@luanpdd/kit-mcp 1.21.0 → 1.26.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 (275) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +914 -648
  3. package/kit/COMANDOS.md +138 -138
  4. package/kit/README.md +76 -52
  5. package/kit/agents/advisor-researcher.md +106 -106
  6. package/kit/agents/assumptions-analyzer.md +107 -107
  7. package/kit/agents/audit-log-implementer.md +138 -0
  8. package/kit/agents/auditor-consistencia-isolamento.md +413 -0
  9. package/kit/agents/codebase-mapper.md +768 -768
  10. package/kit/agents/crm-pipeline-implementer.md +106 -0
  11. package/kit/agents/debugger.md +813 -772
  12. package/kit/agents/detector-tenant-quente.md +337 -0
  13. package/kit/agents/evolution-go-integrator.md +21 -0
  14. package/kit/agents/example-reviewer.md +21 -21
  15. package/kit/agents/executor.md +564 -523
  16. package/kit/agents/integration-checker.md +200 -200
  17. package/kit/agents/invite-flow-implementer.md +52 -0
  18. package/kit/agents/lgpd-compliance-auditor.md +89 -0
  19. package/kit/agents/multi-tenant-isolation-auditor.md +10 -0
  20. package/kit/agents/multi-tenant-rls-writer.md +78 -0
  21. package/kit/agents/nyquist-auditor.md +178 -178
  22. package/kit/agents/org-onboarding-implementer.md +21 -0
  23. package/kit/agents/phase-researcher.md +696 -696
  24. package/kit/agents/plan-checker.md +272 -272
  25. package/kit/agents/planner.md +922 -891
  26. package/kit/agents/project-researcher.md +652 -652
  27. package/kit/agents/research-synthesizer.md +245 -245
  28. package/kit/agents/roadmapper.md +677 -677
  29. package/kit/agents/supabase-architect.md +27 -0
  30. package/kit/agents/supabase-auth-bootstrapper.md +80 -0
  31. package/kit/agents/supabase-column-privileges-writer.md +399 -0
  32. package/kit/agents/supabase-migration-writer.md +141 -14
  33. package/kit/agents/supabase-rbac-implementer.md +392 -0
  34. package/kit/agents/supabase-rls-hardener.md +521 -0
  35. package/kit/agents/supabase-rls-writer.md +105 -9
  36. package/kit/agents/supabase-roles-implementer.md +355 -0
  37. package/kit/agents/super-admin-implementer.md +99 -0
  38. package/kit/agents/ui-auditor.md +437 -437
  39. package/kit/agents/ui-checker.md +302 -302
  40. package/kit/agents/ui-researcher.md +355 -355
  41. package/kit/agents/user-profiler.md +175 -175
  42. package/kit/agents/validador-evolucao-schema.md +335 -0
  43. package/kit/agents/verifier.md +728 -728
  44. package/kit/commands/adicionar-backlog.md +75 -75
  45. package/kit/commands/adicionar-fase.md +42 -42
  46. package/kit/commands/adicionar-tarefa.md +45 -45
  47. package/kit/commands/adicionar-testes.md +41 -41
  48. package/kit/commands/ajuda.md +21 -21
  49. package/kit/commands/atualizar.md +37 -37
  50. package/kit/commands/auditar-marco.md +179 -179
  51. package/kit/commands/auditar-uat.md +23 -23
  52. package/kit/commands/autonomo.md +40 -40
  53. package/kit/commands/branch-pr.md +24 -24
  54. package/kit/commands/concluir-marco.md +247 -247
  55. package/kit/commands/configuracoes.md +36 -36
  56. package/kit/commands/dados-distribuidos.md +188 -0
  57. package/kit/commands/definir-perfil.md +10 -10
  58. package/kit/commands/depurar.md +190 -190
  59. package/kit/commands/discutir-fase.md +131 -131
  60. package/kit/commands/entrar-discord.md +17 -17
  61. package/kit/commands/estatisticas.md +18 -18
  62. package/kit/commands/example-greeting.md +33 -33
  63. package/kit/commands/executar-fase.md +58 -58
  64. package/kit/commands/expresso.md +56 -56
  65. package/kit/commands/fase-ui.md +34 -34
  66. package/kit/commands/fazer.md +57 -57
  67. package/kit/commands/fio.md +125 -125
  68. package/kit/commands/fluxos-trabalho.md +64 -64
  69. package/kit/commands/forense.md +176 -176
  70. package/kit/commands/gerenciador.md +38 -38
  71. package/kit/commands/inserir-fase.md +31 -31
  72. package/kit/commands/limpeza.md +17 -17
  73. package/kit/commands/listar-hipoteses-fase.md +45 -45
  74. package/kit/commands/listar-workspaces.md +18 -18
  75. package/kit/commands/mapear-codebase.md +70 -70
  76. package/kit/commands/nota.md +33 -33
  77. package/kit/commands/novo-marco.md +43 -43
  78. package/kit/commands/novo-projeto.md +41 -41
  79. package/kit/commands/novo-workspace.md +43 -43
  80. package/kit/commands/pausar-trabalho.md +37 -37
  81. package/kit/commands/perfil-usuario.md +45 -45
  82. package/kit/commands/pesquisar-fase.md +195 -195
  83. package/kit/commands/planejar-fase.md +67 -67
  84. package/kit/commands/planejar-lacunas.md +33 -33
  85. package/kit/commands/plantar-ideia.md +25 -25
  86. package/kit/commands/progresso.md +24 -24
  87. package/kit/commands/proximo.md +30 -30
  88. package/kit/commands/publicar.md +490 -490
  89. package/kit/commands/rapido.md +35 -35
  90. package/kit/commands/reaplicar-patches.md +124 -124
  91. package/kit/commands/relatorio-sessao.md +19 -19
  92. package/kit/commands/remover-fase.md +31 -31
  93. package/kit/commands/remover-workspace.md +26 -26
  94. package/kit/commands/resumo-marco.md +50 -50
  95. package/kit/commands/retomar-trabalho.md +40 -40
  96. package/kit/commands/revisar-backlog.md +60 -60
  97. package/kit/commands/revisar-ui.md +32 -32
  98. package/kit/commands/revisar.md +37 -37
  99. package/kit/commands/saude.md +21 -21
  100. package/kit/commands/setup-notion.md +93 -93
  101. package/kit/commands/supabase.md +55 -8
  102. package/kit/commands/sync-main.md +68 -68
  103. package/kit/commands/validar-fase.md +35 -35
  104. package/kit/commands/verificar-tarefas.md +44 -44
  105. package/kit/commands/verificar-trabalho.md +64 -64
  106. package/kit/file-manifest.json +52 -32
  107. package/kit/framework/bin/lib/commands.cjs +959 -959
  108. package/kit/framework/bin/lib/config.cjs +442 -442
  109. package/kit/framework/bin/lib/core.cjs +1230 -1230
  110. package/kit/framework/bin/lib/frontmatter.cjs +336 -336
  111. package/kit/framework/bin/lib/init.cjs +1442 -1442
  112. package/kit/framework/bin/lib/milestone.cjs +252 -252
  113. package/kit/framework/bin/lib/model-profiles.cjs +68 -68
  114. package/kit/framework/bin/lib/phase.cjs +888 -888
  115. package/kit/framework/bin/lib/profile-output.cjs +952 -952
  116. package/kit/framework/bin/lib/profile-pipeline.cjs +539 -539
  117. package/kit/framework/bin/lib/roadmap.cjs +329 -329
  118. package/kit/framework/bin/lib/security.cjs +382 -382
  119. package/kit/framework/bin/lib/state.cjs +1031 -1031
  120. package/kit/framework/bin/lib/template.cjs +222 -222
  121. package/kit/framework/bin/lib/uat.cjs +282 -282
  122. package/kit/framework/bin/lib/verify.cjs +888 -888
  123. package/kit/framework/bin/lib/workstream.cjs +491 -491
  124. package/kit/framework/bin/tools.cjs +918 -918
  125. package/kit/framework/commands/workstreams.md +63 -63
  126. package/kit/framework/references/checkpoints.md +778 -778
  127. package/kit/framework/references/continuation-format.md +249 -249
  128. package/kit/framework/references/decimal-phase-calculation.md +64 -64
  129. package/kit/framework/references/git-integration.md +295 -295
  130. package/kit/framework/references/git-planning-commit.md +38 -38
  131. package/kit/framework/references/model-profile-resolution.md +36 -36
  132. package/kit/framework/references/model-profiles.md +139 -139
  133. package/kit/framework/references/phase-argument-parsing.md +61 -61
  134. package/kit/framework/references/planning-config.md +202 -202
  135. package/kit/framework/references/questioning.md +162 -162
  136. package/kit/framework/references/tdd.md +263 -263
  137. package/kit/framework/references/ui-brand.md +160 -160
  138. package/kit/framework/references/user-profiling.md +657 -657
  139. package/kit/framework/references/verification-patterns.md +612 -612
  140. package/kit/framework/references/workstream-flag.md +58 -58
  141. package/kit/framework/templates/DEBUG.md +164 -164
  142. package/kit/framework/templates/UAT.md +265 -265
  143. package/kit/framework/templates/UI-SPEC.md +100 -100
  144. package/kit/framework/templates/VALIDATION.md +76 -76
  145. package/kit/framework/templates/claude-md.md +122 -122
  146. package/kit/framework/templates/codebase/architecture.md +185 -185
  147. package/kit/framework/templates/codebase/concerns.md +205 -205
  148. package/kit/framework/templates/codebase/conventions.md +204 -204
  149. package/kit/framework/templates/codebase/integrations.md +192 -192
  150. package/kit/framework/templates/codebase/stack.md +158 -158
  151. package/kit/framework/templates/codebase/structure.md +199 -199
  152. package/kit/framework/templates/codebase/testing.md +301 -301
  153. package/kit/framework/templates/config.json +44 -44
  154. package/kit/framework/templates/context.md +352 -352
  155. package/kit/framework/templates/continue-here.md +78 -78
  156. package/kit/framework/templates/copilot-instructions.md +7 -7
  157. package/kit/framework/templates/debug-subagent-prompt.md +91 -91
  158. package/kit/framework/templates/dev-preferences.md +20 -20
  159. package/kit/framework/templates/discovery.md +146 -146
  160. package/kit/framework/templates/discussion-log.md +63 -63
  161. package/kit/framework/templates/milestone-archive.md +123 -123
  162. package/kit/framework/templates/milestone.md +115 -115
  163. package/kit/framework/templates/phase-prompt.md +610 -610
  164. package/kit/framework/templates/planner-subagent-prompt.md +117 -117
  165. package/kit/framework/templates/project.md +186 -186
  166. package/kit/framework/templates/requirements.md +231 -231
  167. package/kit/framework/templates/research-project/ARCHITECTURE.md +204 -204
  168. package/kit/framework/templates/research-project/FEATURES.md +147 -147
  169. package/kit/framework/templates/research-project/PITFALLS.md +200 -200
  170. package/kit/framework/templates/research-project/STACK.md +120 -120
  171. package/kit/framework/templates/research-project/SUMMARY.md +170 -170
  172. package/kit/framework/templates/research.md +419 -419
  173. package/kit/framework/templates/retrospective.md +54 -54
  174. package/kit/framework/templates/roadmap.md +202 -202
  175. package/kit/framework/templates/state.md +176 -176
  176. package/kit/framework/templates/summary-complex.md +59 -59
  177. package/kit/framework/templates/summary-minimal.md +41 -41
  178. package/kit/framework/templates/summary-standard.md +48 -48
  179. package/kit/framework/templates/summary.md +209 -209
  180. package/kit/framework/templates/user-profile.md +146 -146
  181. package/kit/framework/templates/user-setup.md +256 -256
  182. package/kit/framework/templates/verification-report.md +258 -258
  183. package/kit/framework/workflows/add-phase.md +112 -112
  184. package/kit/framework/workflows/add-tests.md +351 -351
  185. package/kit/framework/workflows/add-todo.md +158 -158
  186. package/kit/framework/workflows/audit-milestone.md +340 -340
  187. package/kit/framework/workflows/audit-uat.md +109 -109
  188. package/kit/framework/workflows/autonomous.md +891 -891
  189. package/kit/framework/workflows/check-todos.md +177 -177
  190. package/kit/framework/workflows/cleanup.md +152 -152
  191. package/kit/framework/workflows/complete-milestone.md +696 -696
  192. package/kit/framework/workflows/diagnose-issues.md +231 -231
  193. package/kit/framework/workflows/discovery-phase.md +289 -289
  194. package/kit/framework/workflows/discuss-phase-assumptions.md +653 -653
  195. package/kit/framework/workflows/discuss-phase.md +784 -784
  196. package/kit/framework/workflows/do.md +104 -104
  197. package/kit/framework/workflows/execute-phase.md +838 -838
  198. package/kit/framework/workflows/execute-plan.md +510 -510
  199. package/kit/framework/workflows/fast.md +102 -102
  200. package/kit/framework/workflows/forensics.md +265 -265
  201. package/kit/framework/workflows/health.md +181 -181
  202. package/kit/framework/workflows/help.md +619 -619
  203. package/kit/framework/workflows/insert-phase.md +130 -130
  204. package/kit/framework/workflows/list-phase-assumptions.md +178 -178
  205. package/kit/framework/workflows/list-workspaces.md +56 -56
  206. package/kit/framework/workflows/manager.md +362 -362
  207. package/kit/framework/workflows/map-codebase.md +377 -377
  208. package/kit/framework/workflows/milestone-summary.md +223 -223
  209. package/kit/framework/workflows/new-milestone.md +486 -486
  210. package/kit/framework/workflows/new-project.md +1159 -1159
  211. package/kit/framework/workflows/new-workspace.md +237 -237
  212. package/kit/framework/workflows/next.md +97 -97
  213. package/kit/framework/workflows/node-repair.md +92 -92
  214. package/kit/framework/workflows/note.md +156 -156
  215. package/kit/framework/workflows/pause-work.md +176 -176
  216. package/kit/framework/workflows/plan-milestone-gaps.md +273 -273
  217. package/kit/framework/workflows/plan-phase.md +765 -765
  218. package/kit/framework/workflows/plant-seed.md +169 -169
  219. package/kit/framework/workflows/pr-branch.md +129 -129
  220. package/kit/framework/workflows/profile-user.md +450 -450
  221. package/kit/framework/workflows/progress.md +507 -507
  222. package/kit/framework/workflows/quick.md +757 -757
  223. package/kit/framework/workflows/remove-phase.md +155 -155
  224. package/kit/framework/workflows/remove-workspace.md +90 -90
  225. package/kit/framework/workflows/research-phase.md +82 -82
  226. package/kit/framework/workflows/resume-project.md +326 -326
  227. package/kit/framework/workflows/review.md +228 -228
  228. package/kit/framework/workflows/session-report.md +146 -146
  229. package/kit/framework/workflows/settings.md +283 -283
  230. package/kit/framework/workflows/ship.md +228 -228
  231. package/kit/framework/workflows/stats.md +60 -60
  232. package/kit/framework/workflows/transition.md +671 -671
  233. package/kit/framework/workflows/ui-phase.md +302 -302
  234. package/kit/framework/workflows/ui-review.md +165 -165
  235. package/kit/framework/workflows/update.md +323 -323
  236. package/kit/framework/workflows/validate-phase.md +174 -174
  237. package/kit/framework/workflows/verify-phase.md +252 -252
  238. package/kit/framework/workflows/verify-work.md +637 -637
  239. package/kit/hooks/check-update.js +118 -118
  240. package/kit/hooks/context-monitor.js +163 -163
  241. package/kit/hooks/prompt-guard.js +103 -103
  242. package/kit/hooks/statusline.js +125 -125
  243. package/kit/hooks/workflow-guard.js +101 -101
  244. package/kit/settings.json +45 -45
  245. package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -0
  246. package/kit/skills/_shared-supabase/glossary.md +27 -0
  247. package/kit/skills/armadilhas-sistemas-distribuidos/SKILL.md +447 -0
  248. package/kit/skills/audit-log-multi-tenant/SKILL.md +6 -0
  249. package/kit/skills/cascading-failures/SKILL.md +4 -0
  250. package/kit/skills/consistencia-leitura-replica/SKILL.md +385 -0
  251. package/kit/skills/crm-lead-pipeline-patterns/SKILL.md +17 -0
  252. package/kit/skills/escolha-modelo-consistencia/SKILL.md +495 -0
  253. package/kit/skills/evolucao-schema-compativel/SKILL.md +448 -0
  254. package/kit/skills/example-skill/SKILL.md +42 -42
  255. package/kit/skills/multi-tenant-performance-scaling/SKILL.md +4 -0
  256. package/kit/skills/multi-tenant-rls-hierarchy/SKILL.md +4 -0
  257. package/kit/skills/postgres-isolamento-concorrencia/SKILL.md +552 -0
  258. package/kit/skills/rbac-permissions-matrix-supabase/SKILL.md +37 -0
  259. package/kit/skills/streams-eventos-cdc/SKILL.md +712 -0
  260. package/kit/skills/supabase-column-level-security/SKILL.md +426 -0
  261. package/kit/skills/supabase-cron-queues/SKILL.md +9 -0
  262. package/kit/skills/supabase-custom-claims-rbac/SKILL.md +472 -0
  263. package/kit/skills/supabase-database-functions/SKILL.md +85 -0
  264. package/kit/skills/supabase-migrations/SKILL.md +133 -11
  265. package/kit/skills/supabase-postgres-roles/SKILL.md +392 -0
  266. package/kit/skills/supabase-rls-defense-in-depth/SKILL.md +418 -0
  267. package/kit/skills/supabase-rls-policies/SKILL.md +462 -12
  268. package/kit/skills/super-admin-platform-pattern/SKILL.md +4 -0
  269. package/kit/skills/tenant-quente-mitigacao/SKILL.md +605 -0
  270. package/package.json +63 -63
  271. package/src/core/kit.js +216 -216
  272. package/src/core/reflect.js +247 -247
  273. package/src/core/reverse-sync.js +372 -372
  274. package/src/core/sync.js +418 -418
  275. package/src/core/watch.js +121 -121
package/README.md CHANGED
@@ -1,648 +1,914 @@
1
- # kit-mcp
2
-
3
- [![npm version](https://img.shields.io/npm/v/@luanpdd/kit-mcp.svg)](https://www.npmjs.com/package/@luanpdd/kit-mcp)
4
- [![npm downloads](https://img.shields.io/npm/dm/@luanpdd/kit-mcp.svg)](https://www.npmjs.com/package/@luanpdd/kit-mcp)
5
- [![CI](https://github.com/luanpdd/kit-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/luanpdd/kit-mcp/actions/workflows/ci.yml)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
-
8
- An opinionated **brownfield planning workflow** (in PT-BR) — agents, slash-commands, framework — shipped as an **MCP server**, with one-shot **sync** that projects the kit into every supported IDE's native layout — Claude Code, Cursor, Codex, Gemini CLI, Windsurf, Antigravity, Copilot, Trae.
9
-
10
- > **One canonical source. N IDEs. Edit once, everywhere updated.**
11
- >
12
- > Install and inherit the bundled workflow, or point `--kit-root` at your own folder to replace it entirely.
13
-
14
- ---
15
-
16
- ## Why this exists
17
-
18
- `.claude/agents/`, `.claude/commands/`, `.claude/skills/` are powerful but locked to Claude Code. The same definitions also need to live as `AGENTS.md` for Codex, `GEMINI.md` for Gemini, `.cursor/rules/` for Cursor, etc. Maintaining all of those by hand drifts immediately.
19
-
20
- **kit-mcp** keeps your canonical source in one place and projects it into every supported IDE through a single registry. It also exposes the kit through an MCP server so any agent that speaks MCP can browse, search, sync, run gates, and record replays.
21
-
22
- Inspired by [vinilana/dotcontext](https://github.com/vinilana/dotcontext) — see the design notes at the bottom for what's adapted, what's not, and why.
23
-
24
- ---
25
-
26
- <!-- AUTOGEN-COUNTS-START -->
27
- **Bundled workflow:** 57 agents · 88 commands · 60 skills · 23 gates
28
- <!-- AUTOGEN-COUNTS-END -->
29
-
30
- ## What ships in the box
31
-
32
- ```
33
- kit-mcp/
34
- ├── kit/ ← bundled brownfield workflow (PT-BR)
35
- │ ├── agents/ 47 agents (planner, executor, verifier, debugger,
36
- │ │ ui-auditor, codebase-mapper, …)
37
- │ ├── commands/ 87 slash-commands (/novo-marco, /planejar-fase,
38
- │ │ /executar-fase, /publicar, …)
39
- │ ├── framework/ workflows + templates + bin libs the agents use
40
- │ ├── hooks/ workflow guards, prompt guards, statusline
41
- │ ├── skills/example-skill/ single example skill (replace with your own)
42
- │ └── README.md file-format guide
43
-
44
- ├── gates/ ← reusable workflow gates (regression, confidence, dep-check, …)
45
-
46
- ├── src/
47
- │ ├── core/ pure runtime — registry, kit, sync, reverse-sync, gates,
48
- │ │ gate-runner, watch, failures, replays, reflect
49
- │ ├── mcp-server/ MCP server entry + install command
50
- │ └── cli/ CLI mirror of the MCP tools
51
-
52
- ├── bin/
53
- │ ├── mcp.js shim → starts the MCP stdio server
54
- │ └── cli.js shim → runs the CLI
55
-
56
- ├── LICENSE MIT
57
- ├── CHANGELOG.md
58
- ├── package.json
59
- └── README.md ← you are here
60
- ```
61
-
62
- **Lines of source code:** ~1300. **Runtime dependencies:** 5 (`@modelcontextprotocol/sdk`, `commander`, `chokidar`, `picocolors`, `@inquirer/prompts`). **Build step:** none — plain ESM Node.js 20+.
63
-
64
- ### About the bundled workflow
65
-
66
- The bundled `kit/` is an opinionated **brownfield planning workflow** in Portuguese — milestones, phases, requirements, planning, execution with atomic commits and checkpoints, retrospective auditing. Installing `@luanpdd/kit-mcp` and syncing into your IDE gives you all 87+ slash-commands, 47+ agents, plus the framework templates that they delegate into.
67
-
68
- If that's not what you want, point `--kit-root` at your own folder and ignore everything under `kit/` — the infrastructure (registry, sync, gates, forensics, MCP server) works the same regardless of what kit you load.
69
-
70
- ### Observability suite (v1.9)
71
-
72
- A complete observability layer derived from *Observability Engineering* (Charity Majors, Liz Fong-Jones, George Miranda — O'Reilly, 2022) ships in the kit. It integrates deeply with the Supabase suite (v1.8) — every Supabase agent now consults observability skills, and the new `incident-investigator` agent uses `mcp__supabase__get_logs` / `execute_sql` / `get_advisors` to apply the **Core Analysis Loop** on real incidents.
73
-
74
- **11 skills** in `kit/skills/`:
75
- - `_shared-observability/glossary.md` — canonical bilingual vocabulary (PT-BR↔EN)
76
- - `structured-events`, `distributed-tracing`, `opentelemetry-standard`, `core-analysis-loop` — foundationals
77
- - `observability-driven-development` — the 4 pre-PR questions ("Does it do what I expected? Compare to previous version? Are users using? Anomalies emerge?")
78
- - `event-based-slos`, `burn-rate-alerting` — SLO definition + predictive burn alerts
79
- - `telemetry-sampling`, `telemetry-pipelines`, `observability-maturity-model` — scale + culture
80
-
81
- **5 agents** in `kit/agents/`:
82
- - `observability-instrumenter` — generates OTel + canonical attribute patches
83
- - `incident-investigator` — Core Analysis Loop with persistent state in `.planning/investigations/`
84
- - `slo-engineer` — generates `SLO.md` + SQL migrations to materialize SLI events
85
- - `burn-rate-forecaster` — calculates burn rate, ETA exhaustion, alert config
86
- - `omm-auditor` — scores 5 OMM capabilities (resilience, code quality, complexity, release cadence, user behavior)
87
-
88
- **6 commands**:
89
- - `/observabilidade <subcommand>` — single orchestrator (analog to `/supabase`) — dispatches to the 5 agents above with PT/EN synonyms
90
- - `/instrumentar-fase` — generates `INSTRUMENTATION.md` per plan after `/planejar-fase`
91
- - `/investigar-producao` — guided Core Analysis Loop with persistent state
92
- - `/definir-slo` — creates SLO definition + SQL materialized view
93
- - `/burn-rate-status` — table `[SLO | budget burned | ETA | action]`, also runnable in `/loop`
94
- - `/auditar-observabilidade` — generates OMM-REPORT.md scored
95
-
96
- **Quick start example:**
97
- ```bash
98
- # Define an SLO for a critical journey
99
- /observabilidade slo "checkout"
100
-
101
- # Investigate a production incident with Core Analysis Loop
102
- /observabilidade investigar "checkout SLO burn rate = 8 às 14:32"
103
-
104
- # Score project against Observability Maturity Model
105
- /observabilidade omm
106
- ```
107
-
108
- ### SRE Engagement suite (v1.10)
109
-
110
- A production engineering layer derived from *Site Reliability Engineering: How Google Runs Production Systems* (Beyer, Jones, Petoff, Murphy — Google/O'Reilly, 2016) ships in the kit. It composes with the Supabase suite (v1.8) and the Observability suite (v1.9) into a coherent production engineering stack — Supabase agents now suggest PRR before launch, every Edge Function template includes the **4 golden signals**, and `incident-investigator` outputs feed directly into blameless postmortems via `/postmortem --from-investigation <id>`.
111
-
112
- **6 skills** in `kit/skills/`:
113
- - `_shared-sre/glossary.md` — canonical bilingual vocabulary (PT-BR↔EN) — SLI/SLO/SLA, error budget, burn rate, toil, postmortem, blameless, PRR, golden signals, risk continuum, MTTR/MTBF
114
- - `sre-risk-management` — risk continuum (cap 3), 99.99% wisdom ("as reliable as needs to be, no more"), error budget as explicit risk × innovation balance
115
- - `four-golden-signals` — Latency + Traffic + Errors + Saturation (cap 6), histograms with exponential bucketing, success vs error latency separated, percentiles vs mean (long tail)
116
- - `eliminating-toil` — canonical toil definition (manual + repetitive + automatable + tactical + no enduring value + scales linearly), ≤ 50% rule (cap 5), automation patterns
117
- - `blameless-postmortems` — canonical 9-section template (cap 15), "no postmortem left unreviewed", blame culture as anti-pattern, Wheel of Misfortune
118
- - `production-readiness-review` — PRR checklist (cap 32) — 6 axes (System architecture, Instrumentation, Emergency response, Capacity planning, Change management, Performance), 3 engagement models
119
-
120
- **4 agents** in `kit/agents/`:
121
- - `golden-signals-instrumenter` — specialization of `observability-instrumenter` (v1.9); generates OTel patches with the 4 golden signals (Latency=histogram, Traffic=counter, Errors=counter by `error.type`, Saturation=gauge)
122
- - `toil-auditor` — analyzes git log + shell scripts + manual commands in README/runbooks; produces `TOIL-AUDIT.md` with P0/P1/P2 priority + estimated effort
123
- - `postmortem-writer` — natural continuation of `incident-investigator` (v1.9); reads `.planning/investigations/<id>.md` and produces blameless postmortem (Summary, Impact, Root Causes, Trigger, Resolution, Detection, Action Items, Lessons Learned, Timeline UTC)
124
- - `prr-conductor` — conducts Production Readiness Review for service/feature; reads schema (Supabase MCP), Edge Functions, `.planning/slos/`, audit logs; produces `PRR-REPORT.md` scored across the 6 axes
125
-
126
- **6 commands**:
127
- - `/sre <subcommand>` — single orchestrator (analog to `/supabase` v1.8 and `/observabilidade` v1.9) — dispatches to the 4 agents with PT/EN synonyms
128
- - `/golden-signals` — invokes `golden-signals-instrumenter` for service/Edge Function/phase; generates `GOLDEN-SIGNALS.md` with OTel-ready instrumentation
129
- - `/auditar-toil` — invokes `toil-auditor`; generates `.planning/TOIL-AUDIT.md`
130
- - `/postmortem` — invokes `postmortem-writer`; supports `--from-investigation <id>` (continue from v1.9 investigation) or `--incident "<description>"` (standalone)
131
- - `/prr` — invokes `prr-conductor`; supports `--service <name>` or `--feature <description>`; generates `PRR-REPORT.md`
132
- - `/risk-budget` — displays current error budget vs risk continuum, citing SLOs from v1.9 (`.planning/slos/`); applies `sre-risk-management` skill
133
-
134
- **3 audit gates** in `gates/`:
135
- - `golden-signals-coverage` (blocking, pre-verify) — verifies code in `supabase/functions/**`, `src/**`, `lib/**` covers the 4 golden signals (skips gracefully on content-only phases)
136
- - `postmortem-template-required` (blocking, pre-conclude) — blocks `/concluir-marco` if any `.planning/investigations/<id>.md` lacks a corresponding `.planning/postmortems/<id>.md` (`Status: INCONCLUSIVE` is the only exception)
137
- - `prr-checklist-coverage` (blocking, pre-verify) — verifies every `PRR-REPORT.md` in `.planning/prr/**/*.md` covers the 6 canonical axes; "skipping an axe = invalid approval"
138
-
139
- **Lifecycle integration:**
140
- - `/forense` — after Core Analysis Loop closes with VALIDATED root cause, suggests chain `/postmortem --from-investigation <id>` (Phase 40 / INT-FW-V2-01)
141
- - `/concluir-marco` — opt-in gate `workflow.complete_milestone_prr_gate=true` requires `PRR-REPORT.md` with status `passed` for production-bound features before archive (Phase 40 / INT-FW-V2-02)
142
- - `/auditar-marco` — auto-invokes `/auditar-toil` when `workflow.audit_milestone_toil=true` (default); result feeds OMM Capacidade 3 scoring via `omm-auditor` (Phase 40 / INT-FW-V2-03)
143
-
144
- **Quick start example — end-to-end SRE workflow:**
145
- ```bash
146
- # Before launching a new feature in production — PRR
147
- /sre prr --feature "checkout v2"
148
-
149
- # While instrumenting service — apply 4 golden signals
150
- /sre golden-signals supabase/functions/orders/index.ts
151
-
152
- # Audit team toil quarterly
153
- /sre toil
154
-
155
- # When SLO burn alert fires — investigate (v1.9 deep loop), then postmortem (v1.10)
156
- /investigar-producao "checkout SLO burn rate = 8 às 14:32"
157
- /sre postmortem --from-investigation checkout-2026-05-07
158
- # Or for framework-level failures:
159
- /forense "framework workflow X falhou em produção"
160
- /sre postmortem --incident "framework workflow X failed (see .planning/forensics/report-*)"
161
-
162
- # Risk dashboard against SLO budgets
163
- /sre risk-budget
164
- ```
165
-
166
- ---
167
-
168
- ## Prerequisites
169
-
170
- - **Node.js 20** (uses native ESM, no transpiler)
171
- - An IDE / agent that speaks MCP if you want to use it that way (Claude Code, Cursor, Codex, Gemini CLI, …)
172
- - Optional: a project where you'll sync the kit (any folder)
173
-
174
- ---
175
-
176
- ## Quick start
177
-
178
- ### 1. Use the bundled workflow as-is (recommended)
179
-
180
- ```bash
181
- # Browse what's bundled
182
- npx -y @luanpdd/kit-mcp kit list-agents # 47 agents
183
- npx -y @luanpdd/kit-mcp kit list-commands # 87 commands
184
- npx -y @luanpdd/kit-mcp sync targets # supported IDEs
185
-
186
- # Install into your project for Claude Code
187
- npx -y @luanpdd/kit-mcp sync install claude-code --project-root .
188
- ```
189
-
190
- After that, open the project in Claude Code and the slash-commands (`/novo-marco`, `/planejar-fase`, `/executar-fase`, `/publicar`, …) and agents are immediately available.
191
-
192
- ### 2. Replace the bundled workflow with your own kit
193
-
194
- Point kit-mcp at your own `kit/` folder via `--kit-root` or the `KIT_MCP_KIT_ROOT` env var:
195
-
196
- ```bash
197
- # Option A: per-command flag
198
- npx -y @luanpdd/kit-mcp --kit-root ~/my-kit kit list-agents
199
- npx -y @luanpdd/kit-mcp --kit-root ~/my-kit sync install claude-code --project-root .
200
-
201
- # Option B: env var (sticky for the session)
202
- export KIT_MCP_KIT_ROOT=~/my-kit
203
- npx -y @luanpdd/kit-mcp sync install claude-code --project-root .
204
- ```
205
-
206
- Your `~/my-kit/` follows the same layout as the bundled kit:
207
-
208
- ```
209
- my-kit/
210
- ├── agents/<name>.md YAML frontmatter + Markdown body
211
- ├── commands/<name>.md YAML frontmatter + Markdown body
212
- └── skills/<name>/SKILL.md YAML frontmatter + Markdown body
213
- references/ optional reference docs
214
- ```
215
-
216
- See [`kit/README.md`](kit/README.md) for the file format.
217
-
218
- ### 3. Register kit-mcp into an IDE (so agents inside the IDE can call the MCP tools)
219
-
220
- ```bash
221
- # Portable works on any machine, no clone needed
222
- npx -y @luanpdd/kit-mcp install write claude-code --scope user --via npx
223
- ```
224
-
225
- For other IDEs, swap `claude-code` for `cursor`, `codex`, `gemini-cli`, `windsurf`, `antigravity`, `copilot`, or `trae`. Run `kit sync targets` for the live capability matrix.
226
-
227
- ---
228
-
229
- ## CLI reference
230
-
231
- The CLI mirrors the MCP tools 1:1. **By default the CLI prints colored, human-readable tables and summary panels.** Add `--json` to restore raw JSON-to-stdout (machine-readable, the default in v1.0). The global `--kit-root` flag overrides the kit source for any subcommand.
232
-
233
- ```bash
234
- kit list-agents # human: colored table, name + description
235
- kit list-agents --json # machine: JSON array
236
-
237
- kit sync install claude-code # human: progress bar + summary panel
238
- kit sync install claude-code --json # machine: full result object
239
- ```
240
-
241
- In non-TTY mode (pipes, CI), animations degrade to linear status lines automatically. `NO_COLOR=1` disables colors entirely; `FORCE_COLOR=1` forces them on even in pipes.
242
-
243
- ### `kit kit ...` — browse the kit
244
-
245
- ```bash
246
- kit kit list-agents # 47 agents (bundled workflow)
247
- kit kit list-commands # 87 commands (bundled workflow)
248
- kit kit list-skills # 49 skills (bundled workflow)
249
- kit kit get agent planner
250
- kit kit search "milestone" # fuzzy match across all kinds
251
- ```
252
-
253
- ### `kit sync ...`project into an IDE
254
-
255
- ```bash
256
- kit sync targets # list supported IDEs + capabilities
257
- kit sync status claude-code # see which capability paths exist in cwd
258
- kit sync install claude-code # write the kit into the cwd as Claude Code expects
259
- kit sync install cursor --mode copy # copy mode (no link to canonical)
260
- kit sync install codex --dry-run # preview without writing
261
- kit sync remove claude-code # remove only files generated by kit-mcp (uses STUB_MARKER)
262
- kit sync watch claude-code cursor # watch kit/ resync to listed IDEs on every change
263
- kit sync watch --all # watch + auto-detect every IDE already present in cwd
264
- ```
265
-
266
- **Modes:**
267
- - `reference` (default) writes a stub that links back to `kit/`. Edit canonical all IDEs see the change.
268
- - `copy` — duplicates content. Use when shipping a frozen snapshot of the kit.
269
-
270
- **Per-IDE projection** — what each target receives:
271
-
272
- | IDE | rules → | agents → | commands → | skills → | framework → | hooks → |
273
- |---|---|---|---|---|---|---|
274
- | Claude Code | `CLAUDE.md` | `.claude/agents/*.md` | `.claude/commands/*.md` | `.claude/skills/*/` | `.claude/framework/**` | `.claude/hooks/**` |
275
- | Cursor | `.cursor/rules/*.mdc` | `.cursor/agents/*.md` | — | — | — | — |
276
- | Codex | `AGENTS.md` | — | — | `.codex/skills/*/` | — | — |
277
- | Gemini CLI | `GEMINI.md` | — | — | `.gemini/skills/*/` | — | — |
278
- | Copilot | `.github/copilot-instructions.md` | `.github/agents/*.agent` | — | `.github/skills/*/` | — | — |
279
- | Windsurf | `.windsurf/rules/*.md` | `.windsurf/agents/*.md` | — | `.windsurf/skills/*/` | — | — |
280
- | Antigravity | `.agents/rules/*.md` | `.agents/agents/*.md` | | `.agents/workflows/*/` | | |
281
- | Trae | `.trae/rules/*.md` | `.trae/agents/*.md` | | | | |
282
-
283
- A capability marked `—` is not supported by that IDE. Adding a new IDE = one entry in [`src/core/registry.js`](src/core/registry.js).
284
-
285
- **About `framework` and `hooks`:** these are *mirror-tree* capabilities — the entire `kit/framework/` and `kit/hooks/` subtrees are copied verbatim into `.claude/framework/` and `.claude/hooks/`. They're needed by the bundled workflow because slash-commands like `/novo-marco` reference framework files via paths like `@./.claude/framework/workflows/new-milestone.md`. A `.kit-mcp-managed` marker is written at the root of each managed tree so `kit sync remove` can clean up safely without touching directories you authored yourself.
286
-
287
- ### `kit install ...` register kit-mcp into an IDE's MCP config
288
-
289
- ```bash
290
- kit install targets # list IDEs that support MCP config
291
- kit install dry-run claude-code --scope user --via npx # preview the JSON/TOML
292
- kit install write claude-code --scope user --via npx # portable: uses `npx @luanpdd/kit-mcp`
293
- kit install write claude-code --scope project --via local # local clone: uses ./bin/mcp.js absolute path
294
- kit install write claude-code --scope user --via global # assumes `npm install -g @luanpdd/kit-mcp`
295
- kit install write # no target: opens an interactive selector (TTY)
296
- kit install write claude-code --yes # CI: skip the confirm prompt
297
- ```
298
-
299
- Since v1.1, `install write` always **previews** the JSON/TOML it's about to write and asks you to confirm. Pass `--yes` (CI mode) or `--json` to bypass the prompt. Without a target argument in TTY mode, you get an arrow-key selector listing all 8 IDEs.
300
-
301
- `--via` decides how the IDE will invoke the server:
302
-
303
- | Mode | Command in IDE config | When to use |
304
- |---|---|---|
305
- | `npx` (recommended) | `npx -y @luanpdd/kit-mcp` | Portableworks on any machine |
306
- | `local` | `node /abs/path/to/clone/bin/mcp.js` | You're hacking on kit-mcp itself |
307
- | `global` | `kit-mcp` | After `npm install -g @luanpdd/kit-mcp` — fastest startup |
308
-
309
- ### `kit reverse-sync ...` — bring IDE edits back to the canonical kit
310
-
311
- If you edited an agent/command/skill/framework/hook **directly inside the IDE's folder** (`.claude/agents/foo.md`, `.claude/framework/workflows/bar.md`, `.claude/hooks/baz.js`, …) instead of in your kit, this brings those edits back so the canonical absorbs them.
312
-
313
- ```bash
314
- kit reverse-sync detect claude-code --project-root .
315
- kit reverse-sync apply claude-code --project-root . --strategy merge --dry-run
316
- kit reverse-sync apply claude-code --project-root . --strategy merge
317
- kit reverse-sync apply claude-code --project-root . --strategy overwrite --only agent/foo
318
- kit reverse-sync apply claude-code --project-root . --strategy overwrite --only framework/workflows/new-milestone.md
319
- ```
320
-
321
- **Strategies:** `skip` (list-only), `merge` (canonical frontmatter + edited body for agents/commands/skills), `overwrite`, `rename` (preserve both as `-from-{ide}.md`).
322
-
323
- **Mirror-tree caps (`framework`, `hooks`):** files have no frontmatter, so `merge` degenerates to `overwrite` (with a note). The `.kit-mcp-managed` marker is automatically excluded from candidates. Filter individual files with `--only framework/<rel>` or `--only hooks/<file>`.
324
-
325
- ### `kit gates ...` reusable workflow gates
326
-
327
- ```bash
328
- kit gates list # all gates with stage + blocking flag
329
- kit gates get regression # full markdown of one gate
330
- kit gates for-stage pre-verify # gates that run before the verify step
331
- kit gates run secrets-scan --project-root . # interactive: shows the script, asks y/N, runs
332
- kit gates run secrets-scan --project-root . --yes # non-interactive (CI)
333
- kit gates run confidence --no-interactive # manual gates verdict=manual when not interactive
334
- ```
335
-
336
- **Verdicts:** `passed` (exit 0), `block` (exit≠0 + blocking), `warn` (exit≠0 + non-blocking), `manual` (no shell), `skipped` (declined).
337
-
338
- Author runnable gates with a `bash` code-fence under `## Check`:
339
-
340
- ````markdown
341
- ---
342
- id: my-gate
343
- stage: pre-verify
344
- blocking: true
345
- description: ...
346
- ---
347
- ## Check
348
- ```bash
349
- test -f package.json && npm test
350
- ```
351
- ````
352
-
353
- ### `kit forensics ...` failure dataset, replays & LLM-driven prompt evolution
354
-
355
- ```bash
356
- # Aggregate failures across debug/, verifications, forensics
357
- kit forensics collect --project-root .
358
- kit forensics summarize --project-root .
359
- kit forensics write-learnings --project-root .
360
-
361
- # LLM pass: read learnings + current agent, propose minimal prompt edits
362
- kit forensics reflect --agent <name> --project-root . --dry-run
363
- kit forensics reflect --agent <name> --project-root .
364
- kit forensics reflect --agent <name> --project-root . --apply
365
-
366
- # Replays
367
- kit forensics list-replays --project-root .
368
- kit forensics load-replay <id> --project-root .
369
- ```
370
-
371
- `reflect` requires `ANTHROPIC_API_KEY` (override model with `KIT_REFLECT_MODEL`, max tokens with `KIT_REFLECT_MAX_TOKENS`). Without the key, `--dry-run` saves the assembled prompt for manual paste.
372
-
373
- The proposal is always saved to `.planning/learnings/{agent}.proposal.md` first; the canonical is only modified after explicit confirmation (or `--apply`). MCP `forensics.reflect` never auto-applies.
374
-
375
- ### `kit ui ...` — live process viewer (sidecar) — _new in 1.2_
376
-
377
- A tiny localhost web app that streams what kit-mcp is doing while your IDE drives it. Strictly opt-in: ignore it and v1.1 behavior is unchanged.
378
-
379
- ```bash
380
- # In one terminal keeps running until Ctrl+C
381
- kit ui start
382
-
383
- # In another terminal (or via Claude Code / Cursor) — runs as before, but events
384
- # are now also broadcast to the sidecar window
385
- kit sync install claude-code
386
-
387
- # Tools too: pass autoSpawn:true on the MCP side, or just `kit ui start` first
388
- kit ui status
389
- kit ui stop
390
- ```
391
-
392
- What you get:
393
-
394
- - A single browser tab at `http://127.0.0.1:7100` (or the next free port up to 7199)
395
- - Live event stream over Server-Sent Events — `tool_invocation`, `progress`, `error`, `milestone`, `run.start`, `run.end`
396
- - Filters by event type and substring; pause/resume; auto-scroll; dark mode tracks the OS
397
- - The sidecar shuts itself down after 30 minutes of idle; `--idle-ms 0` disables that
398
-
399
- **Auto-spawn from MCP tools.** Pass `autoSpawn: true` in the inputSchema of `sync` (action=install), `reverse-sync` (action=apply), or `gates` (action=run). The MCP server will spawn `bin/ui.js` detached, wait for it to come online, open your default browser, and stream that tool's progress. Trivial tools (`kit list-*`, `forensics`, `install`) deliberately don't accept `autoSpawn` — the overhead isn't worth it.
400
-
401
- **Opt-out always available.** From the CLI: pass `--no-ui` or set `KIT_MCP_NO_UI=1`. The sidecar is never started behind your back; it's only used when a lockfile is already present (someone ran `kit ui start` or `autoSpawn: true`).
402
-
403
- **Security model.** Sidecar binds to `127.0.0.1` literally never `0.0.0.0`, never `localhost` (which resolves to `::1` on Windows). Every route validates the `Host` header to mitigate DNS rebinding. CSP is strict (`default-src 'self'; …; frame-ancestors 'none'`). Paths in payloads are scrubbed (`$HOME → ~`, `<projectRoot> → <project>`) so screenshots don't leak directory structure. No persistence, no TLS, no auth — single-user dev workstation only. Full threat model in [`docs/sidecar-security.md`](docs/sidecar-security.md).
404
-
405
- **First-run quirks.** Windows Defender / macOS firewall may prompt the first time `kit ui start` binds. Approving "Private networks" is enough — the server doesn't accept anything from outside loopback regardless. On WSL, `kit ui start` opens the URL in the Windows host browser via `wslview`. In CI / SSH / `TERM=dumb`, browser launch is suppressed and the URL is printed to stderr instead.
406
-
407
- ---
408
-
409
- ## MCP usage
410
-
411
- Once registered (`kit install write <ide> --via npx`), the IDE's agent gets 6 MCP tools, all using **action-based dispatch** — one tool, many actions, low context cost.
412
-
413
- | Tool | Actions |
414
- |---|---|
415
- | `kit` | `list-agents`, `list-commands`, `list-skills`, `get`, `search` |
416
- | `sync` | `targets`, `status`, `install`, `remove` |
417
- | `reverse-sync` | `detect`, `apply` |
418
- | `gates` | `list`, `get`, `for-stage` |
419
- | `forensics` | `collect`, `summarize`, `write-learnings`, `reflect`, `list-replays`, `record-replay`, `load-replay`, `annotate-replay` |
420
- | `install` | `targets`, `install`, `dry-run` |
421
-
422
- ### Example calls (from inside an MCP client)
423
-
424
- ```jsonc
425
- { "tool": "kit", "arguments": { "action": "list-agents" } }
426
- { "tool": "sync", "arguments": { "action": "install", "target": "claude-code", "projectRoot": "/abs" } }
427
- { "tool": "gates", "arguments": { "action": "for-stage", "stage": "pre-verify" } }
428
- { "tool": "forensics", "arguments": { "action": "write-learnings", "projectRoot": "/abs" } }
429
- { "tool": "reverse-sync", "arguments": { "action": "detect", "target": "claude-code", "projectRoot": "/abs" } }
430
- ```
431
-
432
- ---
433
-
434
- ## Harness usage (programmatic)
435
-
436
- The `core/` modules are pure functions, no transport coupling:
437
-
438
- ```javascript
439
- import { listKit, searchKit } from '@luanpdd/kit-mcp/src/core/kit.js';
440
- import { syncTo, statusOf } from '@luanpdd/kit-mcp/src/core/sync.js';
441
- import { listGates, gatesForStage } from '@luanpdd/kit-mcp/src/core/gates.js';
442
- import { runGate } from '@luanpdd/kit-mcp/src/core/gate-runner.js';
443
- import { detectReverse, applyReverse } from '@luanpdd/kit-mcp/src/core/reverse-sync.js';
444
- import { watchKit } from '@luanpdd/kit-mcp/src/core/watch.js';
445
- import { collectFailures, writeLearnings } from '@luanpdd/kit-mcp/src/core/failures.js';
446
- import { reflect } from '@luanpdd/kit-mcp/src/core/reflect.js';
447
-
448
- // Browse the kit
449
- const kit = await listKit('/path/to/kit');
450
- console.log(kit.agents.length, 'agents');
451
-
452
- // Sync to multiple IDEs in parallel
453
- await Promise.all([
454
- syncTo('claude-code', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
455
- syncTo('cursor', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
456
- syncTo('codex', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
457
- ]);
458
-
459
- // Watch and resync
460
- const w = await watchKit(['claude-code'], { projectRoot: '/proj/foo' });
461
- // ... later: await w.stop();
462
- ```
463
-
464
- This is what dotcontext calls "the harness" — a runtime layer used both by CLI and MCP.
465
-
466
- ---
467
-
468
- ## Adding things
469
-
470
- ### Add a new agent / command / skill
471
-
472
- Drop a file (or folder, for skills) into your `kit/`:
473
-
474
- ```bash
475
- # kit/agents/refactor-suggester.md
476
- cat > kit/agents/refactor-suggester.md <<'EOF'
477
- ---
478
- name: refactor-suggester
479
- description: Scans a directory and suggests safe refactors with diff previews.
480
- tools: Read, Glob, Grep
481
- ---
482
- You are a refactoring assistant ...
483
- EOF
484
-
485
- # Re-sync (or use `kit sync watch` for automatic)
486
- kit sync install claude-code --project-root /your/project
487
- ```
488
-
489
- ### Add a new gate
490
-
491
- ```bash
492
- cat > gates/bundle-size.md <<'EOF'
493
- ---
494
- id: bundle-size
495
- stage: post-verify
496
- blocking: false
497
- description: Warn if the production bundle grew more than 10% versus the previous phase.
498
- ---
499
- ## Check
500
- ```bash
501
- # your script here; cwd will be --project-root
502
- EOF
503
- ```
504
-
505
- The gate appears in `kit gates list` immediately and is runnable with `kit gates run bundle-size`.
506
-
507
- ### Add a new IDE target
508
-
509
- Open [`src/core/registry.js`](src/core/registry.js) and add an entry to `TARGETS`:
510
-
511
- ```javascript
512
- 'my-new-ide': {
513
- label: 'My New IDE',
514
- rules: { path: 'MY_RULES.md', mode: 'single' },
515
- agents: { path: '.myide/agents/', mode: 'multi', extension: '.md' },
516
- commands: null,
517
- skills: { path: '.myide/skills/', mode: 'multi-dir' },
518
- mcpConfig:{ path: '.myide/mcp.json', strategy: 'merge-mcpServers-json',
519
- userPath: '~/.myide/mcp.json', userKey: 'mcpServers' },
520
- },
521
- ```
522
-
523
- That's the entire change. `kit sync install my-new-ide` and `kit install write my-new-ide` work immediately.
524
-
525
- ---
526
-
527
- ## How the sync stays in sync
528
-
529
- When you run `sync install <ide> --mode reference`, kit-mcp writes stubs like:
530
-
531
- ```markdown
532
- ---
533
- name: example-reviewer
534
- description: ...
535
- ---
536
-
537
- <!-- kit-mcp:reference -->
538
- # example-reviewer
539
-
540
- > Canonical source: [`../../kit/agents/example-reviewer.md`](../../kit/agents/example-reviewer.md)
541
- > Edit the source file in the kit, not this stub.
542
- ```
543
-
544
- The IDE reads the **frontmatter** (preserved verbatim) for the metadata it needs, and the body points back at the canonical file. Edit `kit/agents/example-reviewer.md` once; running `sync install` again refreshes timestamps but the link is unchanged.
545
-
546
- The `STUB_MARKER` (`<!-- kit-mcp:reference -->`) lets `sync remove` clean up only files we wrote, never touching anything you authored manually. It also lets `reverse-sync detect` recognize stubs vs user-edited content.
547
-
548
- ---
549
-
550
- ## Releasing (maintainers)
551
-
552
- The repo auto-publishes to npm via GitHub Actions whenever a version tag (`v*`) is pushed.
553
-
554
- ### One-time setup
555
-
556
- 1. **Create the GitHub repo** (if not already):
557
- ```bash
558
- gh repo create luanpdd/kit-mcp --public --source . --push
559
- ```
560
-
561
- 2. **Generate an npm token** at https://www.npmjs.com/settings/luanpdd/tokens
562
- - Type: **Granular Access Token**
563
- - Permissions: **Read and write** for `@luanpdd/*` scope
564
- - **Allow this token to bypass 2FA**: ✅ enabled (required for CI)
565
-
566
- 3. **Add the token as a GitHub secret**:
567
- ```bash
568
- gh secret set NPM_TOKEN
569
- # paste the npm_xxxxx token when prompted
570
- ```
571
-
572
- ### Release flow
573
-
574
- ```bash
575
- npm version patch # or minor / major bumps + commits + tags
576
- git push --follow-tags
577
- # GitHub Action runs CLI smoke tests, then `npm publish --provenance`
578
- ```
579
-
580
- The publish workflow refuses to ship if `package.json` version doesn't match the tag.
581
-
582
- The CI workflow runs CLI smoke tests on **Ubuntu / macOS / Windows × Node 20 / 22** on every PR and push to `main`.
583
-
584
- ---
585
-
586
- ## Design notes — what we adapted from dotcontext, what we didn't
587
-
588
- **Adapted (load-bearing simplifications):**
589
-
590
- 1. **Single registry table** — `src/core/registry.js`. Adding an IDE = one entry, not a new adapter file. Capability differences handled by `null`, not `if/else`.
591
- 2. **Markdown references over copies** edit the canonical, all targets see it.
592
- 3. **Action-based MCP dispatching** — 6 tools instead of 30+. Small surface, easy to remember.
593
- 4. **CLI ↔ harness ↔ MCP** — `core/` is pure, CLI and MCP are thin transports.
594
-
595
- **Adapted but reshaped:**
596
-
597
- 5. **Failure dataset** `forensics collect/summarize/write-learnings` aggregates `debug/resolved/`, failed `*-VERIFICATION.md`, `forensics/*` into per-agent learning docs.
598
- 6. **Reflect (LLM pass)** `forensics reflect` feeds learnings + current agent into an LLM and proposes minimal prompt edits.
599
- 7. **Replays** `forensics record-replay / load-replay` for tight prompt iteration.
600
- 8. **Gates as named files** — extracted into `gates/*.md` with explicit verdict format. Runnable with `gates run`.
601
-
602
- **Not adapted (over-engineered for a personal kit):**
603
-
604
- - PREVC state machine, role assignments, sensors/contracts/policies/datasets too much for personal use.
605
- - Built-in agents/skills hardcoded — yours come from your `kit/`.
606
-
607
- ---
608
-
609
- ## Roadmap (open ideas)
610
-
611
- - HTTP transport for IDEs that don't speak stdio MCP.
612
- - `forensics reflect` with diff visual instead of full content.
613
- - `kit gates run --all` aggregating verdicts of every gate at a stage.
614
- - Dependabot config to keep `chokidar` and `@modelcontextprotocol/sdk` current.
615
- - `kit sync watch` exposed via MCP (long-running tool challenge).
616
-
617
- PRs welcome.
618
-
619
- ---
620
-
621
- ## Tests
622
-
623
- Built on `node:test` (zero dependencies). Two suites:
624
-
625
- ```bash
626
- npm test # unit — kit parser, sync (all modes), reverse-sync, gates, registry
627
- npm run test:integration # integration spawns bin/cli.js end-to-end on a temp project
628
- npm run test:all # both
629
- ```
630
-
631
- Plus the original quick smokes:
632
-
633
- ```bash
634
- node bin/cli.js kit list-agents | head -5 # 47 bundled agents
635
- node bin/cli.js sync targets # 8 IDEs
636
- node bin/cli.js gates list # 20 gates
637
- node bin/cli.js install dry-run claude-code --via npx
638
- ```
639
-
640
- CI runs unit + integration + smoke + MCP boot on Ubuntu / macOS / Windows × Node 20 / 22 on every push and PR.
641
-
642
- ---
643
-
644
- ## License
645
-
646
- MITsee [LICENSE](LICENSE).
647
-
648
- Copyright © 2026 luanpdd.
1
+ # kit-mcp
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@luanpdd/kit-mcp.svg)](https://www.npmjs.com/package/@luanpdd/kit-mcp)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@luanpdd/kit-mcp.svg)](https://www.npmjs.com/package/@luanpdd/kit-mcp)
5
+ [![CI](https://github.com/luanpdd/kit-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/luanpdd/kit-mcp/actions/workflows/ci.yml)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ An opinionated **brownfield planning workflow** (in PT-BR) — agents, slash-commands, framework — shipped as an **MCP server**, with one-shot **sync** that projects the kit into every supported IDE's native layout — Claude Code, Cursor, Codex, Gemini CLI, Windsurf, Antigravity, Copilot, Trae.
9
+
10
+ > **One canonical source. N IDEs. Edit once, everywhere updated.**
11
+ >
12
+ > Install and inherit the bundled workflow, or point `--kit-root` at your own folder to replace it entirely.
13
+
14
+ ---
15
+
16
+ ## Why this exists
17
+
18
+ `.claude/agents/`, `.claude/commands/`, `.claude/skills/` are powerful but locked to Claude Code. The same definitions also need to live as `AGENTS.md` for Codex, `GEMINI.md` for Gemini, `.cursor/rules/` for Cursor, etc. Maintaining all of those by hand drifts immediately.
19
+
20
+ **kit-mcp** keeps your canonical source in one place and projects it into every supported IDE through a single registry. It also exposes the kit through an MCP server so any agent that speaks MCP can browse, search, sync, run gates, and record replays.
21
+
22
+ Inspired by [vinilana/dotcontext](https://github.com/vinilana/dotcontext) — see the design notes at the bottom for what's adapted, what's not, and why.
23
+
24
+ ---
25
+
26
+ <!-- AUTOGEN-COUNTS-START -->
27
+ **Bundled workflow:** 64 agents · 89 commands · 71 skills · 23 gates
28
+ <!-- AUTOGEN-COUNTS-END -->
29
+
30
+ ## What ships in the box
31
+
32
+ ```
33
+ kit-mcp/
34
+ ├── kit/ ← bundled brownfield workflow (PT-BR)
35
+ │ ├── agents/ 47 agents (planner, executor, verifier, debugger,
36
+ │ │ ui-auditor, codebase-mapper, …)
37
+ │ ├── commands/ 87 slash-commands (/novo-marco, /planejar-fase,
38
+ │ │ /executar-fase, /publicar, …)
39
+ │ ├── framework/ workflows + templates + bin libs the agents use
40
+ │ ├── hooks/ workflow guards, prompt guards, statusline
41
+ │ ├── skills/example-skill/ single example skill (replace with your own)
42
+ │ └── README.md file-format guide
43
+
44
+ ├── gates/ ← reusable workflow gates (regression, confidence, dep-check, …)
45
+
46
+ ├── src/
47
+ │ ├── core/ pure runtime — registry, kit, sync, reverse-sync, gates,
48
+ │ │ gate-runner, watch, failures, replays, reflect
49
+ │ ├── mcp-server/ MCP server entry + install command
50
+ │ └── cli/ CLI mirror of the MCP tools
51
+
52
+ ├── bin/
53
+ │ ├── mcp.js shim → starts the MCP stdio server
54
+ │ └── cli.js shim → runs the CLI
55
+
56
+ ├── LICENSE MIT
57
+ ├── CHANGELOG.md
58
+ ├── package.json
59
+ └── README.md ← you are here
60
+ ```
61
+
62
+ **Lines of source code:** ~1300. **Runtime dependencies:** 5 (`@modelcontextprotocol/sdk`, `commander`, `chokidar`, `picocolors`, `@inquirer/prompts`). **Build step:** none — plain ESM Node.js 20+.
63
+
64
+ ### About the bundled workflow
65
+
66
+ The bundled `kit/` is an opinionated **brownfield planning workflow** in Portuguese — milestones, phases, requirements, planning, execution with atomic commits and checkpoints, retrospective auditing. Installing `@luanpdd/kit-mcp` and syncing into your IDE gives you all 87+ slash-commands, 47+ agents, plus the framework templates that they delegate into.
67
+
68
+ If that's not what you want, point `--kit-root` at your own folder and ignore everything under `kit/` — the infrastructure (registry, sync, gates, forensics, MCP server) works the same regardless of what kit you load.
69
+
70
+ ### Observability suite (v1.9)
71
+
72
+ A complete observability layer derived from *Observability Engineering* (Charity Majors, Liz Fong-Jones, George Miranda — O'Reilly, 2022) ships in the kit. It integrates deeply with the Supabase suite (v1.8) — every Supabase agent now consults observability skills, and the new `incident-investigator` agent uses `mcp__supabase__get_logs` / `execute_sql` / `get_advisors` to apply the **Core Analysis Loop** on real incidents.
73
+
74
+ **11 skills** in `kit/skills/`:
75
+ - `_shared-observability/glossary.md` — canonical bilingual vocabulary (PT-BR↔EN)
76
+ - `structured-events`, `distributed-tracing`, `opentelemetry-standard`, `core-analysis-loop` — foundationals
77
+ - `observability-driven-development` — the 4 pre-PR questions ("Does it do what I expected? Compare to previous version? Are users using? Anomalies emerge?")
78
+ - `event-based-slos`, `burn-rate-alerting` — SLO definition + predictive burn alerts
79
+ - `telemetry-sampling`, `telemetry-pipelines`, `observability-maturity-model` — scale + culture
80
+
81
+ **5 agents** in `kit/agents/`:
82
+ - `observability-instrumenter` — generates OTel + canonical attribute patches
83
+ - `incident-investigator` — Core Analysis Loop with persistent state in `.planning/investigations/`
84
+ - `slo-engineer` — generates `SLO.md` + SQL migrations to materialize SLI events
85
+ - `burn-rate-forecaster` — calculates burn rate, ETA exhaustion, alert config
86
+ - `omm-auditor` — scores 5 OMM capabilities (resilience, code quality, complexity, release cadence, user behavior)
87
+
88
+ **6 commands**:
89
+ - `/observabilidade <subcommand>` — single orchestrator (analog to `/supabase`) — dispatches to the 5 agents above with PT/EN synonyms
90
+ - `/instrumentar-fase` — generates `INSTRUMENTATION.md` per plan after `/planejar-fase`
91
+ - `/investigar-producao` — guided Core Analysis Loop with persistent state
92
+ - `/definir-slo` — creates SLO definition + SQL materialized view
93
+ - `/burn-rate-status` — table `[SLO | budget burned | ETA | action]`, also runnable in `/loop`
94
+ - `/auditar-observabilidade` — generates OMM-REPORT.md scored
95
+
96
+ **Quick start example:**
97
+ ```bash
98
+ # Define an SLO for a critical journey
99
+ /observabilidade slo "checkout"
100
+
101
+ # Investigate a production incident with Core Analysis Loop
102
+ /observabilidade investigar "checkout SLO burn rate = 8 às 14:32"
103
+
104
+ # Score project against Observability Maturity Model
105
+ /observabilidade omm
106
+ ```
107
+
108
+ ### SRE Engagement suite (v1.10)
109
+
110
+ A production engineering layer derived from *Site Reliability Engineering: How Google Runs Production Systems* (Beyer, Jones, Petoff, Murphy — Google/O'Reilly, 2016) ships in the kit. It composes with the Supabase suite (v1.8) and the Observability suite (v1.9) into a coherent production engineering stack — Supabase agents now suggest PRR before launch, every Edge Function template includes the **4 golden signals**, and `incident-investigator` outputs feed directly into blameless postmortems via `/postmortem --from-investigation <id>`.
111
+
112
+ **6 skills** in `kit/skills/`:
113
+ - `_shared-sre/glossary.md` — canonical bilingual vocabulary (PT-BR↔EN) — SLI/SLO/SLA, error budget, burn rate, toil, postmortem, blameless, PRR, golden signals, risk continuum, MTTR/MTBF
114
+ - `sre-risk-management` — risk continuum (cap 3), 99.99% wisdom ("as reliable as needs to be, no more"), error budget as explicit risk × innovation balance
115
+ - `four-golden-signals` — Latency + Traffic + Errors + Saturation (cap 6), histograms with exponential bucketing, success vs error latency separated, percentiles vs mean (long tail)
116
+ - `eliminating-toil` — canonical toil definition (manual + repetitive + automatable + tactical + no enduring value + scales linearly), ≤ 50% rule (cap 5), automation patterns
117
+ - `blameless-postmortems` — canonical 9-section template (cap 15), "no postmortem left unreviewed", blame culture as anti-pattern, Wheel of Misfortune
118
+ - `production-readiness-review` — PRR checklist (cap 32) — 6 axes (System architecture, Instrumentation, Emergency response, Capacity planning, Change management, Performance), 3 engagement models
119
+
120
+ **4 agents** in `kit/agents/`:
121
+ - `golden-signals-instrumenter` — specialization of `observability-instrumenter` (v1.9); generates OTel patches with the 4 golden signals (Latency=histogram, Traffic=counter, Errors=counter by `error.type`, Saturation=gauge)
122
+ - `toil-auditor` — analyzes git log + shell scripts + manual commands in README/runbooks; produces `TOIL-AUDIT.md` with P0/P1/P2 priority + estimated effort
123
+ - `postmortem-writer` — natural continuation of `incident-investigator` (v1.9); reads `.planning/investigations/<id>.md` and produces blameless postmortem (Summary, Impact, Root Causes, Trigger, Resolution, Detection, Action Items, Lessons Learned, Timeline UTC)
124
+ - `prr-conductor` — conducts Production Readiness Review for service/feature; reads schema (Supabase MCP), Edge Functions, `.planning/slos/`, audit logs; produces `PRR-REPORT.md` scored across the 6 axes
125
+
126
+ **6 commands**:
127
+ - `/sre <subcommand>` — single orchestrator (analog to `/supabase` v1.8 and `/observabilidade` v1.9) — dispatches to the 4 agents with PT/EN synonyms
128
+ - `/golden-signals` — invokes `golden-signals-instrumenter` for service/Edge Function/phase; generates `GOLDEN-SIGNALS.md` with OTel-ready instrumentation
129
+ - `/auditar-toil` — invokes `toil-auditor`; generates `.planning/TOIL-AUDIT.md`
130
+ - `/postmortem` — invokes `postmortem-writer`; supports `--from-investigation <id>` (continue from v1.9 investigation) or `--incident "<description>"` (standalone)
131
+ - `/prr` — invokes `prr-conductor`; supports `--service <name>` or `--feature <description>`; generates `PRR-REPORT.md`
132
+ - `/risk-budget` — displays current error budget vs risk continuum, citing SLOs from v1.9 (`.planning/slos/`); applies `sre-risk-management` skill
133
+
134
+ **3 audit gates** in `gates/`:
135
+ - `golden-signals-coverage` (blocking, pre-verify) — verifies code in `supabase/functions/**`, `src/**`, `lib/**` covers the 4 golden signals (skips gracefully on content-only phases)
136
+ - `postmortem-template-required` (blocking, pre-conclude) — blocks `/concluir-marco` if any `.planning/investigations/<id>.md` lacks a corresponding `.planning/postmortems/<id>.md` (`Status: INCONCLUSIVE` is the only exception)
137
+ - `prr-checklist-coverage` (blocking, pre-verify) — verifies every `PRR-REPORT.md` in `.planning/prr/**/*.md` covers the 6 canonical axes; "skipping an axe = invalid approval"
138
+
139
+ **Lifecycle integration:**
140
+ - `/forense` — after Core Analysis Loop closes with VALIDATED root cause, suggests chain `/postmortem --from-investigation <id>` (Phase 40 / INT-FW-V2-01)
141
+ - `/concluir-marco` — opt-in gate `workflow.complete_milestone_prr_gate=true` requires `PRR-REPORT.md` with status `passed` for production-bound features before archive (Phase 40 / INT-FW-V2-02)
142
+ - `/auditar-marco` — auto-invokes `/auditar-toil` when `workflow.audit_milestone_toil=true` (default); result feeds OMM Capacidade 3 scoring via `omm-auditor` (Phase 40 / INT-FW-V2-03)
143
+
144
+ **Quick start example — end-to-end SRE workflow:**
145
+ ```bash
146
+ # Before launching a new feature in production — PRR
147
+ /sre prr --feature "checkout v2"
148
+
149
+ # While instrumenting service — apply 4 golden signals
150
+ /sre golden-signals supabase/functions/orders/index.ts
151
+
152
+ # Audit team toil quarterly
153
+ /sre toil
154
+
155
+ # When SLO burn alert fires — investigate (v1.9 deep loop), then postmortem (v1.10)
156
+ /investigar-producao "checkout SLO burn rate = 8 às 14:32"
157
+ /sre postmortem --from-investigation checkout-2026-05-07
158
+ # Or for framework-level failures:
159
+ /forense "framework workflow X falhou em produção"
160
+ /sre postmortem --incident "framework workflow X failed (see .planning/forensics/report-*)"
161
+
162
+ # Risk dashboard against SLO budgets
163
+ /sre risk-budget
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Slash Commands Reference (89 commands)
169
+
170
+ Comandos do kit são organizados em **workflow lifecycle** (brownfield planning canônico) + **8 suítes especializadas** (Supabase, Observability, SRE, Legacy, Multi-Tenant, DDIA, etc.) + **quick actions** + **utilities**.
171
+
172
+ ### Workflow Lifecycle (brownfield planning)
173
+
174
+ O fluxo canônico de um projeto: bootstrap → milestone → phase → execute → audit → publish.
175
+
176
+ | Comando | Objetivo |
177
+ |---------|----------|
178
+ | `/novo-projeto` | Inicializa novo projeto com coleta profunda de contexto e PROJECT.md |
179
+ | `/novo-marco` | Inicia novo ciclo de milestone — atualiza PROJECT.md, encaminha para requisitos |
180
+ | `/novo-workspace` | Cria workspace isolado com cópias de repos e .planning/ independente |
181
+ | `/discutir-fase N` | Reúne contexto da fase por questionamento adaptativo antes do planejamento |
182
+ | `/listar-hipoteses-fase N` | Mostra hipóteses do Claude sobre abordagem antes do planejamento |
183
+ | `/planejar-fase N` | Cria plano detalhado da fase (PLAN.md) com loop de verificação |
184
+ | `/pesquisar-fase N` | Pesquisa como implementar uma fase (standalone — geralmente use planejar) |
185
+ | `/executar-fase N` | Executa todos os planos de uma fase com paralelização por ondas |
186
+ | `/autonomo` | Executa todas as fases restantes autônomamente — discuss→plan→execute por fase |
187
+ | `/auditar-marco` | Audita conclusão do milestone contra intenção original antes de arquivar |
188
+ | `/concluir-marco` | Arquiva milestone concluído, cria tag git, prepara para próxima versão |
189
+ | `/publicar` | Publica milestone — cria doc no Notion, abre PR no GitHub com link |
190
+ | `/publicar-rapido` | Variante leve do publicar para hotfix/quick-task sem ROADMAP dependency |
191
+ | `/branch-pr` | Cria branch limpo para PR filtrando commits de .planning/ |
192
+
193
+ ### Phase Lifecycle (gerenciar fases)
194
+
195
+ | Comando | Objetivo |
196
+ |---------|----------|
197
+ | `/adicionar-fase` | Adiciona fase ao final do milestone atual no roadmap |
198
+ | `/inserir-fase` | Insere trabalho urgente como fase decimal (ex: 72.1) entre fases existentes |
199
+ | `/remover-fase N` | Remove fase futura do roadmap e renumera subsequentes |
200
+ | `/planejar-lacunas` | Cria fases para fechar lacunas identificadas pela auditoria de milestone |
201
+ | `/validar-fase N` | Audita retroativamente e preenche lacunas de validação para fase concluída |
202
+ | `/adicionar-testes N` | Gera testes para fase concluída com base em UAT + implementação |
203
+ | `/auditar-uat` | Auditoria multi-fase de todos itens de UAT e verificação pendentes |
204
+ | `/verificar-trabalho` | Valida funcionalidades construídas através de UAT conversacional |
205
+ | `/pausar-trabalho` | Cria handoff de contexto ao pausar trabalho no meio de uma fase |
206
+ | `/retomar-trabalho` | Retoma trabalho da sessão anterior com restauração completa de contexto |
207
+
208
+ ### Suite `/supabase` (v1.8 + v1.23-v1.26 — 4 camadas de segurança canônicas)
209
+
210
+ Orquestrador `/supabase <subcomando>` com 14 subcomandos (sinônimos PT/EN). Toda a trilha de segurança Supabase canônica está implementada.
211
+
212
+ | Subcomando | Objetivo | Cross-ref |
213
+ |------------|----------|-----------|
214
+ | `/supabase arquiteto` | Projeta schema + RLS + topologia realtime ANTES da implementação | v1.8 |
215
+ | `/supabase migration` | Escreve migration SQL com 5 blocos obrigatórios + auto-chain hardener | v1.23 |
216
+ | `/supabase rls` | Gera RLS policies granulares com GRANT + IS NOT NULL + views security_invoker | v1.23 |
217
+ | `/supabase hardener` | Canonical materializer RLS — recebe draft via Task, verdicts GO/STRENGTHEN/REWRITE | v1.23 |
218
+ | `/supabase column` | Column-Level privileges (REVOKE table-level + GRANT (col)) PII/audit/billing | v1.24 |
219
+ | `/supabase rbac` | Custom Claims via Auth Hook (enum + user_roles + auth hook + authorize() function) | v1.25 |
220
+ | `/supabase role` | Postgres Roles (CREATE ROLE + INHERIT/NOINHERIT + GRANT/REVOKE) — system access | v1.26 |
221
+ | `/supabase edge` | Escreve Deno Edge Functions com imports npm:/jsr: + env vars + EdgeRuntime | |
222
+ | `/supabase realtime` | Configura canais Realtime broadcast com private:true + RLS sobre realtime.messages | |
223
+ | `/supabase auth` | Bootstrap Next.js v16 + Supabase Auth com @supabase/ssr + jwt-decode listener | |
224
+ | `/supabase storage` | Configura buckets (públicos vs privados) + signed URLs + RLS sobre storage.objects | |
225
+ | `/supabase rag` | Edge Function com embeddings + pgvector (HNSW/IVFFlat + RLS with permissions) | |
226
+ | `/supabase cron` | Pattern `pg_cron + pgmq + pg_net` (cron → pgmq → Edge Function) | |
227
+ | `/supabase check` | Valida SQL antes de apply (schema-checker — FKs/colunas/tabelas referenciadas) | |
228
+
229
+ ### Suite `/observabilidade` (v1.9)
230
+
231
+ | Comando | Objetivo |
232
+ |---------|----------|
233
+ | `/observabilidade <sub>` | Orquestrador — dispatcha para instrumenter, investigator, slo-engineer, burn-rate-forecaster, omm-auditor |
234
+ | `/instrumentar-fase N` | Após `/planejar-fase`, gera INSTRUMENTATION.md por plano (spans + atributos canônicos) |
235
+ | `/investigar-producao` | Core Analysis Loop guiado em incidente real — estado persistente em `.planning/investigations/` |
236
+ | `/definir-slo` | Gera SLO.md + SQL para materializar SLI events em view/MV no Postgres |
237
+ | `/burn-rate-status` | Tabela dual-window por SLO (fast 1h + slow 6h) — page/ticket/warn alerts |
238
+ | `/auditar-observabilidade` | OMM-REPORT.md scored em 5 capacidades (resiliência/qualidade/complexidade/cadência/comportamento) |
239
+ | `/auditar-observabilidade-cobertura` | X/N Edge Functions com 4 golden signals + Y/N com SLO + Z/N com burn alert |
240
+
241
+ ### Suite `/sre` (v1.10 + v1.11)
242
+
243
+ | Comando | Objetivo |
244
+ |---------|----------|
245
+ | `/sre <sub>` | Orquestrador — dispatcha para golden-signals-instrumenter, toil-auditor, postmortem-writer, prr-conductor, etc. |
246
+ | `/golden-signals` | Instrumenta serviço/Edge Function com 4 golden signals OTel (Latency/Traffic/Errors/Saturation) |
247
+ | `/auditar-toil` | Identifica toil no projeto (6 critérios canônicos) + sugere automação via pg_cron |
248
+ | `/auditar-cascading` | Audita código para 5 triggers de cascading failure (sem timeout, retry sem jitter, etc.) |
249
+ | `/auditar-release` | Audita CI/CD para hermeticidade + reprodutibilidade + policy enforcement |
250
+ | `/load-shedding` | Aplica patches de load shedding em Edge Function/handler HTTP (drop policy, deadline-aware) |
251
+ | `/postmortem` | Postmortem blameless 9 seções (modo `--from-investigation` ou `--incident`) |
252
+ | `/prr` | Production Readiness Review scored em 6 axes (System/Instrumentation/Emergency/Capacity/Change/Performance) |
253
+ | `/risk-budget` | Error budget atual vs risk continuum (cap 3 SRE) posiciona no continuum 99% → 99.999% |
254
+
255
+ ### Suite `/legacy` (v1.12 — Working Effectively with Legacy Code, Feathers 2004)
256
+
257
+ | Comando | Objetivo |
258
+ |---------|----------|
259
+ | `/legacy <sub>` | Orquestrador dispatcha para legacy-characterizer, seam-finder, refactor-safety-auditor |
260
+ | `/caracterizar` | Gera characterization tests (cap 13 Feathers) — golden snapshots como oracle imutável |
261
+ | `/caracterizar-prompt` | Characterization de prompts/tools LLM em produção temperature=0 + seed fixo |
262
+ | `/encontrar-seams` | Analisa código para identificar seams (object/link/preprocessing) pré-requisito refactor |
263
+ | `/auditar-refactor` | Gate canônico ANTES de refactor veredito GO/BLOCK/WARN |
264
+ | `/refactor-seguro` | Chain canônico — encontrar-seams → caracterizar → auditar-refactor → executar |
265
+ | `/capturar-payloads` | Instrumenta Edge Function para captura via mcp__supabase__get_logs por N dias |
266
+ | `/detectar-duplicacao` | Shotgun surgery — duplicação sintática (jscpd/regex) + semântica (embeddings) |
267
+ | `/storytelling` | IA gera mental model de codebase desconhecido (story 5 frases + naked CRC) |
268
+
269
+ ### Suite `/multi-tenant` (v1.21) e `/dados-distribuidos` (v1.22)
270
+
271
+ | Comando | Objetivo |
272
+ |---------|----------|
273
+ | `/multi-tenant <sub>` | Orquestrador B2B SaaS — 10 agents implementers (architect, rls, onboarding, invite, super-admin, audit-log, whatsapp, crm, lgpd, isolation-audit) |
274
+ | `/dados-distribuidos <sub>` | Orquestrador DDIA Foundations auditor-consistencia-isolamento, detector-tenant-quente, validador-evolucao-schema |
275
+
276
+ ### UI Phase (frontend design contract)
277
+
278
+ | Comando | Objetivo |
279
+ |---------|----------|
280
+ | `/fase-ui N` | Gera contrato de design UI (UI-SPEC.md) para fases frontend |
281
+ | `/revisar-ui N` | Auditoria visual retroativa de 6 pilares do código frontend implementado |
282
+
283
+ ### Backlog & Ideas
284
+
285
+ | Comando | Objetivo |
286
+ |---------|----------|
287
+ | `/adicionar-backlog` | Adiciona ideia ao estacionamento de backlog (numeração 999.x) |
288
+ | `/revisar-backlog` | Revisa e promove itens do backlog para milestone ativo |
289
+ | `/plantar-ideia` | Captura ideia prospectiva com condições de gatilho — surge automaticamente no milestone certo |
290
+ | `/nota` | Captura de ideias sem fricção. Adicionar, listar ou promover notas para todos |
291
+ | `/adicionar-tarefa` | Captura ideia ou tarefa como todo a partir do contexto da conversa |
292
+ | `/verificar-tarefas` | Lista todos pendentes e seleciona um para trabalhar |
293
+
294
+ ### Quick Actions & Routing
295
+
296
+ | Comando | Objetivo |
297
+ |---------|----------|
298
+ | `/fazer "<task>"` | **Entrypoint canônico** — roteia texto livre para o comando correto. Use este na dúvida |
299
+ | `/proximo` | Avança automaticamente para o próximo passo lógico no workflow |
300
+ | `/progresso` | Verifica progresso do projeto, mostra contexto e roteia para próxima ação |
301
+ | `/expresso` | Tarefa rápida com garantias framework (commits atômicos + state tracking) sem agents opcionais |
302
+ | `/rapido` | Tarefa trivial inline — sem subagentes, sem overhead de planejamento |
303
+ | `/autonomo` | Executa fases restantes autônomamente discuss→plan→execute por fase |
304
+ | `/depurar` | Depuração sistemática com estado persistente entre resets de contexto |
305
+ | `/forense` | Investigação post-mortem de workflows com falha analisa git + artefatos + estado |
306
+
307
+ ### Workspace & Workflows (paralelos)
308
+
309
+ | Comando | Objetivo |
310
+ |---------|----------|
311
+ | `/fluxos-trabalho` | Gerencia fluxos paralelos listar, criar, alternar, status, progresso, concluir, retomar |
312
+ | `/listar-workspaces` | Lista workspaces framework ativos e seu status |
313
+ | `/remover-workspace` | Remove workspace framework e limpa worktrees |
314
+ | `/fio` | Gerencia threads de contexto persistentes para trabalho entre sessões |
315
+ | `/gerenciador` | Central de comando interativa para gerenciar múltiplas fases em um terminal |
316
+
317
+ ### Utilities
318
+
319
+ | Comando | Objetivo |
320
+ |---------|----------|
321
+ | `/ajuda` | Mostra comandos disponíveis e guia de uso |
322
+ | `/atualizar` | Atualiza framework para versão mais recente com changelog |
323
+ | `/configuracoes` | Configura toggles de workflow e perfil de modelo |
324
+ | `/definir-perfil` | Altera perfil de modelo para agents framework (quality/balanced/budget/inherit) |
325
+ | `/perfil-usuario` | Gera perfil comportamental do desenvolvedor (artefatos descobríveis pelo Claude) |
326
+ | `/mapear-codebase` | Analisa base de código com agents paralelos para produzir docs em .planning/codebase/ |
327
+ | `/relatorio-sessao` | Relatório da sessão com estimativas de tokens, resumo de trabalho e resultados |
328
+ | `/estatisticas` | Estatísticas do projeto fases, planos, requisitos, métricas git e timeline |
329
+ | `/saude` | Diagnostica integridade do diretório de planejamento e opcionalmente repara |
330
+ | `/sync-main` | Atualiza branch local com commits da main (pergunta qual priorizar em conflito) |
331
+ | `/limpeza` | Arquiva diretórios de fase acumulados de milestones concluídos |
332
+ | `/reaplicar-patches` | Reaplica modificações locais após atualização do framework |
333
+ | `/revisar` | Solicita revisão entre IAs de planos de fase a partir de CLIs externas |
334
+ | `/resumo-marco` | Resumo abrangente do projeto a partir dos artefatos do milestone |
335
+ | `/setup-notion` | Cria estrutura de páginas Notion para novo projeto + gera `.claude/notion-config.json` |
336
+ | `/entrar-discord` | Entrar na comunidade framework no Discord |
337
+
338
+ ---
339
+
340
+ ## Workflow exemplos
341
+
342
+ ### Exemplo 1: Ciclo completo de um milestone (brownfield)
343
+
344
+ ```bash
345
+ # 1. iniciar milestone
346
+ /novo-marco
347
+ # → coleta objetivos, opcionalmente pesquisa (4 agents paralelos), define REQUIREMENTS.md,
348
+ # invoca roadmapper para criar ROADMAP.md, commita
349
+
350
+ # 2. executar fase (manual passo-a-passo)
351
+ /discutir-fase 124 # gather context via questionamento adaptativo
352
+ /planejar-fase 124 # plan-checker → planner → PLAN.md
353
+ /executar-fase 124 # executor com atomic commits + verifier
354
+
355
+ # OU: executar todas as fases autônomamente
356
+ /autonomo # discuss plan execute por fase + commit atômico
357
+
358
+ # 3. auditar
359
+ /auditar-marco # verifica cobertura, integration entre phases, fluxos E2E
360
+
361
+ # 4. concluir e publicar
362
+ /concluir-marco # archive .planning/milestones/v{X.Y}-* + tag git
363
+ /publicar # Notion + PR GitHub com link Notion no body
364
+ ```
365
+
366
+ ### Exemplo 2: Trilha de segurança Supabase (v1.23-v1.26 cumulativos)
367
+
368
+ ```bash
369
+ # 1. arquitetura inicial — projeta schema + RLS + Postgres roles upfront
370
+ /supabase arquiteto "B2B SaaS com leads + audit log + invites + super-admin"
371
+
372
+ # 2. migration com 5 blocos obrigatórios (CREATE TABLE + GRANTs + RLS + 4 policies + INDEX)
373
+ /supabase migration "create_orgs_and_members"
374
+ # → auto-chain cooperativo com supabase-rls-hardener (Detector 1-10)
375
+
376
+ # 3. column-level para PII (v1.24)
377
+ /supabase column "audit_log payload protected security_admin"
378
+
379
+ # 4. RBAC via Custom Claims (v1.25)
380
+ /supabase rbac "roles admin/moderator/user + 8 permissions"
381
+ # cria enum types + user_roles + auth hook + authorize() + RLS policies
382
+
383
+ # 5. Custom Postgres role para service accounts (v1.26)
384
+ /supabase role "platform_admin para super-admin operations"
385
+ ```
386
+
387
+ ### Exemplo 3: Investigação de incidente (Observability + SRE)
388
+
389
+ ```bash
390
+ # 1. diagnóstico
391
+ /investigar-producao # Core Analysis Loop com estado persistente
392
+ # 4 fases: dados/hipótese/validação/root cause
393
+ # → arquiva em .planning/investigations/<id>.md
394
+
395
+ # 2. postmortem após fix
396
+ /postmortem --from-investigation <id>
397
+ # blameless 9 seções (cap 15 livro Google SRE)
398
+
399
+ # 3. ajustar SLO se necessário
400
+ /definir-slo # SLI event-based + SQL materialization
401
+ /burn-rate-status # tabela dual-window page/ticket/warn
402
+
403
+ # 4. PRR antes de scaled release
404
+ /prr --service "checkout" # scored em 6 axes
405
+ ```
406
+
407
+ ### Exemplo 4: Refactor seguro de código legado (v1.12)
408
+
409
+ ```bash
410
+ # Chain canônico — bloqueia se gates falhares
411
+ /refactor-seguro src/foo.ts
412
+ # 1. encontrar-seams — identifica object/link/preprocessing seams (cap 25 Feathers)
413
+ # 2. caracterizar gera characterization tests (cap 13) cobrindo 5+ grupos de equivalência
414
+ # 3. auditar-refactor — veredito GO/BLOCK/WARN baseado em coverage + mutation
415
+ # 4. executor com safety net
416
+ ```
417
+
418
+ ### Exemplo 5: Quick action via roteamento canônico
419
+
420
+ ```bash
421
+ # Texto livre — kit roteia para o comando certo
422
+ /fazer "preciso adicionar uma tabela leads com phone email e org_id"
423
+ # → roteia para /supabase migration (que auto-chain para hardener + RLS)
424
+
425
+ /fazer "quero entender por que esse codebase está confuso"
426
+ # roteia para /storytelling ou /mapear-codebase
427
+
428
+ /fazer "meu teste de produção flaky não sei por que"
429
+ # roteia para /depurar (cria sessão persistente)
430
+ ```
431
+
432
+ ---
433
+
434
+ ## Prerequisites
435
+
436
+ - **Node.js 20** (uses native ESM, no transpiler)
437
+ - An IDE / agent that speaks MCP if you want to use it that way (Claude Code, Cursor, Codex, Gemini CLI, …)
438
+ - Optional: a project where you'll sync the kit (any folder)
439
+
440
+ ---
441
+
442
+ ## Quick start
443
+
444
+ ### 1. Use the bundled workflow as-is (recommended)
445
+
446
+ ```bash
447
+ # Browse what's bundled
448
+ npx -y @luanpdd/kit-mcp kit list-agents # 47 agents
449
+ npx -y @luanpdd/kit-mcp kit list-commands # 87 commands
450
+ npx -y @luanpdd/kit-mcp sync targets # supported IDEs
451
+
452
+ # Install into your project for Claude Code
453
+ npx -y @luanpdd/kit-mcp sync install claude-code --project-root .
454
+ ```
455
+
456
+ After that, open the project in Claude Code and the slash-commands (`/novo-marco`, `/planejar-fase`, `/executar-fase`, `/publicar`, …) and agents are immediately available.
457
+
458
+ ### 2. Replace the bundled workflow with your own kit
459
+
460
+ Point kit-mcp at your own `kit/` folder via `--kit-root` or the `KIT_MCP_KIT_ROOT` env var:
461
+
462
+ ```bash
463
+ # Option A: per-command flag
464
+ npx -y @luanpdd/kit-mcp --kit-root ~/my-kit kit list-agents
465
+ npx -y @luanpdd/kit-mcp --kit-root ~/my-kit sync install claude-code --project-root .
466
+
467
+ # Option B: env var (sticky for the session)
468
+ export KIT_MCP_KIT_ROOT=~/my-kit
469
+ npx -y @luanpdd/kit-mcp sync install claude-code --project-root .
470
+ ```
471
+
472
+ Your `~/my-kit/` follows the same layout as the bundled kit:
473
+
474
+ ```
475
+ my-kit/
476
+ ├── agents/<name>.md YAML frontmatter + Markdown body
477
+ ├── commands/<name>.md YAML frontmatter + Markdown body
478
+ └── skills/<name>/SKILL.md YAML frontmatter + Markdown body
479
+ references/ optional reference docs
480
+ ```
481
+
482
+ See [`kit/README.md`](kit/README.md) for the file format.
483
+
484
+ ### 3. Register kit-mcp into an IDE (so agents inside the IDE can call the MCP tools)
485
+
486
+ ```bash
487
+ # Portable — works on any machine, no clone needed
488
+ npx -y @luanpdd/kit-mcp install write claude-code --scope user --via npx
489
+ ```
490
+
491
+ For other IDEs, swap `claude-code` for `cursor`, `codex`, `gemini-cli`, `windsurf`, `antigravity`, `copilot`, or `trae`. Run `kit sync targets` for the live capability matrix.
492
+
493
+ ---
494
+
495
+ ## CLI reference
496
+
497
+ The CLI mirrors the MCP tools 1:1. **By default the CLI prints colored, human-readable tables and summary panels.** Add `--json` to restore raw JSON-to-stdout (machine-readable, the default in v1.0). The global `--kit-root` flag overrides the kit source for any subcommand.
498
+
499
+ ```bash
500
+ kit list-agents # human: colored table, name + description
501
+ kit list-agents --json # machine: JSON array
502
+
503
+ kit sync install claude-code # human: progress bar + summary panel
504
+ kit sync install claude-code --json # machine: full result object
505
+ ```
506
+
507
+ In non-TTY mode (pipes, CI), animations degrade to linear status lines automatically. `NO_COLOR=1` disables colors entirely; `FORCE_COLOR=1` forces them on even in pipes.
508
+
509
+ ### `kit kit ...` browse the kit
510
+
511
+ ```bash
512
+ kit kit list-agents # 47 agents (bundled workflow)
513
+ kit kit list-commands # 87 commands (bundled workflow)
514
+ kit kit list-skills # 49 skills (bundled workflow)
515
+ kit kit get agent planner
516
+ kit kit search "milestone" # fuzzy match across all kinds
517
+ ```
518
+
519
+ ### `kit sync ...` — project into an IDE
520
+
521
+ ```bash
522
+ kit sync targets # list supported IDEs + capabilities
523
+ kit sync status claude-code # see which capability paths exist in cwd
524
+ kit sync install claude-code # write the kit into the cwd as Claude Code expects
525
+ kit sync install cursor --mode copy # copy mode (no link to canonical)
526
+ kit sync install codex --dry-run # preview without writing
527
+ kit sync remove claude-code # remove only files generated by kit-mcp (uses STUB_MARKER)
528
+ kit sync watch claude-code cursor # watch kit/ → resync to listed IDEs on every change
529
+ kit sync watch --all # watch + auto-detect every IDE already present in cwd
530
+ ```
531
+
532
+ **Modes:**
533
+ - `reference` (default) — writes a stub that links back to `kit/`. Edit canonical → all IDEs see the change.
534
+ - `copy` — duplicates content. Use when shipping a frozen snapshot of the kit.
535
+
536
+ **Per-IDE projection** — what each target receives:
537
+
538
+ | IDE | rules → | agents → | commands → | skills → | framework → | hooks → |
539
+ |---|---|---|---|---|---|---|
540
+ | Claude Code | `CLAUDE.md` | `.claude/agents/*.md` | `.claude/commands/*.md` | `.claude/skills/*/` | `.claude/framework/**` | `.claude/hooks/**` |
541
+ | Cursor | `.cursor/rules/*.mdc` | `.cursor/agents/*.md` | | | — | — |
542
+ | Codex | `AGENTS.md` | — | — | `.codex/skills/*/` | — | — |
543
+ | Gemini CLI | `GEMINI.md` | — | — | `.gemini/skills/*/` | — | — |
544
+ | Copilot | `.github/copilot-instructions.md` | `.github/agents/*.agent` | | `.github/skills/*/` | | |
545
+ | Windsurf | `.windsurf/rules/*.md` | `.windsurf/agents/*.md` | — | `.windsurf/skills/*/` | — | — |
546
+ | Antigravity | `.agents/rules/*.md` | `.agents/agents/*.md` | | `.agents/workflows/*/` | | |
547
+ | Trae | `.trae/rules/*.md` | `.trae/agents/*.md` | — | — | — | — |
548
+
549
+ A capability marked `—` is not supported by that IDE. Adding a new IDE = one entry in [`src/core/registry.js`](src/core/registry.js).
550
+
551
+ **About `framework` and `hooks`:** these are *mirror-tree* capabilities — the entire `kit/framework/` and `kit/hooks/` subtrees are copied verbatim into `.claude/framework/` and `.claude/hooks/`. They're needed by the bundled workflow because slash-commands like `/novo-marco` reference framework files via paths like `@./.claude/framework/workflows/new-milestone.md`. A `.kit-mcp-managed` marker is written at the root of each managed tree so `kit sync remove` can clean up safely without touching directories you authored yourself.
552
+
553
+ ### `kit install ...` — register kit-mcp into an IDE's MCP config
554
+
555
+ ```bash
556
+ kit install targets # list IDEs that support MCP config
557
+ kit install dry-run claude-code --scope user --via npx # preview the JSON/TOML
558
+ kit install write claude-code --scope user --via npx # portable: uses `npx @luanpdd/kit-mcp`
559
+ kit install write claude-code --scope project --via local # local clone: uses ./bin/mcp.js absolute path
560
+ kit install write claude-code --scope user --via global # assumes `npm install -g @luanpdd/kit-mcp`
561
+ kit install write # no target: opens an interactive selector (TTY)
562
+ kit install write claude-code --yes # CI: skip the confirm prompt
563
+ ```
564
+
565
+ Since v1.1, `install write` always **previews** the JSON/TOML it's about to write and asks you to confirm. Pass `--yes` (CI mode) or `--json` to bypass the prompt. Without a target argument in TTY mode, you get an arrow-key selector listing all 8 IDEs.
566
+
567
+ `--via` decides how the IDE will invoke the server:
568
+
569
+ | Mode | Command in IDE config | When to use |
570
+ |---|---|---|
571
+ | `npx` (recommended) | `npx -y @luanpdd/kit-mcp` | Portable — works on any machine |
572
+ | `local` | `node /abs/path/to/clone/bin/mcp.js` | You're hacking on kit-mcp itself |
573
+ | `global` | `kit-mcp` | After `npm install -g @luanpdd/kit-mcp` — fastest startup |
574
+
575
+ ### `kit reverse-sync ...` bring IDE edits back to the canonical kit
576
+
577
+ If you edited an agent/command/skill/framework/hook **directly inside the IDE's folder** (`.claude/agents/foo.md`, `.claude/framework/workflows/bar.md`, `.claude/hooks/baz.js`, …) instead of in your kit, this brings those edits back so the canonical absorbs them.
578
+
579
+ ```bash
580
+ kit reverse-sync detect claude-code --project-root .
581
+ kit reverse-sync apply claude-code --project-root . --strategy merge --dry-run
582
+ kit reverse-sync apply claude-code --project-root . --strategy merge
583
+ kit reverse-sync apply claude-code --project-root . --strategy overwrite --only agent/foo
584
+ kit reverse-sync apply claude-code --project-root . --strategy overwrite --only framework/workflows/new-milestone.md
585
+ ```
586
+
587
+ **Strategies:** `skip` (list-only), `merge` (canonical frontmatter + edited body — for agents/commands/skills), `overwrite`, `rename` (preserve both as `-from-{ide}.md`).
588
+
589
+ **Mirror-tree caps (`framework`, `hooks`):** files have no frontmatter, so `merge` degenerates to `overwrite` (with a note). The `.kit-mcp-managed` marker is automatically excluded from candidates. Filter individual files with `--only framework/<rel>` or `--only hooks/<file>`.
590
+
591
+ ### `kit gates ...`reusable workflow gates
592
+
593
+ ```bash
594
+ kit gates list # all gates with stage + blocking flag
595
+ kit gates get regression # full markdown of one gate
596
+ kit gates for-stage pre-verify # gates that run before the verify step
597
+ kit gates run secrets-scan --project-root . # interactive: shows the script, asks y/N, runs
598
+ kit gates run secrets-scan --project-root . --yes # non-interactive (CI)
599
+ kit gates run confidence --no-interactive # manual gates verdict=manual when not interactive
600
+ ```
601
+
602
+ **Verdicts:** `passed` (exit 0), `block` (exit≠0 + blocking), `warn` (exit≠0 + non-blocking), `manual` (no shell), `skipped` (declined).
603
+
604
+ Author runnable gates with a `bash` code-fence under `## Check`:
605
+
606
+ ````markdown
607
+ ---
608
+ id: my-gate
609
+ stage: pre-verify
610
+ blocking: true
611
+ description: ...
612
+ ---
613
+ ## Check
614
+ ```bash
615
+ test -f package.json && npm test
616
+ ```
617
+ ````
618
+
619
+ ### `kit forensics ...` — failure dataset, replays & LLM-driven prompt evolution
620
+
621
+ ```bash
622
+ # Aggregate failures across debug/, verifications, forensics
623
+ kit forensics collect --project-root .
624
+ kit forensics summarize --project-root .
625
+ kit forensics write-learnings --project-root .
626
+
627
+ # LLM pass: read learnings + current agent, propose minimal prompt edits
628
+ kit forensics reflect --agent <name> --project-root . --dry-run
629
+ kit forensics reflect --agent <name> --project-root .
630
+ kit forensics reflect --agent <name> --project-root . --apply
631
+
632
+ # Replays
633
+ kit forensics list-replays --project-root .
634
+ kit forensics load-replay <id> --project-root .
635
+ ```
636
+
637
+ `reflect` requires `ANTHROPIC_API_KEY` (override model with `KIT_REFLECT_MODEL`, max tokens with `KIT_REFLECT_MAX_TOKENS`). Without the key, `--dry-run` saves the assembled prompt for manual paste.
638
+
639
+ The proposal is always saved to `.planning/learnings/{agent}.proposal.md` first; the canonical is only modified after explicit confirmation (or `--apply`). MCP `forensics.reflect` never auto-applies.
640
+
641
+ ### `kit ui ...` — live process viewer (sidecar) — _new in 1.2_
642
+
643
+ A tiny localhost web app that streams what kit-mcp is doing while your IDE drives it. Strictly opt-in: ignore it and v1.1 behavior is unchanged.
644
+
645
+ ```bash
646
+ # In one terminal keeps running until Ctrl+C
647
+ kit ui start
648
+
649
+ # In another terminal (or via Claude Code / Cursor) — runs as before, but events
650
+ # are now also broadcast to the sidecar window
651
+ kit sync install claude-code
652
+
653
+ # Tools too: pass autoSpawn:true on the MCP side, or just `kit ui start` first
654
+ kit ui status
655
+ kit ui stop
656
+ ```
657
+
658
+ What you get:
659
+
660
+ - A single browser tab at `http://127.0.0.1:7100` (or the next free port up to 7199)
661
+ - Live event stream over Server-Sent Events — `tool_invocation`, `progress`, `error`, `milestone`, `run.start`, `run.end`
662
+ - Filters by event type and substring; pause/resume; auto-scroll; dark mode tracks the OS
663
+ - The sidecar shuts itself down after 30 minutes of idle; `--idle-ms 0` disables that
664
+
665
+ **Auto-spawn from MCP tools.** Pass `autoSpawn: true` in the inputSchema of `sync` (action=install), `reverse-sync` (action=apply), or `gates` (action=run). The MCP server will spawn `bin/ui.js` detached, wait for it to come online, open your default browser, and stream that tool's progress. Trivial tools (`kit list-*`, `forensics`, `install`) deliberately don't accept `autoSpawn` — the overhead isn't worth it.
666
+
667
+ **Opt-out always available.** From the CLI: pass `--no-ui` or set `KIT_MCP_NO_UI=1`. The sidecar is never started behind your back; it's only used when a lockfile is already present (someone ran `kit ui start` or `autoSpawn: true`).
668
+
669
+ **Security model.** Sidecar binds to `127.0.0.1` literally — never `0.0.0.0`, never `localhost` (which resolves to `::1` on Windows). Every route validates the `Host` header to mitigate DNS rebinding. CSP is strict (`default-src 'self'; …; frame-ancestors 'none'`). Paths in payloads are scrubbed (`$HOME → ~`, `<projectRoot> → <project>`) so screenshots don't leak directory structure. No persistence, no TLS, no auth — single-user dev workstation only. Full threat model in [`docs/sidecar-security.md`](docs/sidecar-security.md).
670
+
671
+ **First-run quirks.** Windows Defender / macOS firewall may prompt the first time `kit ui start` binds. Approving "Private networks" is enough — the server doesn't accept anything from outside loopback regardless. On WSL, `kit ui start` opens the URL in the Windows host browser via `wslview`. In CI / SSH / `TERM=dumb`, browser launch is suppressed and the URL is printed to stderr instead.
672
+
673
+ ---
674
+
675
+ ## MCP usage
676
+
677
+ Once registered (`kit install write <ide> --via npx`), the IDE's agent gets 6 MCP tools, all using **action-based dispatch** — one tool, many actions, low context cost.
678
+
679
+ | Tool | Actions |
680
+ |---|---|
681
+ | `kit` | `list-agents`, `list-commands`, `list-skills`, `get`, `search` |
682
+ | `sync` | `targets`, `status`, `install`, `remove` |
683
+ | `reverse-sync` | `detect`, `apply` |
684
+ | `gates` | `list`, `get`, `for-stage` |
685
+ | `forensics` | `collect`, `summarize`, `write-learnings`, `reflect`, `list-replays`, `record-replay`, `load-replay`, `annotate-replay` |
686
+ | `install` | `targets`, `install`, `dry-run` |
687
+
688
+ ### Example calls (from inside an MCP client)
689
+
690
+ ```jsonc
691
+ { "tool": "kit", "arguments": { "action": "list-agents" } }
692
+ { "tool": "sync", "arguments": { "action": "install", "target": "claude-code", "projectRoot": "/abs" } }
693
+ { "tool": "gates", "arguments": { "action": "for-stage", "stage": "pre-verify" } }
694
+ { "tool": "forensics", "arguments": { "action": "write-learnings", "projectRoot": "/abs" } }
695
+ { "tool": "reverse-sync", "arguments": { "action": "detect", "target": "claude-code", "projectRoot": "/abs" } }
696
+ ```
697
+
698
+ ---
699
+
700
+ ## Harness usage (programmatic)
701
+
702
+ The `core/` modules are pure functions, no transport coupling:
703
+
704
+ ```javascript
705
+ import { listKit, searchKit } from '@luanpdd/kit-mcp/src/core/kit.js';
706
+ import { syncTo, statusOf } from '@luanpdd/kit-mcp/src/core/sync.js';
707
+ import { listGates, gatesForStage } from '@luanpdd/kit-mcp/src/core/gates.js';
708
+ import { runGate } from '@luanpdd/kit-mcp/src/core/gate-runner.js';
709
+ import { detectReverse, applyReverse } from '@luanpdd/kit-mcp/src/core/reverse-sync.js';
710
+ import { watchKit } from '@luanpdd/kit-mcp/src/core/watch.js';
711
+ import { collectFailures, writeLearnings } from '@luanpdd/kit-mcp/src/core/failures.js';
712
+ import { reflect } from '@luanpdd/kit-mcp/src/core/reflect.js';
713
+
714
+ // Browse the kit
715
+ const kit = await listKit('/path/to/kit');
716
+ console.log(kit.agents.length, 'agents');
717
+
718
+ // Sync to multiple IDEs in parallel
719
+ await Promise.all([
720
+ syncTo('claude-code', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
721
+ syncTo('cursor', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
722
+ syncTo('codex', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
723
+ ]);
724
+
725
+ // Watch and resync
726
+ const w = await watchKit(['claude-code'], { projectRoot: '/proj/foo' });
727
+ // ... later: await w.stop();
728
+ ```
729
+
730
+ This is what dotcontext calls "the harness" — a runtime layer used both by CLI and MCP.
731
+
732
+ ---
733
+
734
+ ## Adding things
735
+
736
+ ### Add a new agent / command / skill
737
+
738
+ Drop a file (or folder, for skills) into your `kit/`:
739
+
740
+ ```bash
741
+ # kit/agents/refactor-suggester.md
742
+ cat > kit/agents/refactor-suggester.md <<'EOF'
743
+ ---
744
+ name: refactor-suggester
745
+ description: Scans a directory and suggests safe refactors with diff previews.
746
+ tools: Read, Glob, Grep
747
+ ---
748
+ You are a refactoring assistant ...
749
+ EOF
750
+
751
+ # Re-sync (or use `kit sync watch` for automatic)
752
+ kit sync install claude-code --project-root /your/project
753
+ ```
754
+
755
+ ### Add a new gate
756
+
757
+ ```bash
758
+ cat > gates/bundle-size.md <<'EOF'
759
+ ---
760
+ id: bundle-size
761
+ stage: post-verify
762
+ blocking: false
763
+ description: Warn if the production bundle grew more than 10% versus the previous phase.
764
+ ---
765
+ ## Check
766
+ ```bash
767
+ # your script here; cwd will be --project-root
768
+ EOF
769
+ ```
770
+
771
+ The gate appears in `kit gates list` immediately and is runnable with `kit gates run bundle-size`.
772
+
773
+ ### Add a new IDE target
774
+
775
+ Open [`src/core/registry.js`](src/core/registry.js) and add an entry to `TARGETS`:
776
+
777
+ ```javascript
778
+ 'my-new-ide': {
779
+ label: 'My New IDE',
780
+ rules: { path: 'MY_RULES.md', mode: 'single' },
781
+ agents: { path: '.myide/agents/', mode: 'multi', extension: '.md' },
782
+ commands: null,
783
+ skills: { path: '.myide/skills/', mode: 'multi-dir' },
784
+ mcpConfig:{ path: '.myide/mcp.json', strategy: 'merge-mcpServers-json',
785
+ userPath: '~/.myide/mcp.json', userKey: 'mcpServers' },
786
+ },
787
+ ```
788
+
789
+ That's the entire change. `kit sync install my-new-ide` and `kit install write my-new-ide` work immediately.
790
+
791
+ ---
792
+
793
+ ## How the sync stays in sync
794
+
795
+ When you run `sync install <ide> --mode reference`, kit-mcp writes stubs like:
796
+
797
+ ```markdown
798
+ ---
799
+ name: example-reviewer
800
+ description: ...
801
+ ---
802
+
803
+ <!-- kit-mcp:reference -->
804
+ # example-reviewer
805
+
806
+ > Canonical source: [`../../kit/agents/example-reviewer.md`](../../kit/agents/example-reviewer.md)
807
+ > Edit the source file in the kit, not this stub.
808
+ ```
809
+
810
+ The IDE reads the **frontmatter** (preserved verbatim) for the metadata it needs, and the body points back at the canonical file. Edit `kit/agents/example-reviewer.md` once; running `sync install` again refreshes timestamps but the link is unchanged.
811
+
812
+ The `STUB_MARKER` (`<!-- kit-mcp:reference -->`) lets `sync remove` clean up only files we wrote, never touching anything you authored manually. It also lets `reverse-sync detect` recognize stubs vs user-edited content.
813
+
814
+ ---
815
+
816
+ ## Releasing (maintainers)
817
+
818
+ The repo auto-publishes to npm via GitHub Actions whenever a version tag (`v*`) is pushed.
819
+
820
+ ### One-time setup
821
+
822
+ 1. **Create the GitHub repo** (if not already):
823
+ ```bash
824
+ gh repo create luanpdd/kit-mcp --public --source . --push
825
+ ```
826
+
827
+ 2. **Generate an npm token** at https://www.npmjs.com/settings/luanpdd/tokens
828
+ - Type: **Granular Access Token**
829
+ - Permissions: **Read and write** for `@luanpdd/*` scope
830
+ - **Allow this token to bypass 2FA**: ✅ enabled (required for CI)
831
+
832
+ 3. **Add the token as a GitHub secret**:
833
+ ```bash
834
+ gh secret set NPM_TOKEN
835
+ # paste the npm_xxxxx token when prompted
836
+ ```
837
+
838
+ ### Release flow
839
+
840
+ ```bash
841
+ npm version patch # or minor / major — bumps + commits + tags
842
+ git push --follow-tags
843
+ # GitHub Action runs CLI smoke tests, then `npm publish --provenance`
844
+ ```
845
+
846
+ The publish workflow refuses to ship if `package.json` version doesn't match the tag.
847
+
848
+ The CI workflow runs CLI smoke tests on **Ubuntu / macOS / Windows × Node 20 / 22** on every PR and push to `main`.
849
+
850
+ ---
851
+
852
+ ## Design notes — what we adapted from dotcontext, what we didn't
853
+
854
+ **Adapted (load-bearing simplifications):**
855
+
856
+ 1. **Single registry table** — `src/core/registry.js`. Adding an IDE = one entry, not a new adapter file. Capability differences handled by `null`, not `if/else`.
857
+ 2. **Markdown references over copies** — edit the canonical, all targets see it.
858
+ 3. **Action-based MCP dispatching** — 6 tools instead of 30+. Small surface, easy to remember.
859
+ 4. **CLI ↔ harness ↔ MCP** — `core/` is pure, CLI and MCP are thin transports.
860
+
861
+ **Adapted but reshaped:**
862
+
863
+ 5. **Failure dataset** — `forensics collect/summarize/write-learnings` aggregates `debug/resolved/`, failed `*-VERIFICATION.md`, `forensics/*` into per-agent learning docs.
864
+ 6. **Reflect (LLM pass)** — `forensics reflect` feeds learnings + current agent into an LLM and proposes minimal prompt edits.
865
+ 7. **Replays** — `forensics record-replay / load-replay` for tight prompt iteration.
866
+ 8. **Gates as named files** — extracted into `gates/*.md` with explicit verdict format. Runnable with `gates run`.
867
+
868
+ **Not adapted (over-engineered for a personal kit):**
869
+
870
+ - PREVC state machine, role assignments, sensors/contracts/policies/datasets — too much for personal use.
871
+ - Built-in agents/skills hardcoded — yours come from your `kit/`.
872
+
873
+ ---
874
+
875
+ ## Roadmap (open ideas)
876
+
877
+ - HTTP transport for IDEs that don't speak stdio MCP.
878
+ - `forensics reflect` with diff visual instead of full content.
879
+ - `kit gates run --all` aggregating verdicts of every gate at a stage.
880
+ - Dependabot config to keep `chokidar` and `@modelcontextprotocol/sdk` current.
881
+ - `kit sync watch` exposed via MCP (long-running tool challenge).
882
+
883
+ PRs welcome.
884
+
885
+ ---
886
+
887
+ ## Tests
888
+
889
+ Built on `node:test` (zero dependencies). Two suites:
890
+
891
+ ```bash
892
+ npm test # unit — kit parser, sync (all modes), reverse-sync, gates, registry
893
+ npm run test:integration # integration — spawns bin/cli.js end-to-end on a temp project
894
+ npm run test:all # both
895
+ ```
896
+
897
+ Plus the original quick smokes:
898
+
899
+ ```bash
900
+ node bin/cli.js kit list-agents | head -5 # 47 bundled agents
901
+ node bin/cli.js sync targets # 8 IDEs
902
+ node bin/cli.js gates list # 20 gates
903
+ node bin/cli.js install dry-run claude-code --via npx
904
+ ```
905
+
906
+ CI runs unit + integration + smoke + MCP boot on Ubuntu / macOS / Windows × Node 20 / 22 on every push and PR.
907
+
908
+ ---
909
+
910
+ ## License
911
+
912
+ MIT — see [LICENSE](LICENSE).
913
+
914
+ Copyright © 2026 luanpdd.