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