protocodebase-cli
v0.1.10
Published
ProtoCodeBase command line tool for authenticated search and one-command source download.
Downloads
1,018
Maintainers
Readme
ProtoCodeBase CLI (pcb)
pcb is the npm-distributed command line client for ProtoCodeBase search and source download.
Install
npm i -g protocodebase-cliOr run without global install:
npx protocodebase-cli --helpCommands
pcb search [options]
pcb pull [options]
pcb token save --token PCBToken_xxx
pcb token clearsearch and pull both execute the same workflow exposed by cli-search.sh.
Default endpoints:
- Web:
https://protocodebase.com - API:
https://protocodebase.com/api/v1 - Built-in fallback: if API base is unreachable or accidentally points to web not API, CLI can auto-try
https://api.<web-host>/api/v1once (when fallback is enabled). - Optional direct-IP fallback: if you pass
--api-ipor setPROTOCODEBASE_API_IP, CLI keeps the domain API as primary and switches to the direct IP endpoint only after failure.
Override for local development if needed:
export PROTOCODEBASE_WEB_BASE="http://127.0.0.1:9527"
export PROTOCODEBASE_API_BASE="http://127.0.0.1:9528/api/v1"Temporary direct-IP fallback for troubleshooting:
export PROTOCODEBASE_API_IP="8.146.230.241:9528"Optional network compatibility override:
export PROTOCODEBASE_CURL_BIN="/usr/bin/curl"
export PROTOCODEBASE_CURL_TLS_MAX="1.2"By default, CLI does not force TLS version. It only auto-retries once with TLS1.2 when handshake fails.
API fallback behavior:
- CLI may auto-switch API base to
api.<web-host>/api/v1when current API base looks wrong. - If
--api-iporPROTOCODEBASE_API_IPis provided, CLI may switch again tohttp://<ip>:9528/api/v1after the domain endpoint still fails. - When API base points to local/tunnel/private address (for example
127.0.0.1,localhost,10.x,192.168.x,172.16-31.x), auto-switch is disabled to avoid breaking SSH tunnel workflows. - You can explicitly disable or enable:
export PROTOCODEBASE_DISABLE_API_FALLBACK=1
# or
export PROTOCODEBASE_ENABLE_API_FALLBACK=1Common Examples
pcb search --query "时间管理" --pick 1
pcb search --query "时间管理" --api-ip "8.146.230.241:9528" --pick 1
pcb search --query "时间管理" --project-name "my_project"
pcb pull --slug "timediary-1775372092457" --save-path "/abs/path/project_root" --yes
pcb token save --token "PCBToken_xxx"Output Layout
After confirmation:
- Protocol files are written directly to project root.
- Code repository is downloaded to
<project-root>/<repo-name>.
If no --project-name or --save-path is provided, a non-conflicting root folder is auto-created as new-project-x.
