codebyplan 1.13.64 → 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 (303) 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 +6194 -5429
  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/github-workflows/ci.yml +5 -0
  287. package/templates/hooks/cbp-session-id-stamp.sh +67 -0
  288. package/templates/hooks/cbp-skill-context-guard.sh +0 -1
  289. package/templates/hooks/cbp-test-hooks.sh +105 -0
  290. package/templates/hooks/validate-structure-lib.sh +36 -9
  291. package/templates/rules/handoff-file-convention.md +65 -0
  292. package/templates/settings.project.base.json +17 -1
  293. package/templates/skills/cbp-checkpoint-check/SKILL.md +0 -1
  294. package/templates/skills/cbp-checkpoint-complete/SKILL.md +32 -0
  295. package/templates/skills/cbp-clear-continue/SKILL.md +23 -2
  296. package/templates/skills/cbp-clear-prep/SKILL.md +22 -2
  297. package/templates/skills/cbp-finalize/SKILL.md +36 -0
  298. package/templates/skills/cbp-session-end/SKILL.md +23 -25
  299. package/templates/skills/cbp-session-start/SKILL.md +24 -2
  300. package/templates/skills/cbp-setup-cd/SKILL.md +0 -1
  301. package/templates/skills/cbp-setup-ci/SKILL.md +0 -1
  302. package/templates/skills/cbp-standalone-task-complete/SKILL.md +32 -0
  303. package/templates/skills/cbp-stripe/SKILL.md +0 -1
@@ -0,0 +1,42 @@
1
+ /**
2
+ * LSP plugin detection and mapping for `codebyplan lsp`.
3
+ *
4
+ * Plugin names are the Claude Code `<lang>-lsp` identifiers discovered by
5
+ * reading the Claude Code settings documentation and the project's .claude/
6
+ * skills/cbp-build-cc-settings/reference/settings-fields.md (enabledPlugins
7
+ * format: `{"plugin@marketplace": true/false}`). These names were
8
+ * research-verified as of 2026-06 — to correct or extend the list, update
9
+ * LSP_TABLE below; the key `plugin` field is the Claude Code plugin registry
10
+ * name and the `binary` field is the executable `which` checks for.
11
+ */
12
+ export interface LspServer {
13
+ language: string;
14
+ plugin: string;
15
+ binary: string;
16
+ npmPackage: string | null;
17
+ installHint: string;
18
+ }
19
+ /**
20
+ * Static LSP table — 11 entries covering the most common languages.
21
+ * Marketplace: claude-plugins-official (auto-available, no extraKnownMarketplaces needed).
22
+ * Key format in settings.json: `${plugin}@claude-plugins-official`
23
+ */
24
+ export declare const LSP_TABLE: LspServer[];
25
+ /**
26
+ * Map an array of detected tech-stack names (as emitted by detectTechStack)
27
+ * to the corresponding LSP server entries from LSP_TABLE.
28
+ *
29
+ * - Matching is case-insensitive.
30
+ * - Result is deduped by `plugin` field — multiple detectedNames that map to
31
+ * the same plugin (e.g. "TypeScript" + "Next.js" both → typescript-lsp)
32
+ * produce a single entry.
33
+ * - Unknown names (not in ALIAS_MAP) are silently ignored.
34
+ */
35
+ export declare function mapTechStackToLsp(detectedNames: string[]): LspServer[];
36
+ /**
37
+ * Check whether a binary is available on the system PATH using `which`.
38
+ * Returns true if found (exit status 0), false for any other outcome
39
+ * (not found, spawnSync error, etc.). Never throws.
40
+ */
41
+ export declare function binaryOnPath(binary: string): boolean;
42
+ //# sourceMappingURL=lsp-detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lsp-detect.d.ts","sourceRoot":"","sources":["../../src/lib/lsp-detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,EAkFhC,CAAC;AAoDF;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAiBtE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIpD"}
@@ -0,0 +1,88 @@
1
+ export interface ManifestEntry {
2
+ /** POSIX-relative source path inside the package's templates dir. */
3
+ src: string;
4
+ /** POSIX-relative destination path inside the project's `.claude/`. */
5
+ dest: string;
6
+ /** sha256 of the file as it was written at install / update time. */
7
+ hash: string;
8
+ }
9
+ export interface Manifest {
10
+ /** Version of codebyplan that produced this manifest. */
11
+ version: string;
12
+ /** ISO timestamp of the most recent install/update. */
13
+ installed_at: string;
14
+ /** Every file currently considered owned by codebyplan. */
15
+ files: ManifestEntry[];
16
+ }
17
+ /** Current manifest filename (post-CHK-132 merge — canonical for the merged codebyplan package). */
18
+ export declare const NEW_MANIFEST_FILENAME = ".cbp.manifest.json";
19
+ /** Mid-gen manifest filename (post-CHK-113 cbp- prefix migration, pre-CHK-132). */
20
+ export declare const MID_MANIFEST_FILENAME = ".cbp-claude.manifest.json";
21
+ /** Legacy manifest filename (pre-CHK-113). Kept for backward-compat reads + uninstall cleanup. */
22
+ export declare const OLD_MANIFEST_FILENAME = ".codebyplan-claude.manifest.json";
23
+ /** Manifest location is fixed under `.claude/` so uninstall can locate it. */
24
+ export declare function manifestPath(projectDir: string): string;
25
+ /** Mid-gen manifest location — used by readManifest fallback + uninstall cleanup. */
26
+ export declare function midManifestPath(projectDir: string): string;
27
+ /** Legacy manifest location — used by readManifest fallback + uninstall cleanup. */
28
+ export declare function oldManifestPath(projectDir: string): string;
29
+ /**
30
+ * Read the manifest from disk. Returns `null` when no manifest file exists
31
+ * (i.e. codebyplan has never been installed in this project).
32
+ *
33
+ * Three-tier read: prefers the current filename; falls back to the mid-gen
34
+ * filename (.cbp-claude.manifest.json from CHK-113); then falls back to the
35
+ * legacy filename (.codebyplan-claude.manifest.json pre-CHK-113). The next
36
+ * `writeManifest` call always writes to the new canonical path — running
37
+ * `install` or `update` against a legacy install effectively completes the
38
+ * migration on first invocation.
39
+ *
40
+ * A corrupt manifest throws — it is an exceptional state and refusing to
41
+ * proceed is safer than silently treating it as "no install" (which would
42
+ * happily overwrite user files).
43
+ */
44
+ export declare function readManifest(projectDir: string): Manifest | null;
45
+ export declare function writeManifest(projectDir: string, manifest: Manifest): void;
46
+ export declare function defaultManifest(): Manifest;
47
+ /**
48
+ * User-scope manifest location — defaults to `~/.claude/.cbp.manifest.json`.
49
+ * Pass `userDir` to target a different directory (used by tests to redirect
50
+ * away from the real home directory).
51
+ */
52
+ export declare function userManifestPath(userDir?: string): string;
53
+ /**
54
+ * User-scope mid-gen manifest location — for migration fallback.
55
+ */
56
+ export declare function userMidManifestPath(userDir?: string): string;
57
+ /**
58
+ * User-scope legacy manifest location — for migration fallback.
59
+ */
60
+ export declare function userOldManifestPath(userDir?: string): string;
61
+ /**
62
+ * Return the manifest path for the given scope.
63
+ * - `'user'` → `<userDir ?? ~/.claude>/.cbp.manifest.json`
64
+ * - `'project'` → `<projectDir>/.claude/.cbp.manifest.json`
65
+ */
66
+ export declare function manifestPathForScope(scope: "user" | "project", projectDir: string, userDir?: string): string;
67
+ /**
68
+ * Read the manifest for the given scope. Returns `null` when no manifest
69
+ * file exists (i.e. the package has never been installed at that scope).
70
+ *
71
+ * Three-tier fallback applies to both scopes.
72
+ *
73
+ * Overloaded so callers don't pass a meaningless `projectDir` when scope === 'user':
74
+ * readManifestForScope('user', userDir?)
75
+ * readManifestForScope('project', projectDir)
76
+ */
77
+ export declare function readManifestForScope(scope: "user", userDir?: string): Manifest | null;
78
+ export declare function readManifestForScope(scope: "project", projectDir: string): Manifest | null;
79
+ /**
80
+ * Write the manifest for the given scope.
81
+ *
82
+ * Overloaded so callers don't pass a meaningless `projectDir` when scope === 'user':
83
+ * writeManifestForScope('user', manifest, userDir?)
84
+ * writeManifestForScope('project', manifest, projectDir)
85
+ */
86
+ export declare function writeManifestForScope(scope: "user", manifest: Manifest, userDir?: string): void;
87
+ export declare function writeManifestForScope(scope: "project", manifest: Manifest, projectDir: string): void;
88
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/lib/manifest.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAC;IACZ,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,oGAAoG;AACpG,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AAEjE,kGAAkG;AAClG,eAAO,MAAM,qBAAqB,qCAAqC,CAAC;AAExE,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAiBhE;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAgB1E;AAED,wBAAgB,eAAe,IAAI,QAAQ,CAM1C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAIR;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GACf,QAAQ,GAAG,IAAI,CAAC;AACnB,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,MAAM,GACjB,QAAQ,GAAG,IAAI,CAAC;AA6BnB;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAAC;AACR,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM,GACjB,IAAI,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Minimal MCP JSON-RPC client for the standalone MCP server (mcp.codebyplan.com).
3
+ *
4
+ * Auth: Bearer JWT only. The standalone MCP host validates an OAuth access
5
+ * token (Authorization: Bearer ...) and rejects x-api-key with 401. The token
6
+ * is sourced from getAccessToken() (auto-refreshing); a not-logged-in caller
7
+ * gets a clear "run codebyplan login" error rather than a doomed request.
8
+ *
9
+ * Host: resolved via mcpEndpoint() (oauth/urls.ts) — the single source of
10
+ * truth for the CLI MCP base URL, shared with api.ts callMcpTool.
11
+ *
12
+ * Why this exists separately from api.ts callMcpTool:
13
+ * Several round/task endpoints are not implemented as REST routes in
14
+ * apps/web (no /api/rounds/[id] folder at all; /api/tasks/[id] exports
15
+ * GET+PUT+DELETE but no PATCH). The MCP server exposes the underlying
16
+ * tools (get_rounds, get_current_task, update_round, update_task) and is
17
+ * the canonical write path. Unlike callMcpTool (a thin fire-and-forget
18
+ * returning raw json.result), this client does full JSON-RPC envelope +
19
+ * SSE-frame parsing and returns the typed content payload — which the
20
+ * round write path depends on.
21
+ *
22
+ * Response shape:
23
+ * { jsonrpc: "2.0", id, result: { content: [{ type: "text", text: "<JSON>" }] } }
24
+ *
25
+ * Tool-level errors surface as result.isError=true with an "Error: ..."
26
+ * text payload; protocol-level errors surface as JSON-RPC error objects.
27
+ */
28
+ export declare class McpError extends Error {
29
+ status?: number;
30
+ code?: string;
31
+ constructor(message: string, status?: number, code?: string);
32
+ }
33
+ /**
34
+ * Invoke an MCP tool by name. Returns the parsed JSON payload from
35
+ * result.content[0].text as T. Throws McpError on transport, protocol,
36
+ * or tool-level errors.
37
+ */
38
+ export declare function mcpCall<T>(toolName: string, args: Record<string, unknown>): Promise<T>;
39
+ //# sourceMappingURL=mcp-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../../src/lib/mcp-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,qBAAa,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;gBAEF,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAM5D;AAcD;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC7B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,CAAC,CAAC,CA2FZ"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Pure library: branch-model migration from 3-branch to 2-tier model.
3
+ *
4
+ * Rewrites branch_config in .codebyplan/git.json (or legacy .codebyplan.json)
5
+ * from { integration: "development", staging: null, protected: ["main","development"], production: "main" }
6
+ * to { integration: null, staging: null, protected: ["main"], production: "main" }
7
+ *
8
+ * Idempotent — second run is a no-op. NEVER deletes remote branches.
9
+ */
10
+ export type BranchConfigShape = {
11
+ integration: string | null;
12
+ staging: string | null;
13
+ protected: string[];
14
+ production: string;
15
+ };
16
+ export type BranchMigrateResult = {
17
+ was_dirty: boolean;
18
+ before: BranchConfigShape | null;
19
+ after: BranchConfigShape;
20
+ config_path: string;
21
+ warnings: string[];
22
+ unmerged_check?: {
23
+ integration_branch: string | null;
24
+ unmerged_commits: number | null;
25
+ note: string;
26
+ };
27
+ };
28
+ export type RunBranchMigrationOptions = {
29
+ cwd?: string;
30
+ dryRun?: boolean;
31
+ skipFetch?: boolean;
32
+ };
33
+ export declare function runBranchMigration(opts?: RunBranchMigrationOptions): Promise<BranchMigrateResult>;
34
+ //# sourceMappingURL=migrate-branch-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-branch-model.d.ts","sourceRoot":"","sources":["../../src/lib/migrate-branch-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,iBAAiB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE;QACf,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;QAClC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;QAChC,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AA8HF,wBAAsB,kBAAkB,CACtC,IAAI,CAAC,EAAE,yBAAyB,GAC/B,OAAO,CAAC,mBAAmB,CAAC,CAsI9B"}
@@ -0,0 +1,39 @@
1
+ export interface MigrationResult {
2
+ /** Operation completed (always true on a non-throwing return). */
3
+ migrated: true;
4
+ /**
5
+ * True iff actual layout files were written (i.e. a genuine migration
6
+ * occurred). False means the call was a structural no-op (already on new
7
+ * layout).
8
+ */
9
+ was_dirty: boolean;
10
+ /**
11
+ * Files actually written to or deleted from disk during migration.
12
+ */
13
+ files_changed: string[];
14
+ summary: string;
15
+ }
16
+ /**
17
+ * Returns `true` iff `.codebyplan.json` exists at `projectPath` AND
18
+ * `.codebyplan/repo.json` does NOT exist at `projectPath`.
19
+ *
20
+ * Any I/O error → `false` (best-effort detection, quiet by design).
21
+ */
22
+ export declare function needsLocalMigration(projectPath: string): Promise<boolean>;
23
+ /**
24
+ * Migrates the legacy `.codebyplan.json` + `.codebyplan.local.json` layout
25
+ * to the new `.codebyplan/` directory layout.
26
+ *
27
+ * Behavior tree (in order):
28
+ * 1. Collision check: if `.codebyplan` exists and is NOT a directory, throw.
29
+ * 2. Fresh new-layout guard: if `.codebyplan/repo.json` exists, return early.
30
+ * 3. Legacy file required: if `.codebyplan.json` absent, return early.
31
+ * 4. Parse legacy JSON.
32
+ * 5. mkdir `.codebyplan/` (recursive).
33
+ * 6. Partition legacy data into per-concern files.
34
+ * 7. Rewrite root `.gitignore` (replace legacy entry).
35
+ * 8. Delete legacy files.
36
+ * 9. Idempotency: step 2 handles re-invocation.
37
+ */
38
+ export declare function runLocalMigration(projectPath: string): Promise<MigrationResult>;
39
+ //# sourceMappingURL=migrate-local-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-local-config.d.ts","sourceRoot":"","sources":["../../src/lib/migrate-local-config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,QAAQ,EAAE,IAAI,CAAC;IACf;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAuCD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC,CAclB;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC,CAkO1B"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Migration timestamp collision detection.
3
+ *
4
+ * Replicates cbp-merge-main Step 1.5 comm logic — pure functions so the
5
+ * behaviour is testable without real git or filesystem calls.
6
+ *
7
+ * A "collision" is a numeric prefix that appears in the unique-to-ours set AND
8
+ * the unique-to-theirs set with different basenames. A shared filename (same
9
+ * prefix, same basename) is NOT a collision — it was already merged.
10
+ *
11
+ * Prefix extraction mirrors the skill's `sed 's|_.*||'` semantics:
12
+ * prefix = everything before the first underscore in the basename (without .sql).
13
+ * e.g. "20260101000000_add_users.sql" → prefix "20260101000000"
14
+ * "20260101000000_01_add_users.sql" → prefix "20260101000000"
15
+ * (the _01_ is treated as part of the name, not a separate prefix segment)
16
+ */
17
+ import type { RunFn } from "./supabase.js";
18
+ export interface MigrationCollision {
19
+ /** The shared numeric prefix (everything before the first underscore). */
20
+ prefix: string;
21
+ /** Basenames (without .sql) on our side with this prefix. */
22
+ ours: string[];
23
+ /** Basenames (without .sql) on their side with this prefix. */
24
+ theirs: string[];
25
+ }
26
+ export interface ComputeMigrationCollisionsInput {
27
+ ourNames: string[];
28
+ theirNames: string[];
29
+ }
30
+ export interface ComputeMigrationCollisionsResult {
31
+ collisions: MigrationCollision[];
32
+ }
33
+ export interface ReadMigrationNamesOpts {
34
+ /** Production/base branch to compare against (e.g. "main"). */
35
+ base: string;
36
+ /** Working directory for git commands. */
37
+ cwd?: string;
38
+ /** Injectable git runner — returns stdout (throws on non-zero). */
39
+ run?: RunFn;
40
+ }
41
+ export interface MigrationNames {
42
+ ourNames: string[];
43
+ theirNames: string[];
44
+ }
45
+ /**
46
+ * Given the migration basenames on both sides of a would-be merge, return the
47
+ * set of true collisions: same numeric prefix, different basename.
48
+ *
49
+ * Pure function — no I/O.
50
+ */
51
+ export declare function computeMigrationCollisions(input: ComputeMigrationCollisionsInput): ComputeMigrationCollisionsResult;
52
+ /**
53
+ * Read migration filenames from both sides of a would-be merge.
54
+ *
55
+ * HEAD side (ours): `git ls-files supabase/migrations/` — includes staged renames.
56
+ * Base side (theirs): `git ls-tree -r --name-only origin/<base> supabase/migrations/`
57
+ *
58
+ * Returns basename arrays (not full paths), sorted.
59
+ */
60
+ export declare function readMigrationNames(opts: ReadMigrationNamesOpts): MigrationNames;
61
+ //# sourceMappingURL=migration-collisions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-collisions.d.ts","sourceRoot":"","sources":["../../src/lib/migration-collisions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAM3C,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,+DAA+D;IAC/D,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,gCAAgC;IAC/C,UAAU,EAAE,kBAAkB,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,sBAAsB;IACrC,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,GAAG,CAAC,EAAE,KAAK,CAAC;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAkDD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,+BAA+B,GACrC,gCAAgC,CA8ClC;AAMD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,sBAAsB,GAC3B,cAAc,CAyChB"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Port verification utilities.
3
+ *
4
+ * Pure functions that compare local package.json port references against
5
+ * DB port allocations. No API calls — callers provide allocations.
6
+ */
7
+ import type { PortAllocation } from "./types.js";
8
+ export interface PortMismatch {
9
+ /** Relative path to the package.json */
10
+ packageJsonPath: string;
11
+ /** Port found in the scripts */
12
+ scriptPort: number;
13
+ /** The matching allocation (if any) */
14
+ allocation: PortAllocation | null;
15
+ /** Description of the mismatch */
16
+ reason: string;
17
+ }
18
+ export interface UnallocatedApp {
19
+ /** App name (e.g., "web", "mcp") */
20
+ name: string;
21
+ /** Relative path (e.g., "apps/web") */
22
+ path: string;
23
+ /** Detected framework */
24
+ framework: string;
25
+ /** Port found in scripts (null if none) */
26
+ detectedPort: number | null;
27
+ /** Suggested dev command */
28
+ command: string;
29
+ }
30
+ /**
31
+ * Scan all package.json files for hardcoded port references and compare
32
+ * against DB allocations. Returns mismatches where a script port does not
33
+ * match any allocation.
34
+ */
35
+ export declare function verifyPorts(projectPath: string, portAllocations: PortAllocation[]): Promise<PortMismatch[]>;
36
+ /**
37
+ * Decide whether `pkg.scripts.dev` represents an actual long-running dev server.
38
+ *
39
+ * Returns `true` when the script invokes a known dev-server bin (Next.js, NestJS,
40
+ * Vite, Nuxt, SvelteKit, Expo) OR carries `--port` / `-p` as exact whitespace-
41
+ * delimited tokens (not substring match). Returns `false` for `tauri dev` (Tauri
42
+ * webview owns no port), `tsc --watch`, esbuild watchers, or absent/empty scripts.
43
+ *
44
+ * Exported for unit testing — module-internal use otherwise.
45
+ */
46
+ export declare function isDevServerScript(pkg: Record<string, unknown>): boolean;
47
+ /**
48
+ * Decide whether a port-allocation `label` corresponds to monorepo app `appName`.
49
+ *
50
+ * Normalisation: lowercase, replace `-` with whitespace, strip parentheses, then
51
+ * tokenise by whitespace. Returns `true` when the normalised `appName` appears as
52
+ * a complete token in the label's token list (not a substring).
53
+ *
54
+ * Examples:
55
+ * ("Web Dev", "web") → true
56
+ * ("Web Dev (codebyplan-vsextension)", "web") → true (parens stripped)
57
+ * ("Webhooks Dev", "web") → false (token rejection)
58
+ *
59
+ * Exported for unit testing — module-internal use otherwise.
60
+ */
61
+ export declare function labelMatchesAppName(label: string, appName: string): boolean;
62
+ /**
63
+ * Find monorepo apps that don't have a port allocation.
64
+ * Uses discoverMonorepoApps from tech-detect and detectFramework from server-detect.
65
+ *
66
+ * An app is flagged as "unallocated" only when (a) no `port_allocations[]` label
67
+ * matches the app name (per `labelMatchesAppName`) AND (b) the package's `dev`
68
+ * script represents a real dev server (per `isDevServerScript`). Apps without a
69
+ * `dev` script, with non-server `dev` scripts (e.g. `tauri dev`, `tsc --watch`),
70
+ * or with malformed package.json are silently skipped.
71
+ */
72
+ export declare function findUnallocatedApps(projectPath: string, portAllocations: PortAllocation[]): Promise<UnallocatedApp[]>;
73
+ //# sourceMappingURL=port-verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"port-verify.d.ts","sourceRoot":"","sources":["../../src/lib/port-verify.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAC;IAClC,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,cAAc,EAAE,GAChC,OAAO,CAAC,YAAY,EAAE,CAAC,CAiCzB;AAaD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAmBvE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAsB3E;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,cAAc,EAAE,GAChC,OAAO,CAAC,cAAc,EAAE,CAAC,CA8C3B"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Structured-signal answers for the three prompt shapes.
3
+ *
4
+ * Returning typed enums (not raw label strings) so call sites branch on a
5
+ * controlled set; the user-facing label can change without breaking
6
+ * downstream code.
7
+ */
8
+ export type OverwriteAnswer = "overwrite" | "skip" | "diff";
9
+ export type OptInAnswer = "opt-in" | "skip";
10
+ export type RemoveAnswer = "remove" | "keep";
11
+ export interface PromptOpts {
12
+ /** Short-circuit every prompt to its recommended default. */
13
+ yes: boolean;
14
+ }
15
+ /**
16
+ * Prompt for what to do with a file that's been hand-modified by the user
17
+ * since install (on-disk hash differs from manifest hash). Default under
18
+ * `--yes` is `overwrite` (replace with the new packaged version).
19
+ */
20
+ export declare function promptOverwrite(filePath: string, opts: PromptOpts, showDiff?: () => void): Promise<OverwriteAnswer>;
21
+ /**
22
+ * Prompt for whether to install a NEW file (present in the package's
23
+ * templates but not in the user's manifest — typically appearing in an
24
+ * `update` run after a package version added new content). Default under
25
+ * `--yes` is `opt-in`.
26
+ */
27
+ export declare function promptOptIn(filePath: string, opts: PromptOpts): Promise<OptInAnswer>;
28
+ /**
29
+ * Prompt for whether to remove a file the user previously installed that
30
+ * has since been DROPPED from the package's templates (typically appears
31
+ * in an `update` run after a package version removed content). Default
32
+ * under `--yes` is `remove`.
33
+ */
34
+ export declare function promptRemove(filePath: string, opts: PromptOpts): Promise<RemoveAnswer>;
35
+ /**
36
+ * Simple line-by-line unified-diff renderer. No external dep — the goal is
37
+ * to give the user enough signal to choose overwrite vs skip, not produce
38
+ * a perfect minimal diff.
39
+ */
40
+ export declare function renderDiff(oldContent: string, newContent: string): string;
41
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/lib/prompt.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAC5D,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC5C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,GAAG,EAAE,OAAO,CAAC;CACd;AAgFD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,EAChB,QAAQ,CAAC,EAAE,MAAM,IAAI,GACpB,OAAO,CAAC,eAAe,CAAC,CAc1B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,WAAW,CAAC,CAYtB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,YAAY,CAAC,CAYvB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAiBzE"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Pure, side-effect-free library for generating and managing README.md files.
3
+ *
4
+ * Uses marker-bounded managed sections:
5
+ * <!-- codebyplan:managed:start:<section> -->
6
+ * ...content...
7
+ * <!-- codebyplan:managed:end:<section> -->
8
+ *
9
+ * A drift hash is embedded inside the managed block:
10
+ * <!-- codebyplan:hash:<sha256> -->
11
+ *
12
+ * DETERMINISTIC: no I/O, no Date.now/random, sorted output everywhere.
13
+ * Two calls with identical config produce byte-identical output.
14
+ */
15
+ import type { MonorepoPackage } from "./structure-generator.js";
16
+ export declare const MANAGED_START_PREFIX = "<!-- codebyplan:managed:start:";
17
+ export declare const MANAGED_END_PREFIX = "<!-- codebyplan:managed:end:";
18
+ export declare const MANAGED_MARKER_SUFFIX = " -->";
19
+ export declare const HASH_MARKER_PREFIX = "<!-- codebyplan:hash:";
20
+ /** Build the managed-start marker for a named section. */
21
+ export declare function managedStartMarker(section: string): string;
22
+ /** Build the managed-end marker for a named section. */
23
+ export declare function managedEndMarker(section: string): string;
24
+ /** Return true if `content` contains any codebyplan managed markers. */
25
+ export declare function hasManagedMarkers(content: string): boolean;
26
+ /**
27
+ * Validate marker integrity in `content`. Returns a list of human-readable
28
+ * problems (empty array = valid). Catches:
29
+ * - start markers with no matching end marker (would cause pathological
30
+ * regex backtracking in refreshManagedSections)
31
+ * - end markers with no matching start marker
32
+ * - duplicate section names (refresh would emit duplicate blocks)
33
+ *
34
+ * Callers should skip refresh for files with a non-empty result.
35
+ */
36
+ export declare function validateManagedMarkers(content: string): string[];
37
+ export interface ReadmeGenConfig {
38
+ /** Name from package.json */
39
+ name?: string;
40
+ /** Description from package.json */
41
+ description?: string;
42
+ /** Scripts from package.json (key: script name, value: command) */
43
+ scripts?: Record<string, string>;
44
+ /** Package manager string (e.g. "pnpm@10.12.4") */
45
+ packageManager?: string;
46
+ /** Tech stack entries — map of category label to comma-joined names */
47
+ techStack?: Record<string, string>;
48
+ /** Workspace packages (for monorepo root) */
49
+ packages?: MonorepoPackage[];
50
+ /** Install command override (e.g. "pnpm install") */
51
+ installCommand?: string;
52
+ }
53
+ export interface ReadmeUnit {
54
+ /** Display name */
55
+ name: string;
56
+ /** Relative path from project root (e.g. "apps/web") */
57
+ path: string;
58
+ /** Absolute path */
59
+ absPath: string;
60
+ /** True if this is the repo root */
61
+ isRoot: boolean;
62
+ }
63
+ /**
64
+ * Build managed sections from config.
65
+ * Returns a Record mapping section names to their rendered Markdown content
66
+ * (NOT wrapped in markers yet — wrapping happens in refreshManagedSections).
67
+ *
68
+ * DETERMINISTIC — no I/O, no timestamps, no random.
69
+ */
70
+ export declare function buildManagedSections(config: ReadmeGenConfig): Record<string, string>;
71
+ /**
72
+ * Compute a sha256 hash over the managed sections in deterministic JSON form.
73
+ * The hash is used as a drift sentinel; identical sections → identical hash.
74
+ *
75
+ * Input is serialized as JSON with sorted keys so map insertion order does not
76
+ * affect the hash.
77
+ */
78
+ export declare function hashManagedContent(sections: Record<string, string>): string;
79
+ /**
80
+ * Generate a full README.md from scratch for a unit that has no existing file.
81
+ * Includes the managed sections wrapped in their markers + a drift hash.
82
+ *
83
+ * DETERMINISTIC — no I/O.
84
+ */
85
+ export declare function scaffoldReadme(config: ReadmeGenConfig): string;
86
+ /**
87
+ * Replace ONLY the marker-bounded content inside an existing README.
88
+ * Prose outside any managed markers is preserved exactly.
89
+ *
90
+ * For sections that exist in `sections` but not in `existing`:
91
+ * - They are appended at the end (before or after a trailing hash comment).
92
+ *
93
+ * For sections that exist in `existing` but not in `sections`:
94
+ * - They are removed (markers + content stripped).
95
+ *
96
+ * The drift hash is updated to reflect the new content.
97
+ *
98
+ * Returns the refreshed README content (same trailing newline convention as
99
+ * the incoming string — adds one if the result would be empty).
100
+ */
101
+ export declare function refreshManagedSections(existing: string, sections: Record<string, string>): string;
102
+ export declare function escapeRegex(str: string): string;
103
+ /**
104
+ * Extract the embedded drift hash from managed content, or null if absent.
105
+ * Shared by cli/claude/readme.ts and lib/agents-generator.ts.
106
+ */
107
+ export declare function extractManagedHash(content: string): string | null;
108
+ //# sourceMappingURL=readme-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readme-generator.d.ts","sourceRoot":"","sources":["../../src/lib/readme-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAMhE,eAAO,MAAM,oBAAoB,mCAAmC,CAAC;AACrE,eAAO,MAAM,kBAAkB,iCAAiC,CAAC;AACjE,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,0DAA0D;AAC1D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wDAAwD;AACxD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAK1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBhE;AAMD,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;IAC7B,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,MAAM,EAAE,OAAO,CAAC;CACjB;AA6DD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,eAAe,GACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA+BxB;AAMD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAO3E;AAMD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CA6B9D;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,MAAM,CAqFR;AAMD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQjE"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * RepoReader — a thin async interface for reading project-content files.
3
+ *
4
+ * The interface decouples CI generator logic (detectPlatforms, runCiInit,
5
+ * runScaffoldCiWorkflow) from the Node.js fs module so that:
6
+ * - Unit tests can inject an InMemoryRepoReader without touching the disk.
7
+ * - Future environments (WASM, Deno, edge) can supply alternative readers.
8
+ *
9
+ * Template-asset resolution (resolveTemplatesDir) is NOT routed through the
10
+ * reader — it resolves packaged assets, not project content.
11
+ *
12
+ * Write operations (mkdir, writeFile, renameSync) stay fs-direct in the call
13
+ * sites: the reader is read-only by design.
14
+ */
15
+ /**
16
+ * Async interface for reading project-content files.
17
+ *
18
+ * All paths passed to these methods are resolved relative to the reader's
19
+ * root directory (for LocalFsReader) or against the in-memory file map (for
20
+ * InMemoryRepoReader in tests).
21
+ *
22
+ * Method semantics:
23
+ * list(dir) — returns the immediate child DIRECTORY names under dir (files
24
+ * are excluded). Does NOT recurse. Never throws for a missing
25
+ * dir — returns []. The sole consumer (detectPlatforms) only ever
26
+ * enumerates sub-directories (apps/*, packages/*), and the
27
+ * pre-refactor code filtered readdir() to directories; returning
28
+ * dirs-only here preserves that byte-identical behaviour and maps
29
+ * cleanly to a GitHub-tree reader (filter entries to type=dir).
30
+ * read(p) — returns the UTF-8 contents of the file at p. Throws if missing.
31
+ * exists(p) — returns true iff the path exists (file or dir).
32
+ */
33
+ export interface RepoReader {
34
+ list(dir: string): Promise<string[]>;
35
+ read(filePath: string): Promise<string>;
36
+ exists(filePath: string): Promise<boolean>;
37
+ }
38
+ /**
39
+ * Production reader that resolves all paths against an absolute `rootDir`.
40
+ *
41
+ * Constructed with the project's absolute root directory. All paths passed to
42
+ * `list`, `read`, and `exists` are resolved with path.resolve(rootDir, p)
43
+ * when they are relative, or used as-is when already absolute.
44
+ *
45
+ * `list` returns only the immediate sub-DIRECTORY names (via readdir with
46
+ * withFileTypes, filtered to entries.isDirectory()). Because it never recurses,
47
+ * node_modules/.git isolation is naturally handled: a caller listing "apps"
48
+ * gets ["web", "mcp"] — not the contents of their node_modules trees, and loose
49
+ * files like apps/README.md are excluded (matching the pre-refactor behaviour).
50
+ */
51
+ export declare class LocalFsReader implements RepoReader {
52
+ private readonly rootDir;
53
+ constructor(rootDir: string);
54
+ private resolve;
55
+ list(dir: string): Promise<string[]>;
56
+ read(filePath: string): Promise<string>;
57
+ exists(filePath: string): Promise<boolean>;
58
+ }
59
+ //# sourceMappingURL=repo-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-reader.d.ts","sourceRoot":"","sources":["../../src/lib/repo-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AASH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACrC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5C;AAMD;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAc,YAAW,UAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM;IAE5C,OAAO,CAAC,OAAO;IAIT,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAcpC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAavC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CASjD"}