@brainervirus/workit-core 0.11.0 → 1.0.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.
- package/README.md +5 -3
- package/package.json +8 -3
- package/scripts/analyze-release-scope.ts +4 -1
- package/scripts/doctor-check.ts +3 -1
- package/scripts/install-codex-plugin.sh +28 -0
- package/scripts/install-cursor-plugin.sh +1 -0
- package/scripts/install-opencode-plugin.sh +1 -0
- package/scripts/install-pi-package.sh +56 -0
- package/scripts/rewrite-workspace-deps.ts +22 -5
- package/scripts/sync-release-manifests.ts +8 -5
- package/scripts/sync-runtime.sh +7 -3
- package/scripts/validate-cursor-marketplace.ts +16 -62
- package/skills/workit-babysit/SKILL.md +33 -0
- package/skills/workit-behavioral-tdd/SKILL.md +53 -0
- package/skills/workit-blast-radius/SKILL.md +31 -0
- package/skills/workit-challenge/SKILL.md +62 -0
- package/skills/workit-debug/SKILL.md +61 -0
- package/skills/workit-deslop/SKILL.md +36 -0
- package/skills/workit-diagram/SKILL.md +32 -0
- package/skills/workit-green-run/SKILL.md +29 -0
- package/skills/workit-handoff/SKILL.md +43 -0
- package/skills/workit-implement/SKILL.md +46 -0
- package/skills/workit-mockup/SKILL.md +28 -0
- package/skills/workit-plan/SKILL.md +66 -0
- package/skills/workit-review/SKILL.md +60 -0
- package/skills/workit-steer/SKILL.md +32 -0
- package/src/core/authority.ts +918 -0
- package/src/core/boundary.ts +29 -0
- package/src/core/branch.ts +26 -255
- package/src/core/changelog.ts +95 -18
- package/src/core/commit-flavors.ts +65 -0
- package/src/core/config-conversion.ts +183 -0
- package/src/core/config.ts +42 -0
- package/src/core/cutover.ts +721 -0
- package/src/core/detect-hosts.ts +107 -0
- package/src/core/doctor.ts +428 -18
- package/src/core/external-action-effects.ts +1171 -0
- package/src/core/external-action.ts +541 -0
- package/src/core/init.ts +83 -32
- package/src/core/methods.ts +125 -0
- package/src/core/policy-resolver.ts +523 -0
- package/src/core/pr-create.ts +7 -1
- package/src/core/registration.ts +69 -4
- package/src/core/repo-context.ts +59 -1
- package/src/core/setup.ts +28 -0
- package/src/core/skill-manifests.ts +40 -42
- package/src/core/support-matrix.ts +8 -3
- package/src/core/sync-runtime.ts +15 -3
- package/src/core/task-context.ts +179 -0
- package/src/core/task-contract.ts +1136 -0
- package/src/core/task-engine.ts +2562 -0
- package/src/core/task-evaluation.ts +679 -0
- package/src/core/task-store.ts +1071 -0
- package/src/core/tracker-issues.ts +237 -0
- package/src/core/uninstall.ts +67 -3
- package/src/core/vcs-config.ts +53 -22
- package/src/core/workers.ts +166 -0
- package/src/core/workspaces.ts +3 -1
- package/src/core/youtrack-tools.ts +2 -0
- package/src/core/youtrack.ts +145 -10
- package/src/core.ts +126 -0
- package/templates/execution-contract.md +17 -50
- package/templates/plan-template.md +3 -3
- package/templates/spec-template.md +15 -3
- package/templates/workit-contract.md +12 -0
- package/commands/wk-changelog.md +0 -2
- package/commands/wk-commit.md +0 -2
- package/commands/wk-docs-refresh.md +0 -2
- package/commands/wk-handoff.md +0 -2
- package/commands/wk-implement.md +0 -2
- package/commands/wk-init.md +0 -2
- package/commands/wk-issue-update.md +0 -2
- package/commands/wk-meetings.md +0 -2
- package/commands/wk-pr.md +0 -2
- package/commands/wk-release-notes.md +0 -2
- package/commands/wk-status.md +0 -2
- package/commands/wk-verify.md +0 -2
- package/scripts/update-superpowers.sh +0 -82
- package/scripts/vendor-assets.ts +0 -37
- package/skills/wk-changelog/SKILL.md +0 -15
- package/skills/wk-commit/SKILL.md +0 -16
- package/skills/wk-docs-refresh/SKILL.md +0 -15
- package/skills/wk-handoff/SKILL.md +0 -20
- package/skills/wk-implement/SKILL.md +0 -47
- package/skills/wk-init/SKILL.md +0 -31
- package/skills/wk-issue-update/SKILL.md +0 -27
- package/skills/wk-issue-update/references/youtrack-update-style.md +0 -81
- package/skills/wk-meetings/SKILL.md +0 -17
- package/skills/wk-pr/SKILL.md +0 -27
- package/skills/wk-release-notes/SKILL.md +0 -15
- package/skills/wk-status/SKILL.md +0 -16
- package/skills/wk-verify/SKILL.md +0 -16
- package/src/core/detector.ts +0 -239
- package/src/core/flow-state.ts +0 -3308
- package/src/core/handoff-context.ts +0 -136
- package/src/core/handoff-tools.ts +0 -133
- package/src/core/menu.ts +0 -70
- package/src/core/plan-tasks.ts +0 -43
- package/src/core/reminder.ts +0 -124
- package/src/core/sdd.ts +0 -353
- package/src/state.ts +0 -22
- package/templates/superpowers-doc-contract.md +0 -75
- package/vendor/superpowers/skills/brainstorming/SKILL.md +0 -159
- package/vendor/superpowers/skills/brainstorming/scripts/frame-template.html +0 -213
- package/vendor/superpowers/skills/brainstorming/scripts/helper.js +0 -167
- package/vendor/superpowers/skills/brainstorming/scripts/server.cjs +0 -723
- package/vendor/superpowers/skills/brainstorming/scripts/start-server.sh +0 -209
- package/vendor/superpowers/skills/brainstorming/scripts/stop-server.sh +0 -120
- package/vendor/superpowers/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
- package/vendor/superpowers/skills/brainstorming/visual-companion.md +0 -291
- package/vendor/superpowers/skills/dispatching-parallel-agents/SKILL.md +0 -185
- package/vendor/superpowers/skills/executing-plans/SKILL.md +0 -70
- package/vendor/superpowers/skills/finishing-a-development-branch/SKILL.md +0 -241
- package/vendor/superpowers/skills/receiving-code-review/SKILL.md +0 -213
- package/vendor/superpowers/skills/requesting-code-review/SKILL.md +0 -103
- package/vendor/superpowers/skills/requesting-code-review/code-reviewer.md +0 -172
- package/vendor/superpowers/skills/subagent-driven-development/SKILL.md +0 -428
- package/vendor/superpowers/skills/subagent-driven-development/implementer-prompt.md +0 -139
- package/vendor/superpowers/skills/subagent-driven-development/scripts/review-package +0 -44
- package/vendor/superpowers/skills/subagent-driven-development/scripts/sdd-workspace +0 -22
- package/vendor/superpowers/skills/subagent-driven-development/scripts/task-brief +0 -40
- package/vendor/superpowers/skills/subagent-driven-development/task-reviewer-prompt.md +0 -188
- package/vendor/superpowers/skills/systematic-debugging/CREATION-LOG.md +0 -119
- package/vendor/superpowers/skills/systematic-debugging/SKILL.md +0 -296
- package/vendor/superpowers/skills/systematic-debugging/condition-based-waiting-example.ts +0 -158
- package/vendor/superpowers/skills/systematic-debugging/condition-based-waiting.md +0 -115
- package/vendor/superpowers/skills/systematic-debugging/defense-in-depth.md +0 -122
- package/vendor/superpowers/skills/systematic-debugging/find-polluter.sh +0 -63
- package/vendor/superpowers/skills/systematic-debugging/root-cause-tracing.md +0 -169
- package/vendor/superpowers/skills/systematic-debugging/test-academic.md +0 -14
- package/vendor/superpowers/skills/systematic-debugging/test-pressure-1.md +0 -58
- package/vendor/superpowers/skills/systematic-debugging/test-pressure-2.md +0 -68
- package/vendor/superpowers/skills/systematic-debugging/test-pressure-3.md +0 -69
- package/vendor/superpowers/skills/test-driven-development/SKILL.md +0 -371
- package/vendor/superpowers/skills/test-driven-development/testing-anti-patterns.md +0 -299
- package/vendor/superpowers/skills/using-git-worktrees/SKILL.md +0 -202
- package/vendor/superpowers/skills/using-superpowers/SKILL.md +0 -62
- package/vendor/superpowers/skills/using-superpowers/references/antigravity-tools.md +0 -23
- package/vendor/superpowers/skills/using-superpowers/references/codex-tools.md +0 -39
- package/vendor/superpowers/skills/using-superpowers/references/pi-tools.md +0 -16
- package/vendor/superpowers/skills/verification-before-completion/SKILL.md +0 -139
- package/vendor/superpowers/skills/writing-plans/SKILL.md +0 -174
- package/vendor/superpowers/skills/writing-plans/plan-document-reviewer-prompt.md +0 -49
- package/vendor/superpowers/skills/writing-skills/SKILL.md +0 -689
- package/vendor/superpowers/skills/writing-skills/anthropic-best-practices.md +0 -1150
- package/vendor/superpowers/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
- package/vendor/superpowers/skills/writing-skills/graphviz-conventions.dot +0 -172
- package/vendor/superpowers/skills/writing-skills/persuasion-principles.md +0 -187
- package/vendor/superpowers/skills/writing-skills/render-graphs.js +0 -168
- package/vendor/superpowers/skills/writing-skills/testing-skills-with-subagents.md +0 -384
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
# Testing Anti-Patterns
|
|
2
|
-
|
|
3
|
-
**Load this reference when:** writing or changing tests, adding mocks, or tempted to add test-only methods to production code.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Tests must verify real behavior, not mock behavior. Mocks are a means to isolate, not the thing being tested.
|
|
8
|
-
|
|
9
|
-
**Core principle:** Test what the code does, not what the mocks do.
|
|
10
|
-
|
|
11
|
-
**Following strict TDD prevents these anti-patterns.**
|
|
12
|
-
|
|
13
|
-
## The Iron Laws
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
1. NEVER test mock behavior
|
|
17
|
-
2. NEVER add test-only methods to production classes
|
|
18
|
-
3. NEVER mock without understanding dependencies
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Anti-Pattern 1: Testing Mock Behavior
|
|
22
|
-
|
|
23
|
-
**The violation:**
|
|
24
|
-
```typescript
|
|
25
|
-
// ❌ BAD: Testing that the mock exists
|
|
26
|
-
test('renders sidebar', () => {
|
|
27
|
-
render(<Page />);
|
|
28
|
-
expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
**Why this is wrong:**
|
|
33
|
-
- You're verifying the mock works, not that the component works
|
|
34
|
-
- Test passes when mock is present, fails when it's not
|
|
35
|
-
- Tells you nothing about real behavior
|
|
36
|
-
|
|
37
|
-
**your human partner's correction:** "Are we testing the behavior of a mock?"
|
|
38
|
-
|
|
39
|
-
**The fix:**
|
|
40
|
-
```typescript
|
|
41
|
-
// ✅ GOOD: Test real component or don't mock it
|
|
42
|
-
test('renders sidebar', () => {
|
|
43
|
-
render(<Page />); // Don't mock sidebar
|
|
44
|
-
expect(screen.getByRole('navigation')).toBeInTheDocument();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// OR if sidebar must be mocked for isolation:
|
|
48
|
-
// Don't assert on the mock - test Page's behavior with sidebar present
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Gate Function
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
BEFORE asserting on any mock element:
|
|
55
|
-
Ask: "Am I testing real component behavior or just mock existence?"
|
|
56
|
-
|
|
57
|
-
IF testing mock existence:
|
|
58
|
-
STOP - Delete the assertion or unmock the component
|
|
59
|
-
|
|
60
|
-
Test real behavior instead
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Anti-Pattern 2: Test-Only Methods in Production
|
|
64
|
-
|
|
65
|
-
**The violation:**
|
|
66
|
-
```typescript
|
|
67
|
-
// ❌ BAD: destroy() only used in tests
|
|
68
|
-
class Session {
|
|
69
|
-
async destroy() { // Looks like production API!
|
|
70
|
-
await this._workspaceManager?.destroyWorkspace(this.id);
|
|
71
|
-
// ... cleanup
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// In tests
|
|
76
|
-
afterEach(() => session.destroy());
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**Why this is wrong:**
|
|
80
|
-
- Production class polluted with test-only code
|
|
81
|
-
- Dangerous if accidentally called in production
|
|
82
|
-
- Violates YAGNI and separation of concerns
|
|
83
|
-
- Confuses object lifecycle with entity lifecycle
|
|
84
|
-
|
|
85
|
-
**The fix:**
|
|
86
|
-
```typescript
|
|
87
|
-
// ✅ GOOD: Test utilities handle test cleanup
|
|
88
|
-
// Session has no destroy() - it's stateless in production
|
|
89
|
-
|
|
90
|
-
// In test-utils/
|
|
91
|
-
export async function cleanupSession(session: Session) {
|
|
92
|
-
const workspace = session.getWorkspaceInfo();
|
|
93
|
-
if (workspace) {
|
|
94
|
-
await workspaceManager.destroyWorkspace(workspace.id);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// In tests
|
|
99
|
-
afterEach(() => cleanupSession(session));
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Gate Function
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
BEFORE adding any method to production class:
|
|
106
|
-
Ask: "Is this only used by tests?"
|
|
107
|
-
|
|
108
|
-
IF yes:
|
|
109
|
-
STOP - Don't add it
|
|
110
|
-
Put it in test utilities instead
|
|
111
|
-
|
|
112
|
-
Ask: "Does this class own this resource's lifecycle?"
|
|
113
|
-
|
|
114
|
-
IF no:
|
|
115
|
-
STOP - Wrong class for this method
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Anti-Pattern 3: Mocking Without Understanding
|
|
119
|
-
|
|
120
|
-
**The violation:**
|
|
121
|
-
```typescript
|
|
122
|
-
// ❌ BAD: Mock breaks test logic
|
|
123
|
-
test('detects duplicate server', () => {
|
|
124
|
-
// Mock prevents config write that test depends on!
|
|
125
|
-
vi.mock('ToolCatalog', () => ({
|
|
126
|
-
discoverAndCacheTools: vi.fn().mockResolvedValue(undefined)
|
|
127
|
-
}));
|
|
128
|
-
|
|
129
|
-
await addServer(config);
|
|
130
|
-
await addServer(config); // Should throw - but won't!
|
|
131
|
-
});
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
**Why this is wrong:**
|
|
135
|
-
- Mocked method had side effect test depended on (writing config)
|
|
136
|
-
- Over-mocking to "be safe" breaks actual behavior
|
|
137
|
-
- Test passes for wrong reason or fails mysteriously
|
|
138
|
-
|
|
139
|
-
**The fix:**
|
|
140
|
-
```typescript
|
|
141
|
-
// ✅ GOOD: Mock at correct level
|
|
142
|
-
test('detects duplicate server', () => {
|
|
143
|
-
// Mock the slow part, preserve behavior test needs
|
|
144
|
-
vi.mock('MCPServerManager'); // Just mock slow server startup
|
|
145
|
-
|
|
146
|
-
await addServer(config); // Config written
|
|
147
|
-
await addServer(config); // Duplicate detected ✓
|
|
148
|
-
});
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Gate Function
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
BEFORE mocking any method:
|
|
155
|
-
STOP - Don't mock yet
|
|
156
|
-
|
|
157
|
-
1. Ask: "What side effects does the real method have?"
|
|
158
|
-
2. Ask: "Does this test depend on any of those side effects?"
|
|
159
|
-
3. Ask: "Do I fully understand what this test needs?"
|
|
160
|
-
|
|
161
|
-
IF depends on side effects:
|
|
162
|
-
Mock at lower level (the actual slow/external operation)
|
|
163
|
-
OR use test doubles that preserve necessary behavior
|
|
164
|
-
NOT the high-level method the test depends on
|
|
165
|
-
|
|
166
|
-
IF unsure what test depends on:
|
|
167
|
-
Run test with real implementation FIRST
|
|
168
|
-
Observe what actually needs to happen
|
|
169
|
-
THEN add minimal mocking at the right level
|
|
170
|
-
|
|
171
|
-
Red flags:
|
|
172
|
-
- "I'll mock this to be safe"
|
|
173
|
-
- "This might be slow, better mock it"
|
|
174
|
-
- Mocking without understanding the dependency chain
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## Anti-Pattern 4: Incomplete Mocks
|
|
178
|
-
|
|
179
|
-
**The violation:**
|
|
180
|
-
```typescript
|
|
181
|
-
// ❌ BAD: Partial mock - only fields you think you need
|
|
182
|
-
const mockResponse = {
|
|
183
|
-
status: 'success',
|
|
184
|
-
data: { userId: '123', name: 'Alice' }
|
|
185
|
-
// Missing: metadata that downstream code uses
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
// Later: breaks when code accesses response.metadata.requestId
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
**Why this is wrong:**
|
|
192
|
-
- **Partial mocks hide structural assumptions** - You only mocked fields you know about
|
|
193
|
-
- **Downstream code may depend on fields you didn't include** - Silent failures
|
|
194
|
-
- **Tests pass but integration fails** - Mock incomplete, real API complete
|
|
195
|
-
- **False confidence** - Test proves nothing about real behavior
|
|
196
|
-
|
|
197
|
-
**The Iron Rule:** Mock the COMPLETE data structure as it exists in reality, not just fields your immediate test uses.
|
|
198
|
-
|
|
199
|
-
**The fix:**
|
|
200
|
-
```typescript
|
|
201
|
-
// ✅ GOOD: Mirror real API completeness
|
|
202
|
-
const mockResponse = {
|
|
203
|
-
status: 'success',
|
|
204
|
-
data: { userId: '123', name: 'Alice' },
|
|
205
|
-
metadata: { requestId: 'req-789', timestamp: 1234567890 }
|
|
206
|
-
// All fields real API returns
|
|
207
|
-
};
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Gate Function
|
|
211
|
-
|
|
212
|
-
```
|
|
213
|
-
BEFORE creating mock responses:
|
|
214
|
-
Check: "What fields does the real API response contain?"
|
|
215
|
-
|
|
216
|
-
Actions:
|
|
217
|
-
1. Examine actual API response from docs/examples
|
|
218
|
-
2. Include ALL fields system might consume downstream
|
|
219
|
-
3. Verify mock matches real response schema completely
|
|
220
|
-
|
|
221
|
-
Critical:
|
|
222
|
-
If you're creating a mock, you must understand the ENTIRE structure
|
|
223
|
-
Partial mocks fail silently when code depends on omitted fields
|
|
224
|
-
|
|
225
|
-
If uncertain: Include all documented fields
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
## Anti-Pattern 5: Integration Tests as Afterthought
|
|
229
|
-
|
|
230
|
-
**The violation:**
|
|
231
|
-
```
|
|
232
|
-
✅ Implementation complete
|
|
233
|
-
❌ No tests written
|
|
234
|
-
"Ready for testing"
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
**Why this is wrong:**
|
|
238
|
-
- Testing is part of implementation, not optional follow-up
|
|
239
|
-
- TDD would have caught this
|
|
240
|
-
- Can't claim complete without tests
|
|
241
|
-
|
|
242
|
-
**The fix:**
|
|
243
|
-
```
|
|
244
|
-
TDD cycle:
|
|
245
|
-
1. Write failing test
|
|
246
|
-
2. Implement to pass
|
|
247
|
-
3. Refactor
|
|
248
|
-
4. THEN claim complete
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
## When Mocks Become Too Complex
|
|
252
|
-
|
|
253
|
-
**Warning signs:**
|
|
254
|
-
- Mock setup longer than test logic
|
|
255
|
-
- Mocking everything to make test pass
|
|
256
|
-
- Mocks missing methods real components have
|
|
257
|
-
- Test breaks when mock changes
|
|
258
|
-
|
|
259
|
-
**your human partner's question:** "Do we need to be using a mock here?"
|
|
260
|
-
|
|
261
|
-
**Consider:** Integration tests with real components often simpler than complex mocks
|
|
262
|
-
|
|
263
|
-
## TDD Prevents These Anti-Patterns
|
|
264
|
-
|
|
265
|
-
**Why TDD helps:**
|
|
266
|
-
1. **Write test first** → Forces you to think about what you're actually testing
|
|
267
|
-
2. **Watch it fail** → Confirms test tests real behavior, not mocks
|
|
268
|
-
3. **Minimal implementation** → No test-only methods creep in
|
|
269
|
-
4. **Real dependencies** → You see what the test actually needs before mocking
|
|
270
|
-
|
|
271
|
-
**If you're testing mock behavior, you violated TDD** - you added mocks without watching test fail against real code first.
|
|
272
|
-
|
|
273
|
-
## Quick Reference
|
|
274
|
-
|
|
275
|
-
| Anti-Pattern | Fix |
|
|
276
|
-
|--------------|-----|
|
|
277
|
-
| Assert on mock elements | Test real component or unmock it |
|
|
278
|
-
| Test-only methods in production | Move to test utilities |
|
|
279
|
-
| Mock without understanding | Understand dependencies first, mock minimally |
|
|
280
|
-
| Incomplete mocks | Mirror real API completely |
|
|
281
|
-
| Tests as afterthought | TDD - tests first |
|
|
282
|
-
| Over-complex mocks | Consider integration tests |
|
|
283
|
-
|
|
284
|
-
## Red Flags
|
|
285
|
-
|
|
286
|
-
- Assertion checks for `*-mock` test IDs
|
|
287
|
-
- Methods only called in test files
|
|
288
|
-
- Mock setup is >50% of test
|
|
289
|
-
- Test fails when you remove mock
|
|
290
|
-
- Can't explain why mock is needed
|
|
291
|
-
- Mocking "just to be safe"
|
|
292
|
-
|
|
293
|
-
## The Bottom Line
|
|
294
|
-
|
|
295
|
-
**Mocks are tools to isolate, not things to test.**
|
|
296
|
-
|
|
297
|
-
If TDD reveals you're testing mock behavior, you've gone wrong.
|
|
298
|
-
|
|
299
|
-
Fix: Test real behavior or question why you're mocking at all.
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: using-git-worktrees
|
|
3
|
-
description: Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Using Git Worktrees
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
Ensure work happens in an isolated workspace. Prefer your platform's native worktree tools. Fall back to manual git worktrees only when no native tool is available.
|
|
11
|
-
|
|
12
|
-
**Core principle:** Detect existing isolation first. Then use native tools. Then fall back to git. Never fight the harness.
|
|
13
|
-
|
|
14
|
-
**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
|
|
15
|
-
|
|
16
|
-
## Step 0: Detect Existing Isolation
|
|
17
|
-
|
|
18
|
-
**Before creating anything, check if you are already in an isolated workspace.**
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
|
|
22
|
-
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
|
|
23
|
-
BRANCH=$(git branch --show-current)
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Submodule guard:** `GIT_DIR != GIT_COMMON` is also true inside git submodules. Before concluding "already in a worktree," verify you are not in a submodule:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
# If this returns a path, you're in a submodule, not a worktree — treat as normal repo
|
|
30
|
-
git rev-parse --show-superproject-working-tree 2>/dev/null
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**If `GIT_DIR != GIT_COMMON` (and not a submodule):** You are already in a linked worktree. Skip to Step 2 (Project Setup). Do NOT create another worktree.
|
|
34
|
-
|
|
35
|
-
Report with branch state:
|
|
36
|
-
- On a branch: "Already in isolated workspace at `<path>` on branch `<name>`."
|
|
37
|
-
- Detached HEAD: "Already in isolated workspace at `<path>` (detached HEAD, externally managed). Branch creation needed at finish time."
|
|
38
|
-
|
|
39
|
-
**If `GIT_DIR == GIT_COMMON` (or in a submodule):** You are in a normal repo checkout.
|
|
40
|
-
|
|
41
|
-
Has the user already indicated their worktree preference in your instructions? If not, ask for consent before creating a worktree:
|
|
42
|
-
|
|
43
|
-
> "Would you like me to set up an isolated worktree? It protects your current branch from changes."
|
|
44
|
-
|
|
45
|
-
Honor any existing declared preference without asking. If the user declines consent, work in place and skip to Step 2.
|
|
46
|
-
|
|
47
|
-
## Step 1: Create Isolated Workspace
|
|
48
|
-
|
|
49
|
-
**You have two mechanisms. Try them in this order.**
|
|
50
|
-
|
|
51
|
-
### 1a. Native Worktree Tools (preferred)
|
|
52
|
-
|
|
53
|
-
The user has asked for an isolated workspace (Step 0 consent). Do you already have a way to create a worktree? It might be a tool with a name like `EnterWorktree`, `WorktreeCreate`, a `/worktree` command, or a `--worktree` flag. If you do, use it and skip to Step 2.
|
|
54
|
-
|
|
55
|
-
Native tools handle directory placement, branch creation, and cleanup automatically. Using `git worktree add` when you have a native tool creates phantom state your harness can't see or manage.
|
|
56
|
-
|
|
57
|
-
Only proceed to Step 1b if you have no native worktree tool available.
|
|
58
|
-
|
|
59
|
-
### 1b. Git Worktree Fallback
|
|
60
|
-
|
|
61
|
-
**Only use this if Step 1a does not apply** — you have no native worktree tool available. Create a worktree manually using git.
|
|
62
|
-
|
|
63
|
-
#### Directory Selection
|
|
64
|
-
|
|
65
|
-
Follow this priority order. Explicit user preference always beats observed filesystem state.
|
|
66
|
-
|
|
67
|
-
1. **Check your instructions for a declared worktree directory preference.** If the user has already specified one, use it without asking.
|
|
68
|
-
|
|
69
|
-
2. **Check for an existing project-local worktree directory:**
|
|
70
|
-
```bash
|
|
71
|
-
ls -d .worktrees 2>/dev/null # Preferred (hidden)
|
|
72
|
-
ls -d worktrees 2>/dev/null # Alternative
|
|
73
|
-
```
|
|
74
|
-
If found, use it. If both exist, `.worktrees` wins.
|
|
75
|
-
|
|
76
|
-
3. **If there is no other guidance available**, default to `.worktrees/` at the project root.
|
|
77
|
-
|
|
78
|
-
#### Safety Verification (project-local directories only)
|
|
79
|
-
|
|
80
|
-
**MUST verify directory is ignored before creating worktree:**
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
**If NOT ignored:** Add to .gitignore, commit the change, then proceed.
|
|
87
|
-
|
|
88
|
-
**Why critical:** Prevents accidentally committing worktree contents to repository.
|
|
89
|
-
|
|
90
|
-
#### Create the Worktree
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
# Determine path based on chosen location
|
|
94
|
-
path="$LOCATION/$BRANCH_NAME"
|
|
95
|
-
|
|
96
|
-
git worktree add "$path" -b "$BRANCH_NAME"
|
|
97
|
-
cd "$path"
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**Sandbox fallback:** If `git worktree add` fails with a permission error (sandbox denial), tell the user the sandbox blocked worktree creation and you're working in the current directory instead. Then run setup and baseline tests in place.
|
|
101
|
-
|
|
102
|
-
## Step 2: Project Setup
|
|
103
|
-
|
|
104
|
-
Auto-detect and run appropriate setup:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
# Node.js
|
|
108
|
-
if [ -f package.json ]; then npm install; fi
|
|
109
|
-
|
|
110
|
-
# Rust
|
|
111
|
-
if [ -f Cargo.toml ]; then cargo build; fi
|
|
112
|
-
|
|
113
|
-
# Python
|
|
114
|
-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
115
|
-
if [ -f pyproject.toml ]; then poetry install; fi
|
|
116
|
-
|
|
117
|
-
# Go
|
|
118
|
-
if [ -f go.mod ]; then go mod download; fi
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Step 3: Verify Clean Baseline
|
|
122
|
-
|
|
123
|
-
Run tests to ensure workspace starts clean:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
# Use project-appropriate command
|
|
127
|
-
npm test / cargo test / pytest / go test ./...
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
**If tests fail:** Report failures, ask whether to proceed or investigate.
|
|
131
|
-
|
|
132
|
-
**If tests pass:** Report ready.
|
|
133
|
-
|
|
134
|
-
### Report
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
Worktree ready at <full-path>
|
|
138
|
-
Tests passing (<N> tests, 0 failures)
|
|
139
|
-
Ready to implement <feature-name>
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Quick Reference
|
|
143
|
-
|
|
144
|
-
| Situation | Action |
|
|
145
|
-
|-----------|--------|
|
|
146
|
-
| Already in linked worktree | Skip creation (Step 0) |
|
|
147
|
-
| In a submodule | Treat as normal repo (Step 0 guard) |
|
|
148
|
-
| Native worktree tool available | Use it (Step 1a) |
|
|
149
|
-
| No native tool | Git worktree fallback (Step 1b) |
|
|
150
|
-
| `.worktrees/` exists | Use it (verify ignored) |
|
|
151
|
-
| `worktrees/` exists | Use it (verify ignored) |
|
|
152
|
-
| Both exist | Use `.worktrees/` |
|
|
153
|
-
| Neither exists | Check instruction file, then default `.worktrees/` |
|
|
154
|
-
| Directory not ignored | Add to .gitignore + commit |
|
|
155
|
-
| Permission error on create | Sandbox fallback, work in place |
|
|
156
|
-
| Tests fail during baseline | Report failures + ask |
|
|
157
|
-
| No package.json/Cargo.toml | Skip dependency install |
|
|
158
|
-
|
|
159
|
-
## Common Mistakes
|
|
160
|
-
|
|
161
|
-
### Fighting the harness
|
|
162
|
-
|
|
163
|
-
- **Problem:** Using `git worktree add` when the platform already provides isolation
|
|
164
|
-
- **Fix:** Step 0 detects existing isolation. Step 1a defers to native tools.
|
|
165
|
-
|
|
166
|
-
### Skipping detection
|
|
167
|
-
|
|
168
|
-
- **Problem:** Creating a nested worktree inside an existing one
|
|
169
|
-
- **Fix:** Always run Step 0 before creating anything
|
|
170
|
-
|
|
171
|
-
### Skipping ignore verification
|
|
172
|
-
|
|
173
|
-
- **Problem:** Worktree contents get tracked, pollute git status
|
|
174
|
-
- **Fix:** Always use `git check-ignore` before creating project-local worktree
|
|
175
|
-
|
|
176
|
-
### Assuming directory location
|
|
177
|
-
|
|
178
|
-
- **Problem:** Creates inconsistency, violates project conventions
|
|
179
|
-
- **Fix:** Follow priority: explicit instructions > existing project-local directory > default
|
|
180
|
-
|
|
181
|
-
### Proceeding with failing tests
|
|
182
|
-
|
|
183
|
-
- **Problem:** Can't distinguish new bugs from pre-existing issues
|
|
184
|
-
- **Fix:** Report failures, get explicit permission to proceed
|
|
185
|
-
|
|
186
|
-
## Red Flags
|
|
187
|
-
|
|
188
|
-
**Never:**
|
|
189
|
-
- Create a worktree when Step 0 detects existing isolation
|
|
190
|
-
- Use `git worktree add` when you have a native worktree tool (e.g., `EnterWorktree`). This is the #1 mistake — if you have it, use it.
|
|
191
|
-
- Skip Step 1a by jumping straight to Step 1b's git commands
|
|
192
|
-
- Create worktree without verifying it's ignored (project-local)
|
|
193
|
-
- Skip baseline test verification
|
|
194
|
-
- Proceed with failing tests without asking
|
|
195
|
-
|
|
196
|
-
**Always:**
|
|
197
|
-
- Run Step 0 detection first
|
|
198
|
-
- Prefer native tools over git fallback
|
|
199
|
-
- Follow directory priority: explicit instructions > existing project-local directory > default
|
|
200
|
-
- Verify directory is ignored for project-local
|
|
201
|
-
- Auto-detect and run project setup
|
|
202
|
-
- Verify clean test baseline
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: using-superpowers
|
|
3
|
-
description: Use when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<SUBAGENT-STOP>
|
|
7
|
-
If you were dispatched as a subagent to execute a specific task, ignore this skill.
|
|
8
|
-
</SUBAGENT-STOP>
|
|
9
|
-
|
|
10
|
-
<EXTREMELY-IMPORTANT>
|
|
11
|
-
If you think there is even a 1% chance a skill might apply to what you are doing, you ABSOLUTELY MUST invoke the skill.
|
|
12
|
-
|
|
13
|
-
IF A SKILL APPLIES TO YOUR TASK, YOU DO NOT HAVE A CHOICE. YOU MUST USE IT.
|
|
14
|
-
|
|
15
|
-
This is not negotiable. You cannot rationalize your way out of this.
|
|
16
|
-
</EXTREMELY-IMPORTANT>
|
|
17
|
-
|
|
18
|
-
## The Rule
|
|
19
|
-
|
|
20
|
-
**Invoke relevant or requested skills BEFORE any response or action** — including clarifying questions, exploring the codebase, or checking files. If it turns out wrong for the situation, you don't have to use it.
|
|
21
|
-
|
|
22
|
-
**Before entering plan mode:** if you haven't already brainstormed, invoke the brainstorming skill first.
|
|
23
|
-
|
|
24
|
-
Then announce "Using [skill] to [purpose]" and follow the skill exactly. If it has a checklist, create a todo per item.
|
|
25
|
-
|
|
26
|
-
## Skill Priority
|
|
27
|
-
|
|
28
|
-
When multiple skills apply, process skills come first — they set the approach, then implementation skills (frontend-design, etc.) carry it out. Brainstorming and systematic-debugging are Superpowers' most common process skills, but the rule holds for any of them.
|
|
29
|
-
|
|
30
|
-
- "Let's build X" → superpowers:brainstorming first, then implementation skills.
|
|
31
|
-
- "Fix this bug" → superpowers:systematic-debugging first, then domain skills.
|
|
32
|
-
|
|
33
|
-
## Red Flags
|
|
34
|
-
|
|
35
|
-
These thoughts mean STOP—you're rationalizing:
|
|
36
|
-
|
|
37
|
-
| Thought | Reality |
|
|
38
|
-
|---------|---------|
|
|
39
|
-
| "This is just a simple question" | Questions are tasks. Check for skills. |
|
|
40
|
-
| "I need more context first" | Skill check comes BEFORE clarifying questions. |
|
|
41
|
-
| "Let me explore the codebase first" | Skills tell you HOW to explore. Check first. |
|
|
42
|
-
| "I can check git/files quickly" | Files lack conversation context. Check for skills. |
|
|
43
|
-
| "Let me gather information first" | Skills tell you HOW to gather information. |
|
|
44
|
-
| "This doesn't need a formal skill" | If a skill exists, use it. |
|
|
45
|
-
| "I remember this skill" | Skills evolve. Read current version. |
|
|
46
|
-
| "This doesn't count as a task" | Action = task. Check for skills. |
|
|
47
|
-
| "The skill is overkill" | Simple things become complex. Use it. |
|
|
48
|
-
| "I'll just do this one thing first" | Check BEFORE doing anything. |
|
|
49
|
-
| "This feels productive" | Undisciplined action wastes time. Skills prevent this. |
|
|
50
|
-
| "I know what that means" | Knowing the concept ≠ using the skill. Invoke it. |
|
|
51
|
-
|
|
52
|
-
## Platform Adaptation
|
|
53
|
-
|
|
54
|
-
If your harness appears here, read its reference file for special instructions:
|
|
55
|
-
|
|
56
|
-
- Codex: `references/codex-tools.md`
|
|
57
|
-
- Pi: `references/pi-tools.md`
|
|
58
|
-
- Antigravity: `references/antigravity-tools.md`
|
|
59
|
-
|
|
60
|
-
## User Instructions
|
|
61
|
-
|
|
62
|
-
User instructions (CLAUDE.md, AGENTS.md, GEMINI.md, etc, direct requests) take precedence over skills, which in turn override default behavior. Only skip skill workflows or instructions when your human partner has explicitly told you to.
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Antigravity CLI (`agy`) Tool Mapping
|
|
2
|
-
|
|
3
|
-
Skills speak in actions ("dispatch a subagent", "create a todo", "read a file"). On the Antigravity CLI (`agy`) these resolve to the tools below.
|
|
4
|
-
|
|
5
|
-
| Action skills request | Antigravity CLI equivalent |
|
|
6
|
-
|----------------------|----------------------|
|
|
7
|
-
| Dispatch a subagent (`Subagent (general-purpose):` template) | `invoke_subagent` with a built-in `TypeName` — `self` for full-capability work, `research` for read-only (see [Subagent support](#subagent-support)) |
|
|
8
|
-
| Task tracking ("create a todo", "mark complete") | a **task artifact** — `write_to_file` with `IsArtifact: true` and `ArtifactType: "task"` (see [Task tracking](#task-tracking)). **Not** `manage_task`, which manages background processes. |
|
|
9
|
-
|
|
10
|
-
## Task tracking
|
|
11
|
-
|
|
12
|
-
Antigravity has **no todo tool** (`manage_task` manages background
|
|
13
|
-
processes — `list`/`kill`/`status`/`send_input` — it is *not* a checklist). When a
|
|
14
|
-
skill says to create a todo list or track tasks, maintain a **task artifact**: a
|
|
15
|
-
markdown checklist saved with `write_to_file` (`IsArtifact: true`,
|
|
16
|
-
`ArtifactMetadata.ArtifactType: "task"`), edited with `replace_file_content` /
|
|
17
|
-
`multi_replace_file_content` as you go.
|
|
18
|
-
|
|
19
|
-
At the start of any multi-step task, create the task artifact listing every step of
|
|
20
|
-
your plan. As you complete each step, edit the artifact to mark it done (`- [x]`).
|
|
21
|
-
If the plan changes, update the checklist. Keep it current — it is your source of
|
|
22
|
-
truth for what remains; once the conversation gets long, re-read it before starting
|
|
23
|
-
each step.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
## Subagent dispatch requires multi-agent support
|
|
2
|
-
|
|
3
|
-
Add to your Codex config (`~/.codex/config.toml`):
|
|
4
|
-
|
|
5
|
-
```toml
|
|
6
|
-
[features]
|
|
7
|
-
multi_agent = true
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
This enables `spawn_agent`, `wait_agent`, and `close_agent` for skills like `dispatching-parallel-agents` and `subagent-driven-development`. When using subagent-driven-development, you should always close implementer and reviewer subagents when they have finished all their work.
|
|
11
|
-
|
|
12
|
-
## Environment Detection
|
|
13
|
-
|
|
14
|
-
Skills that create worktrees or finish branches should detect their
|
|
15
|
-
environment with read-only git commands before proceeding:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
|
|
19
|
-
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
|
|
20
|
-
BRANCH=$(git branch --show-current)
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
- `GIT_DIR != GIT_COMMON` → already in a linked worktree (skip creation)
|
|
24
|
-
- `BRANCH` empty → detached HEAD (cannot branch/push/PR from sandbox)
|
|
25
|
-
|
|
26
|
-
See `using-git-worktrees` Step 0 and `finishing-a-development-branch`
|
|
27
|
-
Step 1 for how each skill uses these signals.
|
|
28
|
-
|
|
29
|
-
## Codex App Finishing
|
|
30
|
-
|
|
31
|
-
When the sandbox blocks branch/push operations (detached HEAD in an
|
|
32
|
-
externally managed worktree), the agent commits all work and informs
|
|
33
|
-
the user to use the App's native controls:
|
|
34
|
-
|
|
35
|
-
- **"Create branch"** — names the branch, then commit/push/PR via App UI
|
|
36
|
-
- **"Hand off to local"** — transfers work to the user's local checkout
|
|
37
|
-
|
|
38
|
-
The agent can still run tests, stage files, and output suggested branch
|
|
39
|
-
names, commit messages, and PR descriptions for the user to copy.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Pi Tool Mapping
|
|
2
|
-
|
|
3
|
-
Skills speak in actions ("dispatch a subagent", "create a todo", "read a file"). On Pi these resolve to the tools below.
|
|
4
|
-
|
|
5
|
-
| Action skills request | Pi equivalent |
|
|
6
|
-
| --- | --- |
|
|
7
|
-
| Dispatch a subagent (`Subagent (general-purpose):` template) | Use an installed subagent tool such as `subagent` from `pi-subagents` if available |
|
|
8
|
-
| Task tracking ("create a todo", "mark complete") | Use an installed todo/task tool if available, otherwise track tasks in the plan or `TODO.md` |
|
|
9
|
-
|
|
10
|
-
## Subagents
|
|
11
|
-
|
|
12
|
-
Pi core does not ship a standard subagent tool. The `pi-subagents` package is a strong optional companion and provides a `subagent` tool with single-agent, chain, parallel, async, forked-context, and resume/status workflows. If no subagent tool is available, do not fabricate `Task` calls; execute sequentially in the current session or explain that the optional subagent capability is not installed.
|
|
13
|
-
|
|
14
|
-
## Task lists
|
|
15
|
-
|
|
16
|
-
Pi core does not ship a standard task-list tool. If a todo/task extension is installed, use its documented tool. Otherwise use Superpowers plan files, checklists in Markdown, or a repo-local `TODO.md` for task tracking. Older Superpowers docs may refer to `TodoWrite`; treat that as the task-tracking action above.
|