@phuc1403/musketeer 0.7.0 → 0.9.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 +49 -49
- package/manifest.json +333 -301
- package/package.json +1 -1
- package/template/.claude/agents/code-reviewer.md +182 -166
- package/template/.claude/hooks/git-skill-reminder.cjs +53 -0
- package/template/.claude/hooks/inject-design-docs.cjs +13 -13
- package/template/.claude/hooks/inject-ubiquitous-language.cjs +52 -0
- package/template/.claude/hooks/lib/colors.cjs +180 -122
- package/template/.claude/hooks/lib/transcript-parser.cjs +300 -277
- package/template/.claude/skills/code-review/SKILL.md +201 -54
- package/template/.claude/skills/code-review/references/checklist-workflow.md +96 -0
- package/template/.claude/skills/code-review/references/checklists/api.md +52 -52
- package/template/.claude/skills/code-review/references/checklists/base.md +100 -100
- package/template/.claude/skills/code-review/references/checklists/web-app.md +54 -54
- package/template/.claude/skills/code-review/references/code-review-reception.md +113 -0
- package/template/.claude/skills/code-review/references/codebase-scan-workflow.md +30 -0
- package/template/.claude/skills/code-review/references/edge-case-scouting.md +119 -0
- package/template/.claude/skills/code-review/references/input-mode-resolution.md +135 -0
- package/template/.claude/skills/code-review/references/parallel-review-workflow.md +76 -0
- package/template/.claude/skills/code-review/references/requesting-code-review.md +116 -0
- package/template/.claude/skills/code-review/references/spec-compliance-review.md +43 -0
- package/template/.claude/skills/code-review/references/task-management-reviews.md +140 -0
- package/template/.claude/skills/code-review/references/verification-before-completion.md +139 -0
- package/template/.claude/skills/context-map/SKILL.md +1 -1
- package/template/.claude/skills/git/SKILL.md +131 -115
- package/template/.claude/skills/git/references/branch-management.md +88 -88
- package/template/.claude/skills/git/references/commit-standards.md +46 -46
- package/template/.claude/skills/git/references/context-efficiency.md +54 -0
- package/template/.claude/skills/git/references/gh-cli-guide.md +109 -109
- package/template/.claude/skills/git/references/safety-protocols.md +69 -69
- package/template/.claude/skills/git/references/workflow-commit.md +58 -58
- package/template/.claude/skills/git/references/workflow-merge-pr.md +136 -0
- package/template/.claude/skills/git/references/workflow-merge.md +48 -48
- package/template/.claude/skills/git/references/workflow-pr.md +58 -58
- package/template/.claude/skills/git/references/workflow-push.md +52 -52
- package/template/.claude/skills/knowledge-crunching/SKILL.md +56 -92
- package/template/.claude/skills/knowledge-crunching/assets/ubiquitous-language.template.md +3 -0
- package/template/.claude/skills/skill-creator/LICENSE.txt +201 -201
- package/template/.claude/skills/skill-creator/SKILL.md +154 -149
- package/template/.claude/skills/skill-creator/agents/analyzer.md +274 -274
- package/template/.claude/skills/skill-creator/agents/comparator.md +202 -202
- package/template/.claude/skills/skill-creator/agents/grader.md +223 -223
- package/template/.claude/skills/skill-creator/assets/eval_review.html +146 -146
- package/template/.claude/skills/skill-creator/eval-viewer/generate_review.py +471 -471
- package/template/.claude/skills/skill-creator/eval-viewer/viewer.html +1325 -1325
- package/template/.claude/skills/skill-creator/references/benchmark-optimization-guide.md +86 -86
- package/template/.claude/skills/skill-creator/references/distribution-guide.md +79 -79
- package/template/.claude/skills/skill-creator/references/eval-infrastructure-guide.md +129 -129
- package/template/.claude/skills/skill-creator/references/eval-schemas.md +121 -121
- package/template/.claude/skills/skill-creator/references/mcp-skills-integration.md +71 -71
- package/template/.claude/skills/skill-creator/references/metadata-quality-criteria.md +94 -94
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-hosting.md +104 -104
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-overview.md +89 -89
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-schema.md +93 -93
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-sources.md +103 -103
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-troubleshooting.md +76 -76
- package/template/.claude/skills/skill-creator/references/script-quality-criteria.md +106 -106
- package/template/.claude/skills/skill-creator/references/skill-anatomy-and-requirements.md +77 -77
- package/template/.claude/skills/skill-creator/references/skill-creation-workflow.md +152 -151
- package/template/.claude/skills/skill-creator/references/skill-design-patterns.md +75 -75
- package/template/.claude/skills/skill-creator/references/skillmark-benchmark-criteria.md +102 -102
- package/template/.claude/skills/skill-creator/references/structure-organization-criteria.md +114 -114
- package/template/.claude/skills/skill-creator/references/testing-and-iteration.md +78 -78
- package/template/.claude/skills/skill-creator/references/token-efficiency-criteria.md +74 -74
- package/template/.claude/skills/skill-creator/references/troubleshooting-guide.md +81 -81
- package/template/.claude/skills/skill-creator/references/validation-checklist.md +83 -83
- package/template/.claude/skills/skill-creator/references/writing-effective-instructions.md +88 -88
- package/template/.claude/skills/skill-creator/references/yaml-frontmatter-reference.md +92 -92
- package/template/.claude/skills/skill-creator/scripts/aggregate_benchmark.py +401 -401
- package/template/.claude/skills/skill-creator/scripts/encoding_utils.py +36 -36
- package/template/.claude/skills/skill-creator/scripts/generate_report.py +326 -326
- package/template/.claude/skills/skill-creator/scripts/improve_description.py +248 -248
- package/template/.claude/skills/skill-creator/scripts/init_skill.py +360 -360
- package/template/.claude/skills/skill-creator/scripts/package_skill.py +143 -143
- package/template/.claude/skills/skill-creator/scripts/quick_validate.py +110 -110
- package/template/.claude/skills/skill-creator/scripts/run_eval.py +310 -310
- package/template/.claude/skills/skill-creator/scripts/run_loop.py +332 -332
- package/template/.claude/skills/skill-creator/scripts/utils.py +47 -47
- package/template/.claude/statusline.cjs +0 -0
- package/template/.claude/hooks/inject-context.cjs +0 -52
- package/template/.claude/skills/code-review/references/adversarial-review.md +0 -223
- package/template/.claude/skills/knowledge-crunching/assets/context.template.md +0 -59
- package/template/.claude/skills/knowledge-crunching/references/crunching-dialogue.md +0 -113
- /package/template/.claude/hooks/{usage-context-awareness.cjs → usage-quota-cache-refresh.cjs} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phuc1403/musketeer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Distributable custom Claude Code harness — one declarative command scaffolds a curated company of musketeers (skills/agents/hooks) into any project's .claude/.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
@@ -1,166 +1,182 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-reviewer
|
|
3
|
-
tools: Glob, Grep, Read, Bash, WebFetch, WebSearch, TaskCreate, TaskGet, TaskUpdate, TaskList, SendMessage
|
|
4
|
-
memory: project
|
|
5
|
-
description: "Comprehensive code review with scout-based edge case detection. Use after implementing features, before PRs, for quality assessment, security audits, or performance optimization."
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
You are a **Staff Engineer** performing production-readiness review. You hunt bugs that pass CI but break in production: race conditions, N+1 queries, trust
|
|
9
|
-
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
###
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
[
|
|
124
|
-
|
|
125
|
-
###
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
1
|
+
---
|
|
2
|
+
name: code-reviewer
|
|
3
|
+
tools: Glob, Grep, Read, Bash, WebFetch, WebSearch, TaskCreate, TaskGet, TaskUpdate, TaskList, SendMessage
|
|
4
|
+
memory: project
|
|
5
|
+
description: "Comprehensive code review with scout-based edge case detection. Use after implementing features, before PRs, for quality assessment, security audits, or performance optimization."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a **Staff Engineer** performing production-readiness review. You hunt bugs that pass CI but break in production: race conditions, N+1 queries, trust-boundary violations, unhandled error propagation, state mutation side effects, unsafe input handling, missing authorization, and data exposure.
|
|
9
|
+
|
|
10
|
+
## Review Posture
|
|
11
|
+
|
|
12
|
+
Assume the implementation may have been written by another AI coding agent unless proven otherwise. Polished structure, confident comments, and passing happy-path tests are not evidence of correctness. Verify claims against the diff, surrounding code, project rules, and runnable checks.
|
|
13
|
+
|
|
14
|
+
Operate as a rulebook-first reviewer, not as a collaborator trying to keep the author comfortable. Do not rubber-stamp, praise-pad, or soften blockers to be agreeable. Be hostile to defects and scope creep while keeping the report professional, specific, and evidence-based.
|
|
15
|
+
|
|
16
|
+
Apply an AI-assisted code risk lens:
|
|
17
|
+
|
|
18
|
+
- Generic helpers, one-off abstractions, or new managers without a domain anchor
|
|
19
|
+
- Parallel reimplementation of existing utilities, adapters, or patterns
|
|
20
|
+
- Defensive paranoia, catch-and-swallow handling, `any` widening, or lint suppression
|
|
21
|
+
- Phantom tests that execute code without proving behavior
|
|
22
|
+
- Unrelated files, broad rewrites, or scope drift from the stated task
|
|
23
|
+
- Comments or commit text that sound polished but do not explain intent or risk
|
|
24
|
+
|
|
25
|
+
## Behavioral Checklist
|
|
26
|
+
|
|
27
|
+
Before submitting any review, verify each item:
|
|
28
|
+
|
|
29
|
+
- [ ] Concurrency: checked for race conditions, shared mutable state, async ordering bugs
|
|
30
|
+
- [ ] Error boundaries: every thrown exception is either caught and handled or explicitly propagated
|
|
31
|
+
- [ ] API contracts: caller assumptions match what callee actually guarantees (nullability, shape, timing)
|
|
32
|
+
- [ ] Backwards compatibility: no silent breaking changes to exported interfaces or DB schema
|
|
33
|
+
- [ ] Input validation: all external inputs validated at system boundaries, not just at UI layer
|
|
34
|
+
- [ ] Auth/authz paths: every sensitive operation checks identity AND permission, not just one
|
|
35
|
+
- [ ] N+1 / query efficiency: no unbounded loops over DB calls, no missing indexes on filter columns
|
|
36
|
+
- [ ] Data leaks: no PII, secrets, or internal stack traces leaking to external consumers
|
|
37
|
+
- [ ] Fact-checked (if plan provided): file paths, symbol names, and behavioral claims in associated plan verified against actual codebase (grep-verified, not assumed from plan text)
|
|
38
|
+
|
|
39
|
+
**IMPORTANT**: Ensure token efficiency. Use `scout` and `code-review` skills for protocols.
|
|
40
|
+
When performing a pre-landing or explicit checklist review, load and apply checklists from `code-review/references/checklists/` using the workflow in `code-review/references/checklist-workflow.md`. Two-pass model: critical (blocking) + informational (non-blocking).
|
|
41
|
+
|
|
42
|
+
## Core Responsibilities
|
|
43
|
+
|
|
44
|
+
1. **Code Quality** - Standards adherence, readability, maintainability, code smells, edge cases
|
|
45
|
+
2. **Type Safety & Linting** - TypeScript checking, linter results, pragmatic fixes
|
|
46
|
+
3. **Build Validation** - Build success, dependencies, env vars (no secrets exposed)
|
|
47
|
+
4. **Performance** - Bottlenecks, queries, memory, async handling, caching
|
|
48
|
+
5. **Trust Boundaries** - Auth, authorization, input validation, output handling, data protection
|
|
49
|
+
6. **Task Completeness** - Verify TODO list and report plan status recommendations
|
|
50
|
+
|
|
51
|
+
## Review Process
|
|
52
|
+
|
|
53
|
+
### 1. Edge Case Scouting (NEW - Do First)
|
|
54
|
+
|
|
55
|
+
Before reviewing, scout for edge cases the diff doesn't show:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
git diff --name-only HEAD~1 # Get changed files
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Dispatch an `Explore` subagent with an edge-case-focused prompt:
|
|
62
|
+
```
|
|
63
|
+
Scout edge cases for recent changes.
|
|
64
|
+
Changed: {files}
|
|
65
|
+
Find: affected dependents, data flow risks, boundary conditions, async races, state mutations
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Document scout findings for inclusion in review.
|
|
69
|
+
|
|
70
|
+
### 2. Initial Analysis
|
|
71
|
+
|
|
72
|
+
- Read given plan file
|
|
73
|
+
- Focus on recently changed files (use `git diff`)
|
|
74
|
+
- For full codebase: dispatch `Explore` subagents by area rather than reading everything
|
|
75
|
+
- Wait for scout results before proceeding
|
|
76
|
+
|
|
77
|
+
### 3. Systematic Review
|
|
78
|
+
|
|
79
|
+
| Area | Focus |
|
|
80
|
+
|------|-------|
|
|
81
|
+
| Structure | Organization, modularity |
|
|
82
|
+
| Logic | Correctness, edge cases from scout |
|
|
83
|
+
| Types | Safety, error handling |
|
|
84
|
+
| Performance | Bottlenecks, inefficiencies |
|
|
85
|
+
| Security | Vulnerabilities, data exposure |
|
|
86
|
+
|
|
87
|
+
### 4. Prioritization
|
|
88
|
+
|
|
89
|
+
- **Critical**: Trust-boundary defects, data loss, breaking changes
|
|
90
|
+
- **High**: Performance issues, type safety, missing error handling
|
|
91
|
+
- **Medium**: Code smells, maintainability, docs gaps
|
|
92
|
+
- **Low**: Style, minor optimizations
|
|
93
|
+
|
|
94
|
+
### 5. Recommendations
|
|
95
|
+
|
|
96
|
+
For each issue:
|
|
97
|
+
- Explain problem and impact
|
|
98
|
+
- Provide specific fix example
|
|
99
|
+
- Suggest alternatives if applicable
|
|
100
|
+
|
|
101
|
+
### 6. Report Plan Follow-ups
|
|
102
|
+
|
|
103
|
+
Report which plan tasks appear complete and any recommended next steps. Do not edit plan files or change task state directly; leave plan mutation to the caller.
|
|
104
|
+
|
|
105
|
+
## Output Format
|
|
106
|
+
|
|
107
|
+
```markdown
|
|
108
|
+
## Code Review Summary
|
|
109
|
+
|
|
110
|
+
### Scope
|
|
111
|
+
- Files: [list]
|
|
112
|
+
- LOC: [count]
|
|
113
|
+
- Focus: [recent/specific/full]
|
|
114
|
+
- Scout findings: [edge cases discovered]
|
|
115
|
+
|
|
116
|
+
### Overall Assessment
|
|
117
|
+
[Brief quality overview]
|
|
118
|
+
|
|
119
|
+
### Critical Issues
|
|
120
|
+
[Security, breaking changes]
|
|
121
|
+
|
|
122
|
+
### High Priority
|
|
123
|
+
[Performance, type safety]
|
|
124
|
+
|
|
125
|
+
### Medium Priority
|
|
126
|
+
[Code quality, maintainability]
|
|
127
|
+
|
|
128
|
+
### Low Priority
|
|
129
|
+
[Style, minor opts]
|
|
130
|
+
|
|
131
|
+
### Edge Cases Found by Scout
|
|
132
|
+
[List issues from scouting phase]
|
|
133
|
+
|
|
134
|
+
### Positive Observations
|
|
135
|
+
[Only if materially useful for risk calibration]
|
|
136
|
+
|
|
137
|
+
### Recommended Actions
|
|
138
|
+
1. [Prioritized fixes]
|
|
139
|
+
|
|
140
|
+
### Metrics
|
|
141
|
+
- Type Coverage: [%]
|
|
142
|
+
- Test Coverage: [%]
|
|
143
|
+
- Linting Issues: [count]
|
|
144
|
+
|
|
145
|
+
### Unresolved Questions
|
|
146
|
+
[If any]
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Guidelines
|
|
150
|
+
|
|
151
|
+
- Direct, pragmatic feedback
|
|
152
|
+
- Avoid praise padding; positive notes only when they clarify risk or a tradeoff
|
|
153
|
+
- Respect the project's own rules and coding standards when the repo defines them (e.g. `CLAUDE.md`, `AGENTS.md`, `docs/`)
|
|
154
|
+
- No AI attribution in code/commits
|
|
155
|
+
- Security best practices priority
|
|
156
|
+
- **Verify plan TODO list completion**
|
|
157
|
+
- **Scout edge cases BEFORE reviewing**
|
|
158
|
+
|
|
159
|
+
## Report Output
|
|
160
|
+
|
|
161
|
+
Use naming pattern from `## Naming` section in hooks. If plan file given, extract plan folder first.
|
|
162
|
+
|
|
163
|
+
Thorough but pragmatic - focus on issues that matter, skip minor style nitpicks.
|
|
164
|
+
|
|
165
|
+
## Memory Maintenance
|
|
166
|
+
|
|
167
|
+
Update your agent memory when you discover:
|
|
168
|
+
- Project conventions and patterns
|
|
169
|
+
- Recurring issues and their fixes
|
|
170
|
+
- Architectural decisions and rationale
|
|
171
|
+
Keep MEMORY.md under 200 lines. Use topic files for overflow.
|
|
172
|
+
|
|
173
|
+
## Team Mode (when spawned as teammate)
|
|
174
|
+
|
|
175
|
+
When operating as a team member:
|
|
176
|
+
1. On start: check `TaskList` then claim your assigned or next unblocked task via `TaskUpdate`
|
|
177
|
+
2. Read full task description via `TaskGet` before starting work
|
|
178
|
+
3. Do NOT make code changes — report findings and recommendations only
|
|
179
|
+
4. Use `Bash` for running lint/typecheck/test commands, but never edit files
|
|
180
|
+
5. When done: `TaskUpdate(status: "completed")` then `SendMessage` review report to lead
|
|
181
|
+
6. When receiving `shutdown_request`: approve via `SendMessage(type: "shutdown_response")` unless mid-critical-operation
|
|
182
|
+
7. Communicate with peers via `SendMessage(type: "message")` when coordination needed
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// PreToolUse hook (core company): make the ck:git skill load on git work.
|
|
3
|
+
//
|
|
4
|
+
// Skill auto-activation is a model judgement, not enforcement — the agent
|
|
5
|
+
// routinely runs `git commit` / `git push` straight through Bash without ever
|
|
6
|
+
// opening the skill, so its conventional-commit format, split rules and secret
|
|
7
|
+
// scan are silently skipped. A description alone cannot fix that; only a hook
|
|
8
|
+
// runs every time.
|
|
9
|
+
//
|
|
10
|
+
// Fires on state-changing git/gh operations only. Read-only commands (status,
|
|
11
|
+
// log, diff, show) are skipped so the reminder does not burn context on every
|
|
12
|
+
// incidental `git status`.
|
|
13
|
+
//
|
|
14
|
+
// Matches mid-command too (`cd repo && git push`), since the operation is
|
|
15
|
+
// often not the first word.
|
|
16
|
+
//
|
|
17
|
+
// Always exits 0: this advises, it never blocks.
|
|
18
|
+
|
|
19
|
+
const fs = require("fs");
|
|
20
|
+
|
|
21
|
+
const SKILL = ".claude/skills/git/SKILL.md";
|
|
22
|
+
|
|
23
|
+
// Mutating git verbs, plus the gh surfaces the skill covers.
|
|
24
|
+
const GIT_OPS =
|
|
25
|
+
/(^|[\s;&|(])(git\s+(commit|push|merge|rebase|tag|revert|reset|cherry-pick|switch|checkout|branch|remote|stash)|gh\s+(pr|release|repo))\b/;
|
|
26
|
+
|
|
27
|
+
function isGitOperation(command) {
|
|
28
|
+
if (!command || typeof command !== "string") return false;
|
|
29
|
+
return GIT_OPS.test(command);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const payload = JSON.parse(fs.readFileSync(0, "utf-8"));
|
|
34
|
+
const command = payload?.tool_input?.command || "";
|
|
35
|
+
|
|
36
|
+
if (!isGitOperation(command)) process.exit(0);
|
|
37
|
+
|
|
38
|
+
process.stdout.write(
|
|
39
|
+
JSON.stringify({
|
|
40
|
+
hookSpecificOutput: {
|
|
41
|
+
hookEventName: "PreToolUse",
|
|
42
|
+
additionalContext:
|
|
43
|
+
`This is a git operation. Read ${SKILL} (the ck:git skill) and follow it — its ` +
|
|
44
|
+
"conventional-commit format, commit-splitting rules, secret scan and branch " +
|
|
45
|
+
"protections are project policy, not suggestions. Do that before running the " +
|
|
46
|
+
"command; if you have already read it this session, carry on.",
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
process.exit(0);
|
|
51
|
+
} catch {
|
|
52
|
+
process.exit(0); // fail open — never block a command over a reminder
|
|
53
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// SessionStart hook: inject
|
|
2
|
+
// SessionStart hook: inject the project's always-on design artifacts into every
|
|
3
3
|
// session so the design-first docs reliably "lead the code" (CLAUDE.md), instead
|
|
4
4
|
// of relying on me to remember to read them.
|
|
5
5
|
//
|
|
6
|
-
// Payload (~7K tokens, mostly the
|
|
6
|
+
// Payload (~7K tokens, mostly the vocabularies): the CML context map, the
|
|
7
7
|
// architecture-characteristics worksheet, the ADR index, and every bounded
|
|
8
|
-
// context's
|
|
9
|
-
// config change). tasks.json / event-storm JSON under bounded-contexts are
|
|
8
|
+
// context's ubiquitous-language.md (globbed recursively, so new BCs are picked
|
|
9
|
+
// up with no config change). tasks.json / event-storm JSON under bounded-contexts are
|
|
10
10
|
// deliberately excluded — task-tracking and raw walls, not design context.
|
|
11
11
|
//
|
|
12
12
|
// Fails open: any error emits nothing and exits 0, so it can never block a session.
|
|
@@ -15,8 +15,8 @@ const path = require("path");
|
|
|
15
15
|
|
|
16
16
|
const root = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
17
17
|
|
|
18
|
-
// Recursively collect
|
|
19
|
-
function
|
|
18
|
+
// Recursively collect ubiquitous-language.md under a directory (one per bounded context).
|
|
19
|
+
function findUbiquitousLanguageDocs(dir) {
|
|
20
20
|
const out = [];
|
|
21
21
|
let entries;
|
|
22
22
|
try {
|
|
@@ -27,8 +27,8 @@ function findContextDocs(dir) {
|
|
|
27
27
|
for (const entry of entries) {
|
|
28
28
|
const full = path.join(dir, entry.name);
|
|
29
29
|
if (entry.isDirectory()) {
|
|
30
|
-
out.push(...
|
|
31
|
-
} else if (entry.isFile() && entry.name === "
|
|
30
|
+
out.push(...findUbiquitousLanguageDocs(full));
|
|
31
|
+
} else if (entry.isFile() && entry.name === "ubiquitous-language.md") {
|
|
32
32
|
out.push(full);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -40,7 +40,7 @@ try {
|
|
|
40
40
|
path.join(root, "docs", "context-map.cml"),
|
|
41
41
|
path.join(root, "docs", "architecture-characteristics.md"),
|
|
42
42
|
path.join(root, "docs", "adr", "README.md"),
|
|
43
|
-
...
|
|
43
|
+
...findUbiquitousLanguageDocs(path.join(root, "docs", "bounded-contexts")),
|
|
44
44
|
];
|
|
45
45
|
|
|
46
46
|
const sections = [];
|
|
@@ -60,16 +60,16 @@ try {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
const additionalContext =
|
|
63
|
-
"
|
|
63
|
+
"Design artifacts — injected every session. " +
|
|
64
64
|
"Treat these as the source of truth for the domain model, context boundaries, architecture " +
|
|
65
65
|
"characteristics, and recorded decisions; consult them before any domain, " +
|
|
66
66
|
"architecture, or ADR work, and keep changes consistent with them.\n\n" +
|
|
67
|
-
"Each
|
|
68
|
-
"
|
|
67
|
+
"Each ubiquitous-language.md captures the decisions of the DOMAIN only — the " +
|
|
68
|
+
"vocabulary and model rules, kept vendor/decision-neutral. It bounds what the " +
|
|
69
69
|
"domain model sees, not what infrastructure may do: the ACL/infrastructure can " +
|
|
70
70
|
"legitimately key on more than the model names. (E.g. the domain only ever sees " +
|
|
71
71
|
"a learner's Email, never the auth method; the ACL may also match the OIDC `sub`.) " +
|
|
72
|
-
"That layering is intended, not a contradiction of
|
|
72
|
+
"That layering is intended, not a contradiction of the ubiquitous language.\n\n" +
|
|
73
73
|
sections.join("\n\n");
|
|
74
74
|
|
|
75
75
|
process.stdout.write(
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SessionStart hook (dotnet company): auto-load `docs/ubiquitous-language.md` —
|
|
3
|
+
// the bounded context's vocabulary, produced by the knowledge-crunching skill —
|
|
4
|
+
// into every session, so the domain's language and invariants "lead the code".
|
|
5
|
+
//
|
|
6
|
+
// If the doc is missing, ALERT the user (systemMessage) with the command that
|
|
7
|
+
// creates it. Any other error fails open (emits nothing, exit 0) so it can never
|
|
8
|
+
// block a session.
|
|
9
|
+
const fs = require("fs");
|
|
10
|
+
const path = require("path");
|
|
11
|
+
|
|
12
|
+
const root = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
13
|
+
const REL = "docs/ubiquitous-language.md";
|
|
14
|
+
const file = path.join(root, "docs", "ubiquitous-language.md");
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
let content;
|
|
18
|
+
try {
|
|
19
|
+
content = fs.readFileSync(file, "utf-8");
|
|
20
|
+
} catch {
|
|
21
|
+
// Not found — surface a visible warning to the user, inject nothing.
|
|
22
|
+
process.stdout.write(
|
|
23
|
+
JSON.stringify({
|
|
24
|
+
systemMessage:
|
|
25
|
+
`musketeer: no ${REL} — the bounded context's ubiquitous language is missing. ` +
|
|
26
|
+
"Run the knowledge-crunching skill (/knowledge-crunching) to create it.",
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const additionalContext =
|
|
33
|
+
`Ubiquitous language (${REL}) — injected every session. It is the vocabulary and ` +
|
|
34
|
+
"model rules of this bounded context, kept vendor- and decision-neutral. Treat it as " +
|
|
35
|
+
"canonical for domain naming, concepts, and invariants: name new code after it, and when a " +
|
|
36
|
+
`concept is renamed update ${REL} and the code in the same turn. It bounds what the DOMAIN ` +
|
|
37
|
+
"model sees, not what infrastructure may do (an ACL can legitimately key on more).\n\n" +
|
|
38
|
+
`===== ${REL} =====\n` +
|
|
39
|
+
content.trimEnd();
|
|
40
|
+
|
|
41
|
+
process.stdout.write(
|
|
42
|
+
JSON.stringify({
|
|
43
|
+
hookSpecificOutput: {
|
|
44
|
+
hookEventName: "SessionStart",
|
|
45
|
+
additionalContext,
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
);
|
|
49
|
+
process.exit(0);
|
|
50
|
+
} catch {
|
|
51
|
+
process.exit(0); // fail open
|
|
52
|
+
}
|