supipowers 0.2.7 → 0.3.0
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/package.json +21 -6
- package/skills/debugging/SKILL.md +54 -15
- package/skills/planning/SKILL.md +70 -10
- package/skills/receiving-code-review/SKILL.md +87 -0
- package/skills/tdd/SKILL.md +83 -0
- package/skills/verification/SKILL.md +54 -0
- package/src/commands/plan.ts +96 -31
- package/src/commands/qa.ts +150 -29
- package/src/commands/release.ts +1 -1
- package/src/commands/review.ts +2 -2
- package/src/commands/run.ts +52 -2
- package/src/commands/update.ts +2 -2
- package/src/discipline/debugging.ts +57 -0
- package/src/discipline/receiving-review.ts +65 -0
- package/src/discipline/tdd.ts +77 -0
- package/src/discipline/verification.ts +68 -0
- package/src/git/branch-finish.ts +101 -0
- package/src/git/worktree.ts +119 -0
- package/src/index.ts +11 -2
- package/src/lsp/detector.ts +2 -2
- package/src/orchestrator/agent-prompts.ts +282 -0
- package/src/orchestrator/dispatcher.ts +150 -1
- package/src/orchestrator/prompts.ts +17 -31
- package/src/planning/plan-reviewer.ts +49 -0
- package/src/planning/plan-writer-prompt.ts +173 -0
- package/src/planning/prompt-builder.ts +178 -0
- package/src/planning/spec-reviewer.ts +43 -0
- package/src/qa/phases/discovery.ts +34 -0
- package/src/qa/phases/execution.ts +65 -0
- package/src/qa/phases/matrix.ts +41 -0
- package/src/qa/phases/reporting.ts +71 -0
- package/src/qa/session.ts +104 -0
- package/src/storage/qa-sessions.ts +83 -0
- package/src/storage/specs.ts +36 -0
- package/src/types.ts +70 -0
- package/src/visual/companion.ts +115 -0
- package/src/visual/prompt-instructions.ts +102 -0
- package/src/visual/scripts/frame-template.html +201 -0
- package/src/visual/scripts/helper.js +88 -0
- package/src/visual/scripts/index.js +148 -0
- package/src/visual/scripts/package.json +10 -0
- package/src/visual/scripts/start-server.sh +98 -0
- package/src/visual/scripts/stop-server.sh +21 -0
- package/src/visual/types.ts +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supipowers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "OMP-native workflow extension inspired by Superpowers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -9,12 +9,23 @@
|
|
|
9
9
|
"test:watch": "vitest",
|
|
10
10
|
"build": "tsc -p tsconfig.build.json"
|
|
11
11
|
},
|
|
12
|
-
"keywords": [
|
|
12
|
+
"keywords": [
|
|
13
|
+
"omp-extension",
|
|
14
|
+
"workflow",
|
|
15
|
+
"agent",
|
|
16
|
+
"superpowers"
|
|
17
|
+
],
|
|
13
18
|
"license": "MIT",
|
|
14
19
|
"bin": {
|
|
15
|
-
"supipowers": "
|
|
20
|
+
"supipowers": "bin/install.mjs"
|
|
16
21
|
},
|
|
17
|
-
"files": [
|
|
22
|
+
"files": [
|
|
23
|
+
"src",
|
|
24
|
+
"skills",
|
|
25
|
+
"bin",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
18
29
|
"dependencies": {
|
|
19
30
|
"@clack/prompts": "^0.10.0"
|
|
20
31
|
},
|
|
@@ -32,7 +43,11 @@
|
|
|
32
43
|
"vitest": "^4.0.0"
|
|
33
44
|
},
|
|
34
45
|
"omp": {
|
|
35
|
-
"extensions": [
|
|
36
|
-
|
|
46
|
+
"extensions": [
|
|
47
|
+
"./src/index.ts"
|
|
48
|
+
],
|
|
49
|
+
"skills": [
|
|
50
|
+
"./skills"
|
|
51
|
+
]
|
|
37
52
|
}
|
|
38
53
|
}
|
|
@@ -1,23 +1,62 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: debugging
|
|
3
|
-
description: Systematic debugging
|
|
3
|
+
description: Systematic debugging — find root cause before attempting fixes, 4-phase investigation process
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Debugging
|
|
6
|
+
# Systematic Debugging
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Iron Law
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
2. **Isolate**: What's the smallest input that triggers it?
|
|
12
|
-
3. **Investigate**: Read the relevant code. Trace the execution path.
|
|
13
|
-
4. **Hypothesize**: Form a theory about the root cause.
|
|
14
|
-
5. **Verify**: Add logging or a test that confirms the theory.
|
|
15
|
-
6. **Fix**: Make the minimal change that fixes the root cause.
|
|
16
|
-
7. **Validate**: Run the reproducer and existing tests.
|
|
10
|
+
**NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.**
|
|
17
11
|
|
|
18
|
-
|
|
12
|
+
Symptom fixes are failure. If you haven't completed Phase 1, you cannot propose fixes.
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
## Phase 1: Root Cause Investigation
|
|
15
|
+
|
|
16
|
+
Complete this phase before proposing any fix.
|
|
17
|
+
|
|
18
|
+
1. **Read error messages carefully.** Don't skip; they often contain solutions.
|
|
19
|
+
2. **Reproduce consistently.** Exact steps, every time.
|
|
20
|
+
3. **Check recent changes.** `git diff`, new dependencies, config changes.
|
|
21
|
+
4. **Gather evidence** in multi-component systems: diagnostic instrumentation at each boundary.
|
|
22
|
+
5. **Trace data flow** backward through call stack to find original trigger.
|
|
23
|
+
|
|
24
|
+
## Phase 2: Pattern Analysis
|
|
25
|
+
|
|
26
|
+
1. Find working examples in codebase.
|
|
27
|
+
2. Compare against references completely (not skimming).
|
|
28
|
+
3. Identify differences between working and broken.
|
|
29
|
+
4. Understand dependencies and assumptions.
|
|
30
|
+
|
|
31
|
+
## Phase 3: Hypothesis and Testing
|
|
32
|
+
|
|
33
|
+
1. Form a single, specific hypothesis (not vague).
|
|
34
|
+
2. Test minimally: smallest possible change, one variable at a time.
|
|
35
|
+
3. Verify before continuing. If wrong → form NEW hypothesis, not more fixes.
|
|
36
|
+
4. Admit uncertainty. Don't pretend to know.
|
|
37
|
+
|
|
38
|
+
## Phase 4: Implementation
|
|
39
|
+
|
|
40
|
+
1. Create failing test case first.
|
|
41
|
+
2. Implement single fix addressing root cause only.
|
|
42
|
+
3. Verify: test passes, no other tests broken.
|
|
43
|
+
4. **If fix doesn't work:**
|
|
44
|
+
- < 3 attempts: Return to Phase 1 with new information
|
|
45
|
+
- ≥ 3 attempts: **STOP** and question the architecture. Discuss with human partner.
|
|
46
|
+
|
|
47
|
+
## Red Flags — STOP and Follow the Process
|
|
48
|
+
|
|
49
|
+
- "Quick fix for now, investigate later"
|
|
50
|
+
- "Just try changing X and see if it works"
|
|
51
|
+
- "Skip the test, I'll manually verify"
|
|
52
|
+
- "It's probably X, let me fix that"
|
|
53
|
+
- "I don't fully understand but this might work"
|
|
54
|
+
- "One more fix attempt" (when already tried 2+)
|
|
55
|
+
- Each fix reveals new problem in different place
|
|
56
|
+
|
|
57
|
+
## When to Use (Especially)
|
|
58
|
+
|
|
59
|
+
- Under time pressure (emergencies make guessing tempting)
|
|
60
|
+
- "Just one quick fix" seems obvious
|
|
61
|
+
- Already tried multiple fixes
|
|
62
|
+
- Don't fully understand the issue
|
package/skills/planning/SKILL.md
CHANGED
|
@@ -1,29 +1,82 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: planning
|
|
3
|
-
description: Guides collaborative
|
|
3
|
+
description: Guides collaborative brainstorming, design, and planning — from idea to implementation plan with review gates
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Planning Skill
|
|
7
7
|
|
|
8
|
-
Guide the user through planning
|
|
8
|
+
Guide the user through a complete planning flow: brainstorm → design → spec → review → plan. This skill is loaded by `/supi:plan`.
|
|
9
|
+
|
|
10
|
+
<HARD-GATE>
|
|
11
|
+
Do NOT write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
|
|
12
|
+
</HARD-GATE>
|
|
9
13
|
|
|
10
14
|
## Process
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
Follow these phases in order. Do not skip or combine them.
|
|
17
|
+
|
|
18
|
+
### Phase 1: Explore Project Context
|
|
19
|
+
|
|
20
|
+
Before asking questions, understand the current state:
|
|
21
|
+
- Check files, docs, recent commits
|
|
22
|
+
- Understand existing architecture and patterns
|
|
23
|
+
- If the request covers multiple independent subsystems, flag it immediately and help decompose into sub-projects
|
|
24
|
+
|
|
25
|
+
### Phase 2: Ask Clarifying Questions
|
|
26
|
+
|
|
27
|
+
- One question at a time — never overwhelm with multiple questions
|
|
28
|
+
- Prefer multiple choice when possible, open-ended is fine too
|
|
29
|
+
- Focus on: purpose, constraints, success criteria
|
|
30
|
+
- Continue until you have enough clarity to propose approaches
|
|
31
|
+
|
|
32
|
+
### Phase 3: Propose 2-3 Approaches
|
|
33
|
+
|
|
34
|
+
- Present 2-3 different approaches with trade-offs
|
|
35
|
+
- Lead with your recommended option and explain why
|
|
36
|
+
- Wait for the user to choose before proceeding
|
|
37
|
+
|
|
38
|
+
### Phase 4: Present Design
|
|
39
|
+
|
|
40
|
+
Once aligned on approach:
|
|
41
|
+
- Scale each section to its complexity (a few sentences if straightforward, up to 200-300 words if nuanced)
|
|
42
|
+
- Cover: architecture, components, data flow, error handling, testing
|
|
43
|
+
- Ask after each section whether it looks right so far
|
|
44
|
+
- Apply YAGNI ruthlessly — remove unnecessary features
|
|
45
|
+
- Design for isolation: smaller units with clear boundaries
|
|
46
|
+
|
|
47
|
+
### Phase 5: Write Design Doc
|
|
15
48
|
|
|
16
|
-
|
|
49
|
+
Once the user approves the design:
|
|
50
|
+
- Save to `docs/supipowers/specs/YYYY-MM-DD-<topic>-design.md`
|
|
51
|
+
- Use clear, concise writing
|
|
52
|
+
- Commit the design document to git
|
|
17
53
|
|
|
18
|
-
|
|
54
|
+
### Phase 6: Spec Review Loop
|
|
55
|
+
|
|
56
|
+
After writing the design doc:
|
|
57
|
+
1. Dispatch a spec-document-reviewer sub-agent to verify completeness
|
|
58
|
+
2. If **Issues Found**: fix the issues, re-dispatch the reviewer
|
|
59
|
+
3. Repeat until **Approved** (max 5 iterations, then surface to human)
|
|
60
|
+
|
|
61
|
+
### Phase 7: User Review Gate
|
|
62
|
+
|
|
63
|
+
Ask the user to review the spec before proceeding:
|
|
64
|
+
|
|
65
|
+
> "Spec written and committed to `<path>`. Please review it and let me know if you want to make any changes before we start writing out the implementation plan."
|
|
66
|
+
|
|
67
|
+
Wait for their response. Only proceed once approved.
|
|
68
|
+
|
|
69
|
+
### Phase 8: Create Implementation Plan
|
|
70
|
+
|
|
71
|
+
Break into bite-sized tasks (2-5 minutes each). Each task must have:
|
|
19
72
|
- Name with parallelism: `[parallel-safe]` or `[sequential: depends on N]`
|
|
20
73
|
- **files**: Exact paths the agent will touch
|
|
21
74
|
- **criteria**: Acceptance criteria (testable)
|
|
22
75
|
- **complexity**: `small` | `medium` | `large`
|
|
23
76
|
|
|
24
|
-
|
|
77
|
+
Include exact code in the plan, not vague descriptions. Use checkbox syntax (`- [ ]`) for tracking steps.
|
|
25
78
|
|
|
26
|
-
|
|
79
|
+
## Plan Structure
|
|
27
80
|
|
|
28
81
|
```
|
|
29
82
|
---
|
|
@@ -43,12 +96,19 @@ tags: [<relevant>, <tags>]
|
|
|
43
96
|
- **files**: src/path/to/file.ts
|
|
44
97
|
- **criteria**: <what success looks like>
|
|
45
98
|
- **complexity**: small
|
|
99
|
+
|
|
100
|
+
- [ ] Step 1: Write the failing test
|
|
101
|
+
- [ ] Step 2: Run test to verify it fails
|
|
102
|
+
- [ ] Step 3: Write minimal implementation
|
|
103
|
+
- [ ] Step 4: Run test to verify it passes
|
|
104
|
+
- [ ] Step 5: Commit
|
|
46
105
|
```
|
|
47
106
|
|
|
48
107
|
## Principles
|
|
49
108
|
|
|
50
|
-
- Each task should be completable in 2-
|
|
109
|
+
- Each task should be completable in 2-5 minutes
|
|
51
110
|
- Tasks that touch different files are parallel-safe
|
|
52
111
|
- Tasks that depend on others' output are sequential
|
|
53
112
|
- Include test files in the files list
|
|
54
113
|
- Prefer small, focused tasks over large ones
|
|
114
|
+
- DRY, YAGNI, TDD, frequent commits
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: receiving-code-review
|
|
3
|
+
description: Receiving code review feedback — verify before implementing, technical rigor not performative agreement
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Receiving Code Review
|
|
7
|
+
|
|
8
|
+
## Core Principle
|
|
9
|
+
|
|
10
|
+
Code review requires technical evaluation, not emotional performance.
|
|
11
|
+
Verify before implementing. Ask before assuming. Technical correctness over social comfort.
|
|
12
|
+
|
|
13
|
+
## The Response Pattern
|
|
14
|
+
|
|
15
|
+
1. **READ:** Complete feedback without reacting.
|
|
16
|
+
2. **UNDERSTAND:** Restate the requirement in your own words, or ask for clarification.
|
|
17
|
+
3. **VERIFY:** Check against codebase reality.
|
|
18
|
+
4. **EVALUATE:** Is this technically sound for THIS codebase?
|
|
19
|
+
5. **RESPOND:** Technical acknowledgment or reasoned pushback.
|
|
20
|
+
6. **IMPLEMENT:** One item at a time, test each change.
|
|
21
|
+
|
|
22
|
+
## Forbidden Responses
|
|
23
|
+
|
|
24
|
+
Never use performative agreement:
|
|
25
|
+
- "You're absolutely right!"
|
|
26
|
+
- "Great point!"
|
|
27
|
+
- "Excellent catch!"
|
|
28
|
+
- "Thanks for catching that!"
|
|
29
|
+
|
|
30
|
+
Instead: restate requirements, ask clarifying questions, take action.
|
|
31
|
+
|
|
32
|
+
Acceptable responses:
|
|
33
|
+
- "Fixed. [description of what changed]"
|
|
34
|
+
- "Good catch — [issue]. Fixed in [location]."
|
|
35
|
+
- "I disagree because [technical reason]. Here's why: ..."
|
|
36
|
+
|
|
37
|
+
## Handling Unclear Feedback
|
|
38
|
+
|
|
39
|
+
If ANY item is unclear, stop and ask for clarification before implementing anything.
|
|
40
|
+
Items may be related — clarify all unclear items before starting work.
|
|
41
|
+
|
|
42
|
+
## Source-Specific Handling
|
|
43
|
+
|
|
44
|
+
**From your human partner:** Trusted. Implement after understanding.
|
|
45
|
+
|
|
46
|
+
**From external reviewers:** Verify technically. Check for breaking changes. Question whether the reviewer understands the full context.
|
|
47
|
+
|
|
48
|
+
## YAGNI Check
|
|
49
|
+
|
|
50
|
+
For suggested "professional features" — grep the codebase for actual usage.
|
|
51
|
+
If unused, suggest removal instead of implementing.
|
|
52
|
+
|
|
53
|
+
## Implementation Order
|
|
54
|
+
|
|
55
|
+
1. Clarify all unclear items first
|
|
56
|
+
2. Blocking issues (must fix)
|
|
57
|
+
3. Simple fixes (quick wins)
|
|
58
|
+
4. Complex fixes (may need discussion)
|
|
59
|
+
5. Test each change before moving to the next
|
|
60
|
+
|
|
61
|
+
## When to Push Back
|
|
62
|
+
|
|
63
|
+
Push back when feedback would:
|
|
64
|
+
- Introduce bugs or break existing behavior
|
|
65
|
+
- Add unnecessary complexity (YAGNI violation)
|
|
66
|
+
- Contradict the codebase's established patterns
|
|
67
|
+
- Solve a problem that doesn't exist
|
|
68
|
+
|
|
69
|
+
Use technical reasoning, not defensiveness.
|
|
70
|
+
|
|
71
|
+
## Common Mistakes
|
|
72
|
+
|
|
73
|
+
| Mistake | Fix |
|
|
74
|
+
|---------|-----|
|
|
75
|
+
| Agree immediately | Verify against codebase first |
|
|
76
|
+
| Implement all at once | One at a time, test each |
|
|
77
|
+
| Skip unclear items | Ask first, implement second |
|
|
78
|
+
| Performative gratitude | Technical acknowledgment only |
|
|
79
|
+
| Defensive pushback | Reasoned technical argument |
|
|
80
|
+
| Trust without verifying | Check codebase reality |
|
|
81
|
+
| Implement suggested feature | YAGNI check — is it actually needed? |
|
|
82
|
+
|
|
83
|
+
## The Bottom Line
|
|
84
|
+
|
|
85
|
+
External feedback = suggestions to evaluate, not orders to follow.
|
|
86
|
+
Verify. Question. Then implement.
|
|
87
|
+
No performative agreement. Technical rigor always.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Test-driven development — write the test first, watch it fail, write minimal code to pass
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test-Driven Development
|
|
7
|
+
|
|
8
|
+
## Iron Law
|
|
9
|
+
|
|
10
|
+
**NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST.**
|
|
11
|
+
|
|
12
|
+
Write code before the test? Delete it. Start over. No exceptions.
|
|
13
|
+
|
|
14
|
+
## Red-Green-Refactor
|
|
15
|
+
|
|
16
|
+
### RED — Write Failing Test
|
|
17
|
+
|
|
18
|
+
- One behavior per test. "and" in the name? Split it.
|
|
19
|
+
- Clear name that describes behavior.
|
|
20
|
+
- Real code, not mocks (unless unavoidable).
|
|
21
|
+
|
|
22
|
+
**Watch it fail. MANDATORY.**
|
|
23
|
+
- Confirm: fails (not errors), failure message expected, fails because feature missing.
|
|
24
|
+
- Test passes? You're testing existing behavior. Fix the test.
|
|
25
|
+
|
|
26
|
+
### GREEN — Minimal Code
|
|
27
|
+
|
|
28
|
+
Write the simplest code that makes the test pass.
|
|
29
|
+
|
|
30
|
+
- Don't add features, refactor other code, or "improve" beyond the test.
|
|
31
|
+
|
|
32
|
+
**Watch it pass. MANDATORY.**
|
|
33
|
+
- Confirm: test passes, other tests still pass, output pristine.
|
|
34
|
+
- Test fails? Fix code, not test.
|
|
35
|
+
|
|
36
|
+
### REFACTOR — Clean Up (After Green Only)
|
|
37
|
+
|
|
38
|
+
- Remove duplication, improve names, extract helpers.
|
|
39
|
+
- Keep tests green. Don't add behavior.
|
|
40
|
+
|
|
41
|
+
## Verification Checklist
|
|
42
|
+
|
|
43
|
+
Before marking work complete:
|
|
44
|
+
|
|
45
|
+
- [ ] Every new function/method has a test
|
|
46
|
+
- [ ] Watched each test fail before implementing
|
|
47
|
+
- [ ] Each test failed for expected reason (feature missing, not typo)
|
|
48
|
+
- [ ] Wrote minimal code to pass each test
|
|
49
|
+
- [ ] All tests pass with pristine output
|
|
50
|
+
- [ ] Tests use real code (mocks only if unavoidable)
|
|
51
|
+
- [ ] Edge cases and errors covered
|
|
52
|
+
|
|
53
|
+
## Red Flags — STOP and Start Over
|
|
54
|
+
|
|
55
|
+
- Code before test
|
|
56
|
+
- Test after implementation
|
|
57
|
+
- Test passes immediately
|
|
58
|
+
- Can't explain why test failed
|
|
59
|
+
- Tests added "later"
|
|
60
|
+
- Rationalizing "just this once"
|
|
61
|
+
|
|
62
|
+
All of these mean: delete code, start over with TDD.
|
|
63
|
+
|
|
64
|
+
## Testing Anti-Patterns
|
|
65
|
+
|
|
66
|
+
- Don't test mock behavior instead of real behavior
|
|
67
|
+
- Don't add test-only methods to production classes
|
|
68
|
+
- Don't mock without understanding dependencies
|
|
69
|
+
- Mocks are tools to isolate, not things to test
|
|
70
|
+
|
|
71
|
+
## When Stuck
|
|
72
|
+
|
|
73
|
+
| Problem | Solution |
|
|
74
|
+
|---------|----------|
|
|
75
|
+
| Don't know how to test | Write wished-for API. Write assertion first. Ask. |
|
|
76
|
+
| Test too complicated | Design too complicated. Simplify interface. |
|
|
77
|
+
| Must mock everything | Code too coupled. Use dependency injection. |
|
|
78
|
+
| Test setup huge | Extract helpers. Still complex? Simplify design. |
|
|
79
|
+
|
|
80
|
+
## Bug Fix Flow
|
|
81
|
+
|
|
82
|
+
Bug found? Write a failing test reproducing it. Follow the TDD cycle.
|
|
83
|
+
The test proves the fix and prevents regression. Never fix bugs without a test.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification
|
|
3
|
+
description: Verification before completion — evidence before claims, always
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Verification Before Completion
|
|
7
|
+
|
|
8
|
+
## Iron Law
|
|
9
|
+
|
|
10
|
+
**NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE.**
|
|
11
|
+
|
|
12
|
+
Claiming work is complete without verification is dishonesty, not efficiency.
|
|
13
|
+
Evidence before assertions, always.
|
|
14
|
+
|
|
15
|
+
## The Gate Function (Mandatory Before Any Status Claim)
|
|
16
|
+
|
|
17
|
+
1. **IDENTIFY:** What command proves this claim?
|
|
18
|
+
2. **RUN:** Execute the FULL command (fresh, complete).
|
|
19
|
+
3. **READ:** Full output. Check exit code. Count failures.
|
|
20
|
+
4. **VERIFY:** Does output confirm the claim?
|
|
21
|
+
- If NO: State actual status with evidence.
|
|
22
|
+
- If YES: State claim WITH evidence.
|
|
23
|
+
5. **ONLY THEN:** Make the claim.
|
|
24
|
+
|
|
25
|
+
Skip any step = lying, not verifying.
|
|
26
|
+
|
|
27
|
+
## Common Failure Patterns
|
|
28
|
+
|
|
29
|
+
| Claim | Requires | Not Sufficient |
|
|
30
|
+
|-------|----------|----------------|
|
|
31
|
+
| Tests pass | Test command output: 0 failures | Previous run, "should pass" |
|
|
32
|
+
| Build succeeds | Build command: exit 0 | Linter passing, logs look good |
|
|
33
|
+
| Bug fixed | Test original symptom: passes | Code changed, assumed fixed |
|
|
34
|
+
| Regression test works | Red-green cycle verified | Test passes once |
|
|
35
|
+
| Agent completed | VCS diff shows changes | Agent reports "success" |
|
|
36
|
+
| Requirements met | Line-by-line checklist | Tests passing |
|
|
37
|
+
|
|
38
|
+
## Red Flags — STOP Before Claiming
|
|
39
|
+
|
|
40
|
+
- Using "should", "probably", "seems to"
|
|
41
|
+
- Expressing satisfaction before verification ("Great!", "Perfect!", "Done!")
|
|
42
|
+
- About to commit/push/PR without verification
|
|
43
|
+
- Trusting agent success reports without checking
|
|
44
|
+
- Relying on partial verification
|
|
45
|
+
- Thinking "just this once"
|
|
46
|
+
|
|
47
|
+
## When to Apply
|
|
48
|
+
|
|
49
|
+
ALWAYS before:
|
|
50
|
+
- Any variation of success/completion claims
|
|
51
|
+
- Any expression of satisfaction about work state
|
|
52
|
+
- Committing, PR creation, task completion
|
|
53
|
+
- Moving to next task
|
|
54
|
+
- Delegating to agents
|
package/src/commands/plan.ts
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
|
|
2
2
|
import { loadConfig } from "../config/loader.js";
|
|
3
3
|
import { savePlan } from "../storage/plans.js";
|
|
4
|
-
import { notifySuccess, notifyInfo } from "../notifications/renderer.js";
|
|
4
|
+
import { notifySuccess, notifyInfo, notifyError } from "../notifications/renderer.js";
|
|
5
|
+
import {
|
|
6
|
+
generateVisualSessionId,
|
|
7
|
+
createSessionDir,
|
|
8
|
+
getScriptsDir,
|
|
9
|
+
parseServerInfo,
|
|
10
|
+
} from "../visual/companion.js";
|
|
11
|
+
import { buildVisualInstructions } from "../visual/prompt-instructions.js";
|
|
12
|
+
import { buildPlanningPrompt, buildQuickPlanPrompt } from "../planning/prompt-builder.js";
|
|
5
13
|
import * as fs from "node:fs";
|
|
6
14
|
import * as path from "node:path";
|
|
7
15
|
|
|
16
|
+
/** Module-level tracking for cleanup */
|
|
17
|
+
let activeSessionDir: string | null = null;
|
|
18
|
+
|
|
19
|
+
export function getActiveVisualSessionDir(): string | null {
|
|
20
|
+
return activeSessionDir;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function setActiveVisualSessionDir(dir: string | null): void {
|
|
24
|
+
activeSessionDir = dir;
|
|
25
|
+
}
|
|
26
|
+
|
|
8
27
|
export function registerPlanCommand(pi: ExtensionAPI): void {
|
|
9
28
|
pi.registerCommand("supi:plan", {
|
|
10
29
|
description: "Start collaborative planning for a feature or task",
|
|
@@ -24,39 +43,85 @@ export function registerPlanCommand(pi: ExtensionAPI): void {
|
|
|
24
43
|
const isQuick = args?.startsWith("--quick");
|
|
25
44
|
const quickDesc = isQuick ? args.replace("--quick", "").trim() : "";
|
|
26
45
|
|
|
46
|
+
// ── Visual companion consent ──────────────────────────────────
|
|
47
|
+
let visualUrl: string | null = null;
|
|
48
|
+
let visualSessionDir: string | null = null;
|
|
49
|
+
|
|
50
|
+
if (ctx.hasUI && !isQuick) {
|
|
51
|
+
const modeChoice = await ctx.ui.select(
|
|
52
|
+
"Planning mode",
|
|
53
|
+
[
|
|
54
|
+
"Terminal only",
|
|
55
|
+
"Terminal + Visual companion (opens browser)",
|
|
56
|
+
],
|
|
57
|
+
{ helpText: "Visual companion shows mockups and diagrams in a browser · Esc to cancel" },
|
|
58
|
+
);
|
|
59
|
+
if (!modeChoice) return;
|
|
60
|
+
|
|
61
|
+
if (modeChoice.startsWith("Terminal + Visual")) {
|
|
62
|
+
const sessionId = generateVisualSessionId();
|
|
63
|
+
visualSessionDir = createSessionDir(ctx.cwd, sessionId);
|
|
64
|
+
const scriptsDir = getScriptsDir();
|
|
65
|
+
|
|
66
|
+
// Install server dependencies if needed
|
|
67
|
+
const nodeModules = path.join(scriptsDir, "node_modules");
|
|
68
|
+
if (!fs.existsSync(nodeModules)) {
|
|
69
|
+
notifyInfo(ctx, "Installing visual companion dependencies...");
|
|
70
|
+
const installResult = await pi.exec("npm", ["install", "--production"], { cwd: scriptsDir });
|
|
71
|
+
if (installResult.code !== 0) {
|
|
72
|
+
notifyError(ctx, "Failed to install visual companion dependencies", installResult.stderr);
|
|
73
|
+
visualSessionDir = null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (visualSessionDir) {
|
|
78
|
+
// Stop any previous visual companion
|
|
79
|
+
if (activeSessionDir) {
|
|
80
|
+
const stopScript = path.join(scriptsDir, "stop-server.sh");
|
|
81
|
+
await pi.exec("bash", [stopScript, activeSessionDir], { cwd: scriptsDir });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Start the server (pass session dir via env command since ExecOptions has no env)
|
|
85
|
+
const startScript = path.join(scriptsDir, "start-server.sh");
|
|
86
|
+
const startResult = await pi.exec("env", [
|
|
87
|
+
`SUPI_VISUAL_DIR=${visualSessionDir}`,
|
|
88
|
+
"bash",
|
|
89
|
+
startScript,
|
|
90
|
+
], { cwd: scriptsDir });
|
|
91
|
+
|
|
92
|
+
if (startResult.code === 0) {
|
|
93
|
+
const serverInfo = parseServerInfo(startResult.stdout);
|
|
94
|
+
if (serverInfo) {
|
|
95
|
+
visualUrl = serverInfo.url;
|
|
96
|
+
activeSessionDir = visualSessionDir;
|
|
97
|
+
notifyInfo(ctx, "Visual companion ready", visualUrl);
|
|
98
|
+
} else {
|
|
99
|
+
notifyError(ctx, "Visual companion started but no connection info received");
|
|
100
|
+
visualSessionDir = null;
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
const errorMsg = startResult.stderr || startResult.stdout;
|
|
104
|
+
notifyError(ctx, "Failed to start visual companion", errorMsg);
|
|
105
|
+
visualSessionDir = null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ── Build prompt ──────────────────────────────────────────────
|
|
27
112
|
let prompt: string;
|
|
28
113
|
if (isQuick && quickDesc) {
|
|
29
|
-
prompt =
|
|
30
|
-
"Generate a concise implementation plan for the following task.",
|
|
31
|
-
"Skip brainstorming — go straight to task breakdown.",
|
|
32
|
-
"",
|
|
33
|
-
`Task: ${quickDesc}`,
|
|
34
|
-
"",
|
|
35
|
-
"Format the plan as markdown with YAML frontmatter (name, created, tags).",
|
|
36
|
-
"Each task should have: name, [parallel-safe] or [sequential] annotation,",
|
|
37
|
-
"**files**, **criteria**, and **complexity** (small/medium/large).",
|
|
38
|
-
"",
|
|
39
|
-
skillContent ? "Follow these planning guidelines:\n" + skillContent : "",
|
|
40
|
-
"",
|
|
41
|
-
"After generating the plan, save it and confirm with the user.",
|
|
42
|
-
].join("\n");
|
|
114
|
+
prompt = buildQuickPlanPrompt(quickDesc, skillContent || undefined);
|
|
43
115
|
} else {
|
|
44
|
-
prompt =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"",
|
|
54
|
-
"Format the final plan as markdown with YAML frontmatter (name, created, tags).",
|
|
55
|
-
"Each task: name, [parallel-safe] or [sequential] annotation,",
|
|
56
|
-
"**files**, **criteria**, **complexity** (small/medium/large).",
|
|
57
|
-
"",
|
|
58
|
-
skillContent ? "Follow these planning guidelines:\n" + skillContent : "",
|
|
59
|
-
].join("\n");
|
|
116
|
+
prompt = buildPlanningPrompt({
|
|
117
|
+
topic: args || undefined,
|
|
118
|
+
skillContent: skillContent || undefined,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Append visual companion instructions if active
|
|
123
|
+
if (visualUrl && visualSessionDir) {
|
|
124
|
+
prompt += "\n\n" + buildVisualInstructions(visualUrl, visualSessionDir);
|
|
60
125
|
}
|
|
61
126
|
|
|
62
127
|
pi.sendMessage(
|