@pi-unipi/unipi 0.1.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/README.md +143 -0
- package/package.json +70 -0
- package/packages/btw/README.md +95 -0
- package/packages/btw/extensions/btw.ts +1972 -0
- package/packages/btw/skills/btw/SKILL.md +149 -0
- package/packages/core/README.md +74 -0
- package/packages/core/index.ts +10 -0
- package/packages/info-screen/README.md +115 -0
- package/packages/info-screen/index.ts +165 -0
- package/packages/memory/README.md +94 -0
- package/packages/memory/index.ts +209 -0
- package/packages/memory/skills/memory/SKILL.md +151 -0
- package/packages/ralph/README.md +101 -0
- package/packages/ralph/index.ts +548 -0
- package/packages/subagents/README.md +114 -0
- package/packages/unipi/index.ts +28 -0
- package/packages/workflow/README.md +129 -0
- package/packages/workflow/index.ts +155 -0
- package/packages/workflow/skills/brainstorm/SKILL.md +202 -0
- package/packages/workflow/skills/consolidate/SKILL.md +142 -0
- package/packages/workflow/skills/consultant/SKILL.md +97 -0
- package/packages/workflow/skills/document/SKILL.md +120 -0
- package/packages/workflow/skills/gather-context/SKILL.md +122 -0
- package/packages/workflow/skills/plan/SKILL.md +169 -0
- package/packages/workflow/skills/quick-work/SKILL.md +110 -0
- package/packages/workflow/skills/review-work/SKILL.md +131 -0
- package/packages/workflow/skills/scan-issues/SKILL.md +183 -0
- package/packages/workflow/skills/work/SKILL.md +144 -0
- package/packages/workflow/skills/worktree-create/SKILL.md +69 -0
- package/packages/workflow/skills/worktree-list/SKILL.md +67 -0
- package/packages/workflow/skills/worktree-merge/SKILL.md +79 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-work
|
|
3
|
+
description: "Review work — check task completion, run lint/build, mark reviewer remarks. Use after /unipi:work completes."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Reviewing Work
|
|
7
|
+
|
|
8
|
+
Review what was built, verify task completion, run codebase checks, add reviewer remarks.
|
|
9
|
+
|
|
10
|
+
## Boundaries
|
|
11
|
+
|
|
12
|
+
**This skill MAY:** read codebase, run checks (lint, build, test, docker), write reviewer remarks to plan docs.
|
|
13
|
+
**This skill MAY NOT:** edit code, implement features, create new files.
|
|
14
|
+
|
|
15
|
+
## Command Format
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/unipi:review-work plan:<path>(optional) <string(greedy)>(optional)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- `plan:<path)` — specific plan to review (auto-suggested)
|
|
22
|
+
- `string(greedy)` — scope (e.g., "only review auth tasks" or "just check builds")
|
|
23
|
+
- If no plan provided → agent finds latest plan or asks user
|
|
24
|
+
- Runs in current session (or worktree session if still active)
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Phase 1: Load Plan
|
|
29
|
+
|
|
30
|
+
1. If `plan:` arg provided, read that plan
|
|
31
|
+
2. If not, list plans in `.unipi/docs/plans/` and ask user
|
|
32
|
+
3. Read plan fully — understand tasks, acceptance criteria, current status
|
|
33
|
+
|
|
34
|
+
**Exit:** Plan loaded. Know what to review.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Phase 2: Check Task Completion
|
|
39
|
+
|
|
40
|
+
For each task in plan:
|
|
41
|
+
|
|
42
|
+
1. Read acceptance criteria
|
|
43
|
+
2. Verify against actual implementation
|
|
44
|
+
3. Determine status:
|
|
45
|
+
- **Done** — all criteria met
|
|
46
|
+
- **Partially Done X/Y** — some steps complete, others not
|
|
47
|
+
- **Unstarted** — nothing done
|
|
48
|
+
|
|
49
|
+
If `string(greedy)` scope provided, only check matching tasks.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Phase 3: Run Codebase Checks
|
|
54
|
+
|
|
55
|
+
Run project's verification suite:
|
|
56
|
+
|
|
57
|
+
1. **Lint** — `npm run lint` or equivalent
|
|
58
|
+
2. **Type check** — `tsc --noEmit` or equivalent
|
|
59
|
+
3. **Tests** — `npm test` or equivalent
|
|
60
|
+
4. **Build** — `npm run build` or equivalent
|
|
61
|
+
5. **Docker** — `docker build .` if Dockerfile exists
|
|
62
|
+
|
|
63
|
+
Report results. If any fail:
|
|
64
|
+
- Note which checks failed
|
|
65
|
+
- Identify which tasks are affected
|
|
66
|
+
- Don't fix — just report
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Phase 4: Write Reviewer Remarks
|
|
71
|
+
|
|
72
|
+
Add `REVIEWER-REMARK` at the **end of the plan document**, behind a divider:
|
|
73
|
+
|
|
74
|
+
```markdown
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Reviewer Remarks
|
|
78
|
+
|
|
79
|
+
REVIEWER-REMARK: Partially Done 3/5
|
|
80
|
+
- Tasks 1-3 complete, verified against acceptance criteria
|
|
81
|
+
- Task 4 stuck: API endpoint returns 500, needs investigation
|
|
82
|
+
- Task 5 unstarted: depends on Task 4
|
|
83
|
+
|
|
84
|
+
Codebase Checks:
|
|
85
|
+
- ✓ Lint passed
|
|
86
|
+
- ✓ Type check passed
|
|
87
|
+
- ✗ Tests failed: 2 failing in auth.test.ts
|
|
88
|
+
- ✓ Build passed
|
|
89
|
+
- ✓ Docker build passed
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Status Format
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
REVIEWER-REMARK: <Done | Partially Done X/Y | Unstarted>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Followed by description explaining the status.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Phase 5: Handoff
|
|
103
|
+
|
|
104
|
+
Based on review results:
|
|
105
|
+
|
|
106
|
+
**If all tasks done and checks pass:**
|
|
107
|
+
> "All tasks complete and verified. Ready to consolidate."
|
|
108
|
+
```
|
|
109
|
+
/unipi:consolidate
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**If tasks incomplete or checks fail:**
|
|
113
|
+
> "Tasks remaining and/or checks failing. Continue work?"
|
|
114
|
+
```
|
|
115
|
+
/unipi:work worktree:<branch> specs:<plan-path>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**If scoped review complete:**
|
|
119
|
+
> "Scoped review complete. Run full review or continue work?"
|
|
120
|
+
```
|
|
121
|
+
/unipi:review-work plan:<plan-path> (full review)
|
|
122
|
+
/unipi:work specs:<plan-path> (continue work)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Notes
|
|
128
|
+
|
|
129
|
+
- Reviewer remarks append to end of plan — don't modify existing content
|
|
130
|
+
- Check results are factual — report pass/fail, don't diagnose
|
|
131
|
+
- This is a checkpoint, not a fix pass — work continues via `/unipi:work`
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scan-issues
|
|
3
|
+
description: "Deep investigation — find bugs, anti-patterns, security issues. Spawns subagents if available."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scanning for Issues
|
|
7
|
+
|
|
8
|
+
Deep investigation of codebase to find bugs, anti-patterns, security issues, and technical debt.
|
|
9
|
+
|
|
10
|
+
## Boundaries
|
|
11
|
+
|
|
12
|
+
**This skill MAY:** read codebase, run read-only analysis commands, spawn subagents, write findings.
|
|
13
|
+
**This skill MAY NOT:** edit code, fix issues, run tests that modify state, deploy.
|
|
14
|
+
|
|
15
|
+
**This is investigation only — not fixing.**
|
|
16
|
+
|
|
17
|
+
## Command Format
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/unipi:scan-issues <string(greedy)>(optional)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- `string(greedy)` — optional scope (e.g., "focus on auth", "check for SQL injection", "find dead code")
|
|
24
|
+
- If not provided → full codebase scan
|
|
25
|
+
- Read-only sandbox
|
|
26
|
+
- Spawns subagents if `@unipi/subagents` extension is installed
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Process
|
|
31
|
+
|
|
32
|
+
### Phase 1: Determine Scope
|
|
33
|
+
|
|
34
|
+
**If scope provided:**
|
|
35
|
+
1. Parse the focus area
|
|
36
|
+
2. Determine scan type:
|
|
37
|
+
- Security scan
|
|
38
|
+
- Bug hunt
|
|
39
|
+
- Anti-pattern detection
|
|
40
|
+
- Tech debt assessment
|
|
41
|
+
- Performance issues
|
|
42
|
+
|
|
43
|
+
**If no scope:**
|
|
44
|
+
1. Ask user what to focus on, or
|
|
45
|
+
2. Run broad scan covering all categories
|
|
46
|
+
|
|
47
|
+
**Exit:** Scope defined.
|
|
48
|
+
|
|
49
|
+
### Phase 2: Deep Investigation
|
|
50
|
+
|
|
51
|
+
If subagents available:
|
|
52
|
+
1. Spawn parallel subagents for different scan types
|
|
53
|
+
2. Each subagent investigates independently
|
|
54
|
+
3. Collect findings from all subagents
|
|
55
|
+
|
|
56
|
+
If no subagents:
|
|
57
|
+
1. Investigate sequentially
|
|
58
|
+
2. Use grep, find, read commands
|
|
59
|
+
3. Build findings incrementally
|
|
60
|
+
|
|
61
|
+
**Scan categories:**
|
|
62
|
+
|
|
63
|
+
**Security:**
|
|
64
|
+
- Hardcoded secrets/credentials
|
|
65
|
+
- SQL injection vulnerabilities
|
|
66
|
+
- XSS vulnerabilities
|
|
67
|
+
- Insecure dependencies
|
|
68
|
+
- Missing input validation
|
|
69
|
+
- Exposed sensitive data
|
|
70
|
+
|
|
71
|
+
**Bugs:**
|
|
72
|
+
- Null/undefined handling
|
|
73
|
+
- Race conditions
|
|
74
|
+
- Error handling gaps
|
|
75
|
+
- Edge cases missed
|
|
76
|
+
- Logic errors
|
|
77
|
+
- Off-by-one errors
|
|
78
|
+
|
|
79
|
+
**Anti-patterns:**
|
|
80
|
+
- Code duplication
|
|
81
|
+
- God objects/functions
|
|
82
|
+
- Circular dependencies
|
|
83
|
+
- Tight coupling
|
|
84
|
+
- Magic numbers/strings
|
|
85
|
+
- Inconsistent patterns
|
|
86
|
+
|
|
87
|
+
**Tech debt:**
|
|
88
|
+
- TODO/FIXME comments
|
|
89
|
+
- Deprecated API usage
|
|
90
|
+
- Outdated dependencies
|
|
91
|
+
- Dead code
|
|
92
|
+
- Missing tests
|
|
93
|
+
- Poor naming
|
|
94
|
+
|
|
95
|
+
**Performance:**
|
|
96
|
+
- N+1 queries
|
|
97
|
+
- Unnecessary re-renders
|
|
98
|
+
- Large bundle imports
|
|
99
|
+
- Missing caching
|
|
100
|
+
- Inefficient algorithms
|
|
101
|
+
|
|
102
|
+
**Exit:** Findings collected.
|
|
103
|
+
|
|
104
|
+
### Phase 3: Categorize & Prioritize
|
|
105
|
+
|
|
106
|
+
Organize findings by severity:
|
|
107
|
+
|
|
108
|
+
**Critical (P0):**
|
|
109
|
+
- Security vulnerabilities
|
|
110
|
+
- Data loss risks
|
|
111
|
+
- Production-breaking bugs
|
|
112
|
+
|
|
113
|
+
**High (P1):**
|
|
114
|
+
- Significant bugs
|
|
115
|
+
- Major anti-patterns
|
|
116
|
+
- Performance bottlenecks
|
|
117
|
+
|
|
118
|
+
**Medium (P2):**
|
|
119
|
+
- Minor bugs
|
|
120
|
+
- Tech debt
|
|
121
|
+
- Code smells
|
|
122
|
+
|
|
123
|
+
**Low (P3):**
|
|
124
|
+
- Style issues
|
|
125
|
+
- Minor improvements
|
|
126
|
+
- Nice-to-haves
|
|
127
|
+
|
|
128
|
+
### Phase 4: Present Findings
|
|
129
|
+
|
|
130
|
+
```markdown
|
|
131
|
+
## Issue Scan Results
|
|
132
|
+
|
|
133
|
+
### Critical (P0)
|
|
134
|
+
- {Finding} — {file:line} — {description}
|
|
135
|
+
|
|
136
|
+
### High (P1)
|
|
137
|
+
- {Finding} — {file:line} — {description}
|
|
138
|
+
|
|
139
|
+
### Medium (P2)
|
|
140
|
+
- {Finding} — {file:line} — {description}
|
|
141
|
+
|
|
142
|
+
### Low (P3)
|
|
143
|
+
- {Finding} — {file:line} — {description}
|
|
144
|
+
|
|
145
|
+
### Summary
|
|
146
|
+
- Total issues: {count}
|
|
147
|
+
- Critical: {count}
|
|
148
|
+
- High: {count}
|
|
149
|
+
- Medium: {count}
|
|
150
|
+
- Low: {count}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Phase 5: Handoff
|
|
154
|
+
|
|
155
|
+
Based on findings:
|
|
156
|
+
|
|
157
|
+
**If critical issues found:**
|
|
158
|
+
> "Critical issues found. Recommend addressing immediately."
|
|
159
|
+
```
|
|
160
|
+
/unipi:quick-work "fix critical security issue in auth.ts"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**If many issues:**
|
|
164
|
+
> "Multiple issues found. Consider planning a cleanup sprint."
|
|
165
|
+
```
|
|
166
|
+
/unipi:brainstorm "tech debt cleanup plan"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**If few/no issues:**
|
|
170
|
+
> "Codebase looks healthy. No critical issues found."
|
|
171
|
+
```
|
|
172
|
+
/unipi:consolidate
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Notes
|
|
178
|
+
|
|
179
|
+
- Investigation only — findings are reported, not fixed
|
|
180
|
+
- Subagent support enables parallel scanning when available
|
|
181
|
+
- Can focus on specific categories or scan broadly
|
|
182
|
+
- Prioritized findings help triage what to fix first
|
|
183
|
+
- Natural lead-in to quick-work (for critical) or brainstorm (for planned cleanup)
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: work
|
|
3
|
+
description: "Execute plan — implement in worktree, test, commit on done. Resumable across sessions."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Executing Plans
|
|
7
|
+
|
|
8
|
+
Load plan, review critically, execute tasks, commit when complete.
|
|
9
|
+
|
|
10
|
+
## Boundaries
|
|
11
|
+
|
|
12
|
+
**This skill MAY:** read/write code in worktree, read/write `.unipi/docs/`, run tests, commit, create worktree.
|
|
13
|
+
**This skill MAY NOT:** modify files outside worktree, merge branches, deploy.
|
|
14
|
+
|
|
15
|
+
## Command Format
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/unipi:work worktree:<branch>(optional) specs:<path>(multiple,optional) <string(greedy)>(optional)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- `worktree:<branch>` — branch to work on (auto-suggested, agent asks if not provided)
|
|
22
|
+
- `specs:<path>` — plan(s) to execute (auto-suggested, agent asks if not provided)
|
|
23
|
+
- `string(greedy)` — scope guidance (e.g., "only task 1 and 2")
|
|
24
|
+
- **Recommended: new session** — this command switches pi's internal worktree
|
|
25
|
+
|
|
26
|
+
## Sandbox
|
|
27
|
+
|
|
28
|
+
- **Read/Write:** full access within worktree directory
|
|
29
|
+
- **Write:** `.unipi/docs/` for progress tracking
|
|
30
|
+
- **Cannot:** modify files outside worktree
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Phase 1: Resolve Args
|
|
35
|
+
|
|
36
|
+
If args not provided, ask user interactively:
|
|
37
|
+
|
|
38
|
+
1. **Worktree:**
|
|
39
|
+
- "Do you want to work on current branch or create a worktree?"
|
|
40
|
+
- If worktree: "What branch name?" (suggest based on spec topic)
|
|
41
|
+
- Create worktree if not exists
|
|
42
|
+
|
|
43
|
+
2. **Specs:**
|
|
44
|
+
- List available plans in `.unipi/docs/plans/`
|
|
45
|
+
- "Which plan(s) to execute?"
|
|
46
|
+
- Can select multiple
|
|
47
|
+
|
|
48
|
+
3. **Scope:**
|
|
49
|
+
- If `string(greedy)` provided, use to scope tasks
|
|
50
|
+
- Otherwise execute all incomplete tasks
|
|
51
|
+
|
|
52
|
+
**Exit:** Worktree set, plan(s) loaded, scope defined.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Phase 2: Review Plan
|
|
57
|
+
|
|
58
|
+
1. Read plan file(s)
|
|
59
|
+
2. Review critically — identify questions or concerns
|
|
60
|
+
3. If concerns: raise with user before starting
|
|
61
|
+
4. Identify which tasks are already `[x]` (done) vs `[ ]` (pending)
|
|
62
|
+
|
|
63
|
+
**Exit:** Plan reviewed, ready to execute.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Phase 3: Execute Tasks
|
|
68
|
+
|
|
69
|
+
For each task in order:
|
|
70
|
+
|
|
71
|
+
1. Mark task as `in_progress` in plan
|
|
72
|
+
2. Follow each step exactly (plan has bite-sized steps)
|
|
73
|
+
3. Run verifications as specified in acceptance criteria
|
|
74
|
+
4. Mark as `[x]` when complete
|
|
75
|
+
5. Update plan file with progress
|
|
76
|
+
|
|
77
|
+
### When to Stop and Ask
|
|
78
|
+
|
|
79
|
+
**STOP immediately when:**
|
|
80
|
+
- Hit blocker (missing dependency, test fails, instruction unclear)
|
|
81
|
+
- Plan has critical gaps
|
|
82
|
+
- You don't understand an instruction
|
|
83
|
+
- Verification fails repeatedly
|
|
84
|
+
|
|
85
|
+
Ask for clarification rather than guessing.
|
|
86
|
+
|
|
87
|
+
### When to Revisit Earlier Steps
|
|
88
|
+
|
|
89
|
+
**Return to review when:**
|
|
90
|
+
- Partner updates plan based on feedback
|
|
91
|
+
- Fundamental approach needs rethinking
|
|
92
|
+
|
|
93
|
+
Don't force through blockers — stop and ask.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Phase 4: Commit Progress
|
|
98
|
+
|
|
99
|
+
After each task or group of tasks:
|
|
100
|
+
1. Stage changes
|
|
101
|
+
2. Commit with descriptive message referencing task name
|
|
102
|
+
3. Continue to next task
|
|
103
|
+
|
|
104
|
+
Don't wait until end to commit — incremental commits are safer.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Phase 5: Complete
|
|
109
|
+
|
|
110
|
+
When all tasks marked `[x]`:
|
|
111
|
+
|
|
112
|
+
1. Run final verification (tests, lint, build)
|
|
113
|
+
2. Commit all remaining changes
|
|
114
|
+
3. Update plan with completion status
|
|
115
|
+
4. Inform user:
|
|
116
|
+
|
|
117
|
+
> "All tasks complete. Worktree: `feat/<branch>`. Recommend reviewing before merge."
|
|
118
|
+
|
|
119
|
+
Suggest next step:
|
|
120
|
+
```
|
|
121
|
+
/unipi:review-work plan:<plan-path>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Recommend starting a new session** for review.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Resumability
|
|
129
|
+
|
|
130
|
+
If user runs `/unipi:work` and plan has partial `[x]` marks:
|
|
131
|
+
1. Read plan
|
|
132
|
+
2. Identify first `[ ]` task
|
|
133
|
+
3. Ask user: "Resume from Task N: {name}?"
|
|
134
|
+
4. Continue from there
|
|
135
|
+
|
|
136
|
+
If user provides scope string, only execute matching tasks.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Notes
|
|
141
|
+
|
|
142
|
+
- Agent reads plan regardlessly on start — finds what's incomplete
|
|
143
|
+
- Worktree isolation: changes don't affect main branch until merge
|
|
144
|
+
- Each worktree session is independent — no coordination with other worktrees
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: worktree-create
|
|
3
|
+
description: "Create git worktree for parallel work. Agent-driven naming."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Creating Worktrees
|
|
7
|
+
|
|
8
|
+
Create a git worktree for isolated parallel work.
|
|
9
|
+
|
|
10
|
+
## Boundaries
|
|
11
|
+
|
|
12
|
+
**This skill MAY:** run git worktree commands, ask user for branch name, suggest names.
|
|
13
|
+
**This skill MAY NOT:** edit code, run tests, implement features.
|
|
14
|
+
|
|
15
|
+
## Command Format
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/unipi:worktree-create <string(greedy)>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- `string(greedy)` — description or desired branch name
|
|
22
|
+
- Agent asks user for exact name or suggests based on description
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Process
|
|
27
|
+
|
|
28
|
+
### Phase 1: Parse Input
|
|
29
|
+
|
|
30
|
+
1. Read the string input
|
|
31
|
+
2. Assess if it's a branch name or a description:
|
|
32
|
+
- Branch name: `feat/auth`, `fix/login-bug` → use directly
|
|
33
|
+
- Description: "add user authentication" → suggest name
|
|
34
|
+
|
|
35
|
+
### Phase 2: Name Resolution
|
|
36
|
+
|
|
37
|
+
**If clear branch name:**
|
|
38
|
+
> "Creating worktree on branch `feat/auth`. Confirm?"
|
|
39
|
+
|
|
40
|
+
**If description:**
|
|
41
|
+
> "Based on your description, I suggest: `feat/user-auth`. What name would you like?"
|
|
42
|
+
|
|
43
|
+
Let user confirm or provide different name.
|
|
44
|
+
|
|
45
|
+
### Phase 3: Create Worktree
|
|
46
|
+
|
|
47
|
+
1. Check if branch already exists (local or remote)
|
|
48
|
+
2. If exists: ask user if they want to reuse or create new
|
|
49
|
+
3. Create worktree:
|
|
50
|
+
```bash
|
|
51
|
+
git worktree add .unipi/worktrees/<branch> -b <branch>
|
|
52
|
+
```
|
|
53
|
+
4. Verify creation succeeded
|
|
54
|
+
|
|
55
|
+
### Phase 4: Confirm
|
|
56
|
+
|
|
57
|
+
Report:
|
|
58
|
+
> "Worktree created: `.unipi/worktrees/<branch>` (branch: `<branch>`)"
|
|
59
|
+
> "To work in this worktree: `/unipi:work worktree:<branch> specs:<plan>`"
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Notes
|
|
64
|
+
|
|
65
|
+
- Worktrees stored in `.unipi/worktrees/` directory
|
|
66
|
+
- Each worktree is a full working copy with its own branch
|
|
67
|
+
- Multiple worktrees can exist for parallel work
|
|
68
|
+
- Use `/unipi:worktree-list` to see all worktrees
|
|
69
|
+
- Use `/unipi:worktree-merge` to merge back to main
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: worktree-list
|
|
3
|
+
description: "List all unipi worktrees. Shows branch, path, and status."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Listing Worktrees
|
|
7
|
+
|
|
8
|
+
List all git worktrees created by unipi.
|
|
9
|
+
|
|
10
|
+
## Boundaries
|
|
11
|
+
|
|
12
|
+
**This skill MAY:** run git worktree commands, read filesystem.
|
|
13
|
+
**This skill MAY NOT:** edit anything, create worktrees, merge branches.
|
|
14
|
+
|
|
15
|
+
## Command Format
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/unipi:worktree-list
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
No arguments. Lists all unipi worktrees.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Process
|
|
26
|
+
|
|
27
|
+
### Phase 1: Gather Worktrees
|
|
28
|
+
|
|
29
|
+
1. Run `git worktree list --porcelain`
|
|
30
|
+
2. Filter for worktrees under `.unipi/worktrees/`
|
|
31
|
+
3. For each worktree, collect:
|
|
32
|
+
- Branch name
|
|
33
|
+
- Path
|
|
34
|
+
- HEAD commit
|
|
35
|
+
- Whether it has uncommitted changes
|
|
36
|
+
|
|
37
|
+
### Phase 2: Present
|
|
38
|
+
|
|
39
|
+
Display in table format:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Worktrees:
|
|
43
|
+
┌──────────────────┬────────────────────────────────┬─────────┐
|
|
44
|
+
│ Branch │ Path │ Status │
|
|
45
|
+
├──────────────────┼────────────────────────────────┼─────────┤
|
|
46
|
+
│ feat/auth │ .unipi/worktrees/feat/auth │ clean │
|
|
47
|
+
│ fix/login-bug │ .unipi/worktrees/fix/login-bug │ dirty │
|
|
48
|
+
└──────────────────┴────────────────────────────────┴─────────┘
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If no worktrees:
|
|
52
|
+
> "No unipi worktrees. Create one with `/unipi:worktree-create`"
|
|
53
|
+
|
|
54
|
+
### Phase 3: Suggest Actions
|
|
55
|
+
|
|
56
|
+
Based on state:
|
|
57
|
+
- If dirty worktrees exist → suggest reviewing or committing
|
|
58
|
+
- If clean worktrees exist → suggest working or merging
|
|
59
|
+
- Always available: `/unipi:worktree-create`, `/unipi:worktree-merge`
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Notes
|
|
64
|
+
|
|
65
|
+
- Only shows worktrees under `.unipi/worktrees/`
|
|
66
|
+
- Ignores worktrees in other locations
|
|
67
|
+
- Status: `clean` = no uncommitted changes, `dirty` = has changes
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: worktree-merge
|
|
3
|
+
description: "Merge worktree branches back to main. Gathers context from specs/plans, merges, cleans up."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Worktree Merge
|
|
7
|
+
|
|
8
|
+
Merge completed worktree branches into main. Gather context from docs before merging.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
### Phase 1: Gather Context
|
|
13
|
+
|
|
14
|
+
Before merging, read existing specs and plans to understand what each worktree was implementing:
|
|
15
|
+
|
|
16
|
+
1. Read all files in `.unipi/docs/specs/` (if exists)
|
|
17
|
+
2. Read all files in `.unipi/docs/plans/` (if exists)
|
|
18
|
+
3. Build a map: branch → what it was working on
|
|
19
|
+
|
|
20
|
+
This context helps during merge conflicts and in the final report.
|
|
21
|
+
|
|
22
|
+
### Phase 2: Resolve Target Branch
|
|
23
|
+
|
|
24
|
+
1. Check for `main` branch: `git branch --list main`
|
|
25
|
+
2. If not found, check `master`: `git branch --list master`
|
|
26
|
+
3. If neither exists, ask user for target branch
|
|
27
|
+
|
|
28
|
+
### Phase 3: Resolve Source Branches
|
|
29
|
+
|
|
30
|
+
**If branches provided in args:**
|
|
31
|
+
- Verify each branch exists: `git branch --list <name>`
|
|
32
|
+
- Check worktree status for each
|
|
33
|
+
|
|
34
|
+
**If no branches provided:**
|
|
35
|
+
- List all worktrees: `git worktree list`
|
|
36
|
+
- Filter to `.unipi/worktrees/` paths only
|
|
37
|
+
- Show each with status (clean/dirty via `git status`)
|
|
38
|
+
- Ask user which to merge
|
|
39
|
+
|
|
40
|
+
### Phase 4: Merge Each Branch
|
|
41
|
+
|
|
42
|
+
For each source branch (in dependency order if specs indicate ordering):
|
|
43
|
+
|
|
44
|
+
1. **Checkout target:** `git checkout main`
|
|
45
|
+
2. **Merge:** `git merge <branch> --no-edit`
|
|
46
|
+
3. **If conflict:**
|
|
47
|
+
- Report which files conflict
|
|
48
|
+
- Reference the spec/plan context: "This branch was working on: <description>"
|
|
49
|
+
- Ask user how to resolve (do NOT force merge)
|
|
50
|
+
- Skip to next branch if user says so
|
|
51
|
+
4. **If success:**
|
|
52
|
+
- Remove worktree: `git worktree remove .unipi/worktrees/<branch-name>`
|
|
53
|
+
- Delete branch: `git branch -d <branch>`
|
|
54
|
+
- Log success with context: "Merged: <what it was doing>"
|
|
55
|
+
|
|
56
|
+
### Phase 5: Report
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
Merge Summary:
|
|
60
|
+
✓ feat/auth — merged (auth system implementation from specs/auth-system.md)
|
|
61
|
+
✓ fix/login-bug — merged (login fix from plans/bugfix-login.md)
|
|
62
|
+
✗ feat/dashboard — CONFLICT in src/dashboard.ts, skipped
|
|
63
|
+
|
|
64
|
+
Worktrees cleaned: 2 removed
|
|
65
|
+
Branches deleted: 2
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Phase 6: Suggest Next
|
|
69
|
+
|
|
70
|
+
- If all merged cleanly → suggest `/unipi:consolidate` to save learnings
|
|
71
|
+
- If conflicts remain → suggest resolving and retrying `/unipi:worktree-merge`
|
|
72
|
+
- If specs/plans exist for merged work → suggest `/unipi:document` to update docs
|
|
73
|
+
|
|
74
|
+
## Important
|
|
75
|
+
|
|
76
|
+
- ALWAYS read specs/plans before merging — context prevents bad conflict resolution
|
|
77
|
+
- NEVER force push or force merge
|
|
78
|
+
- Ask user before destructive operations (branch deletion)
|
|
79
|
+
- If a worktree has uncommitted changes, warn and skip
|