pii-mcp 1.4.0__tar.gz
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.
- pii_mcp-1.4.0/.agents/skills/committing-and-pr-workflow/SKILL.md +109 -0
- pii_mcp-1.4.0/.agents/skills/dispatching-parallel-agents/SKILL.md +185 -0
- pii_mcp-1.4.0/.agents/skills/executing-plans/SKILL.md +70 -0
- pii_mcp-1.4.0/.agents/skills/finishing-a-development-branch/SKILL.md +241 -0
- pii_mcp-1.4.0/.agents/skills/subagent-driven-development/SKILL.md +416 -0
- pii_mcp-1.4.0/.agents/skills/subagent-driven-development/implementer-prompt.md +139 -0
- pii_mcp-1.4.0/.agents/skills/subagent-driven-development/scripts/review-package +47 -0
- pii_mcp-1.4.0/.agents/skills/subagent-driven-development/scripts/task-brief +42 -0
- pii_mcp-1.4.0/.agents/skills/subagent-driven-development/task-reviewer-prompt.md +188 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/CREATION-LOG.md +119 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/SKILL.md +296 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/condition-based-waiting.md +115 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/defense-in-depth.md +122 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/find-polluter.sh +63 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/root-cause-tracing.md +169 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/test-academic.md +14 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/test-pressure-1.md +58 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/test-pressure-2.md +68 -0
- pii_mcp-1.4.0/.agents/skills/systematic-debugging/test-pressure-3.md +69 -0
- pii_mcp-1.4.0/.agents/skills/using-git-worktrees/SKILL.md +202 -0
- pii_mcp-1.4.0/.agents/skills/verification-before-completion/SKILL.md +139 -0
- pii_mcp-1.4.0/.commitlintrc.json +3 -0
- pii_mcp-1.4.0/.cursor/rules/docstrings-over-comments.mdc +40 -0
- pii_mcp-1.4.0/.githooks/commit-msg +25 -0
- pii_mcp-1.4.0/.github/workflows/ci.yml +72 -0
- pii_mcp-1.4.0/.github/workflows/publish-python.yml +33 -0
- pii_mcp-1.4.0/.github/workflows/release.yml +118 -0
- pii_mcp-1.4.0/.github/workflows/security.yml +33 -0
- pii_mcp-1.4.0/.gitignore +28 -0
- pii_mcp-1.4.0/.releaserc.json +30 -0
- pii_mcp-1.4.0/CHANGELOG.md +54 -0
- pii_mcp-1.4.0/Cargo.lock +313 -0
- pii_mcp-1.4.0/Cargo.toml +19 -0
- pii_mcp-1.4.0/PKG-INFO +102 -0
- pii_mcp-1.4.0/PUBLISHING.md +69 -0
- pii_mcp-1.4.0/README.md +73 -0
- pii_mcp-1.4.0/crates/pii-core/Cargo.toml +19 -0
- pii_mcp-1.4.0/crates/pii-core/src/checksum.rs +243 -0
- pii_mcp-1.4.0/crates/pii-core/src/detectors.rs +792 -0
- pii_mcp-1.4.0/crates/pii-core/src/lib.rs +22 -0
- pii_mcp-1.4.0/crates/pii-core/src/scrub.rs +314 -0
- pii_mcp-1.4.0/crates/pii-mcp-native/Cargo.toml +17 -0
- pii_mcp-1.4.0/crates/pii-mcp-native/src/lib.rs +145 -0
- pii_mcp-1.4.0/package.json +21 -0
- pii_mcp-1.4.0/pnpm-lock.yaml +3011 -0
- pii_mcp-1.4.0/pyproject.toml +60 -0
- pii_mcp-1.4.0/scripts/bench_backends.py +122 -0
- pii_mcp-1.4.0/scripts/record-release.sh +20 -0
- pii_mcp-1.4.0/scripts/set-version.sh +36 -0
- pii_mcp-1.4.0/src/pii_mcp/__init__.py +39 -0
- pii_mcp-1.4.0/src/pii_mcp/detectors.py +498 -0
- pii_mcp-1.4.0/src/pii_mcp/fastmcp.py +266 -0
- pii_mcp-1.4.0/src/pii_mcp/scrub.py +317 -0
- pii_mcp-1.4.0/tests/test_backend.py +34 -0
- pii_mcp-1.4.0/tests/test_middleware.py +113 -0
- pii_mcp-1.4.0/tests/test_scrub_payload.py +86 -0
- pii_mcp-1.4.0/tests/test_scrub_text.py +460 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: committing-and-pr-workflow
|
|
3
|
+
description: Use whenever you have made code or doc changes in this repo and are deciding how to land them — enforces committing every change, grouping changes into reviewed PRs by concern, self-reviewing the diff and committing follow-up fixes, and ASKING the user before merging. Triggers on "commit this", "open a PR", "ship it", finishing a task, or any point where work is done but not yet integrated.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Committing & PR Workflow
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
How work gets integrated in this repo. The rule is simple: **nothing stays
|
|
11
|
+
uncommitted, everything lands through a reviewed PR, and merges are the user's
|
|
12
|
+
call.**
|
|
13
|
+
|
|
14
|
+
**Core principle:** Commit → group into PRs by concern → self-review → commit
|
|
15
|
+
fixes → ask before merging.
|
|
16
|
+
|
|
17
|
+
**Announce at start:** "I'm using the committing-and-pr-workflow skill to land
|
|
18
|
+
this work."
|
|
19
|
+
|
|
20
|
+
## The Process
|
|
21
|
+
|
|
22
|
+
### Step 1: Commit every change
|
|
23
|
+
|
|
24
|
+
- Never leave the working tree dirty at the end of a task. If you changed it,
|
|
25
|
+
commit it.
|
|
26
|
+
- Use Conventional Commits — `<type>(scope): description`. The `.githooks/commit-msg`
|
|
27
|
+
hook (commitlint) enforces this; a bad subject is rejected.
|
|
28
|
+
- **Merge commits count too.** commitlint ignores them by default, so Git's
|
|
29
|
+
auto-generated `Merge branch ...` subject slips through — don't let it. When
|
|
30
|
+
resolving conflicts or merging `main` into a branch, replace it with a
|
|
31
|
+
conventional subject, e.g. `chore(web): merge origin/main into metrics branch`.
|
|
32
|
+
- Commit at logical checkpoints, not one giant blob. One commit should be one
|
|
33
|
+
coherent change with a message that explains the *why*.
|
|
34
|
+
- End every commit message with a `Co-Authored-By` trailer naming the model that
|
|
35
|
+
wrote it, at `<noreply@anthropic.com>`:
|
|
36
|
+
`Co-Authored-By: Claude <model> <noreply@anthropic.com>`
|
|
37
|
+
|
|
38
|
+
Use whatever your harness specifies for the model you actually are (e.g.
|
|
39
|
+
`Claude Opus 5`, `Claude Sonnet 5`); if it specifies nothing, plain
|
|
40
|
+
`Co-Authored-By: Claude <noreply@anthropic.com>` is fine. Don't copy a version
|
|
41
|
+
from this file or from older commits — the attribution should be accurate for
|
|
42
|
+
the commit at hand, and this doc can't stay current with model releases.
|
|
43
|
+
|
|
44
|
+
### Step 2: Group into PRs by concern
|
|
45
|
+
|
|
46
|
+
- **Check the tree before branching.** It must be clean and on the branch you
|
|
47
|
+
expect. If it is dirty or on an unexpected branch, another agent is mid-flight
|
|
48
|
+
— **do not `git checkout` over it.** Stop and report the state; branching or
|
|
49
|
+
switching now will reshuffle their uncommitted work.
|
|
50
|
+
- **Branch off `main` first** — never commit directly to `main` (it is the
|
|
51
|
+
default and is protected by CI + semantic-release).
|
|
52
|
+
- **One PR per concern.** A bug fix and an unrelated feature are two PRs. Don't
|
|
53
|
+
smuggle a refactor into a feature PR. When in doubt, split.
|
|
54
|
+
- Keep code and docs-only changes separate unless the docs directly document the
|
|
55
|
+
code in the same PR.
|
|
56
|
+
- Remember semantic-release reads commit/PR titles on `main`: `feat:` → minor,
|
|
57
|
+
`fix:` → patch, `docs:`/`chore:` → no release. Title the PR with the type that
|
|
58
|
+
reflects its real impact.
|
|
59
|
+
|
|
60
|
+
### Step 3: Open the PR
|
|
61
|
+
|
|
62
|
+
- Push the branch and open the PR against `main` with `gh`.
|
|
63
|
+
- Body must have a **Summary** and a **Test plan**, and the Test plan must cover
|
|
64
|
+
both:
|
|
65
|
+
1. **Automated** — what you ran (`pnpm lint`/`pnpm test`, counts, CI status).
|
|
66
|
+
2. **Manual verification** — numbered repro steps a human reviewer can follow
|
|
67
|
+
against a running stack to confirm the change actually works. Required for
|
|
68
|
+
anything touching data handling, security/compliance, or user-visible
|
|
69
|
+
behavior; skip only for changes with no runtime behavior to check (docs,
|
|
70
|
+
comments, pure refactors covered 1:1 by existing tests).
|
|
71
|
+
- End the PR body with:
|
|
72
|
+
`🤖 Generated with [Claude Code](https://claude.com/claude-code)`
|
|
73
|
+
|
|
74
|
+
### Step 4: Self-review and commit fixes
|
|
75
|
+
|
|
76
|
+
- Review your own diff before handing it over — read it, or run `/code-review`.
|
|
77
|
+
- If review surfaces issues, **commit the fixes onto the same branch** (don't
|
|
78
|
+
leave them as loose comments). Re-review after fixing.
|
|
79
|
+
- Confirm CI is green (`gh pr checks <n>`).
|
|
80
|
+
|
|
81
|
+
### Step 5: Ask before merging — always
|
|
82
|
+
|
|
83
|
+
- **Never merge a PR without explicit user approval.** Not even a green,
|
|
84
|
+
reviewed, trivial one.
|
|
85
|
+
- When a PR is reviewed and CI is green, surface it and ask: list the PR(s) that
|
|
86
|
+
are ready and ask the user which to merge (e.g. via the AskUserQuestion tool).
|
|
87
|
+
- Only after the user says yes: merge with `gh pr merge <n> --merge --delete-branch`,
|
|
88
|
+
then sync local `main`. **Not `--squash`** — squash merging is disabled on
|
|
89
|
+
this repo's branch protection and the API call fails outright. **Not
|
|
90
|
+
`--rebase`** either — the user's stated preference is an actual merge
|
|
91
|
+
commit. Give the merge commit a Conventional Commits subject (commitlint
|
|
92
|
+
ignores merge commits by default, so GitHub's auto-generated `Merge pull
|
|
93
|
+
request #N from ...` subject would slip through unflagged and pollute
|
|
94
|
+
history; semantic-release also reads that subject on `main` to derive the
|
|
95
|
+
version).
|
|
96
|
+
|
|
97
|
+
## Running multiple agents at once
|
|
98
|
+
|
|
99
|
+
A single agent uses the main working tree as normal. But if **you** are fanning
|
|
100
|
+
out several agents that each commit, they must not share one checkout — parallel
|
|
101
|
+
`git checkout`s collide and reshuffle each other's working trees. Launch each
|
|
102
|
+
such agent with `isolation: "worktree"` (or have it `EnterWorktree`) so it gets
|
|
103
|
+
its own working directory and branch. Don't make worktrees the default for solo
|
|
104
|
+
work — each worktree needs its own install, so it only pays off when work is
|
|
105
|
+
genuinely concurrent.
|
|
106
|
+
|
|
107
|
+
## Related
|
|
108
|
+
|
|
109
|
+
- `finishing-a-development-branch` — generic completion options (merge/PR/cleanup).
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dispatching-parallel-agents
|
|
3
|
+
description: Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Dispatching Parallel Agents
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
You delegate tasks to specialized agents with isolated context. By precisely crafting their instructions and context, you ensure they stay focused and succeed at their task. They should never inherit your session's context or history — you construct exactly what they need. This also preserves your own context for coordination work.
|
|
11
|
+
|
|
12
|
+
When you have multiple unrelated failures (different test files, different subsystems, different bugs), investigating them sequentially wastes time. Each investigation is independent and can happen in parallel.
|
|
13
|
+
|
|
14
|
+
**Core principle:** Dispatch one agent per independent problem domain. Let them work concurrently.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
```dot
|
|
19
|
+
digraph when_to_use {
|
|
20
|
+
"Multiple failures?" [shape=diamond];
|
|
21
|
+
"Are they independent?" [shape=diamond];
|
|
22
|
+
"Single agent investigates all" [shape=box];
|
|
23
|
+
"One agent per problem domain" [shape=box];
|
|
24
|
+
"Can they work in parallel?" [shape=diamond];
|
|
25
|
+
"Sequential agents" [shape=box];
|
|
26
|
+
"Parallel dispatch" [shape=box];
|
|
27
|
+
|
|
28
|
+
"Multiple failures?" -> "Are they independent?" [label="yes"];
|
|
29
|
+
"Are they independent?" -> "Single agent investigates all" [label="no - related"];
|
|
30
|
+
"Are they independent?" -> "Can they work in parallel?" [label="yes"];
|
|
31
|
+
"Can they work in parallel?" -> "Parallel dispatch" [label="yes"];
|
|
32
|
+
"Can they work in parallel?" -> "Sequential agents" [label="no - shared state"];
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Use when:**
|
|
37
|
+
- 3+ test files failing with different root causes
|
|
38
|
+
- Multiple subsystems broken independently
|
|
39
|
+
- Each problem can be understood without context from others
|
|
40
|
+
- No shared state between investigations
|
|
41
|
+
|
|
42
|
+
**Don't use when:**
|
|
43
|
+
- Failures are related (fix one might fix others)
|
|
44
|
+
- Need to understand full system state
|
|
45
|
+
- Agents would interfere with each other
|
|
46
|
+
|
|
47
|
+
## The Pattern
|
|
48
|
+
|
|
49
|
+
### 1. Identify Independent Domains
|
|
50
|
+
|
|
51
|
+
Group failures by what's broken:
|
|
52
|
+
- File A tests: Tool approval flow
|
|
53
|
+
- File B tests: Batch completion behavior
|
|
54
|
+
- File C tests: Abort functionality
|
|
55
|
+
|
|
56
|
+
Each domain is independent - fixing tool approval doesn't affect abort tests.
|
|
57
|
+
|
|
58
|
+
### 2. Create Focused Agent Tasks
|
|
59
|
+
|
|
60
|
+
Each agent gets:
|
|
61
|
+
- **Specific scope:** One test file or subsystem
|
|
62
|
+
- **Clear goal:** Make these tests pass
|
|
63
|
+
- **Constraints:** Don't change other code
|
|
64
|
+
- **Expected output:** Summary of what you found and fixed
|
|
65
|
+
|
|
66
|
+
### 3. Dispatch in Parallel
|
|
67
|
+
|
|
68
|
+
Issue all three subagent dispatches in the same response — they run in parallel:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
Subagent (general-purpose): "Fix agent-tool-abort.test.ts failures"
|
|
72
|
+
Subagent (general-purpose): "Fix batch-completion-behavior.test.ts failures"
|
|
73
|
+
Subagent (general-purpose): "Fix tool-approval-race-conditions.test.ts failures"
|
|
74
|
+
# All three run concurrently.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Multiple dispatch calls in one response = parallel execution. One per response = sequential.
|
|
78
|
+
|
|
79
|
+
### 4. Review and Integrate
|
|
80
|
+
|
|
81
|
+
When agents return:
|
|
82
|
+
- Read each summary
|
|
83
|
+
- Verify fixes don't conflict
|
|
84
|
+
- Run full test suite
|
|
85
|
+
- Integrate all changes
|
|
86
|
+
|
|
87
|
+
## Agent Prompt Structure
|
|
88
|
+
|
|
89
|
+
Good agent prompts are:
|
|
90
|
+
1. **Focused** - One clear problem domain
|
|
91
|
+
2. **Self-contained** - All context needed to understand the problem
|
|
92
|
+
3. **Specific about output** - What should the agent return?
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
|
|
96
|
+
|
|
97
|
+
1. "should abort tool with partial output capture" - expects 'interrupted at' in message
|
|
98
|
+
2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
|
|
99
|
+
3. "should properly track pendingToolCount" - expects 3 results but gets 0
|
|
100
|
+
|
|
101
|
+
These are timing/race condition issues. Your task:
|
|
102
|
+
|
|
103
|
+
1. Read the test file and understand what each test verifies
|
|
104
|
+
2. Identify root cause - timing issues or actual bugs?
|
|
105
|
+
3. Fix by:
|
|
106
|
+
- Replacing arbitrary timeouts with event-based waiting
|
|
107
|
+
- Fixing bugs in abort implementation if found
|
|
108
|
+
- Adjusting test expectations if testing changed behavior
|
|
109
|
+
|
|
110
|
+
Do NOT just increase timeouts - find the real issue.
|
|
111
|
+
|
|
112
|
+
Return: Summary of what you found and what you fixed.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Common Mistakes
|
|
116
|
+
|
|
117
|
+
**❌ Too broad:** "Fix all the tests" - agent gets lost
|
|
118
|
+
**✅ Specific:** "Fix agent-tool-abort.test.ts" - focused scope
|
|
119
|
+
|
|
120
|
+
**❌ No context:** "Fix the race condition" - agent doesn't know where
|
|
121
|
+
**✅ Context:** Paste the error messages and test names
|
|
122
|
+
|
|
123
|
+
**❌ No constraints:** Agent might refactor everything
|
|
124
|
+
**✅ Constraints:** "Do NOT change production code" or "Fix tests only"
|
|
125
|
+
|
|
126
|
+
**❌ Vague output:** "Fix it" - you don't know what changed
|
|
127
|
+
**✅ Specific:** "Return summary of root cause and changes"
|
|
128
|
+
|
|
129
|
+
## When NOT to Use
|
|
130
|
+
|
|
131
|
+
**Related failures:** Fixing one might fix others - investigate together first
|
|
132
|
+
**Need full context:** Understanding requires seeing entire system
|
|
133
|
+
**Exploratory debugging:** You don't know what's broken yet
|
|
134
|
+
**Shared state:** Agents would interfere (editing same files, using same resources)
|
|
135
|
+
|
|
136
|
+
## Real Example from Session
|
|
137
|
+
|
|
138
|
+
**Scenario:** 6 test failures across 3 files after major refactoring
|
|
139
|
+
|
|
140
|
+
**Failures:**
|
|
141
|
+
- agent-tool-abort.test.ts: 3 failures (timing issues)
|
|
142
|
+
- batch-completion-behavior.test.ts: 2 failures (tools not executing)
|
|
143
|
+
- tool-approval-race-conditions.test.ts: 1 failure (execution count = 0)
|
|
144
|
+
|
|
145
|
+
**Decision:** Independent domains - abort logic separate from batch completion separate from race conditions
|
|
146
|
+
|
|
147
|
+
**Dispatch:**
|
|
148
|
+
```
|
|
149
|
+
Agent 1 → Fix agent-tool-abort.test.ts
|
|
150
|
+
Agent 2 → Fix batch-completion-behavior.test.ts
|
|
151
|
+
Agent 3 → Fix tool-approval-race-conditions.test.ts
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Results:**
|
|
155
|
+
- Agent 1: Replaced timeouts with event-based waiting
|
|
156
|
+
- Agent 2: Fixed event structure bug (threadId in wrong place)
|
|
157
|
+
- Agent 3: Added wait for async tool execution to complete
|
|
158
|
+
|
|
159
|
+
**Integration:** All fixes independent, no conflicts, full suite green
|
|
160
|
+
|
|
161
|
+
**Time saved:** 3 problems solved in parallel vs sequentially
|
|
162
|
+
|
|
163
|
+
## Key Benefits
|
|
164
|
+
|
|
165
|
+
1. **Parallelization** - Multiple investigations happen simultaneously
|
|
166
|
+
2. **Focus** - Each agent has narrow scope, less context to track
|
|
167
|
+
3. **Independence** - Agents don't interfere with each other
|
|
168
|
+
4. **Speed** - 3 problems solved in time of 1
|
|
169
|
+
|
|
170
|
+
## Verification
|
|
171
|
+
|
|
172
|
+
After agents return:
|
|
173
|
+
1. **Review each summary** - Understand what changed
|
|
174
|
+
2. **Check for conflicts** - Did agents edit same code?
|
|
175
|
+
3. **Run full suite** - Verify all fixes work together
|
|
176
|
+
4. **Spot check** - Agents can make systematic errors
|
|
177
|
+
|
|
178
|
+
## Real-World Impact
|
|
179
|
+
|
|
180
|
+
From debugging session (2025-10-03):
|
|
181
|
+
- 6 failures across 3 files
|
|
182
|
+
- 3 agents dispatched in parallel
|
|
183
|
+
- All investigations completed concurrently
|
|
184
|
+
- All fixes integrated successfully
|
|
185
|
+
- Zero conflicts between agent changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: executing-plans
|
|
3
|
+
description: Use when you have a written implementation plan to execute in a separate session with review checkpoints
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Executing Plans
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Load plan, review critically, execute all tasks, report when complete.
|
|
11
|
+
|
|
12
|
+
**Announce at start:** "I'm using the executing-plans skill to implement this plan."
|
|
13
|
+
|
|
14
|
+
**Note:** Tell your human partner that Superpowers works much better with access to subagents. The quality of its work will be significantly higher if run on a platform with subagent support (Claude Code, Codex CLI, Codex App, Copilot CLI, and Gemini CLI all qualify; see the per-platform tool refs in `../using-superpowers/references/`). If subagents are available, use superpowers:subagent-driven-development instead of this skill.
|
|
15
|
+
|
|
16
|
+
## The Process
|
|
17
|
+
|
|
18
|
+
### Step 1: Load and Review Plan
|
|
19
|
+
1. Read plan file
|
|
20
|
+
2. Review critically - identify any questions or concerns about the plan
|
|
21
|
+
3. If concerns: Raise them with your human partner before starting
|
|
22
|
+
4. If no concerns: Create todos for the plan items and proceed
|
|
23
|
+
|
|
24
|
+
### Step 2: Execute Tasks
|
|
25
|
+
|
|
26
|
+
For each task:
|
|
27
|
+
1. Mark as in_progress
|
|
28
|
+
2. Follow each step exactly (plan has bite-sized steps)
|
|
29
|
+
3. Run verifications as specified
|
|
30
|
+
4. Mark as completed
|
|
31
|
+
|
|
32
|
+
### Step 3: Complete Development
|
|
33
|
+
|
|
34
|
+
After all tasks complete and verified:
|
|
35
|
+
- Announce: "I'm using the finishing-a-development-branch skill to complete this work."
|
|
36
|
+
- **REQUIRED SUB-SKILL:** Use superpowers:finishing-a-development-branch
|
|
37
|
+
- Follow that skill to verify tests, present options, execute choice
|
|
38
|
+
|
|
39
|
+
## When to Stop and Ask for Help
|
|
40
|
+
|
|
41
|
+
**STOP executing immediately when:**
|
|
42
|
+
- Hit a blocker (missing dependency, test fails, instruction unclear)
|
|
43
|
+
- Plan has critical gaps preventing starting
|
|
44
|
+
- You don't understand an instruction
|
|
45
|
+
- Verification fails repeatedly
|
|
46
|
+
|
|
47
|
+
**Ask for clarification rather than guessing.**
|
|
48
|
+
|
|
49
|
+
## When to Revisit Earlier Steps
|
|
50
|
+
|
|
51
|
+
**Return to Review (Step 1) when:**
|
|
52
|
+
- Partner updates the plan based on your feedback
|
|
53
|
+
- Fundamental approach needs rethinking
|
|
54
|
+
|
|
55
|
+
**Don't force through blockers** - stop and ask.
|
|
56
|
+
|
|
57
|
+
## Remember
|
|
58
|
+
- Review plan critically first
|
|
59
|
+
- Follow plan steps exactly
|
|
60
|
+
- Don't skip verifications
|
|
61
|
+
- Reference skills when plan says to
|
|
62
|
+
- Stop when blocked, don't guess
|
|
63
|
+
- Never start implementation on main/master branch without explicit user consent
|
|
64
|
+
|
|
65
|
+
## Integration
|
|
66
|
+
|
|
67
|
+
**Required workflow skills:**
|
|
68
|
+
- **superpowers:using-git-worktrees** - Ensures isolated workspace (creates one or verifies existing)
|
|
69
|
+
- **superpowers:writing-plans** - Creates the plan this skill executes
|
|
70
|
+
- **superpowers:finishing-a-development-branch** - Complete development after all tasks
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: finishing-a-development-branch
|
|
3
|
+
description: Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Finishing a Development Branch
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Guide completion of development work by presenting clear options and handling chosen workflow.
|
|
11
|
+
|
|
12
|
+
**Core principle:** Verify tests → Detect environment → Present options → Execute choice → Clean up.
|
|
13
|
+
|
|
14
|
+
**Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work."
|
|
15
|
+
|
|
16
|
+
## The Process
|
|
17
|
+
|
|
18
|
+
### Step 1: Verify Tests
|
|
19
|
+
|
|
20
|
+
**Before presenting options, verify tests pass:**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Run project's test suite
|
|
24
|
+
npm test / cargo test / pytest / go test ./...
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**If tests fail:**
|
|
28
|
+
```
|
|
29
|
+
Tests failing (<N> failures). Must fix before completing:
|
|
30
|
+
|
|
31
|
+
[Show failures]
|
|
32
|
+
|
|
33
|
+
Cannot proceed with merge/PR until tests pass.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Stop. Don't proceed to Step 2.
|
|
37
|
+
|
|
38
|
+
**If tests pass:** Continue to Step 2.
|
|
39
|
+
|
|
40
|
+
### Step 2: Detect Environment
|
|
41
|
+
|
|
42
|
+
**Determine workspace state before presenting options:**
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
|
|
46
|
+
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This determines which menu to show and how cleanup works:
|
|
50
|
+
|
|
51
|
+
| State | Menu | Cleanup |
|
|
52
|
+
|-------|------|---------|
|
|
53
|
+
| `GIT_DIR == GIT_COMMON` (normal repo) | Standard 4 options | No worktree to clean up |
|
|
54
|
+
| `GIT_DIR != GIT_COMMON`, named branch | Standard 4 options | Provenance-based (see Step 6) |
|
|
55
|
+
| `GIT_DIR != GIT_COMMON`, detached HEAD | Reduced 3 options (no merge) | No cleanup (externally managed) |
|
|
56
|
+
|
|
57
|
+
### Step 3: Determine Base Branch
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Try common base branches
|
|
61
|
+
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or ask: "This branch split from main - is that correct?"
|
|
65
|
+
|
|
66
|
+
### Step 4: Present Options
|
|
67
|
+
|
|
68
|
+
**Normal repo and named-branch worktree — present exactly these 4 options:**
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Implementation complete. What would you like to do?
|
|
72
|
+
|
|
73
|
+
1. Merge back to <base-branch> locally
|
|
74
|
+
2. Push and create a Pull Request
|
|
75
|
+
3. Keep the branch as-is (I'll handle it later)
|
|
76
|
+
4. Discard this work
|
|
77
|
+
|
|
78
|
+
Which option?
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Detached HEAD — present exactly these 3 options:**
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
Implementation complete. You're on a detached HEAD (externally managed workspace).
|
|
85
|
+
|
|
86
|
+
1. Push as new branch and create a Pull Request
|
|
87
|
+
2. Keep as-is (I'll handle it later)
|
|
88
|
+
3. Discard this work
|
|
89
|
+
|
|
90
|
+
Which option?
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Don't add explanation** - keep options concise.
|
|
94
|
+
|
|
95
|
+
### Step 5: Execute Choice
|
|
96
|
+
|
|
97
|
+
#### Option 1: Merge Locally
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Get main repo root for CWD safety
|
|
101
|
+
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
|
|
102
|
+
cd "$MAIN_ROOT"
|
|
103
|
+
|
|
104
|
+
# Merge first — verify success before removing anything
|
|
105
|
+
git checkout <base-branch>
|
|
106
|
+
git pull
|
|
107
|
+
git merge <feature-branch>
|
|
108
|
+
|
|
109
|
+
# Verify tests on merged result
|
|
110
|
+
<test command>
|
|
111
|
+
|
|
112
|
+
# Only after merge succeeds: cleanup worktree (Step 6), then delete branch
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Then: Cleanup worktree (Step 6), then delete branch:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
git branch -d <feature-branch>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### Option 2: Push and Create PR
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Push branch
|
|
125
|
+
git push -u origin <feature-branch>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Do NOT clean up worktree** — user needs it alive to iterate on PR feedback.
|
|
129
|
+
|
|
130
|
+
#### Option 3: Keep As-Is
|
|
131
|
+
|
|
132
|
+
Report: "Keeping branch <name>. Worktree preserved at <path>."
|
|
133
|
+
|
|
134
|
+
**Don't cleanup worktree.**
|
|
135
|
+
|
|
136
|
+
#### Option 4: Discard
|
|
137
|
+
|
|
138
|
+
**Confirm first:**
|
|
139
|
+
```
|
|
140
|
+
This will permanently delete:
|
|
141
|
+
- Branch <name>
|
|
142
|
+
- All commits: <commit-list>
|
|
143
|
+
- Worktree at <path>
|
|
144
|
+
|
|
145
|
+
Type 'discard' to confirm.
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Wait for exact confirmation.
|
|
149
|
+
|
|
150
|
+
If confirmed:
|
|
151
|
+
```bash
|
|
152
|
+
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
|
|
153
|
+
cd "$MAIN_ROOT"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Then: Cleanup worktree (Step 6), then force-delete branch:
|
|
157
|
+
```bash
|
|
158
|
+
git branch -D <feature-branch>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Step 6: Cleanup Workspace
|
|
162
|
+
|
|
163
|
+
**Only runs for Options 1 and 4.** Options 2 and 3 always preserve the worktree.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
|
|
167
|
+
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
|
|
168
|
+
WORKTREE_PATH=$(git rev-parse --show-toplevel)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**If `GIT_DIR == GIT_COMMON`:** Normal repo, no worktree to clean up. Done.
|
|
172
|
+
|
|
173
|
+
**If worktree path is under `.worktrees/` or `worktrees/`:** Superpowers created this worktree — we own cleanup.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
|
|
177
|
+
cd "$MAIN_ROOT"
|
|
178
|
+
git worktree remove "$WORKTREE_PATH"
|
|
179
|
+
git worktree prune # Self-healing: clean up any stale registrations
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Otherwise:** The host environment (harness) owns this workspace. Do NOT remove it. If your platform provides a workspace-exit tool, use it. Otherwise, leave the workspace in place.
|
|
183
|
+
|
|
184
|
+
## Quick Reference
|
|
185
|
+
|
|
186
|
+
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|
|
187
|
+
|--------|-------|------|---------------|----------------|
|
|
188
|
+
| 1. Merge locally | yes | - | - | yes |
|
|
189
|
+
| 2. Create PR | - | yes | yes | - |
|
|
190
|
+
| 3. Keep as-is | - | - | yes | - |
|
|
191
|
+
| 4. Discard | - | - | - | yes (force) |
|
|
192
|
+
|
|
193
|
+
## Common Mistakes
|
|
194
|
+
|
|
195
|
+
**Skipping test verification**
|
|
196
|
+
- **Problem:** Merge broken code, create failing PR
|
|
197
|
+
- **Fix:** Always verify tests before offering options
|
|
198
|
+
|
|
199
|
+
**Open-ended questions**
|
|
200
|
+
- **Problem:** "What should I do next?" is ambiguous
|
|
201
|
+
- **Fix:** Present exactly 4 structured options (or 3 for detached HEAD)
|
|
202
|
+
|
|
203
|
+
**Cleaning up worktree for Option 2**
|
|
204
|
+
- **Problem:** Remove worktree user needs for PR iteration
|
|
205
|
+
- **Fix:** Only cleanup for Options 1 and 4
|
|
206
|
+
|
|
207
|
+
**Deleting branch before removing worktree**
|
|
208
|
+
- **Problem:** `git branch -d` fails because worktree still references the branch
|
|
209
|
+
- **Fix:** Merge first, remove worktree, then delete branch
|
|
210
|
+
|
|
211
|
+
**Running git worktree remove from inside the worktree**
|
|
212
|
+
- **Problem:** Command fails silently when CWD is inside the worktree being removed
|
|
213
|
+
- **Fix:** Always `cd` to main repo root before `git worktree remove`
|
|
214
|
+
|
|
215
|
+
**Cleaning up harness-owned worktrees**
|
|
216
|
+
- **Problem:** Removing a worktree the harness created causes phantom state
|
|
217
|
+
- **Fix:** Only clean up worktrees under `.worktrees/` or `worktrees/`
|
|
218
|
+
|
|
219
|
+
**No confirmation for discard**
|
|
220
|
+
- **Problem:** Accidentally delete work
|
|
221
|
+
- **Fix:** Require typed "discard" confirmation
|
|
222
|
+
|
|
223
|
+
## Red Flags
|
|
224
|
+
|
|
225
|
+
**Never:**
|
|
226
|
+
- Proceed with failing tests
|
|
227
|
+
- Merge without verifying tests on result
|
|
228
|
+
- Delete work without confirmation
|
|
229
|
+
- Force-push without explicit request
|
|
230
|
+
- Remove a worktree before confirming merge success
|
|
231
|
+
- Clean up worktrees you didn't create (provenance check)
|
|
232
|
+
- Run `git worktree remove` from inside the worktree
|
|
233
|
+
|
|
234
|
+
**Always:**
|
|
235
|
+
- Verify tests before offering options
|
|
236
|
+
- Detect environment before presenting menu
|
|
237
|
+
- Present exactly 4 options (or 3 for detached HEAD)
|
|
238
|
+
- Get typed confirmation for Option 4
|
|
239
|
+
- Clean up worktree for Options 1 & 4 only
|
|
240
|
+
- `cd` to main repo root before worktree removal
|
|
241
|
+
- Run `git worktree prune` after removal
|