Overview
index.ts acts as thin CLI wiring: it registers commands via api.registerCli and delegates to handlers. Business logic lives in src/handlers/ and src/lib/. The plugin exports __internal for test-only access to handlers and lib functions.
File structure
Handler-to-command map
| Handler | Commands |
|---|---|
| recipes | list, show, status, bind, unbind, bindings |
| scaffold | scaffold |
| team | scaffold-team, migrate-team, remove-team |
| tickets | tickets, move-ticket, assign, take, handoff, dispatch, complete |
| install | install-skill (ClawHub skills), install (marketplace recipe), install-recipe (alias) |
| cron | Reconciled during scaffold (no standalone command) |
Shared scaffold flow
Bothscaffold and scaffold-team use:
scaffoldAgentFromRecipe— creates workspace, writes recipe-managed files, applies agent configreconcileRecipeCronJobs— when a recipe declarescronJobs, installs/updates cron jobs percronInstallationconfig
cronJobs in frontmatter.
Data flow
Key decisions
- Tool policy preservation: When a recipe omits
tools, the scaffold preserves the existing agent’s tool policy (rather than resetting it). See scaffold logic and tests. __internalexport: Unit tests import handlers and lib helpers via__internal; these are not part of the public plugin API.
Quality automation
- smell-check:
npm run smell-checkruns:- ESLint:
no-explicit-any,complexity,max-lines-per-function,max-params(src/; index.ts exempt from complexity/lines) - jscpd: Duplicate code detection (≥8 lines, ≥50 tokens)
- Pattern grep:
as anyin src/ (max 10), TODO/FIXME/XXX (max 20)
- ESLint:
- lint:
npm run lint/npm run lint:fix - tests:
npm test(vitest),npm run test:coverage - CI:
.github/workflows/ci.ymlruns test:coverage, smell-check, npm audit
If this doc is outdated, please submit a PR to update it.
