codebyplan 1.13.65 → 1.13.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/README.md +118 -75
  2. package/dist/__tests__/helpers.d.ts +22 -0
  3. package/dist/__tests__/helpers.d.ts.map +1 -0
  4. package/dist/ci-public.d.ts +20 -0
  5. package/dist/ci-public.d.ts.map +1 -0
  6. package/dist/ci.js +11 -2
  7. package/dist/cli/arch-map.d.ts +33 -0
  8. package/dist/cli/arch-map.d.ts.map +1 -0
  9. package/dist/cli/branch.d.ts +10 -0
  10. package/dist/cli/branch.d.ts.map +1 -0
  11. package/dist/cli/bump.d.ts +12 -0
  12. package/dist/cli/bump.d.ts.map +1 -0
  13. package/dist/cli/cd.d.ts +20 -0
  14. package/dist/cli/cd.d.ts.map +1 -0
  15. package/dist/cli/check.d.ts +30 -0
  16. package/dist/cli/check.d.ts.map +1 -0
  17. package/dist/cli/checkpoint.d.ts +17 -0
  18. package/dist/cli/checkpoint.d.ts.map +1 -0
  19. package/dist/cli/ci.d.ts +31 -0
  20. package/dist/cli/ci.d.ts.map +1 -0
  21. package/dist/cli/claude/__test-helpers__/expect-manifest.d.ts +7 -0
  22. package/dist/cli/claude/__test-helpers__/expect-manifest.d.ts.map +1 -0
  23. package/dist/cli/claude/__test-helpers__/tmp-fixture.d.ts +64 -0
  24. package/dist/cli/claude/__test-helpers__/tmp-fixture.d.ts.map +1 -0
  25. package/dist/cli/claude/audit-mode.d.ts +16 -0
  26. package/dist/cli/claude/audit-mode.d.ts.map +1 -0
  27. package/dist/cli/claude/generate.d.ts +23 -0
  28. package/dist/cli/claude/generate.d.ts.map +1 -0
  29. package/dist/cli/claude/install.d.ts +55 -0
  30. package/dist/cli/claude/install.d.ts.map +1 -0
  31. package/dist/cli/claude/migrate-memory.d.ts +117 -0
  32. package/dist/cli/claude/migrate-memory.d.ts.map +1 -0
  33. package/dist/cli/claude/readme.d.ts +28 -0
  34. package/dist/cli/claude/readme.d.ts.map +1 -0
  35. package/dist/cli/claude/status.d.ts +41 -0
  36. package/dist/cli/claude/status.d.ts.map +1 -0
  37. package/dist/cli/claude/uninstall.d.ts +21 -0
  38. package/dist/cli/claude/uninstall.d.ts.map +1 -0
  39. package/dist/cli/claude/update.d.ts +25 -0
  40. package/dist/cli/claude/update.d.ts.map +1 -0
  41. package/dist/cli/claude/verify-parity.d.ts +25 -0
  42. package/dist/cli/claude/verify-parity.d.ts.map +1 -0
  43. package/dist/cli/cleanup-plan-folders.d.ts +21 -0
  44. package/dist/cli/cleanup-plan-folders.d.ts.map +1 -0
  45. package/dist/cli/commit.d.ts +25 -0
  46. package/dist/cli/commit.d.ts.map +1 -0
  47. package/dist/cli/config.d.ts +50 -0
  48. package/dist/cli/config.d.ts.map +1 -0
  49. package/dist/cli/confirm.d.ts +9 -0
  50. package/dist/cli/confirm.d.ts.map +1 -0
  51. package/dist/cli/create-org.d.ts +9 -0
  52. package/dist/cli/create-org.d.ts.map +1 -0
  53. package/dist/cli/create-project.d.ts +10 -0
  54. package/dist/cli/create-project.d.ts.map +1 -0
  55. package/dist/cli/create-repo.d.ts +14 -0
  56. package/dist/cli/create-repo.d.ts.map +1 -0
  57. package/dist/cli/docs.d.ts +41 -0
  58. package/dist/cli/docs.d.ts.map +1 -0
  59. package/dist/cli/doctor.d.ts +17 -0
  60. package/dist/cli/doctor.d.ts.map +1 -0
  61. package/dist/cli/e2e/verify-round.d.ts +46 -0
  62. package/dist/cli/e2e/verify-round.d.ts.map +1 -0
  63. package/dist/cli/e2e.d.ts +11 -0
  64. package/dist/cli/e2e.d.ts.map +1 -0
  65. package/dist/cli/eslint.d.ts +20 -0
  66. package/dist/cli/eslint.d.ts.map +1 -0
  67. package/dist/cli/export-writer.d.ts +99 -0
  68. package/dist/cli/export-writer.d.ts.map +1 -0
  69. package/dist/cli/handoff.d.ts +13 -0
  70. package/dist/cli/handoff.d.ts.map +1 -0
  71. package/dist/cli/login.d.ts +10 -0
  72. package/dist/cli/login.d.ts.map +1 -0
  73. package/dist/cli/logout.d.ts +2 -0
  74. package/dist/cli/logout.d.ts.map +1 -0
  75. package/dist/cli/lsp.d.ts +16 -0
  76. package/dist/cli/lsp.d.ts.map +1 -0
  77. package/dist/cli/migration-collisions.d.ts +10 -0
  78. package/dist/cli/migration-collisions.d.ts.map +1 -0
  79. package/dist/cli/ports.d.ts +29 -0
  80. package/dist/cli/ports.d.ts.map +1 -0
  81. package/dist/cli/process-exit-signal.d.ts +24 -0
  82. package/dist/cli/process-exit-signal.d.ts.map +1 -0
  83. package/dist/cli/round.d.ts +79 -0
  84. package/dist/cli/round.d.ts.map +1 -0
  85. package/dist/cli/scaffold-publish-workflow.d.ts +16 -0
  86. package/dist/cli/scaffold-publish-workflow.d.ts.map +1 -0
  87. package/dist/cli/session/freshness-gate.d.ts +21 -0
  88. package/dist/cli/session/freshness-gate.d.ts.map +1 -0
  89. package/dist/cli/session/home-ff.d.ts +16 -0
  90. package/dist/cli/session/home-ff.d.ts.map +1 -0
  91. package/dist/cli/session/infra-files.d.ts +21 -0
  92. package/dist/cli/session/infra-files.d.ts.map +1 -0
  93. package/dist/cli/session/start.d.ts +70 -0
  94. package/dist/cli/session/start.d.ts.map +1 -0
  95. package/dist/cli/session.d.ts +17 -0
  96. package/dist/cli/session.d.ts.map +1 -0
  97. package/dist/cli/setup.d.ts +2 -0
  98. package/dist/cli/setup.d.ts.map +1 -0
  99. package/dist/cli/ship.d.ts +16 -0
  100. package/dist/cli/ship.d.ts.map +1 -0
  101. package/dist/cli/slug.d.ts +10 -0
  102. package/dist/cli/slug.d.ts.map +1 -0
  103. package/dist/cli/standalone-task.d.ts +31 -0
  104. package/dist/cli/standalone-task.d.ts.map +1 -0
  105. package/dist/cli/statusline.d.ts +10 -0
  106. package/dist/cli/statusline.d.ts.map +1 -0
  107. package/dist/cli/supabase/new-migration.d.ts +24 -0
  108. package/dist/cli/supabase/new-migration.d.ts.map +1 -0
  109. package/dist/cli/supabase/preview-check.d.ts +30 -0
  110. package/dist/cli/supabase/preview-check.d.ts.map +1 -0
  111. package/dist/cli/supabase/resolve-preview.d.ts +19 -0
  112. package/dist/cli/supabase/resolve-preview.d.ts.map +1 -0
  113. package/dist/cli/supabase/teardown-preview.d.ts +22 -0
  114. package/dist/cli/supabase/teardown-preview.d.ts.map +1 -0
  115. package/dist/cli/sync.d.ts +13 -0
  116. package/dist/cli/sync.d.ts.map +1 -0
  117. package/dist/cli/task.d.ts +17 -0
  118. package/dist/cli/task.d.ts.map +1 -0
  119. package/dist/cli/tech-stack.d.ts +11 -0
  120. package/dist/cli/tech-stack.d.ts.map +1 -0
  121. package/dist/cli/upgrade-auth.d.ts +2 -0
  122. package/dist/cli/upgrade-auth.d.ts.map +1 -0
  123. package/dist/cli/upload-e2e-images.d.ts +18 -0
  124. package/dist/cli/upload-e2e-images.d.ts.map +1 -0
  125. package/dist/cli/validate-waves.d.ts +22 -0
  126. package/dist/cli/validate-waves.d.ts.map +1 -0
  127. package/dist/cli/version-status.d.ts +42 -0
  128. package/dist/cli/version-status.d.ts.map +1 -0
  129. package/dist/cli/watch.d.ts +18 -0
  130. package/dist/cli/watch.d.ts.map +1 -0
  131. package/dist/cli/whoami.d.ts +5 -0
  132. package/dist/cli/whoami.d.ts.map +1 -0
  133. package/dist/cli/worktree/add.d.ts +81 -0
  134. package/dist/cli/worktree/add.d.ts.map +1 -0
  135. package/dist/cli/worktree/create.d.ts +46 -0
  136. package/dist/cli/worktree/create.d.ts.map +1 -0
  137. package/dist/cli/worktree/path.d.ts +19 -0
  138. package/dist/cli/worktree/path.d.ts.map +1 -0
  139. package/dist/cli/worktree/remove.d.ts +60 -0
  140. package/dist/cli/worktree/remove.d.ts.map +1 -0
  141. package/dist/cli/worktree.d.ts +15 -0
  142. package/dist/cli/worktree.d.ts.map +1 -0
  143. package/dist/cli.js +5613 -5328
  144. package/dist/dispatch.d.ts +64 -0
  145. package/dist/dispatch.d.ts.map +1 -0
  146. package/dist/index.d.ts +2 -0
  147. package/dist/index.d.ts.map +1 -0
  148. package/dist/lib/agents-generator.d.ts +42 -0
  149. package/dist/lib/agents-generator.d.ts.map +1 -0
  150. package/dist/lib/api.d.ts +54 -0
  151. package/dist/lib/api.d.ts.map +1 -0
  152. package/dist/lib/atomic-write.d.ts +27 -0
  153. package/dist/lib/atomic-write.d.ts.map +1 -0
  154. package/dist/lib/branch-checkout.d.ts +47 -0
  155. package/dist/lib/branch-checkout.d.ts.map +1 -0
  156. package/dist/lib/branch-port-resolver.d.ts +58 -0
  157. package/dist/lib/branch-port-resolver.d.ts.map +1 -0
  158. package/dist/lib/bump.d.ts +97 -0
  159. package/dist/lib/bump.d.ts.map +1 -0
  160. package/dist/lib/cd-init.d.ts +86 -0
  161. package/dist/lib/cd-init.d.ts.map +1 -0
  162. package/dist/lib/check-baseline.d.ts +91 -0
  163. package/dist/lib/check-baseline.d.ts.map +1 -0
  164. package/dist/lib/check.d.ts +178 -0
  165. package/dist/lib/check.d.ts.map +1 -0
  166. package/dist/lib/ci-init.d.ts +106 -0
  167. package/dist/lib/ci-init.d.ts.map +1 -0
  168. package/dist/lib/ci-resolve.d.ts +60 -0
  169. package/dist/lib/ci-resolve.d.ts.map +1 -0
  170. package/dist/lib/claude-mode-audit.d.ts +41 -0
  171. package/dist/lib/claude-mode-audit.d.ts.map +1 -0
  172. package/dist/lib/claude-plan.d.ts +34 -0
  173. package/dist/lib/claude-plan.d.ts.map +1 -0
  174. package/dist/lib/commit-scope.d.ts +21 -0
  175. package/dist/lib/commit-scope.d.ts.map +1 -0
  176. package/dist/lib/e2e.d.ts +157 -0
  177. package/dist/lib/e2e.d.ts.map +1 -0
  178. package/dist/lib/eslint-generator.d.ts +86 -0
  179. package/dist/lib/eslint-generator.d.ts.map +1 -0
  180. package/dist/lib/file-lock.d.ts +44 -0
  181. package/dist/lib/file-lock.d.ts.map +1 -0
  182. package/dist/lib/flags.d.ts +115 -0
  183. package/dist/lib/flags.d.ts.map +1 -0
  184. package/dist/lib/gh-required-checks.d.ts +76 -0
  185. package/dist/lib/gh-required-checks.d.ts.map +1 -0
  186. package/dist/lib/git-utils.d.ts +46 -0
  187. package/dist/lib/git-utils.d.ts.map +1 -0
  188. package/dist/lib/gitignore-block.d.ts +32 -0
  189. package/dist/lib/gitignore-block.d.ts.map +1 -0
  190. package/dist/lib/gitignore-detect.d.ts +117 -0
  191. package/dist/lib/gitignore-detect.d.ts.map +1 -0
  192. package/dist/lib/handoff-file.d.ts +63 -0
  193. package/dist/lib/handoff-file.d.ts.map +1 -0
  194. package/dist/lib/hash.d.ts +9 -0
  195. package/dist/lib/hash.d.ts.map +1 -0
  196. package/dist/lib/lsp-detect.d.ts +42 -0
  197. package/dist/lib/lsp-detect.d.ts.map +1 -0
  198. package/dist/lib/manifest.d.ts +88 -0
  199. package/dist/lib/manifest.d.ts.map +1 -0
  200. package/dist/lib/mcp-client.d.ts +39 -0
  201. package/dist/lib/mcp-client.d.ts.map +1 -0
  202. package/dist/lib/migrate-branch-model.d.ts +34 -0
  203. package/dist/lib/migrate-branch-model.d.ts.map +1 -0
  204. package/dist/lib/migrate-local-config.d.ts +39 -0
  205. package/dist/lib/migrate-local-config.d.ts.map +1 -0
  206. package/dist/lib/migration-collisions.d.ts +61 -0
  207. package/dist/lib/migration-collisions.d.ts.map +1 -0
  208. package/dist/lib/port-verify.d.ts +73 -0
  209. package/dist/lib/port-verify.d.ts.map +1 -0
  210. package/dist/lib/prompt.d.ts +41 -0
  211. package/dist/lib/prompt.d.ts.map +1 -0
  212. package/dist/lib/readme-generator.d.ts +108 -0
  213. package/dist/lib/readme-generator.d.ts.map +1 -0
  214. package/dist/lib/repo-reader.d.ts +59 -0
  215. package/dist/lib/repo-reader.d.ts.map +1 -0
  216. package/dist/lib/scaffold-cd-workflow.d.ts +48 -0
  217. package/dist/lib/scaffold-cd-workflow.d.ts.map +1 -0
  218. package/dist/lib/scaffold-ci-workflow.d.ts +83 -0
  219. package/dist/lib/scaffold-ci-workflow.d.ts.map +1 -0
  220. package/dist/lib/scaffold-publish-workflow.d.ts +48 -0
  221. package/dist/lib/scaffold-publish-workflow.d.ts.map +1 -0
  222. package/dist/lib/server-detect.d.ts +20 -0
  223. package/dist/lib/server-detect.d.ts.map +1 -0
  224. package/dist/lib/session.d.ts +371 -0
  225. package/dist/lib/session.d.ts.map +1 -0
  226. package/dist/lib/settings-merge.d.ts +268 -0
  227. package/dist/lib/settings-merge.d.ts.map +1 -0
  228. package/dist/lib/ship.d.ts +84 -0
  229. package/dist/lib/ship.d.ts.map +1 -0
  230. package/dist/lib/slug.d.ts +26 -0
  231. package/dist/lib/slug.d.ts.map +1 -0
  232. package/dist/lib/spawn.d.ts +12 -0
  233. package/dist/lib/spawn.d.ts.map +1 -0
  234. package/dist/lib/state-client.d.ts +54 -0
  235. package/dist/lib/state-client.d.ts.map +1 -0
  236. package/dist/lib/state-store.d.ts +153 -0
  237. package/dist/lib/state-store.d.ts.map +1 -0
  238. package/dist/lib/state-sync.d.ts +101 -0
  239. package/dist/lib/state-sync.d.ts.map +1 -0
  240. package/dist/lib/statusline-config.d.ts +55 -0
  241. package/dist/lib/statusline-config.d.ts.map +1 -0
  242. package/dist/lib/structure-generator.d.ts +63 -0
  243. package/dist/lib/structure-generator.d.ts.map +1 -0
  244. package/dist/lib/supabase.d.ts +87 -0
  245. package/dist/lib/supabase.d.ts.map +1 -0
  246. package/dist/lib/sync-approvals.d.ts +108 -0
  247. package/dist/lib/sync-approvals.d.ts.map +1 -0
  248. package/dist/lib/tech-detect.d.ts +77 -0
  249. package/dist/lib/tech-detect.d.ts.map +1 -0
  250. package/dist/lib/template-walker.d.ts +26 -0
  251. package/dist/lib/template-walker.d.ts.map +1 -0
  252. package/dist/lib/templates-dir.d.ts +25 -0
  253. package/dist/lib/templates-dir.d.ts.map +1 -0
  254. package/dist/lib/types.d.ts +843 -0
  255. package/dist/lib/types.d.ts.map +1 -0
  256. package/dist/lib/validate-waves.d.ts +38 -0
  257. package/dist/lib/validate-waves.d.ts.map +1 -0
  258. package/dist/lib/verify-parity.d.ts +154 -0
  259. package/dist/lib/verify-parity.d.ts.map +1 -0
  260. package/dist/lib/version.d.ts +3 -0
  261. package/dist/lib/version.d.ts.map +1 -0
  262. package/dist/lib/watch-daemon.d.ts +114 -0
  263. package/dist/lib/watch-daemon.d.ts.map +1 -0
  264. package/dist/lib/worktree.d.ts +56 -0
  265. package/dist/lib/worktree.d.ts.map +1 -0
  266. package/dist/oauth/browser.d.ts +8 -0
  267. package/dist/oauth/browser.d.ts.map +1 -0
  268. package/dist/oauth/client-registration.d.ts +16 -0
  269. package/dist/oauth/client-registration.d.ts.map +1 -0
  270. package/dist/oauth/device-flow.d.ts +40 -0
  271. package/dist/oauth/device-flow.d.ts.map +1 -0
  272. package/dist/oauth/jwt-decode.d.ts +10 -0
  273. package/dist/oauth/jwt-decode.d.ts.map +1 -0
  274. package/dist/oauth/keychain.d.ts +17 -0
  275. package/dist/oauth/keychain.d.ts.map +1 -0
  276. package/dist/oauth/token-refresh.d.ts +7 -0
  277. package/dist/oauth/token-refresh.d.ts.map +1 -0
  278. package/dist/oauth/types.d.ts +28 -0
  279. package/dist/oauth/types.d.ts.map +1 -0
  280. package/dist/oauth/urls.d.ts +16 -0
  281. package/dist/oauth/urls.d.ts.map +1 -0
  282. package/package.json +5 -6
  283. package/templates/agents/cbp-security-agent.md +0 -1
  284. package/templates/agents/cbp-stripe-agent.md +0 -1
  285. package/templates/agents/cbp-testing-qa-agent.md +0 -1
  286. package/templates/hooks/cbp-skill-context-guard.sh +0 -1
  287. package/templates/hooks/validate-structure-lib.sh +36 -9
  288. package/templates/skills/cbp-checkpoint-check/SKILL.md +0 -1
  289. package/templates/skills/cbp-clear-continue/SKILL.md +0 -1
  290. package/templates/skills/cbp-clear-prep/SKILL.md +0 -1
  291. package/templates/skills/cbp-setup-cd/SKILL.md +0 -1
  292. package/templates/skills/cbp-setup-ci/SKILL.md +0 -1
  293. package/templates/skills/cbp-stripe/SKILL.md +0 -1
package/README.md CHANGED
@@ -1,95 +1,137 @@
1
1
  # codebyplan
2
2
 
3
- CLI for [CodeByPlan](https://codebyplan.com) — AI-powered development planning and tracking.
3
+ CLI for [CodeByPlan](https://codebyplan.com) — AI-powered development planning and tracking. It
4
+ authenticates you, wires Claude Code to the CodeByPlan MCP server, scaffolds the `.claude/` skill /
5
+ agent / hook system into your repo, and runs the planning workflow (checkpoints → tasks → rounds),
6
+ CI/CD setup, and shipping.
4
7
 
5
- ## Installation
8
+ ## Requirements
6
9
 
7
- ```bash
8
- npx codebyplan setup
9
- ```
10
-
11
- This will:
12
-
13
- 1. Sign you in via OAuth (a browser window opens automatically; no API key needed)
14
- 2. Configure Claude Code to connect via remote MCP
15
- 3. Optionally link a repository
16
-
17
- ## Commands
10
+ - **Node.js >= 22.** Realtime sync uses the runtime's native `WebSocket`, which is only available on
11
+ Node 22+.
18
12
 
19
- ### `codebyplan setup`
20
-
21
- Interactive setup wizard. Authenticates via OAuth and configures the MCP server connection.
22
-
23
- ### `codebyplan config`
24
-
25
- Sync repo configuration from the CodeByPlan database to `.codebyplan.json`. Updates `server_port`, `server_type`, `branch_config`, and `port_allocations`. Also runs the worktree self-heal to cache the active worktree ID in memory.
26
-
27
- **Options:**
28
-
29
- | Flag | Description |
30
- | ------------------ | ------------------------------------------------ |
31
- | `--path <dir>` | Project root directory (default: cwd) |
32
- | `--repo-id <uuid>` | Repository ID (default: from `.codebyplan.json`) |
33
- | `--dry-run` | Preview changes without writing |
34
-
35
- **Example:**
13
+ ## Quick start
36
14
 
37
15
  ```bash
38
- codebyplan config
39
- codebyplan config --dry-run
40
- ```
41
-
42
- ### `codebyplan ports`
43
-
44
- Verify port allocations match local `package.json` dev scripts. Reports mismatches and unallocated apps. With `--fix`, auto-creates missing port allocations in the database.
45
-
46
- **Options:**
47
-
48
- | Flag | Description |
49
- | ------------------ | ------------------------------------------------ |
50
- | `--path <dir>` | Project root directory (default: cwd) |
51
- | `--repo-id <uuid>` | Repository ID (default: from `.codebyplan.json`) |
52
- | `--dry-run` | Preview changes without writing |
53
- | `--fix` | Auto-create missing port allocations |
54
-
55
- **Example:**
56
-
57
- ```bash
58
- codebyplan ports
59
- codebyplan ports --fix
60
- codebyplan ports --fix --dry-run
16
+ npx codebyplan setup
61
17
  ```
62
18
 
63
- ### `codebyplan tech-stack`
64
-
65
- Detect and sync tech stack dependencies from all `package.json` files in the project. Also runs the local config migration to move any legacy `worktree_id` from `.codebyplan.json` to the gitignored `.codebyplan.local.json`.
66
-
67
- **Options:**
19
+ `setup` walks you through:
68
20
 
69
- | Flag | Description |
70
- | ------------------ | ------------------------------------------------ |
71
- | `--path <dir>` | Project root directory (default: cwd) |
72
- | `--repo-id <uuid>` | Repository ID (default: from `.codebyplan.json`) |
73
- | `--dry-run` | Preview changes without writing |
21
+ 1. **Authentication** — the OAuth device-code flow is recommended: a browser window opens to sign you
22
+ in and no API key is stored. A legacy API-key path remains as a short-lived shim (deprecated
23
+ 2026-06-30).
24
+ 2. **MCP configuration** writes the `codebyplan` remote-MCP entry (URL only, no secret) into your
25
+ global `~/.claude.json` or the project-local `.mcp.json`.
26
+ 3. **Project init** (optional) — link an existing repository (or create one inline), then scaffold the
27
+ committed `.codebyplan/` config directory and install the `.claude/` assets. Run from a repo root.
74
28
 
75
- **Example:**
29
+ ## Configuration: the `.codebyplan/` directory
76
30
 
77
- ```bash
78
- codebyplan tech-stack
79
- codebyplan tech-stack --dry-run
80
- ```
31
+ Repo configuration lives in a per-concern `.codebyplan/` directory (not a single `.codebyplan.json`).
32
+ The committed files are shared across the team; a few per-device / per-worktree files are gitignored.
81
33
 
82
- ### `codebyplan help`
34
+ | File | Scope | Contents |
35
+ | ---- | ----- | -------- |
36
+ | `repo.json` | committed | `repo_id`, `organization_id`, `project_id` |
37
+ | `server.json` | committed | server port + type, `port_allocations[]` |
38
+ | `git.json` | committed | branch config |
39
+ | `shipment.json` | committed | configured deploy surfaces (Vercel, EAS, Supabase, npm, …) |
40
+ | `ci.json` / `cd.json` | committed | CI / CD source-of-truth read by the workflow generators |
41
+ | `vendor.json`, `statusline.json` | committed | vendor-docs path, statusline display prefs |
42
+ | `device.local.json`, `server.local.json` | gitignored | per-device id, per-worktree ports |
43
+ | `state/` | gitignored | per-worktree hot-path cache of workflow state (synced from the DB) |
83
44
 
84
- Show help message.
45
+ Run `codebyplan config` to (re)sync the committed config from the CodeByPlan database.
85
46
 
86
- ### `codebyplan --version`
47
+ ## Commands
87
48
 
88
- Print the CLI version.
49
+ Run `codebyplan help` for the full usage block, or `codebyplan <command> --help` for a command's
50
+ flags. The command surface:
51
+
52
+ ### Auth & identity
53
+
54
+ | Command | Description |
55
+ | ------- | ----------- |
56
+ | `setup` | Interactive setup — OAuth + MCP config + optional project init |
57
+ | `login [--admin]` | Authenticate via the OAuth device-code flow |
58
+ | `logout` | Clear cached OAuth tokens |
59
+ | `whoami [--json]` | Show the authenticated identity |
60
+ | `upgrade-auth` | Migrate a legacy `x-api-key` MCP config to OAuth |
61
+
62
+ ### Project & config
63
+
64
+ | Command | Description |
65
+ | ------- | ----------- |
66
+ | `config` | Sync repo config from the DB into `.codebyplan/` (`config migrate` upgrades a legacy `.codebyplan.json`) |
67
+ | `ports` | Verify / fix port allocations against local dev scripts |
68
+ | `tech-stack` | Detect and sync tech-stack dependencies |
69
+ | `docs` | Manage the local dependency-docs mirror |
70
+ | `create-org` / `create-project` / `create-repo` | Create an organization / project / repository |
71
+
72
+ ### Planning workflow
73
+
74
+ | Command | Description |
75
+ | ------- | ----------- |
76
+ | `checkpoint` | Checkpoint writes via MCP (create / update / complete / export) |
77
+ | `task` | Checkpoint-bound task writes via MCP |
78
+ | `standalone-task` | Standalone (non-checkpoint) task writes via MCP |
79
+ | `round` | Round helpers (`round sync-approvals`, …) |
80
+ | `session` | Session helpers (home-ff / freshness-gate / infra-files) |
81
+ | `sync` / `watch` | Hydrate `.codebyplan/state/`; run the Realtime down-sync daemon |
82
+
83
+ ### CI / CD & shipping
84
+
85
+ | Command | Description |
86
+ | ------- | ----------- |
87
+ | `ci` / `cd` | CI / CD config management + GitHub Actions workflow scaffolding |
88
+ | `eslint` | Detect the stack, resolve presets, generate `eslint.config.mjs` |
89
+ | `ship` | Ship the current feat branch to production via PR |
90
+ | `bump [--prerelease <id>]` | Detect changed packages and patch-bump versions |
91
+ | `branch` | Branch model migration / checkout |
92
+ | `scaffold-publish-workflow` | Write the publish-on-main GitHub workflow |
93
+ | `upload-e2e-images` | Upload new/changed committed E2E PNGs for a checkpoint |
94
+
95
+ ### Claude assets
96
+
97
+ | Command | Description |
98
+ | ------- | ----------- |
99
+ | `claude install` / `update` / `uninstall` | Manage `.claude/` skills, agents, and hooks |
100
+ | `claude status` | Report package-sync state (drift, version skip, settings drift) |
101
+ | `claude generate` | Write `.claude/generated/structure.md` from local config |
102
+ | `claude readme` | Generate / refresh READMEs for outward-facing units |
103
+ | `claude migrate-memory` | Inventory auto-memory files and emit a migration plan |
104
+ | `claude audit-mode` | Audit the model/effort convention across templates |
105
+
106
+ ### Supabase
107
+
108
+ | Command | Description |
109
+ | ------- | ----------- |
110
+ | `supabase resolve-preview` / `teardown-preview` | Resolve / guard-check a preview branch |
111
+ | `supabase new-migration <name>` | Create a monotonic timestamped migration file |
112
+ | `supabase preview-check` | Poll the GitHub "Supabase Preview" status check |
113
+
114
+ ### Utilities
115
+
116
+ | Command | Description |
117
+ | ------- | ----------- |
118
+ | `check` | Run the unified check matrix (lint, tsc, tests, audit) |
119
+ | `doctor` | Diagnostics: auth, version, settings (always exits 0) |
120
+ | `lsp` | Detect the stack and enable LSP plugins in Claude Code |
121
+ | `arch-map` | Architecture-map status / drift / stamp |
122
+ | `worktree` | Worktree management (add / create / remove) |
123
+ | `e2e` | E2E deterministic gates (verify-round) |
124
+ | `slug <title>` | Convert a title to a git-safe branch slug |
125
+ | `commit --scope-task` | Compute staged files scoped to the active task (JSON) |
126
+ | `migration-collisions` | Detect Supabase migration timestamp collisions pre-merge |
127
+ | `validate-waves` | Validate a plan's `waves[]` against parallel-wave invariants |
128
+ | `cleanup-plan-folders` | Remove stale plan folders |
129
+ | `statusline` | Show or set the statusline renderer (bash / node / python) |
130
+ | `version-status` | Report installed vs latest version + update guard (JSON) |
89
131
 
90
132
  ## MCP Server
91
133
 
92
- Claude Code connects to CodeByPlan via a remote MCP server. The `setup` command configures this automatically:
134
+ Claude Code connects to CodeByPlan via a remote MCP server. `setup` configures this automatically:
93
135
 
94
136
  ```json
95
137
  {
@@ -102,8 +144,9 @@ Claude Code connects to CodeByPlan via a remote MCP server. The `setup` command
102
144
  }
103
145
  ```
104
146
 
105
- Authentication is handled via OAuth Bearer no API key is stored in this file.
147
+ The entry is URL-only authentication is handled by Claude Code's own OAuth handshake against the
148
+ MCP host, so no API key is stored in this file.
106
149
 
107
- ## Learn More
150
+ ## Learn more
108
151
 
109
152
  - [codebyplan.com](https://codebyplan.com)
@@ -0,0 +1,22 @@
1
+ import { vi } from "vitest";
2
+ /**
3
+ * Create a mock fetch response.
4
+ */
5
+ export declare function mockResponse(body: unknown, init?: {
6
+ status?: number;
7
+ headers?: Record<string, string>;
8
+ }): Response;
9
+ /**
10
+ * Install a mock fetch that returns the given responses in order.
11
+ * Returns the mock function for assertions.
12
+ */
13
+ export declare function mockFetch(...responses: Response[]): ReturnType<typeof vi.fn>;
14
+ /**
15
+ * Install a mock fetch that always rejects with the given error.
16
+ */
17
+ export declare function mockFetchError(error: Error): ReturnType<typeof vi.fn>;
18
+ /**
19
+ * Set environment variables for tests. Returns a cleanup function.
20
+ */
21
+ export declare function setEnv(vars: Record<string, string>): () => void;
22
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/__tests__/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B;;GAEG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,EACb,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC3D,QAAQ,CASV;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAY5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAKrE;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,IAAI,CAe/D"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Public generator surface for the `codebyplan/ci` subpath export.
3
+ *
4
+ * Re-exports ONLY the reader interface, the local-fs reader, and the CI
5
+ * generator functions + types. Does NOT import from src/index.ts or any CLI
6
+ * entry so the emitted dist/ci.js bundle stays clean (no process.argv parsing,
7
+ * no keyring, no Supabase client).
8
+ *
9
+ * Import in consuming repos:
10
+ * import { detectPlatforms, buildDefaultCiConfig, LocalFsReader } from 'codebyplan/ci';
11
+ */
12
+ export type { RepoReader } from "./lib/repo-reader.js";
13
+ export { LocalFsReader } from "./lib/repo-reader.js";
14
+ export { detectPlatforms, buildDefaultCiConfig, PLATFORM_COMMAND_MAP, } from "./lib/ci-init.js";
15
+ export type { CiInitOptions, CiInitResult } from "./lib/ci-init.js";
16
+ export { runCiInit } from "./lib/ci-init.js";
17
+ export { runScaffoldCiWorkflow, renderCiWorkflowContent, } from "./lib/scaffold-ci-workflow.js";
18
+ export type { ScaffoldCiWorkflowOptions } from "./lib/scaffold-ci-workflow.js";
19
+ export type { ScaffoldResult } from "./lib/scaffold-publish-workflow.js";
20
+ //# sourceMappingURL=ci-public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-public.d.ts","sourceRoot":"","sources":["../src/ci-public.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,YAAY,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC"}
package/dist/ci.js CHANGED
@@ -45,10 +45,19 @@ import * as path2 from "node:path";
45
45
 
46
46
  // src/lib/atomic-write.ts
47
47
  import * as fs from "node:fs";
48
- function writeJsonAtomic(filePath, value) {
48
+ function writeJsonAtomic(filePath, value, opts = {}) {
49
49
  const tmpPath = filePath + ".tmp";
50
50
  try {
51
- fs.writeFileSync(tmpPath, JSON.stringify(value, null, 2) + "\n", "utf-8");
51
+ fs.writeFileSync(tmpPath, JSON.stringify(value, null, 2) + "\n", {
52
+ encoding: "utf-8",
53
+ ...opts.mode !== void 0 ? { mode: opts.mode } : {}
54
+ });
55
+ if (opts.mode !== void 0 && process.platform !== "win32") {
56
+ try {
57
+ fs.chmodSync(tmpPath, opts.mode);
58
+ } catch {
59
+ }
60
+ }
52
61
  fs.renameSync(tmpPath, filePath);
53
62
  } catch (err) {
54
63
  try {
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `codebyplan arch-map` — architecture map pipeline for .codebyplan/architecture.json.
3
+ *
4
+ * Subcommands:
5
+ * status — enumerate modules; cross-reference architecture.json
6
+ * drift — report modules whose stamped SHA has since changed
7
+ * stamp — update architecture.json with the current SHA for a module
8
+ */
9
+ /**
10
+ * Derive the map-file slug for a module path: replace path separators with `-`,
11
+ * then normalize a leading dot to `dot-` so a dot-prefixed module (e.g. `.github`)
12
+ * maps to a NON-hidden, collision-safe map file (`dot-github.md`). Only the map-file
13
+ * slug is normalized — the manifest `path` keeps the leading dot so `git log -- .github`
14
+ * drift tracking still works.
15
+ */
16
+ export declare function mapFileSlug(modulePath: string): string;
17
+ /**
18
+ * Update YAML frontmatter fields in a map file's content string.
19
+ *
20
+ * Finds the leading `---` ... `---` frontmatter block and replaces
21
+ * `generated_from_sha`, `generated_at`, and optionally `depth` values in-place.
22
+ * All other lines (frontmatter or body) pass through byte-for-byte.
23
+ *
24
+ * Returns null when no valid frontmatter block is found (first non-empty line
25
+ * is not "---", or the closing "---" is missing).
26
+ */
27
+ export declare function updateFrontmatterFields(content: string, fields: {
28
+ generated_from_sha: string;
29
+ generated_at: string;
30
+ depth?: string;
31
+ }): string | null;
32
+ export declare function runArchMapCommand(rest: string[]): Promise<void>;
33
+ //# sourceMappingURL=arch-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arch-map.d.ts","sourceRoot":"","sources":["../../src/cli/arch-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+BH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAGtD;AAoTD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE;IAAE,kBAAkB,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3E,MAAM,GAAG,IAAI,CA0Cf;AAyID,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA8FrE"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CLI handler for `codebyplan branch <subcommand>`.
3
+ *
4
+ * Two-level subcommand dispatcher — no Commander dependency.
5
+ * Subcommands:
6
+ * migrate Rewrite branch_config from 3-branch to 2-tier model
7
+ * checkout Switch/create a branch (replicates cbp-task-start Step 3.3)
8
+ */
9
+ export declare function runBranchCommand(args: string[]): Promise<void>;
10
+ //# sourceMappingURL=branch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/cli/branch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BpE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * CLI handler for `codebyplan bump`.
3
+ *
4
+ * Detects changed workspace packages since the base branch, patch-bumps their
5
+ * versions, and prepends CHANGELOG entries. Does NOT commit or push.
6
+ *
7
+ * Flags:
8
+ * --dry-run Compute and print planned bumps without writing any files
9
+ * --json Write structured JSON output to stdout
10
+ */
11
+ export declare function runBumpCommand(args: string[]): Promise<void>;
12
+ //# sourceMappingURL=bump.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bump.d.ts","sourceRoot":"","sources":["../../src/cli/bump.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA0EH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuClE"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * CLI handler for `codebyplan cd`.
3
+ *
4
+ * Subcommands:
5
+ * init Detect CD surfaces from shipment.json and write/update .codebyplan/cd.json
6
+ * scaffold-workflow Write .github/workflows/publish.yml and release-desktop.yml from bundled templates
7
+ *
8
+ * Flags (all subcommands):
9
+ * --dry-run Preview the operation without writing any files
10
+ * --force Overwrite existing content that differs
11
+ * --project-dir <p> Override the project root (default: cwd)
12
+ * --json Emit structured JSON to stdout
13
+ * --help Print help and exit
14
+ *
15
+ * Flags (scaffold-workflow only):
16
+ * --workflow <name> Which workflow to scaffold: publish | release-desktop (may be repeated)
17
+ * Defaults to both when omitted.
18
+ */
19
+ export declare function runCdCommand(args: string[]): Promise<void>;
20
+ //# sourceMappingURL=cd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cd.d.ts","sourceRoot":"","sources":["../../src/cli/cd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAkHH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgFhE"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * CLI handler for `codebyplan check`.
3
+ *
4
+ * Runs the unified whole-repo + baseline check matrix (gate6, lint, typecheck,
5
+ * tests, audit) and emits a human-readable pipe-table or JSON output.
6
+ *
7
+ * Flags:
8
+ * --scope <round|task|merged> Check scope (default: round)
9
+ * --files <comma-separated> DEPRECATED / NO-OP in whole-repo mode.
10
+ * Emits a notice to stderr and is otherwise ignored.
11
+ * --update-baseline Run checks and write current failing state to
12
+ * .check-baseline.json (seeds/refreshes baseline).
13
+ * --no-baseline STRICT / absolute-green: ignore the baseline so
14
+ * EVERY failing package + GHSA id counts as a
15
+ * failure (any red fails). gate6 unchanged.
16
+ * Mutually exclusive with --update-baseline
17
+ * (the latter is ignored, with a warning).
18
+ * --concurrency <n> Cap turbo task parallelism (turbo --concurrency).
19
+ * The strict whole-repo CI gate passes 1 to
20
+ * serialize package suites and avoid contention
21
+ * flakes; omit it for the dev-loop default.
22
+ * --json Emit structured JSON to stdout instead of the
23
+ * human pipe-table
24
+ *
25
+ * Exit behaviour:
26
+ * process.exitCode = 1 when any hard-fail check fails.
27
+ * Never calls process.exit() directly — caller (index.ts) handles that.
28
+ */
29
+ export declare function runCheckCommand(args: string[]): void;
30
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/cli/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAoOH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA2BpD"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * CLI handler for `codebyplan checkpoint <subcommand>`.
3
+ *
4
+ * Implements local-first write semantics:
5
+ * 1. Snapshot current local file
6
+ * 2. Optimistic local write
7
+ * 3. Backend call via state-client
8
+ * 4a. Success: overwrite local from server response + update entity_hashes
9
+ * 4b. 4xx BackendError: restore snapshot + exit 1 with stderr message
10
+ * 4c. 5xx BackendError / network error: keep local + write _pending/<id>.json + exit 1
11
+ *
12
+ * Subcommands: create | update | complete
13
+ *
14
+ * Uses parseFlagsFromArgs pattern (no Commander dependency).
15
+ */
16
+ export declare function runCheckpointCommand(args: string[]): Promise<void>;
17
+ //# sourceMappingURL=checkpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../src/cli/checkpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAohBH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCxE"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * CLI handler for `codebyplan ci`.
3
+ *
4
+ * Subcommands:
5
+ * init Detect platforms and write/update .codebyplan/ci.json
6
+ * scaffold-workflow Write .github/workflows/ci.yml from the bundled template
7
+ * enforce-check Enforce the required CI status check on a GitHub branch
8
+ * resolve <category> Resolve the shell command for a CI check category
9
+ *
10
+ * Flags (all subcommands):
11
+ * --dry-run Preview the operation without writing any files
12
+ * --force Overwrite existing content that differs
13
+ * --project-dir <p> Override the project root (default: cwd)
14
+ * --json Emit structured JSON to stdout
15
+ * --help Print help and exit
16
+ *
17
+ * Flags (scaffold-workflow only):
18
+ * --pnpm-version <v> pnpm version for {{PNPM_VERSION}} token (default: auto-detected from package.json packageManager, falls back to "10")
19
+ * --node-version <v> Node.js version for {{NODE_VERSION}} token (default: "22")
20
+ * --strict-enforced Emit ci-strict as an enforced gate (default: read .codebyplan/ci.json workflow.strict_check_enforced)
21
+ *
22
+ * Flags (enforce-check only):
23
+ * --branch <b> Branch to enforce (default: "main")
24
+ * --check-name <n> Status check name (default: "Lint + typecheck + test + build")
25
+ *
26
+ * Flags (resolve only):
27
+ * --platform <slug> Platform slug to resolve against (e.g. next_js, nestjs)
28
+ * --json Emit the full CiResolveResult as JSON
29
+ */
30
+ export declare function runCiCommand(args: string[]): Promise<void>;
31
+ //# sourceMappingURL=ci.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci.d.ts","sourceRoot":"","sources":["../../src/cli/ci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAyIH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsLhE"}
@@ -0,0 +1,7 @@
1
+ import { type Manifest } from "../../../lib/manifest.js";
2
+ /**
3
+ * Reads the manifest from projectDir, asserts non-null, then calls checker.
4
+ * Produces a descriptive error on null rather than a TypeError.
5
+ */
6
+ export declare function expectManifest(projectDir: string, checker: (manifest: Manifest) => void): void;
7
+ //# sourceMappingURL=expect-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expect-manifest.d.ts","sourceRoot":"","sources":["../../../../src/cli/claude/__test-helpers__/expect-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEvE;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,GACpC,IAAI,CAKN"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Shape returned by createTmpProject(). A test typically:
3
+ * 1. Seeds `templatesDir` with a tiny replica of packages/codebyplan-package/templates/
4
+ * 2. process.chdir(projectDir) so install/update/uninstall write into projectDir
5
+ * 3. afterEach: restores cwd and calls cleanup()
6
+ */
7
+ export interface TmpProject {
8
+ /** Absolute path to the project root (acts as user's repo). */
9
+ projectDir: string;
10
+ /** Absolute path to the simulated templates dir for the package. */
11
+ templatesDir: string;
12
+ /** Removes BOTH dirs recursively. Idempotent — safe to call multiple times. */
13
+ cleanup: () => void;
14
+ }
15
+ export interface SeedOpts {
16
+ /** Adds a small but representative tree under templatesDir. Default: true. */
17
+ seedDefaultTemplates?: boolean;
18
+ /**
19
+ * When true, also seeds `settings.user.base.json` into templatesDir alongside
20
+ * the project base. The 22 user-scope keys are written using the same shape as
21
+ * the real `templates/settings.user.base.json`.
22
+ */
23
+ userScope?: boolean;
24
+ }
25
+ /**
26
+ * Create two sibling tmp dirs (one for the project, one for the package's
27
+ * templates) using mkdtempSync — fully isolated per-test, no cross-test
28
+ * leakage even when run in parallel.
29
+ *
30
+ * The default seed mirrors the real templates/ layout enough that
31
+ * install/update/uninstall exercise every code path: a couple of skill
32
+ * files, an agent file, a hook .sh, a hooks.json (which the walker skips),
33
+ * and a hooks/README.md (also skipped).
34
+ */
35
+ export declare function createTmpProject(opts?: SeedOpts): TmpProject;
36
+ /** Seed a minimal templates tree representative of the real package layout. */
37
+ export declare function seedMinimalTemplates(templatesDir: string): void;
38
+ /**
39
+ * Seed `settings.user.base.json` into `templatesDir`. Contains only the
40
+ * 22 user-scope owned keys — 21 common keys (matching settings.project.base.json
41
+ * values byte-for-byte) plus `permissions.skipDangerousModePermissionPrompt`.
42
+ *
43
+ * Note: `autoMemoryEnabled` is a common project key (added to
44
+ * settings.project.base.json to ship auto-memory disabled per repo) but is
45
+ * intentionally ABSENT from this user template — auto-memory is per-repository,
46
+ * so the project template alone disables it for every consuming repo's team;
47
+ * user scope would overreach to non-CBP projects.
48
+ *
49
+ * No skills/agents/hooks/rules are seeded — user-scope install never copies
50
+ * template files.
51
+ */
52
+ export declare function seedUserTemplates(templatesDir: string): void;
53
+ /**
54
+ * Create a temporary directory that mimics `~/.claude/` for test isolation.
55
+ * Tests should pass the returned `userDir` path via `deps.userDir` to avoid
56
+ * touching the real home directory.
57
+ *
58
+ * Returns the absolute path and a `cleanup` function that removes it.
59
+ */
60
+ export declare function createTmpUserDir(): {
61
+ userDir: string;
62
+ cleanup: () => void;
63
+ };
64
+ //# sourceMappingURL=tmp-fixture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tmp-fixture.d.ts","sourceRoot":"","sources":["../../../../src/cli/claude/__test-helpers__/tmp-fixture.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,8EAA8E;IAC9E,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,QAAa,GAAG,UAAU,CAqBhE;AAED,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAoG/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAgC5D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAQ3E"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * CLI handler for `codebyplan claude audit-mode`.
3
+ *
4
+ * Scans `templates/agents/*.md` and `templates/skills/* /SKILL.md`, applies
5
+ * the model/effort convention from cbp-build-cc-mode, and emits a
6
+ * pipe-delimited report.
7
+ *
8
+ * Exit codes:
9
+ * 0 — all files comply (zero gaps)
10
+ * 1 — one or more gaps detected
11
+ *
12
+ * Flags:
13
+ * --json Emit entries array as JSON instead of the human table
14
+ */
15
+ export declare function runAuditMode(args: string[]): Promise<void>;
16
+ //# sourceMappingURL=audit-mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-mode.d.ts","sourceRoot":"","sources":["../../../src/cli/claude/audit-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAgEH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BhE"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * I/O orchestrator for `codebyplan claude generate`.
3
+ *
4
+ * Reads LOCAL config + repo layout (offline — no DB/MCP calls) and writes a
5
+ * DETERMINISTIC `.claude/generated/structure.md`.
6
+ *
7
+ * Usage:
8
+ * codebyplan claude generate [--project-dir <path>] [--dry-run]
9
+ *
10
+ * Integration contract (TASK-4 will wire the import line):
11
+ * Add this to .claude/CLAUDE.md where you want the content injected:
12
+ * @.claude/generated/structure.md
13
+ */
14
+ export interface GenerateOpts {
15
+ /** Override the project root (default: cwd). */
16
+ projectDir?: string;
17
+ /** Print the would-be content to stdout, write nothing. */
18
+ dryRun?: boolean;
19
+ /** Exit non-zero when AGENTS.md is missing or drifted. Read-only — writes nothing. */
20
+ check?: boolean;
21
+ }
22
+ export declare function runGenerate(opts: GenerateOpts | Record<string, unknown>): Promise<void>;
23
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/cli/claude/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAqBH,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sFAAsF;IACtF,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAyDD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3C,OAAO,CAAC,IAAI,CAAC,CA4Of"}