@pi-unipi/workflow 0.1.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.
@@ -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,98 @@
1
+ ---
2
+ name: worktree-merge
3
+ description: "Merge worktrees back to main branch. Multi-branch support with auto-suggest."
4
+ ---
5
+
6
+ # Merging Worktrees
7
+
8
+ Merge completed worktree branches back into main.
9
+
10
+ ## Boundaries
11
+
12
+ **This skill MAY:** run git merge, git branch, git worktree commands, ask user for confirmation.
13
+ **This skill MAY NOT:** edit code, implement features, force push.
14
+
15
+ ## Command Format
16
+
17
+ ```
18
+ /unipi:worktree-merge <branch>(multiple,optional) <string(greedy)>(optional)
19
+ ```
20
+
21
+ - `<branch>` — one or more branches to merge (auto-suggested from worktree-list)
22
+ - `string(greedy)` — optional context (e.g., "merge all clean worktrees" or "merge auth first")
23
+ - If no branches provided → agent lists worktrees and asks user to select
24
+
25
+ ---
26
+
27
+ ## Process
28
+
29
+ ### Phase 1: Resolve Target Branch
30
+
31
+ 1. Check for `main` branch
32
+ 2. If no `main`, check for `master`
33
+ 3. If neither exists:
34
+ > "No main or master branch found. Which branch should I merge into?"
35
+ - Ask user for target branch
36
+
37
+ **Exit:** Target branch identified (e.g., `main`).
38
+
39
+ ### Phase 2: Resolve Source Branches
40
+
41
+ If branches provided in args:
42
+ 1. Verify each branch exists
43
+ 2. Check for uncommitted changes in worktree
44
+ 3. Warn if dirty: "Branch `feat/auth` has uncommitted changes. Commit first?"
45
+
46
+ If no branches provided:
47
+ 1. List all unipi worktrees
48
+ 2. Show status (clean/dirty)
49
+ 3. Ask user to select which to merge
50
+
51
+ **Exit:** Source branch(es) confirmed, all clean.
52
+
53
+ ### Phase 3: Merge
54
+
55
+ For each source branch:
56
+
57
+ 1. Switch to target branch (`git checkout main`)
58
+ 2. Merge source branch (`git merge feat/auth`)
59
+ 3. Handle conflicts if any:
60
+ - Report conflicts clearly
61
+ - Ask user how to resolve
62
+ - Don't force-merge
63
+ 4. If merge succeeds:
64
+ - Remove worktree (`git worktree remove .unipi/worktrees/feat/auth`)
65
+ - Delete branch if user confirms (`git branch -d feat/auth`)
66
+
67
+ ### Phase 4: Report
68
+
69
+ Summary:
70
+ ```
71
+ Merged 2 worktrees into main:
72
+ ✓ feat/auth — merged successfully, worktree removed
73
+ ✓ fix/login-bug — merged successfully, worktree removed
74
+ ```
75
+
76
+ Or if issues:
77
+ ```
78
+ Merged 1 of 2 worktrees:
79
+ ✓ feat/auth — merged successfully
80
+ ✗ fix/login-bug — CONFLICT in src/auth.ts, needs manual resolution
81
+ ```
82
+
83
+ ### Phase 5: Suggest Next
84
+
85
+ After merge:
86
+ - If all merged → suggest `/unipi:consolidate` to capture learnings
87
+ - If conflicts remain → suggest resolving and retrying
88
+ - If partial merge → suggest `/unipi:worktree-merge` for remaining
89
+
90
+ ---
91
+
92
+ ## Notes
93
+
94
+ - Merges are standard git merges — no rebasing by default
95
+ - Worktree removal keeps filesystem clean
96
+ - Branch deletion is optional — ask user
97
+ - Conflicts require human intervention — don't force
98
+ - Order matters if branches depend on each other