forge-workflow 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/.claude/commands/plan.md +93 -4
  2. package/.cline/workflows/dev.md +311 -0
  3. package/.cline/workflows/plan.md +475 -0
  4. package/.cline/workflows/premerge.md +176 -0
  5. package/.cline/workflows/research.md +39 -0
  6. package/.cline/workflows/review.md +439 -0
  7. package/.cline/workflows/rollback.md +718 -0
  8. package/.cline/workflows/ship.md +131 -0
  9. package/.cline/workflows/sonarcloud.md +146 -0
  10. package/.cline/workflows/status.md +74 -0
  11. package/.cline/workflows/validate.md +234 -0
  12. package/.cline/workflows/verify.md +218 -0
  13. package/.codex/config.toml +11 -0
  14. package/.codex/skills/dev/SKILL.md +314 -0
  15. package/.codex/skills/plan/SKILL.md +478 -0
  16. package/.codex/skills/premerge/SKILL.md +179 -0
  17. package/.codex/skills/research/SKILL.md +42 -0
  18. package/.codex/skills/review/SKILL.md +442 -0
  19. package/.codex/skills/rollback/SKILL.md +721 -0
  20. package/.codex/skills/ship/SKILL.md +134 -0
  21. package/.codex/skills/sonarcloud/SKILL.md +149 -0
  22. package/.codex/skills/status/SKILL.md +77 -0
  23. package/.codex/skills/validate/SKILL.md +237 -0
  24. package/.codex/skills/verify/SKILL.md +221 -0
  25. package/.cursor/commands/dev.md +311 -0
  26. package/.cursor/commands/plan.md +475 -0
  27. package/.cursor/commands/premerge.md +176 -0
  28. package/.cursor/commands/research.md +39 -0
  29. package/.cursor/commands/review.md +439 -0
  30. package/.cursor/commands/rollback.md +718 -0
  31. package/.cursor/commands/ship.md +131 -0
  32. package/.cursor/commands/sonarcloud.md +146 -0
  33. package/.cursor/commands/status.md +74 -0
  34. package/.cursor/commands/validate.md +234 -0
  35. package/.cursor/commands/verify.md +218 -0
  36. package/.cursor/rules/permissions-guidance.mdc +37 -0
  37. package/.github/prompts/dev.prompt.md +316 -0
  38. package/.github/prompts/plan.prompt.md +480 -0
  39. package/.github/prompts/premerge.prompt.md +181 -0
  40. package/.github/prompts/research.prompt.md +44 -0
  41. package/.github/prompts/review.prompt.md +444 -0
  42. package/.github/prompts/rollback.prompt.md +723 -0
  43. package/.github/prompts/ship.prompt.md +136 -0
  44. package/.github/prompts/sonarcloud.prompt.md +151 -0
  45. package/.github/prompts/status.prompt.md +79 -0
  46. package/.github/prompts/validate.prompt.md +239 -0
  47. package/.github/prompts/verify.prompt.md +223 -0
  48. package/.kilocode/workflows/dev.md +315 -0
  49. package/.kilocode/workflows/plan.md +479 -0
  50. package/.kilocode/workflows/premerge.md +180 -0
  51. package/.kilocode/workflows/research.md +43 -0
  52. package/.kilocode/workflows/review.md +443 -0
  53. package/.kilocode/workflows/rollback.md +722 -0
  54. package/.kilocode/workflows/ship.md +135 -0
  55. package/.kilocode/workflows/sonarcloud.md +150 -0
  56. package/.kilocode/workflows/status.md +78 -0
  57. package/.kilocode/workflows/validate.md +238 -0
  58. package/.kilocode/workflows/verify.md +222 -0
  59. package/.opencode/commands/dev.md +314 -0
  60. package/.opencode/commands/plan.md +478 -0
  61. package/.opencode/commands/premerge.md +179 -0
  62. package/.opencode/commands/research.md +42 -0
  63. package/.opencode/commands/review.md +442 -0
  64. package/.opencode/commands/rollback.md +721 -0
  65. package/.opencode/commands/ship.md +134 -0
  66. package/.opencode/commands/sonarcloud.md +149 -0
  67. package/.opencode/commands/status.md +77 -0
  68. package/.opencode/commands/validate.md +237 -0
  69. package/.opencode/commands/verify.md +221 -0
  70. package/.roo/commands/dev.md +315 -0
  71. package/.roo/commands/plan.md +479 -0
  72. package/.roo/commands/premerge.md +180 -0
  73. package/.roo/commands/research.md +43 -0
  74. package/.roo/commands/review.md +443 -0
  75. package/.roo/commands/rollback.md +722 -0
  76. package/.roo/commands/ship.md +135 -0
  77. package/.roo/commands/sonarcloud.md +150 -0
  78. package/.roo/commands/status.md +78 -0
  79. package/.roo/commands/validate.md +238 -0
  80. package/.roo/commands/verify.md +222 -0
  81. package/LICENSE +21 -21
  82. package/docs/ENHANCED_ONBOARDING.md +2 -2
  83. package/docs/TOOLCHAIN.md +15 -234
  84. package/install.sh +32 -36
  85. package/lib/commands/plan.js +11 -15
  86. package/lib/commands/recommend.js +2 -2
  87. package/lib/dep-guard/analyzer.js +294 -0
  88. package/lib/dep-guard/behavior-detector.js +98 -0
  89. package/lib/dep-guard/contract-detector.js +162 -0
  90. package/lib/dep-guard/import-detector.js +498 -0
  91. package/lib/dep-guard/path-utils.js +13 -0
  92. package/lib/dep-guard/rubric.js +120 -0
  93. package/lib/dep-guard/task-parser.js +318 -0
  94. package/lib/plugin-catalog.js +18 -28
  95. package/lib/workflow-profiles.js +5 -11
  96. package/package.json +15 -4
  97. package/skills/parallel-deep-research/SKILL.md +108 -0
  98. package/skills/parallel-deep-research/evals/README.md +27 -0
  99. package/skills/parallel-deep-research/evals/evals.json +62 -0
  100. package/skills/sonarcloud-analysis/SKILL.md +171 -0
  101. package/skills/sonarcloud-analysis/evals/README.md +27 -0
  102. package/skills/sonarcloud-analysis/evals/evals.json +50 -0
  103. package/skills/sonarcloud-analysis/references/api-reference.md +466 -0
  104. package/docs/planning/PROGRESS.md +0 -396
  105. package/docs/plans/.gitkeep +0 -0
  106. package/docs/plans/2026-02-27-forge-test-suite-v2-decisions.md +0 -21
  107. package/docs/plans/2026-02-27-forge-test-suite-v2-design.md +0 -362
  108. package/docs/plans/2026-02-27-forge-test-suite-v2-tasks.md +0 -343
  109. package/docs/plans/2026-03-02-superpowers-gaps-decisions.md +0 -26
  110. package/docs/plans/2026-03-02-superpowers-gaps-design.md +0 -239
  111. package/docs/plans/2026-03-02-superpowers-gaps-tasks.md +0 -260
  112. package/docs/plans/2026-03-04-agent-command-parity-design.md +0 -163
  113. package/docs/plans/2026-03-04-verify-worktree-cleanup-decisions.md +0 -7
  114. package/docs/plans/2026-03-04-verify-worktree-cleanup-design.md +0 -165
  115. package/docs/plans/2026-03-05-forge-uto-decisions.md +0 -6
  116. package/docs/plans/2026-03-05-forge-uto-design.md +0 -116
  117. package/docs/plans/2026-03-05-forge-uto-tasks.md +0 -244
  118. package/docs/plans/2026-03-10-command-creator-and-eval-decisions.md +0 -52
  119. package/docs/plans/2026-03-10-command-creator-and-eval-design.md +0 -350
  120. package/docs/plans/2026-03-10-command-creator-and-eval-tasks.md +0 -426
  121. package/docs/plans/2026-03-10-stale-workflow-refs-decisions.md +0 -8
  122. package/docs/plans/2026-03-10-stale-workflow-refs-design.md +0 -80
  123. package/docs/plans/2026-03-10-stale-workflow-refs-tasks.md +0 -90
  124. package/docs/plans/2026-03-14-beads-plan-context-decisions.md +0 -9
  125. package/docs/plans/2026-03-14-beads-plan-context-design.md +0 -171
  126. package/docs/plans/2026-03-14-beads-plan-context-tasks.md +0 -160
  127. package/docs/plans/2026-03-14-skill-eval-loop-decisions.md +0 -33
  128. package/docs/plans/2026-03-14-skill-eval-loop-design.md +0 -118
  129. package/docs/plans/2026-03-14-skill-eval-loop-results.md +0 -78
  130. package/docs/plans/2026-03-14-skill-eval-loop-tasks.md +0 -160
  131. package/docs/plans/2026-03-15-agent-command-parity-v2-decisions.md +0 -11
  132. package/docs/plans/2026-03-15-agent-command-parity-v2-design.md +0 -145
  133. package/docs/plans/2026-03-15-agent-command-parity-v2-tasks.md +0 -211
  134. package/docs/research/TEMPLATE.md +0 -292
  135. package/docs/research/advanced-testing.md +0 -297
  136. package/docs/research/agent-permissions.md +0 -167
  137. package/docs/research/dependency-chain.md +0 -328
  138. package/docs/research/forge-workflow-v2.md +0 -550
  139. package/docs/research/plugin-architecture.md +0 -772
  140. package/docs/research/pr4-cli-automation.md +0 -326
  141. package/docs/research/premerge-verify-restructure.md +0 -205
  142. package/docs/research/skills-restructure.md +0 -508
  143. package/docs/research/sonarcloud-perfection-plan.md +0 -166
  144. package/docs/research/sonarcloud-quality-gate.md +0 -184
  145. package/docs/research/superpowers-integration.md +0 -403
  146. package/docs/research/superpowers.md +0 -319
  147. package/docs/research/test-environment.md +0 -519
@@ -0,0 +1,135 @@
1
+ ---
2
+ description: Create PR with comprehensive documentation
3
+ mode: code
4
+ ---
5
+
6
+ Push code and create a pull request with full context and documentation links.
7
+
8
+ # Ship
9
+
10
+ This command creates a PR after validation passes.
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ /ship
16
+ ```
17
+
18
+ ```
19
+ <HARD-GATE: /ship entry>
20
+ Do NOT create PR until:
21
+ 1. /validate was run in this session with all four outputs shown (type, lint, tests, security)
22
+ 2. All checks confirmed passing — not assumed, not "was passing earlier"
23
+ 3. Beads issue is in_progress
24
+ 4. git branch --show-current output is NOT main or master
25
+ </HARD-GATE>
26
+ ```
27
+
28
+ ## What This Command Does
29
+
30
+ ### Step 1: Verify /validate Passed
31
+ Ensure all four validation checks completed successfully with fresh output in this session.
32
+
33
+ ### Step 2: Update Beads
34
+ ```bash
35
+ bd update <id> --status done
36
+ bd sync
37
+ ```
38
+
39
+ ### Step 3: Push Branch
40
+ ```bash
41
+ git push -u origin <branch-name>
42
+ ```
43
+
44
+ ### Step 4: Create PR
45
+
46
+ ```bash
47
+ gh pr create --title "feat: <feature-name>" --body "$(cat <<'EOF'
48
+ ## Summary
49
+ [Auto-generated from commits and design doc]
50
+
51
+ ## Design Doc
52
+ See: docs/plans/YYYY-MM-DD-<slug>-design.md
53
+
54
+ ## Decisions Log
55
+ See: docs/plans/YYYY-MM-DD-<slug>-decisions.md (if any undocumented decisions arose during /dev)
56
+
57
+ ## Beads Issue
58
+ Closes: <issue-id>
59
+
60
+ ## Key Decisions
61
+ [From design doc - 3-5 key decisions with reasoning]
62
+
63
+ ## TDD Test Coverage
64
+ - Unit tests: [count] tests, [X] scenarios
65
+ - Integration tests: [count] tests
66
+ - E2E tests: [count] tests
67
+ - All tests passing ✓
68
+
69
+ ## Security Review
70
+ - OWASP Top 10: All mitigations implemented
71
+ - Security tests: [count] scenarios passing
72
+ - Automated scan: No vulnerabilities
73
+
74
+ ## Test Plan
75
+ - [x] Type check passing
76
+ - [x] Lint passing
77
+ - [x] Code review passing
78
+ - [x] E2E tests passing
79
+ - [x] Security review completed
80
+
81
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
82
+ EOF
83
+ )"
84
+ ```
85
+
86
+ ### Step 5: Record Stage Transition
87
+ ```bash
88
+ bash scripts/beads-context.sh stage-transition <id> ship review
89
+ ```
90
+
91
+ ## Example Output
92
+
93
+ ```
94
+ ✓ Validation: /validate passed (all 4 checks — fresh output confirmed)
95
+ ✓ Beads: Marked done & synced (forge-xyz)
96
+ ✓ Pushed: feat/stripe-billing
97
+ ✓ PR created: https://github.com/.../pull/123
98
+ - Beads linked: forge-xyz
99
+ - Design doc linked: docs/plans/2026-02-26-stripe-billing-design.md
100
+ - Decisions log linked: docs/plans/2026-02-26-stripe-billing-decisions.md
101
+ - Test coverage documented
102
+ - Security review documented
103
+
104
+ PR Summary:
105
+ - 12 commits
106
+ - 18 test cases, all passing
107
+ - OWASP Top 10 security review completed
108
+ - 3 key architectural decisions documented
109
+
110
+ ⏸️ PR created, awaiting automated checks (Greptile, SonarCloud, GitHub Actions)
111
+
112
+ Next: /review <pr-number> (after automated checks complete)
113
+ ```
114
+
115
+ ## Integration with Workflow
116
+
117
+ ```
118
+ Utility: /status → Understand current context before starting
119
+ Stage 1: /plan → Design intent → research → branch + worktree + task list
120
+ Stage 2: /dev → Implement each task with subagent-driven TDD
121
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output
122
+ Stage 4: /ship → Push + create PR (you are here)
123
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
124
+ Stage 6: /premerge → Update docs, hand off PR to user
125
+ Stage 7: /verify → Post-merge CI check on main
126
+ ```
127
+
128
+ ## Tips
129
+
130
+ - **Complete PR body**: Include design doc, decisions log, and test coverage
131
+ - **Link everything**: Design doc, decisions log, Beads issue
132
+ - **Document security**: OWASP Top 10 review in PR body
133
+ - **Test coverage**: Show all test scenarios passing
134
+ - **Wait for checks**: Let GitHub Actions, Greptile, SonarCloud run
135
+ - **NO auto-merge**: Always wait for /review phase
@@ -0,0 +1,150 @@
1
+ ---
2
+ description: Pull issues, metrics, quality gates, and analysis data from SonarCloud
3
+ mode: code
4
+ ---
5
+
6
+ # SonarCloud Query Command
7
+
8
+ Pull code quality data from SonarCloud. Requires `SONARCLOUD_TOKEN` environment variable.
9
+
10
+ ## Arguments
11
+
12
+ - `$ARGUMENTS` - Query type and parameters
13
+
14
+ ## Query Types
15
+
16
+ | Query | Description | Example |
17
+ |-------|-------------|---------|
18
+ | `issues <project>` | Get open issues | `/sonarcloud issues my-project` |
19
+ | `metrics <project>` | Get code metrics | `/sonarcloud metrics my-project` |
20
+ | `gate <project>` | Quality gate status | `/sonarcloud gate my-project` |
21
+ | `health <project>` | Full health report | `/sonarcloud health my-project` |
22
+ | `pr <project> <pr#>` | PR analysis | `/sonarcloud pr my-project 123` |
23
+ | `hotspots <project>` | Security hotspots | `/sonarcloud hotspots my-project` |
24
+ | `history <project>` | Analysis history | `/sonarcloud history my-project` |
25
+
26
+ ## Filters (append to query)
27
+
28
+ | Filter | Description | Example |
29
+ |--------|-------------|---------|
30
+ | `--branch <name>` | Filter by branch | `--branch develop` |
31
+ | `--severity <levels>` | Filter severity | `--severity BLOCKER,CRITICAL` |
32
+ | `--type <types>` | Filter issue type | `--type BUG,VULNERABILITY` |
33
+ | `--new-code` | Only new code issues | `--new-code` |
34
+
35
+ ## Instructions
36
+
37
+ 1. Parse the query from `$ARGUMENTS` to determine:
38
+ - Query type (issues, metrics, gate, health, pr, hotspots, history)
39
+ - Project key
40
+ - Optional filters (branch, severity, type, new-code, etc.)
41
+ 2. Check for `SONARCLOUD_TOKEN` environment variable. If not set, inform user.
42
+ 3. Check for `SONARCLOUD_ORG` environment variable or ask user for organization key.
43
+ 4. Execute the appropriate API call using curl or the TypeScript client at `next-app/src/lib/integrations/sonarcloud.ts`
44
+ 5. Format and present results clearly:
45
+ - For issues: Group by severity/type, show file, line, message
46
+ - For metrics: Show as table with metric name and value
47
+ - For quality gate: Show pass/fail with failed conditions
48
+ - For health: Comprehensive summary with all data
49
+ 6. Offer follow-up actions:
50
+ - "Show issues in specific file?"
51
+ - "Get more details on a specific issue?"
52
+ - "Compare with another branch?"
53
+
54
+ ## Example Outputs
55
+
56
+ ### Issues Query
57
+
58
+ ```
59
+ 📋 Open Issues for my-project (branch: main)
60
+
61
+ Total: 45 issues
62
+
63
+ By Severity:
64
+ 🔴 BLOCKER: 2
65
+ 🟠 CRITICAL: 5
66
+ 🟡 MAJOR: 18
67
+ ⚪ MINOR: 15
68
+ ⚫ INFO: 5
69
+
70
+ By Type:
71
+ 🐛 BUG: 8
72
+ 🔓 VULNERABILITY: 3
73
+ 💩 CODE_SMELL: 34
74
+
75
+ Top Issues:
76
+ 1. [CRITICAL] src/auth/login.ts:42 - SQL injection vulnerability
77
+ 2. [BLOCKER] src/api/users.ts:156 - Null pointer dereference
78
+ ...
79
+ ```
80
+
81
+ ### Metrics Query
82
+
83
+ ```
84
+ 📊 Metrics for my-project
85
+
86
+ | Metric | Value |
87
+ |--------|-------|
88
+ | Lines of Code | 51,234 |
89
+ | Coverage | 78.5% |
90
+ | Duplications | 3.2% |
91
+ | Bugs | 8 |
92
+ | Vulnerabilities | 3 |
93
+ | Code Smells | 34 |
94
+ | Technical Debt | 4d 2h |
95
+ | Maintainability | A |
96
+ | Reliability | B |
97
+ | Security | A |
98
+ ```
99
+
100
+ ### Quality Gate Query
101
+
102
+ ```
103
+ 🚦 Quality Gate: ❌ FAILED
104
+
105
+ Failed Conditions:
106
+ | Metric | Threshold | Actual |
107
+ |--------|-----------|--------|
108
+ | Coverage on New Code | ≥ 80% | 65.3% |
109
+ | New Bugs | = 0 | 2 |
110
+
111
+ Passed Conditions:
112
+ | Metric | Threshold | Actual |
113
+ |--------|-----------|--------|
114
+ | New Vulnerabilities | = 0 | 0 |
115
+ | Duplicated Lines | ≤ 3% | 1.2% |
116
+ ```
117
+
118
+ ## API Reference
119
+
120
+ Base URL: `https://sonarcloud.io/api`
121
+
122
+ ### Key Endpoints
123
+
124
+ ```bash
125
+ # Issues
126
+ curl -H "Authorization: Bearer $TOKEN" \
127
+ "https://sonarcloud.io/api/issues/search?organization=$ORG&componentKeys=$PROJECT&resolved=false"
128
+
129
+ # Metrics
130
+ curl -H "Authorization: Bearer $TOKEN" \
131
+ "https://sonarcloud.io/api/measures/component?component=$PROJECT&metricKeys=bugs,vulnerabilities,coverage"
132
+
133
+ # Quality Gate
134
+ curl -H "Authorization: Bearer $TOKEN" \
135
+ "https://sonarcloud.io/api/qualitygates/project_status?projectKey=$PROJECT"
136
+
137
+ # Hotspots
138
+ curl -H "Authorization: Bearer $TOKEN" \
139
+ "https://sonarcloud.io/api/hotspots/search?projectKey=$PROJECT&status=TO_REVIEW"
140
+ ```
141
+
142
+ ## Full Skill Reference
143
+
144
+ See `skills/sonarcloud-analysis/SKILL.md` for complete API documentation including:
145
+
146
+ - All endpoints and parameters
147
+ - Response structures
148
+ - Pagination handling
149
+ - Advanced filtering
150
+ - Integration patterns
@@ -0,0 +1,78 @@
1
+ ---
2
+ description: Check current stage and context
3
+ mode: code
4
+ ---
5
+
6
+ Check where you are in the project and what work is in progress.
7
+
8
+ # Status Check
9
+
10
+ This command helps you understand the current state of the project before starting new work.
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ /status
16
+ ```
17
+
18
+ ## What This Command Does
19
+
20
+ ### Step 1: Check Project Health
21
+ ```bash
22
+ bd stats
23
+ ```
24
+ - How many open / in-progress / completed issues?
25
+ - Any blocked issues?
26
+
27
+ ### Step 2: Check Active Work
28
+ ```bash
29
+ # Active Beads issues
30
+ bd list --status in_progress
31
+ ```
32
+
33
+ For each in-progress issue, show compact progress:
34
+ ```bash
35
+ bash scripts/beads-context.sh parse-progress <issue-id>
36
+ ```
37
+ Display the compact output (e.g., "3/7 tasks done | Last: Validation logic (def5678)")
38
+
39
+ Hint: `bd show <id>` for full context on any issue.
40
+
41
+ ### Step 3: Review Recent Work
42
+ ```bash
43
+ # Recent commits
44
+ git log --oneline -10
45
+
46
+ # Recently completed Beads
47
+ bd list --status completed --limit 5
48
+ ```
49
+
50
+ ### Step 4: Determine Context
51
+ - **New feature**: No active work, ready to start fresh
52
+ - **Continuing work**: In-progress issues found, resume where left off
53
+ - **Review needed**: Work marked complete, needs review/merge
54
+
55
+ ## Example Output
56
+
57
+ ```
58
+ ✓ Project Health: 3 open, 1 in-progress, 12 completed
59
+
60
+ Active Work:
61
+ - forge-ctc: Clean up stale workflow refs (in_progress)
62
+ 3/7 tasks done | Last: Validation logic (def5678)
63
+ → bd show forge-ctc for full context
64
+
65
+ Recent Completions:
66
+ - forge-uto: Sync AGENTS.md with agent cleanup (closed 2 days ago)
67
+ - forge-abc: Auth refresh tokens (closed 5 days ago)
68
+
69
+ Context: Continuing work
70
+
71
+ Next: Resume with /dev or /validate (check issue status)
72
+ ```
73
+
74
+ ## Next Steps
75
+
76
+ - **If starting new work**: Run `/plan <feature-name>`
77
+ - **If continuing work**: Resume with appropriate phase command
78
+ - **If reviewing**: Run `/review <pr-number>` or `/premerge <pr-number>`
@@ -0,0 +1,238 @@
1
+ ---
2
+ description: Complete validation (type/lint/tests/security)
3
+ mode: code
4
+ ---
5
+
6
+ Run comprehensive validation including type checking, linting, code review, security review, and tests.
7
+
8
+ # Validate
9
+
10
+ This command validates all code before creating a pull request.
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ /validate
16
+ ```
17
+
18
+ Or use the unified validation script:
19
+
20
+ ```bash
21
+ bun run check # Runs all validation steps automatically (check is the npm script name; /validate is the workflow command)
22
+ ```
23
+
24
+ ## What This Command Does
25
+
26
+ **Quick Start**: Run `bun run check` to execute the full validation pipeline (implemented in `scripts/validate.sh`). The npm script is named `check`; the workflow command is `/validate`. See individual steps below for details.
27
+
28
+ ### Step 1: Type Check
29
+ ```bash
30
+ # Run your project's type check command
31
+ bun run typecheck # or: npm run typecheck, tsc, etc.
32
+ ```
33
+ - Verify all TypeScript types are valid
34
+ - No `any` types allowed
35
+ - Strict mode enforcement
36
+
37
+ ### Step 2: Lint
38
+ ```bash
39
+ # Run your project's lint command
40
+ bun run lint # or: npm run lint, eslint ., etc.
41
+ ```
42
+ - Linting rules
43
+ - Code style consistency
44
+ - Best practices compliance
45
+
46
+ ### Step 3: Code Review (if available)
47
+ ```bash
48
+ /code-review:code-review
49
+ ```
50
+ - Static code analysis
51
+ - Code quality check
52
+ - Potential issues flagged
53
+
54
+ ### Step 4: Security Review
55
+
56
+ **OWASP Top 10 Checklist**:
57
+ - A01: Broken Access Control
58
+ - A02: Cryptographic Failures
59
+ - A03: Injection
60
+ - A04: Insecure Design
61
+ - A05: Security Misconfiguration
62
+ - A06: Vulnerable Components
63
+ - A07: Authentication Failures
64
+ - A08: Data Integrity Failures
65
+ - A09: Logging & Monitoring Failures
66
+ - A10: Server-Side Request Forgery
67
+
68
+ **Automated Security Scan**:
69
+ ```bash
70
+ # Run your project's security scan
71
+ npm audit # or: bun audit, snyk test, etc.
72
+ ```
73
+
74
+ **Manual Review**:
75
+ - Review security test scenarios (from design doc — `## Technical Research` section)
76
+ - Verify security mitigations implemented
77
+ - Check for sensitive data exposure
78
+
79
+ ### Step 5: Tests
80
+ ```bash
81
+ # Run your project's test command
82
+ bun test # or: npm run test, jest, vitest, etc.
83
+ ```
84
+ - All tests passing
85
+ - Includes security test scenarios
86
+ - TDD tests from /dev phase
87
+
88
+ > **💭 Plan-Act-Reflect Checkpoint**
89
+ > Before declaring validation complete:
90
+ > - Are all security test scenarios from your design doc actually implemented and passing?
91
+ > - Did you verify OWASP Top 10 mitigations, not just check a box?
92
+ > - Are there edge cases or integration scenarios you haven't tested?
93
+ >
94
+ > **If unsure**: Re-read the `## Technical Research` section in `docs/plans/YYYY-MM-DD-<slug>-design.md`
95
+
96
+ ## On Validation Failure: 4-Phase Debug Mode
97
+
98
+ > **Iron Law: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST**
99
+ >
100
+ > Every fix attempt without a diagnosed root cause wastes time and masks the real problem.
101
+
102
+ ### Phase D1: Reproduce
103
+
104
+ Confirm the failure is deterministic. Capture the exact error.
105
+
106
+ - Run the failing command fresh — do not rely on cached output
107
+ - Record: exact command, exact error message, exact line number
108
+ - If intermittent: run 3 times, document frequency
109
+
110
+ ### Phase D2: Root-Cause Trace
111
+
112
+ Trace to the source, not the symptom. **Fix at source, not at symptom.**
113
+
114
+ - Read the stack trace — where does it originate?
115
+ - Is it a test bug, an implementation bug, or a config bug?
116
+ - What changed recently that could have caused this?
117
+ - Read the actual failing line and surrounding context
118
+
119
+ ### Phase D3: Fix
120
+
121
+ ONE minimal fix. ONE change at a time.
122
+
123
+ 1. Write the failing test FIRST (if not already a test failure)
124
+ 2. Make the smallest possible change to fix the root cause
125
+ 3. Do not fix multiple things in one commit
126
+ 4. Do not "also improve" unrelated code while fixing
127
+
128
+ ### Phase D4: Verify
129
+
130
+ Re-run full validation from the beginning.
131
+
132
+ - Do not declare fixed until you have run the full validate suite
133
+ - Show fresh output — not "it should be fine now"
134
+ - All checks must pass, not just the one that was failing
135
+
136
+ <HARD-GATE: 3+ fix attempts>
137
+ STOP. Question architecture before Fix #4.
138
+
139
+ If you have attempted 3+ fixes without resolution:
140
+ 1. Step back — is the approach fundamentally wrong?
141
+ 2. Read the original spec/design doc
142
+ 3. Ask: "Am I fixing symptoms or the real problem?"
143
+ 4. Consider: revert all changes and start fresh with better understanding
144
+
145
+ "Quick fix for now" is not a valid fix strategy.
146
+ </HARD-GATE>
147
+
148
+ ### Red Flags — STOP if you hear yourself saying:
149
+
150
+ - "Quick fix for now"
151
+ - "It's probably X"
152
+ - "I don't fully understand but this might work"
153
+ - "Should be fixed now"
154
+ - "It was passing earlier"
155
+ - "I'm confident this is right"
156
+
157
+ **None of these are evidence. Run the command. Show the output.**
158
+
159
+ ### Step 6: Handle Failures
160
+
161
+ If any check fails:
162
+ ```bash
163
+ # Create Beads issue for problems
164
+ bd create "Fix <issue-description>"
165
+
166
+ # Mark current issue as blocked
167
+ bd update <current-id> --status blocked --comment "Blocked by <new-issue-id>"
168
+
169
+ # Output what needs fixing
170
+ ```
171
+
172
+ If all pass:
173
+
174
+ ```
175
+ <HARD-GATE: /validate exit>
176
+ Do NOT output any variation of "check complete", "ready to ship", or proceed to /ship
177
+ until ALL FOUR show fresh output in this session:
178
+
179
+ 1. Type check: [command run] → [actual output] → exit 0 confirmed
180
+ 2. Lint: [command run] → [actual output] → 0 errors, 0 warnings confirmed
181
+ 3. Tests: [command run] → [actual output] → N/N passing confirmed
182
+ 4. Security scan: [command run] → [actual output] → no critical issues confirmed
183
+
184
+ "Should pass", "was passing earlier", and "I'm confident" are not evidence.
185
+ Run the commands. Show the output. THEN declare done.
186
+
187
+ 5. Stage transition: Run `bash scripts/beads-context.sh stage-transition <id> validate ship` → exit 0 confirmed
188
+ </HARD-GATE>
189
+ ```
190
+
191
+ ## Example Output (Success)
192
+
193
+ ```
194
+ ✓ Type check: Passed
195
+ ✓ Lint: Passed
196
+ ✓ Code review: No issues
197
+ ✓ Security Review:
198
+ - OWASP Top 10: All mitigations verified
199
+ - Automated scan: No vulnerabilities
200
+ - Manual review: Security tests passing
201
+ ✓ Tests: 15/15 passing (TDD complete)
202
+
203
+ Ready for /ship
204
+ ```
205
+
206
+ ## Example Output (Failure)
207
+
208
+ ```
209
+ ✗ Tests: 2/15 failing
210
+ - validation.test.ts: Assertion failed
211
+ - auth.test.ts: Timeout exceeded
212
+
213
+ ✓ Beads issue created: bd-k8m3 "Fix validation test"
214
+ ✓ Current issue marked: Blocked by bd-k8m3
215
+
216
+ Fix issues then re-run /validate
217
+ ```
218
+
219
+ ## Integration with Workflow
220
+
221
+ ```
222
+ Utility: /status → Understand current context before starting
223
+ Stage 1: /plan → Design intent → research → branch + worktree + task list
224
+ Stage 2: /dev → Implement each task with subagent-driven TDD
225
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output (you are here)
226
+ Stage 4: /ship → Push + create PR
227
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
228
+ Stage 6: /premerge → Update docs, hand off PR to user
229
+ Stage 7: /verify → Post-merge CI check on main
230
+ ```
231
+
232
+ ## Tips
233
+
234
+ - **All checks must pass**: Don't proceed to /ship with failures
235
+ - **Security is mandatory**: OWASP Top 10 review required for all features
236
+ - **Create issues for failures**: Track problems in Beads
237
+ - **TDD helps**: Tests should already pass from /dev phase
238
+ - **Fix before shipping**: Resolve all issues before creating PR