contextdevkit 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +592 -0
- package/LICENSE +21 -0
- package/README.md +401 -0
- package/docs/AGENT-PACKAGE-FORMAT.md +140 -0
- package/docs/ARCHITECTURE.md +258 -0
- package/docs/CHANGELOG.md +559 -0
- package/docs/CUSTOMIZING.md +211 -0
- package/docs/LEVELS.md +151 -0
- package/docs/ROADMAP.md +385 -0
- package/docs/SQUAD-PIPELINE-FORMAT.md +258 -0
- package/docs/SQUADS/agent-forge.md +65 -0
- package/docs/SQUADS/design-team.md +161 -0
- package/docs/token-economy-plan.md +135 -0
- package/install.mjs +273 -0
- package/instrucoes.md +274 -0
- package/package.json +46 -0
- package/templates/CLAUDE.md.tpl +133 -0
- package/templates/claude/agents/_TEMPLATE.md +52 -0
- package/templates/claude/agents/accessibility.md +36 -0
- package/templates/claude/agents/agent-architect.md +37 -0
- package/templates/claude/agents/architect.md +39 -0
- package/templates/claude/agents/code-reviewer.md +43 -0
- package/templates/claude/agents/code-security.md +59 -0
- package/templates/claude/agents/context-keeper.md +40 -0
- package/templates/claude/agents/devops.md +40 -0
- package/templates/claude/agents/eval-designer.md +40 -0
- package/templates/claude/agents/forge-orchestrator.md +42 -0
- package/templates/claude/agents/governance-officer.md +45 -0
- package/templates/claude/agents/growth.md +92 -0
- package/templates/claude/agents/infra-security.md +53 -0
- package/templates/claude/agents/landing-architect.md +154 -0
- package/templates/claude/agents/model-router.md +34 -0
- package/templates/claude/agents/packager.md +38 -0
- package/templates/claude/agents/privacy-lgpd.md +64 -0
- package/templates/claude/agents/product-owner.md +51 -0
- package/templates/claude/agents/prompt-engineer.md +33 -0
- package/templates/claude/agents/qa-e2e.md +52 -0
- package/templates/claude/agents/qa-fuzzer.md +24 -0
- package/templates/claude/agents/qa-integration.md +21 -0
- package/templates/claude/agents/qa-orchestrator.md +40 -0
- package/templates/claude/agents/qa-perf.md +40 -0
- package/templates/claude/agents/qa-unit.md +39 -0
- package/templates/claude/agents/rag-designer.md +54 -0
- package/templates/claude/agents/retention.md +85 -0
- package/templates/claude/agents/security.md +48 -0
- package/templates/claude/agents/seo-specialist.md +106 -0
- package/templates/claude/agents/test-engineer.md +48 -0
- package/templates/claude/agents/tool-designer.md +32 -0
- package/templates/claude/agents/ui-designer.md +37 -0
- package/templates/claude/agents/ux-designer.md +38 -0
- package/templates/claude/commands/README.md +95 -0
- package/templates/claude/commands/advise.md +80 -0
- package/templates/claude/commands/audit/analyze-code-ia-practices.md +75 -0
- package/templates/claude/commands/audit/audit.md +35 -0
- package/templates/claude/commands/audit/contract-check.md +21 -0
- package/templates/claude/commands/audit/deep-analysis.md +48 -0
- package/templates/claude/commands/audit/deps-audit.md +49 -0
- package/templates/claude/commands/audit/security-setup.md +35 -0
- package/templates/claude/commands/audit/seo-audit.md +63 -0
- package/templates/claude/commands/audit/tech-debt-sweep.md +35 -0
- package/templates/claude/commands/bug-hunt.md +42 -0
- package/templates/claude/commands/claude-md.md +36 -0
- package/templates/claude/commands/close-version.md +25 -0
- package/templates/claude/commands/context-refresh.md +19 -0
- package/templates/claude/commands/context-stats.md +15 -0
- package/templates/claude/commands/dashboard.md +66 -0
- package/templates/claude/commands/distill-apply.md +19 -0
- package/templates/claude/commands/distill-sessions.md +26 -0
- package/templates/claude/commands/fleet.md +47 -0
- package/templates/claude/commands/forge/forge-audit.md +16 -0
- package/templates/claude/commands/forge/forge-budget.md +16 -0
- package/templates/claude/commands/forge/forge-deprecate.md +16 -0
- package/templates/claude/commands/forge/forge-doctor.md +17 -0
- package/templates/claude/commands/forge/forge-eval.md +16 -0
- package/templates/claude/commands/forge/forge-fallback-test.md +17 -0
- package/templates/claude/commands/forge/forge-killswitch.md +17 -0
- package/templates/claude/commands/forge/forge-list.md +17 -0
- package/templates/claude/commands/forge/forge-new.md +41 -0
- package/templates/claude/commands/forge/forge-policy.md +16 -0
- package/templates/claude/commands/forge/forge-redteam.md +17 -0
- package/templates/claude/commands/forge/forge-refresh-matrix.md +20 -0
- package/templates/claude/commands/forge/forge-route.md +17 -0
- package/templates/claude/commands/forge/forge-show.md +16 -0
- package/templates/claude/commands/landing-page.md +71 -0
- package/templates/claude/commands/log-session.md +59 -0
- package/templates/claude/commands/media-gen.md +93 -0
- package/templates/claude/commands/new-adr.md +30 -0
- package/templates/claude/commands/pipeline/dev-start.md +64 -0
- package/templates/claude/commands/pipeline/pipeline.md +36 -0
- package/templates/claude/commands/pipeline/resume.md +70 -0
- package/templates/claude/commands/pipeline/retro.md +34 -0
- package/templates/claude/commands/pipeline/runs.md +63 -0
- package/templates/claude/commands/pipeline/ship.md +54 -0
- package/templates/claude/commands/pipeline/workflow.md +85 -0
- package/templates/claude/commands/playbook.md +27 -0
- package/templates/claude/commands/predictions-review.md +28 -0
- package/templates/claude/commands/qa/qa-signoff.md +24 -0
- package/templates/claude/commands/qa/scaffold-tests.md +27 -0
- package/templates/claude/commands/qa/test-plan.md +26 -0
- package/templates/claude/commands/qa/visual-test.md +42 -0
- package/templates/claude/commands/roadmap.md +48 -0
- package/templates/claude/commands/setup/aidevtool-from0.md +104 -0
- package/templates/claude/commands/setup/context-config.md +25 -0
- package/templates/claude/commands/setup/context-doctor.md +21 -0
- package/templates/claude/commands/setup/context-level.md +17 -0
- package/templates/claude/commands/setup/setupcontextdevkit.md +121 -0
- package/templates/claude/commands/simulate-impact.md +32 -0
- package/templates/claude/commands/squad.md +44 -0
- package/templates/claude/commands/state.md +21 -0
- package/templates/claude/commands/token-report.md +29 -0
- package/templates/claude/commands/tune-agents.md +35 -0
- package/templates/claude/commands/vcs/claim.md +18 -0
- package/templates/claude/commands/vcs/git.md +83 -0
- package/templates/claude/commands/vcs/release.md +15 -0
- package/templates/claude/commands/vcs/worktree-new.md +18 -0
- package/templates/claude/commands/watch.md +47 -0
- package/templates/contextkit/.env.example +36 -0
- package/templates/contextkit/CLAUDE.child.md.tpl +38 -0
- package/templates/contextkit/README.md +74 -0
- package/templates/contextkit/behaviors-examples.md +183 -0
- package/templates/contextkit/behaviors.md +116 -0
- package/templates/contextkit/best-practices.md +323 -0
- package/templates/contextkit/config.json +66 -0
- package/templates/contextkit/detectors/README.md +45 -0
- package/templates/contextkit/detectors/example-detector.mjs.example +25 -0
- package/templates/contextkit/instrucoes.md +114 -0
- package/templates/contextkit/memory/GLOSSARY.md +13 -0
- package/templates/contextkit/memory/SESSIONS.md +9 -0
- package/templates/contextkit/memory/WORKSPACE.md +7 -0
- package/templates/contextkit/memory/business-rules/_TEMPLATE.md +33 -0
- package/templates/contextkit/memory/decisions/0000-record-architecture-decisions.md +34 -0
- package/templates/contextkit/memory/decisions/_TEMPLATE.md +25 -0
- package/templates/contextkit/memory/predictions/.gitkeep +0 -0
- package/templates/contextkit/memory/roadmap.md +28 -0
- package/templates/contextkit/memory/sessions/.gitkeep +0 -0
- package/templates/contextkit/memory/workflows/.gitkeep +0 -0
- package/templates/contextkit/pipeline/backlog/.gitkeep +0 -0
- package/templates/contextkit/pipeline/conclusion/.gitkeep +0 -0
- package/templates/contextkit/pipeline/devpipeline.md +9 -0
- package/templates/contextkit/pipeline/testing/.gitkeep +0 -0
- package/templates/contextkit/pipeline/working/.gitkeep +0 -0
- package/templates/contextkit/review-protocol.md +214 -0
- package/templates/contextkit/runtime/config/defaults.mjs +215 -0
- package/templates/contextkit/runtime/config/levels.mjs +42 -0
- package/templates/contextkit/runtime/config/load.mjs +105 -0
- package/templates/contextkit/runtime/config/paths.mjs +92 -0
- package/templates/contextkit/runtime/config/presets.mjs +47 -0
- package/templates/contextkit/runtime/config/schema.mjs +88 -0
- package/templates/contextkit/runtime/config/settings-compose.mjs +55 -0
- package/templates/contextkit/runtime/git-hooks/commit-msg.mjs +55 -0
- package/templates/contextkit/runtime/git-hooks/pre-commit.mjs +47 -0
- package/templates/contextkit/runtime/git-hooks/pre-push.mjs +102 -0
- package/templates/contextkit/runtime/hooks/boot-context-readers.mjs +111 -0
- package/templates/contextkit/runtime/hooks/boot-signals.mjs +135 -0
- package/templates/contextkit/runtime/hooks/check-registration.mjs +228 -0
- package/templates/contextkit/runtime/hooks/concurrency-guard.mjs +110 -0
- package/templates/contextkit/runtime/hooks/ledger.mjs +231 -0
- package/templates/contextkit/runtime/hooks/md-extract.mjs +65 -0
- package/templates/contextkit/runtime/hooks/path-classification.mjs +62 -0
- package/templates/contextkit/runtime/hooks/safe-io.mjs +84 -0
- package/templates/contextkit/runtime/hooks/session-digest-core.mjs +85 -0
- package/templates/contextkit/runtime/hooks/session-start.mjs +248 -0
- package/templates/contextkit/runtime/hooks/simulate-gate.mjs +108 -0
- package/templates/contextkit/runtime/hooks/track-edits.mjs +154 -0
- package/templates/contextkit/runtime/providers/media/_adapter.mjs +120 -0
- package/templates/contextkit/runtime/providers/media/nano-banana.mjs +110 -0
- package/templates/contextkit/runtime/providers/media/veo.mjs +162 -0
- package/templates/contextkit/runtime/providers/review/_adapter.mjs +71 -0
- package/templates/contextkit/runtime/providers/review/detect.mjs +115 -0
- package/templates/contextkit/runtime/providers/review/gh.mjs +103 -0
- package/templates/contextkit/runtime/state/state-io.mjs +172 -0
- package/templates/contextkit/runtime/statusline.mjs +51 -0
- package/templates/contextkit/squads/README.md +115 -0
- package/templates/contextkit/squads/_BRIEFING.md.tpl +27 -0
- package/templates/contextkit/squads/agent-forge/README.md +69 -0
- package/templates/contextkit/squads/agent-forge/ROADMAP.md +108 -0
- package/templates/contextkit/squads/agent-forge/best-practices.md +89 -0
- package/templates/contextkit/squads/agent-forge/cli/forge-admin.mjs +132 -0
- package/templates/contextkit/squads/agent-forge/cli/forge-eval-cli.mjs +163 -0
- package/templates/contextkit/squads/agent-forge/cli/forge-new.mjs +97 -0
- package/templates/contextkit/squads/agent-forge/cli/forge-ops.mjs +177 -0
- package/templates/contextkit/squads/agent-forge/lib/architect.mjs +112 -0
- package/templates/contextkit/squads/agent-forge/lib/eval-designer.mjs +133 -0
- package/templates/contextkit/squads/agent-forge/lib/eval-runner.mjs +167 -0
- package/templates/contextkit/squads/agent-forge/lib/governance-officer.mjs +178 -0
- package/templates/contextkit/squads/agent-forge/lib/package-ops.mjs +101 -0
- package/templates/contextkit/squads/agent-forge/lib/packager.mjs +219 -0
- package/templates/contextkit/squads/agent-forge/lib/prompt-gen.mjs +122 -0
- package/templates/contextkit/squads/agent-forge/lib/rag-designer.mjs +102 -0
- package/templates/contextkit/squads/agent-forge/lib/router.mjs +165 -0
- package/templates/contextkit/squads/agent-forge/lib/tool-gen.mjs +113 -0
- package/templates/contextkit/squads/agent-forge/lib/yaml.mjs +47 -0
- package/templates/contextkit/squads/agent-forge/pipeline.yaml +65 -0
- package/templates/contextkit/squads/agent-forge/router/capability-matrix.json +112 -0
- package/templates/contextkit/squads/agent-forge/router/decision-rules.json +120 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/.agentforgerc +12 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/CHANGELOG.md +13 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/LICENSE +5 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/README.md +39 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/go/README.md +10 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/go/agent.go +14 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/go/go.mod +3 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/node/README.md +11 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/node/index.js +53 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/node/package.json +9 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/python/README.md +10 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/python/agent.py +16 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/python/pyproject.toml +10 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/golden.jsonl +1 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/red-team.jsonl +3 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/rubric.yaml +14 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/run-eval.md +17 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/thresholds.yaml +18 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/examples/basic.node.md +17 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/examples/with-fallback.node.md +24 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/examples/with-rag.python.md +20 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/audit.schema.json +23 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/compliance.policy.yaml +43 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/cost.policy.yaml +36 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/fallback-chain.yaml +16 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/quality.policy.yaml +43 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/manifest.yaml +91 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.anthropic.md +19 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.canonical.md +25 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.deepseek.md +21 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.google.md +19 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.ollama.md +21 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.openai.md +20 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/config.yaml +17 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/index/.gitkeep +3 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/ingestion/chunker.config.yaml +6 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/ingestion/sources.yaml +8 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/retrieval/query-template.md +16 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/retrieval/rerank.config.yaml +6 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/anthropic.tools.json +11 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/deepseek.tools.json +14 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/google.tools.json +11 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/ollama.tools.json +14 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/openai.tools.json +14 -0
- package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/schemas.canonical.json +25 -0
- package/templates/contextkit/starters/tanstack/README.md +86 -0
- package/templates/contextkit/starters/tanstack/index.html +12 -0
- package/templates/contextkit/starters/tanstack/package.json +25 -0
- package/templates/contextkit/starters/tanstack/src/main.tsx +40 -0
- package/templates/contextkit/starters/tanstack/src/router.tsx +12 -0
- package/templates/contextkit/starters/tanstack/src/routes/__root.tsx +10 -0
- package/templates/contextkit/starters/tanstack/src/routes/index.tsx +17 -0
- package/templates/contextkit/starters/tanstack/tsconfig.json +19 -0
- package/templates/contextkit/starters/tanstack/vite.config.ts +10 -0
- package/templates/contextkit/tools/scripts/adr-digest-core.mjs +42 -0
- package/templates/contextkit/tools/scripts/adr-digest.mjs +78 -0
- package/templates/contextkit/tools/scripts/agent-tuning.mjs +74 -0
- package/templates/contextkit/tools/scripts/aiso-audit.mjs +174 -0
- package/templates/contextkit/tools/scripts/audit-shared.mjs +129 -0
- package/templates/contextkit/tools/scripts/claim.mjs +133 -0
- package/templates/contextkit/tools/scripts/claude-md.mjs +123 -0
- package/templates/contextkit/tools/scripts/clean-drive.mjs +78 -0
- package/templates/contextkit/tools/scripts/context-config.mjs +111 -0
- package/templates/contextkit/tools/scripts/context-level.mjs +98 -0
- package/templates/contextkit/tools/scripts/context-pack.mjs +120 -0
- package/templates/contextkit/tools/scripts/contract-scan.mjs +186 -0
- package/templates/contextkit/tools/scripts/dashboard-data.mjs +198 -0
- package/templates/contextkit/tools/scripts/dashboard-html.mjs +215 -0
- package/templates/contextkit/tools/scripts/dashboard-server.mjs +129 -0
- package/templates/contextkit/tools/scripts/dashboard.mjs +107 -0
- package/templates/contextkit/tools/scripts/deep-analysis.mjs +62 -0
- package/templates/contextkit/tools/scripts/deps-audit.mjs +201 -0
- package/templates/contextkit/tools/scripts/detect-stack.mjs +164 -0
- package/templates/contextkit/tools/scripts/distill-detect.mjs +90 -0
- package/templates/contextkit/tools/scripts/doctor.mjs +165 -0
- package/templates/contextkit/tools/scripts/fleet.mjs +170 -0
- package/templates/contextkit/tools/scripts/generate-context.mjs +142 -0
- package/templates/contextkit/tools/scripts/gh-alerts.mjs +117 -0
- package/templates/contextkit/tools/scripts/git.mjs +97 -0
- package/templates/contextkit/tools/scripts/home.mjs +106 -0
- package/templates/contextkit/tools/scripts/mark-simulation.mjs +78 -0
- package/templates/contextkit/tools/scripts/media-gen.mjs +154 -0
- package/templates/contextkit/tools/scripts/pipeline-board.mjs +74 -0
- package/templates/contextkit/tools/scripts/pipeline-prioritize.mjs +68 -0
- package/templates/contextkit/tools/scripts/pipeline-session.mjs +99 -0
- package/templates/contextkit/tools/scripts/pipeline-validate.mjs +136 -0
- package/templates/contextkit/tools/scripts/pipeline.mjs +302 -0
- package/templates/contextkit/tools/scripts/playbook.mjs +123 -0
- package/templates/contextkit/tools/scripts/predictions-review.mjs +113 -0
- package/templates/contextkit/tools/scripts/release.mjs +60 -0
- package/templates/contextkit/tools/scripts/resume.mjs +114 -0
- package/templates/contextkit/tools/scripts/roadmap.mjs +86 -0
- package/templates/contextkit/tools/scripts/runs.mjs +116 -0
- package/templates/contextkit/tools/scripts/seo-audit.mjs +150 -0
- package/templates/contextkit/tools/scripts/session-digest.mjs +89 -0
- package/templates/contextkit/tools/scripts/session-reindex.mjs +91 -0
- package/templates/contextkit/tools/scripts/setup-complete.mjs +69 -0
- package/templates/contextkit/tools/scripts/squad-meta.mjs +23 -0
- package/templates/contextkit/tools/scripts/squad-pipeline-condition.mjs +192 -0
- package/templates/contextkit/tools/scripts/squad-pipeline.mjs +301 -0
- package/templates/contextkit/tools/scripts/squad.mjs +80 -0
- package/templates/contextkit/tools/scripts/stats.mjs +138 -0
- package/templates/contextkit/tools/scripts/sync-check.mjs +235 -0
- package/templates/contextkit/tools/scripts/tech-debt-detectors.mjs +76 -0
- package/templates/contextkit/tools/scripts/tech-debt-scan.mjs +164 -0
- package/templates/contextkit/tools/scripts/token-report.mjs +153 -0
- package/templates/contextkit/tools/scripts/visual-test.mjs +132 -0
- package/templates/contextkit/tools/scripts/watch.mjs +106 -0
- package/templates/contextkit/tools/scripts/workflow.mjs +136 -0
- package/templates/contextkit/tools/scripts/workspace-sync.mjs +220 -0
- package/templates/contextkit/tools/scripts/worktree-new.mjs +50 -0
- package/templates/contextkit/workflows/L1-static-loading.md +59 -0
- package/templates/contextkit/workflows/L2-session-ledger.md +86 -0
- package/templates/contextkit/workflows/L3-multi-session.md +80 -0
- package/templates/contextkit/workflows/L4-squads.md +68 -0
- package/templates/contextkit/workflows/L5-proactive.md +88 -0
- package/templates/contextkit/workflows/README.md +47 -0
- package/templates/contextkit/workflows/playbooks/distillation-cycle.md +74 -0
- package/templates/contextkit/workflows/playbooks/landing-page.md +197 -0
- package/templates/contextkit/workflows/playbooks/security-batch.md +68 -0
- package/templates/contextkit/workflows/playbooks/seo-aiso.md +288 -0
- package/templates/contextkit/workflows/playbooks/simulate-impact.md +83 -0
- package/templates/contextkit/workflows/playbooks/tanstack.md +164 -0
- package/templates/contextkit/workflows/playbooks/tech-debt-sweep.md +77 -0
- package/templates/docs/CHANGELOG.md.tpl +11 -0
- package/templates/gitattributes +3 -0
- package/templates/github/ISSUE_TEMPLATE/bug_report.md +30 -0
- package/templates/github/ISSUE_TEMPLATE/feature_request.md +22 -0
- package/templates/github/PULL_REQUEST_TEMPLATE.md +27 -0
- package/templates/github/dependabot.yml +27 -0
- package/templates/github/workflows/quality.yml +36 -0
- package/templates/github/workflows/security.yml +54 -0
- package/tools/install/cli.mjs +62 -0
- package/tools/install/fs.mjs +56 -0
- package/tools/install/git.mjs +114 -0
- package/tools/install/project.mjs +51 -0
- package/tools/install/uninstall.mjs +54 -0
- package/tools/integration-test-compozy.mjs +88 -0
- package/tools/integration-test-guards.mjs +269 -0
- package/tools/integration-test-tooling-agent-forge.mjs +189 -0
- package/tools/integration-test-tooling-pipeline.mjs +164 -0
- package/tools/integration-test-tooling.mjs +172 -0
- package/tools/integration-test.mjs +228 -0
- package/tools/it-helpers.mjs +60 -0
- package/tools/selfcheck-agent-forge-ops.mjs +107 -0
- package/tools/selfcheck-agent-forge.mjs +304 -0
- package/tools/selfcheck-config.mjs +80 -0
- package/tools/selfcheck-runtime.mjs +135 -0
- package/tools/selfcheck-source.mjs +326 -0
- package/tools/selfcheck.mjs +268 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Custom tech-debt detectors
|
|
2
|
+
|
|
3
|
+
Drop-in extension point for `/tech-debt-sweep` (`tech-debt-scan.mjs`). Any
|
|
4
|
+
`*.mjs` file in **this folder** is auto-loaded and its exported detector
|
|
5
|
+
function(s) run alongside the built-ins on every scan — no core edit needed.
|
|
6
|
+
|
|
7
|
+
> This folder itself is **excluded from scanning** (you don't lint your linters),
|
|
8
|
+
> and a broken detector is skipped defensively rather than failing the run.
|
|
9
|
+
|
|
10
|
+
## The contract
|
|
11
|
+
|
|
12
|
+
A detector is a pure function:
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
// (relativePath, fileContent) => findings[]
|
|
16
|
+
export default function detectName(path, content) {
|
|
17
|
+
// return [] when there's nothing to report
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Each **finding** is an object:
|
|
22
|
+
|
|
23
|
+
| field | type | notes |
|
|
24
|
+
| ---------- | ------ | ------------------------------------------------------ |
|
|
25
|
+
| `kind` | string | short id, e.g. `"console-log"` |
|
|
26
|
+
| `severity` | 1–5 | 5 = RED zone (fails the CI gate), 1 = info |
|
|
27
|
+
| `path` | string | the `path` arg |
|
|
28
|
+
| `line` | number | 1-based line number (optional) |
|
|
29
|
+
| `message` | string | what's wrong + ideally how to fix |
|
|
30
|
+
| `snippet` | string | optional offending line excerpt |
|
|
31
|
+
|
|
32
|
+
A module may `export default` one detector **or** export several named
|
|
33
|
+
functions — all exported functions are collected.
|
|
34
|
+
|
|
35
|
+
## Enable the example
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cp contextkit/detectors/example-detector.mjs.example contextkit/detectors/console-log.mjs
|
|
39
|
+
node contextkit/tools/scripts/tech-debt-scan.mjs # now flags stray console.log calls
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## ⚠️ Trust
|
|
43
|
+
|
|
44
|
+
Detectors are **executed** by the scanner with full Node privileges. Only add
|
|
45
|
+
detectors you've read and trust — treat them like any other code in the repo.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example custom tech-debt detector — flags stray `console.log(` calls left in
|
|
3
|
+
* source (a common debug leftover). Copy this file to `<name>.mjs` in this
|
|
4
|
+
* folder to ACTIVATE it (the `.example` suffix keeps it inert until you do):
|
|
5
|
+
*
|
|
6
|
+
* cp example-detector.mjs.example console-log.mjs
|
|
7
|
+
*
|
|
8
|
+
* Contract: `(relativePath, fileContent) => findings[]`. See README.md.
|
|
9
|
+
*/
|
|
10
|
+
export default function detectConsoleLog(path, content) {
|
|
11
|
+
const findings = [];
|
|
12
|
+
content.split('\n').forEach((line, i) => {
|
|
13
|
+
if (/\bconsole\.log\(/.test(line)) {
|
|
14
|
+
findings.push({
|
|
15
|
+
kind: 'console-log',
|
|
16
|
+
severity: 2,
|
|
17
|
+
path,
|
|
18
|
+
line: i + 1,
|
|
19
|
+
snippet: line.trim().slice(0, 120),
|
|
20
|
+
message: 'Stray `console.log` — remove it or route through a real logger.',
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return findings;
|
|
25
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# ContextDevKit — Guia de Uso (pt-BR)
|
|
2
|
+
|
|
3
|
+
> Guia prático em português. **Comandos, caminhos e chaves de config** ficam em
|
|
4
|
+
> inglês de propósito (é o "principal" do projeto) — só a explicação é em pt-BR.
|
|
5
|
+
|
|
6
|
+
## O que é
|
|
7
|
+
|
|
8
|
+
O ContextDevKit transforma "AI-assisted coding" em **engenharia**: em vez de torcer pra
|
|
9
|
+
IA lembrar do contexto, o ambiente (hooks do Claude Code) **força** boas
|
|
10
|
+
práticas e guarda o histórico no próprio repositório.
|
|
11
|
+
|
|
12
|
+
## Primeiro uso
|
|
13
|
+
|
|
14
|
+
Abra o projeto no Claude Code, aprove os hooks, e rode **`/setupcontextdevkit`** —
|
|
15
|
+
ele detecta a stack, ajusta o config, preenche o `CLAUDE.md`, marca paths de
|
|
16
|
+
risco, cria um ADR base e registra a sessão. Um banner de "first run" aparece
|
|
17
|
+
no boot até você rodá-lo.
|
|
18
|
+
|
|
19
|
+
Projeto vazio (greenfield)? Use **`/aidevtool-from0`** — questionário interativo
|
|
20
|
+
de produto → visão, stack, roadmap, boas práticas e DevPipeline montados num
|
|
21
|
+
único passo.
|
|
22
|
+
|
|
23
|
+
## Os 7 níveis
|
|
24
|
+
|
|
25
|
+
| Nível | O que ativa |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| **L1 Memory** | contexto no boot, `/log-session`, ADRs, changelog |
|
|
28
|
+
| **L2 Ledger** | detecção de drift |
|
|
29
|
+
| **L3 Multi** | claims, worktrees, índices auto-gerados, git hooks (Conventional Commits + pre-push contra conflito real) |
|
|
30
|
+
| **L4 Squads** | 28 sub-agentes em 7 squads (devteam, qa-team, design-team com `seo-specialist` + `landing-architect`, security, compliance-LGPD, ops, agent-forge) |
|
|
31
|
+
| **L5 Proactive** | gate `/simulate-impact`, tech-debt, distill-detect, contract drift |
|
|
32
|
+
| **L6 Autonomy** | pipeline `/ship`, learning loop `/retro`, métricas, agent-forge ativo |
|
|
33
|
+
| **L7 Ecosystem** | `/fleet` (multi-repo), `/tune-agents`, testes visuais, playbook runner |
|
|
34
|
+
|
|
35
|
+
Trocar de nível: `/context-level <n>` (reinicie o Claude Code depois).
|
|
36
|
+
|
|
37
|
+
## Comandos principais
|
|
38
|
+
|
|
39
|
+
- **Setup:** `/aidevtool-from0` (vazio) · `/setupcontextdevkit` (existente)
|
|
40
|
+
- **Diário:** `/state` · `/log-session` (no fim) · `/new-adr` · `/close-version` ·
|
|
41
|
+
`/context-refresh` · `/bug-hunt` · `/dashboard` · `/watch` · `/playbook` ·
|
|
42
|
+
`/context-stats` · `/distill-sessions` · `/distill-apply`
|
|
43
|
+
- **Trabalho focado:** `/dev-start` (mostra PRs abertos via sync-check) ·
|
|
44
|
+
`/workflow` · `/ship` · `/resume`
|
|
45
|
+
- **Coordenação (L3):** `/claim` · `/release` · `/worktree-new` · `/git`
|
|
46
|
+
- **Qualidade (pack `qa/` + L5):** `/test-plan` · `/scaffold-tests` ·
|
|
47
|
+
`/qa-signoff` · `/visual-test` · `/simulate-impact` · `/tech-debt-sweep` ·
|
|
48
|
+
`/analyze-code-ia-practices` · `/contract-check`
|
|
49
|
+
- **Auditoria (pack `audit/`):** `/audit` · `/deep-analysis` · `/security-setup` ·
|
|
50
|
+
`/deps-audit` · **`/seo-audit`** *(novo — SEO + AISO)*
|
|
51
|
+
- **Landing pages & mídia *(novo na v1.7)*:** `/landing-page` (architect
|
|
52
|
+
opinionado anti-cookie-cutter) · `/media-gen` (Veo + Nano Banana via `.env`)
|
|
53
|
+
- **Produto & execução:** `/roadmap` · `/pipeline` · `/runs` · `/retro` ·
|
|
54
|
+
`/squad` · `/claude-md`
|
|
55
|
+
- **Plataforma:** `/context-doctor` · `/context-config` · `/context-level` ·
|
|
56
|
+
`/fleet` *(L7)* · `/tune-agents` *(L6)*
|
|
57
|
+
- **Agent-forge** *(L6+)*: 14 comandos `forge-*` para o ciclo de Agent Packages
|
|
58
|
+
|
|
59
|
+
## Squads
|
|
60
|
+
|
|
61
|
+
| Squad | Specialists | Quando |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| **devteam** | architect, code-reviewer, context-keeper, test-engineer | Design + revisão + memória |
|
|
64
|
+
| **qa-team** | qa-orchestrator + unit/integration/fuzzer/perf/e2e | Testes |
|
|
65
|
+
| **design-team** | ui-designer, ux-designer, accessibility, **seo-specialist**, **landing-architect** | UI/UX, WCAG AA, SEO+AISO, landing |
|
|
66
|
+
| **security-team** | security, code-security, infra-security | Auth, deps, IaC |
|
|
67
|
+
| **compliance-team** | privacy-lgpd, governance-officer | LGPD, políticas |
|
|
68
|
+
| **ops-team** | devops | CI/CD, deploys |
|
|
69
|
+
| **agent-forge** *(L6+)* | forge-orchestrator + 7 specialists | Pipeline pra Agent Packages portáveis |
|
|
70
|
+
|
|
71
|
+
## Provider adapters *(novo)*
|
|
72
|
+
|
|
73
|
+
Dois surfaces plugáveis sob `runtime/providers/`:
|
|
74
|
+
|
|
75
|
+
- **`review/`** — adapters de CLI de PR (hoje: `gh`; adicione `glab.mjs` /
|
|
76
|
+
`bb.mjs` no mesmo contrato).
|
|
77
|
+
- **`media/`** — geração de mídia (hoje: `nano-banana` para imagem via Imagen 3
|
|
78
|
+
e `veo` para vídeo, ambos via `GOOGLE_AI_API_KEY` configurado em
|
|
79
|
+
`contextkit/.env`).
|
|
80
|
+
|
|
81
|
+
Setup do `/media-gen`:
|
|
82
|
+
1. Pega chave em https://aistudio.google.com/apikey
|
|
83
|
+
2. Copia `contextkit/.env.example` pra `contextkit/.env`, cola em `GOOGLE_AI_API_KEY=`
|
|
84
|
+
3. (Opcional) `CONTEXTDEVKIT_MEDIA_MAX_USD=5.00` pra capar custo por processo
|
|
85
|
+
4. Roda com `node --env-file=contextkit/.env contextkit/tools/scripts/media-gen.mjs ...`
|
|
86
|
+
|
|
87
|
+
## Boas práticas
|
|
88
|
+
|
|
89
|
+
- **Onde começar:** projeto **vazio** → L3; projeto que **já tem código** → L7
|
|
90
|
+
(use tudo; os gates ficam inertes até configurar `highRiskPaths`). O
|
|
91
|
+
instalador escolhe automaticamente.
|
|
92
|
+
- **ADR antes** de decisão grande (`/new-adr`). ADR aceito é imutável.
|
|
93
|
+
- **Registre a sessão** (`/log-session`) — veja seu `drift rate` em
|
|
94
|
+
`/context-stats`. Se perdeu, `/resume`.
|
|
95
|
+
- Ajuste `contextkit/config.json` → `ledger.*` ao seu stack (ou `/context-config`).
|
|
96
|
+
- Mantenha o `CLAUDE.md` curto e com as regras imutáveis preenchidas.
|
|
97
|
+
- Não edite arquivos gerados (`SESSIONS.md`, `WORKSPACE.md`, `tech-debt-board.md`,
|
|
98
|
+
`dashboard.html`) — são regenerados.
|
|
99
|
+
- Sessões paralelas → `/worktree-new` (nunca dois chats no mesmo diretório).
|
|
100
|
+
- **Landing page?** Use `/landing-page` antes de codar — recusa SPA puro,
|
|
101
|
+
define fold count, escolhe pacotes da rec table datada, delega imagery pra
|
|
102
|
+
`/media-gen` (sem stock photos genéricas).
|
|
103
|
+
|
|
104
|
+
## Manutenção
|
|
105
|
+
|
|
106
|
+
- `/context-doctor` — saúde do install. `/context-stats` — métricas.
|
|
107
|
+
- `/audit` — auditoria geral (bom agendar via `/loop` ou `/schedule`).
|
|
108
|
+
- `/dashboard` — visual do estado em HTML; `--watch` em tempo real.
|
|
109
|
+
- Atualizar o kit: rode o instalador de novo (não perde memória/config) ou
|
|
110
|
+
`npx contextdevkit@latest --target . --update`.
|
|
111
|
+
|
|
112
|
+
Docs completos (inglês): `contextkit/README.md` e a pasta `docs/` do kit
|
|
113
|
+
(`docs/ARCHITECTURE.md`, `docs/CUSTOMIZING.md`, `docs/SQUADS/design-team.md`,
|
|
114
|
+
`docs/SQUADS/agent-forge.md`, `docs/LEVELS.md`).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Glossary — domain term ↔ code identifier
|
|
2
|
+
|
|
3
|
+
> The naming authority for this project. Before coining a new domain identifier
|
|
4
|
+
> (variable, function, table, endpoint), check here. Keeps UI/business language
|
|
5
|
+
> and code vocabulary aligned, and prevents three names for the same concept.
|
|
6
|
+
|
|
7
|
+
| Domain term (UI / business) | Code identifier | Notes |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| _example: customer_ | `user` | one canonical word per concept |
|
|
10
|
+
|
|
11
|
+
<!-- Grow this table as the domain language emerges. When the UI audience speaks
|
|
12
|
+
a different language than the code, this table is where the translation is
|
|
13
|
+
pinned down (e.g. "ruivo" → `copper`). -->
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Session History
|
|
2
|
+
|
|
3
|
+
> ⚠️ **AUTO-GENERATED FILE — DO NOT EDIT BY HAND**.
|
|
4
|
+
> Each session lives in its own file under `contextkit/memory/sessions/`.
|
|
5
|
+
> Regenerated by `session-reindex` (also runs on pre-commit).
|
|
6
|
+
|
|
7
|
+
Register a new session with `/log-session`.
|
|
8
|
+
|
|
9
|
+
_(No sessions registered yet.)_
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Workspace — Active Sessions
|
|
2
|
+
|
|
3
|
+
> ⚠️ **AUTO-GENERATED FILE — DO NOT EDIT BY HAND**.
|
|
4
|
+
> Regenerated by `workspace-sync` (runs on pre-commit) from
|
|
5
|
+
> `.claude/.workspace/<sid>.json` files maintained by hooks and slash commands.
|
|
6
|
+
|
|
7
|
+
_(No active sessions. The workspace is idle.)_
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Business Rule: <name> (v1)
|
|
2
|
+
|
|
3
|
+
- **Status**: Draft <!-- Draft | Active | Superseded by <name>-vN -->
|
|
4
|
+
- **Version**: v1
|
|
5
|
+
- **Owner**: <team / role> · **Updated**: YYYY-MM-DD
|
|
6
|
+
- **Related**: [GLOSSARY](../GLOSSARY.md) terms · ADR(s) · roadmap P-IDs
|
|
7
|
+
|
|
8
|
+
## Rule
|
|
9
|
+
State the rule precisely, in domain language — what MUST happen, for whom, and
|
|
10
|
+
when. A reader should be able to implement or verify it from this section alone.
|
|
11
|
+
|
|
12
|
+
## Inputs → outputs
|
|
13
|
+
- **Given**: <preconditions / inputs>
|
|
14
|
+
- **Then**: <the deterministic result>
|
|
15
|
+
|
|
16
|
+
## Edge cases & exceptions
|
|
17
|
+
- <boundary condition> → <expected behaviour>
|
|
18
|
+
- <conflict / failure mode> → <expected behaviour>
|
|
19
|
+
|
|
20
|
+
## Rationale (why)
|
|
21
|
+
Why the rule exists (business / legal / UX). If a technical decision enforces it,
|
|
22
|
+
link the ADR in `../decisions/`.
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
| Input | Expected |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| <case> | <result> |
|
|
28
|
+
|
|
29
|
+
<!-- One file per cohesive rule, versioned (`-v1`, `-v2`). When a rule changes
|
|
30
|
+
materially, add a new version and mark the old one "Superseded". Keep the
|
|
31
|
+
business language consistent with GLOSSARY.md. This folder mirrors the
|
|
32
|
+
source platform's docs/business-rules/, kept in contextkit/memory/ alongside
|
|
33
|
+
the rest of the project's durable memory. -->
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ADR-0000: Record architecture decisions
|
|
2
|
+
|
|
3
|
+
- **Status**: Accepted
|
|
4
|
+
- **Date**: 2020-01-01
|
|
5
|
+
- **Deciders**: ContextDevKit
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
Significant architectural choices on a project get made in conversations, chat
|
|
10
|
+
logs, and people's heads — then forgotten. Six months later nobody remembers why
|
|
11
|
+
the datastore was chosen, why a library was rejected, or what constraint a
|
|
12
|
+
strange-looking design protects. AI coding sessions make this worse: each fresh
|
|
13
|
+
session starts blind unless the *why* is written down somewhere durable.
|
|
14
|
+
|
|
15
|
+
## Decision
|
|
16
|
+
|
|
17
|
+
We will record every significant architectural decision as an **Architecture
|
|
18
|
+
Decision Record (ADR)** — a numbered, immutable markdown file in
|
|
19
|
+
`contextkit/memory/decisions/`, following Michael Nygard's format
|
|
20
|
+
(Context / Decision / Consequences).
|
|
21
|
+
|
|
22
|
+
- Create one with `/new-adr <title>` **before** implementing the decision.
|
|
23
|
+
- ADRs are **immutable once Accepted**. To change a decision, write a NEW ADR
|
|
24
|
+
that supersedes the old one and update the old one's status.
|
|
25
|
+
- The immutable rules in `CLAUDE.md` should each point to the ADR that justifies
|
|
26
|
+
them.
|
|
27
|
+
|
|
28
|
+
## Consequences
|
|
29
|
+
|
|
30
|
+
- **Positive**: durable institutional memory; new sessions (human or AI) can
|
|
31
|
+
reconstruct intent; debates don't get re-litigated.
|
|
32
|
+
- **Trade-off**: a small ritual cost per decision. Worth it — the alternative is
|
|
33
|
+
silent drift.
|
|
34
|
+
- **Follow-up**: keep ADRs short. They capture *why*, not implementation detail.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ADR-NNNN: <Short decision title>
|
|
2
|
+
|
|
3
|
+
- **Status**: Proposed <!-- Proposed | Accepted | Superseded by ADR-XXXX -->
|
|
4
|
+
- **Date**: YYYY-MM-DD
|
|
5
|
+
- **Deciders**: <who>
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
What is the situation and the forces at play? Why is a decision needed now?
|
|
10
|
+
State the constraints (technical, business, team, time) honestly. This section
|
|
11
|
+
should let a future reader understand the problem WITHOUT already knowing the answer.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
What we will do, stated plainly and in the active voice. "We will use X because Y."
|
|
16
|
+
|
|
17
|
+
## Consequences
|
|
18
|
+
|
|
19
|
+
- **Positive**: what becomes easier / safer / faster.
|
|
20
|
+
- **Negative / trade-offs**: what becomes harder, what we give up, the risks.
|
|
21
|
+
- **Follow-ups**: anything this decision obligates us to do next.
|
|
22
|
+
|
|
23
|
+
<!-- If this supersedes an earlier ADR, add:
|
|
24
|
+
Supersedes [ADR-XXXX](XXXX-...md). And set that ADR's status to
|
|
25
|
+
"Superseded by ADR-NNNN". ADRs are immutable once Accepted. -->
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Product Roadmap
|
|
2
|
+
|
|
3
|
+
> The **product / business plan** — capabilities and milestones, ordered by value.
|
|
4
|
+
> The *what* and *why*. Execution (bugs, increments, tasks, SLA) lives in the
|
|
5
|
+
> **DevPipeline** (`contextkit/pipeline/`), not here. Built collaboratively via
|
|
6
|
+
> `/roadmap`; keep it current as priorities change.
|
|
7
|
+
>
|
|
8
|
+
> **Convention — P-IDs:** phases are `P1`, `P2`, …; items are `P1.1`, `P1.2`, …
|
|
9
|
+
> Each item is a user-facing capability with a one-line acceptance note. Mark
|
|
10
|
+
> status with: 📋 planned · ⏳ in progress (a session is on it) · 🟡 partial/blocked ·
|
|
11
|
+
> ✅ done — flip an item to ⏳ when a session starts it, to ✅ when it ships.
|
|
12
|
+
> Cross-reference DevPipeline tasks by P-ID (a task's `roadmap:` field).
|
|
13
|
+
|
|
14
|
+
<!-- ROADMAP-NOT-DEFINED -->
|
|
15
|
+
_No roadmap defined yet._ Run **`/roadmap`** — in a new project it's built with
|
|
16
|
+
you step by step; in an existing project it looks for a roadmap/PRD/spec to
|
|
17
|
+
import, or analyzes the code and proposes one for you to refine and extend.
|
|
18
|
+
|
|
19
|
+
<!--
|
|
20
|
+
Example shape once defined:
|
|
21
|
+
|
|
22
|
+
## P1 — <phase name / theme>
|
|
23
|
+
- **P1.1** 📋 <capability> — _accept:_ <one-line done criterion>
|
|
24
|
+
- **P1.2** 📋 <capability> — _accept:_ <...>
|
|
25
|
+
|
|
26
|
+
## P2 — <next phase>
|
|
27
|
+
- **P2.1** 📋 <capability> — _accept:_ <...>
|
|
28
|
+
-->
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# DevPipeline — execution board
|
|
2
|
+
|
|
3
|
+
> ⚠️ **AUTO-GENERATED** by `pipeline.mjs sync` (also on pre-commit). Do not hand-edit.
|
|
4
|
+
> The product/business plan is `contextkit/memory/roadmap.md`. THIS is execution control:
|
|
5
|
+
> bugs, increments, chores and roadmap items broken into tasks with priority + SLA.
|
|
6
|
+
|
|
7
|
+
Backlog **0** · Testing **0** · Concluded **0**
|
|
8
|
+
|
|
9
|
+
_(No tasks yet. Add one with `/pipeline` or `node contextkit/tools/scripts/pipeline.mjs add ...`.)_
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# AI-Assisted Coding Review Protocol
|
|
2
|
+
|
|
3
|
+
> How `/analyze-code-ia-practices` is meant to be *run* — severity vocabulary,
|
|
4
|
+
> when each tier applies, the audit protocol, and the contract between the
|
|
5
|
+
> deterministic scanner and the agent.
|
|
6
|
+
>
|
|
7
|
+
> **Paired with `best-practices.md`** (the rubric: principles, tiers, rules,
|
|
8
|
+
> over-apply clauses). That file says *what good looks like*; this file says
|
|
9
|
+
> *how to apply it and how to report.*
|
|
10
|
+
>
|
|
11
|
+
> **Scope.** This protocol covers the *code-quality* lens: architecture
|
|
12
|
+
> (Tier 1) and hygiene (Tier 2). Security, accessibility, privacy and
|
|
13
|
+
> dependency / supply-chain concerns are owned by the kit's specialised
|
|
14
|
+
> agents and commands — see *Adjacent concerns* at the foot of
|
|
15
|
+
> `best-practices.md` for the routing.
|
|
16
|
+
>
|
|
17
|
+
> Keep both files in sync with the constitution in `CLAUDE.md` and with
|
|
18
|
+
> `contextkit/config.json` (thresholds and ledger paths).
|
|
19
|
+
|
|
20
|
+
## Severity vocabulary
|
|
21
|
+
|
|
22
|
+
Anchored on the scanner's existing **1..5** scale (used by `tech-debt-scan`
|
|
23
|
+
and its `--ci` gate) so the rubric, the deterministic scan, and the build
|
|
24
|
+
gate stay aligned. Inventing a parallel scale would drift them apart.
|
|
25
|
+
|
|
26
|
+
| Label | Scanner sev | Meaning |
|
|
27
|
+
| ----------- | :---------: | ------------------------------------------------------ |
|
|
28
|
+
| `BLOCKER` | 5 | Fix before merge. Fails `tech-debt-scan --ci`. |
|
|
29
|
+
| `HARD` | 4 | Clear violation, no cohesion excuse. Fix it. |
|
|
30
|
+
| `CANDIDATE` | 2–3 | Judgment call; may be justified. Explain the tradeoff. |
|
|
31
|
+
| `NIT` | 1 | Mention once, don't litigate. |
|
|
32
|
+
|
|
33
|
+
Mapping rules of thumb:
|
|
34
|
+
|
|
35
|
+
- A **Tier 1** (architecture) finding is typically `HARD` — the cost of
|
|
36
|
+
leaving it grows fast. Downgrade to `CANDIDATE` only when the affected
|
|
37
|
+
surface is genuinely small and isolated.
|
|
38
|
+
- A **Tier 2** (hygiene) finding starts at `CANDIDATE` and rises to `HARD`
|
|
39
|
+
only when the over-apply clause has been considered and rejected, or to
|
|
40
|
+
`BLOCKER` when the scanner already emits severity 5 (e.g. `> 308` lines —
|
|
41
|
+
the project's line-budget RED zone, configurable in `contextkit/config.json
|
|
42
|
+
→ l5.lineBudget`).
|
|
43
|
+
- For **security findings**, dispatch the security-team — see *Adjacent
|
|
44
|
+
concerns* in `best-practices.md`. The severity vocabulary here applies
|
|
45
|
+
inside the rubric's lane only.
|
|
46
|
+
|
|
47
|
+
## When this rubric applies
|
|
48
|
+
|
|
49
|
+
Rigor must match the stakes, or it's either waste or negligence.
|
|
50
|
+
|
|
51
|
+
- **Production paths** (anything shipped to users, anything that holds real
|
|
52
|
+
data): the full rubric applies.
|
|
53
|
+
- **Spikes & throwaways** (prototypes, scratch directories like
|
|
54
|
+
`/experiments` or `/spikes`, code you will delete within the week):
|
|
55
|
+
**Tier 2 hygiene and tests are relaxed.** Don't demand JSDoc or coverage
|
|
56
|
+
on code that isn't going to survive. Naming and obvious-error handling
|
|
57
|
+
still matter — but the documentation/tests bar drops.
|
|
58
|
+
- **Tier 1 (architecture)** sits in the middle. A three-file script doesn't
|
|
59
|
+
need a hexagonal architecture; an app with a real domain does. The
|
|
60
|
+
*direction* of dependencies still matters at any size — the *depth* of
|
|
61
|
+
layering scales with complexity.
|
|
62
|
+
|
|
63
|
+
## Running the analysis
|
|
64
|
+
|
|
65
|
+
How `/analyze-code-ia-practices` should behave once the scanner has run.
|
|
66
|
+
|
|
67
|
+
1. **Read both rubric files first** (`best-practices.md` and this protocol).
|
|
68
|
+
Use the project's `l5.lineBudget` thresholds from `contextkit/config.json`
|
|
69
|
+
(defaults: `yellow: 240`, `red: 308`).
|
|
70
|
+
|
|
71
|
+
2. **Run the deterministic scan:**
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
node contextkit/tools/scripts/tech-debt-scan.mjs --json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The scan surfaces mechanical signal — oversized files, "And/Or/E"
|
|
78
|
+
identifier names, TODO/FIXME/HACK/XXX markers, and (in React/JSX
|
|
79
|
+
projects only) `useState`/`useEffect` loops. That is the *floor* of the
|
|
80
|
+
report, not the ceiling.
|
|
81
|
+
|
|
82
|
+
3. **Apply judgment the regex can't, in tier order:**
|
|
83
|
+
|
|
84
|
+
- **Tier 1 first.** Read the code: does the domain depend on
|
|
85
|
+
infrastructure? Are boundaries respected? Any circular imports or
|
|
86
|
+
fan-out monsters? Where does state actually live, and does it live
|
|
87
|
+
once?
|
|
88
|
+
- **Tier 2 next.** Walk the scanner findings; for each file, decide the
|
|
89
|
+
*right* fix per H1's preference list (extract a unit with one job,
|
|
90
|
+
promote inline render functions, lift complex state into a hook,
|
|
91
|
+
separate layers), not "split at random."
|
|
92
|
+
|
|
93
|
+
4. **Lead with the right fix, per file.** Name the concrete refactor
|
|
94
|
+
("extract the `OrderRepo` port", "lift this state into a hook", "move
|
|
95
|
+
business math out of the route handler") rather than "this is too big."
|
|
96
|
+
A Tier-1 finding usually reframes the Tier-2 ones — don't lead with
|
|
97
|
+
"this file is 320 lines" when the real story is "the domain imports the
|
|
98
|
+
persistence client."
|
|
99
|
+
|
|
100
|
+
5. **Honor each rule's "Don't over-apply" clause.** If the clause covers
|
|
101
|
+
the case, say so and move on. Manufactured findings cost more trust
|
|
102
|
+
than they save.
|
|
103
|
+
|
|
104
|
+
6. **Silence is a valid result.** Clean code gets a clean bill. Do not
|
|
105
|
+
manufacture findings to look thorough.
|
|
106
|
+
|
|
107
|
+
7. **Route adjacent concerns out, don't smuggle them in.** If during the
|
|
108
|
+
pass you spot a security/accessibility/privacy/dependency issue, name
|
|
109
|
+
it briefly and dispatch the relevant agent/command (see *Adjacent
|
|
110
|
+
concerns* in `best-practices.md`). Don't expand the rubric's lane.
|
|
111
|
+
|
|
112
|
+
8. **Feed the DevPipeline backlog** with the surviving items,
|
|
113
|
+
auto-prioritised by severity (BLOCKER → P0, HARD → P1, CANDIDATE → P2,
|
|
114
|
+
NIT → P3):
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
node contextkit/tools/scripts/pipeline.mjs add --type chore --priority <P> \
|
|
118
|
+
--source "practices:<file>" --title "<short fix description>"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`--source` keeps re-runs idempotent. Priorities remain editable
|
|
122
|
+
(`/pipeline` or `pipeline.mjs prioritize <id> <P>`).
|
|
123
|
+
|
|
124
|
+
9. **Do not refactor in this command** — it is analysis. Offer to open a
|
|
125
|
+
focused `/dev-start "refactor <file> by responsibility"` (or `/ship`)
|
|
126
|
+
on the top item if the user wants to act.
|
|
127
|
+
|
|
128
|
+
## Report shape
|
|
129
|
+
|
|
130
|
+
Each finding follows the same shape so reports are scannable and sortable:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
path:line — TIER/§ID — SEVERITY — what's wrong — proposed fix
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Example findings:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
src/api/orders.ts:142 — TIER1/S1 — HARD — controller imports DB client directly — extract an OrderRepo port; inject from edge
|
|
140
|
+
src/state/cart.ts:88 — TIER1/S4 — HARD — cart total cached in 3 components, drifting — derive from one source (one query hook)
|
|
141
|
+
src/ui/Dashboard.tsx — TIER2/H1 — BLOCKER — 412 lines (> 308) — extract `useDashboardData` hook + promote `renderHeader` to component
|
|
142
|
+
src/lib/helpers.ts:8 — TIER2/H5 — NIT — `arr` carries meaning here — rename to `pendingInvoices`
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Sort by:** tier (1 → 2), then severity (5 → 1), then **blast radius** —
|
|
146
|
+
how far the smell spreads (how many call sites, how exposed the code path
|
|
147
|
+
is). A `BLOCKER` on a widely-imported module beats a `BLOCKER` on a leaf
|
|
148
|
+
utility.
|
|
149
|
+
|
|
150
|
+
Group findings by file in the final report so the human sees the *file's*
|
|
151
|
+
story, not a flat list.
|
|
152
|
+
|
|
153
|
+
## Scanner map — what's mechanical vs. what needs judgment
|
|
154
|
+
|
|
155
|
+
The deterministic scanner (`tech-debt-scan.mjs`) owns the mechanical
|
|
156
|
+
signal; the agent owns everything that needs judgment. The split is honest
|
|
157
|
+
— the rubric does not promise enforcement the scanner cannot deliver.
|
|
158
|
+
|
|
159
|
+
### Scanner (regex, cheap, exact — runs today)
|
|
160
|
+
|
|
161
|
+
| Detector | Rule informed | Sev | Notes |
|
|
162
|
+
| ---------------------- | ----------------- | :----: | -------------------------------------------- |
|
|
163
|
+
| `detectLineBudget` | H1 | 3 / 5 | Yellow ≥ 240, RED > 308 (configurable). |
|
|
164
|
+
| `detectSrpAnd` | H2 | 2 | JS/TS `And`/`Or`/`E`; Python `_and_`/`_or_`. |
|
|
165
|
+
| `detectReactStateLoop` | H3 (React/JSX) | 3 | `> 2 useState + ≥ 1 useEffect`; no-op elsewhere. |
|
|
166
|
+
| `detectTodoMarkers` | H4 / H6 (debt) | 1 | `TODO`/`FIXME`/`HACK`/`XXX` in comments. |
|
|
167
|
+
|
|
168
|
+
The scanner auto-restricts each detector by file extension; in a project
|
|
169
|
+
with no React, `detectReactStateLoop` is a silent no-op. That is what makes
|
|
170
|
+
the kit stack-agnostic in practice, not just in principle.
|
|
171
|
+
|
|
172
|
+
**Custom detectors** drop into `contextkit/detectors/*.mjs` and are
|
|
173
|
+
auto-loaded. A broken custom detector is skipped, never blocks the scan
|
|
174
|
+
(constitution, rule 2 — "hooks never break real work").
|
|
175
|
+
|
|
176
|
+
**`--ci` gate** fails the build on any severity-5 finding. This is the
|
|
177
|
+
hard line the project will not regress past.
|
|
178
|
+
|
|
179
|
+
**Plug-in slot is the right place for stack-specific detectors** (e.g. a
|
|
180
|
+
project that wants to detect its specific ORM's misuse, or a particular
|
|
181
|
+
secret-naming convention) — add a `*.mjs` file under `contextkit/detectors/`
|
|
182
|
+
exporting a `default` function or a `detectors` array. The kit ships zero
|
|
183
|
+
stack-specific detectors on purpose (constitution, rule 9 — templates
|
|
184
|
+
carry no invented domain content).
|
|
185
|
+
|
|
186
|
+
### Agent only — judgment, no regex can do it
|
|
187
|
+
|
|
188
|
+
- **All of Tier 1** (S1 dependency direction, S2 boundaries, S3 coupling
|
|
189
|
+
and cycles, S4 state location). These require reading import graphs and
|
|
190
|
+
understanding intent, not pattern-matching strings.
|
|
191
|
+
- **Whether a flagged H1 size is cohesion or rot.** The scanner sees 312
|
|
192
|
+
lines; only the agent can tell whether they're a dumb constants file or
|
|
193
|
+
a god component.
|
|
194
|
+
- **The right refactor per file.** "Extract `X`", "lift state into a
|
|
195
|
+
hook", "promote `renderY` to a component" — these are H1's *Fix*
|
|
196
|
+
preference list, not the scanner's job.
|
|
197
|
+
- **Whether a Tier-2 violation is relaxable** because the file is a spike
|
|
198
|
+
or throwaway (see *When this rubric applies*).
|
|
199
|
+
|
|
200
|
+
### What this protocol deliberately does not promise
|
|
201
|
+
|
|
202
|
+
- **No `// context-allow §ID: reason` pragma** — not implemented in the
|
|
203
|
+
scanner. If you find one in someone's proposal, it is aspirational, not
|
|
204
|
+
honored. (Rule 9: don't ship a speculative half. A future ADR may add it
|
|
205
|
+
as an atomic change: detector + selfcheck assertion + this doc.)
|
|
206
|
+
- **No import-cycle, secret-pattern, or `any`-counter detection in the
|
|
207
|
+
kit's default set.** These belong in custom detectors a project adds for
|
|
208
|
+
itself, or in future ADRs that ship them properly with tests.
|
|
209
|
+
- **No security/AppSec coverage in this rubric.** That is the security-team's
|
|
210
|
+
lane: `code-security`, `security`, `infra-security` agents; `/audit`,
|
|
211
|
+
`/deps-audit`, `/security-setup` commands.
|
|
212
|
+
|
|
213
|
+
Keep this map and `contextkit/config.json` in agreement; keep the whole pair
|
|
214
|
+
of files in sync with `CLAUDE.md` and `best-practices.md`.
|