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