@ktpartners/dgs-platform 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +38 -0
- package/README.md +851 -0
- package/agents/dgs-codebase-cross-analyzer.md +183 -0
- package/agents/dgs-codebase-mapper.md +782 -0
- package/agents/dgs-codebase-synthesizer.md +156 -0
- package/agents/dgs-debugger.md +1256 -0
- package/agents/dgs-executor.md +550 -0
- package/agents/dgs-integration-checker.md +481 -0
- package/agents/dgs-nyquist-auditor.md +178 -0
- package/agents/dgs-phase-researcher.md +563 -0
- package/agents/dgs-phase-verifier.md +450 -0
- package/agents/dgs-plan-checker.md +708 -0
- package/agents/dgs-planner.md +1324 -0
- package/agents/dgs-project-researcher.md +631 -0
- package/agents/dgs-research-synthesizer.md +249 -0
- package/agents/dgs-roadmapper.md +652 -0
- package/agents/dgs-verifier.md +607 -0
- package/bin/install.js +2073 -0
- package/commands/dgs/add-doc.md +45 -0
- package/commands/dgs/add-idea.md +38 -0
- package/commands/dgs/add-phase.md +43 -0
- package/commands/dgs/add-repo.md +54 -0
- package/commands/dgs/add-tests.md +41 -0
- package/commands/dgs/add-todo.md +47 -0
- package/commands/dgs/approve-spec.md +38 -0
- package/commands/dgs/audit-milestone.md +36 -0
- package/commands/dgs/audit-phase.md +37 -0
- package/commands/dgs/cancel-job.md +23 -0
- package/commands/dgs/capture-principle.md +143 -0
- package/commands/dgs/check-todos.md +45 -0
- package/commands/dgs/cleanup.md +18 -0
- package/commands/dgs/complete-milestone.md +136 -0
- package/commands/dgs/complete-project.md +70 -0
- package/commands/dgs/consolidate-ideas.md +50 -0
- package/commands/dgs/create-milestone-job.md +37 -0
- package/commands/dgs/debug.md +164 -0
- package/commands/dgs/develop-idea.md +53 -0
- package/commands/dgs/discuss-idea.md +41 -0
- package/commands/dgs/discuss-phase.md +83 -0
- package/commands/dgs/execute-phase.md +41 -0
- package/commands/dgs/fast.md +38 -0
- package/commands/dgs/find-related-ideas.md +43 -0
- package/commands/dgs/health.md +28 -0
- package/commands/dgs/help.md +22 -0
- package/commands/dgs/import-spec.md +36 -0
- package/commands/dgs/init-product.md +28 -0
- package/commands/dgs/insert-phase.md +32 -0
- package/commands/dgs/join-discord.md +18 -0
- package/commands/dgs/list-docs.md +40 -0
- package/commands/dgs/list-ideas.md +42 -0
- package/commands/dgs/list-jobs.md +22 -0
- package/commands/dgs/list-phase-assumptions.md +46 -0
- package/commands/dgs/list-projects.md +57 -0
- package/commands/dgs/list-specs.md +40 -0
- package/commands/dgs/map-codebase.md +92 -0
- package/commands/dgs/new-milestone.md +44 -0
- package/commands/dgs/new-project.md +42 -0
- package/commands/dgs/node-repair.md +26 -0
- package/commands/dgs/overlap-check.md +20 -0
- package/commands/dgs/pause-work.md +38 -0
- package/commands/dgs/plan-milestone-gaps.md +34 -0
- package/commands/dgs/plan-phase.md +44 -0
- package/commands/dgs/progress.md +24 -0
- package/commands/dgs/quick.md +41 -0
- package/commands/dgs/reactivate-project.md +70 -0
- package/commands/dgs/reapply-patches.md +110 -0
- package/commands/dgs/refine-spec.md +38 -0
- package/commands/dgs/reject-idea.md +43 -0
- package/commands/dgs/remove-doc.md +44 -0
- package/commands/dgs/remove-phase.md +31 -0
- package/commands/dgs/remove-repo.md +69 -0
- package/commands/dgs/research-idea.md +43 -0
- package/commands/dgs/research-phase.md +189 -0
- package/commands/dgs/restore-idea.md +45 -0
- package/commands/dgs/resume-work.md +40 -0
- package/commands/dgs/rollback-job.md +24 -0
- package/commands/dgs/run-job.md +35 -0
- package/commands/dgs/search.md +40 -0
- package/commands/dgs/set-profile.md +34 -0
- package/commands/dgs/settings.md +38 -0
- package/commands/dgs/switch-project.md +58 -0
- package/commands/dgs/undo-consolidation.md +42 -0
- package/commands/dgs/update-idea.md +44 -0
- package/commands/dgs/update.md +37 -0
- package/commands/dgs/validate-phase.md +35 -0
- package/commands/dgs/verify-work.md +39 -0
- package/commands/dgs/write-spec.md +49 -0
- package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-01-SUMMARY.md +84 -0
- package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-02-SUMMARY.md +86 -0
- package/deliver-great-systems/.planning/phases/10-v1-to-v2-migration-flow/10-01-SUMMARY.md +85 -0
- package/deliver-great-systems/bin/dgs-tools.cjs +1444 -0
- package/deliver-great-systems/bin/lib/auto-test.cjs +1365 -0
- package/deliver-great-systems/bin/lib/commands.cjs +570 -0
- package/deliver-great-systems/bin/lib/config.cjs +417 -0
- package/deliver-great-systems/bin/lib/conflict-agent.cjs +1063 -0
- package/deliver-great-systems/bin/lib/conflict-agent.test.cjs +554 -0
- package/deliver-great-systems/bin/lib/context.cjs +929 -0
- package/deliver-great-systems/bin/lib/context.test.cjs +693 -0
- package/deliver-great-systems/bin/lib/core.cjs +744 -0
- package/deliver-great-systems/bin/lib/core.test.cjs +822 -0
- package/deliver-great-systems/bin/lib/docs.cjs +919 -0
- package/deliver-great-systems/bin/lib/docs.test.cjs +211 -0
- package/deliver-great-systems/bin/lib/execution.cjs +705 -0
- package/deliver-great-systems/bin/lib/execution.test.cjs +1472 -0
- package/deliver-great-systems/bin/lib/frontmatter.cjs +324 -0
- package/deliver-great-systems/bin/lib/ideas.cjs +1406 -0
- package/deliver-great-systems/bin/lib/ideas.test.cjs +1417 -0
- package/deliver-great-systems/bin/lib/identity.cjs +125 -0
- package/deliver-great-systems/bin/lib/init.cjs +1114 -0
- package/deliver-great-systems/bin/lib/init.test.cjs +1271 -0
- package/deliver-great-systems/bin/lib/jobs.cjs +2015 -0
- package/deliver-great-systems/bin/lib/jobs.test.cjs +2619 -0
- package/deliver-great-systems/bin/lib/merge-conflicts.cjs +654 -0
- package/deliver-great-systems/bin/lib/merge-conflicts.test.cjs +370 -0
- package/deliver-great-systems/bin/lib/migration.cjs +352 -0
- package/deliver-great-systems/bin/lib/migration.test.cjs +582 -0
- package/deliver-great-systems/bin/lib/milestone.cjs +243 -0
- package/deliver-great-systems/bin/lib/overlap.cjs +437 -0
- package/deliver-great-systems/bin/lib/overlap.test.cjs +747 -0
- package/deliver-great-systems/bin/lib/path-audit.test.cjs +384 -0
- package/deliver-great-systems/bin/lib/paths.cjs +144 -0
- package/deliver-great-systems/bin/lib/paths.test.cjs +486 -0
- package/deliver-great-systems/bin/lib/phase.cjs +910 -0
- package/deliver-great-systems/bin/lib/projects.cjs +691 -0
- package/deliver-great-systems/bin/lib/projects.test.cjs +871 -0
- package/deliver-great-systems/bin/lib/repos.cjs +1432 -0
- package/deliver-great-systems/bin/lib/repos.test.cjs +1882 -0
- package/deliver-great-systems/bin/lib/roadmap.cjs +305 -0
- package/deliver-great-systems/bin/lib/search.cjs +570 -0
- package/deliver-great-systems/bin/lib/specs.cjs +1303 -0
- package/deliver-great-systems/bin/lib/state.cjs +893 -0
- package/deliver-great-systems/bin/lib/template.cjs +228 -0
- package/deliver-great-systems/bin/lib/test-helpers.cjs +291 -0
- package/deliver-great-systems/bin/lib/verify.cjs +796 -0
- package/deliver-great-systems/references/checkpoints.md +776 -0
- package/deliver-great-systems/references/conflict-resolution.md +66 -0
- package/deliver-great-systems/references/context-tiers.md +166 -0
- package/deliver-great-systems/references/continuation-format.md +249 -0
- package/deliver-great-systems/references/decimal-phase-calculation.md +67 -0
- package/deliver-great-systems/references/git-integration.md +250 -0
- package/deliver-great-systems/references/git-planning-commit.md +40 -0
- package/deliver-great-systems/references/model-profile-resolution.md +36 -0
- package/deliver-great-systems/references/model-profiles.md +95 -0
- package/deliver-great-systems/references/phase-argument-parsing.md +61 -0
- package/deliver-great-systems/references/planning-config.md +224 -0
- package/deliver-great-systems/references/questioning.md +162 -0
- package/deliver-great-systems/references/spec-review-loop.md +177 -0
- package/deliver-great-systems/references/tdd.md +265 -0
- package/deliver-great-systems/references/ui-brand.md +160 -0
- package/deliver-great-systems/references/verification-patterns.md +612 -0
- package/deliver-great-systems/templates/DEBUG.md +166 -0
- package/deliver-great-systems/templates/UAT.md +251 -0
- package/deliver-great-systems/templates/VALIDATION.md +95 -0
- package/deliver-great-systems/templates/claude-md.md +74 -0
- package/deliver-great-systems/templates/codebase/architecture.md +257 -0
- package/deliver-great-systems/templates/codebase/concerns.md +312 -0
- package/deliver-great-systems/templates/codebase/conventions.md +309 -0
- package/deliver-great-systems/templates/codebase/integrations.md +282 -0
- package/deliver-great-systems/templates/codebase/stack.md +188 -0
- package/deliver-great-systems/templates/codebase/structure.md +287 -0
- package/deliver-great-systems/templates/codebase/testing.md +482 -0
- package/deliver-great-systems/templates/config.json +38 -0
- package/deliver-great-systems/templates/context.md +354 -0
- package/deliver-great-systems/templates/continue-here.md +80 -0
- package/deliver-great-systems/templates/debug-subagent-prompt.md +93 -0
- package/deliver-great-systems/templates/discovery.md +148 -0
- package/deliver-great-systems/templates/milestone-archive.md +125 -0
- package/deliver-great-systems/templates/milestone.md +117 -0
- package/deliver-great-systems/templates/phase-prompt.md +615 -0
- package/deliver-great-systems/templates/planner-subagent-prompt.md +119 -0
- package/deliver-great-systems/templates/project.md +186 -0
- package/deliver-great-systems/templates/requirements.md +233 -0
- package/deliver-great-systems/templates/research-project/ARCHITECTURE.md +206 -0
- package/deliver-great-systems/templates/research-project/FEATURES.md +149 -0
- package/deliver-great-systems/templates/research-project/PITFALLS.md +202 -0
- package/deliver-great-systems/templates/research-project/STACK.md +122 -0
- package/deliver-great-systems/templates/research-project/SUMMARY.md +172 -0
- package/deliver-great-systems/templates/research.md +554 -0
- package/deliver-great-systems/templates/retrospective.md +54 -0
- package/deliver-great-systems/templates/roadmap.md +204 -0
- package/deliver-great-systems/templates/state.md +178 -0
- package/deliver-great-systems/templates/summary-complex.md +59 -0
- package/deliver-great-systems/templates/summary-minimal.md +41 -0
- package/deliver-great-systems/templates/summary-standard.md +48 -0
- package/deliver-great-systems/templates/summary.md +253 -0
- package/deliver-great-systems/templates/user-setup.md +313 -0
- package/deliver-great-systems/templates/verification-report.md +324 -0
- package/deliver-great-systems/workflows/add-doc.md +151 -0
- package/deliver-great-systems/workflows/add-idea.md +96 -0
- package/deliver-great-systems/workflows/add-phase.md +120 -0
- package/deliver-great-systems/workflows/add-tests.md +359 -0
- package/deliver-great-systems/workflows/add-todo.md +162 -0
- package/deliver-great-systems/workflows/approve-spec.md +194 -0
- package/deliver-great-systems/workflows/audit-milestone.md +364 -0
- package/deliver-great-systems/workflows/audit-phase.md +462 -0
- package/deliver-great-systems/workflows/cancel-job.md +108 -0
- package/deliver-great-systems/workflows/check-todos.md +181 -0
- package/deliver-great-systems/workflows/cleanup.md +247 -0
- package/deliver-great-systems/workflows/codereview.md +526 -0
- package/deliver-great-systems/workflows/complete-milestone.md +1298 -0
- package/deliver-great-systems/workflows/consolidate-ideas.md +365 -0
- package/deliver-great-systems/workflows/create-milestone-job.md +177 -0
- package/deliver-great-systems/workflows/develop-idea.md +544 -0
- package/deliver-great-systems/workflows/diagnose-issues.md +231 -0
- package/deliver-great-systems/workflows/discovery-phase.md +301 -0
- package/deliver-great-systems/workflows/discuss-idea.md +263 -0
- package/deliver-great-systems/workflows/discuss-phase.md +733 -0
- package/deliver-great-systems/workflows/execute-phase.md +571 -0
- package/deliver-great-systems/workflows/execute-plan.md +592 -0
- package/deliver-great-systems/workflows/find-related-ideas.md +271 -0
- package/deliver-great-systems/workflows/health.md +173 -0
- package/deliver-great-systems/workflows/help.md +997 -0
- package/deliver-great-systems/workflows/import-spec.md +381 -0
- package/deliver-great-systems/workflows/init-product.md +767 -0
- package/deliver-great-systems/workflows/insert-phase.md +138 -0
- package/deliver-great-systems/workflows/list-docs.md +119 -0
- package/deliver-great-systems/workflows/list-ideas.md +154 -0
- package/deliver-great-systems/workflows/list-jobs.md +89 -0
- package/deliver-great-systems/workflows/list-phase-assumptions.md +192 -0
- package/deliver-great-systems/workflows/list-specs.md +101 -0
- package/deliver-great-systems/workflows/map-codebase.md +621 -0
- package/deliver-great-systems/workflows/new-milestone.md +591 -0
- package/deliver-great-systems/workflows/new-project.md +1113 -0
- package/deliver-great-systems/workflows/node-repair.md +94 -0
- package/deliver-great-systems/workflows/overlap-check.md +86 -0
- package/deliver-great-systems/workflows/pause-work.md +134 -0
- package/deliver-great-systems/workflows/plan-milestone-gaps.md +306 -0
- package/deliver-great-systems/workflows/plan-phase.md +698 -0
- package/deliver-great-systems/workflows/progress.md +386 -0
- package/deliver-great-systems/workflows/quick.md +845 -0
- package/deliver-great-systems/workflows/refine-spec.md +275 -0
- package/deliver-great-systems/workflows/reject-idea.md +109 -0
- package/deliver-great-systems/workflows/remove-doc.md +117 -0
- package/deliver-great-systems/workflows/remove-phase.md +163 -0
- package/deliver-great-systems/workflows/research-idea.md +325 -0
- package/deliver-great-systems/workflows/research-phase.md +81 -0
- package/deliver-great-systems/workflows/restore-idea.md +101 -0
- package/deliver-great-systems/workflows/resume-project.md +311 -0
- package/deliver-great-systems/workflows/rollback-job.md +130 -0
- package/deliver-great-systems/workflows/run-job.md +498 -0
- package/deliver-great-systems/workflows/search.md +130 -0
- package/deliver-great-systems/workflows/set-profile.md +83 -0
- package/deliver-great-systems/workflows/settings.md +470 -0
- package/deliver-great-systems/workflows/transition.md +563 -0
- package/deliver-great-systems/workflows/undo-consolidation.md +155 -0
- package/deliver-great-systems/workflows/update-idea.md +157 -0
- package/deliver-great-systems/workflows/update.md +242 -0
- package/deliver-great-systems/workflows/validate-phase.md +177 -0
- package/deliver-great-systems/workflows/verify-phase.md +253 -0
- package/deliver-great-systems/workflows/verify-work.md +671 -0
- package/deliver-great-systems/workflows/write-spec.md +450 -0
- package/hooks/dist/dgs-check-update.js +62 -0
- package/hooks/dist/dgs-context-monitor.js +141 -0
- package/hooks/dist/dgs-statusline.js +115 -0
- package/package.json +60 -0
- package/scripts/build-hooks.js +43 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Multi-agent code review that runs 3 passes of 3 parallel agents each (9 total reviews) against the diff produced by a plan execution. Auto-fixes low-risk issues in a separate commit. Logs ambiguous CRITICAL/HIGH findings as deviations rather than prompting the user (non-interactive mode).
|
|
3
|
+
</purpose>
|
|
4
|
+
|
|
5
|
+
<context_tier>none</context_tier>
|
|
6
|
+
|
|
7
|
+
<inputs>
|
|
8
|
+
- PHASE: phase identifier
|
|
9
|
+
- PLAN: plan number
|
|
10
|
+
- PLAN_PATH: path to the PLAN.md file
|
|
11
|
+
- PHASE_DIR: phase directory path
|
|
12
|
+
- DIFF_REF: git ref range for the code diff (from first task commit to HEAD)
|
|
13
|
+
</inputs>
|
|
14
|
+
|
|
15
|
+
<process>
|
|
16
|
+
|
|
17
|
+
<step name="compute_diff">
|
|
18
|
+
Compute the diff from the plan's task commits.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
FIRST_TASK_COMMIT=$(git log --oneline --grep="feat(${PHASE}-${PLAN}):" --grep="fix(${PHASE}-${PLAN}):" --grep="test(${PHASE}-${PLAN}):" --grep="refactor(${PHASE}-${PLAN}):" --reverse | head -1 | cut -d' ' -f1)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If FIRST_TASK_COMMIT is empty, exit with message: "No task commits found for ${PHASE}-${PLAN}, skipping code review."
|
|
25
|
+
|
|
26
|
+
Otherwise, compute the full diff:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
REVIEW_DIFF=$(git diff ${FIRST_TASK_COMMIT}^..HEAD)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Store REVIEW_DIFF for use by all review agents. Also store the file list:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
CHANGED_FILES=$(git diff --name-only ${FIRST_TASK_COMMIT}^..HEAD)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Display:
|
|
39
|
+
```
|
|
40
|
+
Reviewing ${PHASE}-${PLAN} changes:
|
|
41
|
+
Files changed: $(echo "$CHANGED_FILES" | wc -l | tr -d ' ')
|
|
42
|
+
Diff size: $(echo "$REVIEW_DIFF" | wc -l | tr -d ' ') lines
|
|
43
|
+
```
|
|
44
|
+
</step>
|
|
45
|
+
|
|
46
|
+
<step name="pass_1_foundational">
|
|
47
|
+
**Pass 1: Foundational Review** -- Spawn 3 parallel Task() subagents.
|
|
48
|
+
|
|
49
|
+
Each agent receives REVIEW_DIFF and CHANGED_FILES as input context.
|
|
50
|
+
|
|
51
|
+
**Agent 1A: Correctness and Security**
|
|
52
|
+
|
|
53
|
+
Review REVIEW_DIFF for:
|
|
54
|
+
- Logic errors, off-by-one mistakes, incorrect conditionals
|
|
55
|
+
- Null/undefined hazards, unhandled promise rejections
|
|
56
|
+
- SQL injection, XSS, command injection
|
|
57
|
+
- Auth bypass, missing authorization checks
|
|
58
|
+
- Secret exposure (hardcoded keys, tokens, passwords)
|
|
59
|
+
- Race conditions, deadlocks
|
|
60
|
+
- Memory leaks, resource cleanup
|
|
61
|
+
|
|
62
|
+
Output: Structured findings list with fields:
|
|
63
|
+
- id: "1A-{N}"
|
|
64
|
+
- severity: critical | high | medium | low
|
|
65
|
+
- category: correctness | security
|
|
66
|
+
- file: file path
|
|
67
|
+
- line: line number or range
|
|
68
|
+
- title: brief description
|
|
69
|
+
- description: detailed explanation
|
|
70
|
+
- suggestion: recommended fix
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
**Agent 1B: Standards and Patterns**
|
|
75
|
+
|
|
76
|
+
Review REVIEW_DIFF against the plan's `<context>` file patterns for:
|
|
77
|
+
- Naming conventions (variables, functions, files)
|
|
78
|
+
- Import patterns (ordering, path style)
|
|
79
|
+
- Error handling style (try/catch vs Result types vs error callbacks)
|
|
80
|
+
- Code organization (module boundaries, file structure)
|
|
81
|
+
- Type safety (any usage, missing types, loose generics)
|
|
82
|
+
- Consistency with existing codebase patterns
|
|
83
|
+
|
|
84
|
+
If a codebase/ map exists at ${project_root}/codebase/, reference CONVENTIONS.md for established patterns.
|
|
85
|
+
|
|
86
|
+
Output: Structured findings list with fields:
|
|
87
|
+
- id: "1B-{N}"
|
|
88
|
+
- severity: critical | high | medium | low
|
|
89
|
+
- category: standards | patterns
|
|
90
|
+
- file, line, title, description, suggestion
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
**Agent 1C: Simplification and Over-engineering**
|
|
95
|
+
|
|
96
|
+
Review REVIEW_DIFF for:
|
|
97
|
+
- Unnecessary abstractions (wrapper classes with no added value)
|
|
98
|
+
- Premature optimization (caching before profiling, complex algorithms for small data)
|
|
99
|
+
- Dead code (unreachable branches, unused imports, commented-out code)
|
|
100
|
+
- Overly clever solutions (prefer readable over clever)
|
|
101
|
+
- Things that could be simpler (fewer indirection layers, simpler data structures)
|
|
102
|
+
- YAGNI violations (features built but not needed by the plan)
|
|
103
|
+
|
|
104
|
+
Output: Structured findings list with fields:
|
|
105
|
+
- id: "1C-{N}"
|
|
106
|
+
- severity: critical | high | medium | low
|
|
107
|
+
- category: simplification | over-engineering
|
|
108
|
+
- file, line, title, description, suggestion
|
|
109
|
+
</step>
|
|
110
|
+
|
|
111
|
+
<step name="pass_2_integration">
|
|
112
|
+
**Pass 2: Integration Review** -- Spawn 3 parallel Task() subagents.
|
|
113
|
+
|
|
114
|
+
Each agent receives REVIEW_DIFF, CHANGED_FILES, and all Pass 1 findings as input context.
|
|
115
|
+
|
|
116
|
+
**Agent 2A: Fix Verification**
|
|
117
|
+
|
|
118
|
+
For each auto-fixable finding from Pass 1 (severity medium or low with a clear fix), propose a concrete code change.
|
|
119
|
+
|
|
120
|
+
Output: List of proposed fixes with fields:
|
|
121
|
+
- finding_ref: reference to Pass 1 finding id (e.g., "1B-3")
|
|
122
|
+
- file: file path
|
|
123
|
+
- line_range: start-end lines
|
|
124
|
+
- current_code: the code as it exists
|
|
125
|
+
- proposed_fix: the corrected code
|
|
126
|
+
- rationale: why this fix is safe
|
|
127
|
+
- risk: low (formatting, naming) | medium (logic change)
|
|
128
|
+
|
|
129
|
+
Only propose fixes where:
|
|
130
|
+
- The change is unambiguous
|
|
131
|
+
- Risk is low (no behavioral change) or the fix is clearly correct
|
|
132
|
+
- The fix does not alter public API contracts
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
**Agent 2B: Integration and Flow**
|
|
137
|
+
|
|
138
|
+
Review REVIEW_DIFF for:
|
|
139
|
+
- Broken imports (referencing files that don't exist or wrong paths)
|
|
140
|
+
- Missing exports (used by other files but not exported)
|
|
141
|
+
- Type mismatches across file boundaries
|
|
142
|
+
- API contract violations (calling functions with wrong signatures)
|
|
143
|
+
- State management issues (stale state, missing synchronization)
|
|
144
|
+
- Circular dependencies
|
|
145
|
+
- Environment/config coupling issues
|
|
146
|
+
|
|
147
|
+
Output: Structured findings list with fields:
|
|
148
|
+
- id: "2B-{N}"
|
|
149
|
+
- severity: critical | high | medium | low
|
|
150
|
+
- category: integration | flow
|
|
151
|
+
- file, line, title, description, suggestion
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
**Agent 2C: Test Coverage**
|
|
156
|
+
|
|
157
|
+
Review REVIEW_DIFF for:
|
|
158
|
+
- Untested branches (if/else without both paths tested)
|
|
159
|
+
- Missing edge case tests (empty arrays, null inputs, boundary values)
|
|
160
|
+
- Test assertions that don't verify behavior (testing implementation details)
|
|
161
|
+
- Mocked-out critical paths (mocking the thing you're supposed to test)
|
|
162
|
+
- Missing error path tests (only happy path tested)
|
|
163
|
+
- Test naming that doesn't describe behavior
|
|
164
|
+
|
|
165
|
+
Output: Structured findings list with fields:
|
|
166
|
+
- id: "2C-{N}"
|
|
167
|
+
- severity: critical | high | medium | low
|
|
168
|
+
- category: test-coverage
|
|
169
|
+
- file, line, title, description, suggestion
|
|
170
|
+
</step>
|
|
171
|
+
|
|
172
|
+
<step name="pass_3_final">
|
|
173
|
+
**Pass 3: Final Review** -- Spawn 3 parallel Task() subagents.
|
|
174
|
+
|
|
175
|
+
Each agent receives REVIEW_DIFF, CHANGED_FILES, and all findings from Pass 1 and Pass 2 as input context.
|
|
176
|
+
|
|
177
|
+
**Agent 3A: Fresh Eyes**
|
|
178
|
+
|
|
179
|
+
Re-read REVIEW_DIFF without bias from prior findings. Identify anything missed by the previous 6 agents. Focus on:
|
|
180
|
+
- Subtle bugs that require understanding data flow across multiple functions
|
|
181
|
+
- Edge cases in business logic
|
|
182
|
+
- Assumptions that may not hold in production
|
|
183
|
+
- Missing error messages or unhelpful error messages
|
|
184
|
+
|
|
185
|
+
Output: Net-new findings only (deduplicated against all prior findings). Use fields:
|
|
186
|
+
- id: "3A-{N}"
|
|
187
|
+
- severity: critical | high | medium | low
|
|
188
|
+
- category: fresh-eyes
|
|
189
|
+
- file, line, title, description, suggestion
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
**Agent 3B: Production Readiness**
|
|
194
|
+
|
|
195
|
+
Review for:
|
|
196
|
+
- Error handling completeness (all external calls wrapped, all user inputs validated)
|
|
197
|
+
- Logging adequacy (operations are logged, errors include context)
|
|
198
|
+
- Graceful degradation (what happens when a dependency is down)
|
|
199
|
+
- Configuration externalization (no hardcoded URLs, ports, credentials)
|
|
200
|
+
- Deployment concerns (migration compatibility, backward compatibility)
|
|
201
|
+
- Performance at scale (N+1 queries, unbounded loops, large payload handling)
|
|
202
|
+
|
|
203
|
+
Output: Structured findings list with fields:
|
|
204
|
+
- id: "3B-{N}"
|
|
205
|
+
- severity: critical | high | medium | low
|
|
206
|
+
- category: production-readiness
|
|
207
|
+
- file, line, title, description, suggestion
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
**Agent 3C: Diff Sanity Check**
|
|
212
|
+
|
|
213
|
+
Verify:
|
|
214
|
+
- No debug code left in (console.log, console.debug, debugger statements)
|
|
215
|
+
- No TODO/FIXME/HACK comments in production code
|
|
216
|
+
- No commented-out code blocks (> 3 lines)
|
|
217
|
+
- No accidental file inclusions (lock files, .env, build artifacts, node_modules)
|
|
218
|
+
- Diff size is reasonable (flag if > 1000 lines changed in a single file)
|
|
219
|
+
- No binary files accidentally committed
|
|
220
|
+
- File permissions are correct
|
|
221
|
+
|
|
222
|
+
Output: Structured findings list with fields:
|
|
223
|
+
- id: "3C-{N}"
|
|
224
|
+
- severity: critical | high | medium | low
|
|
225
|
+
- category: sanity-check
|
|
226
|
+
- file, line, title, description, suggestion
|
|
227
|
+
</step>
|
|
228
|
+
|
|
229
|
+
<step name="aggregate_findings">
|
|
230
|
+
Merge all findings from all 3 passes (agents 1A, 1B, 1C, 2A, 2B, 2C, 3A, 3B, 3C).
|
|
231
|
+
|
|
232
|
+
**Deduplication:**
|
|
233
|
+
- Group by file + line range + category
|
|
234
|
+
- If two findings reference the same code location with the same category, keep the one with higher severity
|
|
235
|
+
- If same severity, keep the one with the more specific suggestion
|
|
236
|
+
|
|
237
|
+
**Sort:**
|
|
238
|
+
1. By severity: critical > high > medium > low
|
|
239
|
+
2. Within severity: by file path alphabetically
|
|
240
|
+
3. Within file: by line number ascending
|
|
241
|
+
|
|
242
|
+
**Count totals:**
|
|
243
|
+
- CRITICAL_COUNT
|
|
244
|
+
- HIGH_COUNT
|
|
245
|
+
- MEDIUM_COUNT
|
|
246
|
+
- LOW_COUNT
|
|
247
|
+
- TOTAL_COUNT
|
|
248
|
+
|
|
249
|
+
Display:
|
|
250
|
+
```
|
|
251
|
+
Aggregated findings: ${TOTAL_COUNT} total
|
|
252
|
+
Critical: ${CRITICAL_COUNT}
|
|
253
|
+
High: ${HIGH_COUNT}
|
|
254
|
+
Medium: ${MEDIUM_COUNT}
|
|
255
|
+
Low: ${LOW_COUNT}
|
|
256
|
+
```
|
|
257
|
+
</step>
|
|
258
|
+
|
|
259
|
+
<step name="write_report">
|
|
260
|
+
Create a persistent CODEREVIEW.md file at `${PHASE_DIR}/${PHASE}-${PLAN}-CODEREVIEW.md`.
|
|
261
|
+
|
|
262
|
+
Store the file path as `CODEREVIEW_PATH` for use in subsequent steps:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
CODEREVIEW_PATH="${PHASE_DIR}/${PHASE}-${PLAN}-CODEREVIEW.md"
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Write the file with the following structure:
|
|
269
|
+
|
|
270
|
+
**Frontmatter:**
|
|
271
|
+
```yaml
|
|
272
|
+
---
|
|
273
|
+
phase: {PHASE}
|
|
274
|
+
plan: {PLAN}
|
|
275
|
+
status: pending # Updated to "complete" after apply_auto_fixes
|
|
276
|
+
timestamp: {ISO timestamp of when codereview started}
|
|
277
|
+
stats:
|
|
278
|
+
total: {TOTAL_COUNT}
|
|
279
|
+
critical: {CRITICAL_COUNT}
|
|
280
|
+
high: {HIGH_COUNT}
|
|
281
|
+
medium: {MEDIUM_COUNT}
|
|
282
|
+
low: {LOW_COUNT}
|
|
283
|
+
auto_fixed: 0 # Updated after apply_auto_fixes
|
|
284
|
+
deviations_logged: 0 # Updated after log_deviations
|
|
285
|
+
---
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Body content:**
|
|
289
|
+
|
|
290
|
+
```markdown
|
|
291
|
+
# Code Review: {PHASE}-{PLAN}
|
|
292
|
+
|
|
293
|
+
## Summary
|
|
294
|
+
|
|
295
|
+
| Metric | Count |
|
|
296
|
+
|--------|-------|
|
|
297
|
+
| Total findings | {TOTAL_COUNT} |
|
|
298
|
+
| Critical | {CRITICAL_COUNT} |
|
|
299
|
+
| High | {HIGH_COUNT} |
|
|
300
|
+
| Medium | {MEDIUM_COUNT} |
|
|
301
|
+
| Low | {LOW_COUNT} |
|
|
302
|
+
|
|
303
|
+
## Pass 1: Foundational Review
|
|
304
|
+
|
|
305
|
+
### Critical
|
|
306
|
+
{findings from 1A/1B/1C with severity critical, formatted as:}
|
|
307
|
+
**{id}: {title}** -- `{file}:{line}`
|
|
308
|
+
{description}
|
|
309
|
+
> Suggestion: {suggestion}
|
|
310
|
+
|
|
311
|
+
### High
|
|
312
|
+
{same format}
|
|
313
|
+
|
|
314
|
+
### Medium
|
|
315
|
+
{same format}
|
|
316
|
+
|
|
317
|
+
### Low
|
|
318
|
+
{same format}
|
|
319
|
+
|
|
320
|
+
## Pass 2: Integration Review
|
|
321
|
+
|
|
322
|
+
{Same structure for 2A/2B/2C findings. Note: 2A proposed fixes are listed under their original finding severity, with a "(auto-fixable)" tag if they qualify.}
|
|
323
|
+
|
|
324
|
+
## Pass 3: Final Review
|
|
325
|
+
|
|
326
|
+
{Same structure for 3A/3B/3C findings}
|
|
327
|
+
|
|
328
|
+
## Auto-Fix Results
|
|
329
|
+
|
|
330
|
+
_Pending -- will be updated after auto-fix step._
|
|
331
|
+
|
|
332
|
+
## Deviations Logged
|
|
333
|
+
|
|
334
|
+
_Pending -- will be updated after deviation logging._
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
For each pass section, if no findings exist for a severity level, omit that severity heading. If no findings exist for an entire pass, write: "No findings."
|
|
338
|
+
</step>
|
|
339
|
+
|
|
340
|
+
<step name="apply_auto_fixes">
|
|
341
|
+
Take the proposed fixes from Agent 2A.
|
|
342
|
+
|
|
343
|
+
**Apply ONLY fixes that meet ALL criteria:**
|
|
344
|
+
- Severity is medium or low
|
|
345
|
+
- Single-line or small-scope changes (< 5 lines)
|
|
346
|
+
- No behavioral change (formatting, naming, simple null checks, missing return types, import ordering)
|
|
347
|
+
- Risk rated as "low" by Agent 2A
|
|
348
|
+
|
|
349
|
+
**Process:**
|
|
350
|
+
1. For each qualifying fix:
|
|
351
|
+
a. Read the target file
|
|
352
|
+
b. Verify the current_code matches what is actually in the file
|
|
353
|
+
c. Apply the proposed_fix
|
|
354
|
+
d. Record the change
|
|
355
|
+
|
|
356
|
+
2. After all fixes applied, run any available verify commands from the PLAN.md tasks to confirm nothing breaks:
|
|
357
|
+
```bash
|
|
358
|
+
# Extract verify commands from PLAN.md
|
|
359
|
+
grep -A 5 "<automated>" ${PLAN_PATH} | grep -v "automated" | head -10
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
3. If a fix breaks verification:
|
|
363
|
+
- Revert that specific fix
|
|
364
|
+
- Remove it from the applied list
|
|
365
|
+
- Log: "Reverted fix {finding_ref}: broke verification"
|
|
366
|
+
|
|
367
|
+
4. Stage all successful fixes and commit:
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
git add [fixed files]
|
|
371
|
+
git commit -m "fix(${PHASE}-${PLAN}): codereview auto-fixes
|
|
372
|
+
|
|
373
|
+
- [list each fix applied, one per bullet]
|
|
374
|
+
|
|
375
|
+
Co-Authored-By: Claude Code Review <noreply@anthropic.com>"
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
If no fixes qualify or all were reverted, skip the commit. Set AUTO_FIX_COMMIT to the commit hash or "none".
|
|
379
|
+
|
|
380
|
+
Record:
|
|
381
|
+
- FIXES_APPLIED: count of successful fixes
|
|
382
|
+
- FIXES_REVERTED: count of reverted fixes
|
|
383
|
+
- AUTO_FIX_COMMIT: commit hash or "none"
|
|
384
|
+
|
|
385
|
+
**Update CODEREVIEW.md with auto-fix results:**
|
|
386
|
+
|
|
387
|
+
Read `${CODEREVIEW_PATH}`. Replace the "## Auto-Fix Results" section content:
|
|
388
|
+
|
|
389
|
+
If fixes were applied:
|
|
390
|
+
```markdown
|
|
391
|
+
## Auto-Fix Results
|
|
392
|
+
|
|
393
|
+
| Finding | File | Fix | Status |
|
|
394
|
+
|---------|------|-----|--------|
|
|
395
|
+
| {finding_ref} | {file}:{line_range} | {rationale} | Applied |
|
|
396
|
+
{... one row per fix applied ...}
|
|
397
|
+
{... if any reverted:}
|
|
398
|
+
| {finding_ref} | {file}:{line_range} | {rationale} | Reverted: {reason} |
|
|
399
|
+
|
|
400
|
+
**Applied:** {FIXES_APPLIED} | **Reverted:** {FIXES_REVERTED} | **Commit:** {AUTO_FIX_COMMIT}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
If no fixes qualified:
|
|
404
|
+
```markdown
|
|
405
|
+
## Auto-Fix Results
|
|
406
|
+
|
|
407
|
+
No fixes qualified for auto-application (all findings were critical/high severity or required behavioral changes).
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Update the frontmatter: set `stats.auto_fixed` to `{FIXES_APPLIED}`.
|
|
411
|
+
|
|
412
|
+
Include CODEREVIEW.md in the auto-fix commit by adding it to the staged files:
|
|
413
|
+
|
|
414
|
+
Change the existing `git add [fixed files]` to also include CODEREVIEW.md:
|
|
415
|
+
```bash
|
|
416
|
+
git add [fixed files] ${CODEREVIEW_PATH}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
If no auto-fixes were applied (commit skipped), commit CODEREVIEW.md alone:
|
|
420
|
+
```bash
|
|
421
|
+
git add ${CODEREVIEW_PATH}
|
|
422
|
+
git commit -m "docs(${PHASE}-${PLAN}): codereview report
|
|
423
|
+
|
|
424
|
+
Co-Authored-By: Claude Code Review <noreply@anthropic.com>"
|
|
425
|
+
```
|
|
426
|
+
</step>
|
|
427
|
+
|
|
428
|
+
<step name="log_deviations">
|
|
429
|
+
For CRITICAL and HIGH findings that were NOT auto-fixed:
|
|
430
|
+
|
|
431
|
+
**Do NOT prompt the user.** Non-interactive mode per design decision.
|
|
432
|
+
|
|
433
|
+
Instead, append each as a deviation entry to the SUMMARY.md that was already created at ${PHASE_DIR}/${PHASE}-${PLAN}-SUMMARY.md.
|
|
434
|
+
|
|
435
|
+
Read the existing SUMMARY.md. Find the `## Deviations from Plan` section. Append after the existing deviation entries (or after "None - plan executed exactly as written" if no prior deviations):
|
|
436
|
+
|
|
437
|
+
For each critical/high finding:
|
|
438
|
+
```
|
|
439
|
+
**[Codereview - {severity}] {title}** -- File: {file}:{line} | Finding: {description} | Suggested fix: {suggestion}
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
Add a new section after `## Deviations from Plan`:
|
|
443
|
+
|
|
444
|
+
```markdown
|
|
445
|
+
## Code Review
|
|
446
|
+
|
|
447
|
+
| Metric | Count |
|
|
448
|
+
|--------|-------|
|
|
449
|
+
| Total findings | {TOTAL_COUNT} |
|
|
450
|
+
| Critical | {CRITICAL_COUNT} |
|
|
451
|
+
| High | {HIGH_COUNT} |
|
|
452
|
+
| Medium | {MEDIUM_COUNT} |
|
|
453
|
+
| Low | {LOW_COUNT} |
|
|
454
|
+
| Auto-fixed | {FIXES_APPLIED} |
|
|
455
|
+
| Logged as deviations | {DEVIATIONS_LOGGED} |
|
|
456
|
+
|
|
457
|
+
Auto-fix commit: {AUTO_FIX_COMMIT}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
Where DEVIATIONS_LOGGED = count of critical + high findings that were not auto-fixed.
|
|
461
|
+
|
|
462
|
+
**Update CODEREVIEW.md with deviations logged:**
|
|
463
|
+
|
|
464
|
+
Read `${CODEREVIEW_PATH}`. Replace the "## Deviations Logged" section content:
|
|
465
|
+
|
|
466
|
+
If deviations were logged:
|
|
467
|
+
```markdown
|
|
468
|
+
## Deviations Logged
|
|
469
|
+
|
|
470
|
+
{DEVIATIONS_LOGGED} critical/high findings logged as deviations to SUMMARY.md:
|
|
471
|
+
|
|
472
|
+
| ID | Severity | Title | File |
|
|
473
|
+
|----|----------|-------|------|
|
|
474
|
+
| {id} | {severity} | {title} | {file}:{line} |
|
|
475
|
+
{... one row per deviation ...}
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
If no deviations:
|
|
479
|
+
```markdown
|
|
480
|
+
## Deviations Logged
|
|
481
|
+
|
|
482
|
+
No critical/high findings to log as deviations.
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
Update the frontmatter: set `stats.deviations_logged` to `{DEVIATIONS_LOGGED}` and set `status` to `complete`.
|
|
486
|
+
|
|
487
|
+
Stage the updated CODEREVIEW.md:
|
|
488
|
+
```bash
|
|
489
|
+
git add ${CODEREVIEW_PATH}
|
|
490
|
+
```
|
|
491
|
+
(It will be included in the next commit -- either the metadata commit from execute-plan or amend.)
|
|
492
|
+
</step>
|
|
493
|
+
|
|
494
|
+
<step name="report_completion">
|
|
495
|
+
Display summary box:
|
|
496
|
+
|
|
497
|
+
```
|
|
498
|
+
------------------------------------------------------------
|
|
499
|
+
CODEREVIEW COMPLETE: ${PHASE}-${PLAN}
|
|
500
|
+
------------------------------------------------------------
|
|
501
|
+
|
|
502
|
+
Pass 1 (Foundation): {N} findings
|
|
503
|
+
Pass 2 (Integration): {N} findings ({M} auto-fixable)
|
|
504
|
+
Pass 3 (Final): {N} findings
|
|
505
|
+
|
|
506
|
+
Total: {T} | Auto-fixed: {F} | Logged as deviations: {D}
|
|
507
|
+
Commit: {AUTO_FIX_COMMIT}
|
|
508
|
+
------------------------------------------------------------
|
|
509
|
+
```
|
|
510
|
+
</step>
|
|
511
|
+
|
|
512
|
+
</process>
|
|
513
|
+
|
|
514
|
+
<success_criteria>
|
|
515
|
+
- [ ] Diff computed from plan's task commits
|
|
516
|
+
- [ ] Pass 1: 3 parallel agents (Correctness/Security, Standards/Patterns, Simplification)
|
|
517
|
+
- [ ] Pass 2: 3 parallel agents (Fix Verification, Integration/Flow, Test Coverage)
|
|
518
|
+
- [ ] Pass 3: 3 parallel agents (Fresh Eyes, Production Readiness, Diff Sanity Check)
|
|
519
|
+
- [ ] Findings aggregated, deduplicated, sorted by severity
|
|
520
|
+
- [ ] Auto-fixes applied for qualifying medium/low findings (< 5 lines, no behavioral change)
|
|
521
|
+
- [ ] Auto-fix commit uses format: fix({phase}-{plan}): codereview auto-fixes
|
|
522
|
+
- [ ] CRITICAL/HIGH findings logged as deviations to SUMMARY.md (non-interactive)
|
|
523
|
+
- [ ] Code Review section added to SUMMARY.md with metrics
|
|
524
|
+
- [ ] CODEREVIEW.md created at ${PHASE_DIR}/${PHASE}-${PLAN}-CODEREVIEW.md with findings, auto-fix results, and deviation log
|
|
525
|
+
- [ ] Completion report displayed
|
|
526
|
+
</success_criteria>
|