@pi-unipi/workflow 0.1.3 → 0.1.5
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/commands.ts +33 -2
- package/index.ts +11 -2
- package/package.json +1 -1
- package/skills/brainstorm/SKILL.md +1 -0
- package/skills/plan/SKILL.md +19 -13
- package/skills/review-work/SKILL.md +6 -2
- package/skills/work/SKILL.md +9 -9
- package/skills/worktree-list/SKILL.md +23 -12
- package/skills/worktree-merge/SKILL.md +10 -2
package/commands.ts
CHANGED
|
@@ -54,6 +54,27 @@ function suggestSpecFiles(prefix: string): { value: string; label: string; descr
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Suggest plan files from .unipi/docs/plans/ for work and review-work commands.
|
|
59
|
+
*/
|
|
60
|
+
function suggestPlanFiles(prefix: string): { value: string; label: string; description: string }[] {
|
|
61
|
+
const plansDir = join(process.cwd(), ".unipi", "docs", "plans");
|
|
62
|
+
if (!existsSync(plansDir)) return [];
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const files = readdirSync(plansDir).filter((f) => f.endsWith(".md"));
|
|
66
|
+
return files
|
|
67
|
+
.filter((f) => !prefix || f.includes(prefix))
|
|
68
|
+
.map((f) => ({
|
|
69
|
+
value: `plan:${f}`,
|
|
70
|
+
label: basename(f, ".md"),
|
|
71
|
+
description: `Plan: ${f}`,
|
|
72
|
+
}));
|
|
73
|
+
} catch {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
57
78
|
/**
|
|
58
79
|
* Suggest existing worktree names for merge/list commands.
|
|
59
80
|
*/
|
|
@@ -96,7 +117,7 @@ const COMMANDS: WorkflowCommand[] = [
|
|
|
96
117
|
description:
|
|
97
118
|
"Execute plan — implement in worktree, test, commit on done",
|
|
98
119
|
skillName: "work",
|
|
99
|
-
argumentHint: "<
|
|
120
|
+
argumentHint: "plan:<file> <description>",
|
|
100
121
|
ralphHint: "Ralph detected. Use /unipi:ralph-start for long-running tasks.",
|
|
101
122
|
},
|
|
102
123
|
{
|
|
@@ -104,7 +125,7 @@ const COMMANDS: WorkflowCommand[] = [
|
|
|
104
125
|
description:
|
|
105
126
|
"Review work — check task completion, run lint/build, mark reviewer remarks",
|
|
106
127
|
skillName: "review-work",
|
|
107
|
-
argumentHint: "<
|
|
128
|
+
argumentHint: "plan:<file> <scope>",
|
|
108
129
|
},
|
|
109
130
|
{
|
|
110
131
|
name: WORKFLOW_COMMANDS.CONSOLIDATE,
|
|
@@ -183,6 +204,16 @@ export function registerWorkflowCommands(
|
|
|
183
204
|
return suggestSpecFiles(prefix);
|
|
184
205
|
}
|
|
185
206
|
|
|
207
|
+
// Work command: suggest plan files
|
|
208
|
+
if (cmd.name === WORKFLOW_COMMANDS.WORK) {
|
|
209
|
+
return suggestPlanFiles(prefix);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Review-work command: suggest plan files
|
|
213
|
+
if (cmd.name === WORKFLOW_COMMANDS.REVIEW_WORK) {
|
|
214
|
+
return suggestPlanFiles(prefix);
|
|
215
|
+
}
|
|
216
|
+
|
|
186
217
|
// Worktree merge: suggest existing worktrees
|
|
187
218
|
if (cmd.name === WORKFLOW_COMMANDS.WORKTREE_MERGE) {
|
|
188
219
|
return suggestWorktrees();
|
package/index.ts
CHANGED
|
@@ -86,7 +86,16 @@ export default function (pi: ExtensionAPI) {
|
|
|
86
86
|
systemPrompt:
|
|
87
87
|
event.systemPrompt +
|
|
88
88
|
base +
|
|
89
|
-
`\nThe write tool is available but restricted to .unipi/docs/specs/ only.\nDo NOT attempt to call blocked tools. Do NOT output tool call XML for them.\nIf the user requests an action that requires a blocked tool, respond that you do not have access.\n</sandbox>`,
|
|
89
|
+
`\nThe write tool is available but restricted to .unipi/docs/specs/ only.\nbash is available ONLY for specific setup use case (e.g., git init, mkdir). Do NOT use bash for reading files or listing directories — use grep, find, ls instead.\nDo NOT attempt to call blocked tools. Do NOT output tool call XML for them.\nIf the user requests an action that requires a blocked tool, respond that you do not have access.\n</sandbox>`,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (currentSandboxLevel === "write_unipi") {
|
|
94
|
+
return {
|
|
95
|
+
systemPrompt:
|
|
96
|
+
event.systemPrompt +
|
|
97
|
+
base +
|
|
98
|
+
`\nWrite tool is restricted to .unipi/docs/ only (specs and plans).\nUse grep, find, ls for file discovery — do NOT guess filenames.\nbash is blocked — use read, write, edit, grep, find, ls only.\nDo NOT attempt to call blocked tools. Do NOT output tool call XML for them.\nIf the user requests an action that requires a blocked tool, respond that you do not have access.\n</sandbox>`,
|
|
90
99
|
};
|
|
91
100
|
}
|
|
92
101
|
|
|
@@ -94,7 +103,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
94
103
|
systemPrompt:
|
|
95
104
|
event.systemPrompt +
|
|
96
105
|
base +
|
|
97
|
-
`\nDo NOT attempt to call blocked tools. Do NOT output tool call XML for them.\nIf the user
|
|
106
|
+
`\nDo NOT attempt to call blocked tools. Do NOT output tool call XML for them.\nIf the user requires an action that requires a blocked tool, respond that you do not have access.\n</sandbox>`,
|
|
98
107
|
};
|
|
99
108
|
});
|
|
100
109
|
|
package/package.json
CHANGED
|
@@ -145,6 +145,7 @@ The `## Implementation Checklist` section uses `- [ ]` markdown checkboxes. Thes
|
|
|
145
145
|
|
|
146
146
|
- **`[ ]` = unplanned** — not yet covered by a plan
|
|
147
147
|
- **`[x]` = planned** — marked when `/unipi:plan` covers this item
|
|
148
|
+
- **`[x]` does NOT mean done** — implementation progress is tracked in the plan file (`unstarted:` / `in-progress:` / `completed:`)
|
|
148
149
|
- Agent MUST fill in checklist items based on the design
|
|
149
150
|
- Each item should be a discrete, implementable task
|
|
150
151
|
- Items should be ordered by dependency (earlier items don't depend on later ones)
|
package/skills/plan/SKILL.md
CHANGED
|
@@ -70,6 +70,7 @@ Structure the plan with heart of gold style:
|
|
|
70
70
|
title: "{Topic} — Implementation Plan"
|
|
71
71
|
type: plan
|
|
72
72
|
date: YYYY-MM-DD
|
|
73
|
+
workbranch: {branch-name or empty if on main}
|
|
73
74
|
specs:
|
|
74
75
|
- path/to/spec.md
|
|
75
76
|
---
|
|
@@ -81,16 +82,19 @@ specs:
|
|
|
81
82
|
|
|
82
83
|
## Tasks
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
1. {Concrete step}
|
|
90
|
-
2. {Concrete step}
|
|
85
|
+
- unstarted: Task 1 — {Task Name}
|
|
86
|
+
- Description: {What needs to be done}
|
|
87
|
+
- Dependencies: {None, or list of tasks}
|
|
88
|
+
- Acceptance Criteria: {How to verify done}
|
|
89
|
+
- Steps:
|
|
90
|
+
1. {Concrete step}
|
|
91
|
+
2. {Concrete step}
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
...
|
|
93
|
+
- unstarted: Task 2 — {Task Name}
|
|
94
|
+
- Description: ...
|
|
95
|
+
- Dependencies: ...
|
|
96
|
+
- Acceptance Criteria: ...
|
|
97
|
+
- Steps: ...
|
|
94
98
|
|
|
95
99
|
## Sequencing
|
|
96
100
|
{Order of execution, dependency graph if complex}
|
|
@@ -129,6 +133,8 @@ After plan is complete:
|
|
|
129
133
|
|
|
130
134
|
This creates the link between brainstorm and plan — plan covers some items, others remain for future plans.
|
|
131
135
|
|
|
136
|
+
**Semantics:** Spec `[x]` means "planned" (covered by a plan). It does NOT mean "done". Implementation progress is tracked in the plan file, not the spec.
|
|
137
|
+
|
|
132
138
|
---
|
|
133
139
|
|
|
134
140
|
## Phase 5: Review Plan
|
|
@@ -138,10 +144,11 @@ Self-check before presenting:
|
|
|
138
144
|
- [ ] Every task has clear acceptance criteria
|
|
139
145
|
- [ ] Dependencies are correct (no circular, no missing)
|
|
140
146
|
- [ ] Steps are bite-sized (agent can follow without guessing)
|
|
141
|
-
- [ ] Brainstorm checkboxes updated correctly
|
|
142
147
|
- [ ] String greedy scope respected (if provided)
|
|
143
148
|
- [ ] Plan is focused enough for single `/unipi:work` session
|
|
144
149
|
|
|
150
|
+
Do NOT re-read or re-edit the spec checkboxes — Phase 4 already wrote them.
|
|
151
|
+
|
|
145
152
|
---
|
|
146
153
|
|
|
147
154
|
## Phase 6: Present & Handoff
|
|
@@ -164,6 +171,5 @@ Recommend starting a **new session** for work — it will switch pi's internal w
|
|
|
164
171
|
## Resumability
|
|
165
172
|
|
|
166
173
|
If user runs `/unipi:plan` on an existing plan:
|
|
167
|
-
1. Read the plan
|
|
168
|
-
2.
|
|
169
|
-
3. Ask user if they want to add tasks, modify existing, or plan new scope
|
|
174
|
+
1. Read the plan — look for `completed:` tasks
|
|
175
|
+
2. Ask user if they want to add tasks, modify existing, or plan new scope
|
|
@@ -25,13 +25,17 @@ Review what was built, verify task completion, run codebase checks, add reviewer
|
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
28
|
-
## Phase 1: Load Plan
|
|
28
|
+
## Phase 1: Load Plan & Switch Branch
|
|
29
29
|
|
|
30
30
|
1. If `plan:` arg provided, read that plan
|
|
31
31
|
2. If not, list plans in `.unipi/docs/plans/` and ask user
|
|
32
32
|
3. Read plan fully — understand tasks, acceptance criteria, current status
|
|
33
|
+
4. **Read `workbranch:` from plan frontmatter:**
|
|
34
|
+
- If `workbranch:` exists and is not empty → switch to that branch/worktree
|
|
35
|
+
- If `workbranch:` missing or empty → review on current branch (main)
|
|
36
|
+
- To switch: `git checkout {workbranch}` or use worktree path
|
|
33
37
|
|
|
34
|
-
**Exit:**
|
|
38
|
+
**Exit:** On correct branch. Plan loaded.
|
|
35
39
|
|
|
36
40
|
---
|
|
37
41
|
|
package/skills/work/SKILL.md
CHANGED
|
@@ -39,6 +39,7 @@ If args not provided, ask user interactively:
|
|
|
39
39
|
- "Do you want to work on current branch or create a worktree?"
|
|
40
40
|
- If worktree: "What branch name?" (suggest based on spec topic)
|
|
41
41
|
- Create worktree if not exists
|
|
42
|
+
- **After creating/confirming worktree:** write `workbranch: {branch-name}` to the plan file frontmatter
|
|
42
43
|
|
|
43
44
|
2. **Specs:**
|
|
44
45
|
- List available plans in `.unipi/docs/plans/`
|
|
@@ -58,7 +59,7 @@ If args not provided, ask user interactively:
|
|
|
58
59
|
1. Read plan file(s)
|
|
59
60
|
2. Review critically — identify questions or concerns
|
|
60
61
|
3. If concerns: raise with user before starting
|
|
61
|
-
4. Identify
|
|
62
|
+
4. Identify task status: `unstarted:` (pending), `in-progress:` (started), `completed:` (done)
|
|
62
63
|
|
|
63
64
|
**Exit:** Plan reviewed, ready to execute.
|
|
64
65
|
|
|
@@ -66,12 +67,12 @@ If args not provided, ask user interactively:
|
|
|
66
67
|
|
|
67
68
|
## Phase 3: Execute Tasks
|
|
68
69
|
|
|
69
|
-
For each task in order:
|
|
70
|
+
For each `unstarted:` task in order:
|
|
70
71
|
|
|
71
|
-
1.
|
|
72
|
+
1. Change `unstarted:` to `in-progress:` in plan
|
|
72
73
|
2. Follow each step exactly (plan has bite-sized steps)
|
|
73
74
|
3. Run verifications as specified in acceptance criteria
|
|
74
|
-
4.
|
|
75
|
+
4. Change `in-progress:` to `completed:` when complete
|
|
75
76
|
5. Update plan file with progress
|
|
76
77
|
|
|
77
78
|
### When to Stop and Ask
|
|
@@ -107,12 +108,11 @@ Don't wait until end to commit — incremental commits are safer.
|
|
|
107
108
|
|
|
108
109
|
## Phase 5: Complete
|
|
109
110
|
|
|
110
|
-
When all tasks
|
|
111
|
+
When all tasks are `completed:`:
|
|
111
112
|
|
|
112
113
|
1. Run final verification (tests, lint, build)
|
|
113
114
|
2. Commit all remaining changes
|
|
114
|
-
3.
|
|
115
|
-
4. Inform user:
|
|
115
|
+
3. Inform user:
|
|
116
116
|
|
|
117
117
|
> "All tasks complete. Worktree: `feat/<branch>`. Recommend reviewing before merge."
|
|
118
118
|
|
|
@@ -127,9 +127,9 @@ Suggest next step:
|
|
|
127
127
|
|
|
128
128
|
## Resumability
|
|
129
129
|
|
|
130
|
-
If user runs `/unipi:work` and plan has
|
|
130
|
+
If user runs `/unipi:work` and plan has `completed:` or `in-progress:` tasks:
|
|
131
131
|
1. Read plan
|
|
132
|
-
2. Identify first `
|
|
132
|
+
2. Identify first `unstarted:` task
|
|
133
133
|
3. Ask user: "Resume from Task N: {name}?"
|
|
134
134
|
4. Continue from there
|
|
135
135
|
|
|
@@ -9,8 +9,8 @@ List all git worktrees created by unipi.
|
|
|
9
9
|
|
|
10
10
|
## Boundaries
|
|
11
11
|
|
|
12
|
-
**This skill MAY:**
|
|
13
|
-
**This skill MAY NOT:** edit anything, create worktrees, merge branches.
|
|
12
|
+
**This skill MAY:** read filesystem (ls, read), grep for git info.
|
|
13
|
+
**This skill MAY NOT:** edit anything, create worktrees, merge branches, run bash.
|
|
14
14
|
|
|
15
15
|
## Command Format
|
|
16
16
|
|
|
@@ -24,17 +24,27 @@ No arguments. Lists all unipi worktrees.
|
|
|
24
24
|
|
|
25
25
|
## Process
|
|
26
26
|
|
|
27
|
-
### Phase 1:
|
|
27
|
+
### Phase 1: Discover Worktrees
|
|
28
28
|
|
|
29
|
-
1.
|
|
30
|
-
2.
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
- HEAD commit
|
|
35
|
-
- Whether it has uncommitted changes
|
|
29
|
+
1. `ls .unipi/worktrees/` — list worktree directories
|
|
30
|
+
2. For each directory:
|
|
31
|
+
- Read `.unipi/worktrees/<branch>/.git` file to get gitdir path
|
|
32
|
+
- Check for uncommitted changes: `ls .unipi/worktrees/<branch>/` and read key files
|
|
33
|
+
3. If `.unipi/worktrees/` doesn't exist or is empty → no worktrees
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
**Exit:** List of worktrees discovered.
|
|
36
|
+
|
|
37
|
+
### Phase 2: Determine Status
|
|
38
|
+
|
|
39
|
+
For each worktree directory:
|
|
40
|
+
|
|
41
|
+
1. Check if `HEAD` file exists in gitdir
|
|
42
|
+
2. Check for modified files by reading directory listing
|
|
43
|
+
3. Determine status:
|
|
44
|
+
- **clean** — no uncommitted changes
|
|
45
|
+
- **dirty** — has uncommitted changes
|
|
46
|
+
|
|
47
|
+
### Phase 3: Present
|
|
38
48
|
|
|
39
49
|
Display in table format:
|
|
40
50
|
|
|
@@ -51,7 +61,7 @@ Worktrees:
|
|
|
51
61
|
If no worktrees:
|
|
52
62
|
> "No unipi worktrees. Create one with `/unipi:worktree-create`"
|
|
53
63
|
|
|
54
|
-
### Phase
|
|
64
|
+
### Phase 4: Suggest Actions
|
|
55
65
|
|
|
56
66
|
Based on state:
|
|
57
67
|
- If dirty worktrees exist → suggest reviewing or committing
|
|
@@ -65,3 +75,4 @@ Based on state:
|
|
|
65
75
|
- Only shows worktrees under `.unipi/worktrees/`
|
|
66
76
|
- Ignores worktrees in other locations
|
|
67
77
|
- Status: `clean` = no uncommitted changes, `dirty` = has changes
|
|
78
|
+
- No bash required — uses ls, read, grep for all discovery
|
|
@@ -46,8 +46,16 @@ For each source branch (in dependency order if specs indicate ordering):
|
|
|
46
46
|
3. **If conflict:**
|
|
47
47
|
- Report which files conflict
|
|
48
48
|
- Reference the spec/plan context: "This branch was working on: <description>"
|
|
49
|
-
-
|
|
50
|
-
|
|
49
|
+
- **Structured conflict resolution:**
|
|
50
|
+
1. **Check finalized plan** — read the plan for this branch, understand intended changes
|
|
51
|
+
2. **Brainstorm resolution** — reason about which changes align with the plan's intent
|
|
52
|
+
3. **Read codebase** — read the conflicting files to understand current state
|
|
53
|
+
4. **Ask user** — present options and ask for final decision (always ask, never force)
|
|
54
|
+
- Options to present:
|
|
55
|
+
- Accept incoming (their changes)
|
|
56
|
+
- Accept current (main branch)
|
|
57
|
+
- Manual merge (describe what each side does, ask user to decide)
|
|
58
|
+
- Skip this branch
|
|
51
59
|
4. **If success:**
|
|
52
60
|
- Remove worktree: `git worktree remove .unipi/worktrees/<branch-name>`
|
|
53
61
|
- Delete branch: `git branch -d <branch>`
|