contextdevkit 1.8.0

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 (345) hide show
  1. package/CHANGELOG.md +592 -0
  2. package/LICENSE +21 -0
  3. package/README.md +401 -0
  4. package/docs/AGENT-PACKAGE-FORMAT.md +140 -0
  5. package/docs/ARCHITECTURE.md +258 -0
  6. package/docs/CHANGELOG.md +559 -0
  7. package/docs/CUSTOMIZING.md +211 -0
  8. package/docs/LEVELS.md +151 -0
  9. package/docs/ROADMAP.md +385 -0
  10. package/docs/SQUAD-PIPELINE-FORMAT.md +258 -0
  11. package/docs/SQUADS/agent-forge.md +65 -0
  12. package/docs/SQUADS/design-team.md +161 -0
  13. package/docs/token-economy-plan.md +135 -0
  14. package/install.mjs +273 -0
  15. package/instrucoes.md +274 -0
  16. package/package.json +46 -0
  17. package/templates/CLAUDE.md.tpl +133 -0
  18. package/templates/claude/agents/_TEMPLATE.md +52 -0
  19. package/templates/claude/agents/accessibility.md +36 -0
  20. package/templates/claude/agents/agent-architect.md +37 -0
  21. package/templates/claude/agents/architect.md +39 -0
  22. package/templates/claude/agents/code-reviewer.md +43 -0
  23. package/templates/claude/agents/code-security.md +59 -0
  24. package/templates/claude/agents/context-keeper.md +40 -0
  25. package/templates/claude/agents/devops.md +40 -0
  26. package/templates/claude/agents/eval-designer.md +40 -0
  27. package/templates/claude/agents/forge-orchestrator.md +42 -0
  28. package/templates/claude/agents/governance-officer.md +45 -0
  29. package/templates/claude/agents/growth.md +92 -0
  30. package/templates/claude/agents/infra-security.md +53 -0
  31. package/templates/claude/agents/landing-architect.md +154 -0
  32. package/templates/claude/agents/model-router.md +34 -0
  33. package/templates/claude/agents/packager.md +38 -0
  34. package/templates/claude/agents/privacy-lgpd.md +64 -0
  35. package/templates/claude/agents/product-owner.md +51 -0
  36. package/templates/claude/agents/prompt-engineer.md +33 -0
  37. package/templates/claude/agents/qa-e2e.md +52 -0
  38. package/templates/claude/agents/qa-fuzzer.md +24 -0
  39. package/templates/claude/agents/qa-integration.md +21 -0
  40. package/templates/claude/agents/qa-orchestrator.md +40 -0
  41. package/templates/claude/agents/qa-perf.md +40 -0
  42. package/templates/claude/agents/qa-unit.md +39 -0
  43. package/templates/claude/agents/rag-designer.md +54 -0
  44. package/templates/claude/agents/retention.md +85 -0
  45. package/templates/claude/agents/security.md +48 -0
  46. package/templates/claude/agents/seo-specialist.md +106 -0
  47. package/templates/claude/agents/test-engineer.md +48 -0
  48. package/templates/claude/agents/tool-designer.md +32 -0
  49. package/templates/claude/agents/ui-designer.md +37 -0
  50. package/templates/claude/agents/ux-designer.md +38 -0
  51. package/templates/claude/commands/README.md +95 -0
  52. package/templates/claude/commands/advise.md +80 -0
  53. package/templates/claude/commands/audit/analyze-code-ia-practices.md +75 -0
  54. package/templates/claude/commands/audit/audit.md +35 -0
  55. package/templates/claude/commands/audit/contract-check.md +21 -0
  56. package/templates/claude/commands/audit/deep-analysis.md +48 -0
  57. package/templates/claude/commands/audit/deps-audit.md +49 -0
  58. package/templates/claude/commands/audit/security-setup.md +35 -0
  59. package/templates/claude/commands/audit/seo-audit.md +63 -0
  60. package/templates/claude/commands/audit/tech-debt-sweep.md +35 -0
  61. package/templates/claude/commands/bug-hunt.md +42 -0
  62. package/templates/claude/commands/claude-md.md +36 -0
  63. package/templates/claude/commands/close-version.md +25 -0
  64. package/templates/claude/commands/context-refresh.md +19 -0
  65. package/templates/claude/commands/context-stats.md +15 -0
  66. package/templates/claude/commands/dashboard.md +66 -0
  67. package/templates/claude/commands/distill-apply.md +19 -0
  68. package/templates/claude/commands/distill-sessions.md +26 -0
  69. package/templates/claude/commands/fleet.md +47 -0
  70. package/templates/claude/commands/forge/forge-audit.md +16 -0
  71. package/templates/claude/commands/forge/forge-budget.md +16 -0
  72. package/templates/claude/commands/forge/forge-deprecate.md +16 -0
  73. package/templates/claude/commands/forge/forge-doctor.md +17 -0
  74. package/templates/claude/commands/forge/forge-eval.md +16 -0
  75. package/templates/claude/commands/forge/forge-fallback-test.md +17 -0
  76. package/templates/claude/commands/forge/forge-killswitch.md +17 -0
  77. package/templates/claude/commands/forge/forge-list.md +17 -0
  78. package/templates/claude/commands/forge/forge-new.md +41 -0
  79. package/templates/claude/commands/forge/forge-policy.md +16 -0
  80. package/templates/claude/commands/forge/forge-redteam.md +17 -0
  81. package/templates/claude/commands/forge/forge-refresh-matrix.md +20 -0
  82. package/templates/claude/commands/forge/forge-route.md +17 -0
  83. package/templates/claude/commands/forge/forge-show.md +16 -0
  84. package/templates/claude/commands/landing-page.md +71 -0
  85. package/templates/claude/commands/log-session.md +59 -0
  86. package/templates/claude/commands/media-gen.md +93 -0
  87. package/templates/claude/commands/new-adr.md +30 -0
  88. package/templates/claude/commands/pipeline/dev-start.md +64 -0
  89. package/templates/claude/commands/pipeline/pipeline.md +36 -0
  90. package/templates/claude/commands/pipeline/resume.md +70 -0
  91. package/templates/claude/commands/pipeline/retro.md +34 -0
  92. package/templates/claude/commands/pipeline/runs.md +63 -0
  93. package/templates/claude/commands/pipeline/ship.md +54 -0
  94. package/templates/claude/commands/pipeline/workflow.md +85 -0
  95. package/templates/claude/commands/playbook.md +27 -0
  96. package/templates/claude/commands/predictions-review.md +28 -0
  97. package/templates/claude/commands/qa/qa-signoff.md +24 -0
  98. package/templates/claude/commands/qa/scaffold-tests.md +27 -0
  99. package/templates/claude/commands/qa/test-plan.md +26 -0
  100. package/templates/claude/commands/qa/visual-test.md +42 -0
  101. package/templates/claude/commands/roadmap.md +48 -0
  102. package/templates/claude/commands/setup/aidevtool-from0.md +104 -0
  103. package/templates/claude/commands/setup/context-config.md +25 -0
  104. package/templates/claude/commands/setup/context-doctor.md +21 -0
  105. package/templates/claude/commands/setup/context-level.md +17 -0
  106. package/templates/claude/commands/setup/setupcontextdevkit.md +121 -0
  107. package/templates/claude/commands/simulate-impact.md +32 -0
  108. package/templates/claude/commands/squad.md +44 -0
  109. package/templates/claude/commands/state.md +21 -0
  110. package/templates/claude/commands/token-report.md +29 -0
  111. package/templates/claude/commands/tune-agents.md +35 -0
  112. package/templates/claude/commands/vcs/claim.md +18 -0
  113. package/templates/claude/commands/vcs/git.md +83 -0
  114. package/templates/claude/commands/vcs/release.md +15 -0
  115. package/templates/claude/commands/vcs/worktree-new.md +18 -0
  116. package/templates/claude/commands/watch.md +47 -0
  117. package/templates/contextkit/.env.example +36 -0
  118. package/templates/contextkit/CLAUDE.child.md.tpl +38 -0
  119. package/templates/contextkit/README.md +74 -0
  120. package/templates/contextkit/behaviors-examples.md +183 -0
  121. package/templates/contextkit/behaviors.md +116 -0
  122. package/templates/contextkit/best-practices.md +323 -0
  123. package/templates/contextkit/config.json +66 -0
  124. package/templates/contextkit/detectors/README.md +45 -0
  125. package/templates/contextkit/detectors/example-detector.mjs.example +25 -0
  126. package/templates/contextkit/instrucoes.md +114 -0
  127. package/templates/contextkit/memory/GLOSSARY.md +13 -0
  128. package/templates/contextkit/memory/SESSIONS.md +9 -0
  129. package/templates/contextkit/memory/WORKSPACE.md +7 -0
  130. package/templates/contextkit/memory/business-rules/_TEMPLATE.md +33 -0
  131. package/templates/contextkit/memory/decisions/0000-record-architecture-decisions.md +34 -0
  132. package/templates/contextkit/memory/decisions/_TEMPLATE.md +25 -0
  133. package/templates/contextkit/memory/predictions/.gitkeep +0 -0
  134. package/templates/contextkit/memory/roadmap.md +28 -0
  135. package/templates/contextkit/memory/sessions/.gitkeep +0 -0
  136. package/templates/contextkit/memory/workflows/.gitkeep +0 -0
  137. package/templates/contextkit/pipeline/backlog/.gitkeep +0 -0
  138. package/templates/contextkit/pipeline/conclusion/.gitkeep +0 -0
  139. package/templates/contextkit/pipeline/devpipeline.md +9 -0
  140. package/templates/contextkit/pipeline/testing/.gitkeep +0 -0
  141. package/templates/contextkit/pipeline/working/.gitkeep +0 -0
  142. package/templates/contextkit/review-protocol.md +214 -0
  143. package/templates/contextkit/runtime/config/defaults.mjs +215 -0
  144. package/templates/contextkit/runtime/config/levels.mjs +42 -0
  145. package/templates/contextkit/runtime/config/load.mjs +105 -0
  146. package/templates/contextkit/runtime/config/paths.mjs +92 -0
  147. package/templates/contextkit/runtime/config/presets.mjs +47 -0
  148. package/templates/contextkit/runtime/config/schema.mjs +88 -0
  149. package/templates/contextkit/runtime/config/settings-compose.mjs +55 -0
  150. package/templates/contextkit/runtime/git-hooks/commit-msg.mjs +55 -0
  151. package/templates/contextkit/runtime/git-hooks/pre-commit.mjs +47 -0
  152. package/templates/contextkit/runtime/git-hooks/pre-push.mjs +102 -0
  153. package/templates/contextkit/runtime/hooks/boot-context-readers.mjs +111 -0
  154. package/templates/contextkit/runtime/hooks/boot-signals.mjs +135 -0
  155. package/templates/contextkit/runtime/hooks/check-registration.mjs +228 -0
  156. package/templates/contextkit/runtime/hooks/concurrency-guard.mjs +110 -0
  157. package/templates/contextkit/runtime/hooks/ledger.mjs +231 -0
  158. package/templates/contextkit/runtime/hooks/md-extract.mjs +65 -0
  159. package/templates/contextkit/runtime/hooks/path-classification.mjs +62 -0
  160. package/templates/contextkit/runtime/hooks/safe-io.mjs +84 -0
  161. package/templates/contextkit/runtime/hooks/session-digest-core.mjs +85 -0
  162. package/templates/contextkit/runtime/hooks/session-start.mjs +248 -0
  163. package/templates/contextkit/runtime/hooks/simulate-gate.mjs +108 -0
  164. package/templates/contextkit/runtime/hooks/track-edits.mjs +154 -0
  165. package/templates/contextkit/runtime/providers/media/_adapter.mjs +120 -0
  166. package/templates/contextkit/runtime/providers/media/nano-banana.mjs +110 -0
  167. package/templates/contextkit/runtime/providers/media/veo.mjs +162 -0
  168. package/templates/contextkit/runtime/providers/review/_adapter.mjs +71 -0
  169. package/templates/contextkit/runtime/providers/review/detect.mjs +115 -0
  170. package/templates/contextkit/runtime/providers/review/gh.mjs +103 -0
  171. package/templates/contextkit/runtime/state/state-io.mjs +172 -0
  172. package/templates/contextkit/runtime/statusline.mjs +51 -0
  173. package/templates/contextkit/squads/README.md +115 -0
  174. package/templates/contextkit/squads/_BRIEFING.md.tpl +27 -0
  175. package/templates/contextkit/squads/agent-forge/README.md +69 -0
  176. package/templates/contextkit/squads/agent-forge/ROADMAP.md +108 -0
  177. package/templates/contextkit/squads/agent-forge/best-practices.md +89 -0
  178. package/templates/contextkit/squads/agent-forge/cli/forge-admin.mjs +132 -0
  179. package/templates/contextkit/squads/agent-forge/cli/forge-eval-cli.mjs +163 -0
  180. package/templates/contextkit/squads/agent-forge/cli/forge-new.mjs +97 -0
  181. package/templates/contextkit/squads/agent-forge/cli/forge-ops.mjs +177 -0
  182. package/templates/contextkit/squads/agent-forge/lib/architect.mjs +112 -0
  183. package/templates/contextkit/squads/agent-forge/lib/eval-designer.mjs +133 -0
  184. package/templates/contextkit/squads/agent-forge/lib/eval-runner.mjs +167 -0
  185. package/templates/contextkit/squads/agent-forge/lib/governance-officer.mjs +178 -0
  186. package/templates/contextkit/squads/agent-forge/lib/package-ops.mjs +101 -0
  187. package/templates/contextkit/squads/agent-forge/lib/packager.mjs +219 -0
  188. package/templates/contextkit/squads/agent-forge/lib/prompt-gen.mjs +122 -0
  189. package/templates/contextkit/squads/agent-forge/lib/rag-designer.mjs +102 -0
  190. package/templates/contextkit/squads/agent-forge/lib/router.mjs +165 -0
  191. package/templates/contextkit/squads/agent-forge/lib/tool-gen.mjs +113 -0
  192. package/templates/contextkit/squads/agent-forge/lib/yaml.mjs +47 -0
  193. package/templates/contextkit/squads/agent-forge/pipeline.yaml +65 -0
  194. package/templates/contextkit/squads/agent-forge/router/capability-matrix.json +112 -0
  195. package/templates/contextkit/squads/agent-forge/router/decision-rules.json +120 -0
  196. package/templates/contextkit/squads/agent-forge/templates/agent-package/.agentforgerc +12 -0
  197. package/templates/contextkit/squads/agent-forge/templates/agent-package/CHANGELOG.md +13 -0
  198. package/templates/contextkit/squads/agent-forge/templates/agent-package/LICENSE +5 -0
  199. package/templates/contextkit/squads/agent-forge/templates/agent-package/README.md +39 -0
  200. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/go/README.md +10 -0
  201. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/go/agent.go +14 -0
  202. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/go/go.mod +3 -0
  203. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/node/README.md +11 -0
  204. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/node/index.js +53 -0
  205. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/node/package.json +9 -0
  206. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/python/README.md +10 -0
  207. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/python/agent.py +16 -0
  208. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/python/pyproject.toml +10 -0
  209. package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/golden.jsonl +1 -0
  210. package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/red-team.jsonl +3 -0
  211. package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/rubric.yaml +14 -0
  212. package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/run-eval.md +17 -0
  213. package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/thresholds.yaml +18 -0
  214. package/templates/contextkit/squads/agent-forge/templates/agent-package/examples/basic.node.md +17 -0
  215. package/templates/contextkit/squads/agent-forge/templates/agent-package/examples/with-fallback.node.md +24 -0
  216. package/templates/contextkit/squads/agent-forge/templates/agent-package/examples/with-rag.python.md +20 -0
  217. package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/audit.schema.json +23 -0
  218. package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/compliance.policy.yaml +43 -0
  219. package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/cost.policy.yaml +36 -0
  220. package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/fallback-chain.yaml +16 -0
  221. package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/quality.policy.yaml +43 -0
  222. package/templates/contextkit/squads/agent-forge/templates/agent-package/manifest.yaml +91 -0
  223. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.anthropic.md +19 -0
  224. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.canonical.md +25 -0
  225. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.deepseek.md +21 -0
  226. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.google.md +19 -0
  227. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.ollama.md +21 -0
  228. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.openai.md +20 -0
  229. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/config.yaml +17 -0
  230. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/index/.gitkeep +3 -0
  231. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/ingestion/chunker.config.yaml +6 -0
  232. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/ingestion/sources.yaml +8 -0
  233. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/retrieval/query-template.md +16 -0
  234. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/retrieval/rerank.config.yaml +6 -0
  235. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/anthropic.tools.json +11 -0
  236. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/deepseek.tools.json +14 -0
  237. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/google.tools.json +11 -0
  238. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/ollama.tools.json +14 -0
  239. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/openai.tools.json +14 -0
  240. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/schemas.canonical.json +25 -0
  241. package/templates/contextkit/starters/tanstack/README.md +86 -0
  242. package/templates/contextkit/starters/tanstack/index.html +12 -0
  243. package/templates/contextkit/starters/tanstack/package.json +25 -0
  244. package/templates/contextkit/starters/tanstack/src/main.tsx +40 -0
  245. package/templates/contextkit/starters/tanstack/src/router.tsx +12 -0
  246. package/templates/contextkit/starters/tanstack/src/routes/__root.tsx +10 -0
  247. package/templates/contextkit/starters/tanstack/src/routes/index.tsx +17 -0
  248. package/templates/contextkit/starters/tanstack/tsconfig.json +19 -0
  249. package/templates/contextkit/starters/tanstack/vite.config.ts +10 -0
  250. package/templates/contextkit/tools/scripts/adr-digest-core.mjs +42 -0
  251. package/templates/contextkit/tools/scripts/adr-digest.mjs +78 -0
  252. package/templates/contextkit/tools/scripts/agent-tuning.mjs +74 -0
  253. package/templates/contextkit/tools/scripts/aiso-audit.mjs +174 -0
  254. package/templates/contextkit/tools/scripts/audit-shared.mjs +129 -0
  255. package/templates/contextkit/tools/scripts/claim.mjs +133 -0
  256. package/templates/contextkit/tools/scripts/claude-md.mjs +123 -0
  257. package/templates/contextkit/tools/scripts/clean-drive.mjs +78 -0
  258. package/templates/contextkit/tools/scripts/context-config.mjs +111 -0
  259. package/templates/contextkit/tools/scripts/context-level.mjs +98 -0
  260. package/templates/contextkit/tools/scripts/context-pack.mjs +120 -0
  261. package/templates/contextkit/tools/scripts/contract-scan.mjs +186 -0
  262. package/templates/contextkit/tools/scripts/dashboard-data.mjs +198 -0
  263. package/templates/contextkit/tools/scripts/dashboard-html.mjs +215 -0
  264. package/templates/contextkit/tools/scripts/dashboard-server.mjs +129 -0
  265. package/templates/contextkit/tools/scripts/dashboard.mjs +107 -0
  266. package/templates/contextkit/tools/scripts/deep-analysis.mjs +62 -0
  267. package/templates/contextkit/tools/scripts/deps-audit.mjs +201 -0
  268. package/templates/contextkit/tools/scripts/detect-stack.mjs +164 -0
  269. package/templates/contextkit/tools/scripts/distill-detect.mjs +90 -0
  270. package/templates/contextkit/tools/scripts/doctor.mjs +165 -0
  271. package/templates/contextkit/tools/scripts/fleet.mjs +170 -0
  272. package/templates/contextkit/tools/scripts/generate-context.mjs +142 -0
  273. package/templates/contextkit/tools/scripts/gh-alerts.mjs +117 -0
  274. package/templates/contextkit/tools/scripts/git.mjs +97 -0
  275. package/templates/contextkit/tools/scripts/home.mjs +106 -0
  276. package/templates/contextkit/tools/scripts/mark-simulation.mjs +78 -0
  277. package/templates/contextkit/tools/scripts/media-gen.mjs +154 -0
  278. package/templates/contextkit/tools/scripts/pipeline-board.mjs +74 -0
  279. package/templates/contextkit/tools/scripts/pipeline-prioritize.mjs +68 -0
  280. package/templates/contextkit/tools/scripts/pipeline-session.mjs +99 -0
  281. package/templates/contextkit/tools/scripts/pipeline-validate.mjs +136 -0
  282. package/templates/contextkit/tools/scripts/pipeline.mjs +302 -0
  283. package/templates/contextkit/tools/scripts/playbook.mjs +123 -0
  284. package/templates/contextkit/tools/scripts/predictions-review.mjs +113 -0
  285. package/templates/contextkit/tools/scripts/release.mjs +60 -0
  286. package/templates/contextkit/tools/scripts/resume.mjs +114 -0
  287. package/templates/contextkit/tools/scripts/roadmap.mjs +86 -0
  288. package/templates/contextkit/tools/scripts/runs.mjs +116 -0
  289. package/templates/contextkit/tools/scripts/seo-audit.mjs +150 -0
  290. package/templates/contextkit/tools/scripts/session-digest.mjs +89 -0
  291. package/templates/contextkit/tools/scripts/session-reindex.mjs +91 -0
  292. package/templates/contextkit/tools/scripts/setup-complete.mjs +69 -0
  293. package/templates/contextkit/tools/scripts/squad-meta.mjs +23 -0
  294. package/templates/contextkit/tools/scripts/squad-pipeline-condition.mjs +192 -0
  295. package/templates/contextkit/tools/scripts/squad-pipeline.mjs +301 -0
  296. package/templates/contextkit/tools/scripts/squad.mjs +80 -0
  297. package/templates/contextkit/tools/scripts/stats.mjs +138 -0
  298. package/templates/contextkit/tools/scripts/sync-check.mjs +235 -0
  299. package/templates/contextkit/tools/scripts/tech-debt-detectors.mjs +76 -0
  300. package/templates/contextkit/tools/scripts/tech-debt-scan.mjs +164 -0
  301. package/templates/contextkit/tools/scripts/token-report.mjs +153 -0
  302. package/templates/contextkit/tools/scripts/visual-test.mjs +132 -0
  303. package/templates/contextkit/tools/scripts/watch.mjs +106 -0
  304. package/templates/contextkit/tools/scripts/workflow.mjs +136 -0
  305. package/templates/contextkit/tools/scripts/workspace-sync.mjs +220 -0
  306. package/templates/contextkit/tools/scripts/worktree-new.mjs +50 -0
  307. package/templates/contextkit/workflows/L1-static-loading.md +59 -0
  308. package/templates/contextkit/workflows/L2-session-ledger.md +86 -0
  309. package/templates/contextkit/workflows/L3-multi-session.md +80 -0
  310. package/templates/contextkit/workflows/L4-squads.md +68 -0
  311. package/templates/contextkit/workflows/L5-proactive.md +88 -0
  312. package/templates/contextkit/workflows/README.md +47 -0
  313. package/templates/contextkit/workflows/playbooks/distillation-cycle.md +74 -0
  314. package/templates/contextkit/workflows/playbooks/landing-page.md +197 -0
  315. package/templates/contextkit/workflows/playbooks/security-batch.md +68 -0
  316. package/templates/contextkit/workflows/playbooks/seo-aiso.md +288 -0
  317. package/templates/contextkit/workflows/playbooks/simulate-impact.md +83 -0
  318. package/templates/contextkit/workflows/playbooks/tanstack.md +164 -0
  319. package/templates/contextkit/workflows/playbooks/tech-debt-sweep.md +77 -0
  320. package/templates/docs/CHANGELOG.md.tpl +11 -0
  321. package/templates/gitattributes +3 -0
  322. package/templates/github/ISSUE_TEMPLATE/bug_report.md +30 -0
  323. package/templates/github/ISSUE_TEMPLATE/feature_request.md +22 -0
  324. package/templates/github/PULL_REQUEST_TEMPLATE.md +27 -0
  325. package/templates/github/dependabot.yml +27 -0
  326. package/templates/github/workflows/quality.yml +36 -0
  327. package/templates/github/workflows/security.yml +54 -0
  328. package/tools/install/cli.mjs +62 -0
  329. package/tools/install/fs.mjs +56 -0
  330. package/tools/install/git.mjs +114 -0
  331. package/tools/install/project.mjs +51 -0
  332. package/tools/install/uninstall.mjs +54 -0
  333. package/tools/integration-test-compozy.mjs +88 -0
  334. package/tools/integration-test-guards.mjs +269 -0
  335. package/tools/integration-test-tooling-agent-forge.mjs +189 -0
  336. package/tools/integration-test-tooling-pipeline.mjs +164 -0
  337. package/tools/integration-test-tooling.mjs +172 -0
  338. package/tools/integration-test.mjs +228 -0
  339. package/tools/it-helpers.mjs +60 -0
  340. package/tools/selfcheck-agent-forge-ops.mjs +107 -0
  341. package/tools/selfcheck-agent-forge.mjs +304 -0
  342. package/tools/selfcheck-config.mjs +80 -0
  343. package/tools/selfcheck-runtime.mjs +135 -0
  344. package/tools/selfcheck-source.mjs +326 -0
  345. package/tools/selfcheck.mjs +268 -0
@@ -0,0 +1,211 @@
1
+ # Customizing ContextDevKit
2
+
3
+ The kit works out of the box, but a few tweaks make it fit your project well.
4
+
5
+ ## 1. Tune which paths matter (do this first)
6
+
7
+ `contextkit/config.json` → `ledger` drives drift detection. Defaults are generic
8
+ (`src/`, `lib/`, `app/`, `packages/`, …). Adjust per stack:
9
+
10
+ ```jsonc
11
+ {
12
+ "ledger": {
13
+ "important": ["app/", "tests/", "pyproject.toml"], // edits here → drift nudge
14
+ "irrelevant": ["node_modules/", "dist/", "__pycache__/"], // never tracked
15
+ "registration": ["contextkit/memory/SESSIONS.md", "docs/CHANGELOG.md"] // counts as "registered"
16
+ }
17
+ }
18
+ ```
19
+
20
+ Examples: Python → add `app/`, `tests/`; Go → `cmd/`, `internal/`; Rust →
21
+ `src/`, `Cargo.toml`. Use `/context-config set ledger.important '["app/","tests/"]'`
22
+ or edit the file directly. Arrays **replace** the defaults.
23
+
24
+ ## 2. Protect high-risk paths (Level 5)
25
+
26
+ `l5.highRiskPaths` is empty by default — the gate protects nothing until you fill
27
+ it. Add the files whose blast radius is largest:
28
+
29
+ ```jsonc
30
+ { "l5": { "highRiskPaths": [
31
+ "db/schema.sql", "src/contracts/", "src/auth/", "openapi.yaml"
32
+ ] } }
33
+ ```
34
+
35
+ Now editing any of those is blocked until `/simulate-impact` records a covering
36
+ analysis.
37
+
38
+ ## 3. Grow your own squad of sub-agents (Level 4)
39
+
40
+ Sub-agents are `.claude/agents/*.md` files with frontmatter. Copy
41
+ `_TEMPLATE.md` and make the agent **sharp and narrow** — its `description` is how
42
+ Claude decides when to route to it, so name the concrete files/dirs it owns.
43
+
44
+ ```markdown
45
+ ---
46
+ name: api-specialist
47
+ description: Use when the task touches src/api/ routes, request validation, or the service layer.
48
+ # Optional: declare MCP servers the agent expects (ADR-0019)
49
+ # mcpServers:
50
+ # - name: postgres
51
+ # rationale: needs read access to the production schema
52
+ # optional: true
53
+ ---
54
+ You are api-specialist... (mental model, invariants, anti-patterns, self-audit)
55
+ ```
56
+
57
+ Good agents do one domain extremely well and delegate the rest. The shipped
58
+ `architect`, `code-reviewer`, `context-keeper`, `seo-specialist`,
59
+ `landing-architect` are stack-agnostic references — read them as style guides
60
+ before writing your own. Add domain agents (frontend, db, security, …) as your
61
+ codebase grows.
62
+
63
+ The kit ships **28 sub-agents** across 7 squads — see
64
+ [`docs/SQUADS/design-team.md`](SQUADS/design-team.md) for the UI/UX/SEO/landing
65
+ specialists and [`docs/SQUADS/agent-forge.md`](SQUADS/agent-forge.md) for the
66
+ L6+ agent-forge squad.
67
+
68
+ Tip: keep a short frontmatter `description` + a focused body. A vague
69
+ "helps with everything" agent defeats routing.
70
+
71
+ ## 4. Add a slash command
72
+
73
+ Slash commands are `.claude/commands/**/*.md` — frontmatter `description` (+ optional
74
+ `argument-hint`) and a prompt body. `$ARGUMENTS` interpolates what the user typed.
75
+ Drop a new file in and it's available immediately.
76
+
77
+ Claude Code resolves commands by **file basename**, not path — so
78
+ `/my-command` finds `my-command.md` whether you place it at the root or under
79
+ `audit/my-command.md`. Use the existing packs (`audit/`, `pipeline/`, `qa/`,
80
+ `vcs/`, `forge/`, `setup/`) as a taxonomy reference. See
81
+ [`templates/claude/commands/README.md`](../templates/claude/commands/README.md)
82
+ for the full taxonomy.
83
+
84
+ ## 5. Write your project's constitution
85
+
86
+ The installed `CLAUDE.md` ships a generic coding constitution (file-size limit,
87
+ SRP, naming, language policy, self-audit). **Edit it** to match your project:
88
+ fill in the immutable rules (and link the ADR that justifies each), set the
89
+ language policy, adjust the line limit. Keep it short — push detail into ADRs.
90
+
91
+ ## 6. Add a provider adapter (review, media)
92
+
93
+ The kit ships two pluggable adapter surfaces. Both follow the same five-point
94
+ contract: **no SDK dependency, refuse-on-missing-creds, typed errors,
95
+ refuse-on-content-policy (where applicable), per-process cost cap (media only)**.
96
+
97
+ ### Review providers (`contextkit/runtime/providers/review/`)
98
+
99
+ Add an adapter for GitLab / Bitbucket / Gitea by creating a new `.mjs` file that
100
+ shells out to the user-installed CLI:
101
+
102
+ ```js
103
+ // contextkit/runtime/providers/review/glab.mjs
104
+ import { spawnSync } from 'node:child_process';
105
+ import { ProviderError } from './_adapter.mjs';
106
+
107
+ export const id = 'glab';
108
+ export const cliBinary = 'glab';
109
+ export const detectsRemote = (url) => /gitlab\.com[:/]/.test(url);
110
+
111
+ function runGlab(args, { stdin } = {}) {
112
+ const r = spawnSync('glab', args, { input: stdin, encoding: 'utf-8' });
113
+ if (r.error?.code === 'ENOENT') throw new ProviderError('CLI_MISSING', 'glab CLI not installed');
114
+ if (r.status !== 0) throw new ProviderError('REMOTE_REJECTED', r.stderr);
115
+ return r.stdout;
116
+ }
117
+
118
+ export async function createPullRequest({ title, body, baseBranch }) { … }
119
+ export async function listOpenReviewComments({ prNumber }) { … }
120
+ export async function postReviewComment({ prNumber, body }) { … }
121
+ ```
122
+
123
+ `detect.mjs` automatically discovers the file and routes by `origin` URL.
124
+ Authority: [ADR-0021](../contextkit/memory/decisions/0021-provider-strategy-review-qa.md).
125
+
126
+ ### Media providers (`contextkit/runtime/providers/media/`)
127
+
128
+ Add an adapter for Runway / Luma / Midjourney following the contract in
129
+ `_adapter.mjs`:
130
+
131
+ ```js
132
+ // contextkit/runtime/providers/media/my-provider.mjs
133
+ import { MediaProviderError, MEDIA_ERROR_CODES, assertCredentials, noteCostOrThrow } from './_adapter.mjs';
134
+
135
+ export const id = 'my-provider';
136
+ export const kind = 'image'; // or 'video'
137
+ export const envVar = 'MY_PROVIDER_API_KEY';
138
+ export const requiredEnv = ['MY_PROVIDER_API_KEY'];
139
+
140
+ export async function generate({ prompt, outPath, options }) {
141
+ assertCredentials(requiredEnv); // refuse before network call
142
+ noteCostOrThrow(0.05); // per-process cost tally
143
+ // …node:fetch → write outPath…
144
+ return { outPath, durationMs, costEstimateUsd, providerRequestId };
145
+ }
146
+ ```
147
+
148
+ Authority: [ADR-0024](../contextkit/memory/decisions/0024-media-generation-veo-nano-banana.md).
149
+
150
+ ## 7. Credentials flow (`contextkit/.env.example`)
151
+
152
+ The kit ships an `.env.example` template at the installed `contextkit/` root with
153
+ commented credentials for `/media-gen` and a tour of the other `CONTEXTDEVKIT_*`
154
+ env vars. Setup:
155
+
156
+ 1. Copy `contextkit/.env.example` to `contextkit/.env`.
157
+ 2. Fill in the keys you want (`GOOGLE_AI_API_KEY` for Nano Banana + Veo).
158
+ 3. (Optional) set `CONTEXTDEVKIT_MEDIA_MAX_USD=5.00` to cap per-process spend.
159
+ 4. Run scripts via Node 20.6+'s built-in env-file loader:
160
+
161
+ ```bash
162
+ node --env-file=contextkit/.env contextkit/tools/scripts/media-gen.mjs image \
163
+ --prompt "..." --out hero.png
164
+ ```
165
+
166
+ Or copy the values into your project's existing dotenv setup (Astro / Next /
167
+ Nuxt / Vite all already read `.env` from the project root).
168
+
169
+ **The kit never writes secrets.** `contextkit/.env.example` is the only template;
170
+ you fill in `contextkit/.env` and it stays out of git via the standard `.env`
171
+ gitignore convention.
172
+
173
+ ## 8. Rebrand the platform folder
174
+
175
+ To rename `contextkit/` (e.g. to `devtools/`), change `PLATFORM_DIR` in
176
+ `contextkit/runtime/config/paths.mjs`, rename the folder, and update the hook
177
+ commands in `.claude/settings.json` (`node devtools/runtime/hooks/...`). Nothing
178
+ else references the literal name.
179
+
180
+ ## 9. Updating the engine later
181
+
182
+ Re-run the installer over the project. It overwrites only the engine and slash
183
+ commands; it never touches your memory, config overrides, or `CLAUDE.md`:
184
+
185
+ ```bash
186
+ node /path/to/contextdevkit/install.mjs --target . --level <N> --yes
187
+ ```
188
+
189
+ Or, even simpler:
190
+
191
+ ```bash
192
+ npx contextdevkit@latest --target . --update
193
+ ```
194
+
195
+ This refreshes engine + slash commands + hook wiring for your **current** level.
196
+ It **never** touches `CLAUDE.md`, `contextkit/config.json`, memory (ADRs/sessions/
197
+ roadmap), pipeline tasks, scoped module `CLAUDE.md`, or your `contextkit/.env`.
198
+
199
+ ## Uninstall
200
+
201
+ Delete the `contextkit/` folder and remove the ContextDevKit entries (the ones whose
202
+ command contains `contextkit/runtime/hooks`) from `.claude/settings.json`. Your
203
+ memory under `contextkit/memory/` is just markdown — keep a copy if you want the
204
+ history.
205
+
206
+ Or use the installer:
207
+
208
+ ```bash
209
+ node /path/to/contextdevkit/install.mjs --target . --uninstall # keeps memory + CLAUDE.md
210
+ node /path/to/contextdevkit/install.mjs --target . --uninstall --purge # also removes the engine
211
+ ```
package/docs/LEVELS.md ADDED
@@ -0,0 +1,151 @@
1
+ # Levels
2
+
3
+ ContextDevKit activates progressively. The active level lives in
4
+ `contextkit/config.json` → `level` and drives both which hooks are wired in
5
+ `.claude/settings.json` and which behaviours the hooks enable at runtime.
6
+
7
+ Change level with `/context-level <n>` or
8
+ `node contextkit/tools/scripts/context-level.mjs <n>` (then restart Claude Code so it
9
+ reloads hooks).
10
+
11
+ ---
12
+
13
+ ## L1 — Memory
14
+
15
+ **Goal:** never lose the *why*. The minimum that makes sessions continuous.
16
+
17
+ - `SessionStart` hook injects boot context: latest session, CHANGELOG
18
+ `[Unreleased]`, git divergence vs upstream.
19
+ - `/log-session` writes one markdown file per session under
20
+ `contextkit/memory/sessions/`.
21
+ - `/new-adr` records architecture decisions (immutable once accepted).
22
+ - `/state`, `/close-version`, `/context-refresh`.
23
+
24
+ **Use when:** any project. This is the floor.
25
+
26
+ ## L2 — Ledger
27
+
28
+ **Goal:** stop work from silently going unrecorded.
29
+
30
+ - `PostToolUse` hook records every edit in a per-session ledger
31
+ (`.claude/.sessions/<sid>.json`).
32
+ - `Stop` hook **blocks** the session from ending if ≥ 2 important files changed
33
+ and the session wasn't registered — nudging you to `/log-session`.
34
+ - The boot context now also reports **drift** from earlier sessions that ended
35
+ without registering.
36
+
37
+ **Use when:** you want the kit to actively keep memory honest (most projects).
38
+
39
+ ## L3 — Multi-session
40
+
41
+ **Goal:** run several Claude sessions in parallel — same machine or different
42
+ machines/devs — **without one silently overwriting another**.
43
+
44
+ - `/claim` / `/release` reserve paths; the `PostToolUse` hook warns when you edit
45
+ a path another active session claimed.
46
+ - **Concurrency guard** (`PreToolUse`): before you write a file, it warns if
47
+ another active session edited that exact file recently, or if it changed on
48
+ disk since you last wrote it — so you re-read and merge instead of clobbering.
49
+ (Claude Code's own `Edit` already refuses to edit a file changed since you read
50
+ it; the guard adds cross-session awareness and covers full-file `Write`s.)
51
+ - **Boot awareness**: SessionStart lists other active branches — local worktrees
52
+ and recent **remote** feature branches (author + age) — so parallel work on
53
+ other machines is visible immediately.
54
+ - **pre-push conflict check**: before a push lands, it fetches the upstream
55
+ (`l3.mainBranch`, default `main`) and **blocks** if your branch has a real
56
+ textual conflict with what was pushed there (warns on auto-mergeable overlap).
57
+ This is the cross-machine guarantee the local ledger can't give. Bypass:
58
+ `CONTEXT_ALLOW_CONFLICT_PUSH=1`.
59
+ - `/worktree-new` creates an isolated git worktree (its own ledger).
60
+ - `SESSIONS.md` / `WORKSPACE.md` are auto-generated; `pre-commit` regenerates
61
+ them; `commit-msg` enforces Conventional Commits (`[skip-cc]` to bypass).
62
+
63
+ **Use when:** more than one session/developer, or you use worktrees.
64
+
65
+ ## L4 — Squads
66
+
67
+ **Goal:** specialized review and design instead of one generalist.
68
+
69
+ Sub-agents land in `.claude/agents/`, organised into **squads** (each squad has
70
+ a router specialist + a roster). The kit ships **28 agents across 7 squads**:
71
+
72
+ - **devteam** — `architect` (cross-cutting design), `code-reviewer`
73
+ (constitution audit), `context-keeper` (platform + memory), `test-engineer`.
74
+ - **qa-team** — `qa-orchestrator` (router + sign-off) with `qa-unit` /
75
+ `qa-integration` / `qa-fuzzer` / `qa-perf` / `qa-e2e` specialists.
76
+ - **design-team** — `ui-designer`, `ux-designer`, `accessibility`,
77
+ **`seo-specialist`** (SEO + AISO), **`landing-architect`** (high-conversion
78
+ landing pages with anti-Lovable posture).
79
+ - **security-team** — `security`, `code-security`, `infra-security`.
80
+ - **compliance-team** — `privacy-lgpd`, `governance-officer`.
81
+ - **ops-team** — `devops`.
82
+ - **agent-forge** *(activated at L6)* — `forge-orchestrator`, `model-router`,
83
+ `prompt-engineer`, `tool-designer`, `eval-designer`, `packager`,
84
+ `rag-designer`, `agent-architect`.
85
+
86
+ Routing is automatic: Claude picks an agent by matching the user's intent to
87
+ the `description` frontmatter. QA commands (`/test-plan`, `/scaffold-tests`,
88
+ `/qa-signoff`) go through `qa-orchestrator`; `/landing-page` invokes
89
+ `landing-architect`, which delegates indexability to `seo-specialist`.
90
+
91
+ Use `_TEMPLATE.md` (or `/squad`) to grow your own domain agents. See
92
+ [`docs/SQUADS/design-team.md`](SQUADS/design-team.md) and
93
+ [`docs/SQUADS/agent-forge.md`](SQUADS/agent-forge.md).
94
+
95
+ **Use when:** the codebase is big enough that domain expertise pays off.
96
+
97
+ ## L5 — Proactive
98
+
99
+ **Goal:** convert "architecture before syntax" into executable governance.
100
+
101
+ - `PreToolUse` gate: editing a path in `l5.highRiskPaths` is **blocked** until
102
+ you run `/simulate-impact` (which writes a Blast Radius Report and authorizes
103
+ the edit). Trivial edits can record an explicit auditable bypass.
104
+ - `/tech-debt-sweep` audits the codebase against your `CLAUDE.md` constitution.
105
+ - Auto-distill: after enough sessions, the Stop hook suggests `/distill-sessions`
106
+ to propose refinements to `CLAUDE.md`.
107
+
108
+ **Use when:** the project has high-blast-radius areas (schema, public contracts,
109
+ auth) you want protected from casual edits.
110
+
111
+ ---
112
+
113
+ ## L6 — Autonomy & Insight
114
+
115
+ **Goal:** make the platform *act and learn*, not just remember and enforce. A
116
+ **capability tier** — no new hook, commands on top of the L5 gates.
117
+
118
+ - `/ship` — orchestrated pipeline (design → implement → review → test → record).
119
+ - `/retro` — turns recurring drift/debt into governance (rules + ADRs).
120
+ - `/context-stats` — telemetry (drift rate, cadence, ADR/agent counts).
121
+
122
+ **Use when:** the practice is established and you want orchestration + insight.
123
+
124
+ ---
125
+
126
+ ## L7 — Ecosystem & Scale
127
+
128
+ **Goal:** operate beyond a single repo and close the quality/insight loops. Also a
129
+ **capability tier** — no new hook.
130
+
131
+ - `/fleet` — one control plane over many repos (portfolio stats, cross-repo audit).
132
+ - `/tune-agents` — propose outcome-driven refinements to agent briefings.
133
+ - `/visual-test` — scaffold a browser-driven visual / screenshot harness.
134
+ - `/playbook`, `/token-report`, `/security-setup` + pluggable detectors & stack presets.
135
+
136
+ **Use when:** an existing/active project that should use the full toolkit from day one.
137
+
138
+ ---
139
+
140
+ ## Where to start
141
+
142
+ The kit is **not** timid by default:
143
+
144
+ - **AI-assisted coding a NEW / empty project from zero?** Start at **L3** — memory + drift +
145
+ multi-session + git hooks. A solid base, no ceremony.
146
+ - **A project that already has code?** Start at **L7** — use everything. It's not
147
+ intrusive: the L5 `simulate-gate` stays inert until you set `l5.highRiskPaths`; the
148
+ rest is advisory. (See [ADR-0009].)
149
+
150
+ `/context-level <n>` moves up or down any time. The installer picks **L3** (greenfield) or
151
+ **L7** (existing) for you, based on whether the folder already has code.