This file provides curated, minimal guidance for AI agents working in this repo. Rules are prioritized (MUST > SHOULD) so agents know what to enforce vs. what to prefer. Detailed workflows live in playbooks loaded on demand — not inlined here.
If something behaves unexpectedly (a test fails for unclear reasons, a build breaks in a surprising way, a dependency does something unusual):
- Stop — do not retry in a loop or force your way through.
- Investigate — read error output, check recent commits, look at related code.
- Document — if you discover a non-obvious gotcha, tell the user so it can be captured.
bitsocial-cli is an oclif-based CLI + daemon for the BitSocial protocol (built on top of pkc-js). It manages communities, challenges, IPFS nodes, and web UIs from the command line.
| Level | Meaning |
|---|---|
| MUST | Non-negotiable. Breaking these causes failures or bad releases. |
| SHOULD | Strong default. Override only with good reason. |
Quick lookup — find your situation, follow the required actions:
| Situation | Do this |
|---|---|
| First time / fresh clone | nvm use → npm ci → npm run build |
Changed any .ts file |
npm run build && npm run build:test |
| Running tests | npm run test:cli |
| Added feature or fixed bug | Write a test → build → run tests |
| Installing a dependency | nvm use first, then npm install ... |
| Before committing | Build passes, all tests pass |
| Layer | Technology |
|---|---|
| Runtime | Node 22 (nvm use reads .nvmrc) |
| Language | TypeScript (ESM, "type": "module") |
| CLI framework | oclif |
| Test runner | Vitest |
| Package mgr | npm (not yarn, not pnpm) |
| Build | tsc with configs in config/ |
src/
├── cli/
│ ├── commands/ # oclif command implementations
│ │ ├── challenge/ # challenge-related subcommands
│ │ └── community/ # community-related subcommands
│ └── hooks/ # oclif lifecycle hooks (init, prerun)
├── challenge-packages/ # challenge package logic
├── common-utils/ # shared utilities
├── ipfs/ # IPFS/Kubo node management
├── webui/ # web UI download & serving
├── util.ts # top-level utility helpers
└── index.ts # package entry point
When the user gives a prompt to implement a feature:
- MUST create a GitHub issue for the feature before starting work (
gh issue create). - MUST keep the issue updated with the current plan and progress as work proceeds.
- MUST ask the user whether to close the issue after the feature is fully implemented and verified — do not close it automatically or via
Closes #Nin commit messages.
- MUST run
nvm usebefore any npm command (npm ci,npm install,npm run, etc.). - MUST use npm, never yarn or pnpm.
- MUST verify build passes after any code change:
npm run build && npm run build:test. - MUST run tests with
npm run test:cli(notvitestdirectly — the script downloads web UIs first). - MUST ensure all tests pass before committing.
- MUST add a test when you add a feature or fix a bug.
- SHOULD keep changes focused — avoid unrelated refactors in the same commit.
- SHOULD prefer editing existing files over creating new ones.
- SHOULD check
config/for tsconfig and vitest settings before assuming defaults.
nvm use # switch to project's Node version
npm ci # clean install dependencies
npm run build # compile TypeScript → dist/
npm run build:test # compile test TypeScript
npm run build && npm run build:test # full build check
npm run test:cli # run all tests (downloads web UIs first)
npm run build:watch # watch mode for main build
npm run build:test:watch # watch mode for test buildNo playbooks yet. As recurring workflows emerge (e.g., release process, adding a new command, upgrading pkc-js), create them as separate files and reference them here.