@spikedpunch/mast 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/LICENSE +21 -0
- package/MAST_SPEC.md +2926 -0
- package/README.md +842 -0
- package/assets/skill.md +45 -0
- package/dist/ast/extract.d.ts +65 -0
- package/dist/ast/extract.d.ts.map +1 -0
- package/dist/ast/extract.js +147 -0
- package/dist/ast/extract.js.map +1 -0
- package/dist/ast/extractor.d.ts +85 -0
- package/dist/ast/extractor.d.ts.map +1 -0
- package/dist/ast/extractor.js +2 -0
- package/dist/ast/extractor.js.map +1 -0
- package/dist/ast/extractors/markdown.d.ts +40 -0
- package/dist/ast/extractors/markdown.d.ts.map +1 -0
- package/dist/ast/extractors/markdown.js +175 -0
- package/dist/ast/extractors/markdown.js.map +1 -0
- package/dist/ast/extractors/typescript.d.ts +179 -0
- package/dist/ast/extractors/typescript.d.ts.map +1 -0
- package/dist/ast/extractors/typescript.js +1439 -0
- package/dist/ast/extractors/typescript.js.map +1 -0
- package/dist/ast/parser.d.ts +5 -0
- package/dist/ast/parser.d.ts.map +1 -0
- package/dist/ast/parser.js +21 -0
- package/dist/ast/parser.js.map +1 -0
- package/dist/ast/types.d.ts +586 -0
- package/dist/ast/types.d.ts.map +1 -0
- package/dist/ast/types.js +3 -0
- package/dist/ast/types.js.map +1 -0
- package/dist/cli/docs-cmd.d.ts +22 -0
- package/dist/cli/docs-cmd.d.ts.map +1 -0
- package/dist/cli/docs-cmd.js +100 -0
- package/dist/cli/docs-cmd.js.map +1 -0
- package/dist/cli/index-cmd.d.ts +72 -0
- package/dist/cli/index-cmd.d.ts.map +1 -0
- package/dist/cli/index-cmd.js +263 -0
- package/dist/cli/index-cmd.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +14 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +64 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/install-hooks.d.ts +3 -0
- package/dist/cli/install-hooks.d.ts.map +1 -0
- package/dist/cli/install-hooks.js +34 -0
- package/dist/cli/install-hooks.js.map +1 -0
- package/dist/cli/metrics-cmd.d.ts +3 -0
- package/dist/cli/metrics-cmd.d.ts.map +1 -0
- package/dist/cli/metrics-cmd.js +164 -0
- package/dist/cli/metrics-cmd.js.map +1 -0
- package/dist/cli/program.d.ts +14 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +44 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/query.d.ts +46 -0
- package/dist/cli/query.d.ts.map +1 -0
- package/dist/cli/query.js +153 -0
- package/dist/cli/query.js.map +1 -0
- package/dist/cli/search-cmd.d.ts +33 -0
- package/dist/cli/search-cmd.d.ts.map +1 -0
- package/dist/cli/search-cmd.js +114 -0
- package/dist/cli/search-cmd.js.map +1 -0
- package/dist/cli/serve.d.ts +3 -0
- package/dist/cli/serve.d.ts.map +1 -0
- package/dist/cli/serve.js +19 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/skill-install.d.ts +39 -0
- package/dist/cli/skill-install.d.ts.map +1 -0
- package/dist/cli/skill-install.js +57 -0
- package/dist/cli/skill-install.js.map +1 -0
- package/dist/cli/status.d.ts +35 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +117 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/upgrade-cmd.d.ts +48 -0
- package/dist/cli/upgrade-cmd.d.ts.map +1 -0
- package/dist/cli/upgrade-cmd.js +129 -0
- package/dist/cli/upgrade-cmd.js.map +1 -0
- package/dist/cli/version.d.ts +3 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +19 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/env.d.ts +17 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +17 -0
- package/dist/env.js.map +1 -0
- package/dist/graph/checker-resolver.d.ts +156 -0
- package/dist/graph/checker-resolver.d.ts.map +1 -0
- package/dist/graph/checker-resolver.js +458 -0
- package/dist/graph/checker-resolver.js.map +1 -0
- package/dist/graph/db.d.ts +318 -0
- package/dist/graph/db.d.ts.map +1 -0
- package/dist/graph/db.js +266 -0
- package/dist/graph/db.js.map +1 -0
- package/dist/graph/index.d.ts +4 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +5 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/local-type-env.d.ts +45 -0
- package/dist/graph/local-type-env.d.ts.map +1 -0
- package/dist/graph/local-type-env.js +59 -0
- package/dist/graph/local-type-env.js.map +1 -0
- package/dist/graph/path-range.d.ts +40 -0
- package/dist/graph/path-range.d.ts.map +1 -0
- package/dist/graph/path-range.js +42 -0
- package/dist/graph/path-range.js.map +1 -0
- package/dist/graph/populate.d.ts +263 -0
- package/dist/graph/populate.d.ts.map +1 -0
- package/dist/graph/populate.js +984 -0
- package/dist/graph/populate.js.map +1 -0
- package/dist/graph/queries.d.ts +114 -0
- package/dist/graph/queries.d.ts.map +1 -0
- package/dist/graph/queries.js +415 -0
- package/dist/graph/queries.js.map +1 -0
- package/dist/graph/sqliteBatch.d.ts +48 -0
- package/dist/graph/sqliteBatch.d.ts.map +1 -0
- package/dist/graph/sqliteBatch.js +93 -0
- package/dist/graph/sqliteBatch.js.map +1 -0
- package/dist/indexer/freshness.d.ts +48 -0
- package/dist/indexer/freshness.d.ts.map +1 -0
- package/dist/indexer/freshness.js +72 -0
- package/dist/indexer/freshness.js.map +1 -0
- package/dist/indexer/import-resolver.d.ts +50 -0
- package/dist/indexer/import-resolver.d.ts.map +1 -0
- package/dist/indexer/import-resolver.js +318 -0
- package/dist/indexer/import-resolver.js.map +1 -0
- package/dist/indexer/index.d.ts +249 -0
- package/dist/indexer/index.d.ts.map +1 -0
- package/dist/indexer/index.js +560 -0
- package/dist/indexer/index.js.map +1 -0
- package/dist/indexer/walker.d.ts +60 -0
- package/dist/indexer/walker.d.ts.map +1 -0
- package/dist/indexer/walker.js +128 -0
- package/dist/indexer/walker.js.map +1 -0
- package/dist/indexer/watcher.d.ts +80 -0
- package/dist/indexer/watcher.d.ts.map +1 -0
- package/dist/indexer/watcher.js +151 -0
- package/dist/indexer/watcher.js.map +1 -0
- package/dist/mcp/context.d.ts +23 -0
- package/dist/mcp/context.d.ts.map +1 -0
- package/dist/mcp/context.js +2 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/register-tools.d.ts +21 -0
- package/dist/mcp/register-tools.d.ts.map +1 -0
- package/dist/mcp/register-tools.js +42 -0
- package/dist/mcp/register-tools.js.map +1 -0
- package/dist/mcp/server.d.ts +58 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +177 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/staleness.d.ts +72 -0
- package/dist/mcp/staleness.d.ts.map +1 -0
- package/dist/mcp/staleness.js +213 -0
- package/dist/mcp/staleness.js.map +1 -0
- package/dist/mcp/startup.d.ts +40 -0
- package/dist/mcp/startup.d.ts.map +1 -0
- package/dist/mcp/startup.js +114 -0
- package/dist/mcp/startup.js.map +1 -0
- package/dist/mcp/tools/_helpers.d.ts +26 -0
- package/dist/mcp/tools/_helpers.d.ts.map +1 -0
- package/dist/mcp/tools/_helpers.js +54 -0
- package/dist/mcp/tools/_helpers.js.map +1 -0
- package/dist/mcp/tools/callers.d.ts +4 -0
- package/dist/mcp/tools/callers.d.ts.map +1 -0
- package/dist/mcp/tools/callers.js +112 -0
- package/dist/mcp/tools/callers.js.map +1 -0
- package/dist/mcp/tools/dependencies.d.ts +4 -0
- package/dist/mcp/tools/dependencies.d.ts.map +1 -0
- package/dist/mcp/tools/dependencies.js +36 -0
- package/dist/mcp/tools/dependencies.js.map +1 -0
- package/dist/mcp/tools/efficiency.d.ts +4 -0
- package/dist/mcp/tools/efficiency.d.ts.map +1 -0
- package/dist/mcp/tools/efficiency.js +39 -0
- package/dist/mcp/tools/efficiency.js.map +1 -0
- package/dist/mcp/tools/exports.d.ts +4 -0
- package/dist/mcp/tools/exports.d.ts.map +1 -0
- package/dist/mcp/tools/exports.js +56 -0
- package/dist/mcp/tools/exports.js.map +1 -0
- package/dist/mcp/tools/implementors.d.ts +4 -0
- package/dist/mcp/tools/implementors.d.ts.map +1 -0
- package/dist/mcp/tools/implementors.js +47 -0
- package/dist/mcp/tools/implementors.js.map +1 -0
- package/dist/mcp/tools/project-skeleton.d.ts +4 -0
- package/dist/mcp/tools/project-skeleton.d.ts.map +1 -0
- package/dist/mcp/tools/project-skeleton.js +61 -0
- package/dist/mcp/tools/project-skeleton.js.map +1 -0
- package/dist/mcp/tools/reindex.d.ts +14 -0
- package/dist/mcp/tools/reindex.d.ts.map +1 -0
- package/dist/mcp/tools/reindex.js +32 -0
- package/dist/mcp/tools/reindex.js.map +1 -0
- package/dist/mcp/tools/rename-impact.d.ts +4 -0
- package/dist/mcp/tools/rename-impact.d.ts.map +1 -0
- package/dist/mcp/tools/rename-impact.js +124 -0
- package/dist/mcp/tools/rename-impact.js.map +1 -0
- package/dist/mcp/tools/search.d.ts +4 -0
- package/dist/mcp/tools/search.d.ts.map +1 -0
- package/dist/mcp/tools/search.js +69 -0
- package/dist/mcp/tools/search.js.map +1 -0
- package/dist/mcp/tools/signature.d.ts +4 -0
- package/dist/mcp/tools/signature.d.ts.map +1 -0
- package/dist/mcp/tools/signature.js +127 -0
- package/dist/mcp/tools/signature.js.map +1 -0
- package/dist/mcp/tools/status.d.ts +4 -0
- package/dist/mcp/tools/status.d.ts.map +1 -0
- package/dist/mcp/tools/status.js +30 -0
- package/dist/mcp/tools/status.js.map +1 -0
- package/dist/search/declex.d.ts +109 -0
- package/dist/search/declex.d.ts.map +1 -0
- package/dist/search/declex.js +242 -0
- package/dist/search/declex.js.map +1 -0
- package/dist/search/fts.d.ts +77 -0
- package/dist/search/fts.d.ts.map +1 -0
- package/dist/search/fts.js +223 -0
- package/dist/search/fts.js.map +1 -0
- package/dist/search/fused.d.ts +110 -0
- package/dist/search/fused.d.ts.map +1 -0
- package/dist/search/fused.js +323 -0
- package/dist/search/fused.js.map +1 -0
- package/dist/search/potential-matches.d.ts +88 -0
- package/dist/search/potential-matches.d.ts.map +1 -0
- package/dist/search/potential-matches.js +83 -0
- package/dist/search/potential-matches.js.map +1 -0
- package/dist/search/scope.d.ts +66 -0
- package/dist/search/scope.d.ts.map +1 -0
- package/dist/search/scope.js +71 -0
- package/dist/search/scope.js.map +1 -0
- package/dist/store/config.d.ts +57 -0
- package/dist/store/config.d.ts.map +1 -0
- package/dist/store/config.js +208 -0
- package/dist/store/config.js.map +1 -0
- package/dist/store/lock.d.ts +101 -0
- package/dist/store/lock.d.ts.map +1 -0
- package/dist/store/lock.js +182 -0
- package/dist/store/lock.js.map +1 -0
- package/dist/store/lockMetrics.d.ts +52 -0
- package/dist/store/lockMetrics.d.ts.map +1 -0
- package/dist/store/lockMetrics.js +29 -0
- package/dist/store/lockMetrics.js.map +1 -0
- package/dist/store/sqliteChunkStore.d.ts +44 -0
- package/dist/store/sqliteChunkStore.d.ts.map +1 -0
- package/dist/store/sqliteChunkStore.js +135 -0
- package/dist/store/sqliteChunkStore.js.map +1 -0
- package/dist/telemetry/lockMetricsSummary.d.ts +42 -0
- package/dist/telemetry/lockMetricsSummary.d.ts.map +1 -0
- package/dist/telemetry/lockMetricsSummary.js +139 -0
- package/dist/telemetry/lockMetricsSummary.js.map +1 -0
- package/dist/telemetry/metrics.d.ts +140 -0
- package/dist/telemetry/metrics.d.ts.map +1 -0
- package/dist/telemetry/metrics.js +312 -0
- package/dist/telemetry/metrics.js.map +1 -0
- package/dist/telemetry/tokenizer.d.ts +125 -0
- package/dist/telemetry/tokenizer.d.ts.map +1 -0
- package/dist/telemetry/tokenizer.js +174 -0
- package/dist/telemetry/tokenizer.js.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-type-env.d.ts","sourceRoot":"","sources":["../../src/graph/local-type-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,qBAAa,oBAAoB;IAC/B,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAuC;IACrE,0EAA0E;IAC1E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqE;IAEnG,gFAAgF;IAChF,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIrC,8EAA8E;IAC9E,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIxC;;;;OAIG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAItF;;;;;;;;OAQG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,gBAAgB,CAAA;KAAE,GAAG,IAAI;CAS9G"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synchronous heuristic resolver for `POTENTIAL_CALL` edges (§10.3.1).
|
|
3
|
+
*
|
|
4
|
+
* Built up per function/method scope during the AST walk, then queried for
|
|
5
|
+
* each call site. It resolves a call's receiver to a callee *symbol name* using
|
|
6
|
+
* a small set of high-frequency, statically-decidable patterns. It does NOT
|
|
7
|
+
* touch the database — whether the resolved name corresponds to a real indexed
|
|
8
|
+
* symbol is decided later, in `insertEdges`' name→id resolution (an unknown
|
|
9
|
+
* name simply yields no edge).
|
|
10
|
+
*
|
|
11
|
+
* Intentionally conservative: false negatives (missed edges) are acceptable;
|
|
12
|
+
* false positives (wrong edges) are not, as they would poison the
|
|
13
|
+
* `verified_callers` contract in `mast_callers`.
|
|
14
|
+
*/
|
|
15
|
+
export class LocalTypeEnvironment {
|
|
16
|
+
/** Named imports and same-file top-level symbols, by bare name. */
|
|
17
|
+
bareCallables = new Map();
|
|
18
|
+
/** Receiver expression (`repo`, `this.repo`) → its resolved type name. */
|
|
19
|
+
receiverTypes = new Map();
|
|
20
|
+
/** `import { handleLogin } from './h'` → bare call `handleLogin()` resolves. */
|
|
21
|
+
recordImport(localName) {
|
|
22
|
+
if (!this.bareCallables.has(localName))
|
|
23
|
+
this.bareCallables.set(localName, 'import');
|
|
24
|
+
}
|
|
25
|
+
/** A top-level function/const in the same file → bare call resolves to it. */
|
|
26
|
+
recordSameFileSymbol(name) {
|
|
27
|
+
if (!this.bareCallables.has(name))
|
|
28
|
+
this.bareCallables.set(name, 'same_file');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A typed receiver binding. `receiver` is the literal receiver expression as
|
|
32
|
+
* it appears before the method call — e.g. `repo` (local/param) or
|
|
33
|
+
* `this.repo` (class field / constructor parameter property).
|
|
34
|
+
*/
|
|
35
|
+
recordReceiverType(receiver, type, resolution) {
|
|
36
|
+
if (!this.receiverTypes.has(receiver))
|
|
37
|
+
this.receiverTypes.set(receiver, { type, resolution });
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a call to `{ callee, resolution }`, or null when the receiver
|
|
41
|
+
* cannot be statically linked.
|
|
42
|
+
*
|
|
43
|
+
* @param receiver - the receiver expression (`repo`, `this.repo`), or null
|
|
44
|
+
* for a bare call (`foo()`).
|
|
45
|
+
* @param method - the called identifier (the function name for a bare call,
|
|
46
|
+
* the member name for a receiver call).
|
|
47
|
+
*/
|
|
48
|
+
resolveCall(receiver, method) {
|
|
49
|
+
if (receiver === null) {
|
|
50
|
+
const resolution = this.bareCallables.get(method);
|
|
51
|
+
return resolution === undefined ? null : { callee: method, resolution };
|
|
52
|
+
}
|
|
53
|
+
const binding = this.receiverTypes.get(receiver);
|
|
54
|
+
if (binding === undefined)
|
|
55
|
+
return null;
|
|
56
|
+
return { callee: `${binding.type}.${method}`, resolution: binding.resolution };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=local-type-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-type-env.js","sourceRoot":"","sources":["../../src/graph/local-type-env.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,oBAAoB;IAC/B,mEAAmE;IAClD,aAAa,GAAG,IAAI,GAAG,EAA4B,CAAC;IACrE,0EAA0E;IACzD,aAAa,GAAG,IAAI,GAAG,EAA0D,CAAC;IAEnG,gFAAgF;IAChF,YAAY,CAAC,SAAiB;QAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC;YAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACtF,CAAC;IAED,8EAA8E;IAC9E,oBAAoB,CAAC,IAAY;QAC/B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC/E,CAAC;IAED;;;;OAIG;IACH,kBAAkB,CAAC,QAAgB,EAAE,IAAY,EAAE,UAA4B;QAC7E,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IAChG,CAAC;IAED;;;;;;;;OAQG;IACH,WAAW,CAAC,QAAuB,EAAE,MAAc;QACjD,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAClD,OAAO,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;QAC1E,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACvC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;IACjF,CAAC;CACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Half-open range bounds for "this path starts with P" queries.
|
|
3
|
+
*
|
|
4
|
+
* The obvious spelling, `path LIKE P || '%'`, is wrong three ways:
|
|
5
|
+
*
|
|
6
|
+
* - **`_` and `%` inside P act as wildcards.** Paths are not escaped before
|
|
7
|
+
* interpolation, so `src/my_util.ts` also matches `src/my.util.ts`. With
|
|
8
|
+
* `ORDER BY path` that returns the wrong row, because `.` (0x2E) sorts
|
|
9
|
+
* before `_` (0x5F).
|
|
10
|
+
* - **LIKE is case-insensitive for ASCII.** `case_sensitive_like` is OFF by
|
|
11
|
+
* default, so `src/Foo.ts` matches `src/FOO.ts` — and `FOO` sorts first.
|
|
12
|
+
* - **It cannot use the index.** SQLite's LIKE optimization requires either
|
|
13
|
+
* `case_sensitive_like=ON` or a NOCASE-collated index; `files.path`'s
|
|
14
|
+
* implicit UNIQUE index is BINARY. The plan degrades to `SCAN files USING
|
|
15
|
+
* COVERING INDEX sqlite_autoindex_files_1` — the only scan among the
|
|
16
|
+
* resolver's five lookups (FINDINGS.md §2.3).
|
|
17
|
+
*
|
|
18
|
+
* A half-open range on the BINARY collation fixes all three at once: it is
|
|
19
|
+
* literal, case-sensitive, and a plain two-sided index seek.
|
|
20
|
+
*
|
|
21
|
+
* Exactness: for any suffix S, `P <= P||S < P||U+10FFFF` holds, and any row in
|
|
22
|
+
* `[P, P||U+10FFFF)` must start with P — a row differing from P at some
|
|
23
|
+
* position inside P is either below P or at/above the bound. The single
|
|
24
|
+
* excluded case is a path whose character immediately after P is U+10FFFF, the
|
|
25
|
+
* highest code point, a permanently-unassigned noncharacter that cannot appear
|
|
26
|
+
* in a filename.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* The exclusive upper bound for paths beginning with `prefix`.
|
|
30
|
+
*
|
|
31
|
+
* Pair with a `>= prefix` lower bound:
|
|
32
|
+
* `.where('path', '>=', p).where('path', '<', pathPrefixUpperBound(p))`.
|
|
33
|
+
*
|
|
34
|
+
* The bound is only ordered correctly under SQLite's BINARY collation, which
|
|
35
|
+
* is `memcmp` over UTF-8. JavaScript's `<` compares UTF-16 code units, under
|
|
36
|
+
* which U+FFFF sorts ABOVE the surrogate pair for U+10FFFF — so this value is
|
|
37
|
+
* for SQL comparison only. Do not use it to filter paths in JS.
|
|
38
|
+
*/
|
|
39
|
+
export declare function pathPrefixUpperBound(prefix: string): string;
|
|
40
|
+
//# sourceMappingURL=path-range.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-range.d.ts","sourceRoot":"","sources":["../../src/graph/path-range.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Half-open range bounds for "this path starts with P" queries.
|
|
3
|
+
*
|
|
4
|
+
* The obvious spelling, `path LIKE P || '%'`, is wrong three ways:
|
|
5
|
+
*
|
|
6
|
+
* - **`_` and `%` inside P act as wildcards.** Paths are not escaped before
|
|
7
|
+
* interpolation, so `src/my_util.ts` also matches `src/my.util.ts`. With
|
|
8
|
+
* `ORDER BY path` that returns the wrong row, because `.` (0x2E) sorts
|
|
9
|
+
* before `_` (0x5F).
|
|
10
|
+
* - **LIKE is case-insensitive for ASCII.** `case_sensitive_like` is OFF by
|
|
11
|
+
* default, so `src/Foo.ts` matches `src/FOO.ts` — and `FOO` sorts first.
|
|
12
|
+
* - **It cannot use the index.** SQLite's LIKE optimization requires either
|
|
13
|
+
* `case_sensitive_like=ON` or a NOCASE-collated index; `files.path`'s
|
|
14
|
+
* implicit UNIQUE index is BINARY. The plan degrades to `SCAN files USING
|
|
15
|
+
* COVERING INDEX sqlite_autoindex_files_1` — the only scan among the
|
|
16
|
+
* resolver's five lookups (FINDINGS.md §2.3).
|
|
17
|
+
*
|
|
18
|
+
* A half-open range on the BINARY collation fixes all three at once: it is
|
|
19
|
+
* literal, case-sensitive, and a plain two-sided index seek.
|
|
20
|
+
*
|
|
21
|
+
* Exactness: for any suffix S, `P <= P||S < P||U+10FFFF` holds, and any row in
|
|
22
|
+
* `[P, P||U+10FFFF)` must start with P — a row differing from P at some
|
|
23
|
+
* position inside P is either below P or at/above the bound. The single
|
|
24
|
+
* excluded case is a path whose character immediately after P is U+10FFFF, the
|
|
25
|
+
* highest code point, a permanently-unassigned noncharacter that cannot appear
|
|
26
|
+
* in a filename.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* The exclusive upper bound for paths beginning with `prefix`.
|
|
30
|
+
*
|
|
31
|
+
* Pair with a `>= prefix` lower bound:
|
|
32
|
+
* `.where('path', '>=', p).where('path', '<', pathPrefixUpperBound(p))`.
|
|
33
|
+
*
|
|
34
|
+
* The bound is only ordered correctly under SQLite's BINARY collation, which
|
|
35
|
+
* is `memcmp` over UTF-8. JavaScript's `<` compares UTF-16 code units, under
|
|
36
|
+
* which U+FFFF sorts ABOVE the surrogate pair for U+10FFFF — so this value is
|
|
37
|
+
* for SQL comparison only. Do not use it to filter paths in JS.
|
|
38
|
+
*/
|
|
39
|
+
export function pathPrefixUpperBound(prefix) {
|
|
40
|
+
return `${prefix}\u{10FFFF}`;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=path-range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-range.js","sourceRoot":"","sources":["../../src/graph/path-range.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,OAAO,GAAG,MAAM,YAAY,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { type Db } from './db.js';
|
|
2
|
+
import type { Chunk, Language, SymbolRecord, ImportRecord, EdgeRecord } from '../ast/types.js';
|
|
3
|
+
import type { IdentifierRow, StarReExportRecord } from '../ast/extractor.js';
|
|
4
|
+
export type { SymbolRecord, ImportRecord, EdgeRecord };
|
|
5
|
+
export interface FileIndexData {
|
|
6
|
+
readonly filePath: string;
|
|
7
|
+
readonly language: Language;
|
|
8
|
+
readonly mtime: number;
|
|
9
|
+
readonly chunks: readonly Chunk[];
|
|
10
|
+
readonly imports: readonly ImportRecord[];
|
|
11
|
+
readonly symbols: readonly SymbolRecord[];
|
|
12
|
+
/**
|
|
13
|
+
* Pre-extracted identifier tokens per chunk, produced by the language
|
|
14
|
+
* extractor — what counts as an "identifier" is a language-level judgment
|
|
15
|
+
* (markdown contributes none). This layer only persists them.
|
|
16
|
+
*/
|
|
17
|
+
readonly identifierRows: readonly IdentifierRow[];
|
|
18
|
+
/** Populated on the second pass after all symbols are inserted. */
|
|
19
|
+
readonly edges: readonly EdgeRecord[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Result of {@link populateFile}: the new `files` row id, plus how many
|
|
23
|
+
* previously-stored chunks were replaced (for `IndexResult.chunksRemoved`
|
|
24
|
+
* accounting — mirrors the removed-count `SqliteChunkStore.replaceChunksForFile`
|
|
25
|
+
* used to report directly before chunks moved into this transaction).
|
|
26
|
+
*/
|
|
27
|
+
export interface PopulateFileResult {
|
|
28
|
+
readonly fileId: number;
|
|
29
|
+
readonly chunksRemoved: number;
|
|
30
|
+
/**
|
|
31
|
+
* False when the monotonic write-guard (F12, see {@link populateFile}'s
|
|
32
|
+
* doc) refused this write because the stored row's mtime already exceeds
|
|
33
|
+
* `data.mtime` — this call lost a race against a fresher write. The row is
|
|
34
|
+
* left completely unchanged: `fileId` is the EXISTING row's id and
|
|
35
|
+
* `chunksRemoved` is 0. Callers must surface this (count it, log it) rather
|
|
36
|
+
* than treat it as an ordinary successful write — a skipped write must
|
|
37
|
+
* never be indistinguishable from a completed one (the `writeErrors`
|
|
38
|
+
* precedent this mirrors).
|
|
39
|
+
*/
|
|
40
|
+
readonly written: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Test-only injection point (§4.4 DI): when provided, `populateFile` calls
|
|
44
|
+
* this instead of writing the `chunks` table inline. Lets write-failure tests
|
|
45
|
+
* (`indexer/__tests__/write-failures.test.ts`) inject a chunk-store failure
|
|
46
|
+
* with an in-memory fake — since the call happens INSIDE this function's own
|
|
47
|
+
* `BEGIN IMMEDIATE` transaction, a rejection here still rolls back everything
|
|
48
|
+
* else the transaction already wrote (symbols/imports/chunk_fts/identifier_fts),
|
|
49
|
+
* proving the same atomicity the production (no-override) path gets from
|
|
50
|
+
* writing straight to the shared `chunks` table. Structurally compatible with
|
|
51
|
+
* `ChunkStore.replaceChunksForFile` (store/sqliteChunkStore.js) without this
|
|
52
|
+
* module importing that type — graph/ stays independent of store/'s DI seam,
|
|
53
|
+
* only its method shape.
|
|
54
|
+
*/
|
|
55
|
+
export type ChunkWriter = (filePath: string, chunks: readonly Chunk[]) => Promise<number>;
|
|
56
|
+
/**
|
|
57
|
+
* Cumulative wall-clock, in ms, for the four regions that tile a file's write.
|
|
58
|
+
*
|
|
59
|
+
* Eval instrument (E1-FTS, IMPLEMENTATION_PLAN.md § E1-FTS PRE-REGISTRATION,
|
|
60
|
+
* 2026-08-14). E1-PHASE localised the super-linear growth exponent to the
|
|
61
|
+
* `write` phase (`b_write = 1.9685`, 94.01% of T9's run) but no further; these
|
|
62
|
+
* four decompose that phase.
|
|
63
|
+
*
|
|
64
|
+
* Mutable by design — it is an accumulator summed across every `populateFile`
|
|
65
|
+
* call in a run, in the same shape and for the same reason as `runIndex`'s own
|
|
66
|
+
* `phase` record. Data, not behaviour (§4.2), so it is a record and not a class.
|
|
67
|
+
*
|
|
68
|
+
* **Every region is timed by its own start and end. None is computed by
|
|
69
|
+
* subtraction.** A `rest` derived as `write − fts` would silently absorb any
|
|
70
|
+
* cost the other timers missed, which is precisely how this experiment's first
|
|
71
|
+
* draft would have produced a false null: FTS5 flushes its segments at COMMIT
|
|
72
|
+
* (`fts5SyncMethod`, `sqlite3.c:262278`; `xCommit` is a no-op at `:262302`),
|
|
73
|
+
* not inside the INSERT, so a naive `fts_ms` around the inserts misses them.
|
|
74
|
+
* Because the regions are timed independently they need not tile exactly, and
|
|
75
|
+
* the shortfall is the point: unattributed work shows up as a tiling gap the
|
|
76
|
+
* harness's ≥ 0.95 gate can see, instead of being absorbed in silence.
|
|
77
|
+
*/
|
|
78
|
+
export interface WriteSpansMs {
|
|
79
|
+
/** The two `DELETE FROM *_fts WHERE file_path = ?` statements. */
|
|
80
|
+
fts_del: number;
|
|
81
|
+
/** The two batched `INSERT INTO *_fts` loops. */
|
|
82
|
+
fts_ins: number;
|
|
83
|
+
/** The per-file `COMMIT`, where FTS5's segment flush actually happens. */
|
|
84
|
+
commit: number;
|
|
85
|
+
/** The monotonic guard, the `files` row, and the chunks/symbols/imports writes. */
|
|
86
|
+
rest: number;
|
|
87
|
+
/**
|
|
88
|
+
* Per-file transaction machinery: connection checkout, the two `busy_timeout`
|
|
89
|
+
* pragmas, and `BEGIN IMMEDIATE`.
|
|
90
|
+
*
|
|
91
|
+
* AMENDMENT 1 to the registration (2026-08-14, pre-run, no data collected).
|
|
92
|
+
* The four registered spans left this unattributed, and it is a per-FILE
|
|
93
|
+
* constant — measured at 0.72 ms/file, which is ~33% of T1's write phase and
|
|
94
|
+
* ~2% of T9's. Two consequences, both bad, both caught by running the
|
|
95
|
+
* instrument before the experiment: the registered tiling gate would have
|
|
96
|
+
* voided the cheapest rung, the one that anchors the exponent, while passing
|
|
97
|
+
* the rung where the answer is least in doubt; and folding it into `rest`
|
|
98
|
+
* instead would have contaminated `b_rest` — the PARTIAL condition — with a
|
|
99
|
+
* per-file constant that pulls any exponent toward 1.0, biasing PARTIAL
|
|
100
|
+
* toward not firing.
|
|
101
|
+
*/
|
|
102
|
+
txn: number;
|
|
103
|
+
/**
|
|
104
|
+
* `structure.lock` acquisition and release, once per 16-file write batch.
|
|
105
|
+
*
|
|
106
|
+
* The only span not accumulated by {@link populateFile} — the indexer owns it,
|
|
107
|
+
* because the lock is per-BATCH and wraps the whole file loop (F1,
|
|
108
|
+
* `indexer/index.ts`). Named separately rather than folded in because the
|
|
109
|
+
* `phaseMs` docblock already warns that `write` includes lock wait and "must
|
|
110
|
+
* not be read as pure I/O under concurrency"; with this span that caveat
|
|
111
|
+
* becomes a number instead of a warning.
|
|
112
|
+
*
|
|
113
|
+
* AMENDMENT 1, same provenance as {@link WriteSpansMs.txn}.
|
|
114
|
+
*/
|
|
115
|
+
lock: number;
|
|
116
|
+
}
|
|
117
|
+
/** A zeroed {@link WriteSpansMs} accumulator. */
|
|
118
|
+
export declare function newWriteSpans(): WriteSpansMs;
|
|
119
|
+
/**
|
|
120
|
+
* Optional per-call knobs for {@link populateFile}.
|
|
121
|
+
*
|
|
122
|
+
* An options object rather than more positional parameters: `chunkWriter` was
|
|
123
|
+
* the third argument, and the two additions here are both eval instruments that
|
|
124
|
+
* would otherwise have to be threaded past it in a fixed order.
|
|
125
|
+
*/
|
|
126
|
+
export interface PopulateFileOptions {
|
|
127
|
+
/** See {@link ChunkWriter} — test-only chunk-write substitution. */
|
|
128
|
+
readonly chunkWriter?: ChunkWriter;
|
|
129
|
+
/** When supplied, this call's four write regions are accumulated into it. */
|
|
130
|
+
readonly spans?: WriteSpansMs;
|
|
131
|
+
/**
|
|
132
|
+
* **Eval-only, and unsafe outside a cold build.** Skips the two
|
|
133
|
+
* `DELETE FROM *_fts WHERE file_path = ?` statements.
|
|
134
|
+
*
|
|
135
|
+
* This is E1-FTS's arm G — the causal test for whether those deletes carry
|
|
136
|
+
* the write phase's exponent, and a rehearsal of the fix (guarding them on
|
|
137
|
+
* whether the file was previously indexed, which the monotonic-guard SELECT
|
|
138
|
+
* below already knows).
|
|
139
|
+
*
|
|
140
|
+
* On a **cold** build the skipped deletes match zero rows, so the finished
|
|
141
|
+
* database is byte-identical to the control's — that identity is what makes
|
|
142
|
+
* arm G confound-free, and it is asserted both by
|
|
143
|
+
* `__tests__/write-spans.test.ts` and by a per-rung gate in the harness. On
|
|
144
|
+
* **any other** path it corrupts the index, leaving the previous version's
|
|
145
|
+
* FTS rows behind alongside the new ones while the ordinary tables replace
|
|
146
|
+
* correctly. The CLI therefore refuses to combine it with `--incremental`.
|
|
147
|
+
*/
|
|
148
|
+
readonly skipFtsDeletes?: boolean;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Dedicated `busy_timeout` (ms) for {@link populateFile}'s own transaction —
|
|
152
|
+
* distinct from `graph.db`'s shared 5000ms connection default
|
|
153
|
+
* (`openDatabase`, `graph/db.ts`).
|
|
154
|
+
*
|
|
155
|
+
* F11 (`IMPLEMENTATION_PLAN.md` "Replace fail-fast advisory locking") moves
|
|
156
|
+
* this transaction from Kysely's deferred `BEGIN` to `BEGIN IMMEDIATE` (see
|
|
157
|
+
* `populateFile`'s doc comment for why) so it takes the write reservation up
|
|
158
|
+
* front instead of discovering contention via `SQLITE_BUSY_SNAPSHOT` on its
|
|
159
|
+
* own commit (F13). That makes the busy_timeout wait live for the first time
|
|
160
|
+
* on this path — under the inherited 5000ms default, ANY genuine contention
|
|
161
|
+
* would block better-sqlite3's synchronous busy-wait for up to 5 seconds,
|
|
162
|
+
* freezing the ENTIRE `mast serve` process (its native busy-wait blocks the
|
|
163
|
+
* whole event loop, not just the calling promise chain — measured directly in
|
|
164
|
+
* `eval/eventloop-probe.json`, see IMPLEMENTATION_PLAN.md's "HARD CONSTRAINT
|
|
165
|
+
* ON F11"). 200ms keeps that freeze window in the same neighbourhood as the
|
|
166
|
+
* 3x100ms `structure.lock` retry budget the JIT path used to pay instead of
|
|
167
|
+
* ever reaching SQLite's own wait (`mcp/staleness.ts`, pre-F11), rather than
|
|
168
|
+
* inheriting the 25x-longer 5000ms shared default. Set and restored only
|
|
169
|
+
* around this transaction's own exclusive connection window (see
|
|
170
|
+
* `populateFile`) so no unrelated statement on the shared connection ever
|
|
171
|
+
* inherits the short value.
|
|
172
|
+
*/
|
|
173
|
+
export declare const IMMEDIATE_WRITE_BUSY_TIMEOUT_MS = 200;
|
|
174
|
+
/**
|
|
175
|
+
* Delete all rows for `filePath` from files, symbols, edges, imports,
|
|
176
|
+
* re_export_files (cascaded via FK), chunks, and FTS5 tables, then re-insert
|
|
177
|
+
* everything from `data` — all within a single SQLite transaction.
|
|
178
|
+
*
|
|
179
|
+
* M1 (`eval/GITNEXUS_COMPARISON.md` §15.1): chunk rows join this SAME
|
|
180
|
+
* transaction instead of being written by a separate chunk-store call before
|
|
181
|
+
* this function runs. That closes the consistency seam the spike deliberately
|
|
182
|
+
* left open — a chunk-store write succeeding while the graph write then fails
|
|
183
|
+
* (or vice versa) can no longer leave the two out of sync, because there is
|
|
184
|
+
* only one commit/rollback boundary for both.
|
|
185
|
+
*
|
|
186
|
+
* The two-pass structure (insert all symbols first, then insert all edges
|
|
187
|
+
* via `insertEdges`) is required for cross-file POTENTIAL_CALL resolution.
|
|
188
|
+
*
|
|
189
|
+
* **Monotonic write-guard (F12, `GITNEXUS_COMPARISON.md` Stage 1)**: refuses
|
|
190
|
+
* to replace a row whose stored `mtime` already exceeds `data.mtime`. Two
|
|
191
|
+
* writers can legitimately race to write the same file — a reindex batch and
|
|
192
|
+
* a concurrent JIT refresh (`mcp/staleness.ts`) both call this function.
|
|
193
|
+
* Without this guard, whichever writer commits LAST wins even if it parsed
|
|
194
|
+
* OLDER content — silently regressing the row. With it, the write carrying
|
|
195
|
+
* the NEWER stamp always wins, independent of arrival order, which is what
|
|
196
|
+
* actually makes the ordering guarantee in `runIndex`'s WHY-comment
|
|
197
|
+
* (`indexer/index.ts`) hold. This is strictly subject to mtime-granularity
|
|
198
|
+
* blindness (see that WHY-comment) — two writes landing in the same tick
|
|
199
|
+
* compare equal, not ordered, and whichever call happens second wins; that is
|
|
200
|
+
* a known, documented limitation, not something this guard claims to solve.
|
|
201
|
+
*
|
|
202
|
+
* **`BEGIN IMMEDIATE`, not a plain `db.transaction()` (F11)**: Kysely's
|
|
203
|
+
* better-sqlite3 driver only ever issues a deferred `BEGIN`
|
|
204
|
+
* (`sqlite-driver.js`'s `beginTransaction` — `CompiledQuery.raw('begin')`,
|
|
205
|
+
* hardcoded), and there is no config knob to change that. A deferred-BEGIN
|
|
206
|
+
* read-then-write (this function's own monotonic-guard SELECT, followed by
|
|
207
|
+
* its writes) can fail `SQLITE_BUSY_SNAPSHOT` in 1-2ms against ANY competing
|
|
208
|
+
* holder — even one that never commits — which `busy_timeout` cannot wait
|
|
209
|
+
* out, because the snapshot is already stale, not merely locked (F13,
|
|
210
|
+
* `eval/e7-round2.json`, 52 real occurrences). `BEGIN IMMEDIATE` takes the
|
|
211
|
+
* write reservation up front instead, eliminating that failure class and
|
|
212
|
+
* falling back to an honest bounded `busy_timeout` wait when genuinely
|
|
213
|
+
* contended (`eval/eventloop-probe.json` Phase 2/3). Since Kysely cannot be
|
|
214
|
+
* asked for `BEGIN IMMEDIATE` via `db.transaction()`, this function instead
|
|
215
|
+
* checks out the underlying connection exclusively via `db.connection()` and
|
|
216
|
+
* issues `begin immediate` / `commit` / `rollback` as raw statements around
|
|
217
|
+
* the same statement sequence a `db.transaction()` callback would have run.
|
|
218
|
+
* Kysely's SQLite adapter reports `supportsMultipleConnections: false`, so
|
|
219
|
+
* `RuntimeDriver` (`runtime-driver.js`) guards every connection acquisition
|
|
220
|
+
* on a given `Db` instance with one `ConnectionMutex` — verified by reading
|
|
221
|
+
* that source AND empirically (20 independently-staggered concurrent
|
|
222
|
+
* `db.connection().execute()` calls against one shared `Db`: zero
|
|
223
|
+
* interleaving errors, all 20 rows landed, in submission order). That means
|
|
224
|
+
* no OTHER statement issued through the SAME `Db` instance — chiefly a
|
|
225
|
+
* same-process concurrent JIT refresh of a different file, now that F11
|
|
226
|
+
* removes `structure.lock` from that path — can interleave into this
|
|
227
|
+
* transaction's raw `begin immediate` / ... / `commit` window. A genuinely
|
|
228
|
+
* different connection (reindex's own `openDatabase()` call in
|
|
229
|
+
* `indexer/index.ts`, or another `mast serve` process) is real SQLite-level
|
|
230
|
+
* concurrency, correctly governed by `BEGIN IMMEDIATE`'s write-reservation
|
|
231
|
+
* semantics and this transaction's own short `busy_timeout`
|
|
232
|
+
* ({@link IMMEDIATE_WRITE_BUSY_TIMEOUT_MS}), not by this in-process mutex.
|
|
233
|
+
*/
|
|
234
|
+
export declare function populateFile(db: Db, data: Omit<FileIndexData, 'edges'>, options?: PopulateFileOptions): Promise<PopulateFileResult>;
|
|
235
|
+
/**
|
|
236
|
+
* Second-pass edge insertion. Run after ALL files' symbols have been inserted
|
|
237
|
+
* so cross-file references resolve correctly.
|
|
238
|
+
*
|
|
239
|
+
* Each `EdgeRecord` uses symbol names, which are resolved to IDs here.
|
|
240
|
+
* Unresolved names are silently skipped (external or not-yet-indexed).
|
|
241
|
+
*/
|
|
242
|
+
export declare function insertEdges(db: Db, filePath: string, edges: readonly EdgeRecord[]): Promise<void>;
|
|
243
|
+
/**
|
|
244
|
+
* Second-pass star re-export insertion (`export * from './x'` → one
|
|
245
|
+
* `re_export_files` row per resolved target). Runs after all files' rows
|
|
246
|
+
* exist, like `insertEdges`, because the target file may be indexed later in
|
|
247
|
+
* the same run. Unresolved or unindexed targets are silently skipped.
|
|
248
|
+
*/
|
|
249
|
+
export declare function insertReExportFiles(db: Db, filePath: string, stars: readonly StarReExportRecord[]): Promise<void>;
|
|
250
|
+
/**
|
|
251
|
+
* Remove all data for files that were present in the previous manifest but
|
|
252
|
+
* are absent from the current filesystem scan (deleted files). Returns the
|
|
253
|
+
* number of `chunks` rows removed (§ `IndexResult.chunksRemoved`).
|
|
254
|
+
*
|
|
255
|
+
* `chunks` (M1, §15.1) and the FTS5 virtual tables (chunk_fts, identifier_fts)
|
|
256
|
+
* do not participate in SQLite FK cascades, so all three must be cleaned up
|
|
257
|
+
* explicitly before the files row is deleted. Wrapped in one transaction so a
|
|
258
|
+
* deleted-file cleanup is atomic the same way `populateFile` is — a failure
|
|
259
|
+
* partway through cannot leave chunks/FTS rows orphaned from a `files` row
|
|
260
|
+
* that was (or wasn't) removed.
|
|
261
|
+
*/
|
|
262
|
+
export declare function removeDeletedFiles(db: Db, deletedPaths: readonly string[]): Promise<number>;
|
|
263
|
+
//# sourceMappingURL=populate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"populate.d.ts","sourceRoot":"","sources":["../../src/graph/populate.ts"],"names":[],"mappings":"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"}
|