Project Structure
patb-cli/ (repository root)
├── src/ # CLI TypeScript source
│ ├── index.ts # Entrypoint: loads config, parses argv, dispatches mode
│ ├── config.ts # .env / env var loading, PATBA_API_KEY, key masking
│ ├── cli.ts # Interactive REPL (default mode)
│ ├── bridge.ts # Zed ACP JSON-RPC 2.0 bridge server (--bridge/-b mode)
│ └── remote.ts # HTTPS client for the remote agent service
├── dist/ # Compiled JS output (generated by `npm run build`, gitignored)
├── docs/ # Docusaurus documentation website (this site)
│ ├── docs/ # Markdown/MDX docs content (this section + End-User docs)
│ ├── blog/ # Project blog
│ ├── planning/ # Design/implementation plans for the docs site itself
│ ├── src/ # Docusaurus theme customizations (homepage, CSS)
│ ├── static/ # Static assets (images, icons)
│ └── docusaurus.config.ts # Site configuration
├── .github/workflows/ # CI: docs deployment to GitHub Pages
├── package.json # CLI package manifest, `bin`, build/docs scripts
├── tsconfig.json # TypeScript compiler configuration for src/
├── README.md
└── .gitignore
Root package.json scripts
| Script | Purpose |
|---|---|
npm run build | Compiles src/ to dist/ via tsc. |
npm run docs:install | Installs the docs/ Docusaurus project's dependencies. |
npm run docs:start | Runs the Docusaurus dev server (from docs/). |
npm run docs:build | Builds the static documentation site (from docs/). |
Module responsibilities
index.tsis the only file that inspectsprocess.argv; it decides between bridge mode, help, and the default REPL, and is the single place configuration is loaded vialoadConfig().config.tsisolates all environment/credential concerns so bothcli.tsandbridge.tsreceive an already-validatedapiKeystring.remote.tsisolates all HTTP/SSE communication with the remote agent service; it has no knowledge of REPL or bridge concerns, so both consumers share the exact same network behavior.cli.tsandbridge.tsare the two "front ends": they both callcreateAWSThread/triggerAWSRun/connectAWSStreamfromremote.ts, but format/transport the results differently (human-readable terminal output vs. JSON-RPCsession/updatenotifications).
See Architecture for how these modules interact at runtime, and Source Code Reference for a per-file breakdown.