@claude-pw/framework 0.3.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/LICENSE +21 -0
- package/README.es.md +173 -0
- package/README.ja.md +173 -0
- package/README.md +173 -0
- package/README.pt-br.md +173 -0
- package/README.zh-cn.md +173 -0
- package/RELEASES.md +66 -0
- package/install.js +593 -0
- package/package.json +35 -0
- package/templates/CHANGELOG.md +6 -0
- package/templates/CLAUDE.md.tpl +38 -0
- package/templates/Makefile +37 -0
- package/templates/PLAN.md.tpl +18 -0
- package/templates/STATUS.md.tpl +15 -0
- package/templates/claude/agents/codebase-mapper.md +105 -0
- package/templates/claude/agents/debugger.md +90 -0
- package/templates/claude/agents/decision-impact.md +36 -0
- package/templates/claude/agents/implementer.md +73 -0
- package/templates/claude/agents/interface-reviewer.md +22 -0
- package/templates/claude/agents/learning-extractor.md +104 -0
- package/templates/claude/agents/phase-validator.md +108 -0
- package/templates/claude/agents/plan-checker.md +18 -0
- package/templates/claude/agents/researcher.md +85 -0
- package/templates/claude/agents/session-recovery.md +127 -0
- package/templates/claude/agents/spike-explorer.md +34 -0
- package/templates/claude/commands/cpw-debug.md +116 -0
- package/templates/claude/commands/cpw-discuss.md +70 -0
- package/templates/claude/commands/cpw-health.md +67 -0
- package/templates/claude/commands/cpw-impact.md +22 -0
- package/templates/claude/commands/cpw-next-step.md +492 -0
- package/templates/claude/commands/cpw-pause.md +49 -0
- package/templates/claude/commands/cpw-quick.md +83 -0
- package/templates/claude/commands/cpw-reflect.md +209 -0
- package/templates/claude/commands/cpw-startup.md +321 -0
- package/templates/claude/commands/cpw-todos.md +100 -0
- package/templates/claude/hooks/cpw-context-monitor.js +59 -0
- package/templates/claude/hooks/cpw-statusline.js +36 -0
- package/templates/claude/rules/git.md +27 -0
- package/templates/claude/rules/interfaces.md +9 -0
- package/templates/claude/rules/testing.md +8 -0
- package/templates/claude/settings.json +42 -0
- package/templates/docs/architecture.md +4 -0
- package/templates/docs/codebase-map.md +3 -0
- package/templates/docs/conventions.md +3 -0
- package/templates/docs/interfaces.md +10 -0
- package/templates/docs/tech-debt.md +3 -0
- package/templates/docs/tooling.md +15 -0
- package/templates/gitignore +17 -0
- package/templates/husky/pre-commit +23 -0
- package/templates/planning/config.json +11 -0
- package/templates/planning/learnings/applied.md +3 -0
- package/templates/planning/learnings/queue.md +5 -0
- package/templates/planning/quick/log.md +4 -0
- package/templates/plans/decisions.md +9 -0
- package/templates/plans/phase-0.md +57 -0
- package/templates/plans/phase-1.md +49 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Statusline for claude-pw — writes context metrics to bridge file
|
|
3
|
+
// Receives JSON on stdin from Claude Code statusline system
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
let input = '';
|
|
10
|
+
process.stdin.setEncoding('utf8');
|
|
11
|
+
process.stdin.on('data', (chunk) => { input += chunk; });
|
|
12
|
+
process.stdin.on('end', () => {
|
|
13
|
+
try {
|
|
14
|
+
const data = JSON.parse(input);
|
|
15
|
+
const sessionId = data.session_id || 'unknown';
|
|
16
|
+
const usedPct = Math.floor(data.context_window?.used_percentage || 0);
|
|
17
|
+
const remainingPct = Math.floor(data.context_window?.remaining_percentage || 100);
|
|
18
|
+
const model = data.model?.display_name || 'Claude';
|
|
19
|
+
const cost = data.cost?.total_cost_usd || 0;
|
|
20
|
+
|
|
21
|
+
// Write bridge file for context monitor hook
|
|
22
|
+
const bridge = path.join(os.tmpdir(), `cpw-ctx-${sessionId}.json`);
|
|
23
|
+
fs.writeFileSync(bridge, JSON.stringify({ used_pct: usedPct, remaining_pct: remainingPct, ts: Math.floor(Date.now() / 1000) }));
|
|
24
|
+
|
|
25
|
+
// Display statusline
|
|
26
|
+
if (usedPct >= 80) {
|
|
27
|
+
process.stdout.write(`\x1b[31m${model} │ ctx ${usedPct}% ⚠ CRITICAL\x1b[0m │ $${cost}\n`);
|
|
28
|
+
} else if (usedPct >= 65) {
|
|
29
|
+
process.stdout.write(`\x1b[33m${model} │ ctx ${usedPct}% ⚠ WARNING\x1b[0m │ $${cost}\n`);
|
|
30
|
+
} else {
|
|
31
|
+
process.stdout.write(`${model} │ ctx ${usedPct}% │ $${cost}\n`);
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// Silent fail — never break the statusline
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
globs: [".husky/**", ".git/hooks/**"]
|
|
3
|
+
---
|
|
4
|
+
# Git
|
|
5
|
+
- Conventional Commits: type(scope): description
|
|
6
|
+
- Types: feat, fix, docs, chore, refactor, test, ci
|
|
7
|
+
- NEVER --no-verify
|
|
8
|
+
- ALWAYS make commit / make push
|
|
9
|
+
- One step = one atomic commit
|
|
10
|
+
- Read gitStrategy from .planning/config.json to determine branching behavior
|
|
11
|
+
|
|
12
|
+
## Strategy: trunk-based (default)
|
|
13
|
+
- Commit and push directly to main/master
|
|
14
|
+
- No branches needed
|
|
15
|
+
|
|
16
|
+
## Strategy: feature-branch
|
|
17
|
+
- At phase start: create branch `phase-N/[description]` from main
|
|
18
|
+
- Commit to branch during steps
|
|
19
|
+
- At phase end (after UAT): create PR to main, do NOT push directly to main
|
|
20
|
+
- After PR merged: pull main, start next phase branch from main
|
|
21
|
+
|
|
22
|
+
## Strategy: gitflow
|
|
23
|
+
- Work from develop branch (create if it doesn't exist)
|
|
24
|
+
- At phase start: create branch `feature/phase-N-[description]` from develop
|
|
25
|
+
- Commit to branch during steps
|
|
26
|
+
- At phase end (after UAT): create PR to develop, do NOT push directly to develop
|
|
27
|
+
- Release branches created separately when ready to ship
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
globs: ["src/interfaces/**"]
|
|
3
|
+
---
|
|
4
|
+
# Interfaces
|
|
5
|
+
- Do NOT modify without RFC in plans/decisions.md
|
|
6
|
+
- Change -> update docs/interfaces.md + tests/contracts/
|
|
7
|
+
- Significant change -> /cpw-impact
|
|
8
|
+
- Strict types, no any/unknown without justification
|
|
9
|
+
- Each interface defines error types
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statusLine": {
|
|
3
|
+
"type": "command",
|
|
4
|
+
"command": "node .claude/hooks/cpw-statusline.js"
|
|
5
|
+
},
|
|
6
|
+
"hooks": {
|
|
7
|
+
"UserPromptSubmit": [
|
|
8
|
+
{
|
|
9
|
+
"matcher": "",
|
|
10
|
+
"hooks": [{
|
|
11
|
+
"type": "command",
|
|
12
|
+
"command": "prompt=\"$CLAUDE_USER_PROMPT\"; if [ ${#prompt} -gt 500 ] && ! echo \"$prompt\" | grep -qiE '(recuerda:|remember:)'; then exit 0; fi; if echo \"$prompt\" | grep -qiE '(\\?$|^(please |can you |could you |por favor |puedes |podrias |ayudame ))'; then exit 0; fi; if echo \"$prompt\" | grep -qiE '(^no[, ]|no uses|no hagas|don.t use|actually|en realidad|mejor usa|use .+ not|instead of|en vez de|nunca |always |siempre |recuerda:|remember:)'; then echo \"[CORRECTION DETECTED] Capture this correction in .planning/learnings/queue.md as a new entry with this exact format:\\n---\\n- **Date**: [today]\\n- **Correction**: [exact user correction text]\\n- **Context**: [what you were doing when corrected]\\n- **Command**: [active command from STATUS.md or the current slash command, e.g., cpw-next-step, cpw-debug, cpw-quick, or 'none' if no command is active]\\n- **Pattern**: [explicit if contains remember:/recuerda:, guardrail if contains nunca/always/siempre/never, correction for the rest]\\n- **Confidence**: [0.90 for explicit, 0.80 for guardrail, 0.70 for correction]\\n- **Validated**: no\\n---\"; fi"
|
|
13
|
+
}]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"Stop": [
|
|
17
|
+
{
|
|
18
|
+
"matcher": "",
|
|
19
|
+
"hooks": [{
|
|
20
|
+
"type": "command",
|
|
21
|
+
"command": "queue='.planning/learnings/queue.md'; if [ -f \"$queue\" ] && grep -qE '^- \\*\\*Date\\*\\*:' \"$queue\" 2>/dev/null; then count=$(grep -c '^- \\*\\*Date\\*\\*:' \"$queue\" 2>/dev/null || echo 0); echo \"[AUTO-REFLECT] $count pending learning(s) in queue. Run /cpw-reflect to process them.\"; fi"
|
|
22
|
+
}]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"PostToolUse": [
|
|
26
|
+
{
|
|
27
|
+
"matcher": "",
|
|
28
|
+
"hooks": [{
|
|
29
|
+
"type": "command",
|
|
30
|
+
"command": "node .claude/hooks/cpw-context-monitor.js"
|
|
31
|
+
}]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"matcher": "Write",
|
|
35
|
+
"hooks": [{
|
|
36
|
+
"type": "command",
|
|
37
|
+
"command": "echo 'Update STATUS.md if you changed stage'"
|
|
38
|
+
}]
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Skills and MCP Servers
|
|
2
|
+
|
|
3
|
+
## Installed
|
|
4
|
+
|
|
5
|
+
| Name | Type | Domain | Use in the project | Installed on |
|
|
6
|
+
|------|------|--------|-------------------|-------------|
|
|
7
|
+
|
|
8
|
+
## Evaluated and discarded
|
|
9
|
+
|
|
10
|
+
| Name | Reason |
|
|
11
|
+
|------|--------|
|
|
12
|
+
|
|
13
|
+
## Notes
|
|
14
|
+
- Only install what has clear use in the plan
|
|
15
|
+
- Review each phase if something new is needed
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# claude-pw - session state (always personal)
|
|
2
|
+
STATUS.md
|
|
3
|
+
|
|
4
|
+
# claude-pw - planning (gitignored by default, set commitPlanning: true in .planning/config.json to track)
|
|
5
|
+
.planning/
|
|
6
|
+
|
|
7
|
+
# Claude Code - local config
|
|
8
|
+
.claude/settings.local.json
|
|
9
|
+
|
|
10
|
+
# OS
|
|
11
|
+
.DS_Store
|
|
12
|
+
Thumbs.db
|
|
13
|
+
|
|
14
|
+
# Editors
|
|
15
|
+
*.swp
|
|
16
|
+
*.swo
|
|
17
|
+
*~
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
echo "Pre-commit..."
|
|
5
|
+
|
|
6
|
+
echo " -> Lint..."
|
|
7
|
+
make lint || { echo " x Lint FAILED"; exit 1; }
|
|
8
|
+
|
|
9
|
+
echo " -> Format..."
|
|
10
|
+
make format-check || { echo " x Format FAILED"; exit 1; }
|
|
11
|
+
|
|
12
|
+
echo " -> Types..."
|
|
13
|
+
make typecheck || { echo " x Typecheck FAILED"; exit 1; }
|
|
14
|
+
|
|
15
|
+
echo " -> Tests..."
|
|
16
|
+
make test || { echo " x Tests FAILED"; exit 1; }
|
|
17
|
+
|
|
18
|
+
if [ -d "tests/contracts" ] && [ "$(ls -A tests/contracts 2>/dev/null)" ]; then
|
|
19
|
+
echo " -> Contracts..."
|
|
20
|
+
make test-contracts || { echo " x Contracts FAILED"; exit 1; }
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
echo "Pre-commit OK"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"autoAdvance": "off",
|
|
3
|
+
"granularity": "standard",
|
|
4
|
+
"modelProfile": "balanced",
|
|
5
|
+
"modelOverrides": {},
|
|
6
|
+
"commitPlanning": false,
|
|
7
|
+
"toolingSources": ["skills.sh", "claude-code-templates"],
|
|
8
|
+
"maxConsecutiveFailures": null,
|
|
9
|
+
"gitStrategy": "trunk-based",
|
|
10
|
+
"autoReflect": "remind"
|
|
11
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Phase 0: Stack and Scaffolding
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
Define technologies, structure, toolchain, and environment setup.
|
|
5
|
+
|
|
6
|
+
## Required context
|
|
7
|
+
- PLAN.md
|
|
8
|
+
- Functional requirements
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
### Step 0.1: Stack definition
|
|
13
|
+
- **Input:** Project requirements. If docs/codebase-map.md exists (from /cpw-startup), use it as a base.
|
|
14
|
+
- **Output:** docs/architecture.md
|
|
15
|
+
- **Done criterion:** Document approved
|
|
16
|
+
- **Status:** [ ]
|
|
17
|
+
|
|
18
|
+
### Step 0.2: Repo structure
|
|
19
|
+
- **Requires:** 0.1
|
|
20
|
+
- **Input:** docs/architecture.md
|
|
21
|
+
- **Output:** Directories created
|
|
22
|
+
- **Done criterion:** `tree -L 2` matches
|
|
23
|
+
- **Status:** [ ]
|
|
24
|
+
|
|
25
|
+
### Step 0.3: Skills and MCPs
|
|
26
|
+
- **Requires:** 0.1, 0.2
|
|
27
|
+
- **Input:** docs/architecture.md, defined stack, identified modules
|
|
28
|
+
- **Output:** List of installed skills/MCPs, docs/tooling.md with justification
|
|
29
|
+
- **Done criterion:** Skills/MCPs installed and verified working
|
|
30
|
+
- **Status:** [ ]
|
|
31
|
+
- **Notes:** Evaluate skills and MCP servers that accelerate development based on the project domain. Search by domain (e.g.: admin UI, video processing, DB management), do NOT overload -- only what has clear use in the plan. Document what was installed and why.
|
|
32
|
+
|
|
33
|
+
### Step 0.4: Makefile + toolchain + changelog auto-gen
|
|
34
|
+
- **Requires:** 0.3
|
|
35
|
+
- **Input:** Stack + structure + installed skills
|
|
36
|
+
- **Output:** Makefile, lint/format/test configs, changelog tooling
|
|
37
|
+
- **Done criterion:** `make lint`, `make test`, `make build` OK
|
|
38
|
+
- **Status:** [ ]
|
|
39
|
+
|
|
40
|
+
### Step 0.5: Pre-commit + CI/CD + versioning
|
|
41
|
+
- **Requires:** 0.4
|
|
42
|
+
- **Input:** Configured toolchain
|
|
43
|
+
- **Output:** Pre-commit hook, CI pipeline, semver
|
|
44
|
+
- **Done criterion:** Pre-commit blocks broken commits, CI runs on push
|
|
45
|
+
- **Status:** [ ]
|
|
46
|
+
|
|
47
|
+
### Step 0.6: Setup Claude Code
|
|
48
|
+
- **Requires:** 0.5
|
|
49
|
+
- **Input:** All of the above
|
|
50
|
+
- **Output:** CLAUDE.md, rules, commands, agents adjusted to the actual stack
|
|
51
|
+
- **Done criterion:** /cpw-next-step works
|
|
52
|
+
- **Status:** [ ]
|
|
53
|
+
|
|
54
|
+
## Gate
|
|
55
|
+
- [ ] `make check` passes
|
|
56
|
+
- [ ] Pre-commit blocks broken commits
|
|
57
|
+
- [ ] Claude Code tooling functional
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Phase 1: Interfaces and Modules
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
Define modules, interfaces, and contracts before implementing.
|
|
5
|
+
|
|
6
|
+
## Required context
|
|
7
|
+
- docs/architecture.md
|
|
8
|
+
- PLAN.md
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
### Step 1.1: Module identification
|
|
13
|
+
- **Input:** Requirements + architecture.md
|
|
14
|
+
- **Output:** List in docs/interfaces.md
|
|
15
|
+
- **Done criterion:** Modules with name, responsibility, boundaries
|
|
16
|
+
- **Status:** [ ]
|
|
17
|
+
|
|
18
|
+
### Step 1.2: Public interfaces
|
|
19
|
+
- **Requires:** 1.1
|
|
20
|
+
- **Input:** List of modules
|
|
21
|
+
- **Output:** src/interfaces/ (one per module)
|
|
22
|
+
- **Done criterion:** Compiles, strict types
|
|
23
|
+
- **Status:** [ ]
|
|
24
|
+
|
|
25
|
+
### Step 1.3: Contracts between modules
|
|
26
|
+
- **Requires:** 1.2
|
|
27
|
+
- **Input:** Interfaces
|
|
28
|
+
- **Output:** Diagram in docs/
|
|
29
|
+
- **Done criterion:** No circular deps
|
|
30
|
+
- **Status:** [ ]
|
|
31
|
+
|
|
32
|
+
### Step 1.4: Contract tests
|
|
33
|
+
- **Requires:** 1.3
|
|
34
|
+
- **Input:** Interfaces
|
|
35
|
+
- **Output:** tests/contracts/ with stubs
|
|
36
|
+
- **Done criterion:** `make test-contracts` passes
|
|
37
|
+
- **Status:** [ ]
|
|
38
|
+
|
|
39
|
+
### Step 1.5: Interface lock
|
|
40
|
+
- **Requires:** 1.4
|
|
41
|
+
- **Input:** All
|
|
42
|
+
- **Output:** Interfaces in main, active RFC
|
|
43
|
+
- **Done criterion:** Merged
|
|
44
|
+
- **Status:** [ ]
|
|
45
|
+
|
|
46
|
+
## Gate
|
|
47
|
+
- [ ] Interfaces compile
|
|
48
|
+
- [ ] Contract tests pass
|
|
49
|
+
- [ ] docs/interfaces.md complete
|