@exero1/claudecontext 0.1.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 +286 -0
- package/dist/installer/install.d.ts +12 -0
- package/dist/installer/install.d.ts.map +1 -0
- package/dist/installer/install.js +714 -0
- package/dist/installer/install.js.map +1 -0
- package/dist/src/cache/budget.d.ts +48 -0
- package/dist/src/cache/budget.d.ts.map +1 -0
- package/dist/src/cache/budget.js +55 -0
- package/dist/src/cache/budget.js.map +1 -0
- package/dist/src/cache/compressor.d.ts +21 -0
- package/dist/src/cache/compressor.d.ts.map +1 -0
- package/dist/src/cache/compressor.js +89 -0
- package/dist/src/cache/compressor.js.map +1 -0
- package/dist/src/cache/levels.d.ts +16 -0
- package/dist/src/cache/levels.d.ts.map +1 -0
- package/dist/src/cache/levels.js +41 -0
- package/dist/src/cache/levels.js.map +1 -0
- package/dist/src/cache/manager.d.ts +38 -0
- package/dist/src/cache/manager.d.ts.map +1 -0
- package/dist/src/cache/manager.js +196 -0
- package/dist/src/cache/manager.js.map +1 -0
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +279 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/detection/areas.d.ts +13 -0
- package/dist/src/detection/areas.d.ts.map +1 -0
- package/dist/src/detection/areas.js +96 -0
- package/dist/src/detection/areas.js.map +1 -0
- package/dist/src/detection/task.d.ts +28 -0
- package/dist/src/detection/task.d.ts.map +1 -0
- package/dist/src/detection/task.js +77 -0
- package/dist/src/detection/task.js.map +1 -0
- package/dist/src/gating/gate.d.ts +38 -0
- package/dist/src/gating/gate.d.ts.map +1 -0
- package/dist/src/gating/gate.js +74 -0
- package/dist/src/gating/gate.js.map +1 -0
- package/dist/src/graph/edges.d.ts +41 -0
- package/dist/src/graph/edges.d.ts.map +1 -0
- package/dist/src/graph/edges.js +115 -0
- package/dist/src/graph/edges.js.map +1 -0
- package/dist/src/graph/indexer.d.ts +38 -0
- package/dist/src/graph/indexer.d.ts.map +1 -0
- package/dist/src/graph/indexer.js +228 -0
- package/dist/src/graph/indexer.js.map +1 -0
- package/dist/src/graph/traversal.d.ts +25 -0
- package/dist/src/graph/traversal.d.ts.map +1 -0
- package/dist/src/graph/traversal.js +173 -0
- package/dist/src/graph/traversal.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +82 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/indexing/codebase.d.ts +30 -0
- package/dist/src/indexing/codebase.d.ts.map +1 -0
- package/dist/src/indexing/codebase.js +127 -0
- package/dist/src/indexing/codebase.js.map +1 -0
- package/dist/src/markdown/writer.d.ts +34 -0
- package/dist/src/markdown/writer.d.ts.map +1 -0
- package/dist/src/markdown/writer.js +96 -0
- package/dist/src/markdown/writer.js.map +1 -0
- package/dist/src/server.d.ts +15 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +520 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/storage/db.d.ts +123 -0
- package/dist/src/storage/db.d.ts.map +1 -0
- package/dist/src/storage/db.js +318 -0
- package/dist/src/storage/db.js.map +1 -0
- package/dist/src/utils/glob.d.ts +11 -0
- package/dist/src/utils/glob.d.ts.map +1 -0
- package/dist/src/utils/glob.js +20 -0
- package/dist/src/utils/glob.js.map +1 -0
- package/hooks/post-write.mjs +57 -0
- package/hooks/pre-compact.mjs +44 -0
- package/hooks/pre-tool-use.mjs +87 -0
- package/hooks/session-start.mjs +54 -0
- package/package.json +51 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { buildBundle } from './cache/manager.js';
|
|
4
|
+
import { detectTask, taskFilePath, defaultTaskContent, taskFileExists } from './detection/task.js';
|
|
5
|
+
import { atomicWrite, safeRead, patchSection, readLastLines, ensureFile, appendLog } from './markdown/writer.js';
|
|
6
|
+
import { searchFiles, scoreFile } from './indexing/codebase.js';
|
|
7
|
+
import { estimateTokens } from './cache/budget.js';
|
|
8
|
+
import { indexFileImports, indexFileSubsystem } from './graph/indexer.js';
|
|
9
|
+
import { upsertBidirectionalEdge } from './graph/edges.js';
|
|
10
|
+
import { check } from './gating/gate.js';
|
|
11
|
+
import { join, resolve, relative } from 'node:path';
|
|
12
|
+
import { existsSync, statSync, readFileSync } from 'node:fs';
|
|
13
|
+
/**
|
|
14
|
+
* Register all 10 ClaudeContext MCP tools on the given server.
|
|
15
|
+
* Protocol: 2025-03-26 — tool annotations required.
|
|
16
|
+
* NEVER console.log() — stdout is the JSON-RPC channel.
|
|
17
|
+
*/
|
|
18
|
+
export function registerTools(server, db, config) {
|
|
19
|
+
const { projectRoot, stateDir, areas } = config;
|
|
20
|
+
// ── Budget config from .claudecontext/config.json (TICKET-016) ────────────
|
|
21
|
+
let budgetConfig;
|
|
22
|
+
const configPath = join(stateDir, 'config.json');
|
|
23
|
+
if (existsSync(configPath)) {
|
|
24
|
+
try {
|
|
25
|
+
const cfg = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
26
|
+
if (cfg.budgets && typeof cfg.budgets === 'object') {
|
|
27
|
+
budgetConfig = cfg.budgets;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch { /* use defaults on parse failure */ }
|
|
31
|
+
}
|
|
32
|
+
// ── Bundle cache (TICKET-011) ───────────────────────────────────────────────
|
|
33
|
+
const bundleCache = new Map();
|
|
34
|
+
let bundleCacheHits = 0;
|
|
35
|
+
let bundleCacheMisses = 0;
|
|
36
|
+
const BUNDLE_CACHE_TTL_MS = 60_000;
|
|
37
|
+
function safeStatMtime(path) {
|
|
38
|
+
try {
|
|
39
|
+
return statSync(path).mtimeMs;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// ── 1. context_detect_task ─────────────────────────────────────────────────
|
|
46
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
47
|
+
tools: [
|
|
48
|
+
{
|
|
49
|
+
name: 'context_detect_task',
|
|
50
|
+
description: 'Infer the active task from git branch + database. Returns task ID, branch, and whether a task file exists.',
|
|
51
|
+
inputSchema: { type: 'object', properties: {}, required: [] },
|
|
52
|
+
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'context_get_bundle',
|
|
56
|
+
description: 'Get the unified context bundle: hierarchical cache levels (L0–L4) + graph-discovered related files. Call this at the start of each session and after compaction.',
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
depth: {
|
|
61
|
+
type: 'number',
|
|
62
|
+
description: 'Graph traversal depth: 1 (default, 1-hop neighbors) or 3 (full BFS, V2 only)',
|
|
63
|
+
minimum: 1,
|
|
64
|
+
maximum: 4,
|
|
65
|
+
},
|
|
66
|
+
budget: {
|
|
67
|
+
type: 'number',
|
|
68
|
+
description: 'Override token budget (default: 27000)',
|
|
69
|
+
minimum: 1000,
|
|
70
|
+
maximum: 100000,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
required: [],
|
|
74
|
+
},
|
|
75
|
+
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'context_update_task',
|
|
79
|
+
description: 'Patch the active task file (L1). Use this when you make a decision, touch a new file, or resolve an open question.',
|
|
80
|
+
inputSchema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: {
|
|
83
|
+
taskId: { type: 'string', description: 'Task ID (omit to use detected active task)' },
|
|
84
|
+
section: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
enum: ['Goal', 'Files touched', 'Open questions', 'Decisions', 'Notes'],
|
|
87
|
+
description: 'Section to update',
|
|
88
|
+
},
|
|
89
|
+
content: { type: 'string', description: 'New content for the section' },
|
|
90
|
+
},
|
|
91
|
+
required: ['section', 'content'],
|
|
92
|
+
},
|
|
93
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'context_update_project',
|
|
97
|
+
description: 'Patch CLAUDE.md (L3 — project-level rules and conventions). Use sparingly — only for durable project-wide changes.',
|
|
98
|
+
inputSchema: {
|
|
99
|
+
type: 'object',
|
|
100
|
+
properties: {
|
|
101
|
+
section: { type: 'string', description: 'Section heading to patch' },
|
|
102
|
+
content: { type: 'string', description: 'New content for the section' },
|
|
103
|
+
},
|
|
104
|
+
required: ['section', 'content'],
|
|
105
|
+
},
|
|
106
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'context_search_codebase',
|
|
110
|
+
description: 'Search for files by query string. Returns ranked results boosted by graph neighbor relationships to the active task. Multi-word queries also search file contents via ripgrep.',
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
properties: {
|
|
114
|
+
query: { type: 'string', description: 'Search query (matches file paths; multi-word queries also search content)' },
|
|
115
|
+
limit: { type: 'number', description: 'Max results (default: 10)', minimum: 1, maximum: 50 },
|
|
116
|
+
searchContent: { type: 'boolean', description: 'Search file contents via ripgrep (defaults to true for multi-word queries)' },
|
|
117
|
+
},
|
|
118
|
+
required: ['query'],
|
|
119
|
+
},
|
|
120
|
+
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'context_status',
|
|
124
|
+
description: 'Show what context is currently loaded: token breakdown per level, edge counts by type, active task, graph age. Call this to show the user what Claude has in memory.',
|
|
125
|
+
inputSchema: { type: 'object', properties: {}, required: [] },
|
|
126
|
+
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'context_ingest_diff',
|
|
130
|
+
description: 'Record file writes in the graph (imports + co_modified edges) and L0 log. Call this after writing files to make graph updates visible immediately in context_get_bundle.',
|
|
131
|
+
inputSchema: {
|
|
132
|
+
type: 'object',
|
|
133
|
+
properties: {
|
|
134
|
+
files: {
|
|
135
|
+
type: 'array',
|
|
136
|
+
items: { type: 'string' },
|
|
137
|
+
description: 'Absolute or relative file paths (relative resolved from projectRoot)',
|
|
138
|
+
minItems: 1,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
required: ['files'],
|
|
142
|
+
},
|
|
143
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'context_gate',
|
|
147
|
+
description: 'Check whether a command or file path is safe to proceed. Returns allow/warn/deny with reason. Use before destructive or irreversible operations.',
|
|
148
|
+
inputSchema: {
|
|
149
|
+
type: 'object',
|
|
150
|
+
properties: {
|
|
151
|
+
input: { type: 'string', description: 'Command string or file path to check' },
|
|
152
|
+
context: { type: 'string', description: 'Optional: what you are about to do' },
|
|
153
|
+
},
|
|
154
|
+
required: ['input'],
|
|
155
|
+
},
|
|
156
|
+
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'context_ingest_test_results',
|
|
160
|
+
description: 'Record test run results into L0 log and (if failing) the active task file. Call this after running tests.',
|
|
161
|
+
inputSchema: {
|
|
162
|
+
type: 'object',
|
|
163
|
+
properties: {
|
|
164
|
+
passed: { type: 'number', description: 'Number of tests passed' },
|
|
165
|
+
failed: { type: 'number', description: 'Number of tests failed' },
|
|
166
|
+
skipped: { type: 'number', description: 'Number of tests skipped' },
|
|
167
|
+
summary: { type: 'string', description: 'One-line test result summary' },
|
|
168
|
+
failingTests: { type: 'array', items: { type: 'string' }, description: 'Names of failing tests (optional)' },
|
|
169
|
+
},
|
|
170
|
+
required: ['passed', 'failed', 'summary'],
|
|
171
|
+
},
|
|
172
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'context_log_event',
|
|
176
|
+
description: 'Write a structured event to the L0 working set log (NOTE, ERROR, DECISION, OBSERVATION). Use to record important observations that should survive compaction.',
|
|
177
|
+
inputSchema: {
|
|
178
|
+
type: 'object',
|
|
179
|
+
properties: {
|
|
180
|
+
event: { type: 'string', enum: ['NOTE', 'ERROR', 'DECISION', 'OBSERVATION'] },
|
|
181
|
+
content: { type: 'string', description: 'Event content (max 500 chars)', maxLength: 500 },
|
|
182
|
+
},
|
|
183
|
+
required: ['event', 'content'],
|
|
184
|
+
},
|
|
185
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
}));
|
|
189
|
+
// ── Tool handler ───────────────────────────────────────────────────────────
|
|
190
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
191
|
+
const { name, arguments: args } = request.params;
|
|
192
|
+
try {
|
|
193
|
+
switch (name) {
|
|
194
|
+
// ── context_detect_task ──────────────────────────────────────────────
|
|
195
|
+
case 'context_detect_task': {
|
|
196
|
+
const info = await detectTask(projectRoot);
|
|
197
|
+
const hasFile = taskFileExists(projectRoot, info.id);
|
|
198
|
+
return {
|
|
199
|
+
content: [{
|
|
200
|
+
type: 'text',
|
|
201
|
+
text: JSON.stringify({
|
|
202
|
+
taskId: info.id,
|
|
203
|
+
branch: info.branch,
|
|
204
|
+
isGit: info.isGit,
|
|
205
|
+
taskFileExists: hasFile,
|
|
206
|
+
taskFilePath: join(projectRoot, 'tasks', `${info.id}.md`),
|
|
207
|
+
}, null, 2),
|
|
208
|
+
}],
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
// ── context_get_bundle ───────────────────────────────────────────────
|
|
212
|
+
case 'context_get_bundle': {
|
|
213
|
+
const parsed = z.object({
|
|
214
|
+
depth: z.number().min(1).max(4).optional(),
|
|
215
|
+
budget: z.number().min(1000).max(100000).optional(),
|
|
216
|
+
}).parse(args ?? {});
|
|
217
|
+
const info = await detectTask(projectRoot);
|
|
218
|
+
// Auto-create task file if missing (ensureFile is idempotent — safe under concurrent access)
|
|
219
|
+
ensureFile(taskFilePath(projectRoot, info.id), defaultTaskContent(info.id, info.branch));
|
|
220
|
+
const depth = parsed.depth ?? 1;
|
|
221
|
+
const l0Mtime = safeStatMtime(join(stateDir, 'l0.log'));
|
|
222
|
+
const l1Mtime = safeStatMtime(taskFilePath(projectRoot, info.id));
|
|
223
|
+
const cacheKey = `${info.id}:${depth}:${l0Mtime}:${l1Mtime}`;
|
|
224
|
+
// Evict stale cache entries
|
|
225
|
+
for (const [k, v] of bundleCache) {
|
|
226
|
+
if (Date.now() - v.builtAt >= BUNDLE_CACHE_TTL_MS)
|
|
227
|
+
bundleCache.delete(k);
|
|
228
|
+
}
|
|
229
|
+
const cached = bundleCache.get(cacheKey);
|
|
230
|
+
if (cached && Date.now() - cached.builtAt < BUNDLE_CACHE_TTL_MS) {
|
|
231
|
+
bundleCacheHits++;
|
|
232
|
+
return { content: [{ type: 'text', text: cached.result.markdown }] };
|
|
233
|
+
}
|
|
234
|
+
bundleCacheMisses++;
|
|
235
|
+
const bundleOpts = {
|
|
236
|
+
projectRoot,
|
|
237
|
+
stateDir,
|
|
238
|
+
taskId: info.id,
|
|
239
|
+
taskBranch: info.branch,
|
|
240
|
+
areas,
|
|
241
|
+
depth,
|
|
242
|
+
...(parsed.budget !== undefined ? { budgetOverride: parsed.budget } : {}),
|
|
243
|
+
...(budgetConfig !== undefined ? { budgetConfig } : {}),
|
|
244
|
+
};
|
|
245
|
+
const result = buildBundle(db, bundleOpts);
|
|
246
|
+
bundleCache.set(cacheKey, { result, builtAt: Date.now() });
|
|
247
|
+
return {
|
|
248
|
+
content: [{
|
|
249
|
+
type: 'text',
|
|
250
|
+
text: result.markdown,
|
|
251
|
+
}],
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
// ── context_update_task ──────────────────────────────────────────────
|
|
255
|
+
case 'context_update_task': {
|
|
256
|
+
const parsed = z.object({
|
|
257
|
+
// taskId must be filesystem-safe: letters, digits, hyphens, underscores only
|
|
258
|
+
taskId: z.string().regex(/^[a-zA-Z0-9_-]+$/, 'taskId must be alphanumeric/hyphens/underscores').optional(),
|
|
259
|
+
section: z.enum(['Goal', 'Files touched', 'Open questions', 'Decisions', 'Notes']),
|
|
260
|
+
content: z.string(),
|
|
261
|
+
}).parse(args);
|
|
262
|
+
let taskId = parsed.taskId;
|
|
263
|
+
if (!taskId) {
|
|
264
|
+
const info = await detectTask(projectRoot);
|
|
265
|
+
taskId = info.id;
|
|
266
|
+
}
|
|
267
|
+
const filePath = taskFilePath(projectRoot, taskId);
|
|
268
|
+
if (!existsSync(filePath)) {
|
|
269
|
+
const info = await detectTask(projectRoot);
|
|
270
|
+
atomicWrite(filePath, defaultTaskContent(taskId, info.branch));
|
|
271
|
+
}
|
|
272
|
+
patchSection(filePath, parsed.section, parsed.content);
|
|
273
|
+
return {
|
|
274
|
+
content: [{
|
|
275
|
+
type: 'text',
|
|
276
|
+
text: `Updated section "${parsed.section}" in tasks/${taskId}.md`,
|
|
277
|
+
}],
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
// ── context_update_project ───────────────────────────────────────────
|
|
281
|
+
case 'context_update_project': {
|
|
282
|
+
const parsed = z.object({
|
|
283
|
+
section: z.string().min(1),
|
|
284
|
+
content: z.string(),
|
|
285
|
+
}).parse(args);
|
|
286
|
+
const claudeMdPath = join(projectRoot, 'CLAUDE.md');
|
|
287
|
+
// Defensive: verify resolved path is within projectRoot (protects against future refactors)
|
|
288
|
+
if (!resolve(claudeMdPath).startsWith(resolve(projectRoot))) {
|
|
289
|
+
throw new Error('Resolved path is outside project root');
|
|
290
|
+
}
|
|
291
|
+
patchSection(claudeMdPath, parsed.section, parsed.content);
|
|
292
|
+
return {
|
|
293
|
+
content: [{
|
|
294
|
+
type: 'text',
|
|
295
|
+
text: `Updated section "${parsed.section}" in CLAUDE.md`,
|
|
296
|
+
}],
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
// ── context_search_codebase ──────────────────────────────────────────
|
|
300
|
+
case 'context_search_codebase': {
|
|
301
|
+
const parsed = z.object({
|
|
302
|
+
query: z.string().min(1),
|
|
303
|
+
limit: z.number().min(1).max(50).optional(),
|
|
304
|
+
searchContent: z.boolean().optional(),
|
|
305
|
+
}).parse(args);
|
|
306
|
+
const info = await detectTask(projectRoot);
|
|
307
|
+
const taskContent = safeRead(taskFilePath(projectRoot, info.id));
|
|
308
|
+
const taskFiles = extractFilesFromTaskContent(taskContent);
|
|
309
|
+
// Default: content search for multi-word queries (heuristic: likely a content search)
|
|
310
|
+
const doContentSearch = parsed.searchContent ?? parsed.query.includes(' ');
|
|
311
|
+
const results = searchFiles(db, parsed.query, taskFiles, projectRoot, parsed.limit ?? 10, doContentSearch);
|
|
312
|
+
const output = results.map(f => `${f.path} (score=${f.score.toFixed(2)}${f.graphNeighborBoost ? ' +graph' : ''})`).join('\n');
|
|
313
|
+
return {
|
|
314
|
+
content: [{
|
|
315
|
+
type: 'text',
|
|
316
|
+
text: results.length > 0
|
|
317
|
+
? `Found ${results.length} files matching "${parsed.query}":\n\n${output}`
|
|
318
|
+
: `No files found matching "${parsed.query}"`,
|
|
319
|
+
}],
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
// ── context_status ───────────────────────────────────────────────────
|
|
323
|
+
case 'context_status': {
|
|
324
|
+
const info = await detectTask(projectRoot);
|
|
325
|
+
const stats = db.getStats();
|
|
326
|
+
const edgeCounts = db.countEdgesByType();
|
|
327
|
+
const dbStats = stats;
|
|
328
|
+
// Build quick token estimates from current files
|
|
329
|
+
const l1Content = safeRead(taskFilePath(projectRoot, info.id));
|
|
330
|
+
const l0Content = readLastLinesFromLog(join(stateDir, 'l0.log'), 50);
|
|
331
|
+
const l3Content = safeRead(join(projectRoot, 'CLAUDE.md'));
|
|
332
|
+
const l1Tokens = estimateTokens(l1Content);
|
|
333
|
+
const l0Tokens = estimateTokens(l0Content);
|
|
334
|
+
const l3Tokens = estimateTokens(l3Content);
|
|
335
|
+
const edgeCountStr = Object.entries(edgeCounts)
|
|
336
|
+
.map(([type, count]) => `${type}=${count}`)
|
|
337
|
+
.join(' ');
|
|
338
|
+
const graphAge = db.getOldestEdgeAgeDays();
|
|
339
|
+
const totalEdges = Object.values(edgeCounts).reduce((a, b) => a + b, 0);
|
|
340
|
+
const latestTest = db.getLatestTestResult(info.id);
|
|
341
|
+
const testLine = latestTest
|
|
342
|
+
? `Tests: passed=${latestTest.passed} failed=${latestTest.failed} (${new Date(latestTest.recorded_at).toISOString().slice(0, 10)})`
|
|
343
|
+
: 'Tests: no results recorded';
|
|
344
|
+
const topFiles = db.getTopFiles(5);
|
|
345
|
+
const hotFilesLine = topFiles.length === 0
|
|
346
|
+
? 'Hot files: none indexed yet'
|
|
347
|
+
: 'Hot files (top 5):\n' + topFiles
|
|
348
|
+
.map(f => ` ${f.path} (score=${f.relevance_score.toFixed(2)}, touches=${f.touch_count})`)
|
|
349
|
+
.join('\n');
|
|
350
|
+
const totalBundleReqs = bundleCacheHits + bundleCacheMisses;
|
|
351
|
+
const hitRateStr = totalBundleReqs > 0
|
|
352
|
+
? `${Math.round((bundleCacheHits / totalBundleReqs) * 100)}% (${bundleCacheHits}/${totalBundleReqs})`
|
|
353
|
+
: 'n/a';
|
|
354
|
+
const statusText = [
|
|
355
|
+
`L0: ${fmtTok(l0Tokens)} tok | L1: ${fmtTok(l1Tokens)} tok | L3: ${fmtTok(l3Tokens)} tok`,
|
|
356
|
+
testLine,
|
|
357
|
+
`Edges: ${edgeCountStr || 'none'} (total=${totalEdges})`,
|
|
358
|
+
`Active task: ${info.id} | Branch: ${info.branch} | Git: ${info.isGit}`,
|
|
359
|
+
`Graph age: ${graphAge > 0 ? `${graphAge} days` : 'unknown'} | Files indexed: ${dbStats.fileCount} | Archive: ${dbStats.archiveCount}`,
|
|
360
|
+
`Bundle cache: hit rate=${hitRateStr}`,
|
|
361
|
+
hotFilesLine,
|
|
362
|
+
].join('\n');
|
|
363
|
+
return {
|
|
364
|
+
content: [{ type: 'text', text: statusText }],
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
// ── context_ingest_diff ──────────────────────────────────────────────
|
|
368
|
+
case 'context_ingest_diff': {
|
|
369
|
+
const parsed = z.object({
|
|
370
|
+
files: z.array(z.string().min(1)).min(1),
|
|
371
|
+
}).parse(args);
|
|
372
|
+
const l0LogPath = join(stateDir, 'l0.log');
|
|
373
|
+
const resolved = parsed.files.map(f => f.startsWith('/') ? f : join(projectRoot, f));
|
|
374
|
+
const timestamp = new Date().toISOString();
|
|
375
|
+
for (const file of resolved) {
|
|
376
|
+
db.touchFile(file);
|
|
377
|
+
const fi = db.getFile(file);
|
|
378
|
+
const score = scoreFile(fi?.last_touched ?? Date.now(), fi?.touch_count ?? 1, false);
|
|
379
|
+
db.updateRelevanceScore(file, score);
|
|
380
|
+
indexFileImports(db, file, projectRoot);
|
|
381
|
+
indexFileSubsystem(db, file, areas, projectRoot);
|
|
382
|
+
appendLog(l0LogPath, `[${timestamp}] WRITE ${file} (touch_count=${fi?.touch_count ?? 1})`, 200);
|
|
383
|
+
}
|
|
384
|
+
db.runInTransaction(() => {
|
|
385
|
+
for (const file of resolved) {
|
|
386
|
+
for (const other of resolved) {
|
|
387
|
+
if (other !== file) {
|
|
388
|
+
upsertBidirectionalEdge(db, { fromNode: file, fromType: 'file', toNode: other, toType: 'file', edgeType: 'co_modified' });
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
const recentFiles = db.getRecentlyTouchedFiles(30 * 60 * 1000, file);
|
|
392
|
+
for (const recent of recentFiles) {
|
|
393
|
+
upsertBidirectionalEdge(db, { fromNode: file, fromType: 'file', toNode: recent, toType: 'file', edgeType: 'co_modified' });
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
// Best-effort L1 task update (mirrors CLI behaviour)
|
|
398
|
+
try {
|
|
399
|
+
const info = await detectTask(projectRoot);
|
|
400
|
+
const tPath = taskFilePath(projectRoot, info.id);
|
|
401
|
+
const taskContent = safeRead(tPath);
|
|
402
|
+
if (taskContent) {
|
|
403
|
+
const toRel = (p) => p.startsWith('/') ? relative(projectRoot, p) : p;
|
|
404
|
+
const existing = new Set(taskContent.split('\n').filter(l => l.startsWith('- ')).map(l => toRel(l.slice(2).trim())));
|
|
405
|
+
const toAdd = resolved.map(toRel).filter(f => !existing.has(f));
|
|
406
|
+
if (toAdd.length > 0) {
|
|
407
|
+
const allFiles = [...existing, ...toAdd];
|
|
408
|
+
patchSection(tPath, 'Files touched', allFiles.map(f => `- ${f}`).join('\n'));
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
catch { /* non-fatal */ }
|
|
413
|
+
return { content: [{ type: 'text', text: `Ingested ${resolved.length} file(s). Edges updated.` }] };
|
|
414
|
+
}
|
|
415
|
+
// ── context_gate ─────────────────────────────────────────────────────
|
|
416
|
+
case 'context_gate': {
|
|
417
|
+
const parsed = z.object({
|
|
418
|
+
input: z.string().min(1),
|
|
419
|
+
context: z.string().optional(),
|
|
420
|
+
}).parse(args);
|
|
421
|
+
const result = check(parsed.input);
|
|
422
|
+
const prefix = result.action === 'deny' ? 'BLOCKED: ' : result.action === 'warn' ? 'WARNING: ' : '';
|
|
423
|
+
return {
|
|
424
|
+
content: [{ type: 'text', text: `${prefix}${JSON.stringify(result)}` }],
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
// ── context_ingest_test_results ──────────────────────────────────────
|
|
428
|
+
case 'context_ingest_test_results': {
|
|
429
|
+
const parsed = z.object({
|
|
430
|
+
passed: z.number().int().min(0),
|
|
431
|
+
failed: z.number().int().min(0),
|
|
432
|
+
skipped: z.number().int().min(0).optional().default(0),
|
|
433
|
+
summary: z.string().min(1),
|
|
434
|
+
failingTests: z.array(z.string()).optional().default([]),
|
|
435
|
+
}).parse(args);
|
|
436
|
+
const l0LogPath = join(stateDir, 'l0.log');
|
|
437
|
+
const timestamp = new Date().toISOString();
|
|
438
|
+
const logLine = `[${timestamp}] TEST passed=${parsed.passed} failed=${parsed.failed} skipped=${parsed.skipped} ${parsed.summary}`;
|
|
439
|
+
appendLog(l0LogPath, logLine, 200);
|
|
440
|
+
const info = await detectTask(projectRoot);
|
|
441
|
+
const resultId = `${info.id}-test-${Date.now()}`;
|
|
442
|
+
db.insertTestResult({
|
|
443
|
+
id: resultId,
|
|
444
|
+
task_id: info.id,
|
|
445
|
+
passed: parsed.passed,
|
|
446
|
+
failed: parsed.failed,
|
|
447
|
+
skipped: parsed.skipped,
|
|
448
|
+
summary: parsed.summary,
|
|
449
|
+
failing_tests: JSON.stringify(parsed.failingTests),
|
|
450
|
+
recorded_at: Date.now(),
|
|
451
|
+
});
|
|
452
|
+
if (parsed.failed > 0) {
|
|
453
|
+
const tPath = taskFilePath(projectRoot, info.id);
|
|
454
|
+
if (existsSync(tPath)) {
|
|
455
|
+
const date = new Date().toISOString().slice(0, 10);
|
|
456
|
+
patchSection(tPath, 'Open questions', `- Tests failing (${parsed.failed} failed): ${parsed.summary} (as of ${date})`);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return { content: [{ type: 'text', text: `Test result recorded: passed=${parsed.passed} failed=${parsed.failed}` }] };
|
|
460
|
+
}
|
|
461
|
+
// ── context_log_event ────────────────────────────────────────────────
|
|
462
|
+
case 'context_log_event': {
|
|
463
|
+
const parsed = z.object({
|
|
464
|
+
event: z.enum(['NOTE', 'ERROR', 'DECISION', 'OBSERVATION']),
|
|
465
|
+
content: z.string().min(1).max(500),
|
|
466
|
+
}).parse(args);
|
|
467
|
+
const l0LogPath = join(stateDir, 'l0.log');
|
|
468
|
+
const timestamp = new Date().toISOString();
|
|
469
|
+
appendLog(l0LogPath, `[${timestamp}] ${parsed.event} ${parsed.content}`, 200);
|
|
470
|
+
return { content: [{ type: 'text', text: `Logged ${parsed.event}: ${parsed.content}` }] };
|
|
471
|
+
}
|
|
472
|
+
default:
|
|
473
|
+
return {
|
|
474
|
+
isError: true,
|
|
475
|
+
content: [{ type: 'text', text: `Unknown tool: ${name}` }],
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
catch (err) {
|
|
480
|
+
return {
|
|
481
|
+
isError: true,
|
|
482
|
+
content: [{
|
|
483
|
+
type: 'text',
|
|
484
|
+
text: `Tool error in ${name}: ${err instanceof Error ? err.message : String(err)}`,
|
|
485
|
+
}],
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
491
|
+
function fmtTok(n) {
|
|
492
|
+
if (n >= 1000)
|
|
493
|
+
return `${(n / 1000).toFixed(1)}k`;
|
|
494
|
+
return String(n);
|
|
495
|
+
}
|
|
496
|
+
function extractFilesFromTaskContent(content) {
|
|
497
|
+
const lines = content.split('\n');
|
|
498
|
+
let inSection = false;
|
|
499
|
+
const files = [];
|
|
500
|
+
for (const line of lines) {
|
|
501
|
+
if (line.startsWith('## Files touched')) {
|
|
502
|
+
inSection = true;
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
if (inSection && line.startsWith('## '))
|
|
506
|
+
break;
|
|
507
|
+
if (inSection) {
|
|
508
|
+
const trimmed = line.replace(/^[-*]\s*/, '').trim();
|
|
509
|
+
if (trimmed && (trimmed.includes('.') || trimmed.includes('/'))) {
|
|
510
|
+
files.push(trimmed);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return files;
|
|
515
|
+
}
|
|
516
|
+
function readLastLinesFromLog(logPath, n) {
|
|
517
|
+
return readLastLines(logPath, n).join('\n');
|
|
518
|
+
}
|
|
519
|
+
// getGraphAgeDays removed — db.getOldestEdgeAgeDays() used directly
|
|
520
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@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