@gannonh/kata 0.1.2 → 0.1.3

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # KATA
4
4
 
5
- **A light-weight and powerful meta-prompting, context engineering and spec-driven development system for Claude Code.**
5
+ **A meta-prompting, context engineering and spec-driven development system for Claude Code.**
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@gannonh/kata?style=for-the-badge&logo=npm&logoColor=white&color=CB3837)](https://www.npmjs.com/package/@gannonh/kata)
8
8
  <br>
@@ -25,10 +25,9 @@ npx @gannonh/kata
25
25
 
26
26
  ---
27
27
 
28
-
29
28
  ## Who This Is For
30
29
 
31
- People who want to describe what they want and have it built correctly — without pretending they're running a 50-person engineering org.
30
+ Developers who describe what they want and have it built correctly.
32
31
 
33
32
  ---
34
33
 
@@ -38,17 +37,17 @@ People who want to describe what they want and have it built correctly — witho
38
37
  npx @gannonh/kata
39
38
  ```
40
39
 
41
- That's it. Verify with `/kata:help` inside your Claude Code interface.
40
+ Verify with `/kata:help` inside Claude Code.
42
41
 
43
42
  ### Staying Updated
44
43
 
45
- Kata evolves fast. Check for updates periodically:
44
+ Kata updates frequently. Check for changes:
46
45
 
47
46
  ```
48
47
  /kata:whats-new
49
48
  ```
50
49
 
51
- Update with:
50
+ Update:
52
51
 
53
52
  ```bash
54
53
  npx @gannonh/kata@latest
@@ -83,19 +82,19 @@ Installs to `./.claude/` for testing modifications before contributing.
83
82
 
84
83
  ### Recommended: Skip Permissions Mode
85
84
 
86
- Kata is designed for frictionless automation. Run Claude Code with:
85
+ Kata automates many operations. Run Claude Code with:
87
86
 
88
87
  ```bash
89
88
  claude --dangerously-skip-permissions
90
89
  ```
91
90
 
92
91
  > [!TIP]
93
- > This is how Kata is intended to be used — stopping to approve `date` and `git commit` 50 times defeats the purpose.
92
+ > Kata works best this way. Approving `date` and `git commit` 50 times slows down the workflow.
94
93
 
95
94
  <details>
96
95
  <summary><strong>Alternative: Granular Permissions</strong></summary>
97
96
 
98
- If you prefer not to use that flag, add this to your project's `.claude/settings.json`:
97
+ Add this to your project's `.claude/settings.json`:
99
98
 
100
99
  ```json
101
100
  {
@@ -129,7 +128,7 @@ If you prefer not to use that flag, add this to your project's `.claude/settings
129
128
 
130
129
  ## How It Works
131
130
 
132
- > **Already have code?** Run `/kata:map-codebase` first. It spawns parallel agents to analyze your stack, architecture, conventions, and concerns. Then `/kata:new-project` knows your codebase questions focus on what you're adding, and planning automatically loads your patterns.
131
+ > **Existing codebase?** Run `/kata:map-codebase` first. It spawns parallel agents to analyze your stack, architecture, conventions, and concerns. Then `/kata:new-project` references your codebase. Questions focus on what you're adding, and planning loads your patterns automatically.
133
132
 
134
133
  ### 1. Initialize Project
135
134
 
@@ -156,9 +155,9 @@ You approve the roadmap. Now you're ready to build.
156
155
  /kata:discuss-phase 1
157
156
  ```
158
157
 
159
- **This is where you shape the implementation.**
158
+ **Here you shape the implementation.**
160
159
 
161
- Your roadmap has a sentence or two per phase. That's not enough context to build something the way *you* imagine it. This step captures your preferences before anything gets researched or planned.
160
+ Your roadmap has a sentence or two per phase. That lacks enough context to build something the way you imagine it. This step captures your preferences before anything gets researched or planned.
162
161
 
163
162
  The system analyzes the phase and identifies gray areas based on what's being built:
164
163
 
@@ -167,12 +166,12 @@ The system analyzes the phase and identifies gray areas based on what's being bu
167
166
  - **Content systems** → Structure, tone, depth, flow
168
167
  - **Organization tasks** → Grouping criteria, naming, duplicates, exceptions
169
168
 
170
- For each area you select, it asks until you're satisfied. The output `CONTEXT.md` feeds directly into the next two steps:
169
+ For each area you select, it asks until you're satisfied. The output, `CONTEXT.md`, feeds directly into the next two steps:
171
170
 
172
171
  1. **Researcher reads it** — Knows what patterns to investigate ("user wants card layout" → research card component libraries)
173
172
  2. **Planner reads it** — Knows what decisions are locked ("infinite scroll decided" → plan includes scroll handling)
174
173
 
175
- The deeper you go here, the more the system builds what you actually want. Skip it and you get reasonable defaults. Use it and you get *your* vision.
174
+ Going deeper here makes the system build what you actually want. Skip it and you get reasonable defaults. Use it and you get your vision.
176
175
 
177
176
  **Creates:** `{phase}-CONTEXT.md`
178
177
 
@@ -221,9 +220,9 @@ Walk away, come back to completed work with clean git history.
221
220
  /kata:verify-work 1
222
221
  ```
223
222
 
224
- **This is where you confirm it actually works.**
223
+ **Here you confirm it actually works.**
225
224
 
226
- Automated verification checks that code exists and tests pass. But does the feature *work* the way you expected? This is your chance to use it.
225
+ Automated verification checks that code exists and tests pass. But does the feature work the way you expected? This is your chance to use it.
227
226
 
228
227
  The system:
229
228
 
@@ -232,7 +231,7 @@ The system:
232
231
  3. **Diagnoses failures automatically** — Spawns debug agents to find root causes
233
232
  4. **Creates verified fix plans** — Ready for immediate re-execution
234
233
 
235
- If everything passes, you move on. If something's broken, you don't manually debug you just run `/kata:execute-phase` again with the fix plans it created.
234
+ If everything passes, you move on. If something's broken, you don't manually debug. Run `/kata:execute-phase` again with the fix plans it created.
236
235
 
237
236
  **Creates:** `{phase}-UAT.md`, fix plans if issues found
238
237
 
@@ -252,11 +251,11 @@ If everything passes, you move on. If something's broken, you don't manually deb
252
251
 
253
252
  Loop **discuss → plan → execute → verify** until milestone complete.
254
253
 
255
- Each phase gets your input (discuss), proper research (plan), clean execution (execute), and human verification (verify). Context stays fresh. Quality stays high.
254
+ Each phase gets your input (discuss), research (plan), clean execution (execute), and human verification (verify). Context stays fresh. Quality stays high.
256
255
 
257
256
  When all phases are done, `/kata:complete-milestone` archives the milestone and tags the release.
258
257
 
259
- Then `/kata:new-milestone` starts the next version same flow as `new-project` but for your existing codebase. You describe what you want to build next, the system researches the domain, you scope requirements, and it creates a fresh roadmap. Each milestone is a clean cycle: define → build → ship.
258
+ Then `/kata:new-milestone` starts the next version. Same flow as `new-project` but for your existing codebase. You describe what you want to build next, the system researches the domain, you scope requirements, and it creates a fresh roadmap. Each milestone is a clean cycle: define → build → ship.
260
259
 
261
260
  ---
262
261
 
@@ -264,11 +263,11 @@ Then `/kata:new-milestone` starts the next version — same flow as `new-project
264
263
 
265
264
  ### Context Engineering
266
265
 
267
- Claude Code is incredibly powerful *if* you give it the context it needs. Most people don't.
266
+ Claude Code performs well with the right context. Most users don't provide it.
268
267
 
269
268
  Kata handles it for you:
270
269
 
271
- | File | What it does |
270
+ | File | Function |
272
271
  | ----------------- | ------------------------------------------------------------- |
273
272
  | `PROJECT.md` | Project vision, always loaded |
274
273
  | `research/` | Ecosystem knowledge (stack, features, architecture, pitfalls) |
@@ -279,7 +278,7 @@ Kata handles it for you:
279
278
  | `SUMMARY.md` | What happened, what changed, committed to history |
280
279
  | `todos/` | Captured ideas and tasks for later work |
281
280
 
282
- Size limits based on where Claude's quality degrades. Stay under, get consistent excellence.
281
+ Size limits based on where Claude's quality degrades. Stay under, get consistent results.
283
282
 
284
283
  ### XML Prompt Formatting
285
284
 
@@ -312,9 +311,9 @@ Every stage uses the same pattern: a thin orchestrator spawns specialized agents
312
311
  | Execution | Groups into waves, tracks progress | Executors implement in parallel, each with fresh 200k context |
313
312
  | Verification | Presents results, routes next | Verifier checks codebase against goals, debuggers diagnose failures |
314
313
 
315
- The orchestrator never does heavy lifting. It spawns agents, waits, integrates results.
314
+ The orchestrator spawns agents, waits, and integrates results.
316
315
 
317
- **The result:** You can run an entire phase deep research, multiple plans created and verified, thousands of lines of code written across parallel executors, automated verification against goals and your main context window stays at 30-40%. The work happens in fresh subagent contexts. Your session stays fast and responsive.
316
+ **Result:** You can run an entire phase (deep research, multiple plans created and verified, thousands of lines of code written across parallel executors, automated verification against goals) and your main context window stays at 30-40%. The work happens in fresh subagent contexts. Your session stays fast and responsive.
318
317
 
319
318
  ### Atomic Git Commits
320
319
 
@@ -339,7 +338,7 @@ Every commit is surgical, traceable, and meaningful.
339
338
  - Complete milestones and start fresh
340
339
  - Adjust plans without rebuilding everything
341
340
 
342
- You're never locked in. The system adapts.
341
+ The system adapts.
343
342
 
344
343
  ---
345
344
 
@@ -347,7 +346,7 @@ You're never locked in. The system adapts.
347
346
 
348
347
  ### Core Workflow
349
348
 
350
- | Command | What it does |
349
+ | Command | Function |
351
350
  | ---------------------------- | ------------------------------------------------------------------ |
352
351
  | `/kata:new-project` | Full initialization: questions → research → requirements → roadmap |
353
352
  | `/kata:discuss-phase [N]` | Capture implementation decisions before planning |
@@ -359,20 +358,20 @@ You're never locked in. The system adapts.
359
358
 
360
359
  ### Navigation
361
360
 
362
- | Command | What it does |
361
+ | Command | Function |
363
362
  | ---------------- | --------------------------------- |
364
363
  | `/kata:progress` | Where am I? What's next? |
365
364
  | `/kata:help` | Show all commands and usage guide |
366
365
 
367
366
  ### Brownfield
368
367
 
369
- | Command | What it does |
368
+ | Command | Function |
370
369
  | -------------------- | -------------------------------------------- |
371
370
  | `/kata:map-codebase` | Analyze existing codebase before new-project |
372
371
 
373
372
  ### Phase Management
374
373
 
375
- | Command | What it does |
374
+ | Command | Function |
376
375
  | ------------------------ | --------------------------------- |
377
376
  | `/kata:add-phase` | Append phase to roadmap |
378
377
  | `/kata:insert-phase [N]` | Insert urgent work between phases |
@@ -380,14 +379,14 @@ You're never locked in. The system adapts.
380
379
 
381
380
  ### Session
382
381
 
383
- | Command | What it does |
382
+ | Command | Function |
384
383
  | ------------------- | -------------------------------------- |
385
384
  | `/kata:pause-work` | Create handoff when stopping mid-phase |
386
385
  | `/kata:resume-work` | Restore from last session |
387
386
 
388
387
  ### Utilities
389
388
 
390
- | Command | What it does |
389
+ | Command | Function |
391
390
  | ----------------------- | ------------------------------------------ |
392
391
  | `/kata:add-todo [desc]` | Capture idea for later |
393
392
  | `/kata:check-todos` | List pending todos |
@@ -430,6 +429,6 @@ MIT License. See [LICENSE](LICENSE) for details.
430
429
 
431
430
  <div align="center">
432
431
 
433
- **Claude Code is powerful. Kata makes it reliable.**
432
+ **Claude Code performs well. Kata makes it reliable.**
434
433
 
435
434
  </div>
@@ -11,9 +11,41 @@ Provides a better update experience than raw `npx @gannonh/kata` by showing vers
11
11
 
12
12
  <process>
13
13
 
14
+ <step name="detect_installation">
15
+ Detect whether Kata is installed locally (in current project) or globally:
16
+
17
+ ```bash
18
+ if [ -d "./.claude/commands/kata" ]; then
19
+ echo "local"
20
+ else
21
+ echo "global"
22
+ fi
23
+ ```
24
+
25
+ **Set paths based on installation type:**
26
+
27
+ | Installation | VERSION Path | Install Flag | Cache Path |
28
+ |-------------|--------------|--------------|------------|
29
+ | Local | `./.claude/kata/VERSION` | (no flag) | `./.claude/kata/cache/update-check.json` |
30
+ | Global | `~/.claude/kata/VERSION` | `--global` | `~/.claude/kata/cache/update-check.json` |
31
+
32
+ Store the installation type for use in subsequent steps.
33
+
34
+ **Display detection result:**
35
+ ```
36
+ Detected installation: [local/global]
37
+ ```
38
+ </step>
39
+
14
40
  <step name="get_installed_version">
15
- Read installed version:
41
+ Read installed version from the detected installation path:
16
42
 
43
+ **For local installation:**
44
+ ```bash
45
+ cat ./.claude/kata/VERSION 2>/dev/null
46
+ ```
47
+
48
+ **For global installation:**
17
49
  ```bash
18
50
  cat ~/.claude/kata/VERSION 2>/dev/null
19
51
  ```
@@ -23,6 +55,7 @@ cat ~/.claude/kata/VERSION 2>/dev/null
23
55
  ## Kata Update
24
56
 
25
57
  **Installed version:** Unknown
58
+ **Installation type:** [local/global]
26
59
 
27
60
  Your installation doesn't include version tracking.
28
61
 
@@ -105,13 +138,20 @@ STOP here if ahead.
105
138
 
106
139
  ────────────────────────────────────────────────────────────
107
140
 
108
- ⚠️ **Note:** The installer performs a clean install of Kata folders:
141
+ ⚠️ **Note:** The installer performs a clean install of Kata folders.
142
+
143
+ **For local installation (in current project):**
144
+ - `./.claude/commands/kata/` will be wiped and replaced
145
+ - `./.claude/kata/` will be wiped and replaced
146
+ - `./.claude/agents/kata-*` files will be replaced
147
+
148
+ **For global installation:**
109
149
  - `~/.claude/commands/kata/` will be wiped and replaced
110
150
  - `~/.claude/kata/` will be wiped and replaced
111
151
  - `~/.claude/agents/kata-*` files will be replaced
112
152
 
113
153
  Your custom files in other locations are preserved:
114
- - Custom commands in `~/.claude/commands/your-stuff/`
154
+ - Custom commands not in the kata folder
115
155
  - Custom agents not prefixed with `kata-` ✓
116
156
  - Custom hooks ✓
117
157
  - Your CLAUDE.md files ✓
@@ -129,8 +169,14 @@ Use AskUserQuestion:
129
169
  </step>
130
170
 
131
171
  <step name="run_update">
132
- Run the update:
172
+ Run the update using the appropriate flag based on installation type:
133
173
 
174
+ **For local installation:**
175
+ ```bash
176
+ npx @gannonh/kata
177
+ ```
178
+
179
+ **For global installation:**
134
180
  ```bash
135
181
  npx @gannonh/kata --global
136
182
  ```
@@ -139,8 +185,14 @@ Capture output. If install fails, show error and STOP.
139
185
 
140
186
  Clear the update cache so statusline indicator disappears:
141
187
 
188
+ **For local installation:**
189
+ ```bash
190
+ rm -f ./.claude/kata/cache/update-check.json
191
+ ```
192
+
193
+ **For global installation:**
142
194
  ```bash
143
- rm -f ~/.claude/cache/kata-update-check.json
195
+ rm -f ~/.claude/kata/cache/update-check.json
144
196
  ```
145
197
  </step>
146
198
 
@@ -161,12 +213,14 @@ Format completion message (changelog was already shown in confirmation step):
161
213
  </process>
162
214
 
163
215
  <success_criteria>
216
+ - [ ] Installation type detected (local vs global)
217
+ - [ ] Correct paths used based on installation type
164
218
  - [ ] Installed version read correctly
165
219
  - [ ] Latest version checked via npm
166
220
  - [ ] Update skipped if already current
167
221
  - [ ] Changelog fetched and displayed BEFORE update
168
- - [ ] Clean install warning shown
222
+ - [ ] Clean install warning shown with appropriate paths
169
223
  - [ ] User confirmation obtained
170
- - [ ] Update executed successfully
224
+ - [ ] Update executed with correct flag (--global for global only)
171
225
  - [ ] Restart reminder shown
172
226
  </success_criteria>
@@ -8,9 +8,23 @@ const os = require('os');
8
8
  const { execSync, spawn } = require('child_process');
9
9
 
10
10
  const homeDir = os.homedir();
11
- const cacheDir = path.join(homeDir, '.claude', 'cache');
12
- const cacheFile = path.join(cacheDir, 'kata-update-check.json');
13
- const versionFile = path.join(homeDir, '.claude', 'kata', 'VERSION');
11
+ const cwd = process.cwd();
12
+
13
+ // Detect local vs global installation by checking VERSION file
14
+ // This single check tells us both: existence = local install, contents = version
15
+ const localVersionFile = path.join(cwd, '.claude', 'kata', 'VERSION');
16
+ const globalVersionFile = path.join(homeDir, '.claude', 'kata', 'VERSION');
17
+ const isLocalInstall = fs.existsSync(localVersionFile);
18
+
19
+ // Use paths based on installation type - cache location matches install context
20
+ const versionFile = isLocalInstall ? localVersionFile : globalVersionFile;
21
+ const cacheDir = isLocalInstall
22
+ ? path.join(cwd, '.claude', 'kata', 'cache')
23
+ : path.join(homeDir, '.claude', 'kata', 'cache');
24
+ const cacheFile = path.join(cacheDir, 'update-check.json');
25
+
26
+ // Store cwd in cache so statusline can detect stale cache
27
+ const checkedCwd = cwd;
14
28
 
15
29
  // Ensure cache directory exists
16
30
  if (!fs.existsSync(cacheDir)) {
@@ -24,6 +38,8 @@ const child = spawn(process.execPath, ['-e', `
24
38
 
25
39
  const cacheFile = ${JSON.stringify(cacheFile)};
26
40
  const versionFile = ${JSON.stringify(versionFile)};
41
+ const checkedCwd = ${JSON.stringify(checkedCwd)};
42
+ const isLocalInstall = ${JSON.stringify(isLocalInstall)};
27
43
 
28
44
  let installed = '0.0.0';
29
45
  try {
@@ -39,7 +55,9 @@ const child = spawn(process.execPath, ['-e', `
39
55
  update_available: latest && installed !== latest,
40
56
  installed,
41
57
  latest: latest || 'unknown',
42
- checked: Math.floor(Date.now() / 1000)
58
+ checked: Math.floor(Date.now() / 1000),
59
+ cwd: checkedCwd,
60
+ isLocalInstall: isLocalInstall
43
61
  };
44
62
 
45
63
  fs.writeFileSync(cacheFile, JSON.stringify(result));
@@ -61,11 +61,27 @@ process.stdin.on('end', () => {
61
61
 
62
62
  // Kata update available?
63
63
  let kataUpdate = '';
64
- const cacheFile = path.join(homeDir, '.claude', 'cache', 'kata-update-check.json');
64
+ const currentDir = dir;
65
+
66
+ // Detect local vs global installation by checking VERSION file
67
+ const localVersionFile = path.join(currentDir, '.claude', 'kata', 'VERSION');
68
+ const currentIsLocalInstall = fs.existsSync(localVersionFile);
69
+
70
+ // Read cache from location matching current context
71
+ const cacheFile = currentIsLocalInstall
72
+ ? path.join(currentDir, '.claude', 'kata', 'cache', 'update-check.json')
73
+ : path.join(homeDir, '.claude', 'kata', 'cache', 'update-check.json');
74
+
65
75
  if (fs.existsSync(cacheFile)) {
66
76
  try {
67
77
  const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
68
- if (cache.update_available) {
78
+
79
+ // Validate cache matches current context (sanity check)
80
+ const cacheIsRelevant = currentIsLocalInstall
81
+ ? (cache.isLocalInstall && cache.cwd === currentDir)
82
+ : !cache.isLocalInstall;
83
+
84
+ if (cache.update_available && cacheIsRelevant) {
69
85
  kataUpdate = '\x1b[33m⬆ /kata:update\x1b[0m │ ';
70
86
  }
71
87
  } catch (e) {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gannonh/kata",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Development framework for Claude Code.",
5
5
  "bin": {
6
6
  "kata": "bin/install.js"
@@ -29,4 +29,4 @@
29
29
  "engines": {
30
30
  "node": ">=16.7.0"
31
31
  }
32
- }
32
+ }