@pi-unipi/workflow 0.1.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/workflow",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Structured development workflow commands for Pi coding agent",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,98 +1,79 @@
1
1
  ---
2
2
  name: worktree-merge
3
- description: "Merge worktrees back to main branch. Multi-branch support with auto-suggest."
3
+ description: "Merge worktree branches back to main. Gathers context from specs/plans, merges, cleans up."
4
4
  ---
5
5
 
6
- # Merging Worktrees
6
+ # Worktree Merge
7
7
 
8
- Merge completed worktree branches back into main.
8
+ Merge completed worktree branches into main. Gather context from docs before merging.
9
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.
10
+ ## Process
14
11
 
15
- ## Command Format
12
+ ### Phase 1: Gather Context
16
13
 
17
- ```
18
- /unipi:worktree-merge <branch>(multiple,optional) <string(greedy)>(optional)
19
- ```
14
+ Before merging, read existing specs and plans to understand what each worktree was implementing:
20
15
 
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 providedagent lists worktrees and asks user to select
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: branchwhat it was working on
24
19
 
25
- ---
26
-
27
- ## Process
20
+ This context helps during merge conflicts and in the final report.
28
21
 
29
- ### Phase 1: Resolve Target Branch
22
+ ### Phase 2: Resolve Target Branch
30
23
 
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
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
36
27
 
37
- **Exit:** Target branch identified (e.g., `main`).
28
+ ### Phase 3: Resolve Source Branches
38
29
 
39
- ### Phase 2: Resolve Source Branches
30
+ **If branches provided in args:**
31
+ - Verify each branch exists: `git branch --list <name>`
32
+ - Check worktree status for each
40
33
 
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?"
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
45
39
 
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
40
+ ### Phase 4: Merge Each Branch
50
41
 
51
- **Exit:** Source branch(es) confirmed, all clean.
42
+ For each source branch (in dependency order if specs indicate ordering):
52
43
 
53
- ### Phase 3: Merge
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>"
54
55
 
55
- For each source branch:
56
+ ### Phase 5: Report
56
57
 
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
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
75
63
 
76
- Or if issues:
64
+ Worktrees cleaned: 2 removed
65
+ Branches deleted: 2
77
66
  ```
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
67
 
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
68
+ ### Phase 6: Suggest Next
89
69
 
90
- ---
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
91
73
 
92
- ## Notes
74
+ ## Important
93
75
 
94
- - Merges are standard git mergesno 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
76
+ - ALWAYS read specs/plans before mergingcontext 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