get-shit-done-cc 1.9.0 → 1.9.2

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.
@@ -1,363 +0,0 @@
1
- ---
2
- name: gsd:analyze-codebase
3
- description: Scan existing codebase and populate .planning/intel/ with file index, conventions, and semantic entity files
4
- argument-hint: ""
5
- allowed-tools:
6
- - Read
7
- - Bash
8
- - Glob
9
- - Write
10
- - Task
11
- ---
12
-
13
- <objective>
14
- Scan codebase to populate .planning/intel/ with file index, conventions, and semantic entity files.
15
-
16
- Works standalone (without /gsd:new-project) for brownfield codebases. Creates summary.md for context injection at session start. Generates entity files that capture file PURPOSE (what it does, why it exists), not just syntax.
17
-
18
- Output: .planning/intel/index.json, conventions.json, summary.md, entities/*.md
19
- </objective>
20
-
21
- <context>
22
- This command performs bulk codebase scanning to bootstrap the Codebase Intelligence system.
23
-
24
- **Use for:**
25
- - Brownfield projects before /gsd:new-project
26
- - Refreshing intel after major changes
27
- - Standalone intel without full project setup
28
-
29
- After initial scan, the PostToolUse hook (hooks/intel-index.js) maintains incremental updates.
30
-
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)
37
- </context>
38
-
39
- <process>
40
-
41
- ## Step 1: Create directory structure
42
-
43
- ```bash
44
- mkdir -p .planning/intel
45
- ```
46
-
47
- ## Step 2: Find all indexable files
48
-
49
- Use Glob tool with pattern: `**/*.{js,ts,jsx,tsx,mjs,cjs}`
50
-
51
- Exclude directories (skip any path containing):
52
- - node_modules
53
- - dist
54
- - build
55
- - .git
56
- - vendor
57
- - coverage
58
- - .next
59
- - __pycache__
60
-
61
- Filter results to remove excluded paths before processing.
62
-
63
- ## Step 3: Process each file
64
-
65
- Initialize the index structure:
66
- ```javascript
67
- {
68
- version: 1,
69
- updated: Date.now(),
70
- files: {}
71
- }
72
- ```
73
-
74
- For each file found:
75
-
76
- 1. Read file content using Read tool
77
-
78
- 2. Extract exports using these patterns:
79
- - Named exports: `export\s*\{([^}]+)\}`
80
- - Declaration exports: `export\s+(?:const|let|var|function\*?|async\s+function|class)\s+(\w+)`
81
- - Default exports: `export\s+default\s+(?:function\s*\*?\s*|class\s+)?(\w+)?`
82
- - CommonJS object: `module\.exports\s*=\s*\{([^}]+)\}`
83
- - CommonJS single: `module\.exports\s*=\s*(\w+)\s*[;\n]`
84
- - TypeScript: `export\s+(?:type|interface)\s+(\w+)`
85
-
86
- 3. Extract imports using these patterns:
87
- - ES6: `import\s+(?:\{[^}]*\}|\*\s+as\s+\w+|\w+)\s+from\s+['"]([^'"]+)['"]`
88
- - Side-effect: `import\s+['"]([^'"]+)['"]` (not preceded by 'from')
89
- - CommonJS: `require\s*\(\s*['"]([^'"]+)['"]\s*\)`
90
-
91
- 4. Store in index:
92
- ```javascript
93
- index.files[absolutePath] = {
94
- exports: [], // Array of export names
95
- imports: [], // Array of import sources
96
- indexed: Date.now()
97
- }
98
- ```
99
-
100
- ## Step 4: Detect conventions
101
-
102
- Analyze the collected index for patterns.
103
-
104
- **Naming conventions** (require 5+ exports, 70%+ match rate):
105
- - camelCase: `^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]+)+$` or single lowercase `^[a-z][a-z0-9]*$`
106
- - PascalCase: `^[A-Z][a-z0-9]+(?:[A-Z][a-z0-9]+)*$` or single `^[A-Z][a-z0-9]+$`
107
- - snake_case: `^[a-z][a-z0-9]*(?:_[a-z0-9]+)+$`
108
- - SCREAMING_SNAKE: `^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$` or single `^[A-Z][A-Z0-9]*$`
109
- - Skip 'default' when counting (it's a keyword, not naming convention)
110
-
111
- **Directory patterns** (use lookup table):
112
- ```
113
- components -> UI components
114
- hooks -> React/custom hooks
115
- utils, lib -> Utility functions
116
- services -> Service layer
117
- api, routes -> API endpoints
118
- types -> TypeScript types
119
- models -> Data models
120
- tests, __tests__, test, spec -> Test files
121
- controllers -> Controllers
122
- middleware -> Middleware
123
- config -> Configuration
124
- constants -> Constants
125
- pages -> Page components
126
- views -> View templates
127
- ```
128
-
129
- **Suffix patterns** (require 5+ occurrences):
130
- ```
131
- .test.*, .spec.* -> Test files
132
- .service.* -> Service layer
133
- .controller.* -> Controllers
134
- .model.* -> Data models
135
- .util.*, .utils.* -> Utility functions
136
- .helper.*, .helpers.* -> Helper functions
137
- .config.* -> Configuration
138
- .types.*, .type.* -> TypeScript types
139
- .hook.*, .hooks.* -> React/custom hooks
140
- .context.* -> React context
141
- .store.* -> State store
142
- .slice.* -> Redux slice
143
- .reducer.* -> Redux reducer
144
- .action.*, .actions.* -> Redux actions
145
- .api.* -> API layer
146
- .route.*, .routes.* -> Route definitions
147
- .middleware.* -> Middleware
148
- .schema.* -> Schema definitions
149
- .mock.*, .mocks.* -> Mock data
150
- .fixture.*, .fixtures.* -> Test fixtures
151
- ```
152
-
153
- ## Step 5: Write index.json
154
-
155
- Write to `.planning/intel/index.json`:
156
- ```javascript
157
- {
158
- "version": 1,
159
- "updated": 1737360330000,
160
- "files": {
161
- "/absolute/path/to/file.js": {
162
- "exports": ["functionA", "ClassB"],
163
- "imports": ["react", "./utils"],
164
- "indexed": 1737360330000
165
- }
166
- }
167
- }
168
- ```
169
-
170
- ## Step 6: Write conventions.json
171
-
172
- Write to `.planning/intel/conventions.json`:
173
- ```javascript
174
- {
175
- "version": 1,
176
- "updated": 1737360330000,
177
- "naming": {
178
- "exports": {
179
- "dominant": "camelCase",
180
- "count": 42,
181
- "percentage": 85
182
- }
183
- },
184
- "directories": {
185
- "components": { "purpose": "UI components", "files": 15 },
186
- "hooks": { "purpose": "React/custom hooks", "files": 8 }
187
- },
188
- "suffixes": {
189
- ".test.js": { "purpose": "Test files", "count": 12 }
190
- }
191
- }
192
- ```
193
-
194
- ## Step 7: Generate summary.md
195
-
196
- Write to `.planning/intel/summary.md`:
197
-
198
- ```markdown
199
- # Codebase Intelligence Summary
200
-
201
- Last updated: [ISO timestamp]
202
- Indexed files: [N]
203
-
204
- ## Naming Conventions
205
-
206
- - Export naming: [case] ([percentage]% of [count] exports)
207
-
208
- ## Key Directories
209
-
210
- - `[dir]/`: [purpose] ([N] files)
211
- - ... (top 5)
212
-
213
- ## File Patterns
214
-
215
- - `*[suffix]`: [purpose] ([count] files)
216
- - ... (top 3)
217
-
218
- Total exports: [N]
219
- ```
220
-
221
- Target: < 500 tokens. Keep concise for context injection.
222
-
223
- ## Step 8: Report completion
224
-
225
- Display summary statistics:
226
-
227
- ```
228
- Codebase Analysis Complete
229
-
230
- Files indexed: [N]
231
- Exports found: [N]
232
- Imports found: [N]
233
-
234
- Conventions detected:
235
- - Naming: [dominant case] ([percentage]%)
236
- - Directories: [list]
237
- - Patterns: [list]
238
-
239
- Files created:
240
- - .planning/intel/index.json
241
- - .planning/intel/conventions.json
242
- - .planning/intel/summary.md
243
- ```
244
-
245
- ## Step 9: Generate semantic entities (optional)
246
-
247
- Generate entity files that capture semantic understanding of key files. These provide PURPOSE, not just syntax.
248
-
249
- **Skip this step if:** User only wants the index, or codebase has < 10 files.
250
-
251
- ### 9.1 Create entities directory
252
-
253
- ```bash
254
- mkdir -p .planning/intel/entities
255
- ```
256
-
257
- ### 9.2 Select files for entity generation
258
-
259
- Select up to 50 files based on these criteria (in priority order):
260
-
261
- 1. **High-export files:** 3+ exports (likely core modules)
262
- 2. **Hub files:** Referenced by 5+ other files (via imports analysis)
263
- 3. **Key directories:** Entry points (index.js, main.js, app.js), config files
264
- 4. **Structural files:** Files matching convention patterns (services, controllers, models)
265
-
266
- From the index.json, identify candidates and limit to 50 files maximum per run.
267
-
268
- ### 9.3 Generate entities via Task tool batching
269
-
270
- Process selected files in **batches of 10** using the Task tool to spawn subagents.
271
-
272
- For each batch, spawn a Task with this instruction:
273
-
274
- ```
275
- Generate semantic entity files for these source files:
276
- [list of 10 absolute file paths]
277
-
278
- For each file:
279
- 1. Read the file content
280
- 2. Write an entity markdown file to .planning/intel/entities/
281
-
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
287
-
288
- Entity template:
289
- ---
290
- source: [absolute path]
291
- indexed: [ISO timestamp]
292
- ---
293
-
294
- # [filename]
295
-
296
- ## Purpose
297
-
298
- [1-2 sentences: What does this file DO? Why does it exist? What problem does it solve?]
299
-
300
- ## Exports
301
-
302
- | Name | Type | Purpose |
303
- |------|------|---------|
304
- | [export] | [function/class/const/type] | [what it does] |
305
-
306
- ## Dependencies
307
-
308
- | Import | Purpose |
309
- |--------|---------|
310
- | [import source] | [why this file needs it] |
311
-
312
- ## Used By
313
-
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"]
315
-
316
- ---
317
-
318
- Focus on PURPOSE and semantic understanding, not just listing syntax.
319
- ```
320
-
321
- ### 9.4 Verify entity generation
322
-
323
- After all batches complete:
324
-
325
- ```bash
326
- ls .planning/intel/entities/*.md | wc -l
327
- ```
328
-
329
- Confirm entity count matches expected file count.
330
-
331
- ### 9.5 Report entity statistics
332
-
333
- ```
334
- Entity Generation Complete
335
-
336
- Entity files created: [N]
337
- Location: .planning/intel/entities/
338
-
339
- Batches processed: [N]
340
- Files per batch: 10
341
-
342
- Next: Intel hooks will continue incremental learning as you code.
343
- ```
344
-
345
- </process>
346
-
347
- <output>
348
- - .planning/intel/index.json - File index with exports and imports
349
- - .planning/intel/conventions.json - Detected naming and structural patterns
350
- - .planning/intel/summary.md - Concise summary for context injection
351
- - .planning/intel/entities/*.md - Semantic entity files (optional, Step 9)
352
- </output>
353
-
354
- <success_criteria>
355
- - [ ] .planning/intel/ directory created
356
- - [ ] All JS/TS files scanned (excluding node_modules, dist, build, .git, vendor, coverage)
357
- - [ ] index.json populated with exports and imports for each file
358
- - [ ] conventions.json has detected patterns (naming, directories, suffixes)
359
- - [ ] summary.md is concise (< 500 tokens)
360
- - [ ] Statistics reported to user
361
- - [ ] Entity files generated for key files (if Step 9 executed)
362
- - [ ] Entity files contain Purpose section with semantic understanding
363
- </success_criteria>
@@ -1,128 +0,0 @@
1
- ---
2
- name: gsd:query-intel
3
- description: Query codebase intelligence graph for dependencies and hotspots
4
- argument-hint: "<dependents|hotspots> [file-path]"
5
- allowed-tools:
6
- - Bash
7
- ---
8
-
9
- <objective>
10
- Query the codebase intelligence graph database for relationship information.
11
-
12
- **Query types:**
13
- - `dependents <file>` — What files depend on this file? (blast radius)
14
- - `hotspots` — Which files have the most dependents? (change carefully)
15
-
16
- Output: Formatted query results from graph.db
17
- </objective>
18
-
19
- <context>
20
- This command exposes the graph query capabilities built by Phase 4 (Semantic Intelligence).
21
-
22
- **Use for:**
23
- - Checking blast radius before refactoring a core file
24
- - Identifying high-impact files that need careful changes
25
- - Understanding dependency relationships in the codebase
26
-
27
- **Requires:** `.planning/intel/graph.db` (created by `/gsd:analyze-codebase` with entity generation)
28
-
29
- If graph.db doesn't exist, the command will return an error suggesting to run analyze-codebase first.
30
- </context>
31
-
32
- <process>
33
-
34
- ## Step 1: Parse arguments
35
-
36
- Extract query type and optional file path from arguments.
37
-
38
- **Arguments:** $ARGUMENTS
39
-
40
- **Expected formats:**
41
- - `dependents src/lib/db.ts` — query what depends on this file
42
- - `hotspots` — query most-depended-on files
43
- - `hotspots 10` — query top 10 hotspots (default: 5)
44
-
45
- ## Step 2: Convert file path to entity ID
46
-
47
- For `dependents` queries, convert the file path to entity ID format:
48
- - `src/lib/db.ts` → `src-lib-db`
49
- - Replace `/` with `-`, remove extension
50
-
51
- ```bash
52
- # Example conversion
53
- FILE_PATH="src/lib/db.ts"
54
- ENTITY_ID=$(echo "$FILE_PATH" | sed 's/\.[^.]*$//' | tr '/' '-')
55
- ```
56
-
57
- ## Step 3: Execute query
58
-
59
- Run the appropriate query against the graph database:
60
-
61
- **For dependents:**
62
- ```bash
63
- echo '{"action":"query","type":"dependents","target":"'$ENTITY_ID'","limit":20}' | node hooks/gsd-intel-index.js
64
- ```
65
-
66
- **For hotspots:**
67
- ```bash
68
- echo '{"action":"query","type":"hotspots","limit":5}' | node hooks/gsd-intel-index.js
69
- ```
70
-
71
- ## Step 4: Format and present results
72
-
73
- Parse the JSON response and present in readable format.
74
-
75
- **For dependents:**
76
- ```
77
- ## Files that depend on {file-path}
78
-
79
- Found {count} dependents:
80
-
81
- 1. src/api/users.ts
82
- 2. src/api/auth.ts
83
- 3. src/services/payment.ts
84
- ...
85
-
86
- **Blast radius:** {count} files would be affected by changes.
87
- ```
88
-
89
- **For hotspots:**
90
- ```
91
- ## Dependency Hotspots
92
-
93
- These files have the most dependents — change carefully:
94
-
95
- | Rank | File | Dependents |
96
- |------|------|------------|
97
- | 1 | src/lib/db.ts | 42 |
98
- | 2 | src/types/user.ts | 35 |
99
- | 3 | src/utils/format.ts | 28 |
100
- ```
101
-
102
- ## Step 5: Handle errors
103
-
104
- **If graph.db doesn't exist:**
105
- ```
106
- No graph database found at .planning/intel/graph.db
107
-
108
- Run /gsd:analyze-codebase first to build the dependency graph.
109
- ```
110
-
111
- **If entity not found:**
112
- ```
113
- No entity found for: {file-path}
114
-
115
- The file may not be indexed yet. Try:
116
- - /gsd:analyze-codebase to rebuild the index
117
- - Check the file path is correct
118
- ```
119
-
120
- </process>
121
-
122
- <success_criteria>
123
- - [ ] Query type parsed from arguments
124
- - [ ] File path converted to entity ID (for dependents)
125
- - [ ] Query executed against graph.db
126
- - [ ] Results formatted in readable markdown
127
- - [ ] Errors handled gracefully with helpful messages
128
- </success_criteria>
@@ -1,173 +0,0 @@
1
- # Entity Template
2
-
3
- Template for `.planning/codebase/{entity-slug}.md` - file-level intelligence documentation.
4
-
5
- ---
6
-
7
- ## File Template
8
-
9
- ```markdown
10
- ---
11
- path: {path}
12
- type: {type}
13
- updated: {updated}
14
- status: {status}
15
- ---
16
-
17
- # {filename}
18
-
19
- ## Purpose
20
-
21
- {purpose}
22
-
23
- ## Exports
24
-
25
- {exports}
26
-
27
- ## Dependencies
28
-
29
- {dependencies}
30
-
31
- ## Used By
32
-
33
- {used_by}
34
-
35
- ## Notes
36
-
37
- {notes}
38
- ```
39
-
40
- ---
41
-
42
- ## Field Reference
43
-
44
- ### Frontmatter
45
-
46
- | Field | Values | Description |
47
- |-------|--------|-------------|
48
- | `path` | Absolute path | Full path to the file |
49
- | `type` | module, component, util, config, test, api, hook | Primary classification |
50
- | `updated` | YYYY-MM-DD | Last time this entity was updated |
51
- | `status` | active, deprecated, stub | Current state |
52
-
53
- ### Sections
54
-
55
- **Purpose** (required)
56
- 1-3 sentences covering:
57
- - What this file does
58
- - Why it exists
59
- - Who/what uses it (high-level)
60
-
61
- **Exports** (required for modules with exports)
62
- List each export with signature and description:
63
- ```markdown
64
- - `functionName(arg: Type): ReturnType` - What it does
65
- - `ClassName` - What it represents
66
- - `CONSTANT_NAME` - What value it holds
67
- ```
68
-
69
- For files without exports (config, tests), write "None" or describe what the file defines.
70
-
71
- **Dependencies** (required)
72
- Internal dependencies use wiki-links (slugified paths):
73
- ```markdown
74
- - [[src-lib-db]] - Database client
75
- - [[src-types-user]] - User type definitions
76
- ```
77
-
78
- External dependencies use plain text:
79
- ```markdown
80
- - react - Component framework
81
- - jose - JWT handling
82
- ```
83
-
84
- **Used By** (grows over time)
85
- Files that import this one, using wiki-links:
86
- ```markdown
87
- - [[src-app-api-auth-route]]
88
- - [[src-components-dashboard]]
89
- ```
90
-
91
- Initially may be empty or incomplete. Updated as Claude encounters imports.
92
-
93
- **Notes** (optional)
94
- Patterns, gotchas, or context:
95
- ```markdown
96
- - Uses singleton pattern for connection pooling
97
- - WARNING: Must call `init()` before any other method
98
- - Related: See [[src-lib-cache]] for caching layer
99
- ```
100
-
101
- ---
102
-
103
- ## Slug Convention
104
-
105
- Entity slugs are derived from file paths:
106
- - `src/lib/db.ts` becomes `src-lib-db`
107
- - `src/app/api/auth/route.ts` becomes `src-app-api-auth-route`
108
-
109
- Rule: Replace `/` and `.` with `-`, drop file extension.
110
-
111
- ---
112
-
113
- ## Example
114
-
115
- ```markdown
116
- ---
117
- path: /project/src/lib/auth.ts
118
- type: util
119
- updated: 2025-01-15
120
- status: active
121
- ---
122
-
123
- # auth.ts
124
-
125
- ## Purpose
126
-
127
- JWT token management using jose library. Handles token creation, verification, and refresh rotation. Used by all protected API routes via middleware.
128
-
129
- ## Exports
130
-
131
- - `createAccessToken(userId: string): Promise<string>` - Creates 15-min access token
132
- - `createRefreshToken(userId: string): Promise<string>` - Creates 7-day refresh token
133
- - `verifyToken(token: string): Promise<TokenPayload>` - Validates and decodes token
134
- - `rotateRefresh(oldToken: string): Promise<TokenPair>` - Issues new token pair
135
-
136
- ## Dependencies
137
-
138
- - [[src-lib-db]] - Stores refresh tokens for revocation
139
- - [[src-types-auth]] - TokenPayload, TokenPair types
140
- - jose - JWT signing and verification
141
- - bcrypt - Password hashing
142
-
143
- ## Used By
144
-
145
- - [[src-middleware]]
146
- - [[src-app-api-auth-login-route]]
147
- - [[src-app-api-auth-logout-route]]
148
- - [[src-app-api-auth-refresh-route]]
149
-
150
- ## Notes
151
-
152
- - Access tokens are stateless; refresh tokens stored in DB for revocation
153
- - Uses RS256 algorithm with keys from environment
154
- - WARNING: Never log token values, even in debug mode
155
- ```
156
-
157
- ---
158
-
159
- ## Guidelines
160
-
161
- **When to create/update:**
162
- - After modifying a file during plan execution
163
- - When encountering a file that lacks documentation
164
- - When relationships change (new imports, exports)
165
-
166
- **Minimal viable entity:**
167
- At minimum, an entity needs frontmatter + Purpose. Other sections can be "TBD" if unknown.
168
-
169
- **Accuracy over completeness:**
170
- Better to have partial accurate info than complete guesses. Mark unknowns explicitly.
171
-
172
- **Link discovery:**
173
- The hook that processes entities extracts all `[[wiki-links]]` to build the relationship graph. Ensure links use correct slug format.