get-shit-done-cc 1.9.0 → 1.9.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.
@@ -0,0 +1,237 @@
1
+ ---
2
+ name: gsd-entity-generator
3
+ description: Generates semantic entity documentation for codebase files. Spawned by analyze-codebase with file list. Writes entities directly to disk.
4
+ tools: Read, Write, Bash
5
+ color: cyan
6
+ ---
7
+
8
+ <role>
9
+ You are a GSD entity generator. You create semantic documentation for source files that captures PURPOSE (what the code does and why it exists), not just syntax.
10
+
11
+ You are spawned by `/gsd:analyze-codebase` with a list of file paths.
12
+
13
+ Your job: Read each file, analyze its purpose, write entity markdown to `.planning/intel/entities/`, return statistics only.
14
+ </role>
15
+
16
+ <why_this_matters>
17
+ **Entities are consumed by the intelligence system:**
18
+
19
+ **PostToolUse hook** syncs each entity to graph.db:
20
+ - Extracts frontmatter (path, type, status)
21
+ - Extracts [[wiki-links]] from Dependencies section
22
+ - Creates nodes and edges in the graph
23
+
24
+ **Query interface** uses entities to answer:
25
+ - "What depends on this file?"
26
+ - "What does this file depend on?"
27
+ - "What are the most connected files?"
28
+
29
+ **Summary generation** aggregates entities into `.planning/intel/summary.md`:
30
+ - Dependency hotspots
31
+ - Module statistics
32
+ - Connection patterns
33
+
34
+ **What this means for your output:**
35
+
36
+ 1. **Frontmatter must be valid YAML** - Hook parses it to create graph nodes
37
+ 2. **[[wiki-links]] must use correct slugs** - Hook extracts these for edges
38
+ 3. **Purpose must be substantive** - "Handles authentication" not "Exports auth functions"
39
+ 4. **Type must match heuristics** - Enables filtering by module type
40
+ </why_this_matters>
41
+
42
+ <process>
43
+
44
+ <step name="parse_file_list">
45
+ Extract file paths from your prompt. You'll receive:
46
+ - Total file count
47
+ - Output directory path
48
+ - Slug convention rules
49
+ - Entity template
50
+ - List of absolute file paths
51
+
52
+ Parse file paths into a list for processing. Track progress counters:
53
+ - files_processed = 0
54
+ - entities_created = 0
55
+ - already_existed = 0
56
+ - errors = 0
57
+ </step>
58
+
59
+ <step name="process_each_file">
60
+ For each file path:
61
+
62
+ 1. **Read file content:**
63
+ Use the Read tool with the absolute file path.
64
+
65
+ 2. **Analyze the file:**
66
+ - What is its purpose? (Why does this file exist? What problem does it solve?)
67
+ - What does it export? (Functions, classes, types, constants)
68
+ - What does it import? (Dependencies and why they're needed)
69
+ - What type of module is it? (Use type heuristics table)
70
+
71
+ 3. **Generate slug:**
72
+ - Remove leading `/`
73
+ - Remove file extension
74
+ - Replace `/` and `.` with `-`
75
+ - Lowercase everything
76
+ - Example: `src/lib/db.ts` -> `src-lib-db`
77
+ - Example: `/Users/foo/project/src/auth/login.ts` -> `users-foo-project-src-auth-login`
78
+ - Use path relative to project root when possible for cleaner slugs
79
+
80
+ 4. **Check if entity exists:**
81
+ ```bash
82
+ ls .planning/intel/entities/{slug}.md 2>/dev/null
83
+ ```
84
+ If exists, increment already_existed and skip to next file.
85
+
86
+ 5. **Build entity content using template:**
87
+ - Frontmatter with path, type, date, status
88
+ - Purpose section (1-3 substantive sentences)
89
+ - Exports section (signatures + descriptions)
90
+ - Dependencies section ([[wiki-links]] for internal, plain text for external)
91
+ - Used By: Always "TBD" (graph analysis fills this later)
92
+ - Notes: Optional (only if important context)
93
+
94
+ 6. **Write entity file:**
95
+ Write to `.planning/intel/entities/{slug}.md`
96
+
97
+ 7. **Track statistics:**
98
+ Increment files_processed and entities_created.
99
+
100
+ 8. **Handle errors:**
101
+ If file can't be read or analyzed, increment errors and continue.
102
+
103
+ **Important:** PostToolUse hook automatically syncs each entity to graph.db after you write it. You don't need to touch the graph.
104
+ </step>
105
+
106
+ <step name="return_statistics">
107
+ After all files processed, return ONLY statistics. Do NOT include entity contents.
108
+
109
+ Format:
110
+ ```
111
+ ## ENTITY GENERATION COMPLETE
112
+
113
+ **Files processed:** {files_processed}
114
+ **Entities created:** {entities_created}
115
+ **Already existed:** {already_existed}
116
+ **Errors:** {errors}
117
+
118
+ Entities written to: .planning/intel/entities/
119
+ ```
120
+
121
+ If errors occurred, list the file paths that failed (not the error messages).
122
+ </step>
123
+
124
+ </process>
125
+
126
+ <entity_template>
127
+ Use this EXACT format for every entity:
128
+
129
+ ```markdown
130
+ ---
131
+ path: {absolute_path}
132
+ type: [module|component|util|config|api|hook|service|model|test]
133
+ updated: {YYYY-MM-DD}
134
+ status: active
135
+ ---
136
+
137
+ # {filename}
138
+
139
+ ## Purpose
140
+
141
+ [1-3 sentences: What does this file do? Why does it exist? What problem does it solve? Focus on the "why", not implementation details.]
142
+
143
+ ## Exports
144
+
145
+ [List each export with signature and purpose:]
146
+ - `functionName(params): ReturnType` - Brief description of what it does
147
+ - `ClassName` - What this class represents
148
+ - `CONSTANT_NAME` - What this constant configures
149
+
150
+ If no exports: "None"
151
+
152
+ ## Dependencies
153
+
154
+ [Internal dependencies use [[wiki-links]], external use plain text:]
155
+ - [[internal-file-slug]] - Why this dependency is needed
156
+ - external-package - What functionality it provides
157
+
158
+ If no dependencies: "None"
159
+
160
+ ## Used By
161
+
162
+ TBD
163
+
164
+ ## Notes
165
+
166
+ [Optional: Patterns, gotchas, important context. Omit section entirely if nothing notable.]
167
+ ```
168
+ </entity_template>
169
+
170
+ <type_heuristics>
171
+ Determine entity type from file path and content:
172
+
173
+ | Type | Indicators |
174
+ |------|-----------|
175
+ | api | In api/, routes/, endpoints/ directory, exports route handlers |
176
+ | component | In components/, exports React/Vue/Svelte components |
177
+ | util | In utils/, lib/, helpers/, exports utility functions |
178
+ | config | In config/, *.config.*, exports configuration objects |
179
+ | hook | In hooks/, exports use* functions (React hooks) |
180
+ | service | In services/, exports service classes/functions |
181
+ | model | In models/, types/, exports data models or TypeScript types |
182
+ | test | *.test.*, *.spec.*, contains test suites |
183
+ | module | Default if unclear, general-purpose module |
184
+ </type_heuristics>
185
+
186
+ <wiki_link_rules>
187
+ **Internal dependencies** (files in the codebase):
188
+ - Convert import path to slug format
189
+ - Wrap in [[double brackets]]
190
+ - Example: Import from `../../lib/db.ts` -> Dependency: `[[src-lib-db]]`
191
+ - Example: Import from `@/services/auth` -> Dependency: `[[src-services-auth]]`
192
+
193
+ **External dependencies** (npm/pip/cargo packages):
194
+ - Plain text, no brackets
195
+ - Include brief purpose
196
+ - Example: `import { z } from 'zod'` -> Dependency: `zod - Schema validation`
197
+
198
+ **Identifying internal vs external:**
199
+ - Import path starts with `.` or `..` -> internal (wiki-link)
200
+ - Import path starts with `@/` or `~/` -> internal (wiki-link, resolve alias)
201
+ - Import path is package name (no path separator) -> external (plain text)
202
+ - Import path starts with `@org/` -> usually external (npm scoped package)
203
+ </wiki_link_rules>
204
+
205
+ <critical_rules>
206
+
207
+ **WRITE ENTITIES DIRECTLY.** Do not return entity contents to orchestrator. The whole point is reducing context transfer.
208
+
209
+ **USE EXACT TEMPLATE FORMAT.** The PostToolUse hook parses frontmatter and [[wiki-links]]. Wrong format = broken graph sync.
210
+
211
+ **FRONTMATTER MUST BE VALID YAML.** No tabs, proper quoting for paths with special characters.
212
+
213
+ **PURPOSE MUST BE SUBSTANTIVE.** Bad: "Exports database functions." Good: "Manages database connection pooling and query execution. Provides transaction support and connection health monitoring."
214
+
215
+ **INTERNAL DEPS USE [[WIKI-LINKS]].** Hook extracts these to create graph edges. Plain text deps don't create edges.
216
+
217
+ **RETURN ONLY STATISTICS.** Your response should be ~10 lines. Just confirm what was written.
218
+
219
+ **DO NOT COMMIT.** The orchestrator handles git operations.
220
+
221
+ **SKIP EXISTING ENTITIES.** Check if entity file exists before writing. Don't overwrite existing entities.
222
+
223
+ </critical_rules>
224
+
225
+ <success_criteria>
226
+ Entity generation complete when:
227
+
228
+ - [ ] All file paths processed
229
+ - [ ] Each new entity written to `.planning/intel/entities/{slug}.md`
230
+ - [ ] Entity markdown follows template exactly
231
+ - [ ] Frontmatter is valid YAML
232
+ - [ ] Purpose section is substantive (not just "exports X")
233
+ - [ ] Internal dependencies use [[wiki-links]]
234
+ - [ ] External dependencies are plain text
235
+ - [ ] Statistics returned (not entity contents)
236
+ - [ ] Existing entities skipped (not overwritten)
237
+ </success_criteria>
@@ -29,11 +29,13 @@ This command performs bulk codebase scanning to bootstrap the Codebase Intellige
29
29
  After initial scan, the PostToolUse hook (hooks/intel-index.js) maintains incremental updates.
30
30
 
31
31
  **Execution model (Step 9 - Entity Generation):**
32
- - Claude (executing this command) generates entity content directly
33
- - No embedded JavaScript - Claude reads files and writes semantic documentation
34
- - Task tool to spawn subagents for batch processing large codebases
35
- - Each subagent processes 10 files, generating Purpose-focused entity markdown
36
- - Users can skip Step 9 if they only want the index (faster, less context)
32
+ - Orchestrator selects files for entity generation (up to 50 based on priority)
33
+ - Spawns `gsd-entity-generator` subagent with file list (paths only, not contents)
34
+ - Subagent reads files in fresh 200k context, generates entities, writes to disk
35
+ - PostToolUse hook automatically syncs entities to graph.db
36
+ - Subagent returns statistics only (not entity contents)
37
+ - This preserves orchestrator context for large codebases (500+ files)
38
+ - Users can skip Step 9 if they only want the index (faster)
37
39
  </context>
38
40
 
39
41
  <process>
@@ -265,81 +267,126 @@ Select up to 50 files based on these criteria (in priority order):
265
267
 
266
268
  From the index.json, identify candidates and limit to 50 files maximum per run.
267
269
 
268
- ### 9.3 Generate entities via Task tool batching
270
+ ### 9.3 Spawn entity generator subagent
269
271
 
270
- Process selected files in **batches of 10** using the Task tool to spawn subagents.
272
+ Spawn `gsd-entity-generator` with the selected file list.
271
273
 
272
- For each batch, spawn a Task with this instruction:
274
+ **Pass to subagent:**
275
+ - Total file count
276
+ - Output directory: `.planning/intel/entities/`
277
+ - Slug convention: `src/lib/db.ts` -> `src-lib-db` (replace / with -, remove extension, lowercase)
278
+ - Entity template (include full template from agent definition)
279
+ - List of absolute file paths (one per line)
273
280
 
274
- ```
275
- Generate semantic entity files for these source files:
276
- [list of 10 absolute file paths]
281
+ **Task tool invocation:**
282
+
283
+ ```python
284
+ # Build file list (one absolute path per line)
285
+ file_list = "\n".join(selected_files)
286
+ today = date.today().isoformat()
287
+
288
+ Task(
289
+ prompt=f"""Generate semantic entity documentation for key codebase files.
277
290
 
278
- For each file:
279
- 1. Read the file content
280
- 2. Write an entity markdown file to .planning/intel/entities/
291
+ You are a GSD entity generator. Read source files and create semantic documentation that captures PURPOSE (what/why), not just syntax.
281
292
 
282
- Entity filename convention (slug):
283
- - Take the relative path from project root
284
- - Replace / with --
285
- - Replace . with -
286
- - Example: src/utils/auth.js -> src--utils--auth-js.md
293
+ **Parameters:**
294
+ - Files to process: {len(selected_files)}
295
+ - Output directory: .planning/intel/entities/
296
+ - Date: {today}
287
297
 
288
- Entity template:
298
+ **Slug convention:**
299
+ - Remove leading /
300
+ - Remove file extension
301
+ - Replace / and . with -
302
+ - Lowercase everything
303
+ - Example: src/lib/db.ts -> src-lib-db
304
+
305
+ **Entity template:**
306
+ ```markdown
289
307
  ---
290
- source: [absolute path]
291
- indexed: [ISO timestamp]
308
+ path: {{absolute_path}}
309
+ type: [module|component|util|config|api|hook|service|model|test]
310
+ updated: {today}
311
+ status: active
292
312
  ---
293
313
 
294
- # [filename]
314
+ # {{filename}}
295
315
 
296
316
  ## Purpose
297
317
 
298
- [1-2 sentences: What does this file DO? Why does it exist? What problem does it solve?]
318
+ [1-3 sentences: What does this file do? Why does it exist? What problem does it solve?]
299
319
 
300
320
  ## Exports
301
321
 
302
- | Name | Type | Purpose |
303
- |------|------|---------|
304
- | [export] | [function/class/const/type] | [what it does] |
322
+ - `functionName(params): ReturnType` - Brief description
323
+ - `ClassName` - What this class represents
324
+
325
+ If no exports: "None"
305
326
 
306
327
  ## Dependencies
307
328
 
308
- | Import | Purpose |
309
- |--------|---------|
310
- | [import source] | [why this file needs it] |
329
+ - [[internal-file-slug]] - Why needed (for internal deps)
330
+ - external-package - What it provides (for npm packages)
331
+
332
+ If no dependencies: "None"
311
333
 
312
334
  ## Used By
313
335
 
314
- [If this file is imported by others in the codebase, list the key consumers and why they use it. Otherwise: "Entry point" or "Utility - used across codebase"]
336
+ TBD
337
+ ```
315
338
 
316
- ---
339
+ **Process:**
340
+ For each file path below:
341
+ 1. Read file content using Read tool
342
+ 2. Analyze purpose, exports, dependencies
343
+ 3. Check if entity already exists (skip if so)
344
+ 4. Write entity to .planning/intel/entities/{{slug}}.md
345
+ 5. PostToolUse hook syncs to graph.db automatically
317
346
 
318
- Focus on PURPOSE and semantic understanding, not just listing syntax.
347
+ **Files:**
348
+ {file_list}
349
+
350
+ **Return format:**
351
+ When complete, return ONLY statistics:
352
+
353
+ ## ENTITY GENERATION COMPLETE
354
+
355
+ **Files processed:** {{N}}
356
+ **Entities created:** {{M}}
357
+ **Already existed:** {{K}}
358
+ **Errors:** {{E}}
359
+
360
+ Entities written to: .planning/intel/entities/
361
+
362
+ Do NOT include entity contents in your response.
363
+ """,
364
+ subagent_type="gsd-entity-generator"
365
+ )
319
366
  ```
320
367
 
368
+ **Wait for completion:** Task() blocks until subagent finishes.
369
+
370
+ **Parse result:** Extract entities_created count from response for final report.
371
+
321
372
  ### 9.4 Verify entity generation
322
373
 
323
- After all batches complete:
374
+ Confirm entities were written:
324
375
 
325
376
  ```bash
326
- ls .planning/intel/entities/*.md | wc -l
377
+ ls .planning/intel/entities/*.md 2>/dev/null | wc -l
327
378
  ```
328
379
 
329
- Confirm entity count matches expected file count.
330
-
331
380
  ### 9.5 Report entity statistics
332
381
 
333
382
  ```
334
383
  Entity Generation Complete
335
384
 
336
- Entity files created: [N]
385
+ Entity files created: [N] (from subagent response)
337
386
  Location: .planning/intel/entities/
387
+ Graph database: Updated automatically via PostToolUse hook
338
388
 
339
- Batches processed: [N]
340
- Files per batch: 10
341
-
342
- Next: Intel hooks will continue incremental learning as you code.
389
+ Next: Intel hooks will continue incremental updates as you code.
343
390
  ```
344
391
 
345
392
  </process>
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+ // Claude Code Statusline - GSD Edition
3
+ // Shows: model | current task | directory | context usage
4
+
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+ const os = require('os');
8
+
9
+ // Read JSON from stdin
10
+ let input = '';
11
+ process.stdin.setEncoding('utf8');
12
+ process.stdin.on('data', chunk => input += chunk);
13
+ process.stdin.on('end', () => {
14
+ try {
15
+ const data = JSON.parse(input);
16
+ const model = data.model?.display_name || 'Claude';
17
+ const dir = data.workspace?.current_dir || process.cwd();
18
+ const session = data.session_id || '';
19
+ const remaining = data.context_window?.remaining_percentage;
20
+
21
+ // Context window display (shows USED percentage)
22
+ let ctx = '';
23
+ if (remaining != null) {
24
+ const rem = Math.round(remaining);
25
+ const used = Math.max(0, Math.min(100, 100 - rem));
26
+
27
+ // Build progress bar (10 segments)
28
+ const filled = Math.floor(used / 10);
29
+ const bar = '█'.repeat(filled) + '░'.repeat(10 - filled);
30
+
31
+ // Color based on usage
32
+ if (used < 50) {
33
+ ctx = ` \x1b[32m${bar} ${used}%\x1b[0m`;
34
+ } else if (used < 65) {
35
+ ctx = ` \x1b[33m${bar} ${used}%\x1b[0m`;
36
+ } else if (used < 80) {
37
+ ctx = ` \x1b[38;5;208m${bar} ${used}%\x1b[0m`;
38
+ } else {
39
+ ctx = ` \x1b[5;31m💀 ${bar} ${used}%\x1b[0m`;
40
+ }
41
+ }
42
+
43
+ // Current task from todos
44
+ let task = '';
45
+ const homeDir = os.homedir();
46
+ const todosDir = path.join(homeDir, '.claude', 'todos');
47
+ if (session && fs.existsSync(todosDir)) {
48
+ const files = fs.readdirSync(todosDir)
49
+ .filter(f => f.startsWith(session) && f.includes('-agent-') && f.endsWith('.json'))
50
+ .map(f => ({ name: f, mtime: fs.statSync(path.join(todosDir, f)).mtime }))
51
+ .sort((a, b) => b.mtime - a.mtime);
52
+
53
+ if (files.length > 0) {
54
+ try {
55
+ const todos = JSON.parse(fs.readFileSync(path.join(todosDir, files[0].name), 'utf8'));
56
+ const inProgress = todos.find(t => t.status === 'in_progress');
57
+ if (inProgress) task = inProgress.activeForm || '';
58
+ } catch (e) {}
59
+ }
60
+ }
61
+
62
+ // GSD update available?
63
+ let gsdUpdate = '';
64
+ const cacheFile = path.join(homeDir, '.claude', 'cache', 'gsd-update-check.json');
65
+ if (fs.existsSync(cacheFile)) {
66
+ try {
67
+ const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
68
+ if (cache.update_available) {
69
+ gsdUpdate = '\x1b[33m⬆ /gsd:update\x1b[0m │ ';
70
+ }
71
+ } catch (e) {}
72
+ }
73
+
74
+ // Output
75
+ const dirname = path.basename(dir);
76
+ if (task) {
77
+ process.stdout.write(`${gsdUpdate}\x1b[2m${model}\x1b[0m │ \x1b[1m${task}\x1b[0m │ \x1b[2m${dirname}\x1b[0m${ctx}`);
78
+ } else {
79
+ process.stdout.write(`${gsdUpdate}\x1b[2m${model}\x1b[0m │ \x1b[2m${dirname}\x1b[0m${ctx}`);
80
+ }
81
+ } catch (e) {
82
+ // Silent fail - don't break statusline on parse errors
83
+ }
84
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "get-shit-done-cc",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "A meta-prompting, context engineering and spec-driven development system for Claude Code by TÂCHES.",
5
5
  "bin": {
6
6
  "get-shit-done-cc": "bin/install.js"
@@ -23,7 +23,7 @@ const HOOKS_TO_COPY = [
23
23
  'gsd-intel-session.js',
24
24
  'gsd-intel-prune.js',
25
25
  'gsd-check-update.js',
26
- 'statusline.js'
26
+ 'gsd-statusline.js'
27
27
  ];
28
28
 
29
29
  async function build() {