@spikedpunch/mast 0.2.0 → 0.4.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/MAST_SPEC.md +169 -44
- package/README.md +266 -20
- package/assets/prime.md +18 -0
- package/assets/signals.md +51 -0
- package/assets/skill.md +13 -15
- package/dist/ast/types.d.ts +137 -1
- package/dist/ast/types.d.ts.map +1 -1
- package/dist/cli/docs-cmd.d.ts +1 -0
- package/dist/cli/docs-cmd.d.ts.map +1 -1
- package/dist/cli/docs-cmd.js +2 -1
- package/dist/cli/docs-cmd.js.map +1 -1
- package/dist/cli/hook-cmd.d.ts +3 -0
- package/dist/cli/hook-cmd.d.ts.map +1 -0
- package/dist/cli/hook-cmd.js +13 -0
- package/dist/cli/hook-cmd.js.map +1 -0
- package/dist/cli/hook-state-dir.d.ts +24 -0
- package/dist/cli/hook-state-dir.d.ts.map +1 -0
- package/dist/cli/hook-state-dir.js +57 -0
- package/dist/cli/hook-state-dir.js.map +1 -0
- package/dist/cli/hook.d.ts +44 -0
- package/dist/cli/hook.d.ts.map +1 -0
- package/dist/cli/hook.js +200 -0
- package/dist/cli/hook.js.map +1 -0
- package/dist/cli/index.js +12 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/installed-artifacts.d.ts +23 -0
- package/dist/cli/installed-artifacts.d.ts.map +1 -0
- package/dist/cli/installed-artifacts.js +39 -0
- package/dist/cli/installed-artifacts.js.map +1 -0
- package/dist/cli/prime-cmd.d.ts +17 -0
- package/dist/cli/prime-cmd.d.ts.map +1 -0
- package/dist/cli/prime-cmd.js +70 -0
- package/dist/cli/prime-cmd.js.map +1 -0
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +6 -0
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/query.d.ts +40 -1
- package/dist/cli/query.d.ts.map +1 -1
- package/dist/cli/query.js +36 -2
- package/dist/cli/query.js.map +1 -1
- package/dist/cli/search-cmd.d.ts +6 -1
- package/dist/cli/search-cmd.d.ts.map +1 -1
- package/dist/cli/search-cmd.js +9 -2
- package/dist/cli/search-cmd.js.map +1 -1
- package/dist/cli/serve.d.ts +6 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +14 -4
- package/dist/cli/serve.js.map +1 -1
- package/dist/cli/setup-cmd.d.ts +34 -0
- package/dist/cli/setup-cmd.d.ts.map +1 -0
- package/dist/cli/setup-cmd.js +205 -0
- package/dist/cli/setup-cmd.js.map +1 -0
- package/dist/cli/setup-command.d.ts +32 -0
- package/dist/cli/setup-command.d.ts.map +1 -0
- package/dist/cli/setup-command.js +43 -0
- package/dist/cli/setup-command.js.map +1 -0
- package/dist/cli/setup-plan.d.ts +52 -0
- package/dist/cli/setup-plan.d.ts.map +1 -0
- package/dist/cli/setup-plan.js +221 -0
- package/dist/cli/setup-plan.js.map +1 -0
- package/dist/cli/setup-rules.d.ts +41 -0
- package/dist/cli/setup-rules.d.ts.map +1 -0
- package/dist/cli/setup-rules.js +76 -0
- package/dist/cli/setup-rules.js.map +1 -0
- package/dist/cli/setup-static.d.ts +13 -0
- package/dist/cli/setup-static.d.ts.map +1 -0
- package/dist/cli/setup-static.js +116 -0
- package/dist/cli/setup-static.js.map +1 -0
- package/dist/cli/skill-install.d.ts +2 -0
- package/dist/cli/skill-install.d.ts.map +1 -1
- package/dist/cli/skill-install.js +2 -0
- package/dist/cli/skill-install.js.map +1 -1
- package/dist/cli/status.d.ts +15 -0
- package/dist/cli/status.d.ts.map +1 -1
- package/dist/cli/status.js +32 -6
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/upgrade-cmd.d.ts +5 -1
- package/dist/cli/upgrade-cmd.d.ts.map +1 -1
- package/dist/cli/upgrade-cmd.js +28 -3
- package/dist/cli/upgrade-cmd.js.map +1 -1
- package/dist/indexer/freshness.d.ts +10 -0
- package/dist/indexer/freshness.d.ts.map +1 -1
- package/dist/indexer/freshness.js +7 -1
- package/dist/indexer/freshness.js.map +1 -1
- package/dist/indexer/import-resolver.js +28 -16
- package/dist/indexer/import-resolver.js.map +1 -1
- package/dist/indexer/index.d.ts +38 -3
- package/dist/indexer/index.d.ts.map +1 -1
- package/dist/indexer/index.js +47 -4
- package/dist/indexer/index.js.map +1 -1
- package/dist/indexer/watcher.d.ts +94 -0
- package/dist/indexer/watcher.d.ts.map +1 -1
- package/dist/indexer/watcher.js +172 -19
- package/dist/indexer/watcher.js.map +1 -1
- package/dist/mcp/context.d.ts +16 -0
- package/dist/mcp/context.d.ts.map +1 -1
- package/dist/mcp/freshness-probe.d.ts +82 -0
- package/dist/mcp/freshness-probe.d.ts.map +1 -0
- package/dist/mcp/freshness-probe.js +111 -0
- package/dist/mcp/freshness-probe.js.map +1 -0
- package/dist/mcp/instructions.d.ts +7 -0
- package/dist/mcp/instructions.d.ts.map +1 -0
- package/dist/mcp/instructions.js +10 -0
- package/dist/mcp/instructions.js.map +1 -0
- package/dist/mcp/server.d.ts +54 -3
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +79 -4
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/_helpers.d.ts +40 -0
- package/dist/mcp/tools/_helpers.d.ts.map +1 -1
- package/dist/mcp/tools/_helpers.js +27 -0
- package/dist/mcp/tools/_helpers.js.map +1 -1
- package/dist/mcp/tools/callers.d.ts.map +1 -1
- package/dist/mcp/tools/callers.js +6 -1
- package/dist/mcp/tools/callers.js.map +1 -1
- package/dist/mcp/tools/dependencies.d.ts.map +1 -1
- package/dist/mcp/tools/dependencies.js +2 -1
- package/dist/mcp/tools/dependencies.js.map +1 -1
- package/dist/mcp/tools/exports.d.ts.map +1 -1
- package/dist/mcp/tools/exports.js +2 -1
- package/dist/mcp/tools/exports.js.map +1 -1
- package/dist/mcp/tools/implementors.d.ts.map +1 -1
- package/dist/mcp/tools/implementors.js +2 -1
- package/dist/mcp/tools/implementors.js.map +1 -1
- package/dist/mcp/tools/project-skeleton.d.ts.map +1 -1
- package/dist/mcp/tools/project-skeleton.js +2 -1
- package/dist/mcp/tools/project-skeleton.js.map +1 -1
- package/dist/mcp/tools/reindex.d.ts.map +1 -1
- package/dist/mcp/tools/reindex.js +3 -0
- package/dist/mcp/tools/reindex.js.map +1 -1
- package/dist/mcp/tools/rename-impact.d.ts.map +1 -1
- package/dist/mcp/tools/rename-impact.js +4 -1
- package/dist/mcp/tools/rename-impact.js.map +1 -1
- package/dist/mcp/tools/search.d.ts.map +1 -1
- package/dist/mcp/tools/search.js +13 -2
- package/dist/mcp/tools/search.js.map +1 -1
- package/dist/mcp/tools/signature.d.ts.map +1 -1
- package/dist/mcp/tools/signature.js +2 -1
- package/dist/mcp/tools/signature.js.map +1 -1
- package/dist/mcp/tools/status.d.ts.map +1 -1
- package/dist/mcp/tools/status.js +8 -2
- package/dist/mcp/tools/status.js.map +1 -1
- package/dist/store/config.d.ts.map +1 -1
- package/dist/store/config.js +4 -5
- package/dist/store/config.js.map +1 -1
- package/dist/store/defaults.d.ts +9 -0
- package/dist/store/defaults.d.ts.map +1 -0
- package/dist/store/defaults.js +12 -0
- package/dist/store/defaults.js.map +1 -0
- package/package.json +5 -2
package/dist/mcp/server.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
1
2
|
import type { ResolvedConfig } from '../store/config.js';
|
|
3
|
+
import { type FreshnessProbe } from './freshness-probe.js';
|
|
2
4
|
/**
|
|
3
5
|
* Thrown by {@link assertServableIndex} when `mast serve --no-startup-reindex`
|
|
4
6
|
* targets a state directory that has never completed an index run. Extends
|
|
@@ -8,6 +10,13 @@ import type { ResolvedConfig } from '../store/config.js';
|
|
|
8
10
|
*/
|
|
9
11
|
export declare class NeverIndexedError extends Error {
|
|
10
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Constructs the MCP server with its handshake identity. Split from `serve` so the
|
|
15
|
+
* `initialize` result can be tested without opening SQLite or stdio. The version comes
|
|
16
|
+
* from the manifest, not a literal (shape S-05); `instructions` is what a client shows
|
|
17
|
+
* the model before it has chosen a tool.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createMastServer(): McpServer;
|
|
11
20
|
/**
|
|
12
21
|
* Refuse to start serving when nothing can ever fill the index (M6 Part A).
|
|
13
22
|
*
|
|
@@ -33,14 +42,56 @@ export declare class NeverIndexedError extends Error {
|
|
|
33
42
|
export declare function assertServableIndex(config: ResolvedConfig, options: {
|
|
34
43
|
readonly noStartupReindex?: boolean;
|
|
35
44
|
}): void;
|
|
45
|
+
/**
|
|
46
|
+
* Run an incremental/full index pass and then correct the cached freshness
|
|
47
|
+
* count, which that pass has just made wrong.
|
|
48
|
+
*
|
|
49
|
+
* Extracted from `serve` because the ordering here is the whole contract and it
|
|
50
|
+
* was previously expressed three times in three closures, one of which got it
|
|
51
|
+
* wrong (D060): the invalidate must be in a `finally`. A reindex that FAILS is
|
|
52
|
+
* the case where the cached count is most likely to be stale and most costly to
|
|
53
|
+
* keep — the watcher only fired because files on disk changed, and `runIndex`
|
|
54
|
+
* losing `structure.lock` to a concurrent writer is an ordinary outcome, not an
|
|
55
|
+
* exceptional one. Invalidating only on success leaves `mast_search` reporting
|
|
56
|
+
* a pre-change count as authoritative for a full TTL, and after
|
|
57
|
+
* `maxConsecutiveFailures` the watcher drops the batch, so nothing retries.
|
|
58
|
+
*
|
|
59
|
+
* Errors propagate deliberately. `WatchScheduler` needs the rejection to
|
|
60
|
+
* requeue the batch, and the startup path wants to warn on its own terms; a
|
|
61
|
+
* function that both corrects the cache and swallows the failure would give
|
|
62
|
+
* neither caller what it needs.
|
|
63
|
+
*
|
|
64
|
+
* @param prime `true` measures immediately (startup, so the first search of the
|
|
65
|
+
* session has a real answer instead of `null`); `false` leaves the next
|
|
66
|
+
* `peekUnindexed` to schedule it, which is right for a watch batch that may
|
|
67
|
+
* be one of many in a burst.
|
|
68
|
+
*/
|
|
69
|
+
export declare function reindexAndRemeasure(config: ResolvedConfig, freshness: FreshnessProbe, options: {
|
|
70
|
+
readonly incremental: boolean;
|
|
71
|
+
readonly prime?: boolean;
|
|
72
|
+
/** §4.4 DI seam: tests drive the failure path without standing up a writer. */
|
|
73
|
+
readonly runIndexFn?: (config: ResolvedConfig, opts: {
|
|
74
|
+
incremental: boolean;
|
|
75
|
+
}) => Promise<unknown>;
|
|
76
|
+
}): Promise<void>;
|
|
36
77
|
export interface ServeOptions {
|
|
37
78
|
readonly config: ResolvedConfig;
|
|
38
79
|
/** Skip the startup incremental reindex (not recommended). */
|
|
39
80
|
readonly noStartupReindex?: boolean;
|
|
40
81
|
/**
|
|
41
|
-
* Watch source files and incrementally reindex on change (§11.4).
|
|
42
|
-
*
|
|
43
|
-
*
|
|
82
|
+
* Watch source files and incrementally reindex on change (§11.4).
|
|
83
|
+
*
|
|
84
|
+
* **Defaults to on** (`undefined` means watch). It was opt-in until
|
|
85
|
+
* 2026-09-03, on the theory that the startup ladder plus JIT staleness kept
|
|
86
|
+
* reads correct. Measurement said otherwise: JIT only re-parses files the
|
|
87
|
+
* index already knows, so a file CREATED during a session is invisible to
|
|
88
|
+
* every read tool until something reindexes — and nothing does. A watcher is
|
|
89
|
+
* the only mechanism here that closes that window without a per-query cost.
|
|
90
|
+
* Watcher construction failures degrade to serving without it, so the
|
|
91
|
+
* default cannot make the server fail to start.
|
|
92
|
+
*
|
|
93
|
+
* Set `false` (CLI `--no-watch`) for container or batch use, where the tree
|
|
94
|
+
* does not change under the server and the fd cost is not worth paying.
|
|
44
95
|
*/
|
|
45
96
|
readonly watch?: boolean;
|
|
46
97
|
}
|
package/dist/mcp/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,C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store/sqliteChunkStore.js';
|
|
|
8
8
|
import { runIndex, loadIndexMeta } from '../indexer/index.js';
|
|
9
9
|
import { startWatchMode } from '../indexer/watcher.js';
|
|
10
10
|
import { bootstrapState } from './startup.js';
|
|
11
|
+
import { createFreshnessProbe } from './freshness-probe.js';
|
|
11
12
|
import { registerAllTools } from './register-tools.js';
|
|
13
|
+
import { CLI_VERSION } from '../cli/version.js';
|
|
14
|
+
import { SERVER_INSTRUCTIONS } from './instructions.js';
|
|
12
15
|
// ---------------------------------------------------------------------------
|
|
13
16
|
// M6 Part A (eval/GITNEXUS_COMPARISON.md §13.8 item 4): refuse to serve only
|
|
14
17
|
// where nothing can EVER fill the index — see assertServableIndex below.
|
|
@@ -22,6 +25,15 @@ import { registerAllTools } from './register-tools.js';
|
|
|
22
25
|
*/
|
|
23
26
|
export class NeverIndexedError extends Error {
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Constructs the MCP server with its handshake identity. Split from `serve` so the
|
|
30
|
+
* `initialize` result can be tested without opening SQLite or stdio. The version comes
|
|
31
|
+
* from the manifest, not a literal (shape S-05); `instructions` is what a client shows
|
|
32
|
+
* the model before it has chosen a tool.
|
|
33
|
+
*/
|
|
34
|
+
export function createMastServer() {
|
|
35
|
+
return new McpServer({ name: 'mast', version: CLI_VERSION }, { instructions: SERVER_INSTRUCTIONS });
|
|
36
|
+
}
|
|
25
37
|
/**
|
|
26
38
|
* True when `config.resolved_state_dir` has never completed an index run:
|
|
27
39
|
* either `graph.db` itself is absent (nothing has ever opened the database),
|
|
@@ -85,6 +97,44 @@ export function assertServableIndex(config, options) {
|
|
|
85
97
|
'query would return {"results":[]} forever, indistinguishable from "symbol doesn\'t exist". ' +
|
|
86
98
|
'Run `mast init` or `mast index` against this state directory first, or drop --no-startup-reindex.');
|
|
87
99
|
}
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Startup ladder (§7.4)
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
/**
|
|
104
|
+
* Run an incremental/full index pass and then correct the cached freshness
|
|
105
|
+
* count, which that pass has just made wrong.
|
|
106
|
+
*
|
|
107
|
+
* Extracted from `serve` because the ordering here is the whole contract and it
|
|
108
|
+
* was previously expressed three times in three closures, one of which got it
|
|
109
|
+
* wrong (D060): the invalidate must be in a `finally`. A reindex that FAILS is
|
|
110
|
+
* the case where the cached count is most likely to be stale and most costly to
|
|
111
|
+
* keep — the watcher only fired because files on disk changed, and `runIndex`
|
|
112
|
+
* losing `structure.lock` to a concurrent writer is an ordinary outcome, not an
|
|
113
|
+
* exceptional one. Invalidating only on success leaves `mast_search` reporting
|
|
114
|
+
* a pre-change count as authoritative for a full TTL, and after
|
|
115
|
+
* `maxConsecutiveFailures` the watcher drops the batch, so nothing retries.
|
|
116
|
+
*
|
|
117
|
+
* Errors propagate deliberately. `WatchScheduler` needs the rejection to
|
|
118
|
+
* requeue the batch, and the startup path wants to warn on its own terms; a
|
|
119
|
+
* function that both corrects the cache and swallows the failure would give
|
|
120
|
+
* neither caller what it needs.
|
|
121
|
+
*
|
|
122
|
+
* @param prime `true` measures immediately (startup, so the first search of the
|
|
123
|
+
* session has a real answer instead of `null`); `false` leaves the next
|
|
124
|
+
* `peekUnindexed` to schedule it, which is right for a watch batch that may
|
|
125
|
+
* be one of many in a burst.
|
|
126
|
+
*/
|
|
127
|
+
export async function reindexAndRemeasure(config, freshness, options) {
|
|
128
|
+
const run = options.runIndexFn ?? runIndex;
|
|
129
|
+
try {
|
|
130
|
+
await run(config, { incremental: options.incremental });
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
freshness.invalidate();
|
|
134
|
+
if (options.prime === true)
|
|
135
|
+
freshness.refresh();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
88
138
|
/**
|
|
89
139
|
* Run the MAST MCP server.
|
|
90
140
|
*
|
|
@@ -112,13 +162,19 @@ export async function serve(options) {
|
|
|
112
162
|
// tool below already uses.
|
|
113
163
|
const chunkStore = new SqliteChunkStore(db);
|
|
114
164
|
// ── Step 3: open MCP transport and register tools ─────────────────────────
|
|
165
|
+
// Freshness signal for `mast_search`'s `unindexed_files` warning. Created
|
|
166
|
+
// before the tools are registered because handlers capture `ctx` at
|
|
167
|
+
// registration; primed below so the first search of a session already has a
|
|
168
|
+
// real answer rather than `null`.
|
|
169
|
+
const freshness = createFreshnessProbe(config, db);
|
|
115
170
|
const ctx = {
|
|
116
171
|
db,
|
|
117
172
|
chunkStore,
|
|
118
173
|
config,
|
|
119
174
|
sessionId: randomUUID(),
|
|
175
|
+
freshness,
|
|
120
176
|
};
|
|
121
|
-
const server =
|
|
177
|
+
const server = createMastServer();
|
|
122
178
|
registerAllTools(server, ctx);
|
|
123
179
|
const transport = new StdioServerTransport();
|
|
124
180
|
await server.connect(transport);
|
|
@@ -128,7 +184,7 @@ export async function serve(options) {
|
|
|
128
184
|
// mast_reindex). JIT staleness handling (§9.0) already guarantees read
|
|
129
185
|
// correctness; watch mode only keeps the FTS/graph index fresh between reads.
|
|
130
186
|
const startWatchIfRequested = () => {
|
|
131
|
-
if (options.watch
|
|
187
|
+
if (options.watch === false)
|
|
132
188
|
return;
|
|
133
189
|
let watchHandle = null;
|
|
134
190
|
try {
|
|
@@ -136,9 +192,21 @@ export async function serve(options) {
|
|
|
136
192
|
config,
|
|
137
193
|
runBatch: async (paths) => {
|
|
138
194
|
process.stderr.write(`[mast] watch: reindexing after ${paths.length} change(s)\n`);
|
|
139
|
-
|
|
195
|
+
// Not primed: a burst of saves produces a burst of batches, and the
|
|
196
|
+
// next `peekUnindexed` will schedule one measurement for all of them.
|
|
197
|
+
await reindexAndRemeasure(config, freshness, { incremental: true });
|
|
140
198
|
},
|
|
141
199
|
onWarn: (message) => process.stderr.write(`${message}\n`),
|
|
200
|
+
// The success path now announces itself, because the failure path
|
|
201
|
+
// always did: `startWatchMode`'s EMFILE degradation writes a warning,
|
|
202
|
+
// so before this line silence meant "watching", "not watching yet" and
|
|
203
|
+
// "watcher failed to start" alike, and an operator could not tell which
|
|
204
|
+
// (D061). Emitted once, after chokidar's initial scan, a settle period
|
|
205
|
+
// and a reconciliation pass (D067): files created before the pass are
|
|
206
|
+
// queued for reindex, and the OS watch has had the settle period to go
|
|
207
|
+
// live. It is not a guarantee: a watch that goes live later than that is
|
|
208
|
+
// still a gap, and nothing proves liveness.
|
|
209
|
+
onReady: () => process.stderr.write('[mast] watch: watching for changes\n'),
|
|
142
210
|
});
|
|
143
211
|
}
|
|
144
212
|
catch (err) {
|
|
@@ -161,12 +229,19 @@ export async function serve(options) {
|
|
|
161
229
|
};
|
|
162
230
|
// ── Step 4: background reindex ────────────────────────────────────────────
|
|
163
231
|
if (options.noStartupReindex) {
|
|
232
|
+
// No reindex is coming, so measure the drift the user has chosen to keep.
|
|
233
|
+
freshness.refresh();
|
|
164
234
|
startWatchIfRequested();
|
|
165
235
|
return;
|
|
166
236
|
}
|
|
167
237
|
void (async () => {
|
|
168
238
|
try {
|
|
169
|
-
|
|
239
|
+
// Measured AFTER the reindex, in the same background task: a probe run
|
|
240
|
+
// before it would race the indexer and cache a count that the very next
|
|
241
|
+
// moment invalidates. On the failure path the correction is the more
|
|
242
|
+
// important half — the index is behind and nothing else will say so —
|
|
243
|
+
// which is why it lives in `reindexAndRemeasure`'s `finally`.
|
|
244
|
+
await reindexAndRemeasure(config, freshness, { incremental: !needsFullReindex, prime: true });
|
|
170
245
|
}
|
|
171
246
|
catch (err) {
|
|
172
247
|
process.stderr.write(`[mast] startup indexing failed: ${String(err)}\n`);
|
package/dist/mcp/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE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BAAkB;QAClB,MAAM,YAAY,GAAG,GAAS,EAAE;YAC9B,MAAM,MAAM,GAAG,WAAW,CAAC;YAC3B,WAAW,GAAG,IAAI,CAAC;YACnB,IAAI,MAAM,KAAK,IAAI;gBAAE,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACvC,CAAC,CAAC;IAEF,6EAA6E;IAE7E,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC7B,0EAA0E;QAC1E,SAAS,CAAC,OAAO,EAAE,CAAC;QACpB,qBAAqB,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IAED,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,IAAI,CAAC;YACH,uEAAuE;YACvE,wEAAwE;YACxE,qEAAqE;YACrE,sEAAsE;YACtE,8DAA8D;YAC9D,MAAM,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,CAAC,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAChG,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IAEL,qBAAqB,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -16,6 +16,46 @@ export { collectPotentialMatches, collectPotentialMatchCandidates, type ChunkByI
|
|
|
16
16
|
* pays nothing extra per call.
|
|
17
17
|
*/
|
|
18
18
|
export declare function isIndexEmpty(ctx: AppContext): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* How exhaustive a tool's answer claims to be. This is what decides whether a
|
|
21
|
+
* partial index is worth mentioning alongside a *non-empty* result, and the two
|
|
22
|
+
* cases are genuinely different claims rather than a style choice.
|
|
23
|
+
*
|
|
24
|
+
* - `exhaustive-set` — the answer is "these are the ones there are"
|
|
25
|
+
* (`mast_callers`, `mast_rename_impact`, `mast_implementors`, `mast_search`,
|
|
26
|
+
* `mast_project_skeleton`). A **non-empty** answer is the dangerous one here:
|
|
27
|
+
* "3 verified callers" computed over a corpus missing forty files is what
|
|
28
|
+
* drives a delete, and it reads exactly like a complete answer.
|
|
29
|
+
* - `named-lookup` — the answer is about one thing the caller named
|
|
30
|
+
* (`mast_signature`, `mast_exports`, `mast_dependencies`). If it was found,
|
|
31
|
+
* the answer is correct however much else is unindexed; only *not finding* it
|
|
32
|
+
* is ambiguous between "absent" and "never indexed".
|
|
33
|
+
*/
|
|
34
|
+
export type CompletenessClaim = 'exhaustive-set' | 'named-lookup';
|
|
35
|
+
/**
|
|
36
|
+
* The partial-index warning (D054), for every tool that returns a primary
|
|
37
|
+
* result set — not just `mast_search`, which had it first only because that is
|
|
38
|
+
* where it was written.
|
|
39
|
+
*
|
|
40
|
+
* The severity zero: a caller reads an empty or thin answer, concludes "it
|
|
41
|
+
* isn't there", and edits or deletes code that is in fact referenced from a
|
|
42
|
+
* file the index never saw. `index_empty` covers the all-or-nothing case; this
|
|
43
|
+
* covers the far commoner partial one, where the index is populated and merely
|
|
44
|
+
* behind.
|
|
45
|
+
*
|
|
46
|
+
* Free to call. `peekUnindexed` reads a TTL-cached count synchronously and
|
|
47
|
+
* never awaits a walk (see `mcp/freshness-probe.ts`), so unlike `isIndexEmpty`
|
|
48
|
+
* this costs nothing on a populated response and needs no empty-path guard for
|
|
49
|
+
* performance — only for meaning.
|
|
50
|
+
*
|
|
51
|
+
* `null` from the probe means *no measurement has landed yet*, which is
|
|
52
|
+
* unknown, not zero. Both render as an omitted field, but they are kept
|
|
53
|
+
* distinct here because the next reader to add a branch would otherwise inherit
|
|
54
|
+
* "unknown means clean" — the exact conflation this signal exists to prevent.
|
|
55
|
+
*/
|
|
56
|
+
export declare function unindexedFilesField(ctx: AppContext, claim: CompletenessClaim, isEmpty: boolean): {
|
|
57
|
+
readonly unindexed_files?: number;
|
|
58
|
+
};
|
|
19
59
|
/** Extract the first JSDoc comment block from chunk content, if present. */
|
|
20
60
|
export declare function extractDoc(content: string): string | null;
|
|
21
61
|
export { globToRegex } from '../../indexer/walker.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_helpers.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAA0B,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEpF,sGAAsG;AACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AASzE,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,GAC5B,MAAM,mCAAmC,CAAC;AAM3C;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAEpE;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGzD;AAID,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,cAAc,EACt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M,GACf,OAAO,CAAC,oBAAoB,CAAC,CAQ/B"}
|
|
@@ -25,6 +25,33 @@ export { collectPotentialMatches, collectPotentialMatchCandidates, } from '../..
|
|
|
25
25
|
export async function isIndexEmpty(ctx) {
|
|
26
26
|
return (await ctx.chunkStore.chunkCount()) === 0;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The partial-index warning (D054), for every tool that returns a primary
|
|
30
|
+
* result set — not just `mast_search`, which had it first only because that is
|
|
31
|
+
* where it was written.
|
|
32
|
+
*
|
|
33
|
+
* The severity zero: a caller reads an empty or thin answer, concludes "it
|
|
34
|
+
* isn't there", and edits or deletes code that is in fact referenced from a
|
|
35
|
+
* file the index never saw. `index_empty` covers the all-or-nothing case; this
|
|
36
|
+
* covers the far commoner partial one, where the index is populated and merely
|
|
37
|
+
* behind.
|
|
38
|
+
*
|
|
39
|
+
* Free to call. `peekUnindexed` reads a TTL-cached count synchronously and
|
|
40
|
+
* never awaits a walk (see `mcp/freshness-probe.ts`), so unlike `isIndexEmpty`
|
|
41
|
+
* this costs nothing on a populated response and needs no empty-path guard for
|
|
42
|
+
* performance — only for meaning.
|
|
43
|
+
*
|
|
44
|
+
* `null` from the probe means *no measurement has landed yet*, which is
|
|
45
|
+
* unknown, not zero. Both render as an omitted field, but they are kept
|
|
46
|
+
* distinct here because the next reader to add a branch would otherwise inherit
|
|
47
|
+
* "unknown means clean" — the exact conflation this signal exists to prevent.
|
|
48
|
+
*/
|
|
49
|
+
export function unindexedFilesField(ctx, claim, isEmpty) {
|
|
50
|
+
if (claim === 'named-lookup' && !isEmpty)
|
|
51
|
+
return {};
|
|
52
|
+
const unindexed = ctx.freshness?.peekUnindexed() ?? null;
|
|
53
|
+
return unindexed !== null && unindexed > 0 ? { unindexed_files: unindexed } : {};
|
|
54
|
+
}
|
|
28
55
|
/** Extract the first JSDoc comment block from chunk content, if present. */
|
|
29
56
|
export function extractDoc(content) {
|
|
30
57
|
const match = /\/\*\*([\s\S]*?)\*\//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":3,"file":"callers.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/callers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAYhD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAgI5E"}
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { buildToolStats, recordToolCall, buildArgsJson, buildResultsJson } from '../../telemetry/metrics.js';
|
|
3
3
|
import { countTokens, estimateFullFileBound } from '../../telemetry/tokenizer.js';
|
|
4
4
|
import { querySymbolByName, queryVerifiedCallers } from '../../graph/queries.js';
|
|
5
|
-
import { jitRefreshFile, collectPotentialMatches, isIndexEmpty } from './_helpers.js';
|
|
5
|
+
import { jitRefreshFile, collectPotentialMatches, isIndexEmpty, unindexedFilesField } from './_helpers.js';
|
|
6
6
|
export function registerCallersTool(server, ctx) {
|
|
7
7
|
server.tool('mast_callers', 'Call sites of a named symbol, partitioned into verified (graph-resolved) and potential (identifier-FTS) sets. Always check both sets — the graph only covers statically-linked call sites. Verified entries with resolution "checker" were proven by the opt-in `mast index --checker` TypeScript pass; the same pass drops non-call-site / wrong-declaration noise out of potential_matches (summary.checker_classified_* report how many).', {
|
|
8
8
|
symbol: z.string().describe('Symbol name whose callers to find'),
|
|
@@ -33,6 +33,7 @@ export function registerCallersTool(server, ctx) {
|
|
|
33
33
|
// §9.0 TOCTOU policy: omitted when false, never present-and-false.
|
|
34
34
|
...(fileBusy ? { file_busy_returning_stale_cache: true } : {}),
|
|
35
35
|
...indexEmptyField,
|
|
36
|
+
...unindexedFilesField(ctx, 'exhaustive-set', true),
|
|
36
37
|
summary: {
|
|
37
38
|
verified_count: 0,
|
|
38
39
|
potential_count: 0,
|
|
@@ -85,6 +86,10 @@ export function registerCallersTool(server, ctx) {
|
|
|
85
86
|
// §9.0 TOCTOU policy: omitted when false, never present-and-false.
|
|
86
87
|
...(fileBusy ? { file_busy_returning_stale_cache: true } : {}),
|
|
87
88
|
...indexEmptyField,
|
|
89
|
+
// Always, not only when empty: "3 verified callers" over a corpus
|
|
90
|
+
// missing forty files reads exactly like a complete answer, and is the
|
|
91
|
+
// one that gets acted on.
|
|
92
|
+
...unindexedFilesField(ctx, 'exhaustive-set', false),
|
|
88
93
|
summary: {
|
|
89
94
|
verified_count: verified_callers.length,
|
|
90
95
|
potential_count: potential_matches.length,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callers.js","sourceRoot":"","sources":["../../../src/mcp/tools/callers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"callers.js","sourceRoot":"","sources":["../../../src/mcp/tools/callers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,YAAY,EAAG,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAE3G,MAAM,UAAU,mBAAm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AAE,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;YAC1F,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC,CAAC;SAC9F,CAAC;QACF,KAAK,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE;YAC1B,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,mBAAmB;YACrE,UAAU,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI;YAClD,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC;YAC7B,WAAW,EAAE,gBAAgB,CAAC,gBAAgB,CAAC;SAChD,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACnB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;IAClF,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/dependencies.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAOhD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/dependencies.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAOhD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAuCjF"}
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { buildToolStats, recordToolCall } from '../../telemetry/metrics.js';
|
|
3
3
|
import { countTokens, estimateFullFileBound } from '../../telemetry/tokenizer.js';
|
|
4
4
|
import { queryDependencies } from '../../graph/queries.js';
|
|
5
|
-
import { jitRefreshFile, isIndexEmpty } from './_helpers.js';
|
|
5
|
+
import { jitRefreshFile, isIndexEmpty, unindexedFilesField } from './_helpers.js';
|
|
6
6
|
export function registerDependenciesTool(server, ctx) {
|
|
7
7
|
server.tool('mast_dependencies', 'All imports for a file — what it depends on, whether each dependency is external or internal, and the resolved path for monorepo imports.', {
|
|
8
8
|
file_path: z.string().describe('Path to the file, relative to the project root'),
|
|
@@ -23,6 +23,7 @@ export function registerDependenciesTool(server, ctx) {
|
|
|
23
23
|
imports,
|
|
24
24
|
// §9.0 TOCTOU policy: omitted when false, never present-and-false.
|
|
25
25
|
...(busy ? { file_busy_returning_stale_cache: true } : {}),
|
|
26
|
+
...unindexedFilesField(ctx, 'named-lookup', imports.length === 0),
|
|
26
27
|
...indexEmptyField,
|
|
27
28
|
_stats: buildToolStats('mast_dependencies', tokens, tokensFullFileBound, [args.file_path], durationMs),
|
|
28
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/mcp/tools/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,iBAAi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AE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQhD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/exports.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQhD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAwE5E"}
|
|
@@ -3,7 +3,7 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { buildToolStats, recordToolCall, buildArgsJson, buildResultsJson } from '../../telemetry/metrics.js';
|
|
4
4
|
import { countTokens, estimateFullFileBound } from '../../telemetry/tokenizer.js';
|
|
5
5
|
import { extractFileSignatures } from '../../ast/extract.js';
|
|
6
|
-
import { extractDoc, jitRefreshFile, isIndexEmpty, DEFAULT_RESULT_LIMIT } from './_helpers.js';
|
|
6
|
+
import { extractDoc, jitRefreshFile, isIndexEmpty, DEFAULT_RESULT_LIMIT, unindexedFilesField } from './_helpers.js';
|
|
7
7
|
export function registerExportsTool(server, ctx) {
|
|
8
8
|
server.tool('mast_exports', 'All exported symbols from a single file with type signatures. No function bodies. Use to answer "what does this file expose?" before deciding whether to open it.', {
|
|
9
9
|
file_path: z.string().describe('Path to the file, relative to the project root'),
|
|
@@ -48,6 +48,7 @@ export function registerExportsTool(server, ctx) {
|
|
|
48
48
|
...(exportsTruncated !== undefined ? { exports_truncated: exportsTruncated } : {}),
|
|
49
49
|
// §9.0 TOCTOU policy: omitted when false, never present-and-false.
|
|
50
50
|
...(busy ? { file_busy_returning_stale_cache: true } : {}),
|
|
51
|
+
...unindexedFilesField(ctx, 'named-lookup', exports.length === 0),
|
|
51
52
|
...indexEmptyField,
|
|
52
53
|
_stats: buildToolStats('mast_exports', tokens, tokensFullFileBound, [args.file_path], durationMs),
|
|
53
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../src/mcp/tools/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../src/mcp/tools/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,oBAAoB,EAAG,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAEpH,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,GAAe;IACpE,MAAM,CAAC,IAAI,CACT,cAAc,EACd,mKAAmK,EACnK;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,C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sourceRoot":"","sources":["../../../src/mcp/tools/implementors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQhD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"implementors.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/implementors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQhD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAwDjF"}
|
|
@@ -3,7 +3,7 @@ import { buildToolStats, recordToolCall } from '../../telemetry/metrics.js';
|
|
|
3
3
|
import { countTokens, estimateFullFileBound } from '../../telemetry/tokenizer.js';
|
|
4
4
|
import { queryImplementors } from '../../graph/queries.js';
|
|
5
5
|
import { findStaleFiles } from '../staleness.js';
|
|
6
|
-
import { isIndexEmpty, DEFAULT_RESULT_LIMIT } from './_helpers.js';
|
|
6
|
+
import { isIndexEmpty, DEFAULT_RESULT_LIMIT, unindexedFilesField } from './_helpers.js';
|
|
7
7
|
export function registerImplementorsTool(server, ctx) {
|
|
8
8
|
server.tool('mast_implementors', 'All classes that implement a named interface, with the list of methods each class provides.', {
|
|
9
9
|
interface_name: z.string().describe('Name of the interface to find implementors of'),
|
|
@@ -42,6 +42,7 @@ export function registerImplementorsTool(server, ctx) {
|
|
|
42
42
|
results: flaggedResults,
|
|
43
43
|
...(resultsTruncated !== undefined ? { results_truncated: resultsTruncated } : {}),
|
|
44
44
|
...indexEmptyField,
|
|
45
|
+
...unindexedFilesField(ctx, 'exhaustive-set', flaggedResults.length === 0),
|
|
45
46
|
_stats: buildToolStats('mast_implementors', tokens, tokensFullFileBound, filesReferenced, durationMs),
|
|
46
47
|
};
|
|
47
48
|
void recordToolCall(ctx.db, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementors.js","sourceRoot":"","sources":["../../../src/mcp/tools/implementors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"implementors.js","sourceRoot":"","sources":["../../../src/mcp/tools/implementors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAG,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAExF,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,GAAe;IACzE,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,6FAA6F,EAC7F;QACE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;QACpF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAA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CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;IAClF,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-skeleton.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/project-skeleton.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAOhD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"project-skeleton.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/project-skeleton.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAOhD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAmEpF"}
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { buildToolStats, recordToolCall } from '../../telemetry/metrics.js';
|
|
3
3
|
import { countTokens, estimateFullFileBound } from '../../telemetry/tokenizer.js';
|
|
4
4
|
import { queryProjectSkeleton } from '../../graph/queries.js';
|
|
5
|
-
import { globToRegex, isIndexEmpty } from './_helpers.js';
|
|
5
|
+
import { globToRegex, isIndexEmpty, unindexedFilesField } from './_helpers.js';
|
|
6
6
|
export function registerProjectSkeletonTool(server, ctx) {
|
|
7
7
|
server.tool('mast_project_skeleton', 'All file paths in the project with their exported top-level symbol names. Returns names only — no signatures or bodies. Use early in a task for architectural orientation.', {
|
|
8
8
|
directory: z.string().nullable().optional().describe('Scope to a subtree of the project (e.g. "api/services/auth")'),
|
|
@@ -49,6 +49,7 @@ export function registerProjectSkeletonTool(server, ctx) {
|
|
|
49
49
|
const response = {
|
|
50
50
|
files,
|
|
51
51
|
...indexEmptyField,
|
|
52
|
+
...unindexedFilesField(ctx, 'exhaustive-set', files.length === 0),
|
|
52
53
|
_stats: buildToolStats('mast_project_skeleton', tokens, tokensFullFileBound, filesReferenced, durationMs),
|
|
53
54
|
};
|
|
54
55
|
void recordToolCall(ctx.db, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-skeleton.js","sourceRoot":"","sources":["../../../src/mcp/tools/project-skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"project-skeleton.js","sourceRoot":"","sources":["../../../src/mcp/tools/project-skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAG,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAE/E,MAAM,UAAU,2BAA2B,CAAC,MAAiB,EAAE,GAAe;IAC5E,MAAM,CAAC,IAAI,CACT,uBAAuB,EACvB,4KAA4K,EAC5K;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8DA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S,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"reindex.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/reindex.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEpE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAiB5E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAYlE"}
|
|
@@ -5,6 +5,9 @@ export function registerReindexTool(server, ctx) {
|
|
|
5
5
|
full: z.boolean().optional().describe('Force a full reindex of all files (slow; use only after large structural changes)'),
|
|
6
6
|
}, async (args) => {
|
|
7
7
|
const result = await runIndex(ctx.config, { incremental: !(args.full ?? false) });
|
|
8
|
+
// Whatever the cached freshness count was, this run just changed it —
|
|
9
|
+
// and leaving it would warn `mast_search` about files this call indexed.
|
|
10
|
+
ctx.freshness?.invalidate();
|
|
8
11
|
const reindexResult = toReindexResult(result);
|
|
9
12
|
return { content: [{ type: 'text', text: JSON.stringify(reindexResult) }] };
|
|
10
13
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reindex.js","sourceRoot":"","sources":["../../../src/mcp/tools/reindex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,QAAQ,EAAoB,MAAM,wBAAwB,CAAC;AAEpE,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,GAAe;IACpE,MAAM,CAAC,IAAI,CACT,cAAc,EACd,2LAA2L,EAC3L;Q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