forge-workflow 0.0.10 → 0.1.0-beta.2

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 (454) hide show
  1. package/.claude/rules/{greptile-review-process.md → review-process.md} +56 -41
  2. package/.claude/scripts/{greptile-resolve.sh → review-resolve.sh} +13 -3
  3. package/.cursor/rules/permissions-guidance.mdc +2 -2
  4. package/.forge/hooks/check-tdd.js +3 -0
  5. package/.forge/hooks/forge-native-hook.js +245 -0
  6. package/.forge/protected-paths.yaml +157 -0
  7. package/AGENTS.md +150 -61
  8. package/CHANGELOG.md +681 -0
  9. package/CLAUDE.md +9 -118
  10. package/QUICKSTART.md +171 -0
  11. package/README.md +271 -363
  12. package/bin/forge-cmd.js +120 -9
  13. package/bin/forge-preflight.js +26 -5
  14. package/bin/forge.js +461 -489
  15. package/docs/INDEX.md +93 -0
  16. package/docs/PROJECT_DESIGN.md +685 -0
  17. package/docs/architecture/index.md +66 -0
  18. package/docs/architecture/notes/README.md +35 -0
  19. package/docs/architecture/subsystems/README.md +46 -0
  20. package/docs/forge/TOOLCHAIN.md +670 -0
  21. package/docs/forge/VALIDATION.md +82 -0
  22. package/docs/{AGENT_INSTALL_PROMPT.md → guides/AGENT_INSTALL_PROMPT.md} +3 -3
  23. package/docs/guides/BEADS_GITHUB_SYNC.md +32 -0
  24. package/docs/{ENHANCED_ONBOARDING.md → guides/ENHANCED_ONBOARDING.md} +16 -12
  25. package/docs/guides/GREPTILE_SETUP.md +46 -0
  26. package/docs/guides/MANUAL_REVIEW_GUIDE.md +58 -0
  27. package/docs/guides/MIGRATION.md +56 -0
  28. package/docs/guides/SETUP.md +118 -0
  29. package/docs/guides/SUPPORT.md +185 -0
  30. package/docs/guides/WORKFLOW_TEMPLATES.md +74 -0
  31. package/docs/guides/memory-backends.md +183 -0
  32. package/docs/reference/ADAPTERS.md +128 -0
  33. package/docs/reference/AGENT_SKILL_PARITY.md +175 -0
  34. package/docs/reference/COMMANDS.md +205 -0
  35. package/docs/reference/DECISION_DRIFT_GUARDS.md +97 -0
  36. package/docs/{EXAMPLES.md → reference/EXAMPLES.md} +7 -5
  37. package/docs/reference/FORGE_KERNEL_STORAGE_MODEL.md +135 -0
  38. package/docs/reference/HERMES_INTEGRATION.md +118 -0
  39. package/docs/reference/INSIGHTS_RECAP.md +63 -0
  40. package/docs/reference/INSTALL.md +164 -0
  41. package/docs/reference/KERNEL_TAXONOMY_VALIDATION.md +161 -0
  42. package/docs/reference/PROTECTED_PATH_MANIFEST.md +25 -0
  43. package/docs/reference/RELEASE.md +68 -0
  44. package/docs/reference/RESEARCH_TEMPLATE.md +292 -0
  45. package/docs/{ROADMAP.md → reference/ROADMAP.md} +12 -9
  46. package/docs/reference/SKILLS.md +35 -0
  47. package/docs/reference/STATUS_BOARD.md +80 -0
  48. package/docs/reference/TEMPLATES.md +106 -0
  49. package/docs/{TOOLCHAIN.md → reference/TOOLCHAIN.md} +62 -47
  50. package/docs/reference/VALIDATION.md +82 -0
  51. package/docs/reference/agent-permissions.md +169 -0
  52. package/docs/reference/beads-to-kernel-migration-ux.md +61 -0
  53. package/docs/reference/control-plane-guarantees.md +125 -0
  54. package/docs/reference/dependency-chain.md +331 -0
  55. package/docs/reference/forge-kernel-issue-command-contract.md +161 -0
  56. package/docs/reference/forge-kernel-schema.md +72 -0
  57. package/docs/reference/kernel-conflict-evaluators.md +27 -0
  58. package/docs/reference/patch-md-format.md +77 -0
  59. package/docs/reference/protected-state-surfaces.md +59 -0
  60. package/docs/reference/shepherd.md +115 -0
  61. package/docs/reference/superpowers-analysis.md +320 -0
  62. package/docs/reference/superpowers-integration-options.md +404 -0
  63. package/docs/reference/test-environment.md +519 -0
  64. package/docs/reference/upgrade-safety.md +59 -0
  65. package/lefthook.yml +18 -0
  66. package/lib/adapter-cli.js +307 -0
  67. package/lib/adapters/beads-issue-adapter.js +127 -0
  68. package/lib/adapters/beads-kernel-compat.js +1042 -0
  69. package/lib/adapters/greptile-review-adapter.js +141 -0
  70. package/lib/adapters/kernel-issue-adapter.js +101 -0
  71. package/lib/adapters/pr-state-adapter.js +484 -0
  72. package/lib/adoption-profiles.js +126 -0
  73. package/lib/agents/README.md +2 -6
  74. package/lib/agents/claude.plugin.json +3 -8
  75. package/lib/agents/codex.plugin.json +9 -1
  76. package/lib/agents/cursor.plugin.json +2 -6
  77. package/lib/agents/hermes.plugin.json +22 -0
  78. package/lib/agents-config.js +39 -1236
  79. package/lib/audit-evidence.js +282 -0
  80. package/lib/beads-setup.js +121 -0
  81. package/lib/beads-sync-scaffold.js +25 -101
  82. package/lib/codex-skills.js +51 -1
  83. package/lib/commands/_issue.js +741 -77
  84. package/lib/commands/_manifest.js +91 -0
  85. package/lib/commands/_registry.js +85 -34
  86. package/lib/commands/_resolve-command-opts.js +261 -0
  87. package/lib/commands/_serve-security.js +270 -0
  88. package/lib/commands/adapter.js +12 -0
  89. package/lib/commands/add.js +118 -0
  90. package/lib/commands/audit.js +70 -0
  91. package/lib/commands/blocked.js +5 -0
  92. package/lib/commands/board.js +64 -0
  93. package/lib/commands/claim.js +21 -2
  94. package/lib/commands/claims.js +7 -0
  95. package/lib/commands/clean.js +485 -75
  96. package/lib/commands/close.js +2 -2
  97. package/lib/commands/comment.js +5 -0
  98. package/lib/commands/control.js +148 -0
  99. package/lib/commands/create.js +2 -2
  100. package/lib/commands/dev.js +185 -7
  101. package/lib/commands/doc-gate.js +336 -0
  102. package/lib/commands/doctor.js +156 -0
  103. package/lib/commands/explain.js +15 -0
  104. package/lib/commands/export.js +237 -0
  105. package/lib/commands/gate.js +192 -0
  106. package/lib/commands/hooks.js +242 -0
  107. package/lib/commands/inbox.js +118 -0
  108. package/lib/commands/init.js +598 -0
  109. package/lib/commands/insights.js +79 -0
  110. package/lib/commands/issue.js +12 -1
  111. package/lib/commands/issues.js +17 -0
  112. package/lib/commands/lint.js +5 -0
  113. package/lib/commands/list.js +2 -2
  114. package/lib/commands/merge.js +312 -0
  115. package/lib/commands/migrate.js +523 -0
  116. package/lib/commands/new.js +12 -0
  117. package/lib/commands/options.js +241 -0
  118. package/lib/commands/orient.js +13 -0
  119. package/lib/commands/orphans.js +5 -0
  120. package/lib/commands/patch.js +67 -0
  121. package/lib/commands/plan.js +436 -24
  122. package/lib/commands/preflight.js +211 -0
  123. package/lib/commands/prime.js +13 -0
  124. package/lib/commands/push.js +69 -2
  125. package/lib/commands/ready.js +2 -2
  126. package/lib/commands/recall.js +116 -0
  127. package/lib/commands/recap.js +61 -0
  128. package/lib/commands/recommend.js +0 -1
  129. package/lib/commands/release.js +91 -0
  130. package/lib/commands/remember.js +74 -0
  131. package/lib/commands/role.js +99 -0
  132. package/lib/commands/serve.js +581 -0
  133. package/lib/commands/setup.js +838 -972
  134. package/lib/commands/shepherd.js +436 -0
  135. package/lib/commands/ship.js +23 -1
  136. package/lib/commands/show.js +2 -2
  137. package/lib/commands/stage.js +192 -0
  138. package/lib/commands/stale.js +5 -0
  139. package/lib/commands/status.js +158 -21
  140. package/lib/commands/sync.js +34 -46
  141. package/lib/commands/team.js +4 -1
  142. package/lib/commands/test.js +43 -27
  143. package/lib/commands/update.js +2 -2
  144. package/lib/commands/upgrade.js +47 -0
  145. package/lib/commands/validate.js +43 -18
  146. package/lib/commands/worktree.js +307 -100
  147. package/lib/config-writer.js +202 -0
  148. package/lib/control-plane.js +236 -0
  149. package/lib/core/runtime-graph.js +946 -0
  150. package/lib/dep-guard/keyword-ripple.js +2 -2
  151. package/lib/deprecated-sync-cleanup.js +362 -0
  152. package/lib/detect-agent.js +2 -28
  153. package/lib/detect-worktree.js +35 -9
  154. package/lib/doc-gate/declaration.js +177 -0
  155. package/lib/doc-gate/detect.js +289 -0
  156. package/lib/doc-gate/gate.js +375 -0
  157. package/lib/doc-gate/okf-config.js +128 -0
  158. package/lib/doc-gate/okf.js +429 -0
  159. package/lib/docs-command.js +1161 -6
  160. package/lib/forge-issues.js +382 -11
  161. package/lib/forge-lock.js +262 -0
  162. package/lib/gate-events.js +193 -0
  163. package/lib/global-flags.js +74 -0
  164. package/lib/greptile-match.js +7 -63
  165. package/lib/harness-capability-matrix.js +380 -0
  166. package/lib/hook-global-installer.js +347 -0
  167. package/lib/hook-renderer.js +451 -0
  168. package/lib/inbox.js +391 -0
  169. package/lib/insights.js +397 -0
  170. package/lib/issue-adapter.js +156 -0
  171. package/lib/issue-backend.js +145 -0
  172. package/lib/issue-render.js +220 -0
  173. package/lib/kernel/backing-issue.js +305 -0
  174. package/lib/kernel/broker.js +1218 -0
  175. package/lib/kernel/cli-broker-factory.js +130 -0
  176. package/lib/kernel/conflict-signal.js +82 -0
  177. package/lib/kernel/evaluators.js +195 -0
  178. package/lib/kernel/fs-class.js +495 -0
  179. package/lib/kernel/issue-command-contract.js +559 -0
  180. package/lib/kernel/issue-id-resolver.js +186 -0
  181. package/lib/kernel/lease-enforcer.js +158 -0
  182. package/lib/kernel/migrations.js +333 -0
  183. package/lib/kernel/planning-buckets-schema.js +109 -0
  184. package/lib/kernel/projection-jsonl-writer.js +450 -0
  185. package/lib/kernel/readiness-model.js +329 -0
  186. package/lib/kernel/schema.js +356 -0
  187. package/lib/kernel/sqlite-driver.js +2504 -0
  188. package/lib/kernel/taxonomy-validator.js +394 -0
  189. package/lib/lefthook-check.js +3 -2
  190. package/lib/lefthook-wiring.js +413 -0
  191. package/lib/mcp-config-renderer.js +288 -0
  192. package/lib/memory/graphiti-mcp.js +106 -0
  193. package/lib/memory/router.js +387 -0
  194. package/lib/memory/typed-api.js +102 -0
  195. package/lib/memory-digest.js +195 -0
  196. package/lib/merge-rules.js +395 -0
  197. package/lib/migrate-dry-run.js +466 -0
  198. package/lib/orientation.js +863 -0
  199. package/lib/package-manager-remediation.js +103 -0
  200. package/lib/package-root.js +381 -0
  201. package/lib/patch-intent.js +890 -0
  202. package/lib/plugin-catalog.js +3 -4
  203. package/lib/plugin-manager.js +0 -5
  204. package/lib/pr-bundle.js +186 -0
  205. package/lib/pr-monitor/differ.js +195 -0
  206. package/lib/pr-monitor/events.js +0 -0
  207. package/lib/pr-monitor/gather.js +124 -0
  208. package/lib/pr-monitor/journal.js +299 -0
  209. package/lib/pr-monitor/monitor.js +146 -0
  210. package/lib/pr-monitor/render-sticky.js +157 -0
  211. package/lib/pr-monitor/watch-lifecycle.js +95 -0
  212. package/lib/pr-monitor/watch.js +247 -0
  213. package/lib/pr-pull.js +1273 -0
  214. package/lib/pr-shepherd.js +494 -0
  215. package/lib/pr-state-validator.js +59 -0
  216. package/lib/preflight/gates.js +237 -0
  217. package/lib/preflight/runner.js +116 -0
  218. package/lib/project-discovery.js +0 -53
  219. package/lib/project-memory.js +99 -497
  220. package/lib/protected-path-manifest.js +281 -0
  221. package/lib/protected-state-surfaces.js +387 -0
  222. package/lib/release-readiness.js +2089 -0
  223. package/lib/reset.js +59 -45
  224. package/lib/review-adapter.js +68 -0
  225. package/lib/rules-sync.js +260 -0
  226. package/lib/runtime-health.js +241 -20
  227. package/lib/safety-config-renderer.js +268 -0
  228. package/lib/setup-action-log.js +1 -7
  229. package/lib/setup.js +27 -65
  230. package/lib/shell-utils.js +76 -6
  231. package/lib/skills-sync.js +330 -0
  232. package/lib/smart-status/scoring.js +17 -3
  233. package/lib/status/beads-snapshot.js +45 -2
  234. package/lib/status/presenter.js +169 -18
  235. package/lib/status/snapshot.js +186 -0
  236. package/lib/sync-backend.js +202 -0
  237. package/lib/untrusted-content.js +52 -0
  238. package/lib/upgrade-safety.js +199 -0
  239. package/lib/workflow/enforce-stage.js +296 -47
  240. package/lib/workflow/stage-transition.js +115 -0
  241. package/lib/workflow/stages.js +30 -6
  242. package/lib/workflow/state-manager.js +11 -22
  243. package/lib/workflow/state.js +23 -1
  244. package/lib/workflow-profiles.js +17 -5
  245. package/package.json +37 -35
  246. package/rules/documentation.md +19 -0
  247. package/rules/kernel-tracking.md +26 -0
  248. package/rules/security.md +22 -0
  249. package/rules/tdd.md +20 -0
  250. package/rules/workflow.md +27 -0
  251. package/scripts/auto-backing-issue.js +47 -0
  252. package/scripts/beads-context.sh +81 -57
  253. package/scripts/beads-upgrade-smoke.sh +24 -3
  254. package/scripts/bootstrap-windows-tools.sh +78 -0
  255. package/scripts/branch-protection.js +2 -3
  256. package/scripts/check-agents.js +34 -137
  257. package/scripts/commitlint.js +3 -1
  258. package/scripts/conflict-detect.sh +3 -0
  259. package/scripts/dep-guard.sh +22 -3
  260. package/scripts/file-index.sh +3 -0
  261. package/scripts/forge-team/lib/claim.sh +34 -18
  262. package/scripts/forge-team/lib/dashboard.sh +61 -86
  263. package/scripts/forge-team/lib/epic.sh +99 -263
  264. package/scripts/forge-team/lib/hooks.sh +26 -28
  265. package/scripts/forge-team/lib/identity.sh +4 -4
  266. package/scripts/forge-team/lib/sync-github.sh +49 -84
  267. package/scripts/forge-team/lib/verify.sh +93 -83
  268. package/scripts/forge-team/lib/workload.sh +41 -65
  269. package/scripts/forge-team/tests/claim.test.sh +25 -19
  270. package/scripts/forge-team/tests/dashboard.test.sh +31 -46
  271. package/scripts/forge-team/tests/epic.test.sh +52 -71
  272. package/scripts/forge-team/tests/hooks.test.sh +38 -50
  273. package/scripts/forge-team/tests/identity.test.sh +3 -3
  274. package/scripts/forge-team/tests/integration.test.sh +44 -66
  275. package/scripts/forge-team/tests/sync-github.test.sh +50 -83
  276. package/scripts/forge-team/tests/verify.test.sh +37 -46
  277. package/scripts/forge-team/tests/workflow-integration.test.sh +4 -4
  278. package/scripts/forge-team/tests/workload.test.sh +32 -66
  279. package/scripts/gen-command-manifest.js +153 -0
  280. package/scripts/gen-embedded-assets.mjs +129 -0
  281. package/scripts/install.ps1 +139 -0
  282. package/scripts/install.sh +268 -0
  283. package/scripts/lib/release-asset.mjs +84 -0
  284. package/scripts/parity-check.mjs +145 -0
  285. package/scripts/parity-check.test.mjs +58 -0
  286. package/scripts/pin-agentic-workflow-images.js +112 -0
  287. package/scripts/pr-coordinator.sh +3 -0
  288. package/scripts/preflight-sonar.eslint.config.mjs +44 -0
  289. package/scripts/preflight.sh +21 -94
  290. package/scripts/protected-state-check.js +104 -0
  291. package/scripts/smart-status.sh +60 -57
  292. package/scripts/spikes/config-race-bench.js +111 -0
  293. package/scripts/spikes/harness-capability-matrix.js +13 -0
  294. package/scripts/spikes/patch-anchor-stability-bench.js +125 -0
  295. package/scripts/spikes/protected-path-manifest.js +20 -0
  296. package/scripts/spikes/skill-auto-invoke-parity.js +292 -0
  297. package/scripts/sync-agent-skills.js +62 -0
  298. package/scripts/sync-utils.sh +3 -0
  299. package/scripts/test-ci-shard.js +13 -6
  300. package/scripts/test.js +95 -12
  301. package/skills/claim-safety/SKILL.md +102 -0
  302. package/skills/claim-safety/evals/evals.json +46 -0
  303. package/{.github/prompts/dev.prompt.md → skills/dev/SKILL.md} +44 -50
  304. package/skills/dev/evals/evals.json +50 -0
  305. package/skills/hermes-forge/SKILL.md +185 -0
  306. package/skills/hermes-forge/evals/evals.json +46 -0
  307. package/skills/issue-basics/SKILL.md +111 -0
  308. package/skills/issue-basics/evals/evals.json +46 -0
  309. package/skills/kernel/SKILL.md +166 -0
  310. package/skills/kernel/evals/evals.json +50 -0
  311. package/skills/memory/SKILL.md +102 -0
  312. package/skills/parallel-deep-research/SKILL.md +14 -11
  313. package/skills/parallel-deep-research/evals/evals.json +11 -27
  314. package/{.github/prompts/plan.prompt.md → skills/plan/SKILL.md} +132 -157
  315. package/skills/plan/evals/evals.json +42 -0
  316. package/skills/research/SKILL.md +195 -0
  317. package/skills/research/evals/evals.json +42 -0
  318. package/{.github/prompts/review.prompt.md → skills/review/SKILL.md} +98 -62
  319. package/skills/review/evals/evals.json +42 -0
  320. package/skills/rollback/SKILL.md +110 -0
  321. package/skills/rollback/evals/evals.json +46 -0
  322. package/skills/rollback/references/methods.md +204 -0
  323. package/{.cursor/commands/rollback.md → skills/rollback/references/workflow-integration.md} +10 -284
  324. package/skills/shepherd/SKILL.md +66 -0
  325. package/skills/shepherd/evals/evals.json +42 -0
  326. package/{.github/prompts/ship.prompt.md → skills/ship/SKILL.md} +81 -45
  327. package/skills/ship/evals/evals.json +42 -0
  328. package/skills/smith/SKILL.md +142 -0
  329. package/skills/smith/evals/evals.json +46 -0
  330. package/skills/smith/references/autonomy-and-gates.md +94 -0
  331. package/{.github/prompts/sonarcloud.prompt.md → skills/sonarcloud/SKILL.md} +14 -3
  332. package/skills/sonarcloud/evals/evals.json +46 -0
  333. package/skills/sonarcloud-analysis/SKILL.md +18 -13
  334. package/skills/sonarcloud-analysis/evals/evals.json +11 -15
  335. package/{.github/prompts/status.prompt.md → skills/status/SKILL.md} +20 -10
  336. package/skills/status/evals/evals.json +50 -0
  337. package/skills/triage-ready/SKILL.md +121 -0
  338. package/skills/triage-ready/evals/evals.json +42 -0
  339. package/{.github/prompts/validate.prompt.md → skills/validate/SKILL.md} +52 -29
  340. package/skills/validate/evals/evals.json +42 -0
  341. package/skills/verify/SKILL.md +299 -0
  342. package/skills/verify/evals/evals.json +50 -0
  343. package/.claude/commands/dev.md +0 -345
  344. package/.claude/commands/plan.md +0 -566
  345. package/.claude/commands/premerge.md +0 -186
  346. package/.claude/commands/research.md +0 -42
  347. package/.claude/commands/review.md +0 -451
  348. package/.claude/commands/rollback.md +0 -721
  349. package/.claude/commands/ship.md +0 -213
  350. package/.claude/commands/sonarcloud.md +0 -152
  351. package/.claude/commands/status.md +0 -90
  352. package/.claude/commands/validate.md +0 -288
  353. package/.claude/commands/verify.md +0 -269
  354. package/.claude/rules/workflow.md +0 -121
  355. package/.cline/workflows/dev.md +0 -342
  356. package/.cline/workflows/plan.md +0 -563
  357. package/.cline/workflows/premerge.md +0 -183
  358. package/.cline/workflows/research.md +0 -39
  359. package/.cline/workflows/review.md +0 -448
  360. package/.cline/workflows/rollback.md +0 -718
  361. package/.cline/workflows/ship.md +0 -210
  362. package/.cline/workflows/sonarcloud.md +0 -146
  363. package/.cline/workflows/status.md +0 -87
  364. package/.cline/workflows/validate.md +0 -285
  365. package/.cline/workflows/verify.md +0 -266
  366. package/.codex/config.toml +0 -11
  367. package/.codex/skills/dev/SKILL.md +0 -345
  368. package/.codex/skills/plan/SKILL.md +0 -566
  369. package/.codex/skills/premerge/SKILL.md +0 -186
  370. package/.codex/skills/research/SKILL.md +0 -42
  371. package/.codex/skills/review/SKILL.md +0 -451
  372. package/.codex/skills/rollback/SKILL.md +0 -721
  373. package/.codex/skills/ship/SKILL.md +0 -213
  374. package/.codex/skills/sonarcloud/SKILL.md +0 -149
  375. package/.codex/skills/status/SKILL.md +0 -90
  376. package/.codex/skills/validate/SKILL.md +0 -288
  377. package/.codex/skills/verify/SKILL.md +0 -269
  378. package/.cursor/commands/dev.md +0 -342
  379. package/.cursor/commands/plan.md +0 -563
  380. package/.cursor/commands/premerge.md +0 -183
  381. package/.cursor/commands/research.md +0 -39
  382. package/.cursor/commands/review.md +0 -448
  383. package/.cursor/commands/ship.md +0 -210
  384. package/.cursor/commands/sonarcloud.md +0 -146
  385. package/.cursor/commands/status.md +0 -87
  386. package/.cursor/commands/validate.md +0 -285
  387. package/.cursor/commands/verify.md +0 -266
  388. package/.cursorrules +0 -149
  389. package/.github/prompts/premerge.prompt.md +0 -188
  390. package/.github/prompts/research.prompt.md +0 -44
  391. package/.github/prompts/rollback.prompt.md +0 -723
  392. package/.github/prompts/verify.prompt.md +0 -271
  393. package/.github/workflows/beads-to-github.yml +0 -89
  394. package/.github/workflows/github-to-beads.yml +0 -100
  395. package/.kilocode/workflows/dev.md +0 -346
  396. package/.kilocode/workflows/plan.md +0 -567
  397. package/.kilocode/workflows/premerge.md +0 -187
  398. package/.kilocode/workflows/research.md +0 -43
  399. package/.kilocode/workflows/review.md +0 -452
  400. package/.kilocode/workflows/rollback.md +0 -722
  401. package/.kilocode/workflows/ship.md +0 -214
  402. package/.kilocode/workflows/sonarcloud.md +0 -150
  403. package/.kilocode/workflows/status.md +0 -91
  404. package/.kilocode/workflows/validate.md +0 -289
  405. package/.kilocode/workflows/verify.md +0 -270
  406. package/.opencode/commands/dev.md +0 -345
  407. package/.opencode/commands/plan.md +0 -566
  408. package/.opencode/commands/premerge.md +0 -186
  409. package/.opencode/commands/research.md +0 -42
  410. package/.opencode/commands/review.md +0 -451
  411. package/.opencode/commands/rollback.md +0 -721
  412. package/.opencode/commands/ship.md +0 -213
  413. package/.opencode/commands/sonarcloud.md +0 -149
  414. package/.opencode/commands/status.md +0 -90
  415. package/.opencode/commands/validate.md +0 -288
  416. package/.opencode/commands/verify.md +0 -269
  417. package/.roo/commands/dev.md +0 -346
  418. package/.roo/commands/plan.md +0 -567
  419. package/.roo/commands/premerge.md +0 -187
  420. package/.roo/commands/research.md +0 -43
  421. package/.roo/commands/review.md +0 -452
  422. package/.roo/commands/rollback.md +0 -722
  423. package/.roo/commands/ship.md +0 -214
  424. package/.roo/commands/sonarcloud.md +0 -150
  425. package/.roo/commands/status.md +0 -91
  426. package/.roo/commands/validate.md +0 -289
  427. package/.roo/commands/verify.md +0 -270
  428. package/docs/BEADS_GITHUB_SYNC.md +0 -281
  429. package/docs/GREPTILE_SETUP.md +0 -400
  430. package/docs/MANUAL_REVIEW_GUIDE.md +0 -106
  431. package/docs/SETUP.md +0 -663
  432. package/docs/VALIDATION.md +0 -363
  433. package/lib/agents/cline.plugin.json +0 -29
  434. package/lib/agents/copilot.plugin.json +0 -24
  435. package/lib/agents/kilocode.plugin.json +0 -22
  436. package/lib/agents/opencode.plugin.json +0 -23
  437. package/lib/agents/roo.plugin.json +0 -30
  438. package/lib/beads-bootstrap.js +0 -225
  439. package/lib/beads-health-check.js +0 -188
  440. package/lib/commands/commands-reset.js +0 -147
  441. package/opencode.json +0 -67
  442. package/scripts/beads-context.test.js +0 -584
  443. package/scripts/github-beads-sync/comment.mjs +0 -64
  444. package/scripts/github-beads-sync/config.mjs +0 -148
  445. package/scripts/github-beads-sync/github-api.mjs +0 -131
  446. package/scripts/github-beads-sync/index.mjs +0 -356
  447. package/scripts/github-beads-sync/label-mapper.mjs +0 -54
  448. package/scripts/github-beads-sync/mapping.mjs +0 -132
  449. package/scripts/github-beads-sync/reverse-sync-cli.mjs +0 -31
  450. package/scripts/github-beads-sync/reverse-sync.mjs +0 -162
  451. package/scripts/github-beads-sync/run-bd.mjs +0 -161
  452. package/scripts/github-beads-sync/sanitize.mjs +0 -121
  453. package/scripts/github-beads-sync.config.json +0 -26
  454. package/scripts/sync-commands.js +0 -600
@@ -1,6 +1,14 @@
1
1
  const fs = require('node:fs');
2
2
  const path = require('node:path');
3
3
 
4
+ const { renderRulesForHarness } = require('./rules-sync');
5
+ const { getPackageRoot } = require('./package-root');
6
+
7
+ // Forge package root — the canonical `rules/` manifest lives here and is the
8
+ // single source for every harness's native rule files. On-disk under npm/npx;
9
+ // resolved to the extracted embed dir inside a compiled binary via getPackageRoot.
10
+ const PACKAGE_ROOT = path.join(__dirname, '..');
11
+
4
12
  /**
5
13
  * Generate universal AGENTS.md file that works with all supported AI agents
6
14
  * @param {string} projectPath - Path to the project root
@@ -68,25 +76,6 @@ async function detectProjectMetadata(projectPath) {
68
76
  return meta;
69
77
  }
70
78
 
71
- /**
72
- * Write a file unless it already exists, unless overwrite is enabled.
73
- *
74
- * @param {string} filePath
75
- * @param {string} content
76
- * @param {boolean} overwrite
77
- * @returns {Promise<void>}
78
- */
79
- async function writeIfNeeded(filePath, content, overwrite = false) {
80
- const exists = await fs.promises.access(filePath).then(() => true).catch(() => false);
81
- if (!exists || overwrite) {
82
- await fs.promises.writeFile(filePath, content, 'utf-8');
83
- }
84
- }
85
-
86
- function createConditionalWriter(overwrite) {
87
- return (filePath, content) => writeIfNeeded(filePath, content, overwrite);
88
- }
89
-
90
79
  /**
91
80
  * Generate AGENTS.md content
92
81
  * @param {Object} meta - Project metadata
@@ -95,14 +84,13 @@ function createConditionalWriter(overwrite) {
95
84
  function generateAgentsMdContent(meta) {
96
85
  return `# Forge Workflow Framework
97
86
 
98
- This project uses the **Forge 7-Stage TDD Workflow** for development.
87
+ This project uses the **Forge TDD Workflow Template** for development. The commands are composable building blocks, not a mandatory fixed ladder.
99
88
 
100
89
  ## Supported AI Agents
101
90
 
102
- This workflow works with all major AI coding agents:
91
+ Forge currently supports Claude Code, Codex, and Cursor. Hermes support is planned.
103
92
  - **Claude Code** - Native custom slash commands, skills
104
- - **GitHub Copilot** - Enterprise support, multi-editor, MCP
105
- - **Kilo Code** - Auto failure recovery, managed indexing
93
+ - **Codex** - OpenAI's CLI agent, skills-based workflow
106
94
  - **Cursor** - IDE-integrated, native Plan/Ask/Debug modes
107
95
 
108
96
  ## Quick Start
@@ -113,7 +101,7 @@ ${meta.testCommand} # Run tests
113
101
  ${meta.buildCommand} # Build project
114
102
  \`\`\`
115
103
 
116
- ## Forge 7-Stage TDD Workflow
104
+ ## Forge TDD Workflow Template
117
105
 
118
106
  ### Utility: /status
119
107
  Check current context and active work
@@ -121,14 +109,14 @@ Check current context and active work
121
109
  - Check Beads issues (if installed) for active work
122
110
  - Identify current workflow stage
123
111
 
124
- ### Stage 1: /plan
112
+ ### /plan
125
113
  Create implementation plan
126
114
  - Research with web search (parallel-ai MCP recommended)
127
- - Document findings in \`docs/plans/<feature-slug>-design.md\`
115
+ - Document findings in \`docs/work/YYYY-MM-DD-<feature-slug>/plan.md\`
128
116
  - Include decision rationale and security considerations
129
117
  - Generate plan, create Beads issue, break into TDD cycles
130
118
 
131
- ### Stage 2: /dev
119
+ ### /dev
132
120
  TDD development (RED-GREEN-REFACTOR)
133
121
  - **RED**: Write failing test FIRST
134
122
  - **GREEN**: Implement minimal code to pass
@@ -136,7 +124,7 @@ TDD development (RED-GREEN-REFACTOR)
136
124
  - Commit after each cycle
137
125
  - Push regularly to remote
138
126
 
139
- ### Stage 3: /validate
127
+ ### /validate
140
128
  Validation and quality gates
141
129
  - Type checking${meta.language === 'TypeScript' ? ' (TypeScript strict mode)' : ''}
142
130
  - Linting (ESLint)
@@ -144,14 +132,14 @@ Validation and quality gates
144
132
  - Test suite (all tests must pass)
145
133
  - Code coverage verification
146
134
 
147
- ### Stage 4: /ship
135
+ ### /ship
148
136
  Create pull request
149
137
  - Generate PR body with context
150
138
  - Reference Beads issues
151
139
  - Include test coverage metrics
152
140
  - Link to research and plan documents
153
141
 
154
- ### Stage 5: /review
142
+ ### /review
155
143
  Address ALL PR feedback
156
144
  - GitHub Actions failures
157
145
  - Code review comments
@@ -159,15 +147,9 @@ Address ALL PR feedback
159
147
  - Security scan results
160
148
  - Resolve all threads before merge
161
149
 
162
- ### Stage 6: /premerge
163
- Merge and cleanup
164
- - Update documentation
165
- - Merge pull request (squash commits)
166
- - Delete feature branch
167
- - Archive completed work
168
- - Close Beads issues
150
+ > **Pre-merge gate** (not a numbered stage): before merge, finish docs on the feature branch, confirm CI is green, and hand off the PR. This gate is embedded in the \`/ship\` and \`/review\` stages, not a standalone command.
169
151
 
170
- ### Stage 7: /verify
152
+ ### /verify
171
153
  Final documentation cross-check
172
154
  - Verify all docs updated correctly
173
155
  - Check for broken links
@@ -230,8 +212,8 @@ forge close <id> # Complete
230
212
  forge sync # Sync Beads state
231
213
  \`\`\`
232
214
 
233
- Use \`bd\` directly only for capabilities Forge does not wrap yet, such as
234
- \`bd init\`, \`bd comments\`, \`bd dep\`, and \`bd dolt\`.
215
+ Use \`forge issue\` subcommands for everything else, such as
216
+ \`forge issue comment\`, \`forge issue dep\`, and \`forge issue stats\`.
235
217
 
236
218
  ## Git Workflow
237
219
 
@@ -260,10 +242,7 @@ git commit -m "refactor: extract helpers" # REFACTOR
260
242
 
261
243
  While this universal AGENTS.md works with all agents, you can optionally enable agent-specific enhancements:
262
244
 
263
- - **GitHub Copilot**: \`.github/copilot-instructions.md\` + path-specific instructions
264
245
  - **Cursor**: \`.cursor/rules/*.mdc\` + native modes
265
- - **OpenCode**: \`opencode.json\` + custom agents
266
- - **Kilo**: \`.kilocode/workflows\`, \`.kilocode/rules\`, \`.kilocode/skills\`
267
246
 
268
247
  Generate with: \`bunx forge setup --agent=<name>\`
269
248
 
@@ -278,371 +257,6 @@ For questions or issues with Forge workflow, see project documentation or GitHub
278
257
  `;
279
258
  }
280
259
 
281
- /**
282
- * Generate GitHub Copilot configuration files
283
- * @param {string} projectPath - Path to the project root
284
- * @param {Object} options - Generation options
285
- * @param {boolean} options.overwrite - Whether to overwrite existing files (default: false)
286
- * @returns {Promise<void>}
287
- */
288
- async function generateCopilotConfig(projectPath, options = {}) {
289
- const { overwrite = false } = options;
290
-
291
- // Detect project metadata
292
- const projectMeta = await detectProjectMetadata(projectPath);
293
-
294
- // Create .github directory structure
295
- const githubDir = path.join(projectPath, '.github');
296
- const instructionsDir = path.join(githubDir, 'instructions');
297
- const promptsDir = path.join(githubDir, 'prompts');
298
-
299
- await fs.promises.mkdir(instructionsDir, { recursive: true });
300
- await fs.promises.mkdir(promptsDir, { recursive: true });
301
-
302
- const writeConfigFile = createConditionalWriter(overwrite);
303
-
304
- // 1. Create .github/copilot-instructions.md
305
- const copilotInstructionsPath = path.join(githubDir, 'copilot-instructions.md');
306
- const copilotInstructionsContent = generateCopilotInstructionsContent(projectMeta);
307
- await writeConfigFile(copilotInstructionsPath, copilotInstructionsContent);
308
-
309
- // 2. Create .github/instructions/typescript.instructions.md
310
- const tsInstructionsPath = path.join(instructionsDir, 'typescript.instructions.md');
311
- const tsInstructionsContent = generateTypeScriptInstructionsContent();
312
- await writeConfigFile(tsInstructionsPath, tsInstructionsContent);
313
-
314
- // 3. Create .github/instructions/testing.instructions.md
315
- const testInstructionsPath = path.join(instructionsDir, 'testing.instructions.md');
316
- const testInstructionsContent = generateTestingInstructionsContent();
317
- await writeConfigFile(testInstructionsPath, testInstructionsContent);
318
-
319
- // 4. Create .github/prompts/red.prompt.md
320
- const redPromptPath = path.join(promptsDir, 'red.prompt.md');
321
- const redPromptContent = generateRedPromptContent();
322
- await writeConfigFile(redPromptPath, redPromptContent);
323
-
324
- // 5. Create .github/prompts/green.prompt.md
325
- const greenPromptPath = path.join(promptsDir, 'green.prompt.md');
326
- const greenPromptContent = generateGreenPromptContent();
327
- await writeConfigFile(greenPromptPath, greenPromptContent);
328
- }
329
-
330
- /**
331
- * Generate .github/copilot-instructions.md content
332
- */
333
- function generateCopilotInstructionsContent(meta) {
334
- const packageManager = meta.testCommand?.includes('bun') ? 'bun' : 'npm';
335
-
336
- return `# Forge Workflow Framework
337
-
338
- This project uses the **Forge 7-Stage TDD Workflow** for development with GitHub Copilot.
339
-
340
- ## Quick Start
341
-
342
- \`\`\`bash
343
- ${packageManager} install # Install dependencies
344
- ${meta.testCommand} # Run tests
345
- ${meta.buildCommand} # Build project
346
- \`\`\`
347
-
348
- ## Tech Stack
349
-
350
- ${meta.language ? `- **Language**: ${meta.language} (strict mode enabled)` : '- **Language**: JavaScript'}
351
- - **Package Manager**: ${packageManager}
352
- - **Testing**: TDD-first approach (tests before implementation)
353
- - **Security**: OWASP Top 10 compliance required
354
- - **Version Control**: Git with conventional commits
355
-
356
- ## Forge 7-Stage TDD Workflow
357
-
358
- ### Utility: /status
359
- Check current context and active work
360
- - Review git status and recent commits
361
- - Check Beads issues (if installed) for active work
362
- - Identify current workflow stage
363
-
364
- ### Stage 1: /plan
365
- Create implementation plan
366
- - Research with web search
367
- - Document findings in \`docs/plans/<feature-slug>-design.md\`
368
- - **Security**: Identify OWASP Top 10 considerations
369
- - Generate plan, create Beads issue, break into TDD cycles
370
-
371
- ### Stage 2: /dev
372
- **TDD development (RED-GREEN-REFACTOR)**
373
- - **RED**: Write failing test FIRST
374
- - **GREEN**: Implement minimal code to pass
375
- - **REFACTOR**: Clean up and optimize
376
- - Commit after each cycle
377
- - Push regularly to remote
378
-
379
- ### Stage 3: /validate
380
- Validation and quality gates
381
- - Type checking${meta.language === 'TypeScript' ? ' (TypeScript strict mode)' : ''}
382
- - Linting (ESLint - no errors allowed)
383
- - Security scanning (npm audit, OWASP checks)
384
- - Test suite (all tests must pass)
385
- - Code coverage verification (80%+ required)
386
-
387
- ### Stage 4: /ship
388
- Create pull request
389
- - Generate PR body with context
390
- - Reference Beads issues
391
- - Include test coverage metrics
392
- - Link to research and plan documents
393
-
394
- ### Stage 5: /review
395
- Address ALL PR feedback
396
- - GitHub Actions failures
397
- - Code review comments
398
- - AI review tools (Greptile, CodeRabbit if configured)
399
- - Security scan results
400
- - **IMPORTANT**: Resolve all comment threads before merge
401
-
402
- ### Stage 6: /premerge
403
- Merge and cleanup
404
- - Update documentation
405
- - Merge pull request (squash commits only)
406
- - Delete feature branch
407
- - Archive completed work
408
- - Close Beads issues
409
-
410
- ### Stage 7: /verify
411
- Final documentation cross-check
412
- - Verify all docs updated correctly
413
- - Check for broken links
414
- - Validate code examples
415
- - Ensure consistency across documentation
416
-
417
- ## Core Principles
418
-
419
- ### 1. TDD-First Development (MANDATORY)
420
- - Tests written UPFRONT in RED-GREEN-REFACTOR cycles
421
- - **NO implementation without failing test first**
422
- - Commit after each GREEN cycle
423
- - Maintain high code coverage (80%+ minimum)
424
-
425
- ### 2. Research-First Approach
426
- - All features start with comprehensive research
427
- - Use web search for best practices and security analysis
428
- - Document findings before implementation
429
- - **Include OWASP Top 10 analysis for security-critical features**
430
-
431
- ### 3. Security Built-In
432
- - **OWASP Top 10** analysis for every new feature:
433
- - A01: Broken Access Control
434
- - A02: Cryptographic Failures
435
- - A03: Injection
436
- - A04: Insecure Design
437
- - A05: Security Misconfiguration
438
- - A06: Vulnerable and Outdated Components
439
- - A07: Identification and Authentication Failures
440
- - A08: Software and Data Integrity Failures
441
- - A09: Security Logging and Monitoring Failures
442
- - A10: Server-Side Request Forgery (SSRF)
443
- - Security test scenarios identified upfront
444
- - Automated scans + manual review
445
- - Input validation and sanitization
446
-
447
- ### 4. Documentation Progressive
448
- - Updated at relevant stages (not deferred to end)
449
- - Cross-checked at /verify stage
450
- - Never accumulate documentation debt
451
- - Keep README, docs/, and inline comments synchronized
452
-
453
- ## Git Workflow
454
-
455
- **Branch naming**:
456
- - \`feat/<feature-slug>\` - New features
457
- - \`fix/<bug-slug>\` - Bug fixes
458
- - \`docs/<doc-slug>\` - Documentation updates
459
-
460
- **Commit pattern** (conventional commits):
461
- \`\`\`bash
462
- git commit -m "test: add validation tests" # RED phase
463
- git commit -m "feat: implement validation" # GREEN phase
464
- git commit -m "refactor: extract helpers" # REFACTOR phase
465
- \`\`\`
466
-
467
- **Pre-commit hooks** (automatic via Lefthook):
468
- - TDD enforcement (source files must have tests)
469
- - Interactive prompts (option to unstage, continue, or abort)
470
-
471
- **Pre-push hooks** (automatic):
472
- - Branch protection (blocks direct push to main/master)
473
- - ESLint check (blocks on errors)
474
- - Test suite (all tests must pass)
475
-
476
- ## MCP Servers (Enhanced Capabilities)
477
-
478
- Configure these MCP servers in \`.mcp.json\`:
479
-
480
- - **github**: Repository integration (usually built-in)
481
- - **parallel-ai**: Web research and data enrichment
482
- - **context7**: Up-to-date library documentation
483
-
484
- ## Issue Tracking with Beads
485
-
486
- Use **Forge's Beads wrapper** for persistent tracking across sessions:
487
-
488
- \`\`\`bash
489
- forge create "Feature name" # Create issue
490
- forge claim <id> # Claim work
491
- forge update <id> --append-notes "Progress" # Add notes
492
- forge close <id> # Complete
493
- forge sync # Sync Beads state
494
- \`\`\`
495
-
496
- Use \`bd\` directly only for capabilities Forge does not wrap yet, such as
497
- \`bd init\`, \`bd comments\`, \`bd dep\`, and \`bd dolt\`.
498
-
499
- ## Code Quality Standards
500
-
501
- ${meta.language === 'TypeScript' ? `
502
- ### TypeScript
503
- - Strict mode enabled (\`strict: true\` in tsconfig.json)
504
- - No \`any\` types without explicit justification
505
- - Prefer interfaces over types for object shapes
506
- - Use const assertions for literal types
507
- ` : ''}
508
-
509
- ### Testing
510
- - TDD-first: Write failing test BEFORE implementation
511
- - Use descriptive test names ("it should...")
512
- - Arrange-Act-Assert pattern
513
- - Mock external dependencies
514
- - Test edge cases and error scenarios
515
-
516
- ### Security
517
- - Validate all user input
518
- - Sanitize output to prevent XSS
519
- - Use parameterized queries (prevent SQL injection)
520
- - Implement proper authentication and authorization
521
- - Never commit secrets or credentials
522
-
523
- ## Additional Resources
524
-
525
- - **Workflow Guide**: \`AGENTS.md\`
526
- - **Architecture**: \`docs/ARCHITECTURE.md\`
527
- - **Configuration**: \`docs/CONFIGURATION.md\`
528
- `;
529
- }
530
-
531
- /**
532
- * Generate .github/instructions/typescript.instructions.md content
533
- */
534
- function generateTypeScriptInstructionsContent() {
535
- return `---
536
- applyTo: "**/*.ts"
537
- ---
538
-
539
- # TypeScript Guidelines
540
-
541
- When working with TypeScript files in this project:
542
-
543
- ## Type Safety
544
- - **strict mode is enabled** - No shortcuts with types
545
- - Avoid \`any\` type - Use \`unknown\` and type guards instead
546
- - Prefer interfaces over type aliases for object shapes
547
- - Use const assertions for literal types
548
-
549
- ## Code Style
550
- - Use explicit return types for public functions
551
- - Leverage type inference for local variables
552
- - Use utility types (\`Partial\`, \`Pick\`, \`Omit\`, etc.) appropriately
553
- - Document complex types with JSDoc comments
554
-
555
- ## Common Patterns
556
- - Use discriminated unions for state management
557
- - Prefer \`readonly\` for immutable data
558
- - Use \`unknown\` instead of \`any\` for truly unknown types
559
- - Leverage template literal types for string validation
560
-
561
- ## Error Handling
562
- - Create custom error types for domain-specific errors
563
- - Use type guards to narrow error types
564
- - Always type catch clauses (\`catch (error: unknown)\`)
565
- `;
566
- }
567
-
568
- /**
569
- * Generate .github/instructions/testing.instructions.md content
570
- */
571
- function generateTestingInstructionsContent() {
572
- return `---
573
- applyTo: "**/*.test.ts"
574
- ---
575
-
576
- # Testing Guidelines
577
-
578
- When writing tests in this project:
579
-
580
- ## TDD-First Approach
581
- - **Write failing test BEFORE implementation** (RED phase)
582
- - Run test to confirm it fails for the right reason
583
- - Implement minimal code to make test pass (GREEN phase)
584
- - Refactor while keeping tests green (REFACTOR phase)
585
-
586
- ## Test Structure
587
- - Use descriptive test names: "it should [expected behavior] when [condition]"
588
- - Follow Arrange-Act-Assert pattern:
589
- - **Arrange**: Set up test data and preconditions
590
- - **Act**: Execute the code under test
591
- - **Assert**: Verify the expected outcome
592
-
593
- ## Best Practices
594
- - One assertion per test (or closely related assertions)
595
- - Test edge cases and error scenarios
596
- - Mock external dependencies (APIs, databases, file system)
597
- - Use fixtures for complex test data
598
- - Keep tests fast and independent
599
-
600
- ## Coverage
601
- - Aim for 80%+ code coverage
602
- - Focus on testing behavior, not implementation details
603
- - Test public interfaces, not private methods
604
- - Include integration tests for critical paths
605
-
606
- ## Security Testing
607
- - Test input validation and sanitization
608
- - Verify authentication and authorization
609
- - Test error messages don't leak sensitive data
610
- - Include security-specific test cases for OWASP Top 10
611
- `;
612
- }
613
-
614
- /**
615
- * Generate .github/prompts/red.prompt.md content
616
- */
617
- function generateRedPromptContent() {
618
- return `Write a failing test for the following requirement.
619
-
620
- Follow TDD red-green-refactor cycle:
621
- - Test should fail initially (RED phase)
622
- - Use descriptive test name
623
- - Follow Arrange-Act-Assert pattern
624
- - Test one behavior per test case
625
-
626
- Do NOT implement the feature yet - only write the test.
627
- `;
628
- }
629
-
630
- /**
631
- * Generate .github/prompts/green.prompt.md content
632
- */
633
- function generateGreenPromptContent() {
634
- return `Implement minimal code to make the failing test pass.
635
-
636
- Follow TDD principles:
637
- - Write only enough code to pass the test (GREEN phase)
638
- - Keep implementation simple and focused
639
- - Don't add features not covered by tests
640
- - Ensure all tests pass
641
-
642
- Refactoring comes after this step - focus on making it work first.
643
- `;
644
- }
645
-
646
260
  /**
647
261
  * Generate Cursor configuration files
648
262
  * @param {string} projectPath - Path to the project root
@@ -653,768 +267,17 @@ Refactoring comes after this step - focus on making it work first.
653
267
  async function generateCursorConfig(projectPath, options = {}) {
654
268
  const { overwrite = false } = options;
655
269
 
656
- // Detect project metadata
657
- const projectMeta = await detectProjectMetadata(projectPath);
658
-
659
- // Create .cursor/rules directory structure
660
- const cursorDir = path.join(projectPath, '.cursor');
661
- const rulesDir = path.join(cursorDir, 'rules');
662
-
663
- await fs.promises.mkdir(rulesDir, { recursive: true });
664
-
665
- const writeConfigFile = createConditionalWriter(overwrite);
666
-
667
- // 1. Create .cursor/rules/forge-workflow.mdc
668
- const workflowPath = path.join(rulesDir, 'forge-workflow.mdc');
669
- const workflowContent = generateCursorWorkflowContent(projectMeta);
670
- await writeConfigFile(workflowPath, workflowContent);
671
-
672
- // 2. Create .cursor/rules/tdd-enforcement.mdc
673
- const tddPath = path.join(rulesDir, 'tdd-enforcement.mdc');
674
- const tddContent = generateCursorTddContent();
675
- await writeConfigFile(tddPath, tddContent);
676
-
677
- // 3. Create .cursor/rules/security-scanning.mdc
678
- const securityPath = path.join(rulesDir, 'security-scanning.mdc');
679
- const securityContent = generateCursorSecurityContent();
680
- await writeConfigFile(securityPath, securityContent);
681
-
682
- // 4. Create .cursor/rules/documentation.mdc
683
- const docsPath = path.join(rulesDir, 'documentation.mdc');
684
- const docsContent = generateCursorDocumentationContent();
685
- await writeConfigFile(docsPath, docsContent);
686
- }
687
-
688
- /**
689
- * Generate .cursor/rules/forge-workflow.mdc content
690
- */
691
- function generateCursorWorkflowContent(meta) {
692
- const packageManager = meta.testCommand?.includes('bun') ? 'bun' : 'npm';
693
-
694
- return `---
695
- description: "When working with Forge workflow stages"
696
- alwaysApply: true
697
- ---
698
-
699
- # Forge 7-Stage TDD Workflow
700
-
701
- Always follow these stages in order:
702
-
703
- ## Utility: /status
704
- Check current context and active work
705
- - Review git status and recent commits
706
- - Check Beads issues (if installed) for active work
707
- - Identify current workflow stage
708
-
709
- ## Stage 1: /plan
710
- Create implementation plan
711
- - Research with parallel-ai
712
- - Document findings in \`docs/plans/<feature-slug>-design.md\`
713
- - **Security**: OWASP Top 10 analysis
714
- - Generate plan, create Beads issue, break into TDD cycles
715
-
716
- ## Stage 2: /dev
717
- **TDD development (RED-GREEN-REFACTOR)**
718
- - **RED**: Write failing test FIRST
719
- - **GREEN**: Implement minimal code to pass
720
- - **REFACTOR**: Clean up and optimize
721
- - Commit after each cycle
722
- - Push regularly to remote
723
-
724
- ## Stage 3: /validate
725
- Validation (type/lint/tests/security)
726
- - Type checking${meta.language === 'TypeScript' ? ' (TypeScript strict mode)' : ''}
727
- - Linting (ESLint - no errors)
728
- - Security scanning (npm audit, OWASP)
729
- - Test suite (all tests must pass)
730
- - Code coverage (80%+ required)
731
-
732
- ## Stage 4: /ship
733
- Create PR with documentation
734
- - Generate PR body with context
735
- - Reference Beads issues
736
- - Include test coverage metrics
737
- - Link to research and plan documents
738
-
739
- ## Stage 5: /review
740
- Address ALL PR feedback
741
- - GitHub Actions failures
742
- - Code review comments
743
- - AI review tools (Greptile, CodeRabbit)
744
- - Security scan results
745
- - **IMPORTANT**: Resolve all comment threads
746
-
747
- ## Stage 6: /premerge
748
- Update docs, merge PR, cleanup
749
- - Update documentation
750
- - Merge pull request (squash commits only)
751
- - Delete feature branch
752
- - Archive completed work
753
- - Close Beads issues
754
-
755
- ## Stage 7: /verify
756
- Final documentation verification
757
- - Verify all docs updated correctly
758
- - Check for broken links
759
- - Validate code examples
760
- - Ensure consistency across documentation
761
-
762
- ## TDD Requirements
763
-
764
- **MANDATORY - No implementation without failing test**:
765
- - Write test FIRST (RED phase)
766
- - Implement minimal code to pass (GREEN phase)
767
- - Refactor and commit (REFACTOR phase)
768
- - No code changes without corresponding tests
769
-
770
- ## Tech Stack
771
-
772
- ${meta.language ? `- **Language**: ${meta.language}` : '- **Language**: JavaScript'}
773
- - **Package Manager**: ${packageManager}
774
- - **Testing**: TDD-first approach (tests before implementation)
775
- - **Security**: OWASP Top 10 compliance
776
- - **Version Control**: Git with conventional commits
777
-
778
- ## Cursor Native Modes
779
-
780
- Leverage Cursor's built-in modes:
781
- - **Agent Mode** (default): Full tools for implementation
782
- - **Ask Mode**: Read-only exploration and learning
783
- - **Plan Mode** (Shift+Tab): Create plans before coding
784
- - **Debug Mode**: Specialized bug hunting with instrumentation
785
-
786
- Use Plan Mode for complex features and architectural decisions.
787
- `;
788
- }
789
-
790
- /**
791
- * Generate .cursor/rules/tdd-enforcement.mdc content
792
- */
793
- function generateCursorTddContent() {
794
- return `---
795
- description: "TDD patterns and enforcement"
796
- globs: ["**/*.ts", "**/*.js", "**/*.test.ts", "**/*.test.js"]
797
- ---
798
-
799
- # TDD Enforcement
800
-
801
- ## RED-GREEN-REFACTOR Cycle
802
-
803
- ### RED Phase (Write Failing Test)
804
- 1. **Write test FIRST** - Before any implementation
805
- 2. Run test to confirm it fails for the right reason
806
- 3. Commit: \`git commit -m "test: add [feature] tests (RED)"\`
807
-
808
- ### GREEN Phase (Make Test Pass)
809
- 1. **Write minimal code** to make the test pass
810
- 2. Keep implementation simple and focused
811
- 3. Don't add features not covered by tests
812
- 4. Commit: \`git commit -m "feat: implement [feature] (GREEN)"\`
813
-
814
- ### REFACTOR Phase (Clean Up)
815
- 1. Improve code while keeping tests green
816
- 2. Extract helpers, remove duplication
817
- 3. Optimize performance if needed
818
- 4. Commit: \`git commit -m "refactor: [description]"\`
819
-
820
- ## Test Structure
821
-
822
- ### Naming Convention
823
- \`\`\`javascript
824
- test('should [expected behavior] when [condition]', async () => {
825
- // Arrange: Set up test data
826
- // Act: Execute code under test
827
- // Assert: Verify outcome
828
- });
829
- \`\`\`
830
-
831
- ### Best Practices
832
- - One assertion per test (or closely related assertions)
833
- - Test edge cases and error scenarios
834
- - Mock external dependencies (APIs, databases, file system)
835
- - Use fixtures for complex test data
836
- - Keep tests fast and independent
837
-
838
- ## Coverage Requirements
839
- - Minimum 80% code coverage
840
- - Focus on testing behavior, not implementation
841
- - Test public interfaces, not private methods
842
- - Include integration tests for critical paths
843
-
844
- ## Security Testing
845
- - Test input validation and sanitization
846
- - Verify authentication and authorization
847
- - Test error messages don't leak sensitive data
848
- - Include security-specific test cases for OWASP Top 10
849
- `;
850
- }
851
-
852
- /**
853
- * Generate .cursor/rules/security-scanning.mdc content
854
- */
855
- function generateCursorSecurityContent() {
856
- return `---
857
- description: "OWASP Top 10 security checks"
858
- ---
859
-
860
- # Security Scanning Guidelines
861
-
862
- ## OWASP Top 10 (2021)
863
-
864
- For every new feature, analyze these security risks:
865
-
866
- ### A01: Broken Access Control
867
- - Verify authorization checks on all protected resources
868
- - Test that users can't access data they shouldn't
869
- - Implement principle of least privilege
870
-
871
- ### A02: Cryptographic Failures
872
- - Never store passwords in plaintext
873
- - Use strong encryption algorithms (AES-256, RSA-2048+)
874
- - Protect data in transit (HTTPS, TLS 1.2+)
875
- - Secure key management
876
-
877
- ### A03: Injection
878
- - **SQL Injection**: Use parameterized queries
879
- - **XSS**: Sanitize output, use Content Security Policy
880
- - **Command Injection**: Validate and sanitize all inputs
881
- - Never concatenate user input into commands or queries
882
-
883
- ### A04: Insecure Design
884
- - Security requirements defined upfront
885
- - Threat modeling for new features
886
- - Defense in depth (multiple security layers)
887
- - Secure defaults
888
-
889
- ### A05: Security Misconfiguration
890
- - Remove default credentials
891
- - Disable unnecessary features and services
892
- - Keep dependencies up to date
893
- - Implement security headers
894
-
895
- ### A06: Vulnerable and Outdated Components
896
- - Regular dependency audits (\`npm audit\`)
897
- - Update dependencies promptly
898
- - Use Software Composition Analysis (SCA) tools
899
- - Monitor security advisories
900
-
901
- ### A07: Identification and Authentication Failures
902
- - Implement multi-factor authentication where appropriate
903
- - Secure password storage (bcrypt, Argon2)
904
- - Protect against brute force attacks (rate limiting)
905
- - Secure session management
906
-
907
- ### A08: Software and Data Integrity Failures
908
- - Verify digital signatures
909
- - Use integrity checks for critical data
910
- - Implement code signing
911
- - Secure CI/CD pipelines
912
-
913
- ### A09: Security Logging and Monitoring Failures
914
- - Log all security-relevant events
915
- - Protect logs from tampering
916
- - Implement alerting for suspicious activity
917
- - Regular log review
918
-
919
- ### A10: Server-Side Request Forgery (SSRF)
920
- - Validate and sanitize all URLs
921
- - Use allowlists for external requests
922
- - Disable unnecessary protocols
923
- - Network segmentation
924
-
925
- ## Security Testing Checklist
926
-
927
- For each feature:
928
- - [ ] Input validation implemented and tested
929
- - [ ] Output sanitization verified
930
- - [ ] Authentication and authorization tested
931
- - [ ] Error messages don't leak sensitive data
932
- - [ ] Dependencies scanned for vulnerabilities
933
- - [ ] Security test cases added to test suite
934
- - [ ] OWASP Top 10 risks analyzed
935
- `;
936
- }
937
-
938
- /**
939
- * Generate .cursor/rules/documentation.mdc content
940
- */
941
- function generateCursorDocumentationContent() {
942
- return `---
943
- description: "Progressive documentation standards"
944
- ---
945
-
946
- # Documentation Standards
947
-
948
- ## Progressive Documentation
949
-
950
- Update documentation at relevant stages (not deferred to end):
951
-
952
- ### During /plan (Stage 1)
953
- - Document findings in \`docs/plans/<feature-slug>-design.md\`
954
- - Include decision rationale
955
- - Document alternatives considered
956
- - Security considerations (OWASP analysis)
957
-
958
- ### During /plan (Stage 3)
959
- - Create implementation plan in \`docs/plans/<feature-slug>.md\`
960
- - Document test scenarios
961
- - Identify affected files
962
-
963
- ### During /dev (Stage 4)
964
- - Add inline code comments for complex logic
965
- - Update JSDoc/TSDoc for public APIs
966
- - Keep comments synchronized with code changes
967
-
968
- ### During /ship (Stage 6)
969
- - Update README if user-facing changes
970
- - Update CHANGELOG with conventional commit summary
971
- - Document breaking changes
972
- - Add migration guide if needed
973
-
974
- ### During /verify (Stage 7)
975
- - Cross-check all documentation updated
976
- - Validate code examples still work
977
- - Check for broken internal links
978
- - Ensure terminology consistency
979
-
980
- ## Documentation Types
981
-
982
- ### Code Comments
983
- - **What to comment**: Why, not what
984
- - Document non-obvious decisions
985
- - Explain complex algorithms
986
- - Note security considerations
987
- - Reference tickets/issues for context
988
-
989
- ### API Documentation
990
- - Use JSDoc/TSDoc for public APIs
991
- - Include parameter types and return types
992
- - Provide usage examples
993
- - Document error conditions
994
- - List breaking changes in version updates
995
-
996
- ### README Updates
997
- - Keep Quick Start section current
998
- - Update feature list
999
- - Maintain installation instructions
1000
- - Document configuration options
1001
- - Include troubleshooting section
1002
-
1003
- ## Documentation Quality
1004
-
1005
- ### Consistency
1006
- - Use consistent terminology across docs
1007
- - Follow project style guide
1008
- - Maintain consistent formatting
1009
- - Use same voice and tone
1010
-
1011
- ### Clarity
1012
- - Write for your audience (developers, users, etc.)
1013
- - Use examples liberally
1014
- - Avoid jargon without explanation
1015
- - Keep sentences short and clear
1016
-
1017
- ### Maintainability
1018
- - Link to code where appropriate
1019
- - Use relative links for internal docs
1020
- - Keep docs close to the code they describe
1021
- - Remove outdated documentation promptly
1022
- `;
1023
- }
1024
-
1025
- /**
1026
- * Generate Kilo Code configuration files
1027
- * @param {string} projectPath - Path to the project root
1028
- * @param {Object} options - Generation options
1029
- * @param {boolean} options.overwrite - Whether to overwrite existing files (default: false)
1030
- * @returns {Promise<void>}
1031
- */
1032
- async function generateKiloConfig(projectPath, options = {}) {
1033
- const { overwrite = false } = options;
1034
-
1035
- // Detect project metadata
1036
- const projectMeta = await detectProjectMetadata(projectPath);
1037
-
1038
- const kilocodeDir = path.join(projectPath, '.kilocode');
1039
- const workflowsDir = path.join(kilocodeDir, 'workflows');
1040
- const rulesDir = path.join(kilocodeDir, 'rules');
1041
- const skillsDir = path.join(kilocodeDir, 'skills', 'forge-workflow');
1042
-
1043
- await fs.promises.mkdir(workflowsDir, { recursive: true });
1044
- await fs.promises.mkdir(rulesDir, { recursive: true });
1045
- await fs.promises.mkdir(skillsDir, { recursive: true });
1046
-
1047
- await writeIfNeeded(
1048
- path.join(workflowsDir, 'forge-workflow.md'),
1049
- generateKiloWorkflowContent(projectMeta),
1050
- overwrite
1051
- );
1052
- await writeIfNeeded(
1053
- path.join(rulesDir, 'workflow.md'),
1054
- generateKiloRulesContent(projectMeta),
1055
- overwrite
1056
- );
1057
- await writeIfNeeded(
1058
- path.join(skillsDir, 'SKILL.md'),
1059
- generateKiloSkillContent(projectMeta),
1060
- overwrite
1061
- );
1062
- }
1063
-
1064
- /**
1065
- * Generate .kilocode/workflows/forge-workflow.md content
1066
- */
1067
- function generateKiloWorkflowContent(meta) {
1068
- const packageManager = meta.testCommand?.includes('bun') ? 'bun' : 'npm';
1069
-
1070
- return `---
1071
- description: "Forge workflow for Kilo Code"
1072
- ---
1073
-
1074
- # Forge Workflow Framework - Kilo Code
1075
-
1076
- This project uses the **Forge 7-Stage TDD Workflow** with Kilo Code native workflows.
1077
-
1078
- ## Quick Start
1079
-
1080
- \`\`\`bash
1081
- ${packageManager} install # Install dependencies
1082
- ${meta.testCommand} # Run tests
1083
- ${meta.buildCommand} # Build project
1084
- \`\`\`
1085
-
1086
- ## Native Kilo Surface
1087
-
1088
- Kilo Code uses native workflows, rules, and skills. Forge generates:
1089
- - \`.kilocode/workflows/forge-workflow.md\`
1090
- - \`.kilocode/rules/workflow.md\`
1091
- - \`.kilocode/skills/forge-workflow/SKILL.md\`
1092
-
1093
- These complement the Forge workflow stages below.
1094
-
1095
- ## Forge 7-Stage TDD Workflow
1096
-
1097
- ### Utility: /status
1098
- Check current context and active work
1099
- - Review git status and recent commits
1100
- - Check Beads issues (if installed)
1101
-
1102
- ### Stage 1: /plan
1103
- Create implementation plan
1104
- - Research with web search
1105
- - Document findings in \`docs/plans/<feature-slug>-design.md\`
1106
- - Security: OWASP Top 10 analysis
1107
- - Generate plan, create Beads issue, break into TDD cycles
1108
-
1109
- ### Stage 2: /dev
1110
- **TDD development (RED-GREEN-REFACTOR)**
1111
- - **RED**: Write failing test FIRST
1112
- - **GREEN**: Implement minimal code to pass
1113
- - **REFACTOR**: Clean up and optimize
1114
- - Commit after each cycle
1115
-
1116
- ### Stage 3: /validate
1117
- Validation (type/lint/tests/security)
1118
- - Type checking${meta.language === 'TypeScript' ? ' (TypeScript strict mode)' : ''}
1119
- - Linting (ESLint)
1120
- - Security scanning
1121
- - Test suite (all tests must pass)
1122
- - Code coverage (80%+ required)
1123
-
1124
- ### Stage 4: /ship
1125
- Create pull request
1126
- - Generate PR body with context
1127
- - Reference Beads issues
1128
- - Include test coverage metrics
1129
-
1130
- ### Stage 5: /review
1131
- Address ALL PR feedback
1132
- - GitHub Actions failures
1133
- - Code review comments
1134
- - AI review tools
1135
- - Resolve all comment threads
1136
-
1137
- ### Stage 6: /premerge
1138
- Merge and cleanup
1139
- - Update documentation
1140
- - Merge PR (squash commits)
1141
- - Delete feature branch
1142
- - Close Beads issues
1143
-
1144
- ### Stage 7: /verify
1145
- Final documentation verification
1146
- - Verify all docs updated
1147
- - Check for broken links
1148
- - Validate code examples
1149
- `;
1150
- }
1151
-
1152
- /**
1153
- * Generate .kilocode/rules/workflow.md content
1154
- */
1155
- function generateKiloRulesContent(meta) {
1156
- const packageManager = meta.testCommand?.includes('bun') ? 'bun' : 'npm';
1157
-
1158
- return `---
1159
- description: "Forge workflow rules for Kilo Code"
1160
- ---
1161
-
1162
- # Forge Workflow Rules
1163
-
1164
- - Use Forge as the source of truth for stage order and hard stops.
1165
- - Run \`forge <stage>\` before continuing any workflow stage.
1166
- - Treat \`.kilocode/workflows\` as the canonical workflow surface.
1167
- - Keep \`AGENTS.md\` as shared context, not the workflow authority.
1168
- - If Forge blocks a stage, fix the prerequisite or provide an explicit override payload.
1169
-
1170
- ## Environment
1171
-
1172
- - Package manager: ${packageManager}
1173
- - Language: ${meta.language ? meta.language : 'JavaScript'}
1174
- `;
1175
- }
1176
-
1177
- /**
1178
- * Generate .kilocode/skills/forge-workflow/SKILL.md content
1179
- */
1180
- function generateKiloSkillContent(meta) {
1181
- const packageManager = meta.testCommand?.includes('bun') ? 'bun' : 'npm';
1182
-
1183
- return `---
1184
- name: forge-workflow
1185
- description: Forge stage adapter for Kilo Code
1186
- ---
1187
-
1188
- # Forge Workflow Skill
1189
-
1190
- Before starting any stage, invoke \`forge <stage>\` so Forge can enforce stage order, prerequisites, and overrides.
1191
- If Forge blocks the stage, stop and resolve it first.
1192
-
1193
- ## Workflow Context
1194
-
1195
- - Package manager: ${packageManager}
1196
- - Language: ${meta.language ? meta.language : 'JavaScript'}
1197
- - Canonical workflow surface: \`.kilocode/workflows/forge-workflow.md\`
1198
- - Shared context: \`AGENTS.md\`
1199
-
1200
- ## Supported Stages
1201
-
1202
- - \`/status\`
1203
- - \`/plan\`
1204
- - \`/dev\`
1205
- - \`/validate\`
1206
- - \`/ship\`
1207
- - \`/review\`
1208
- - \`/premerge\`
1209
- - \`/verify\`
1210
- `;
1211
- }
1212
-
1213
- /**
1214
- * Generate OpenCode configuration files
1215
- * @param {string} projectPath - Path to the project root
1216
- * @param {Object} options - Generation options
1217
- * @param {boolean} options.overwrite - Whether to overwrite existing files (default: false)
1218
- * @returns {Promise<void>}
1219
- */
1220
- async function generateOpenCodeConfig(projectPath, options = {}) {
1221
- const { overwrite = false } = options;
1222
-
1223
- // Detect project metadata
1224
- const projectMeta = await detectProjectMetadata(projectPath);
1225
-
1226
- // Create .opencode/agents directory
1227
- const opencodeDir = path.join(projectPath, '.opencode');
1228
- const agentsDir = path.join(opencodeDir, 'agents');
1229
- await fs.promises.mkdir(agentsDir, { recursive: true });
1230
-
1231
- const writeConfigFile = createConditionalWriter(overwrite);
1232
-
1233
- // 1. Create opencode.json
1234
- const opencodeJsonPath = path.join(projectPath, 'opencode.json');
1235
- const opencodeJsonContent = generateOpenCodeJsonContent(projectMeta);
1236
- await writeConfigFile(opencodeJsonPath, opencodeJsonContent);
1237
-
1238
- // 2. Create .opencode/agents/plan-review.md
1239
- const planAgentPath = path.join(agentsDir, 'plan-review.md');
1240
- const planAgentContent = generateOpenCodePlanAgentContent();
1241
- await writeConfigFile(planAgentPath, planAgentContent);
1242
-
1243
- // 3. Create .opencode/agents/tdd-build.md
1244
- const buildAgentPath = path.join(agentsDir, 'tdd-build.md');
1245
- const buildAgentContent = generateOpenCodeBuildAgentContent();
1246
- await writeConfigFile(buildAgentPath, buildAgentContent);
1247
- }
1248
-
1249
- /**
1250
- * Generate opencode.json content
1251
- */
1252
- function generateOpenCodeJsonContent(_meta) {
1253
- return JSON.stringify({
1254
- "$schema": "https://opencode.ai/config.json",
1255
- "agent": {
1256
- "build": {
1257
- "mode": "primary",
1258
- "model": "anthropic/claude-sonnet-4-20250514",
1259
- "tools": {
1260
- "write": true,
1261
- "edit": true,
1262
- "bash": true
1263
- }
1264
- },
1265
- "plan": {
1266
- "mode": "primary",
1267
- "model": "anthropic/claude-haiku-4-20250514",
1268
- "tools": {
1269
- "write": false,
1270
- "edit": false,
1271
- "bash": false
1272
- }
1273
- }
1274
- },
1275
- "mcp_servers": {
1276
- "parallel-ai": {
1277
- "type": "stdio",
1278
- "command": "npx",
1279
- "args": ["-y", "@parallel-ai/mcp-server"],
1280
- "env": {
1281
- "API_KEY": "${env:PARALLEL_AI_TOKEN}"
1282
- }
1283
- },
1284
- "context7": {
1285
- "type": "stdio",
1286
- "command": "npx",
1287
- "args": ["-y", "@context7/mcp-server"]
1288
- }
1289
- }
1290
- }, null, 2);
1291
- }
1292
-
1293
- /**
1294
- * Generate .opencode/agents/plan-review.md content
1295
- */
1296
- function generateOpenCodePlanAgentContent() {
1297
- return `---
1298
- description: Read-only planning and analysis
1299
- mode: subagent
1300
- model: anthropic/claude-sonnet-4-20250514
1301
- temperature: 0.1
1302
- tools:
1303
- write: false
1304
- edit: false
1305
- bash: false
1306
- ---
1307
-
1308
- # Planning & Review Agent
1309
-
1310
- You are in **planning mode** for the Forge 7-Stage TDD Workflow.
1311
-
1312
- ## Your Role
1313
-
1314
- Focus on:
1315
- - Understanding requirements thoroughly
1316
- - Researching existing patterns in the codebase
1317
- - Creating detailed implementation plans
1318
- - Identifying test scenarios upfront
1319
- - Analyzing OWASP Top 10 security considerations
1320
- - **NO code changes allowed** - planning only
1321
-
1322
- ## Forge Planning Stages
1323
-
1324
- ### Stage 1: /plan
1325
- - Research with web search for best practices
1326
- - Document findings in \`docs/plans/<feature-slug>-design.md\`
1327
- - Include security analysis (OWASP Top 10)
1328
- - Create detailed plan in \`docs/plans/<feature-slug>.md\`
1329
- - Break down into TDD cycles (RED-GREEN-REFACTOR)
1330
- - Identify files to create/modify
1331
-
1332
- ## Output Format
1333
-
1334
- Your plan should include:
1335
- 1. **Requirements Summary** - What needs to be built
1336
- 2. **Test Scenarios** - All tests to write (RED phase)
1337
- 3. **Implementation Steps** - Minimal code to pass tests (GREEN phase)
1338
- 4. **Security Analysis** - OWASP Top 10 relevant risks
1339
- 5. **Files Affected** - List of files to create/modify
1340
- 6. **Verification** - How to test end-to-end
1341
-
1342
- **Remember**: You are read-only. No code changes. Planning only.
1343
- `;
1344
- }
1345
-
1346
- /**
1347
- * Generate .opencode/agents/tdd-build.md content
1348
- */
1349
- function generateOpenCodeBuildAgentContent() {
1350
- return `---
1351
- description: TDD implementation with full tools
1352
- mode: primary
1353
- model: anthropic/claude-sonnet-4-20250514
1354
- temperature: 0
1355
- tools:
1356
- write: true
1357
- edit: true
1358
- bash: true
1359
- ---
1360
-
1361
- # TDD Build Agent
1362
-
1363
- You are in **implementation mode** for the Forge 7-Stage TDD Workflow.
1364
-
1365
- ## MANDATORY TDD Process
1366
-
1367
- **RED-GREEN-REFACTOR** - No exceptions:
1368
-
1369
- ### RED Phase
1370
- 1. Write failing test FIRST
1371
- 2. Run test to confirm it fails for the right reason
1372
- 3. Commit: \`git commit -m "test: add [feature] tests (RED)"\`
1373
-
1374
- ### GREEN Phase
1375
- 1. Write minimal code to make the test pass
1376
- 2. Keep implementation simple
1377
- 3. Don't add features not covered by tests
1378
- 4. Commit: \`git commit -m "feat: implement [feature] (GREEN)"\`
1379
-
1380
- ### REFACTOR Phase
1381
- 1. Clean up code while keeping tests green
1382
- 2. Extract helpers, remove duplication
1383
- 3. Commit: \`git commit -m "refactor: [description]"\`
1384
-
1385
- ## Forge Development Stages
1386
-
1387
- ### Stage 2: /dev
1388
- Implement features using TDD:
1389
- - Follow RED-GREEN-REFACTOR for each feature
1390
- - Commit after each GREEN cycle
1391
- - Push regularly to remote
1392
-
1393
- ### Stage 3: /validate
1394
- Validate before creating PR:
1395
- - Type checking (TypeScript strict mode)
1396
- - Linting (ESLint - no errors)
1397
- - Security scanning (npm audit)
1398
- - Test suite (all must pass)
1399
- - Code coverage (80%+ required)
1400
-
1401
- ## Security
1402
-
1403
- For every feature, check OWASP Top 10:
1404
- - Input validation
1405
- - Output sanitization
1406
- - Authentication/Authorization
1407
- - Cryptography
1408
- - Dependency vulnerabilities
1409
-
1410
- ## Quality Standards
1411
-
1412
- - Tests written BEFORE implementation
1413
- - 80%+ code coverage
1414
- - No ESLint errors
1415
- - Security vulnerabilities addressed
1416
- - Documentation updated progressively
1417
- `;
270
+ // Cursor rule CONTENT is not hand-authored here. It is rendered from the
271
+ // canonical `rules/<name>.md` manifest. Cursor is the only harness with a native
272
+ // rule surface; Claude/Codex/Hermes receive the same policy via their AGENTS.md
273
+ // instruction projection (no always-on `.claude/rules/*` files are generated).
274
+ // See lib/rules-sync.js and docs/reference/AGENT_SKILL_PARITY.md.
275
+ renderRulesForHarness({
276
+ sourceRoot: getPackageRoot(PACKAGE_ROOT),
277
+ targetRoot: projectPath,
278
+ harness: 'cursor',
279
+ overwrite,
280
+ });
1418
281
  }
1419
282
 
1420
283
  /**
@@ -1502,7 +365,7 @@ Forge supports multiple AI agents through a three-tier architecture:
1502
365
  - \`parallel-ai\` - Web search and research
1503
366
  - \`github\` - GitHub API integration
1504
367
 
1505
- **Compatibility**: ✅ Growing (Claude Code, GitHub Copilot, Cursor, OpenCode support MCP)
368
+ **Compatibility**: ✅ Growing (Claude Code, Codex, and Cursor support MCP)
1506
369
 
1507
370
  ## Universal vs Agent-Specific
1508
371
 
@@ -1548,11 +411,9 @@ This ensures:
1548
411
  \`\`\`
1549
412
  project/
1550
413
  ├── AGENTS.md # Universal commands (all agents)
1551
- ├── .mcp.json # MCP servers (Claude, Copilot, Cursor, OpenCode)
414
+ ├── .mcp.json # MCP servers (Claude, Codex, Cursor)
1552
415
  ├── .claude/
1553
416
  │ └── skills/ # Claude-specific skills
1554
- ├── .github/
1555
- │ └── copilot-instructions.md # Copilot-specific instructions
1556
417
  └── .cursor/
1557
418
  └── rules/ # Cursor-specific rules
1558
419
  \`\`\`
@@ -1691,7 +552,7 @@ bunx forge setup --profile=team --interactive
1691
552
  /validate # Run all checks
1692
553
  /ship # Create PR
1693
554
  /review # Address feedback
1694
- /premerge # Merge after approval
555
+ /verify # Post-merge verify (pre-merge gate runs in /ship + /review)
1695
556
  \`\`\`
1696
557
 
1697
558
  ## Configuration Options
@@ -1868,9 +729,8 @@ function generateMcpSetupContent() {
1868
729
 
1869
730
  **Supported Agents**:
1870
731
  - ✅ Claude Code
1871
- - ✅ GitHub Copilot (VS Code extension)
732
+ - ✅ Codex
1872
733
  - ✅ Cursor
1873
- - ✅ OpenCode
1874
734
 
1875
735
  ## Quick Start
1876
736
 
@@ -1883,9 +743,8 @@ Choose one of the supported agents above.
1883
743
  Each agent has a different configuration location:
1884
744
 
1885
745
  **Claude Code**: \`.mcp.json\` in project root
1886
- **GitHub Copilot**: \`.mcp.json\` in project root (VS Code)
746
+ **Codex**: \`~/.codex/config.toml\` under \`mcp_servers\`
1887
747
  **Cursor**: \`.cursor/mcp.json\`
1888
- **OpenCode**: \`opencode.json\` under \`mcp_servers\`
1889
748
 
1890
749
  ### 3. Add Forge-Recommended Servers
1891
750
 
@@ -1943,9 +802,6 @@ Copy the configuration for your agent from the examples below.
1943
802
 
1944
803
  **Purpose**: GitHub repository access, issues, PRs, code search
1945
804
 
1946
- **Setup for GitHub Copilot** (built-in):
1947
- - No configuration needed, included by default in VS Code extension
1948
-
1949
805
  **Setup for Claude Code**:
1950
806
  \`\`\`json
1951
807
  {
@@ -1994,25 +850,6 @@ Copy the configuration for your agent from the examples below.
1994
850
 
1995
851
  **Environment Variables**: Set in \`.env\` or shell profile
1996
852
 
1997
- ### GitHub Copilot
1998
-
1999
- **File**: \`.mcp.json\` in project root (VS Code)
2000
-
2001
- **Example**:
2002
- \`\`\`json
2003
- {
2004
- "mcpServers": {
2005
- "context7": {
2006
- "type": "local",
2007
- "command": "npx",
2008
- "args": ["-y", "@context7/mcp-server"]
2009
- }
2010
- }
2011
- }
2012
- \`\`\`
2013
-
2014
- **Note**: GitHub MCP server is built-in, no config needed
2015
-
2016
853
  ### Cursor
2017
854
 
2018
855
  **File**: \`.cursor/mcp.json\`
@@ -2039,31 +876,6 @@ Copy the configuration for your agent from the examples below.
2039
876
 
2040
877
  **Note**: Cursor supports both STDIO and HTTP MCP servers
2041
878
 
2042
- ### OpenCode
2043
-
2044
- **File**: \`opencode.json\` (add under \`mcp_servers\`)
2045
-
2046
- **Example**:
2047
- \`\`\`json
2048
- {
2049
- "mcp_servers": {
2050
- "parallel-ai": {
2051
- "type": "stdio",
2052
- "command": "npx",
2053
- "args": ["-y", "@parallel-ai/mcp-server"],
2054
- "env": {
2055
- "API_KEY": "\${env:PARALLEL_AI_TOKEN}"
2056
- }
2057
- },
2058
- "context7": {
2059
- "type": "stdio",
2060
- "command": "npx",
2061
- "args": ["-y", "@context7/mcp-server"]
2062
- }
2063
- }
2064
- }
2065
- \`\`\`
2066
-
2067
879
  ## Setup with Forge
2068
880
 
2069
881
  Forge can automatically configure MCP servers during setup:
@@ -2074,7 +886,7 @@ bunx forge setup --mcp
2074
886
 
2075
887
  # Agent-specific setup with MCP
2076
888
  bunx forge setup --agent=claude --mcp
2077
- bunx forge setup --agent=copilot --mcp
889
+ bunx forge setup --agent=codex --mcp
2078
890
  bunx forge setup --agent=cursor --mcp
2079
891
  \`\`\`
2080
892
 
@@ -2109,12 +921,6 @@ Test MCP setup:
2109
921
  # Should use parallel-ai automatically
2110
922
  \`\`\`
2111
923
 
2112
- **GitHub Copilot**:
2113
- \`\`\`bash
2114
- # In VS Code, ask Copilot: "What's the latest TypeScript syntax?"
2115
- # Should fetch from context7
2116
- \`\`\`
2117
-
2118
924
  **Cursor**:
2119
925
  \`\`\`bash
2120
926
  # In Cursor, use Agent mode: "Research authentication best practices"
@@ -2156,10 +962,7 @@ Choose based on server documentation.
2156
962
  module.exports = {
2157
963
  detectProjectMetadata,
2158
964
  generateAgentsMd,
2159
- generateCopilotConfig,
2160
965
  generateCursorConfig,
2161
- generateKiloConfig,
2162
- generateOpenCodeConfig,
2163
966
  generateArchitectureDoc,
2164
967
  generateConfigurationDoc,
2165
968
  generateMcpSetupDoc