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