opencodekit 0.0.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/README.md +258 -0
- package/dist/index.js +3391 -0
- package/dist/template/.opencode/.env.example +193 -0
- package/dist/template/.opencode/AGENTS.md +214 -0
- package/dist/template/.opencode/README.md +269 -0
- package/dist/template/.opencode/agent/build.md +75 -0
- package/dist/template/.opencode/agent/explore.md +66 -0
- package/dist/template/.opencode/agent/planner.md +83 -0
- package/dist/template/.opencode/agent/review.md +90 -0
- package/dist/template/.opencode/agent/rush.md +85 -0
- package/dist/template/.opencode/agent/scout.md +93 -0
- package/dist/template/.opencode/command/analyze-project.md +39 -0
- package/dist/template/.opencode/command/brainstorm.md +11 -0
- package/dist/template/.opencode/command/commit.md +11 -0
- package/dist/template/.opencode/command/create.md +118 -0
- package/dist/template/.opencode/command/design.md +15 -0
- package/dist/template/.opencode/command/finish.md +233 -0
- package/dist/template/.opencode/command/fix-ci.md +20 -0
- package/dist/template/.opencode/command/fix-types.md +10 -0
- package/dist/template/.opencode/command/fix-ui.md +22 -0
- package/dist/template/.opencode/command/fix.md +22 -0
- package/dist/template/.opencode/command/handoff.md +146 -0
- package/dist/template/.opencode/command/implement.md +167 -0
- package/dist/template/.opencode/command/import-plan.md +188 -0
- package/dist/template/.opencode/command/integration-test.md +36 -0
- package/dist/template/.opencode/command/issue.md +41 -0
- package/dist/template/.opencode/command/plan.md +158 -0
- package/dist/template/.opencode/command/pr.md +36 -0
- package/dist/template/.opencode/command/quick-build.md +13 -0
- package/dist/template/.opencode/command/research-and-implement.md +21 -0
- package/dist/template/.opencode/command/research-ui.md +32 -0
- package/dist/template/.opencode/command/research.md +153 -0
- package/dist/template/.opencode/command/resume.md +127 -0
- package/dist/template/.opencode/command/review-codebase.md +13 -0
- package/dist/template/.opencode/command/skill-create.md +29 -0
- package/dist/template/.opencode/command/skill-optimize.md +28 -0
- package/dist/template/.opencode/command/status.md +109 -0
- package/dist/template/.opencode/command/ui-review.md +28 -0
- package/dist/template/.opencode/dcp.jsonc +34 -0
- package/dist/template/.opencode/memory/README.md +128 -0
- package/dist/template/.opencode/memory/_templates/handoff.md +33 -0
- package/dist/template/.opencode/memory/_templates/research.md +29 -0
- package/dist/template/.opencode/memory/_templates/task-prd.md +43 -0
- package/dist/template/.opencode/memory/_templates/task-review.md +73 -0
- package/dist/template/.opencode/memory/_templates/task-spec.md +71 -0
- package/dist/template/.opencode/memory/design-guidelines.md +281 -0
- package/dist/template/.opencode/memory/handoffs/README.md +83 -0
- package/dist/template/.opencode/opencode.json +469 -0
- package/dist/template/.opencode/package.json +23 -0
- package/dist/template/.opencode/pickle-thinker.jsonc +11 -0
- package/dist/template/.opencode/plugin/README.md +162 -0
- package/dist/template/.opencode/plugin/notification.ts +88 -0
- package/dist/template/.opencode/plugin/sessions.ts +434 -0
- package/dist/template/.opencode/plugin/superpowers.ts +332 -0
- package/dist/template/.opencode/plugin/tsconfig.json +15 -0
- package/dist/template/.opencode/superpowers/.claude/settings.local.json +141 -0
- package/dist/template/.opencode/superpowers/.claude-plugin/marketplace.json +20 -0
- package/dist/template/.opencode/superpowers/.claude-plugin/plugin.json +13 -0
- package/dist/template/.opencode/superpowers/.codex/INSTALL.md +35 -0
- package/dist/template/.opencode/superpowers/.codex/superpowers-bootstrap.md +33 -0
- package/dist/template/.opencode/superpowers/.codex/superpowers-codex +267 -0
- package/dist/template/.opencode/superpowers/.github/FUNDING.yml +3 -0
- package/dist/template/.opencode/superpowers/.opencode/INSTALL.md +135 -0
- package/dist/template/.opencode/superpowers/.opencode/plugin/superpowers.js +215 -0
- package/dist/template/.opencode/superpowers/LICENSE +21 -0
- package/dist/template/.opencode/superpowers/README.md +165 -0
- package/dist/template/.opencode/superpowers/RELEASE-NOTES.md +493 -0
- package/dist/template/.opencode/superpowers/agents/code-reviewer.md +48 -0
- package/dist/template/.opencode/superpowers/commands/brainstorm.md +5 -0
- package/dist/template/.opencode/superpowers/commands/execute-plan.md +5 -0
- package/dist/template/.opencode/superpowers/commands/write-plan.md +5 -0
- package/dist/template/.opencode/superpowers/docs/README.codex.md +153 -0
- package/dist/template/.opencode/superpowers/docs/README.opencode.md +234 -0
- package/dist/template/.opencode/superpowers/docs/plans/2025-11-22-opencode-support-design.md +294 -0
- package/dist/template/.opencode/superpowers/docs/plans/2025-11-22-opencode-support-implementation.md +1095 -0
- package/dist/template/.opencode/superpowers/hooks/hooks.json +15 -0
- package/dist/template/.opencode/superpowers/hooks/session-start.sh +34 -0
- package/dist/template/.opencode/superpowers/lib/skills-core.js +208 -0
- package/dist/template/.opencode/superpowers/skills/brainstorming/SKILL.md +54 -0
- package/dist/template/.opencode/superpowers/skills/condition-based-waiting/SKILL.md +120 -0
- package/dist/template/.opencode/superpowers/skills/condition-based-waiting/example.ts +158 -0
- package/dist/template/.opencode/superpowers/skills/defense-in-depth/SKILL.md +127 -0
- package/dist/template/.opencode/superpowers/skills/dispatching-parallel-agents/SKILL.md +180 -0
- package/dist/template/.opencode/superpowers/skills/executing-plans/SKILL.md +76 -0
- package/dist/template/.opencode/superpowers/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/dist/template/.opencode/superpowers/skills/frontend-aesthetics/SKILL.md +137 -0
- package/dist/template/.opencode/superpowers/skills/gemini-large-context/SKILL.md +205 -0
- package/dist/template/.opencode/superpowers/skills/receiving-code-review/SKILL.md +209 -0
- package/dist/template/.opencode/superpowers/skills/requesting-code-review/SKILL.md +105 -0
- package/dist/template/.opencode/superpowers/skills/requesting-code-review/code-reviewer.md +146 -0
- package/dist/template/.opencode/superpowers/skills/root-cause-tracing/SKILL.md +174 -0
- package/dist/template/.opencode/superpowers/skills/root-cause-tracing/find-polluter.sh +63 -0
- package/dist/template/.opencode/superpowers/skills/sharing-skills/SKILL.md +194 -0
- package/dist/template/.opencode/superpowers/skills/subagent-driven-development/SKILL.md +189 -0
- package/dist/template/.opencode/superpowers/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/dist/template/.opencode/superpowers/skills/systematic-debugging/SKILL.md +295 -0
- package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-academic.md +14 -0
- package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/dist/template/.opencode/superpowers/skills/test-driven-development/SKILL.md +364 -0
- package/dist/template/.opencode/superpowers/skills/testing-anti-patterns/SKILL.md +302 -0
- package/dist/template/.opencode/superpowers/skills/testing-skills-with-subagents/SKILL.md +387 -0
- package/dist/template/.opencode/superpowers/skills/testing-skills-with-subagents/examples/CLAUDE_MD_TESTING.md +189 -0
- package/dist/template/.opencode/superpowers/skills/ui-ux-research/SKILL.md +191 -0
- package/dist/template/.opencode/superpowers/skills/using-git-worktrees/SKILL.md +213 -0
- package/dist/template/.opencode/superpowers/skills/using-superpowers/SKILL.md +101 -0
- package/dist/template/.opencode/superpowers/skills/verification-before-completion/SKILL.md +139 -0
- package/dist/template/.opencode/superpowers/skills/writing-plans/SKILL.md +116 -0
- package/dist/template/.opencode/superpowers/skills/writing-skills/SKILL.md +622 -0
- package/dist/template/.opencode/superpowers/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/dist/template/.opencode/superpowers/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/dist/template/.opencode/superpowers/skills/writing-skills/persuasion-principles.md +187 -0
- package/dist/template/.opencode/superpowers/tests/opencode/run-tests.sh +165 -0
- package/dist/template/.opencode/superpowers/tests/opencode/setup.sh +73 -0
- package/dist/template/.opencode/superpowers/tests/opencode/test-plugin-loading.sh +81 -0
- package/dist/template/.opencode/superpowers/tests/opencode/test-priority.sh +198 -0
- package/dist/template/.opencode/superpowers/tests/opencode/test-skills-core.sh +440 -0
- package/dist/template/.opencode/superpowers/tests/opencode/test-tools.sh +104 -0
- package/dist/template/.opencode/tool/memory-read.ts +66 -0
- package/dist/template/.opencode/tool/memory-update.ts +61 -0
- package/dist/template/.opencode/tsconfig.json +21 -0
- package/package.json +52 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Code Review Agent
|
|
2
|
+
|
|
3
|
+
You are reviewing code changes for production readiness.
|
|
4
|
+
|
|
5
|
+
**Your task:**
|
|
6
|
+
1. Review {WHAT_WAS_IMPLEMENTED}
|
|
7
|
+
2. Compare against {PLAN_OR_REQUIREMENTS}
|
|
8
|
+
3. Check code quality, architecture, testing
|
|
9
|
+
4. Categorize issues by severity
|
|
10
|
+
5. Assess production readiness
|
|
11
|
+
|
|
12
|
+
## What Was Implemented
|
|
13
|
+
|
|
14
|
+
{DESCRIPTION}
|
|
15
|
+
|
|
16
|
+
## Requirements/Plan
|
|
17
|
+
|
|
18
|
+
{PLAN_REFERENCE}
|
|
19
|
+
|
|
20
|
+
## Git Range to Review
|
|
21
|
+
|
|
22
|
+
**Base:** {BASE_SHA}
|
|
23
|
+
**Head:** {HEAD_SHA}
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
git diff --stat {BASE_SHA}..{HEAD_SHA}
|
|
27
|
+
git diff {BASE_SHA}..{HEAD_SHA}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Review Checklist
|
|
31
|
+
|
|
32
|
+
**Code Quality:**
|
|
33
|
+
- Clean separation of concerns?
|
|
34
|
+
- Proper error handling?
|
|
35
|
+
- Type safety (if applicable)?
|
|
36
|
+
- DRY principle followed?
|
|
37
|
+
- Edge cases handled?
|
|
38
|
+
|
|
39
|
+
**Architecture:**
|
|
40
|
+
- Sound design decisions?
|
|
41
|
+
- Scalability considerations?
|
|
42
|
+
- Performance implications?
|
|
43
|
+
- Security concerns?
|
|
44
|
+
|
|
45
|
+
**Testing:**
|
|
46
|
+
- Tests actually test logic (not mocks)?
|
|
47
|
+
- Edge cases covered?
|
|
48
|
+
- Integration tests where needed?
|
|
49
|
+
- All tests passing?
|
|
50
|
+
|
|
51
|
+
**Requirements:**
|
|
52
|
+
- All plan requirements met?
|
|
53
|
+
- Implementation matches spec?
|
|
54
|
+
- No scope creep?
|
|
55
|
+
- Breaking changes documented?
|
|
56
|
+
|
|
57
|
+
**Production Readiness:**
|
|
58
|
+
- Migration strategy (if schema changes)?
|
|
59
|
+
- Backward compatibility considered?
|
|
60
|
+
- Documentation complete?
|
|
61
|
+
- No obvious bugs?
|
|
62
|
+
|
|
63
|
+
## Output Format
|
|
64
|
+
|
|
65
|
+
### Strengths
|
|
66
|
+
[What's well done? Be specific.]
|
|
67
|
+
|
|
68
|
+
### Issues
|
|
69
|
+
|
|
70
|
+
#### Critical (Must Fix)
|
|
71
|
+
[Bugs, security issues, data loss risks, broken functionality]
|
|
72
|
+
|
|
73
|
+
#### Important (Should Fix)
|
|
74
|
+
[Architecture problems, missing features, poor error handling, test gaps]
|
|
75
|
+
|
|
76
|
+
#### Minor (Nice to Have)
|
|
77
|
+
[Code style, optimization opportunities, documentation improvements]
|
|
78
|
+
|
|
79
|
+
**For each issue:**
|
|
80
|
+
- File:line reference
|
|
81
|
+
- What's wrong
|
|
82
|
+
- Why it matters
|
|
83
|
+
- How to fix (if not obvious)
|
|
84
|
+
|
|
85
|
+
### Recommendations
|
|
86
|
+
[Improvements for code quality, architecture, or process]
|
|
87
|
+
|
|
88
|
+
### Assessment
|
|
89
|
+
|
|
90
|
+
**Ready to merge?** [Yes/No/With fixes]
|
|
91
|
+
|
|
92
|
+
**Reasoning:** [Technical assessment in 1-2 sentences]
|
|
93
|
+
|
|
94
|
+
## Critical Rules
|
|
95
|
+
|
|
96
|
+
**DO:**
|
|
97
|
+
- Categorize by actual severity (not everything is Critical)
|
|
98
|
+
- Be specific (file:line, not vague)
|
|
99
|
+
- Explain WHY issues matter
|
|
100
|
+
- Acknowledge strengths
|
|
101
|
+
- Give clear verdict
|
|
102
|
+
|
|
103
|
+
**DON'T:**
|
|
104
|
+
- Say "looks good" without checking
|
|
105
|
+
- Mark nitpicks as Critical
|
|
106
|
+
- Give feedback on code you didn't review
|
|
107
|
+
- Be vague ("improve error handling")
|
|
108
|
+
- Avoid giving a clear verdict
|
|
109
|
+
|
|
110
|
+
## Example Output
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
### Strengths
|
|
114
|
+
- Clean database schema with proper migrations (db.ts:15-42)
|
|
115
|
+
- Comprehensive test coverage (18 tests, all edge cases)
|
|
116
|
+
- Good error handling with fallbacks (summarizer.ts:85-92)
|
|
117
|
+
|
|
118
|
+
### Issues
|
|
119
|
+
|
|
120
|
+
#### Important
|
|
121
|
+
1. **Missing help text in CLI wrapper**
|
|
122
|
+
- File: index-conversations:1-31
|
|
123
|
+
- Issue: No --help flag, users won't discover --concurrency
|
|
124
|
+
- Fix: Add --help case with usage examples
|
|
125
|
+
|
|
126
|
+
2. **Date validation missing**
|
|
127
|
+
- File: search.ts:25-27
|
|
128
|
+
- Issue: Invalid dates silently return no results
|
|
129
|
+
- Fix: Validate ISO format, throw error with example
|
|
130
|
+
|
|
131
|
+
#### Minor
|
|
132
|
+
1. **Progress indicators**
|
|
133
|
+
- File: indexer.ts:130
|
|
134
|
+
- Issue: No "X of Y" counter for long operations
|
|
135
|
+
- Impact: Users don't know how long to wait
|
|
136
|
+
|
|
137
|
+
### Recommendations
|
|
138
|
+
- Add progress reporting for user experience
|
|
139
|
+
- Consider config file for excluded projects (portability)
|
|
140
|
+
|
|
141
|
+
### Assessment
|
|
142
|
+
|
|
143
|
+
**Ready to merge: With fixes**
|
|
144
|
+
|
|
145
|
+
**Reasoning:** Core implementation is solid with good architecture and tests. Important issues (help text, date validation) are easily fixed and don't affect core functionality.
|
|
146
|
+
```
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: root-cause-tracing
|
|
3
|
+
description: Use when errors occur deep in execution and you need to trace back to find the original trigger - systematically traces bugs backward through call stack, adding instrumentation when needed, to identify source of invalid data or incorrect behavior
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Root Cause Tracing
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
|
|
11
|
+
|
|
12
|
+
**Core principle:** Trace backward through the call chain until you find the original trigger, then fix at the source.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
```dot
|
|
17
|
+
digraph when_to_use {
|
|
18
|
+
"Bug appears deep in stack?" [shape=diamond];
|
|
19
|
+
"Can trace backwards?" [shape=diamond];
|
|
20
|
+
"Fix at symptom point" [shape=box];
|
|
21
|
+
"Trace to original trigger" [shape=box];
|
|
22
|
+
"BETTER: Also add defense-in-depth" [shape=box];
|
|
23
|
+
|
|
24
|
+
"Bug appears deep in stack?" -> "Can trace backwards?" [label="yes"];
|
|
25
|
+
"Can trace backwards?" -> "Trace to original trigger" [label="yes"];
|
|
26
|
+
"Can trace backwards?" -> "Fix at symptom point" [label="no - dead end"];
|
|
27
|
+
"Trace to original trigger" -> "BETTER: Also add defense-in-depth";
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Use when:**
|
|
32
|
+
- Error happens deep in execution (not at entry point)
|
|
33
|
+
- Stack trace shows long call chain
|
|
34
|
+
- Unclear where invalid data originated
|
|
35
|
+
- Need to find which test/code triggers the problem
|
|
36
|
+
|
|
37
|
+
## The Tracing Process
|
|
38
|
+
|
|
39
|
+
### 1. Observe the Symptom
|
|
40
|
+
```
|
|
41
|
+
Error: git init failed in /Users/jesse/project/packages/core
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. Find Immediate Cause
|
|
45
|
+
**What code directly causes this?**
|
|
46
|
+
```typescript
|
|
47
|
+
await execFileAsync('git', ['init'], { cwd: projectDir });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Ask: What Called This?
|
|
51
|
+
```typescript
|
|
52
|
+
WorktreeManager.createSessionWorktree(projectDir, sessionId)
|
|
53
|
+
→ called by Session.initializeWorkspace()
|
|
54
|
+
→ called by Session.create()
|
|
55
|
+
→ called by test at Project.create()
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 4. Keep Tracing Up
|
|
59
|
+
**What value was passed?**
|
|
60
|
+
- `projectDir = ''` (empty string!)
|
|
61
|
+
- Empty string as `cwd` resolves to `process.cwd()`
|
|
62
|
+
- That's the source code directory!
|
|
63
|
+
|
|
64
|
+
### 5. Find Original Trigger
|
|
65
|
+
**Where did empty string come from?**
|
|
66
|
+
```typescript
|
|
67
|
+
const context = setupCoreTest(); // Returns { tempDir: '' }
|
|
68
|
+
Project.create('name', context.tempDir); // Accessed before beforeEach!
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Adding Stack Traces
|
|
72
|
+
|
|
73
|
+
When you can't trace manually, add instrumentation:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
// Before the problematic operation
|
|
77
|
+
async function gitInit(directory: string) {
|
|
78
|
+
const stack = new Error().stack;
|
|
79
|
+
console.error('DEBUG git init:', {
|
|
80
|
+
directory,
|
|
81
|
+
cwd: process.cwd(),
|
|
82
|
+
nodeEnv: process.env.NODE_ENV,
|
|
83
|
+
stack,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
await execFileAsync('git', ['init'], { cwd: directory });
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Critical:** Use `console.error()` in tests (not logger - may not show)
|
|
91
|
+
|
|
92
|
+
**Run and capture:**
|
|
93
|
+
```bash
|
|
94
|
+
npm test 2>&1 | grep 'DEBUG git init'
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Analyze stack traces:**
|
|
98
|
+
- Look for test file names
|
|
99
|
+
- Find the line number triggering the call
|
|
100
|
+
- Identify the pattern (same test? same parameter?)
|
|
101
|
+
|
|
102
|
+
## Finding Which Test Causes Pollution
|
|
103
|
+
|
|
104
|
+
If something appears during tests but you don't know which test:
|
|
105
|
+
|
|
106
|
+
Use the bisection script: @find-polluter.sh
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
./find-polluter.sh '.git' 'src/**/*.test.ts'
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Runs tests one-by-one, stops at first polluter. See script for usage.
|
|
113
|
+
|
|
114
|
+
## Real Example: Empty projectDir
|
|
115
|
+
|
|
116
|
+
**Symptom:** `.git` created in `packages/core/` (source code)
|
|
117
|
+
|
|
118
|
+
**Trace chain:**
|
|
119
|
+
1. `git init` runs in `process.cwd()` ← empty cwd parameter
|
|
120
|
+
2. WorktreeManager called with empty projectDir
|
|
121
|
+
3. Session.create() passed empty string
|
|
122
|
+
4. Test accessed `context.tempDir` before beforeEach
|
|
123
|
+
5. setupCoreTest() returns `{ tempDir: '' }` initially
|
|
124
|
+
|
|
125
|
+
**Root cause:** Top-level variable initialization accessing empty value
|
|
126
|
+
|
|
127
|
+
**Fix:** Made tempDir a getter that throws if accessed before beforeEach
|
|
128
|
+
|
|
129
|
+
**Also added defense-in-depth:**
|
|
130
|
+
- Layer 1: Project.create() validates directory
|
|
131
|
+
- Layer 2: WorkspaceManager validates not empty
|
|
132
|
+
- Layer 3: NODE_ENV guard refuses git init outside tmpdir
|
|
133
|
+
- Layer 4: Stack trace logging before git init
|
|
134
|
+
|
|
135
|
+
## Key Principle
|
|
136
|
+
|
|
137
|
+
```dot
|
|
138
|
+
digraph principle {
|
|
139
|
+
"Found immediate cause" [shape=ellipse];
|
|
140
|
+
"Can trace one level up?" [shape=diamond];
|
|
141
|
+
"Trace backwards" [shape=box];
|
|
142
|
+
"Is this the source?" [shape=diamond];
|
|
143
|
+
"Fix at source" [shape=box];
|
|
144
|
+
"Add validation at each layer" [shape=box];
|
|
145
|
+
"Bug impossible" [shape=doublecircle];
|
|
146
|
+
"NEVER fix just the symptom" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
|
|
147
|
+
|
|
148
|
+
"Found immediate cause" -> "Can trace one level up?";
|
|
149
|
+
"Can trace one level up?" -> "Trace backwards" [label="yes"];
|
|
150
|
+
"Can trace one level up?" -> "NEVER fix just the symptom" [label="no"];
|
|
151
|
+
"Trace backwards" -> "Is this the source?";
|
|
152
|
+
"Is this the source?" -> "Trace backwards" [label="no - keeps going"];
|
|
153
|
+
"Is this the source?" -> "Fix at source" [label="yes"];
|
|
154
|
+
"Fix at source" -> "Add validation at each layer";
|
|
155
|
+
"Add validation at each layer" -> "Bug impossible";
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**NEVER fix just where the error appears.** Trace back to find the original trigger.
|
|
160
|
+
|
|
161
|
+
## Stack Trace Tips
|
|
162
|
+
|
|
163
|
+
**In tests:** Use `console.error()` not logger - logger may be suppressed
|
|
164
|
+
**Before operation:** Log before the dangerous operation, not after it fails
|
|
165
|
+
**Include context:** Directory, cwd, environment variables, timestamps
|
|
166
|
+
**Capture stack:** `new Error().stack` shows complete call chain
|
|
167
|
+
|
|
168
|
+
## Real-World Impact
|
|
169
|
+
|
|
170
|
+
From debugging session (2025-10-03):
|
|
171
|
+
- Found root cause through 5-level trace
|
|
172
|
+
- Fixed at source (getter validation)
|
|
173
|
+
- Added 4 layers of defense
|
|
174
|
+
- 1847 tests passed, zero pollution
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Bisection script to find which test creates unwanted files/state
|
|
3
|
+
# Usage: ./find-polluter.sh <file_or_dir_to_check> <test_pattern>
|
|
4
|
+
# Example: ./find-polluter.sh '.git' 'src/**/*.test.ts'
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
if [ $# -ne 2 ]; then
|
|
9
|
+
echo "Usage: $0 <file_to_check> <test_pattern>"
|
|
10
|
+
echo "Example: $0 '.git' 'src/**/*.test.ts'"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
POLLUTION_CHECK="$1"
|
|
15
|
+
TEST_PATTERN="$2"
|
|
16
|
+
|
|
17
|
+
echo "🔍 Searching for test that creates: $POLLUTION_CHECK"
|
|
18
|
+
echo "Test pattern: $TEST_PATTERN"
|
|
19
|
+
echo ""
|
|
20
|
+
|
|
21
|
+
# Get list of test files
|
|
22
|
+
TEST_FILES=$(find . -path "$TEST_PATTERN" | sort)
|
|
23
|
+
TOTAL=$(echo "$TEST_FILES" | wc -l | tr -d ' ')
|
|
24
|
+
|
|
25
|
+
echo "Found $TOTAL test files"
|
|
26
|
+
echo ""
|
|
27
|
+
|
|
28
|
+
COUNT=0
|
|
29
|
+
for TEST_FILE in $TEST_FILES; do
|
|
30
|
+
COUNT=$((COUNT + 1))
|
|
31
|
+
|
|
32
|
+
# Skip if pollution already exists
|
|
33
|
+
if [ -e "$POLLUTION_CHECK" ]; then
|
|
34
|
+
echo "⚠️ Pollution already exists before test $COUNT/$TOTAL"
|
|
35
|
+
echo " Skipping: $TEST_FILE"
|
|
36
|
+
continue
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo "[$COUNT/$TOTAL] Testing: $TEST_FILE"
|
|
40
|
+
|
|
41
|
+
# Run the test
|
|
42
|
+
npm test "$TEST_FILE" > /dev/null 2>&1 || true
|
|
43
|
+
|
|
44
|
+
# Check if pollution appeared
|
|
45
|
+
if [ -e "$POLLUTION_CHECK" ]; then
|
|
46
|
+
echo ""
|
|
47
|
+
echo "🎯 FOUND POLLUTER!"
|
|
48
|
+
echo " Test: $TEST_FILE"
|
|
49
|
+
echo " Created: $POLLUTION_CHECK"
|
|
50
|
+
echo ""
|
|
51
|
+
echo "Pollution details:"
|
|
52
|
+
ls -la "$POLLUTION_CHECK"
|
|
53
|
+
echo ""
|
|
54
|
+
echo "To investigate:"
|
|
55
|
+
echo " npm test $TEST_FILE # Run just this test"
|
|
56
|
+
echo " cat $TEST_FILE # Review test code"
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
done
|
|
60
|
+
|
|
61
|
+
echo ""
|
|
62
|
+
echo "✅ No polluter found - all tests clean!"
|
|
63
|
+
exit 0
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sharing-skills
|
|
3
|
+
description: Use when you've developed a broadly useful skill and want to contribute it upstream via pull request - guides process of branching, committing, pushing, and creating PR to contribute skills back to upstream repository
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sharing Skills
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Contribute skills from your local branch back to the upstream repository.
|
|
11
|
+
|
|
12
|
+
**Workflow:** Branch → Edit/Create skill → Commit → Push → PR
|
|
13
|
+
|
|
14
|
+
## When to Share
|
|
15
|
+
|
|
16
|
+
**Share when:**
|
|
17
|
+
- Skill applies broadly (not project-specific)
|
|
18
|
+
- Pattern/technique others would benefit from
|
|
19
|
+
- Well-tested and documented
|
|
20
|
+
- Follows writing-skills guidelines
|
|
21
|
+
|
|
22
|
+
**Keep personal when:**
|
|
23
|
+
- Project-specific or organization-specific
|
|
24
|
+
- Experimental or unstable
|
|
25
|
+
- Contains sensitive information
|
|
26
|
+
- Too narrow/niche for general use
|
|
27
|
+
|
|
28
|
+
## Prerequisites
|
|
29
|
+
|
|
30
|
+
- `gh` CLI installed and authenticated
|
|
31
|
+
- Working directory is `~/.config/superpowers/skills/` (your local clone)
|
|
32
|
+
- **REQUIRED:** Skill has been tested using writing-skills TDD process
|
|
33
|
+
|
|
34
|
+
## Sharing Workflow
|
|
35
|
+
|
|
36
|
+
### 1. Ensure You're on Main and Synced
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cd ~/.config/superpowers/skills/
|
|
40
|
+
git checkout main
|
|
41
|
+
git pull upstream main
|
|
42
|
+
git push origin main # Push to your fork
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Create Feature Branch
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Branch name: add-skillname-skill
|
|
49
|
+
skill_name="your-skill-name"
|
|
50
|
+
git checkout -b "add-${skill_name}-skill"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Create or Edit Skill
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Work on your skill in skills/
|
|
57
|
+
# Create new skill or edit existing one
|
|
58
|
+
# Skill should be in skills/category/skill-name/SKILL.md
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 4. Commit Changes
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Add and commit
|
|
65
|
+
git add skills/your-skill-name/
|
|
66
|
+
git commit -m "Add ${skill_name} skill
|
|
67
|
+
|
|
68
|
+
$(cat <<'EOF'
|
|
69
|
+
Brief description of what this skill does and why it's useful.
|
|
70
|
+
|
|
71
|
+
Tested with: [describe testing approach]
|
|
72
|
+
EOF
|
|
73
|
+
)"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 5. Push to Your Fork
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
git push -u origin "add-${skill_name}-skill"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 6. Create Pull Request
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Create PR to upstream using gh CLI
|
|
86
|
+
gh pr create \
|
|
87
|
+
--repo upstream-org/upstream-repo \
|
|
88
|
+
--title "Add ${skill_name} skill" \
|
|
89
|
+
--body "$(cat <<'EOF'
|
|
90
|
+
## Summary
|
|
91
|
+
Brief description of the skill and what problem it solves.
|
|
92
|
+
|
|
93
|
+
## Testing
|
|
94
|
+
Describe how you tested this skill (pressure scenarios, baseline tests, etc.).
|
|
95
|
+
|
|
96
|
+
## Context
|
|
97
|
+
Any additional context about why this skill is needed and how it should be used.
|
|
98
|
+
EOF
|
|
99
|
+
)"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Complete Example
|
|
103
|
+
|
|
104
|
+
Here's a complete example of sharing a skill called "async-patterns":
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# 1. Sync with upstream
|
|
108
|
+
cd ~/.config/superpowers/skills/
|
|
109
|
+
git checkout main
|
|
110
|
+
git pull upstream main
|
|
111
|
+
git push origin main
|
|
112
|
+
|
|
113
|
+
# 2. Create branch
|
|
114
|
+
git checkout -b "add-async-patterns-skill"
|
|
115
|
+
|
|
116
|
+
# 3. Create/edit the skill
|
|
117
|
+
# (Work on skills/async-patterns/SKILL.md)
|
|
118
|
+
|
|
119
|
+
# 4. Commit
|
|
120
|
+
git add skills/async-patterns/
|
|
121
|
+
git commit -m "Add async-patterns skill
|
|
122
|
+
|
|
123
|
+
Patterns for handling asynchronous operations in tests and application code.
|
|
124
|
+
|
|
125
|
+
Tested with: Multiple pressure scenarios testing agent compliance."
|
|
126
|
+
|
|
127
|
+
# 5. Push
|
|
128
|
+
git push -u origin "add-async-patterns-skill"
|
|
129
|
+
|
|
130
|
+
# 6. Create PR
|
|
131
|
+
gh pr create \
|
|
132
|
+
--repo upstream-org/upstream-repo \
|
|
133
|
+
--title "Add async-patterns skill" \
|
|
134
|
+
--body "## Summary
|
|
135
|
+
Patterns for handling asynchronous operations correctly in tests and application code.
|
|
136
|
+
|
|
137
|
+
## Testing
|
|
138
|
+
Tested with multiple application scenarios. Agents successfully apply patterns to new code.
|
|
139
|
+
|
|
140
|
+
## Context
|
|
141
|
+
Addresses common async pitfalls like race conditions, improper error handling, and timing issues."
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## After PR is Merged
|
|
145
|
+
|
|
146
|
+
Once your PR is merged:
|
|
147
|
+
|
|
148
|
+
1. Sync your local main branch:
|
|
149
|
+
```bash
|
|
150
|
+
cd ~/.config/superpowers/skills/
|
|
151
|
+
git checkout main
|
|
152
|
+
git pull upstream main
|
|
153
|
+
git push origin main
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
2. Delete the feature branch:
|
|
157
|
+
```bash
|
|
158
|
+
git branch -d "add-${skill_name}-skill"
|
|
159
|
+
git push origin --delete "add-${skill_name}-skill"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Troubleshooting
|
|
163
|
+
|
|
164
|
+
**"gh: command not found"**
|
|
165
|
+
- Install GitHub CLI: https://cli.github.com/
|
|
166
|
+
- Authenticate: `gh auth login`
|
|
167
|
+
|
|
168
|
+
**"Permission denied (publickey)"**
|
|
169
|
+
- Check SSH keys: `gh auth status`
|
|
170
|
+
- Set up SSH: https://docs.github.com/en/authentication
|
|
171
|
+
|
|
172
|
+
**"Skill already exists"**
|
|
173
|
+
- You're creating a modified version
|
|
174
|
+
- Consider different skill name or coordinate with the skill's maintainer
|
|
175
|
+
|
|
176
|
+
**PR merge conflicts**
|
|
177
|
+
- Rebase on latest upstream: `git fetch upstream && git rebase upstream/main`
|
|
178
|
+
- Resolve conflicts
|
|
179
|
+
- Force push: `git push -f origin your-branch`
|
|
180
|
+
|
|
181
|
+
## Multi-Skill Contributions
|
|
182
|
+
|
|
183
|
+
**Do NOT batch multiple skills in one PR.**
|
|
184
|
+
|
|
185
|
+
Each skill should:
|
|
186
|
+
- Have its own feature branch
|
|
187
|
+
- Have its own PR
|
|
188
|
+
- Be independently reviewable
|
|
189
|
+
|
|
190
|
+
**Why?** Individual skills can be reviewed, iterated, and merged independently.
|
|
191
|
+
|
|
192
|
+
## Related Skills
|
|
193
|
+
|
|
194
|
+
- **writing-skills** - REQUIRED: How to create well-tested skills before sharing
|