@dimassetoid/septum-mcp 0.3.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +255 -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
|
@@ -4,6 +4,7 @@ import * as path from "node:path";
|
|
|
4
4
|
import type { ExtractedDependency, ExtractedSymbol, ParsedFileAST, Visibility } from "../../../types/index.ts";
|
|
5
5
|
import { findBraceBlockEnd, calculateControlFlowNesting } from "../boundary-tracker.ts";
|
|
6
6
|
import type { CodeExtractor } from "./base.ts";
|
|
7
|
+
import { warnIfUnexpectedParserError } from "./manifest-helpers.ts";
|
|
7
8
|
|
|
8
9
|
const GO_STDLIB_PREFIXES = new Set([
|
|
9
10
|
"bufio",
|
|
@@ -305,7 +306,9 @@ export class GoExtractor implements CodeExtractor {
|
|
|
305
306
|
}
|
|
306
307
|
currentDir = path.dirname(currentDir);
|
|
307
308
|
}
|
|
308
|
-
} catch {
|
|
309
|
+
} catch (err: unknown) {
|
|
310
|
+
warnIfUnexpectedParserError(`Failed to inspect go.mod for ${filePath}`, err);
|
|
311
|
+
}
|
|
309
312
|
return null;
|
|
310
313
|
}
|
|
311
314
|
|
|
@@ -435,7 +438,7 @@ export class GoExtractor implements CodeExtractor {
|
|
|
435
438
|
const visibility: Visibility = /^[A-Z]/.test(methodName) ? "public" : "private";
|
|
436
439
|
const lineStart = node.startPosition.row + 1;
|
|
437
440
|
const lineEnd = Math.max(lineStart, node.endPosition.row + 1);
|
|
438
|
-
const headerLine = getNodeHeader(node);
|
|
441
|
+
const headerLine = getNodeHeader(node, content);
|
|
439
442
|
const nestingDepth = calculateAstControlFlowNesting(
|
|
440
443
|
node,
|
|
441
444
|
GO_CONTROL_FLOW_NODES,
|
|
@@ -465,7 +468,7 @@ export class GoExtractor implements CodeExtractor {
|
|
|
465
468
|
const visibility: Visibility = /^[A-Z]/.test(funcName) ? "public" : "private";
|
|
466
469
|
const lineStart = node.startPosition.row + 1;
|
|
467
470
|
const lineEnd = Math.max(lineStart, node.endPosition.row + 1);
|
|
468
|
-
const headerLine = getNodeHeader(node);
|
|
471
|
+
const headerLine = getNodeHeader(node, content);
|
|
469
472
|
const nestingDepth = calculateAstControlFlowNesting(
|
|
470
473
|
node,
|
|
471
474
|
GO_CONTROL_FLOW_NODES,
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { ExecutionChainNode } from "../../../types/index.ts";
|
|
2
|
+
import type { VerticalSliceCandidate } from "./semantic-extractor.interface.ts";
|
|
3
|
+
|
|
4
|
+
export interface GraphQLDetectionInput {
|
|
5
|
+
uri?: string;
|
|
6
|
+
handlerName?: string;
|
|
7
|
+
baseClasses?: string[];
|
|
8
|
+
qualifiedTarget?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const GRAPHQL_HANDLER_PATTERN =
|
|
12
|
+
/(?:^|[.:/\\])(?:Async)?GraphQL(?:View|Controller|Handler|App|Router|Server|Middleware|Endpoint)\b|\b(?:graphqlHTTP|createYoga|expressMiddleware|apolloServer|mercurius)\b/i;
|
|
13
|
+
|
|
14
|
+
const GRAPHQL_URI_PATTERN = /(?:^|\/)graphql\/?$/i;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Shared multi-framework predicate determining whether a route/handler represents
|
|
18
|
+
* a GraphQL entrypoint across Python, TypeScript/JS, Go, and PHP adapters.
|
|
19
|
+
*/
|
|
20
|
+
export function isGraphQLRouteOrHandler(input: GraphQLDetectionInput): boolean {
|
|
21
|
+
if (input.handlerName && GRAPHQL_HANDLER_PATTERN.test(input.handlerName)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (input.qualifiedTarget && GRAPHQL_HANDLER_PATTERN.test(input.qualifiedTarget)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
if (input.baseClasses?.some((base) => GRAPHQL_HANDLER_PATTERN.test(base))) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (input.uri && GRAPHQL_URI_PATTERN.test(input.uri.trim())) {
|
|
31
|
+
const combined = `${input.handlerName ?? ""} ${input.qualifiedTarget ?? ""} ${(input.baseClasses ?? []).join(" ")}`;
|
|
32
|
+
return /\b(?:graphql|dispatch|schema|yoga|apollo|mercurius|strawberry|ariadne|graphene)\b/i.test(combined);
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface GraphQLSliceOptions {
|
|
38
|
+
domainId?: number | null;
|
|
39
|
+
frameworkStyle: string;
|
|
40
|
+
httpMethod: string;
|
|
41
|
+
uri: string;
|
|
42
|
+
routeName?: string;
|
|
43
|
+
controllerClass: string;
|
|
44
|
+
actionName: string;
|
|
45
|
+
controllerFile: string;
|
|
46
|
+
controllerLine: number;
|
|
47
|
+
routeFile: string;
|
|
48
|
+
routeLine: number;
|
|
49
|
+
schemaSymbol?: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
inferredAction?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Builds a standardized VerticalSliceCandidate for GraphQL endpoints so all
|
|
56
|
+
* framework adapters emit consistent ingress, handler, and schema nodes.
|
|
57
|
+
*/
|
|
58
|
+
export function buildGraphQLSliceCandidate(options: GraphQLSliceOptions): VerticalSliceCandidate {
|
|
59
|
+
const method = options.httpMethod.toUpperCase();
|
|
60
|
+
const chain: ExecutionChainNode[] = [
|
|
61
|
+
{
|
|
62
|
+
stage: "ingress",
|
|
63
|
+
symbol: `${method} ${options.uri}`,
|
|
64
|
+
file: options.routeFile,
|
|
65
|
+
line: options.routeLine,
|
|
66
|
+
description: options.description ?? "GraphQL Endpoint Registration",
|
|
67
|
+
relationship: {
|
|
68
|
+
kind: "route_binding",
|
|
69
|
+
derivation: "source",
|
|
70
|
+
source: { file: options.routeFile, line: options.routeLine },
|
|
71
|
+
reason: options.description ?? "GraphQL Endpoint Registration",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
stage: "controller",
|
|
76
|
+
symbol: `${options.controllerClass}::${options.actionName}`,
|
|
77
|
+
file: options.controllerFile,
|
|
78
|
+
line: options.controllerLine,
|
|
79
|
+
description: options.inferredAction
|
|
80
|
+
? "Inherited GraphQL View Handler (line points to class)"
|
|
81
|
+
: "GraphQL View Handler",
|
|
82
|
+
relationship: {
|
|
83
|
+
kind: "route_binding",
|
|
84
|
+
derivation: options.inferredAction ? "inferred" : "source",
|
|
85
|
+
source: { file: options.controllerFile, line: options.controllerLine },
|
|
86
|
+
reason: options.inferredAction
|
|
87
|
+
? "Inherited GraphQL View Handler"
|
|
88
|
+
: "GraphQL View Handler",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
if (options.schemaSymbol) {
|
|
94
|
+
chain.push({
|
|
95
|
+
stage: "validation",
|
|
96
|
+
symbol: options.schemaSymbol,
|
|
97
|
+
description: "GraphQL Schema Binding",
|
|
98
|
+
relationship: {
|
|
99
|
+
kind: "schema_binding",
|
|
100
|
+
derivation: "source",
|
|
101
|
+
source: { file: options.routeFile, line: options.routeLine },
|
|
102
|
+
reason: "GraphQL Schema Binding",
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
domain_id: options.domainId ?? null,
|
|
109
|
+
feature_key: null,
|
|
110
|
+
http_method: method,
|
|
111
|
+
route_uri: options.uri,
|
|
112
|
+
route_name: options.routeName || `${options.controllerClass}.${options.actionName}`,
|
|
113
|
+
controller_class: options.controllerClass,
|
|
114
|
+
action_name: options.actionName,
|
|
115
|
+
controller_file: options.controllerFile,
|
|
116
|
+
controller_line: options.controllerLine,
|
|
117
|
+
architecture_style: options.frameworkStyle,
|
|
118
|
+
entry_kind: "http_route",
|
|
119
|
+
execution_chain_json: JSON.stringify(chain),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Shared post-extraction normalizer used by slice-catalog so any framework adapter
|
|
125
|
+
* emitting a GraphQL route receives a consistent `<framework>-graphql` style.
|
|
126
|
+
*/
|
|
127
|
+
export function normalizeGraphQLEntrypoints(slices: VerticalSliceCandidate[]): VerticalSliceCandidate[] {
|
|
128
|
+
return slices.map((slice) => {
|
|
129
|
+
if (slice.entry_kind !== "http_route") return slice;
|
|
130
|
+
if (slice.architecture_style.endsWith("graphql")) return slice;
|
|
131
|
+
if (
|
|
132
|
+
!isGraphQLRouteOrHandler({
|
|
133
|
+
uri: slice.route_uri,
|
|
134
|
+
handlerName: `${slice.controller_class}.${slice.action_name}`,
|
|
135
|
+
})
|
|
136
|
+
) {
|
|
137
|
+
return slice;
|
|
138
|
+
}
|
|
139
|
+
const baseStyle = slice.architecture_style.replace(/-(?:mvc|api|drf|http)$/, "");
|
|
140
|
+
const frameworkStyle = baseStyle === "mvc" ? "graphql" : `${baseStyle}-graphql`;
|
|
141
|
+
return {
|
|
142
|
+
...slice,
|
|
143
|
+
architecture_style: frameworkStyle,
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
}
|