Skip to main content

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

ScriptPurpose
npm run buildCompiles src/ to dist/ via tsc.
npm run docs:installInstalls the docs/ Docusaurus project's dependencies.
npm run docs:startRuns the Docusaurus dev server (from docs/).
npm run docs:buildBuilds the static documentation site (from docs/).

Module responsibilities

  • index.ts is the only file that inspects process.argv; it decides between bridge mode, help, and the default REPL, and is the single place configuration is loaded via loadConfig().
  • config.ts isolates all environment/credential concerns so both cli.ts and bridge.ts receive an already-validated apiKey string.
  • remote.ts isolates 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.ts and bridge.ts are the two "front ends": they both call createAWSThread / triggerAWSRun / connectAWSStream from remote.ts, but format/transport the results differently (human-readable terminal output vs. JSON-RPC session/update notifications).

See Architecture for how these modules interact at runtime, and Source Code Reference for a per-file breakdown.