@hy-sde-org/dsh-tool-codebase-memory 0.1.2-rc.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,459 @@
1
+ /**
2
+ * Model-facing codebase-memory CLI tools over the `codebase-memory-mcp cli`
3
+ * one-shot mode: `codebase_list_projects`, `codebase_index_repository`,
4
+ * `codebase_index_status`, `codebase_search_graph`, `codebase_query_graph`,
5
+ * `codebase_trace_path`, `codebase_get_code_snippet`,
6
+ * `codebase_get_graph_schema`, `codebase_get_architecture`,
7
+ * `codebase_search_code`, `codebase_detect_changes`, `codebase_manage_adr`,
8
+ * `codebase_ingest_traces`, `codebase_delete_project`.
9
+ *
10
+ * Each call spawns `codebase-memory-mcp cli --json <tool>` once with a temp
11
+ * `--args-file` and parses the raw MCP result envelope — the same daemon the
12
+ * stdio MCP server fronts, so indexes, mutation locks and index supervisors
13
+ * are shared. Long-lived process: none; the daemon stays warm across calls.
14
+ * @module @hy-sde-org/dsh-tool-codebase-memory/codebase-memory
15
+ */
16
+ import { execFile } from 'node:child_process';
17
+ import { unlink, writeFile } from 'node:fs/promises';
18
+ import { tmpdir } from 'node:os';
19
+ import { join } from 'node:path';
20
+ import { randomUUID } from 'node:crypto';
21
+ import { defineTool } from '@deepseek-ai/dsh-tools';
22
+ /**
23
+ * `defineTool` passthrough that additionally accepts the fork's `device`
24
+ * device-catalog marker. The published `@deepseek-ai/dsh-tools` 0.1.2-rc.1
25
+ * types predate that option (it landed in the harness's in-repo registry),
26
+ * so the marker rides a widened but fully typed options shape; a consumer
27
+ * registry without the device concept simply ignores it at runtime.
28
+ */
29
+ function defineCodebaseMemoryTool(options) {
30
+ return defineTool(options);
31
+ }
32
+ /** Raised when the CLI exits non-zero, the envelope reports isError, or the output is unreadable. */
33
+ export class CodebaseMemoryCliError extends Error {
34
+ /** CLI invocation that failed. */
35
+ args;
36
+ /** Captured stdout (may hold a partial MCP envelope). */
37
+ stdout;
38
+ /** Captured stderr (mem.init/progress noise plus human errors). */
39
+ stderr;
40
+ /** Process exit code, or null when no process ran (e.g. ENOENT). */
41
+ exitCode;
42
+ /** Parsed error payload from the envelope, when available. */
43
+ payload;
44
+ constructor(message, args, stdout, stderr, exitCode, payload) {
45
+ super(message);
46
+ this.name = 'CodebaseMemoryCliError';
47
+ this.args = args;
48
+ this.stdout = stdout;
49
+ this.stderr = stderr;
50
+ this.exitCode = exitCode;
51
+ this.payload = payload;
52
+ }
53
+ }
54
+ /**
55
+ * Run the CLI once; stdout/stderr/exit-code are returned as-is.
56
+ * @param cmd - CLI executable path.
57
+ * @param args - full argv (including `cli --json <tool>` and, when args exist, `--args-file`).
58
+ * @param options - run options (per-call timeout).
59
+ * @returns the captured stdout/stderr and exit code.
60
+ * @throws {@link CodebaseMemoryCliError} when the process fails or times out.
61
+ */
62
+ export async function runCli(cmd, args, options) {
63
+ return new Promise((resolve, reject) => {
64
+ execFile(cmd, args, {
65
+ timeout: options.timeoutMs,
66
+ maxBuffer: 256 * 1024 * 1024,
67
+ windowsHide: true,
68
+ }, (err, stdout, stderr) => {
69
+ if (!err) {
70
+ resolve({ stdout, stderr, exitCode: 0 });
71
+ return;
72
+ }
73
+ const e = err;
74
+ const code = typeof e.code === 'number' ? e.code : null;
75
+ if (e.code === 'ENOENT') {
76
+ reject(new CodebaseMemoryCliError(`codebase-memory CLI not found (\`${cmd}\`). Install it from the codebase-memory-mcp releases (https://github.com/DeusData/codebase-memory-mcp/releases): tar xzf then ./install.sh, or set config.cliPath.`, args, stdout, stderr, code));
77
+ return;
78
+ }
79
+ const tail = stderr.trim().slice(0, 400);
80
+ reject(new CodebaseMemoryCliError(`codebase-memory CLI exited with ${code === null ? 'unknown error' : `code ${code}`}${tail ? `: ${tail}` : ''}`, args, stdout, stderr, code));
81
+ });
82
+ });
83
+ }
84
+ /** Narrows a parsed error payload to its optional error/hint fields. */
85
+ function asErrorPayload(value) {
86
+ if (typeof value !== 'object' || value === null)
87
+ return {};
88
+ return {
89
+ error: 'error' in value ? value.error : undefined,
90
+ hint: 'hint' in value ? value.hint : undefined,
91
+ };
92
+ }
93
+ /**
94
+ * Parse the raw MCP result envelope printed by `cli --json <tool>`.
95
+ *
96
+ * Under `--json` the CLI always exits 0 and reports tool errors inside the
97
+ * envelope (`{"content":[{"type":"text","text":...}],"isError":true}`), so the
98
+ * envelope — not the process exit code — is the source of truth.
99
+ * @param run - captured run output.
100
+ * @returns the parsed envelope.
101
+ * @throws {@link CodebaseMemoryCliError} when the envelope reports `isError`.
102
+ */
103
+ export function parseEnvelope(run) {
104
+ let doc;
105
+ try {
106
+ doc = JSON.parse(run.stdout);
107
+ }
108
+ catch {
109
+ throw new CodebaseMemoryCliError('codebase-memory CLI returned non-JSON output (expected an MCP result envelope)', ['cli', '--json'], run.stdout, run.stderr, run.exitCode);
110
+ }
111
+ const root = doc;
112
+ if (!root || !Array.isArray(root.content) || root.content.length === 0) {
113
+ throw new CodebaseMemoryCliError('codebase-memory CLI returned a malformed MCP result envelope (no content blocks)', ['cli', '--json'], run.stdout, run.stderr, run.exitCode);
114
+ }
115
+ const text = root.content[0]?.text;
116
+ const textStr = typeof text === 'string' ? text : run.stdout;
117
+ let payload = textStr;
118
+ if (textStr.trim().startsWith('{') || textStr.trim().startsWith('[') || textStr.trim().startsWith('"')) {
119
+ try {
120
+ payload = JSON.parse(textStr);
121
+ }
122
+ catch {
123
+ // stay with the verbatim text
124
+ }
125
+ }
126
+ if (root.isError) {
127
+ const err = asErrorPayload(payload);
128
+ const message = typeof err.error === 'string' ? err.error : 'codebase-memory tool error';
129
+ const hint = typeof err.hint === 'string' ? ` ${err.hint}` : '';
130
+ throw new CodebaseMemoryCliError(message + hint, ['cli', '--json'], run.stdout, run.stderr, run.exitCode, payload);
131
+ }
132
+ return { payload, text: textStr, stdout: run.stdout, stderr: run.stderr, exitCode: run.exitCode };
133
+ }
134
+ /** Shared output schema: every tool resolves to one JSON text document. */
135
+ const OUTPUT_SCHEMA = {
136
+ type: 'object',
137
+ additionalProperties: false,
138
+ properties: {
139
+ text: { type: 'string', required: true },
140
+ },
141
+ };
142
+ /**
143
+ * Render a JSON payload into the tool result text, truncating when it exceeds
144
+ * the cap so oversized graph payloads cannot blow the session context.
145
+ * @param payload - parsed envelope payload.
146
+ * @param maxChars - truncation cap.
147
+ * @returns the rendered text.
148
+ */
149
+ export function renderPayload(payload, maxChars) {
150
+ const text = payload === undefined ? '' : JSON.stringify(payload);
151
+ if (text.length <= maxChars)
152
+ return text;
153
+ return `${text.slice(0, maxChars)}\n...(truncated by tool-codebase-memory: payload was ${text.length} chars; narrow the query or page with limit/offset)`;
154
+ }
155
+ /**
156
+ * Register all fourteen codebase-memory tools (the prompt section is added by
157
+ * the index plugin; this stays separable for tests).
158
+ * @param ctx - Cordis context carrying `tools` and `systemPrompt`.
159
+ * @param config - tool-level configuration (CLI path/project/timeouts/caps).
160
+ */
161
+ export function applyCodebaseMemoryTools(ctx, config = {}) {
162
+ const cmd = config.cliPath ?? 'codebase-memory-mcp';
163
+ const defaultProject = config.project;
164
+ const maxChars = config.maxChars ?? 200000;
165
+ const call = async (tool, args, timeoutMs) => {
166
+ const argv = ['cli', '--json', tool];
167
+ let tmp;
168
+ try {
169
+ if (Object.keys(args).length > 0) {
170
+ tmp = join(tmpdir(), `cbm-${randomUUID()}.json`);
171
+ await writeFile(tmp, JSON.stringify(args), 'utf8');
172
+ argv.push('--args-file', tmp);
173
+ }
174
+ const run = await runCli(cmd, argv, { timeoutMs });
175
+ const env = parseEnvelope(run);
176
+ return { payload: env.payload };
177
+ }
178
+ finally {
179
+ if (tmp)
180
+ await unlink(tmp).catch(() => { });
181
+ }
182
+ };
183
+ // project-aware tools default `project` from config when omitted
184
+ const withProject = (args) => {
185
+ if (args.project !== undefined || defaultProject === undefined)
186
+ return args;
187
+ return { ...args, project: defaultProject };
188
+ };
189
+ // per-tool timeouts; indexing and heavy analysis get longer budgets
190
+ const INDEX_TIMEOUT = config.indexTimeoutMs ?? 600000;
191
+ const baseTimeout = config.timeoutMs ?? 60000;
192
+ void ctx;
193
+ ctx.tools.register(defineCodebaseMemoryTool({
194
+ name: 'codebase_list_projects',
195
+ device: true,
196
+ description: 'List every project indexed into the codebase-memory knowledge graph (name, root path, git state). Use before any other codebase_* tool to learn the canonical `project` name for the repository in question, then pass it to the other tools.',
197
+ parameters: {},
198
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
199
+ async execute() {
200
+ const { payload } = await call('list_projects', {}, baseTimeout);
201
+ return { text: JSON.stringify(payload) };
202
+ },
203
+ }));
204
+ ctx.tools.register(defineCodebaseMemoryTool({
205
+ name: 'codebase_index_repository',
206
+ device: true,
207
+ description: 'Index a repository into the codebase-memory knowledge graph. Use INSTEAD of ad-hoc greps when you need structural answers (callers/callees, routes, architectures, cross-service links) that the filesystem tools would need many read/grep cycles to piece together. Runs in the daemon; repos are indexed once and queried repeatedly afterwards.',
208
+ parameters: {
209
+ repoPath: { type: 'string', description: 'Path to the repository to index.' },
210
+ mode: { type: 'string', enum: ['full', 'moderate', 'fast', 'cross-repo-intelligence'], description: 'full (default): all files + similarity/semantic edges. moderate: filtered files + similarity/semantic. fast: filtered files, no similarity/semantic. cross-repo-intelligence: only match routes/channels across already-indexed projects (requires targetProjects).' },
211
+ targetProjects: { type: 'array', items: { type: 'string' }, description: 'Projects to search for cross-repo links (cross-repo-intelligence mode). Use ["*"] for all indexed projects.' },
212
+ name: { type: 'string', description: 'Override the derived project name (defaults to the path slug).' },
213
+ persistence: { type: 'boolean', description: 'Write a compressed artifact to .codebase-memory/graph.db.zst for team sharing.' },
214
+ },
215
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
216
+ async execute(args) {
217
+ const a = args;
218
+ if (!a.repoPath)
219
+ throw new CodebaseMemoryCliError('repoPath is required', [], '', '', null);
220
+ const payload = { repo_path: a.repoPath };
221
+ if (a.mode)
222
+ payload.mode = a.mode;
223
+ if (a.targetProjects)
224
+ payload.target_projects = a.targetProjects;
225
+ if (a.name)
226
+ payload.name = a.name;
227
+ if (a.persistence !== undefined)
228
+ payload.persistence = a.persistence;
229
+ const { payload: out } = await call('index_repository', payload, INDEX_TIMEOUT);
230
+ return { text: JSON.stringify(out) };
231
+ },
232
+ }));
233
+ ctx.tools.register(defineCodebaseMemoryTool({
234
+ name: 'codebase_index_status',
235
+ device: true,
236
+ description: 'Report indexing status and coverage for a project: node/edge counts, freshness, skipped and partially-parsed files, and any logfile of the last index run. Use before trusting an answer about a recently-changed repo.',
237
+ parameters: {
238
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
239
+ },
240
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
241
+ async execute(args) {
242
+ const a = args;
243
+ const { payload } = await call('index_status', withProject(a), baseTimeout);
244
+ return { text: renderPayload(payload, maxChars) };
245
+ },
246
+ }));
247
+ ctx.tools.register(defineCodebaseMemoryTool({
248
+ name: 'codebase_search_graph',
249
+ device: true,
250
+ description: 'Search the codebase-memory knowledge graph for functions, classes, routes, and variables. Preferred over plain grep/glob when finding definitions, implementations, or relationships: three independent modes — query (BM25 full-text with camelCase splitting and structural label boosting), namePattern (exact regex on symbol names), semanticQuery (vector cosine; fills the vocabulary gap, e.g. find "publish" when you search "send"). Responds with prefix-grouped tree rows of qn/label/file/lines and in/out degrees.',
251
+ parameters: {
252
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
253
+ query: { type: 'string', description: 'Natural-language or keyword full-text search. Tokens split on whitespace; camelCase identifiers index as individual words. When provided, namePattern is ignored.' },
254
+ label: { type: 'string', description: 'Restrict to one node label, e.g. Function, Method, Route, Class.' },
255
+ namePattern: { type: 'string', description: 'Exact regex over symbol names (ignored when query is provided).' },
256
+ qnPattern: { type: 'string', description: 'Regex over qualified names.' },
257
+ filePattern: { type: 'string', description: 'Restrict to files matching this substring/glob.' },
258
+ relationship: { type: 'string', description: 'Edge relationship to filter by.' },
259
+ minDegree: { type: 'integer', description: 'Minimum selected degree.' },
260
+ maxDegree: { type: 'integer', description: 'Maximum selected degree.' },
261
+ excludeEntryPoints: { type: 'boolean', description: 'Exclude entry-point symbols.' },
262
+ includeConnected: { type: 'boolean', description: 'Also return connected nodes.' },
263
+ semanticQuery: { type: 'array', items: { type: 'string' }, description: 'Array of keyword strings (NOT a single string) — each scored via per-keyword min-cosine. Requires moderate/full index mode.' },
264
+ limit: { type: 'integer', description: 'Max results per call (default 50). Response carries total and has_more; page with offset when truncated.' },
265
+ offset: { type: 'integer', description: 'Skip the first N results. Combine with limit to page until has_more is false.' },
266
+ format: { type: 'string', enum: ['tree', 'json'], description: 'Response encoding: tree (default) prefix-grouped rows; json the same model as structured JSON.' },
267
+ fields: { type: 'array', items: { type: 'string' }, description: 'Extra per-node property columns, e.g. complexity, cognitive, signature, docstring, return_type, is_test, lines(int). Core columns (qn/label/file/lines/in/out) are always present.' },
268
+ },
269
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
270
+ async execute(args) {
271
+ const a = args;
272
+ const { payload } = await call('search_graph', withProject(a), baseTimeout);
273
+ return { text: renderPayload(payload, maxChars) };
274
+ },
275
+ }));
276
+ ctx.tools.register(defineCodebaseMemoryTool({
277
+ name: 'codebase_query_graph',
278
+ device: true,
279
+ description: 'Execute a raw Cypher query against the codebase-memory knowledge graph for multi-hop patterns, aggregations, and cross-service analysis the curated tools cannot express. Response carries total (returned row count); the graph enforces a hard 100k row ceiling, so add LIMIT for broad queries. Each Function/Method node also carries complexity/cognitive/loop/recursion hot-path properties.',
280
+ parameters: {
281
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
282
+ query: { type: 'string', description: 'Cypher query, e.g. MATCH (f:Function) WHERE f.transitive_loop_depth >= 3 RETURN f.qualified_name, f.transitive_loop_depth, f.linear_scan_in_loop ORDER BY f.transitive_loop_depth DESC.' },
283
+ maxRows: { type: 'integer', description: 'Optional row cap (default: unlimited up to the 100k ceiling). No offset support — use codebase_search_graph for paged browsing.' },
284
+ },
285
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
286
+ async execute(args) {
287
+ const a = args;
288
+ if (!a.query)
289
+ throw new CodebaseMemoryCliError('query is required', [], '', '', null);
290
+ const payload = { query: a.query, ...withProject(a) };
291
+ if (a.maxRows !== undefined)
292
+ payload.max_rows = a.maxRows;
293
+ const { payload: out } = await call('query_graph', payload, baseTimeout);
294
+ return { text: renderPayload(out, maxChars) };
295
+ },
296
+ }));
297
+ ctx.tools.register(defineCodebaseMemoryTool({
298
+ name: 'codebase_trace_path',
299
+ device: true,
300
+ description: 'Trace call/dataflow/cross-service paths through the codebase-memory knowledge graph. callers/callees (calls mode), value propagation with argument expressions (data_flow), or through HTTP/async route nodes and across repos (cross_service). Callers surface the declaration plus every inbound edge.',
301
+ parameters: {
302
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
303
+ functionName: { type: 'string', description: 'Qualified name from codebase_search_graph, or a short function name.' },
304
+ direction: { type: 'string', enum: ['inbound', 'outbound', 'both'], description: 'Trace direction (default both).' },
305
+ depth: { type: 'integer', description: 'Hop depth (default 3).' },
306
+ mode: { type: 'string', enum: ['calls', 'data_flow', 'cross_service'], description: 'calls: CALLS edges. data_flow: CALLS+DATA_FLOWS with arg expressions. cross_service: HTTP/async routes and CROSS_* cross-repo edges.' },
307
+ parameterName: { type: 'string', description: 'data_flow mode: scope the trace to one parameter name.' },
308
+ edgeTypes: { type: 'array', items: { type: 'string' }, description: 'Restrict to specific edge types.' },
309
+ riskLabels: { type: 'boolean', description: 'Add CRITICAL/HIGH/MEDIUM/LOW risk classes by hop distance.' },
310
+ includeTests: { type: 'boolean', description: 'Include test nodes (default excludes them).' },
311
+ },
312
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
313
+ async execute(args) {
314
+ const a = args;
315
+ const { payload } = await call('trace_path', withProject(a), baseTimeout);
316
+ return { text: renderPayload(payload, maxChars) };
317
+ },
318
+ }));
319
+ ctx.tools.register(defineCodebaseMemoryTool({
320
+ name: 'codebase_get_code_snippet',
321
+ device: true,
322
+ description: 'Read the source of one symbol from an indexed project — full qualified name from codebase_search_graph, or a short function name. Use instead of several file read + grep cycles when you already know the symbol (from codebase_search_graph / codebase_trace_path).',
323
+ parameters: {
324
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
325
+ qualifiedName: { type: 'string', description: 'Full qualified_name from codebase_search_graph, or a short function name.' },
326
+ includeNeighbors: { type: 'boolean', description: "Also render the symbol's structural neighbors." },
327
+ },
328
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
329
+ async execute(args) {
330
+ const a = args;
331
+ if (!a.qualifiedName)
332
+ throw new CodebaseMemoryCliError('qualifiedName is required', [], '', '', null);
333
+ const payload = { qualified_name: a.qualifiedName, ...withProject(a) };
334
+ if (a.includeNeighbors !== undefined)
335
+ payload.include_neighbors = a.includeNeighbors;
336
+ const { payload: out } = await call('get_code_snippet', payload, baseTimeout);
337
+ return { text: renderPayload(out, maxChars) };
338
+ },
339
+ }));
340
+ ctx.tools.register(defineCodebaseMemoryTool({
341
+ name: 'codebase_get_graph_schema',
342
+ device: true,
343
+ description: 'Return the node labels and edge types available in a project\'s knowledge graph — the vocabulary for codebase_query_graph Cypher and the labels accepted by codebase_search_graph.',
344
+ parameters: {
345
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
346
+ },
347
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
348
+ async execute(args) {
349
+ const a = args;
350
+ const { payload } = await call('get_graph_schema', withProject(a), baseTimeout);
351
+ return { text: renderPayload(payload, maxChars) };
352
+ },
353
+ }));
354
+ ctx.tools.register(defineCodebaseMemoryTool({
355
+ name: 'codebase_get_architecture',
356
+ device: true,
357
+ description: 'High-level architecture overview of a project from the knowledge graph: packages, services, dependencies, and de-facto modules (Leiden clusters over the call/import graph) with cohesion and representative nodes. Use before diving into traversal code, and to validate refactors against the real seams. Optional directory prefix scopes the analysis.',
358
+ parameters: {
359
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
360
+ path: { type: 'string', description: 'Optional directory prefix to scope the architecture, e.g. apps/hoa.' },
361
+ aspects: { type: 'array', items: { type: 'string' }, description: 'Aspects to include: all, overview, structure, dependencies, routes, languages, packages, entry_points, hotspots, boundaries, layers, file_tree, clusters. Omit = all.' },
362
+ },
363
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
364
+ async execute(args) {
365
+ const a = args;
366
+ const { payload } = await call('get_architecture', withProject(a), baseTimeout);
367
+ return { text: renderPayload(payload, maxChars) };
368
+ },
369
+ }));
370
+ ctx.tools.register(defineCodebaseMemoryTool({
371
+ name: 'codebase_search_code',
372
+ device: true,
373
+ description: 'Grep-augmented code search: finds text patterns, then enriches matches into containing functions ranked by structural importance (definitions first, popular functions next, tests last). Modes: compact (default, signatures), full (with source), files (just file paths). Use when you need to find code by literal text within one indexed project.',
374
+ parameters: {
375
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
376
+ pattern: { type: 'string', description: 'Text pattern to search (grep syntax).' },
377
+ filePattern: { type: 'string', description: 'Glob to restrict files, e.g. *.go or packages/**/*.ts.' },
378
+ pathFilter: { type: 'string', description: 'Regex filter on result file paths, e.g. ^src/ or \\.(go|ts)$.' },
379
+ mode: { type: 'string', enum: ['compact', 'full', 'files'], description: 'compact (default): signatures + metadata. full: with source. files: just file list.' },
380
+ context: { type: 'integer', description: 'Lines of context around each match (grep -C). Only used in compact mode.' },
381
+ regex: { type: 'boolean', description: 'Treat pattern as a regular expression (default literal).' },
382
+ limit: { type: 'integer', description: 'Max enriched results (default 10; responses carry total_grep_matches/total_results so you can detect truncation and raise limit or narrow path_filter).' },
383
+ },
384
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
385
+ async execute(args) {
386
+ const a = args;
387
+ const { payload } = await call('search_code', withProject(a), baseTimeout);
388
+ return { text: renderPayload(payload, maxChars) };
389
+ },
390
+ }));
391
+ ctx.tools.register(defineCodebaseMemoryTool({
392
+ name: 'codebase_detect_changes',
393
+ device: true,
394
+ description: 'Detect code changes and their impact on an indexed project\'s knowledge graph: git diff from a base branch/ref mapped onto the graph, telling you which symbols/routes/clusters a change touches. Use before and after edits to plan and review work.',
395
+ parameters: {
396
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
397
+ scope: { type: 'string', description: 'Optional scope hint for the analysis.' },
398
+ depth: { type: 'integer', description: 'Impact depth (default 2).' },
399
+ baseBranch: { type: 'string', description: 'Base branch to diff from (default main).' },
400
+ since: { type: 'string', description: 'Git ref or tag to compare from, e.g. HEAD~5 or v0.5.0. Diffs <ref>...HEAD.' },
401
+ },
402
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
403
+ async execute(args) {
404
+ const a = args;
405
+ const { payload } = await call('detect_changes', withProject(a), baseTimeout);
406
+ return { text: renderPayload(payload, maxChars) };
407
+ },
408
+ }));
409
+ ctx.tools.register(defineCodebaseMemoryTool({
410
+ name: 'codebase_manage_adr',
411
+ device: true,
412
+ description: 'Read or write Architecture Decision Records for an indexed project. Modes: get (list ADRs), update (create/replace an ADR), sections (read individual ADR sections). Use to persist load-bearing architectural choices next to the code.',
413
+ parameters: {
414
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
415
+ mode: { type: 'string', enum: ['get', 'update', 'sections'], description: 'get: list ADRs; update: create/replace an ADR; sections: read one ADR\'s sections.' },
416
+ content: { type: 'string', description: 'Full ADR content for mode=update.' },
417
+ sections: { type: 'array', items: { type: 'string' }, description: 'Section names to read for mode=sections.' },
418
+ },
419
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
420
+ async execute(args) {
421
+ const a = args;
422
+ const { payload } = await call('manage_adr', withProject(a), baseTimeout);
423
+ return { text: renderPayload(payload, maxChars) };
424
+ },
425
+ }));
426
+ ctx.tools.register(defineCodebaseMemoryTool({
427
+ name: 'codebase_ingest_traces',
428
+ device: true,
429
+ description: 'Fold runtime call traces into an indexed project\'s knowledge graph so queries and analysis reflect observed behavior, not just static structure. Accepts an array of {caller, callee, count} and returns the accepted/imported counts.',
430
+ parameters: {
431
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
432
+ traces: { type: 'array', items: { type: 'object', additionalProperties: false, properties: { caller: { type: 'string', required: true }, callee: { type: 'string', required: true }, count: { type: 'integer', required: true } } }, description: 'Runtime traces to ingest.' },
433
+ },
434
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
435
+ async execute(args) {
436
+ const a = args;
437
+ if (!Array.isArray(a.traces) || a.traces.length === 0)
438
+ throw new CodebaseMemoryCliError('traces must be a non-empty array', [], '', '', null);
439
+ const payload = { traces: a.traces, ...withProject(a) };
440
+ const { payload: out } = await call('ingest_traces', payload, baseTimeout);
441
+ return { text: renderPayload(out, maxChars) };
442
+ },
443
+ }));
444
+ ctx.tools.register(defineCodebaseMemoryTool({
445
+ name: 'codebase_delete_project',
446
+ device: true,
447
+ description: 'Delete a project\'s index from the codebase-memory graph store. Destructive and permanent: the graph is rebuilt only by re-running codebase_index_repository. Use only for cleanup of superseded indexes (e.g. to free disk).',
448
+ parameters: {
449
+ project: { type: 'string', description: 'Indexed project name (see codebase_list_projects).' },
450
+ },
451
+ output: { schema: OUTPUT_SCHEMA, render: (_a, v) => [{ type: 'text', text: v.text }] },
452
+ async execute(args) {
453
+ const a = args;
454
+ const { payload } = await call('delete_project', withProject(a), baseTimeout);
455
+ return { text: renderPayload(payload, maxChars) };
456
+ },
457
+ }));
458
+ }
459
+ //# sourceMappingURL=codebase-memory.js.map
@@ -0,0 +1 @@
1
+ {"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AA4B,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;YAChF,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;YAC1E,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAA;QAC/C,CAAC;KACF,CAAC,CAAC,CAAA;IAEH,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC1C,IAAI,EAAE,yBAAyB;QAC/B,MAAM,EAAE,IAAI;QACZ,WAAW,EACT,+NAA+N;QACjO,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oDAAoD,EAAE;SAC/F;QACD,MAAM,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE;QACtF,KAAK,CAAC,OAAO,CAAC,IAAI;YAChB,MAAM,CAAC,GAAG,IAA+B,CAAA;YACzC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAA;YAC7E,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAA;QACnD,CAAC;KACF,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Model-facing codebase-memory CLI tools (`codebase_list_projects`,
3
+ * `codebase_index_repository`, `codebase_index_status`, `codebase_search_graph`,
4
+ * `codebase_query_graph`, `codebase_trace_path`, `codebase_get_code_snippet`,
5
+ * `codebase_get_graph_schema`, `codebase_get_architecture`,
6
+ * `codebase_search_code`, `codebase_detect_changes`, `codebase_manage_adr`,
7
+ * `codebase_ingest_traces`, `codebase_delete_project`) over the installed
8
+ * `codebase-memory-mcp` CLI, plus a `codebase:tools` system-prompt section.
9
+ * Agent-plane: this package mounts as a preset or patch row and registers no
10
+ * service of its own.
11
+ * @module @hy-sde-org/dsh-tool-codebase-memory
12
+ */
13
+ import { Context } from '@deepseek-ai/cordis';
14
+ import type { CodebaseMemoryToolConfig } from './codebase-memory.ts';
15
+ /** Plugin configuration (camera over the CLI invocation). */
16
+ export interface Config extends CodebaseMemoryToolConfig {
17
+ }
18
+ export { buildCodebaseMemoryPromptSection } from './prompt.ts';
19
+ export { applyCodebaseMemoryTools, CodebaseMemoryCliError, renderPayload } from './codebase-memory.ts';
20
+ export type { CodebaseMemoryToolConfig } from './codebase-memory.ts';
21
+ export { checkCodebaseMemoryCli } from './invariant.ts';
22
+ /** Cordis plugin name for loader diagnostics. */
23
+ export declare const name = "tool-codebase-memory";
24
+ /** Services consumed by this plugin (tools + systemPrompt from the agent bundle). */
25
+ export declare const inject: string[];
26
+ /**
27
+ * Register the codebase-memory CLI tools and the `codebase:tools` prompt section.
28
+ * @param ctx - the agent-plane plugin context (injects `tools`, `systemPrompt`).
29
+ * @param config - resolved plugin configuration.
30
+ */
31
+ export declare function apply(ctx: Context, config?: Config): void;
32
+ /** Cordis plugin object for `@hy-sde-org/dsh-tool-codebase-memory`. */
33
+ declare const _default: {
34
+ name: string;
35
+ inject: string[];
36
+ apply: typeof apply;
37
+ };
38
+ export default _default;
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAGpE,6DAA6D;AAC7D,MAAM,WAAW,MAAO,SAAQ,wBAAwB;CAAG;AAE3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACtG,YAAY,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,iDAAiD;AACjD,eAAO,MAAM,IAAI,yBAAyB,CAAA;AAE1C,qFAAqF;AACrF,eAAO,MAAM,MAAM,UAA4B,CAAA;AAE/C;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CAG7D;AAED,uEAAuE;;;;;;AACvE,wBAAsC"}
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Model-facing codebase-memory CLI tools (`codebase_list_projects`,
3
+ * `codebase_index_repository`, `codebase_index_status`, `codebase_search_graph`,
4
+ * `codebase_query_graph`, `codebase_trace_path`, `codebase_get_code_snippet`,
5
+ * `codebase_get_graph_schema`, `codebase_get_architecture`,
6
+ * `codebase_search_code`, `codebase_detect_changes`, `codebase_manage_adr`,
7
+ * `codebase_ingest_traces`, `codebase_delete_project`) over the installed
8
+ * `codebase-memory-mcp` CLI, plus a `codebase:tools` system-prompt section.
9
+ * Agent-plane: this package mounts as a preset or patch row and registers no
10
+ * service of its own.
11
+ * @module @hy-sde-org/dsh-tool-codebase-memory
12
+ */
13
+ import { applyCodebaseMemoryTools } from "./codebase-memory.js";
14
+ import { buildCodebaseMemoryPromptSection } from "./prompt.js";
15
+ export { buildCodebaseMemoryPromptSection } from "./prompt.js";
16
+ export { applyCodebaseMemoryTools, CodebaseMemoryCliError, renderPayload } from "./codebase-memory.js";
17
+ export { checkCodebaseMemoryCli } from "./invariant.js";
18
+ /** Cordis plugin name for loader diagnostics. */
19
+ export const name = 'tool-codebase-memory';
20
+ /** Services consumed by this plugin (tools + systemPrompt from the agent bundle). */
21
+ export const inject = ['tools', 'systemPrompt'];
22
+ /**
23
+ * Register the codebase-memory CLI tools and the `codebase:tools` prompt section.
24
+ * @param ctx - the agent-plane plugin context (injects `tools`, `systemPrompt`).
25
+ * @param config - resolved plugin configuration.
26
+ */
27
+ export function apply(ctx, config = {}) {
28
+ applyCodebaseMemoryTools(ctx, config);
29
+ ctx.systemPrompt.section(buildCodebaseMemoryPromptSection());
30
+ }
31
+ /** Cordis plugin object for `@hy-sde-org/dsh-tool-codebase-memory`. */
32
+ export default { name, inject, apply };
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAE/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAA;AAK9D,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,iDAAiD;AACjD,MAAM,CAAC,MAAM,IAAI,GAAG,sBAAsB,CAAA;AAE1C,qFAAqF;AACrF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;AAE/C;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,GAAY,EAAE,SAAiB,EAAE;IACrD,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IACrC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,gCAAgC,EAAE,CAAC,CAAA;AAC9D,CAAC;AAED,uEAAuE;AACvE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Package-owned invariant companion for `@hy-sde-org/dsh-tool-codebase-memory`.
3
+ * @module @hy-sde-org/dsh-tool-codebase-memory/invariant
4
+ */
5
+ import type { Context } from '@deepseek-ai/cordis';
6
+ /** Cordis companion plugin name. */
7
+ export declare const name = "tool-codebase-memory-invariant";
8
+ /** Service required before the companion can reserve package ownership. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Register this package's invariant companion.
12
+ * @param ctx - Cordis context carrying the invariant service.
13
+ * @returns the installed registration's disposer after setup succeeds.
14
+ */
15
+ export declare const apply: (ctx: Context) => Promise<() => void>;
16
+ /** Standalone availability probe re-export (usable outside the registry). */
17
+ export { checkCodebaseMemoryCli } from './cli-check.ts';
18
+ //# sourceMappingURL=invariant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAMlD,oCAAoC;AACpC,eAAO,MAAM,IAAI,mCAAmC,CAAA;AACpD,2EAA2E;AAC3E,eAAO,MAAM,MAAM,UAAiB,CAAA;AAgBpC;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,KAAK,OAAO,KAAG,OAAO,CAAC,MAAM,IAAI,CACU,CAAA;AAGjE,6EAA6E;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA"}