@dimassetoid/septum-mcp 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -55
- package/package.json +7 -5
- package/src/cli/commands/check.ts +14 -10
- package/src/cli/commands/hook.ts +41 -6
- package/src/cli/commands/init.ts +10 -1
- package/src/cli/commands/stats.ts +33 -0
- package/src/cli/commands/sync-progress.ts +71 -0
- package/src/cli/commands/sync.ts +32 -4
- package/src/cli/index.ts +7 -0
- package/src/cli/templates/hooks.ts +3 -14
- package/src/cli/templates/skill.ts +17 -10
- package/src/core/boundary/audit.ts +383 -0
- package/src/core/boundary/evaluator.ts +251 -114
- package/src/core/boundary/staged-auditor.ts +147 -55
- package/src/core/config/domain-ownership.ts +6 -4
- package/src/core/config/domain-registration.ts +141 -0
- package/src/core/config/loader.ts +1 -25
- package/src/core/config/schema.ts +24 -36
- package/src/core/database/client.ts +2 -0
- package/src/core/database/repositories/dependency.repository.ts +334 -572
- package/src/core/database/repositories/domain.repository.ts +2 -1
- package/src/core/database/repositories/file.repository.ts +10 -0
- package/src/core/database/repositories/symbol.repository.ts +97 -398
- package/src/core/database/repository.ts +68 -9
- package/src/core/database/schema.ts +26 -0
- package/src/core/discovery/declarative-routes.ts +69 -0
- package/src/core/discovery/framework-detector.ts +149 -0
- package/src/core/discovery/navigation.ts +222 -58
- package/src/core/discovery/topology-detector.ts +93 -168
- package/src/core/errors.ts +19 -0
- package/src/core/ingestion/pipeline.ts +287 -88
- package/src/core/parser/extractors/base.ts +11 -3
- package/src/core/parser/extractors/csharp.ts +2 -2
- package/src/core/parser/extractors/django-routing.ts +163 -0
- package/src/core/parser/extractors/django-semantic.ts +397 -481
- package/src/core/parser/extractors/elysia-semantic.ts +172 -475
- package/src/core/parser/extractors/express-semantic.ts +195 -383
- package/src/core/parser/extractors/fastapi-semantic.ts +178 -361
- package/src/core/parser/extractors/fastify-semantic.ts +216 -717
- package/src/core/parser/extractors/flask-semantic.ts +89 -352
- package/src/core/parser/extractors/go-routing.ts +344 -0
- package/src/core/parser/extractors/go-semantic.ts +205 -562
- package/src/core/parser/extractors/go.ts +6 -3
- package/src/core/parser/extractors/graphql-entrypoint.ts +146 -0
- package/src/core/parser/extractors/hono-semantic.ts +132 -509
- package/src/core/parser/extractors/java.ts +2 -2
- package/src/core/parser/extractors/laravel-routing.ts +263 -0
- package/src/core/parser/extractors/laravel-semantic.ts +143 -335
- package/src/core/parser/extractors/manifest-helpers.ts +64 -0
- package/src/core/parser/extractors/mcp-cli-dispatch.ts +268 -0
- package/src/core/parser/extractors/mcp-cli-semantic.ts +82 -333
- package/src/core/parser/extractors/nestjs-semantic.ts +238 -494
- package/src/core/parser/extractors/nextjs-semantic.ts +164 -0
- package/src/core/parser/extractors/php-ast-helpers.ts +51 -0
- package/src/core/parser/extractors/php.ts +1 -1
- package/src/core/parser/extractors/python-route-ast.ts +249 -0
- package/src/core/parser/extractors/python.ts +5 -9
- package/src/core/parser/extractors/registry.ts +2 -0
- package/src/core/parser/extractors/route-prefixes.ts +43 -0
- package/src/core/parser/extractors/ruby.ts +2 -2
- package/src/core/parser/extractors/rust.ts +4 -4
- package/src/core/parser/extractors/symfony-routing.ts +114 -0
- package/src/core/parser/extractors/symfony-semantic.ts +72 -226
- package/src/core/parser/extractors/typescript-bindings.ts +333 -0
- package/src/core/parser/extractors/typescript-compiler-fallback.ts +380 -0
- package/src/core/parser/extractors/typescript-fallback.ts +207 -0
- package/src/core/parser/extractors/typescript-route-context.ts +58 -0
- package/src/core/parser/extractors/typescript.ts +23 -216
- package/src/core/parser/language-capabilities.ts +1 -1
- package/src/core/parser/schema/providers/laravel-migration-provider.ts +4 -1
- package/src/core/parser/wasm-loader.ts +6 -2
- package/src/core/resolver/ast-method-tracer.ts +230 -0
- package/src/core/resolver/call-graph-helpers.ts +72 -0
- package/src/core/resolver/call-graph-tracer.ts +169 -414
- package/src/core/resolver/dependency-analysis.ts +593 -0
- package/src/core/resolver/import-candidates.ts +120 -0
- package/src/core/resolver/import-evidence.ts +88 -0
- package/src/core/resolver/import-resolver.ts +60 -7
- package/src/core/resolver/interpretation-inputs.ts +60 -2
- package/src/core/resolver/languages/python.ts +31 -13
- package/src/core/resolver/languages/shared.ts +4 -1
- package/src/core/resolver/module-resolver.ts +10 -3
- package/src/core/resolver/path-resolver.ts +6 -3
- package/src/core/resolver/polyglot-slice-tracer.ts +197 -0
- package/src/core/resolver/slice-catalog.ts +21 -6
- package/src/core/resolver/slice-format.ts +13 -0
- package/src/core/resolver/slice-selection.ts +237 -0
- package/src/core/resolver/symbol-impact.ts +104 -8
- package/src/core/resolver/symbol-locator.ts +82 -15
- package/src/core/resolver/vertical-slice-tracer.ts +31 -230
- package/src/core/resources/ignore.ts +0 -1
- package/src/core/resources/limits.ts +2 -1
- package/src/core/resources/work-queue.ts +167 -4
- package/src/core/retrieval/context-page.ts +11 -4
- package/src/core/retrieval/context.ts +363 -226
- package/src/{mcp/tools/get-symbol.ts → core/retrieval/source-context.ts} +145 -96
- package/src/core/retrieval/symbol-details.ts +453 -0
- package/src/core/retrieval/symbol-evidence.ts +3 -3
- package/src/core/retrieval/typescript-references.ts +38 -7
- package/src/core/retrieval/universal-context.ts +182 -0
- package/src/core/telemetry/summary.ts +114 -0
- package/src/core/telemetry/telemetry.ts +192 -49
- package/src/mcp/formatters/compact-text.ts +439 -0
- package/src/mcp/resources-and-prompts.ts +253 -0
- package/src/mcp/schemas/boundary.ts +145 -0
- package/src/mcp/schemas/map.ts +250 -0
- package/src/mcp/schemas/shared.ts +52 -0
- package/src/mcp/schemas/slice.ts +60 -0
- package/src/mcp/schemas/symbol.ts +268 -0
- package/src/mcp/schemas.ts +5 -746
- package/src/mcp/server.ts +269 -429
- package/src/mcp/tool-catalog.ts +331 -0
- package/src/mcp/tools/boundary.ts +68 -3
- package/src/mcp/tools/map.ts +104 -4
- package/src/mcp/tools/slice.ts +101 -3
- package/src/mcp/tools/symbol.ts +469 -17
- package/src/mcp/ui/app-client.ts +899 -0
- package/src/mcp/ui/app.html +478 -0
- package/src/mcp/workflow-playbooks.ts +181 -0
- package/src/mcp/workspace-boundary.ts +50 -0
- package/src/mcp/workspace-manager.ts +88 -15
- package/src/mcp/workspace-watcher.ts +30 -11
- package/src/types/index.ts +12 -0
- package/src/mcp/tools/check-boundary.ts +0 -382
- package/src/mcp/tools/get-domain-catalog.ts +0 -39
- package/src/mcp/tools/get-symbol-impact.ts +0 -104
- package/src/mcp/tools/locate-symbol.ts +0 -236
- package/src/mcp/tools/register-domain.ts +0 -113
- package/src/mcp/tools/trace-vertical-slice.ts +0 -106
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base typed error for Septum domain, validation, and operational failures.
|
|
3
|
+
* Transport layers (MCP / CLI) inspect `code` without ad-hoc property casting.
|
|
4
|
+
*/
|
|
5
|
+
export class SeptumError extends Error {
|
|
6
|
+
public readonly code: string;
|
|
7
|
+
|
|
8
|
+
constructor(code: string, message: string, options?: ErrorOptions) {
|
|
9
|
+
super(message, options);
|
|
10
|
+
this.name = new.target.name;
|
|
11
|
+
this.code = code;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class WorkspaceBusyError extends SeptumError {
|
|
16
|
+
constructor(message: string) {
|
|
17
|
+
super("SERVER_BUSY", message);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { scanSourceFiles } from "../resources/source-inventory.ts";
|
|
1
|
+
import { scanSourceFiles, type SourceInventory } from "../resources/source-inventory.ts";
|
|
2
2
|
import { rebuildSliceCatalog } from "../resolver/slice-catalog.ts";
|
|
3
3
|
import { SEMANTIC_FINGERPRINT } from "../parser/semantic-revision.ts";
|
|
4
4
|
import { RESOLVER_REVISION } from "../resolver/import-resolver.ts";
|
|
@@ -6,10 +6,10 @@ import { sourceObservationsCurrent } from "../resources/source-files.ts";
|
|
|
6
6
|
import { shouldIgnoreSourcePath } from "../resources/ignore.ts";
|
|
7
7
|
import { RESOURCE_LIMITS } from "../resources/limits.ts";
|
|
8
8
|
import { readSourceFile, SourceFileLimitError, type SkippedSourceFile, type SourceReadFingerprint } from "../resources/source-files.ts";
|
|
9
|
-
import { existsSync, statSync } from "node:fs";
|
|
9
|
+
import { existsSync, statSync, type Stats } from "node:fs";
|
|
10
10
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
11
11
|
import { isPathContained, resolveWorkspaceRoot } from "../resolver/path-resolver.ts";
|
|
12
|
-
import type { ParsedFileAST } from "../../types/index.ts";
|
|
12
|
+
import type { ArchetypeKind, ParsedFileAST } from "../../types/index.ts";
|
|
13
13
|
import type { ValidatedSeptumConfig } from "../config/schema.ts";
|
|
14
14
|
import type { SeptumRepository } from "../database/repository.ts";
|
|
15
15
|
import { detectArchetype } from "../parser/extractors/base.ts";
|
|
@@ -20,6 +20,13 @@ import { ModuleResolver } from "../resolver/module-resolver.ts";
|
|
|
20
20
|
import { computeContentHash } from "./hasher.ts";
|
|
21
21
|
import { assertUniqueDomainRoots, domainNameKey, DomainRootConflictError } from "../config/domain-ownership.ts";
|
|
22
22
|
import { ConfigLoader } from "../config/loader.ts";
|
|
23
|
+
import { SeptumTelemetry } from "../telemetry/telemetry.ts";
|
|
24
|
+
|
|
25
|
+
export type IngestionProgressEvent =
|
|
26
|
+
| { phase: "scanning"; status: "start" | "done"; total: number }
|
|
27
|
+
| { phase: "parsing"; status: "progress" | "done"; processed: number; total: number }
|
|
28
|
+
| { phase: "resolving"; status: "done"; symbols: number; dependencies: number }
|
|
29
|
+
| { phase: "linking"; status: "start" | "done"; slices: number };
|
|
23
30
|
|
|
24
31
|
export interface IngestionMetrics {
|
|
25
32
|
domains_processed: number;
|
|
@@ -31,6 +38,12 @@ export interface IngestionMetrics {
|
|
|
31
38
|
/** Indexed-file parse attempts across this sync, including recovered retries; excludes semantic extraction. */
|
|
32
39
|
parser_invocations: number;
|
|
33
40
|
duration_ms: number;
|
|
41
|
+
stage_timings_ms?: {
|
|
42
|
+
scan_ms: number;
|
|
43
|
+
parse_ms: number;
|
|
44
|
+
commit_ms: number;
|
|
45
|
+
slice_ms: number;
|
|
46
|
+
};
|
|
34
47
|
}
|
|
35
48
|
|
|
36
49
|
export class IngestionPipeline {
|
|
@@ -49,8 +62,17 @@ export class IngestionPipeline {
|
|
|
49
62
|
}
|
|
50
63
|
}
|
|
51
64
|
|
|
52
|
-
public async run(
|
|
53
|
-
|
|
65
|
+
public async run(
|
|
66
|
+
config: ValidatedSeptumConfig,
|
|
67
|
+
options: {
|
|
68
|
+
verifyContent?: boolean;
|
|
69
|
+
rebuild?: boolean;
|
|
70
|
+
signal?: AbortSignal;
|
|
71
|
+
onProgress?: (info: IngestionProgressEvent) => void;
|
|
72
|
+
} = {}
|
|
73
|
+
): Promise<IngestionMetrics> {
|
|
74
|
+
const workspaceRoot = this.resolveWorkspaceRoot(config, Object.values(config.domains)[0]?.root ?? ".");
|
|
75
|
+
this.repo.setMeta("workspace_root", workspaceRoot);
|
|
54
76
|
this.repo.setMeta("settings_json", JSON.stringify(config.settings));
|
|
55
77
|
this.repo.setMeta("resolver_revision", RESOLVER_REVISION);
|
|
56
78
|
this.repo.setMeta("sync_state", "running");
|
|
@@ -67,15 +89,58 @@ export class IngestionPipeline {
|
|
|
67
89
|
this.repo.setMeta("sync_state", "complete");
|
|
68
90
|
this.repo.setMeta("sync_error", "");
|
|
69
91
|
this.repo.setMeta("sync_error_code", "");
|
|
92
|
+
SeptumTelemetry.recordSystemEvent({
|
|
93
|
+
level: "INFO",
|
|
94
|
+
component: "ingestion",
|
|
95
|
+
event: "ingestion_completed",
|
|
96
|
+
fields: {
|
|
97
|
+
state_previous: "running",
|
|
98
|
+
state_current: "complete",
|
|
99
|
+
files_scanned: result!.files_scanned,
|
|
100
|
+
files_updated: result!.files_updated,
|
|
101
|
+
files_skipped: result!.files_skipped,
|
|
102
|
+
parser_invocations: result!.parser_invocations,
|
|
103
|
+
duration_ms: result!.duration_ms,
|
|
104
|
+
...(result!.stage_timings_ms ?? {}),
|
|
105
|
+
},
|
|
106
|
+
workspaceRoot,
|
|
107
|
+
emitStderr: false,
|
|
108
|
+
});
|
|
70
109
|
return result!;
|
|
71
110
|
} catch (error) {
|
|
72
111
|
this.recordSyncFailure(error);
|
|
112
|
+
SeptumTelemetry.recordSystemEvent({
|
|
113
|
+
level: "ERROR",
|
|
114
|
+
component: "ingestion",
|
|
115
|
+
event: "ingestion_failed",
|
|
116
|
+
fields: {
|
|
117
|
+
state_previous: "running",
|
|
118
|
+
state_current: "error",
|
|
119
|
+
error_code: error instanceof DomainRootConflictError ? error.code : undefined,
|
|
120
|
+
message: (error instanceof Error ? error.message : String(error)).slice(0, 256),
|
|
121
|
+
},
|
|
122
|
+
workspaceRoot,
|
|
123
|
+
emitStderr: false,
|
|
124
|
+
});
|
|
73
125
|
throw error;
|
|
74
126
|
}
|
|
75
127
|
}
|
|
76
128
|
|
|
77
|
-
private async runSync(
|
|
129
|
+
private async runSync(
|
|
130
|
+
config: ValidatedSeptumConfig,
|
|
131
|
+
options: {
|
|
132
|
+
verifyContent?: boolean;
|
|
133
|
+
rebuild?: boolean;
|
|
134
|
+
signal?: AbortSignal;
|
|
135
|
+
onProgress?: (info: IngestionProgressEvent) => void;
|
|
136
|
+
},
|
|
137
|
+
work: { parserInvocations: number }
|
|
138
|
+
): Promise<IngestionMetrics> {
|
|
78
139
|
const startTime = performance.now();
|
|
140
|
+
let scanMs = 0;
|
|
141
|
+
let parseMs = 0;
|
|
142
|
+
let commitMs = 0;
|
|
143
|
+
let sliceMs = 0;
|
|
79
144
|
let filesScanned = 0;
|
|
80
145
|
let filesUpdated = 0;
|
|
81
146
|
let filesSkipped = 0;
|
|
@@ -83,6 +148,7 @@ export class IngestionPipeline {
|
|
|
83
148
|
let dependenciesIndexed = 0;
|
|
84
149
|
const unsupportedFiles: string[] = [];
|
|
85
150
|
const skippedFiles: SkippedSourceFile[] = [];
|
|
151
|
+
const ingestedFullPaths = new Set<string>();
|
|
86
152
|
let removedFiles = 0;
|
|
87
153
|
|
|
88
154
|
let domainNames = Object.keys(config.domains);
|
|
@@ -113,13 +179,64 @@ export class IngestionPipeline {
|
|
|
113
179
|
}
|
|
114
180
|
}
|
|
115
181
|
this.ensureParserFingerprint(options.rebuild);
|
|
116
|
-
|
|
182
|
+
options.onProgress?.({ phase: "scanning", status: "start", total: 0 });
|
|
183
|
+
const scanStart = performance.now();
|
|
184
|
+
const initialScan = scanSourceFiles(projectRoot, { ignorePatterns: config.settings.ignore_patterns, signal: options.signal });
|
|
185
|
+
const initialStats = new Map<string, Stats>();
|
|
186
|
+
const initialEntries: Array<{ fullPath: string; relPath: string }> = [];
|
|
187
|
+
const inventory = initialScan.files.map(fullPath => {
|
|
188
|
+
const relPath = relative(projectRoot, fullPath).replace(/\\/g, "/");
|
|
189
|
+
const stat = statSync(fullPath);
|
|
190
|
+
initialStats.set(fullPath, stat);
|
|
191
|
+
initialEntries.push({ fullPath, relPath });
|
|
192
|
+
return `${relPath}:${stat.size}:${stat.mtimeMs}:${stat.ctimeMs}:${stat.ino}`;
|
|
193
|
+
}).sort();
|
|
194
|
+
scanMs += performance.now() - scanStart;
|
|
195
|
+
const totalEstimatedFiles = initialEntries.length;
|
|
196
|
+
options.onProgress?.({ phase: "scanning", status: "done", total: totalEstimatedFiles });
|
|
197
|
+
const batchFilesLimit = options.rebuild && totalEstimatedFiles >= 500 ? 250 : RESOURCE_LIMITS.batchFiles;
|
|
198
|
+
const batchBytesLimit = options.rebuild && totalEstimatedFiles >= 500 ? 4 * 1024 * 1024 : RESOURCE_LIMITS.batchBytes;
|
|
117
199
|
|
|
118
200
|
const existingFilesMap = new Map<string, import("../../types/index.ts").FileRecord>();
|
|
119
201
|
for (const f of this.repo.getAllFiles()) {
|
|
120
202
|
existingFilesMap.set(f.path, f);
|
|
121
203
|
}
|
|
122
204
|
|
|
205
|
+
// Single-pass O(F * depth) longest-prefix domain partitioning for projectRoot domains
|
|
206
|
+
const prefixToDomain = new Map<string, string>();
|
|
207
|
+
for (const domainName of domainNames) {
|
|
208
|
+
const domainCfg = config.domains[domainName];
|
|
209
|
+
const wsRoot = this.resolveWorkspaceRoot(config, domainCfg.root);
|
|
210
|
+
if (wsRoot !== projectRoot || !isPathContained(domainCfg.root, wsRoot)) continue;
|
|
211
|
+
const relPrefix = relative(wsRoot, resolve(wsRoot, domainCfg.root)).replace(/\\/g, "/");
|
|
212
|
+
prefixToDomain.set(relPrefix, domainName);
|
|
213
|
+
}
|
|
214
|
+
const entriesByDomain = new Map<string, Array<{ fullPath: string; relPath: string }>>();
|
|
215
|
+
for (const entry of initialEntries) {
|
|
216
|
+
let owner: string | undefined = prefixToDomain.get(entry.relPath);
|
|
217
|
+
if (!owner) {
|
|
218
|
+
let dir = entry.relPath;
|
|
219
|
+
while (true) {
|
|
220
|
+
const slash = dir.lastIndexOf("/");
|
|
221
|
+
if (slash === -1) {
|
|
222
|
+
owner = prefixToDomain.get("");
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
dir = dir.slice(0, slash);
|
|
226
|
+
owner = prefixToDomain.get(dir);
|
|
227
|
+
if (owner) break;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (owner) {
|
|
231
|
+
let bucket = entriesByDomain.get(owner);
|
|
232
|
+
if (!bucket) {
|
|
233
|
+
bucket = [];
|
|
234
|
+
entriesByDomain.set(owner, bucket);
|
|
235
|
+
}
|
|
236
|
+
bucket.push(entry);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
123
240
|
for (const domainName of domainNames) {
|
|
124
241
|
const domainCfg = config.domains[domainName];
|
|
125
242
|
const domainId = this.repo.upsertDomain(domainName, domainCfg);
|
|
@@ -146,21 +263,21 @@ export class IngestionPipeline {
|
|
|
146
263
|
throw new Error(`Failed to access domain root '${domainCfg.root}' for domain '${domainName}': ${err.message || err}`);
|
|
147
264
|
}
|
|
148
265
|
|
|
149
|
-
const
|
|
150
|
-
.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
266
|
+
const collectedFiles = workspaceRoot === projectRoot
|
|
267
|
+
? (entriesByDomain.get(domainName) ?? [])
|
|
268
|
+
: this.collectFiles(
|
|
269
|
+
absDomainRoot,
|
|
270
|
+
workspaceRoot,
|
|
271
|
+
config.settings.ignore_patterns,
|
|
272
|
+
domainNames
|
|
273
|
+
.filter(name => name !== domainName)
|
|
274
|
+
.map(name => relative(workspaceRoot, resolve(workspaceRoot, config.domains[name].root)).replace(/\\/g, "/"))
|
|
275
|
+
.filter(child => {
|
|
276
|
+
const fromParent = relative(absDomainRoot, resolve(workspaceRoot, child)).replace(/\\/g, "/");
|
|
277
|
+
return fromParent !== "" && fromParent !== ".." && !fromParent.startsWith("../") && !isAbsolute(fromParent);
|
|
278
|
+
}),
|
|
279
|
+
options.signal
|
|
280
|
+
);
|
|
164
281
|
const activeRelPaths = new Set<string>();
|
|
165
282
|
|
|
166
283
|
const pendingMetadataUpdates: Array<{
|
|
@@ -178,22 +295,39 @@ export class IngestionPipeline {
|
|
|
178
295
|
lineCount: number;
|
|
179
296
|
archetype: ReturnType<typeof detectArchetype>;
|
|
180
297
|
mtimeMs: number;
|
|
298
|
+
ctimeMs: number;
|
|
181
299
|
sizeBytes: number;
|
|
300
|
+
ino: number;
|
|
182
301
|
ast: ParsedFileAST;
|
|
183
302
|
}> = [];
|
|
184
303
|
|
|
185
304
|
let batchBytes = 0;
|
|
186
305
|
const commitBatch = () => {
|
|
187
306
|
for (const item of pendingUpdates) {
|
|
188
|
-
let
|
|
189
|
-
try {
|
|
190
|
-
|
|
191
|
-
if (
|
|
307
|
+
let changed = false;
|
|
308
|
+
try {
|
|
309
|
+
const s = statSync(item.fullPath);
|
|
310
|
+
if (s.size !== item.sizeBytes || s.mtimeMs !== item.mtimeMs || s.ctimeMs !== item.ctimeMs || s.ino !== item.ino) {
|
|
311
|
+
changed = true;
|
|
312
|
+
}
|
|
313
|
+
} catch (error: any) {
|
|
314
|
+
if (error?.code === "ENOENT") {
|
|
315
|
+
throw new Error(`Source changed during synchronization: '${item.relPath}'. Run sync again after the file stops changing.`);
|
|
316
|
+
}
|
|
317
|
+
throw error;
|
|
192
318
|
}
|
|
193
|
-
if (
|
|
194
|
-
|
|
319
|
+
if (changed) {
|
|
320
|
+
let currentHash: string | undefined;
|
|
321
|
+
try { currentHash = existsSync(item.fullPath) ? computeContentHash(readSourceFile(item.fullPath)) : undefined; }
|
|
322
|
+
catch (error: any) {
|
|
323
|
+
if (error?.code !== "ENOENT") throw error;
|
|
324
|
+
}
|
|
325
|
+
if (currentHash !== item.contentHash) {
|
|
326
|
+
throw new Error(`Source changed during synchronization: '${item.relPath}'. Run sync again after the file stops changing.`);
|
|
327
|
+
}
|
|
195
328
|
}
|
|
196
329
|
}
|
|
330
|
+
const commitStart = performance.now();
|
|
197
331
|
this.repo.runInTransaction(() => {
|
|
198
332
|
for (const meta of pendingMetadataUpdates) {
|
|
199
333
|
if (meta.file.archetype !== meta.archetype) {
|
|
@@ -202,26 +336,18 @@ export class IngestionPipeline {
|
|
|
202
336
|
} else this.repo.updateFileMetadataOnly(meta.id, meta.mtimeMs, meta.sizeBytes);
|
|
203
337
|
}
|
|
204
338
|
|
|
205
|
-
if (pendingUpdates.length) this.repo.setMeta("slices_dirty", "1");
|
|
206
339
|
for (const item of pendingUpdates) {
|
|
207
|
-
|
|
208
|
-
domainId,
|
|
209
|
-
item.relPath,
|
|
210
|
-
item.archetype,
|
|
211
|
-
item.contentHash,
|
|
212
|
-
item.lineCount,
|
|
213
|
-
item.mtimeMs,
|
|
214
|
-
item.sizeBytes
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
this.repo.replaceFileSymbols(fileId, item.ast.symbols);
|
|
218
|
-
this.repo.replaceFileDependencies(fileId, item.ast.dependencies);
|
|
340
|
+
this.publishParsedFile(domainId, item, false);
|
|
219
341
|
|
|
220
342
|
symbolsIndexed += item.ast.symbols.length;
|
|
221
343
|
dependenciesIndexed += item.ast.dependencies.length;
|
|
222
344
|
}
|
|
345
|
+
if (pendingUpdates.length > 0) {
|
|
346
|
+
this.repo.setMeta("slices_dirty", "1");
|
|
347
|
+
}
|
|
223
348
|
|
|
224
349
|
});
|
|
350
|
+
commitMs += performance.now() - commitStart;
|
|
225
351
|
pendingUpdates.length = 0;
|
|
226
352
|
pendingMetadataUpdates.length = 0;
|
|
227
353
|
batchBytes = 0;
|
|
@@ -229,17 +355,23 @@ export class IngestionPipeline {
|
|
|
229
355
|
|
|
230
356
|
for (const { fullPath, relPath } of collectedFiles) {
|
|
231
357
|
options.signal?.throwIfAborted();
|
|
232
|
-
if (pendingMetadataUpdates.length >=
|
|
358
|
+
if (pendingMetadataUpdates.length >= batchFilesLimit) commitBatch();
|
|
233
359
|
filesScanned++;
|
|
234
|
-
if (filesScanned % RESOURCE_LIMITS.batchFiles === 0) {
|
|
360
|
+
if (filesScanned % RESOURCE_LIMITS.batchFiles === 0) {
|
|
361
|
+
options.onProgress?.({ phase: "parsing", status: "progress", processed: filesScanned, total: totalEstimatedFiles });
|
|
362
|
+
await new Promise<void>(done => setTimeout(done, 0));
|
|
363
|
+
options.signal?.throwIfAborted();
|
|
364
|
+
}
|
|
235
365
|
activeRelPaths.add(relPath);
|
|
236
366
|
|
|
237
|
-
let stat;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
367
|
+
let stat = initialStats.get(fullPath);
|
|
368
|
+
if (!stat) {
|
|
369
|
+
try {
|
|
370
|
+
stat = statSync(fullPath);
|
|
371
|
+
} catch (error: any) {
|
|
372
|
+
if (error?.code === "ENOENT") continue;
|
|
373
|
+
throw new Error(`Failed to inspect source '${relPath}': ${error?.message || error}`);
|
|
374
|
+
}
|
|
243
375
|
}
|
|
244
376
|
|
|
245
377
|
const mtimeMs = stat.mtimeMs;
|
|
@@ -263,7 +395,7 @@ export class IngestionPipeline {
|
|
|
263
395
|
filesSkipped++;
|
|
264
396
|
continue;
|
|
265
397
|
}
|
|
266
|
-
if (pendingUpdates.length >=
|
|
398
|
+
if (pendingUpdates.length >= batchFilesLimit || (batchBytes + sizeBytes > batchBytesLimit && pendingUpdates.length > 0)) { commitBatch(); await new Promise<void>(done => setTimeout(done, 0)); options.signal?.throwIfAborted(); }
|
|
267
399
|
let content: string;
|
|
268
400
|
try { content = readSourceFile(fullPath); }
|
|
269
401
|
catch (error) {
|
|
@@ -291,15 +423,31 @@ export class IngestionPipeline {
|
|
|
291
423
|
}
|
|
292
424
|
|
|
293
425
|
const lineCount = content.split("\n").length;
|
|
426
|
+
ingestedFullPaths.add(fullPath);
|
|
294
427
|
work.parserInvocations++;
|
|
428
|
+
const parseStart = performance.now();
|
|
295
429
|
const ast = await this.parserEngine.parseFile(fullPath, content);
|
|
296
|
-
|
|
430
|
+
parseMs += performance.now() - parseStart;
|
|
431
|
+
if (ast.status === "unsupported" || ast.status === "degraded") {
|
|
297
432
|
unsupportedFiles.push(relPath);
|
|
433
|
+
if (existingFile) removedFiles++;
|
|
298
434
|
this.repo.deleteFileByPath(relPath);
|
|
299
435
|
this.repo.setMeta("slices_dirty", "1");
|
|
436
|
+
if (ast.status === "degraded") {
|
|
437
|
+
SeptumTelemetry.recordSystemEvent({
|
|
438
|
+
level: "WARN",
|
|
439
|
+
component: "ingestion",
|
|
440
|
+
event: "parser_degraded_isolated",
|
|
441
|
+
fields: {
|
|
442
|
+
file: relPath,
|
|
443
|
+
diagnostics: ast.diagnostics?.map(d => `${d.code}: ${d.message}`).join("; ").slice(0, 200),
|
|
444
|
+
},
|
|
445
|
+
workspaceRoot: projectRoot,
|
|
446
|
+
emitStderr: false,
|
|
447
|
+
});
|
|
448
|
+
}
|
|
300
449
|
continue;
|
|
301
450
|
}
|
|
302
|
-
if (ast.status === "degraded") throw new Error(`Cannot reliably index '${relPath}': parser is degraded. ${ast.diagnostics?.map(d => `${d.code}: ${d.message}`).join("; ") ?? ""}`);
|
|
303
451
|
|
|
304
452
|
filesUpdated++;
|
|
305
453
|
batchBytes += sizeBytes;
|
|
@@ -310,7 +458,9 @@ export class IngestionPipeline {
|
|
|
310
458
|
lineCount,
|
|
311
459
|
archetype,
|
|
312
460
|
mtimeMs,
|
|
461
|
+
ctimeMs: stat.ctimeMs,
|
|
313
462
|
sizeBytes,
|
|
463
|
+
ino: stat.ino,
|
|
314
464
|
ast,
|
|
315
465
|
});
|
|
316
466
|
}
|
|
@@ -321,14 +471,16 @@ export class IngestionPipeline {
|
|
|
321
471
|
for (const [existingPath, existingRecord] of existingFilesMap.entries()) {
|
|
322
472
|
if (existingRecord.domain_id === domainId && !activeRelPaths.has(existingPath)) {
|
|
323
473
|
removedFiles++;
|
|
324
|
-
this.
|
|
325
|
-
this.repo.deleteFileByPath(existingPath);
|
|
474
|
+
this.removeIndexedFile(existingPath);
|
|
326
475
|
existingFilesMap.delete(existingPath);
|
|
327
476
|
}
|
|
328
477
|
}
|
|
329
478
|
});
|
|
330
479
|
}
|
|
331
480
|
|
|
481
|
+
options.onProgress?.({ phase: "parsing", status: "done", processed: filesScanned, total: totalEstimatedFiles });
|
|
482
|
+
options.onProgress?.({ phase: "resolving", status: "done", symbols: symbolsIndexed, dependencies: dependenciesIndexed });
|
|
483
|
+
|
|
332
484
|
options.signal?.throwIfAborted();
|
|
333
485
|
const topologyInputs = ["package.json", "composer.json", "nest-cli.json", "go.mod", "artisan", "tsconfig.json"]
|
|
334
486
|
.map(file => { const target = join(projectRoot, file); return existsSync(target) ? readSourceFile(target) : ""; });
|
|
@@ -350,27 +502,49 @@ export class IngestionPipeline {
|
|
|
350
502
|
if (semanticInputChanged) break;
|
|
351
503
|
}
|
|
352
504
|
const extractorRevision = SEMANTIC_FINGERPRINT;
|
|
505
|
+
options.onProgress?.({ phase: "linking", status: "start", slices: 0 });
|
|
506
|
+
const sliceStart = performance.now();
|
|
353
507
|
if (this.repo.getMeta("semantic_extractor_revision") !== extractorRevision || this.repo.getMeta("semantic_inventory") !== inventoryRevision || semanticInputChanged || filesUpdated > 0 || removedFiles > 0 || this.repo.getMeta("slices_dirty") === "1" || this.repo.getMeta("semantic_revision") !== semanticRevision) {
|
|
354
508
|
await rebuildSliceCatalog(this.repo, projectRoot, {
|
|
355
509
|
ignorePatterns: config.settings.ignore_patterns, signal: options.signal,
|
|
356
|
-
semanticRevision, inventoryRevision,
|
|
510
|
+
semanticRevision, inventoryRevision, inventory: initialScan,
|
|
357
511
|
});
|
|
358
512
|
}
|
|
513
|
+
sliceMs += performance.now() - sliceStart;
|
|
514
|
+
options.onProgress?.({ phase: "linking", status: "done", slices: this.repo.countVerticalSlices() });
|
|
359
515
|
|
|
360
516
|
skippedFiles.push(...JSON.parse(this.repo.getMeta("semantic_skipped_files") || "[]"));
|
|
361
|
-
|
|
517
|
+
const endScan = scanSourceFiles(projectRoot, { ignorePatterns: config.settings.ignore_patterns, signal: options.signal });
|
|
518
|
+
if (endScan.files.length !== initialStats.size || endScan.files.some(fullPath => !initialStats.has(fullPath))) {
|
|
362
519
|
throw new Error("Source changed during synchronization: workspace inventory changed. Run sync again after the files stop changing.");
|
|
363
520
|
}
|
|
521
|
+
for (const fullPath of ingestedFullPaths) {
|
|
522
|
+
const initialStat = initialStats.get(fullPath);
|
|
523
|
+
if (!initialStat) continue;
|
|
524
|
+
let endStat: Stats;
|
|
525
|
+
try {
|
|
526
|
+
endStat = statSync(fullPath);
|
|
527
|
+
} catch {
|
|
528
|
+
throw new Error("Source changed during synchronization: workspace inventory changed. Run sync again after the files stop changing.");
|
|
529
|
+
}
|
|
530
|
+
if (
|
|
531
|
+
endStat.size !== initialStat.size ||
|
|
532
|
+
endStat.mtimeMs !== initialStat.mtimeMs ||
|
|
533
|
+
endStat.ctimeMs !== initialStat.ctimeMs ||
|
|
534
|
+
endStat.ino !== initialStat.ino
|
|
535
|
+
) {
|
|
536
|
+
throw new Error("Source changed during synchronization: workspace inventory changed. Run sync again after the files stop changing.");
|
|
537
|
+
}
|
|
538
|
+
}
|
|
364
539
|
const durationMs = Math.round(performance.now() - startTime);
|
|
365
540
|
|
|
366
541
|
// Identify uncovered eligible source files outside registered domains
|
|
367
542
|
const indexedPaths = new Set(this.repo.getAllFiles().map((file) => file.path));
|
|
368
543
|
for (const path of this.verifiedFiles.keys()) if (!indexedPaths.has(path)) this.verifiedFiles.delete(path);
|
|
369
|
-
const allWorkspaceFiles = this.collectFiles(projectRoot, projectRoot, config.settings.ignore_patterns, [], options.signal);
|
|
370
544
|
const unsupportedSet = new Set(unsupportedFiles);
|
|
371
545
|
const skippedSet = new Set(skippedFiles.map((file) => file.path));
|
|
372
|
-
const uncoveredFiles =
|
|
373
|
-
.map((
|
|
546
|
+
const uncoveredFiles = initialEntries
|
|
547
|
+
.map((entry) => entry.relPath)
|
|
374
548
|
.filter((rel) => !indexedPaths.has(rel) && !unsupportedSet.has(rel) && !skippedSet.has(rel));
|
|
375
549
|
|
|
376
550
|
// Update SSOT repo_meta watermark
|
|
@@ -397,6 +571,12 @@ export class IngestionPipeline {
|
|
|
397
571
|
dependencies_indexed: dependenciesIndexed,
|
|
398
572
|
parser_invocations: work.parserInvocations,
|
|
399
573
|
duration_ms: durationMs,
|
|
574
|
+
stage_timings_ms: {
|
|
575
|
+
scan_ms: Math.round(scanMs),
|
|
576
|
+
parse_ms: Math.round(parseMs),
|
|
577
|
+
commit_ms: Math.round(commitMs),
|
|
578
|
+
slice_ms: Math.round(sliceMs),
|
|
579
|
+
},
|
|
400
580
|
};
|
|
401
581
|
}
|
|
402
582
|
|
|
@@ -479,6 +659,49 @@ export class IngestionPipeline {
|
|
|
479
659
|
* JIT single-file ingestion: quickly verifies and updates a single file's AST,
|
|
480
660
|
* symbols, and dependencies in SQLite if its mtime or content hash has changed.
|
|
481
661
|
*/
|
|
662
|
+
/** Apply inside the caller's transaction after checking the source hash. */
|
|
663
|
+
private publishParsedFile(domainId: number, file: {
|
|
664
|
+
relPath: string;
|
|
665
|
+
archetype: ArchetypeKind;
|
|
666
|
+
contentHash: string;
|
|
667
|
+
lineCount: number;
|
|
668
|
+
mtimeMs: number;
|
|
669
|
+
sizeBytes: number;
|
|
670
|
+
ast: ParsedFileAST;
|
|
671
|
+
}, markSlicesDirty = true): void {
|
|
672
|
+
const { relPath, archetype, contentHash, lineCount, mtimeMs, sizeBytes, ast } = file;
|
|
673
|
+
const fileId = this.repo.upsertFile(domainId, relPath, archetype, contentHash, lineCount, mtimeMs, sizeBytes);
|
|
674
|
+
this.repo.replaceFileSymbols(fileId, ast.symbols);
|
|
675
|
+
this.repo.replaceFileDependencies(fileId, ast.dependencies);
|
|
676
|
+
if (markSlicesDirty) this.repo.setMeta("slices_dirty", "1");
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
private removeIndexedFile(path: string): void {
|
|
680
|
+
this.repo.deleteFileByPath(path);
|
|
681
|
+
this.repo.setMeta("slices_dirty", "1");
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
private updateFileDiagnostics(path: string, reason?: "file_too_large" | "unsupported"): void {
|
|
685
|
+
const skipped: SkippedSourceFile[] = JSON.parse(this.repo.getMeta("skipped_files") || "[]");
|
|
686
|
+
const unsupported: string[] = JSON.parse(this.repo.getMeta("unsupported_files") || "[]");
|
|
687
|
+
this.repo.setMeta("skipped_files", JSON.stringify([
|
|
688
|
+
...skipped.filter(file => file.path !== path),
|
|
689
|
+
...(reason === "file_too_large" ? [{ path, reason }] : []),
|
|
690
|
+
]));
|
|
691
|
+
this.repo.setMeta("unsupported_files", JSON.stringify([
|
|
692
|
+
...unsupported.filter(file => file !== path),
|
|
693
|
+
...(reason === "unsupported" ? [path] : []),
|
|
694
|
+
]));
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
public removeFile(path: string, reason?: "file_too_large" | "unsupported"): void {
|
|
698
|
+
this.repo.runInTransaction(() => {
|
|
699
|
+
this.removeIndexedFile(path);
|
|
700
|
+
this.repo.clearVerticalSlices();
|
|
701
|
+
this.updateFileDiagnostics(path, reason);
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
|
|
482
705
|
public async ingestFile(targetFilePath: string, config: ValidatedSeptumConfig): Promise<boolean> {
|
|
483
706
|
try { this.assertDomainOwnership(config, this.customWorkspaceRoot || resolveWorkspaceRoot()); }
|
|
484
707
|
catch (error) { this.recordSyncFailure(error); throw error; }
|
|
@@ -518,13 +741,7 @@ export class IngestionPipeline {
|
|
|
518
741
|
try { content = readSourceFile(fullPath); }
|
|
519
742
|
catch (error) {
|
|
520
743
|
if (!(error instanceof SourceFileLimitError)) throw error;
|
|
521
|
-
this.
|
|
522
|
-
this.repo.deleteFileByPath(relPath);
|
|
523
|
-
this.repo.clearVerticalSlices();
|
|
524
|
-
this.repo.setMeta("slices_dirty", "1");
|
|
525
|
-
const skipped: SkippedSourceFile[] = JSON.parse(this.repo.getMeta("skipped_files") || "[]");
|
|
526
|
-
this.repo.setMeta("skipped_files", JSON.stringify([...skipped.filter(file => file.path !== relPath), {path: relPath, reason: "file_too_large"}]));
|
|
527
|
-
});
|
|
744
|
+
this.removeFile(relPath, "file_too_large");
|
|
528
745
|
return false;
|
|
529
746
|
}
|
|
530
747
|
const currentHash = computeContentHash(content);
|
|
@@ -545,14 +762,10 @@ export class IngestionPipeline {
|
|
|
545
762
|
|
|
546
763
|
const lineCount = content.split("\n").length;
|
|
547
764
|
const ast = await this.parserEngine.parseFile(fullPath, content);
|
|
548
|
-
if (ast.status === "unsupported") {
|
|
549
|
-
this.
|
|
550
|
-
const unsupported = new Set<string>(JSON.parse(this.repo.getMeta("unsupported_files") || "[]"));
|
|
551
|
-
unsupported.add(relPath);
|
|
552
|
-
this.repo.setMeta("unsupported_files", JSON.stringify([...unsupported]));
|
|
765
|
+
if (ast.status === "unsupported" || ast.status === "degraded") {
|
|
766
|
+
this.removeFile(relPath, "unsupported");
|
|
553
767
|
return false;
|
|
554
768
|
}
|
|
555
|
-
if (ast.status === "degraded") throw new Error(`Cannot reliably index '${relPath}': parser is degraded. ${ast.diagnostics?.map(d => `${d.code}: ${d.message}`).join("; ") ?? ""}`);
|
|
556
769
|
|
|
557
770
|
let latestHash: string | undefined;
|
|
558
771
|
try { latestHash = computeContentHash(readSourceFile(fullPath)); }
|
|
@@ -565,23 +778,9 @@ export class IngestionPipeline {
|
|
|
565
778
|
}
|
|
566
779
|
|
|
567
780
|
this.repo.runInTransaction(() => {
|
|
568
|
-
|
|
569
|
-
domainId,
|
|
570
|
-
relPath,
|
|
571
|
-
archetype,
|
|
572
|
-
currentHash,
|
|
573
|
-
lineCount,
|
|
574
|
-
mtimeMs,
|
|
575
|
-
sizeBytes
|
|
576
|
-
);
|
|
577
|
-
this.repo.replaceFileSymbols(fileId, ast.symbols);
|
|
578
|
-
this.repo.replaceFileDependencies(fileId, ast.dependencies);
|
|
781
|
+
this.publishParsedFile(domainId, { relPath, archetype, contentHash: currentHash, lineCount, mtimeMs, sizeBytes, ast });
|
|
579
782
|
this.repo.clearVerticalSlices();
|
|
580
|
-
this.
|
|
581
|
-
const skipped: SkippedSourceFile[] = JSON.parse(this.repo.getMeta("skipped_files") || "[]");
|
|
582
|
-
this.repo.setMeta("skipped_files", JSON.stringify(skipped.filter(file => file.path !== relPath)));
|
|
583
|
-
const unsupported = JSON.parse(this.repo.getMeta("unsupported_files") || "[]") as string[];
|
|
584
|
-
this.repo.setMeta("unsupported_files", JSON.stringify(unsupported.filter(path => path !== relPath)));
|
|
783
|
+
this.updateFileDiagnostics(relPath);
|
|
585
784
|
});
|
|
586
785
|
|
|
587
786
|
return true;
|
|
@@ -20,11 +20,12 @@ export function detectArchetype(filePath: string, archetypesMap: Record<string,
|
|
|
20
20
|
if (/(?:^|\/)(?:tests?|__tests__)\/|(?:\.test\.|\.spec\.|_test\.go$|Test\.php$)/i.test(normalized)) {
|
|
21
21
|
return "unknown";
|
|
22
22
|
}
|
|
23
|
+
if (lower.includes("middleware") || lower.includes("cors_handler") || lower.includes("asgi") || lower.includes("wsgi")) return "middleware";
|
|
23
24
|
if (lower.includes("controller") || /(?:^|\/)handlers?\/|handler\.(?:go|ts|js|py|php)$/i.test(lower)) return "controller";
|
|
24
25
|
if (lower.endsWith("views.py") || (lower.includes("views/") && lower.endsWith(".py"))) return "controller";
|
|
25
|
-
if (/(?:^|\/)(?:console\/)?commands?\//i.test(lower)) return "action";
|
|
26
|
-
if (/(?:^|\/)models?\/|entities|entity
|
|
27
|
-
if (lower.includes("service")) return "service";
|
|
26
|
+
if (/(?:^|\/)(?:console\/)?commands?\//i.test(lower) || /(?:^|\/)(?:tools?|use[-_]?cases?)\//i.test(lower)) return "action";
|
|
27
|
+
if (/(?:^|\/)models?\/|entities|entity/i.test(lower) || /models?\.(?:php|ts|js|py|go)$/i.test(lower)) return "model";
|
|
28
|
+
if (lower.includes("service") || /(?:^|\/)(?:adapters?|gateways?|providers?)\//i.test(lower)) return "service";
|
|
28
29
|
if (lower.includes("repository") || lower.includes("repo")) return "repository";
|
|
29
30
|
if (/(?:^|\/)actions?\/|action\.(?:php|ts|js|py|go)$/i.test(lower)) return "action";
|
|
30
31
|
if (lower.includes("job") || lower.includes("queue")) return "job";
|
|
@@ -36,6 +37,13 @@ export function detectArchetype(filePath: string, archetypesMap: Record<string,
|
|
|
36
37
|
if (lower.includes(".blade.php") || lower.includes("views/") || lower.includes("templates/")) return "view";
|
|
37
38
|
if (lower.includes("route") || lower.includes("router")) return "route";
|
|
38
39
|
if (lower.includes("util") || lower.includes("helper")) return "util";
|
|
40
|
+
// Non-MVC structural archetypes (libraries, CLIs, compilers, MCP servers, engines)
|
|
41
|
+
if (/(?:^|\/)(?:parsers?|extractors?)\//i.test(lower) || /(?:parser|extractor|lexer|tokenizer)\.(?:ts|js|py|go|php|rs|rb|java|cs)$/i.test(lower)) return "parser";
|
|
42
|
+
if (/(?:^|\/)resolvers?\//i.test(lower) || /(?:resolver|tracer|locator)\.(?:ts|js|py|go|php|rs|rb|java|cs)$/i.test(lower)) return "resolver";
|
|
43
|
+
if (/(?:^|\/)(?:pipelines?|ingestion|workflows?)\//i.test(lower) || /(?:pipeline|ingestor|indexer)\.(?:ts|js|py|go|php|rs|rb|java|cs)$/i.test(lower)) return "pipeline";
|
|
44
|
+
if (/(?:^|\/)config\//i.test(lower) || /(?:config|settings|loader)\.(?:ts|js|py|go|php|rs|rb|java|cs)$/i.test(lower)) return "config";
|
|
45
|
+
if (/(?:server|watcher|daemon|manager|runtime|client)\.(?:ts|js|py|go|php|rs|rb|java|cs)$/i.test(lower)) return "server";
|
|
46
|
+
if (/(?:^|\/)(?:boundary|retrieval|discovery|telemetry)\//i.test(lower) || /(?:evaluator|auditor|detector|orchestrator)\.(?:ts|js|py|go|php|rs|rb|java|cs)$/i.test(lower)) return "service";
|
|
39
47
|
|
|
40
48
|
return "unknown";
|
|
41
49
|
}
|
|
@@ -80,7 +80,7 @@ export class CSharpExtractor implements CodeExtractor {
|
|
|
80
80
|
const methodName = nameNode.text;
|
|
81
81
|
const lineStart = member.startPosition.row + 1;
|
|
82
82
|
const lineEnd = Math.max(lineStart, member.endPosition.row + 1);
|
|
83
|
-
const headerLine = getNodeHeader(member);
|
|
83
|
+
const headerLine = getNodeHeader(member, content);
|
|
84
84
|
const nestingDepth = calculateAstControlFlowNesting(
|
|
85
85
|
member,
|
|
86
86
|
CSHARP_CONTROL_FLOW_NODES,
|
|
@@ -162,7 +162,7 @@ export class CSharpExtractor implements CodeExtractor {
|
|
|
162
162
|
const fullName = parentScope ? `${parentScope}.${baseName}` : baseName;
|
|
163
163
|
const lineStart = node.startPosition.row + 1;
|
|
164
164
|
const lineEnd = Math.max(lineStart, node.endPosition.row + 1);
|
|
165
|
-
const headerLine = getNodeHeader(node);
|
|
165
|
+
const headerLine = getNodeHeader(node, content);
|
|
166
166
|
const kind =
|
|
167
167
|
node.type === "interface_declaration"
|
|
168
168
|
? "interface"
|