@raquezha/norpiv 0.0.5 → 0.0.6

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 CHANGED
@@ -20,7 +20,7 @@ Auxiliary hygiene:
20
20
 
21
21
  | Command | Purpose | Input / Output Files |
22
22
  | :--- | :--- | :--- |
23
- | `/cleanup` | Declutter Git branches and completed task folders after work is merged/closed. | Prunes finished task folders & resets pointer when safe |
23
+ | `/post-merge-prune` | Delete stale local branches after a PR/MR is merged, prune remote refs, and clean completed task folders. | Post-merge branch cleanup plus safe task-folder cleanup |
24
24
 
25
25
  ---
26
26
 
@@ -51,7 +51,7 @@ Best for trying or handing off RPIV skills without installing the full `nothing`
51
51
 
52
52
  ```bash
53
53
  npx -y skills add raquezha/nothing --full-depth -g -a pi \
54
- -s triage frame grill-with-docs plan implement verify sync cleanup update-docs distill \
54
+ -s triage frame grill-with-docs plan implement verify sync post-merge-prune update-docs distill \
55
55
  -y
56
56
  ```
57
57
 
@@ -84,7 +84,7 @@ Targets:
84
84
 
85
85
  | Hat | Purpose |
86
86
  | :--- | :--- |
87
- | `pi --rpiv` | Full RPIV workflow. Loads triage, frame, grill-with-docs, plan, implement, verify, sync, cleanup, and update-docs. |
87
+ | `pi --rpiv` | Full RPIV workflow. Loads triage, frame, grill-with-docs, plan, implement, verify, sync, post-merge-prune, and update-docs. |
88
88
  | `pi --notes` | Conversation distiller. Saves useful thinking to Obsidian without RPIV ceremony. |
89
89
 
90
90
  ## 📝 Pre-RPIV note capture
@@ -152,7 +152,7 @@ Obsidian note → /triage → RPIV (only when ready to commit)
152
152
  ```text
153
153
  /verify
154
154
  /sync
155
- /cleanup
155
+ /post-merge-prune
156
156
  ```
157
157
 
158
158
  ## 🧭 Shared helper scripts
@@ -136,7 +136,7 @@ function writeCodexAdapter(root, names, sharedNames, opts) {
136
136
  const sharedLines = sharedNames.length
137
137
  ? `\nShared helpers:\n\n${sharedNames.map((name) => `- ${name}/`).join("\n")}\n`
138
138
  : "";
139
- const body = `# norpiv RPIV skills for Codex\n\nCodex does not currently auto-load Pi/Claude SKILL.md bundles from npm.\n\nUse these installed skill instructions as a portable RPIV workflow reference:\n\n${names.map((name) => `- ${name}/SKILL.md`).join("\n")}\n${sharedLines}\nCore lifecycle: triage frame grill-with-docs plan implement verify sync cleanup.\n\nIf your Codex environment supports AGENTS.md discovery, copy or reference this file from your project.\n`;
139
+ const body = `# norpiv RPIV skills for Codex\n\nCodex does not currently auto-load Pi/Claude SKILL.md bundles from npm.\n\nUse these installed skill instructions as a portable RPIV workflow reference:\n\n${names.map((name) => `- ${name}/SKILL.md`).join("\n")}\n${sharedLines}\nCore lifecycle: triage -> frame -> grill-with-docs -> plan -> implement -> verify -> sync -> post-merge-prune.\n\nIf your Codex environment supports AGENTS.md discovery, copy or reference this file from your project.\n`;
140
140
  log(opts, `write Codex adapter ${adapter}`);
141
141
  if (!opts.dryRun) fs.writeFileSync(adapter, body);
142
142
  }
package/distill/SKILL.md CHANGED
@@ -180,7 +180,7 @@ If writing fails, output the markdown to stdout so the user can copy it manually
180
180
  - Does not require `WORK.md`
181
181
  - Does not interact with `.workflow/` directory
182
182
  - Does not sync to Jira, GitHub, or GitLab
183
- - Does not run cleanup
183
+ - Does not run post-merge-prune
184
184
  - Does not require any existing task or ticket
185
185
 
186
186
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raquezha/norpiv",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Bundled RPIV workflow skills for Pi, Claude, and Codex-style coding agents",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "files": [
10
10
  "bin",
11
- "cleanup",
11
+ "post-merge-prune",
12
12
  "distill",
13
13
  "frame",
14
14
  "grill-with-docs",
@@ -44,7 +44,7 @@
44
44
  "verify",
45
45
  "sync",
46
46
  "update-docs",
47
- "cleanup",
47
+ "post-merge-prune",
48
48
  "distill"
49
49
  ]
50
50
  }
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: post-merge-prune
3
+ description: "Post-merge branch cleanup only. Use after a PR/MR is merged and the local feature branch is stale: prune remote refs and delete local branches already merged into the target branch."
4
+ ---
5
+
6
+ # Skill: post-merge-prune
7
+
8
+ > [!IMPORTANT]
9
+ > **LLM INSTRUCTION**: This skill is a deliberate post-merge deletion tool. If the user invokes `post-merge-prune`, they want stale local branches removed after merge into the intended target branch. Do not offer a menu of options. Do not ask "Dry run or Execute?". Proceed directly.
10
+
11
+ Use this skill after a PR/MR has been merged into its intended branch, typically `main`, to remove stale remote-tracking refs and delete the matching local branches because the work is done.
12
+
13
+ ## Goal
14
+ - Switch to the intended target branch (`main` by default).
15
+ - Prune deleted remote branches.
16
+ - Delete local branches that are already merged into the target branch.
17
+ - Optionally remove matching workflow task folders.
18
+
19
+ ## Workflow
20
+
21
+ ### Step 1: Go to the target branch
22
+ - `git checkout main` (or the intended merge target)
23
+ - If the tree is dirty, stash first.
24
+
25
+ ### Step 2: Prune remote-tracking refs
26
+ - `git remote update origin --prune`
27
+ - This removes local refs for remote branches that were deleted after merge.
28
+
29
+ ### Step 3: Delete merged local branches
30
+ Iterate through local branches and delete the ones already merged into the target branch:
31
+ - Use `git branch -d <branch>` for normal merges.
32
+ - If `-d` refuses but `git log main..[branch]` is empty, the branch was squash-merged; use `git branch -D <branch>`.
33
+ - Never delete the active target branch.
34
+
35
+ ### Step 4: Optional workflow cleanup
36
+ If a deleted branch has a matching `.workflow/tasks/*` folder, remove it.
37
+ If `.workflow/active_task.json` points to a deleted task, clear it.
38
+
39
+ ### Step 5: Verify
40
+ - `git branch -a` should no longer show deleted refs.
41
+ - `git branch --merged main` should only show branches you intend to keep.
42
+ - `.workflow/tasks/` should not contain deleted tasks.
43
+
44
+ ## Guardrails
45
+ - **RESOLUTION OVER REPORTING**: If merge status is unclear, check `git branch --merged main` or `git log main..branch` and resolve it.
46
+ - **NO DRY RUNS BY DEFAULT**: Execute the cleanup unless the user explicitly asks for a preview.
47
+ - **SMART DELETE**: If a branch is squash-merged, delete it with `git branch -D` after confirming there are no unique commits left.
48
+ - **ACTIVE BRANCH PROTECTION**: Do not delete the current branch.
49
+ - **UNMERGED WORK**: If a branch has unique commits and no remote, ask once before force-deleting.
50
+
51
+ ## Output Contract
52
+ Return a concise report:
53
+ - **Cleaned**: deleted branches / task folders
54
+ - **Kept**: branches still in use
55
+ - **Working Branch**: the branch left checked out (should be `main`)
File without changes
@@ -289,7 +289,7 @@ if [[ -n "$WORK_MD" && -f "$WORK_MD" ]]; then
289
289
  fi
290
290
 
291
291
  if [[ "$META_STATUS" =~ ^(done|archived)$ ]]; then
292
- warn "active pointer references a task with status=$META_STATUS; consider cleanup, archive handling, or reopening intentionally"
292
+ warn "active pointer references a task with status=$META_STATUS; consider post-merge-prune, archive handling, or reopening intentionally"
293
293
  fi
294
294
 
295
295
  echo
@@ -315,7 +315,7 @@ if [[ -n "$WORK_MD" && -f "$WORK_MD" ]]; then
315
315
  fi
316
316
  if [[ -n "$META_STATUS" && "$META_STATUS" =~ ^(done|archived)$ ]]; then
317
317
  echo " - Choose intentionally: $TRIAGE_HELPER ${TASK_SOURCE:-local} ${TASK_ID:-task} reopen"
318
- echo " - Or leave closed and run cleanup when appropriate."
318
+ echo " - Or leave closed and run post-merge-prune when appropriate."
319
319
  fi
320
320
  if [[ "$WARNINGS" -eq 0 && "$ERRORS" -eq 0 ]]; then
321
321
  echo " - No fixes suggested."
package/sync/SKILL.md CHANGED
@@ -128,4 +128,4 @@ Return a concise summary:
128
128
  - **Action**: no-op / updated existing status / created new status
129
129
  - **Reason**: marker found, body identical, marker missing, etc.
130
130
  - **Link**: remote comment/note URL if available
131
- - **Next step**: review, verify, cleanup, or continue implementation
131
+ - **Next step**: review, verify, post-merge-prune, or continue implementation
package/verify/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: verify
3
- description: Verify the active slice or task against WORK.md, quality gates, and review readiness. Use after implementation or manual changes to decide whether work is ready for sync, review, or cleanup.
3
+ description: Verify the active slice or task against WORK.md, quality gates, and review readiness. Use after implementation or manual changes to decide whether work is ready for sync, review, or post-merge-prune.
4
4
  ---
5
5
 
6
6
  # Skill: verify
@@ -21,7 +21,7 @@ The final gate for a slice or task. Verify truth before reporting progress.
21
21
  4. Check for AI artifacts: placeholder comments, fake APIs, dead code, inconsistent naming.
22
22
  5. Confirm commit messages include Conventional Commit format. When AI contributed, you MUST append an `Assisted-by` trailer. Do NOT guess or hallucinate the model name from your system prompt. You must run `bash ~/RQZ/personal/nothing/packages/norpiv/scripts/get-pi-model.sh` and use its exact output to construct the trailer: `Assisted-by: <EXACT_OUTPUT> [tools]`.
23
23
  6. If passing, mark the slice checkbox complete in `[PLAN]` and append verification evidence to `[LOG]` (Format: `YYYY-MM-DD hh:mm AM/PM`).
24
- 7. Recommend `/sync` for tracker update, or cleanup if the task is fully merged and user approves.
24
+ 7. Recommend `/sync` for tracker update, or `/post-merge-prune` if the task is fully merged and user approves.
25
25
 
26
26
  ## Output contract
27
27
  End with:
package/cleanup/SKILL.md DELETED
@@ -1,53 +0,0 @@
1
- ---
2
- name: cleanup
3
- description: "DIRECT EXECUTION: Immediately prunes local branches and task folders. User activation of this skill constitutes explicit permission to execute deletions. Do not ask for confirmation or offer dry runs unless requested. Reconciles stale Git refs and workflow artifacts."
4
- ---
5
-
6
- # Skill: cleanup (Durable Repo Hygiene)
7
-
8
- > [!IMPORTANT]
9
- > **LLM INSTRUCTION**: This skill is a DIRECT ACTION tool. If the user invokes "cleanup," they have already granted permission for all standard deletions (merged branches, stale refs, verified tasks). DO NOT offer a menu of options. DO NOT ask "Dry run or Execute?". Proceed directly to Step 1.
10
-
11
- A durable, idempotent utility to synchronize the local filesystem and Git state with the project's "Definition of Done," regardless of whether the RPIV workflow is used.
12
-
13
- ## Pre-conditions (Checkpoints)
14
- - **Current Branch**: Should ideally be `main` or `master`.
15
- - **Durable State Source**: `git branch` refs and (optionally) `.workflow/tasks/*/WORK.md`.
16
-
17
- ## Workflow (Durable Steps)
18
-
19
- ### Step 1: Remote Reconciliation
20
- - `git remote update origin --prune`
21
- - Identify branches deleted on remote.
22
-
23
- ### Step 2: Analysis (General & Workflow)
24
- Iterate through all local branches and `.workflow/tasks/*` folders:
25
- - **STALE BRANCHES**: Local branches merged into `main` (safe to delete) or whose remote is gone.
26
- - **VERIFIED TASKS**: `.workflow/tasks/*` where `WORK.md` state is `MERGED` or `CLOSED`.
27
- - **ORPHANS**: Local branches with no remote and no task folder, or task folders with no branch.
28
-
29
- ### Step 3: Atomic Execution
30
- 1. **Branch Pruning**:
31
- - Use `git branch -d` for merged branches.
32
- - **Smart Merge Check**: If `-d` fails, check `git log main..[branch]`. If empty, the branch was squash-merged; use `git branch -D` quietly.
33
- 2. **Artifact Cleanup**: If a `.workflow/tasks/` folder exists for a pruned branch, `rm -rf` it.
34
- 3. **Active Task Reset**: Clear `.workflow/active_task.json` if it points to a deleted task.
35
-
36
- ### Step 4: Durable Verification (Success Metrics)
37
- - `git branch -a` must not contain deleted refs.
38
- - `.workflow/tasks/` must not contain folders for deleted tasks.
39
-
40
- ## Guardrails & Recovery
41
- - **RESOLUTION OVER REPORTING**: Do not stall the user with "Ambiguous" lists or menus. If a status is unclear, the agent must check merge status (`git branch --merged` or `git log main..branch`) immediately and resolve it.
42
- - **NO DRY RUNS BY DEFAULT**: Proceed directly to execution unless a dry run is explicitly requested.
43
- - **MANDATORY SMART DELETE**: If `git branch -d` fails, the agent MUST check if the diff is empty. If empty (squash-merged), use `git branch -D` quietly.
44
- - **TRUST THE USER**: If the user says "all done" or "clean it all," skip all safety checks and force-delete everything.
45
- - **Dirty Tree**: If the working tree is dirty, `git stash` before branch switching and `git stash pop` as the final act.
46
- - **Unmerged Work**: If a branch has no remote and contains unique commits, the agent **MUST** ask ONCE: "Branch [name] contains unmerged commits and has no remote. Force delete? (y/N)".
47
-
48
- ## Output Contract
49
- Return a concise "Durable State Report":
50
- - **Cleaned**: List of (Task ID + Branch Name) successfully removed.
51
- - **Skipped/Active**: List of tasks kept and why (e.g., "Contains unmerged commits").
52
- - **Working Branch**: The branch left active (should be `main`).
53
- - **Next step**: Ready for `/triage`.