tlc-claude-code 2.6.1 → 2.7.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.
@@ -22,7 +22,24 @@ Run a comprehensive audit of the codebase against TLC coding standards.
22
22
  /tlc:audit
23
23
  ```
24
24
 
25
- ## Process
25
+ ## CodeDB Acceleration
26
+
27
+ When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
28
+
29
+ Use the broadest CodeDB query that covers the audit pass before reading files manually.
30
+
31
+ | Tool | Usage |
32
+ |------|-------|
33
+ | `codedb_tree` | Analyze folder structure, including file counts per folder and nesting depth. |
34
+ | `codedb_search` | Scan for violation patterns such as hardcoded URLs `https?://`, magic strings, and `process.env` usage outside config. |
35
+ | `codedb_symbol` | Check JSDoc coverage on exported functions before doing line-by-line review. |
36
+ | `codedb_bundle` | Batch the audit checks into one call to reduce repeated repository scans. |
37
+
38
+ Use CodeDB results to narrow any follow-up reads to the specific files or folders with likely violations.
39
+
40
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
41
+
42
+ ## Process
26
43
 
27
44
  ### Step 1: Load Audit Module
28
45
 
@@ -145,7 +145,23 @@ The existing autofix instructions below are the Inline Mode instructions and sho
145
145
  /tlc:autofix
146
146
  ```
147
147
 
148
- ## Process
148
+ ## CodeDB Acceleration
149
+
150
+ When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
151
+
152
+ Use CodeDB to narrow the failing area before opening files or proposing a fix.
153
+
154
+ | Tool | Usage |
155
+ |------|-------|
156
+ | `codedb_symbol` | Find test function definitions quickly for the failing cases. |
157
+ | `codedb_deps` | Trace imports and dependents of the broken module before editing. |
158
+ | `codedb_hot` | Focus repair work on recently modified files that likely caused the failure. |
159
+
160
+ Use these results to choose the smallest verified fix path before rerunning tests.
161
+
162
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
163
+
164
+ ## Process
149
165
 
150
166
  ### Step 1: Run Tests
151
167
 
@@ -395,6 +395,22 @@ This is the core TLC command. Tests before code, one task at a time.
395
395
  /tlc:build <phase_number> --agents 5 # Limit parallel agents to 5
396
396
  ```
397
397
 
398
+ ## CodeDB Acceleration
399
+
400
+ When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
401
+
402
+ Use CodeDB to inspect nearby code and conventions before creating files or implementing the next step.
403
+
404
+ | Tool | Usage |
405
+ |------|-------|
406
+ | `codedb_outline` | Inspect files adjacent to the task area for existing patterns, exports, and interfaces. |
407
+ | `codedb_search` | Find similar implementations to follow as the reference path for new work. |
408
+ | `codedb_tree` | Verify the target directory structure before creating or moving files. |
409
+
410
+ Use these queries to keep new work aligned with surrounding modules and repository layout.
411
+
412
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
413
+
398
414
  ## Process
399
415
 
400
416
  ### Step 0: Create Phase Branch (Mandatory)
@@ -138,6 +138,22 @@ The existing coverage instructions below are the Inline Mode instructions and sh
138
138
  - When joining a project to understand test gaps
139
139
  - After "vibe coding" a feature without tests
140
140
 
141
+ ## CodeDB Acceleration
142
+
143
+ When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
144
+
145
+ Prefer a single batched pass to map source files, test files, and exported surfaces before deeper inspection.
146
+
147
+ | Tool | Usage |
148
+ |------|-------|
149
+ | `codedb_tree` | Identify all source files and test files across the repository. |
150
+ | `codedb_outline` | Find exported functions and signatures per file to compare against existing tests. |
151
+ | `codedb_bundle` | Batch the tree and outline queries into one call for faster coverage mapping. |
152
+
153
+ Use the returned file and symbol lists to focus manual review on untested or high-risk modules.
154
+
155
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
156
+
141
157
  ## Process
142
158
 
143
159
  ### 1. Detect Test Framework
@@ -149,6 +149,21 @@ This command is not a blank-page brainstorming prompt. The agent should do the i
149
149
 
150
150
  If no phase number, auto-detect current phase from `.planning/ROADMAP.md`.
151
151
 
152
+ ## CodeDB Acceleration
153
+
154
+ When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
155
+
156
+ Use structure and module outlines to ground the discussion in the code that the current phase actually touches.
157
+
158
+ | Tool | Usage |
159
+ |------|-------|
160
+ | `codedb_outline` | Inspect modules relevant to the phase being discussed, including exports and interfaces. |
161
+ | `codedb_tree` | Understand folder organization in the affected area before making recommendations. |
162
+
163
+ Use CodeDB output to support tradeoff analysis and keep the discussion tied to concrete files.
164
+
165
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
166
+
152
167
  ## Process
153
168
 
154
169
  ### Step 1: Scan Context First
@@ -166,6 +166,25 @@ After observability scaffolding, inspect the project's CI/CD posture:
166
166
  - Report: `"CI/CD OK"`
167
167
  - Include detected platform and workflow file paths in the summary
168
168
 
169
+ ### 6b. Register CodeDB MCP Server
170
+
171
+ If `codedb` is installed (`command -v codedb`), create `.mcp.json` in the project root (if it doesn't already exist):
172
+
173
+ ```json
174
+ {
175
+ "mcpServers": {
176
+ "codedb": {
177
+ "command": "codedb",
178
+ "args": ["mcp", "."]
179
+ }
180
+ }
181
+ }
182
+ ```
183
+
184
+ This gives Claude Code sub-millisecond code search, symbol lookup, and project tree — 1600x fewer tokens than grep/read.
185
+
186
+ If `codedb` is not installed, skip silently (it's optional infrastructure from tlc-core).
187
+
169
188
  ### 7. If Tests Already Exist
170
189
 
171
190
  - Skip framework setup
@@ -173,6 +173,21 @@ The existing planning instructions below are the Inline Mode instructions and sh
173
173
 
174
174
  If no phase number, auto-detect current phase from ROADMAP.md.
175
175
 
176
+ ## CodeDB Acceleration
177
+
178
+ When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
179
+
180
+ Start with structure and interface discovery before breaking work into tasks or estimating scope.
181
+
182
+ | Tool | Usage |
183
+ |------|-------|
184
+ | `codedb_tree` | Understand the project structure before creating the task breakdown. |
185
+ | `codedb_outline` | Inspect key modules for existing patterns, exports, and interfaces to follow. |
186
+
187
+ Use the CodeDB snapshot to anchor the plan in the actual repository layout instead of assumptions.
188
+
189
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
190
+
176
191
  ## Process
177
192
 
178
193
  ### Step 1: Load Context
@@ -15,6 +15,22 @@ It also runs:
15
15
  - After any multi-file change
16
16
  - Before recommending a commit or push
17
17
 
18
+ ## CodeDB Acceleration
19
+
20
+ When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
21
+
22
+ Use dependency and recency data first so the completeness check covers the full blast radius of recent edits.
23
+
24
+ | Tool | Usage |
25
+ |------|-------|
26
+ | `codedb_deps` | Find all files that import or otherwise reference the changed modules. |
27
+ | `codedb_hot` | Identify recently changed files that should be treated as the primary focus area. |
28
+ | `codedb_search` | Verify registration patterns such as command arrays, route tables, and exports. |
29
+
30
+ Use the results to confirm registry updates, parallel-system changes, and downstream references before declaring done.
31
+
32
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
33
+
18
34
  ## Process
19
35
 
20
36
  ### Step 1: Inventory What Was Changed
@@ -17,7 +17,23 @@ Same fixes as `/tlc:cleanup` but:
17
17
  /tlc:refactor
18
18
  ```
19
19
 
20
- ## Process
20
+ ## CodeDB Acceleration
21
+
22
+ When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
23
+
24
+ Use symbol, usage, and dependency lookups before editing so each refactor step accounts for its full impact.
25
+
26
+ | Tool | Usage |
27
+ |------|-------|
28
+ | `codedb_symbol` | Find all definitions of the symbols being refactored. |
29
+ | `codedb_word` | Find all usages of identifiers across the codebase before renaming or extracting them. |
30
+ | `codedb_deps` | Trace the file-level impact of moves so imports and references stay consistent. |
31
+
32
+ Use the CodeDB output to build safer preview steps and reduce missed follow-up edits.
33
+
34
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
35
+
36
+ ## Process
21
37
 
22
38
  ### Step 1: Create or Resume Session
23
39
 
@@ -174,6 +174,22 @@ TLC automatically uses ALL providers configured for the `review` capability in `
174
174
  /tlc:review --base dev # Review vs different base branch
175
175
  ```
176
176
 
177
+ ## CodeDB Acceleration
178
+
179
+ When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
180
+
181
+ Run the security and change-impact queries early so the manual review starts from the highest-risk files.
182
+
183
+ | Tool | Usage |
184
+ |------|-------|
185
+ | `codedb_search` | Scan for security patterns such as credentials, SQL injection, XSS, and `eval`. |
186
+ | `codedb_deps` | Check whether changed files have unreviewed dependents elsewhere in the codebase. |
187
+ | `codedb_hot` | Identify recently changed files that deserve extra review focus. |
188
+
189
+ Use these results to prioritize findings, coverage checks, and any follow-up file reads.
190
+
191
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
192
+
177
193
  ## Process
178
194
 
179
195
  ### Step 1: Load Router State (Persistent)
@@ -72,6 +72,30 @@ else
72
72
  fi
73
73
  fi
74
74
 
75
+ # ─── CodeDB (codebase awareness) ─────────────────────
76
+ if command -v codedb >/dev/null 2>&1; then
77
+ if curl -sf --max-time 1 "http://localhost:7719/health" > /dev/null 2>&1; then
78
+ echo "codedb: running"
79
+ else
80
+ codedb serve "$PROJECT_DIR" > /dev/null 2>&1 &
81
+ echo "codedb: started indexing $PROJECT_DIR"
82
+ fi
83
+ # Ensure .mcp.json exists for Claude Code MCP discovery
84
+ if [ ! -f "$PROJECT_DIR/.mcp.json" ]; then
85
+ cat > "$PROJECT_DIR/.mcp.json" <<'MCPEOF'
86
+ {
87
+ "mcpServers": {
88
+ "codedb": {
89
+ "command": "codedb",
90
+ "args": ["mcp", "."]
91
+ }
92
+ }
93
+ }
94
+ MCPEOF
95
+ echo "codedb: created .mcp.json"
96
+ fi
97
+ fi
98
+
75
99
  # ─── Memory System Init ─────────────────────────────
76
100
  mkdir -p "$PROJECT_DIR/.tlc/memory/team/decisions" \
77
101
  "$PROJECT_DIR/.tlc/memory/team/gotchas" \
package/CLAUDE.md CHANGED
@@ -11,6 +11,20 @@
11
11
  5. **No Co-Authored-By in commits.** The user is the author. Claude is a tool.
12
12
  6. **Ask before `git push`.** Never push without explicit approval.
13
13
 
14
+ ## CodeDB
15
+
16
+ When `.mcp.json` contains a `codedb` server entry, prefer CodeDB MCP tools over built-in equivalents:
17
+
18
+ | Prefer | Instead of | Use for |
19
+ |--------|------------|---------|
20
+ | `codedb_tree` | Glob | file/folder discovery |
21
+ | `codedb_search` / `codedb_word` | Grep | text/identifier search |
22
+ | `codedb_outline` | Read | understanding file structure (symbols, exports) |
23
+ | `codedb_deps` | manual import tracing | reverse dependency analysis |
24
+ | `codedb_bundle` | multiple separate calls | batch multiple queries into one call (up to 20 ops) |
25
+
26
+ If CodeDB MCP tools are not available (no `.mcp.json` or server unreachable), fall back to built-in Grep/Glob/Read.
27
+
14
28
  ## Command Dispatch
15
29
 
16
30
  When the user says X → invoke `Skill(skill="tlc:...")`:
package/bin/install.js CHANGED
@@ -190,6 +190,9 @@ function install(targetDir, installType) {
190
190
  success(`Installed settings template with hook wiring`);
191
191
  }
192
192
 
193
+ // Install CodeDB (codebase awareness — sub-ms code search, 1600x token reduction)
194
+ installCodedb();
195
+
193
196
  // Fix ownership if running under sudo
194
197
  if (isRunningAsSudo()) {
195
198
  const claudeDir = path.dirname(targetDir);
@@ -215,6 +218,69 @@ function install(targetDir, installType) {
215
218
  log('');
216
219
  }
217
220
 
221
+ function installCodedb() {
222
+ const { execSync } = require('child_process');
223
+
224
+ // Check if already installed
225
+ try {
226
+ const version = execSync('codedb --version', { encoding: 'utf8', stdio: 'pipe' }).trim();
227
+ success(`CodeDB already installed: ${c.cyan}${version}${c.reset}`);
228
+ return;
229
+ } catch {
230
+ // Not installed — continue
231
+ }
232
+
233
+ log(`Installing ${c.cyan}CodeDB${c.reset} (codebase awareness)...`);
234
+
235
+ const platform = process.platform;
236
+ const arch = process.arch;
237
+
238
+ let asset;
239
+ if (platform === 'darwin' && arch === 'arm64') {
240
+ asset = 'codedb-darwin-arm64';
241
+ } else if (platform === 'linux' && arch === 'x64') {
242
+ asset = 'codedb-linux-x86_64';
243
+ } else {
244
+ log(`${c.yellow}CodeDB: no binary for ${platform}-${arch}. Skipping.${c.reset}`);
245
+ return;
246
+ }
247
+
248
+ const url = `https://github.com/justrach/codedb/releases/download/v0.2.4/${asset}`;
249
+
250
+ // Find writable bin directory
251
+ const binDirs = [
252
+ '/opt/homebrew/bin',
253
+ '/usr/local/bin',
254
+ path.join(process.env.HOME || '/root', '.local', 'bin'),
255
+ ];
256
+
257
+ let targetBin;
258
+ for (const dir of binDirs) {
259
+ try {
260
+ fs.mkdirSync(dir, { recursive: true });
261
+ fs.accessSync(dir, fs.constants.W_OK);
262
+ targetBin = path.join(dir, 'codedb');
263
+ break;
264
+ } catch {
265
+ continue;
266
+ }
267
+ }
268
+
269
+ if (!targetBin) {
270
+ log(`${c.yellow}CodeDB: no writable bin directory found. Install manually: curl -fsSL https://codedb.codegraff.com/install.sh | sh${c.reset}`);
271
+ return;
272
+ }
273
+
274
+ try {
275
+ execSync(`curl -fsSL -o "${targetBin}" "${url}"`, { stdio: 'pipe' });
276
+ fs.chmodSync(targetBin, 0o755);
277
+ const version = execSync(`"${targetBin}" --version`, { encoding: 'utf8', stdio: 'pipe' }).trim();
278
+ success(`CodeDB installed: ${c.cyan}${version}${c.reset} at ${c.dim}${targetBin}${c.reset}`);
279
+ } catch (err) {
280
+ log(`${c.yellow}CodeDB: install failed (${err.message}). Install manually: curl -fsSL https://codedb.codegraff.com/install.sh | sh${c.reset}`);
281
+ }
282
+ }
283
+
218
284
  function installHooks(targetDir, packageRoot) {
219
285
  // For local install: .claude/commands -> go up to .claude/hooks
220
286
  // For global install: ~/.claude/commands -> go up to ~/.claude/hooks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tlc-claude-code",
3
- "version": "2.6.1",
3
+ "version": "2.7.0",
4
4
  "description": "TLC - Test Led Coding for Claude Code",
5
5
  "bin": {
6
6
  "tlc-claude-code": "./bin/install.js",