septum 0.1.0 → 0.1.2
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 -21
- package/README.md +100 -100
- package/bin/septum.ts +4 -4
- package/package.json +63 -62
- package/src/cli/commands/check.ts +161 -161
- package/src/cli/commands/hook.ts +188 -188
- package/src/cli/commands/ingest.ts +29 -29
- package/src/cli/commands/init.ts +211 -211
- package/src/cli/commands/locate.ts +61 -61
- package/src/cli/commands/query.ts +64 -64
- package/src/cli/commands/serve.ts +5 -5
- package/src/cli/commands/slice.ts +90 -90
- package/src/cli/commands/sync.ts +31 -31
- package/src/cli/index.ts +199 -178
- package/src/cli/templates/hooks.ts +75 -75
- package/src/cli/templates/rules.ts +38 -38
- package/src/cli/templates/skill.ts +66 -66
- package/src/core/boundary/evaluator.ts +210 -210
- package/src/core/config/loader.ts +84 -84
- package/src/core/config/schema.ts +39 -39
- package/src/core/database/client.ts +44 -132
- package/src/core/database/repositories/dependency.repository.ts +279 -279
- package/src/core/database/repositories/domain.repository.ts +198 -198
- package/src/core/database/repositories/file.repository.ts +99 -99
- package/src/core/database/repositories/meta.repository.ts +33 -33
- package/src/core/database/repositories/symbol.repository.ts +424 -424
- package/src/core/database/repository.ts +242 -242
- package/src/core/database/schema.ts +120 -0
- package/src/core/discovery/topology-detector.ts +418 -418
- package/src/core/ingestion/hasher.ts +5 -5
- package/src/core/ingestion/pipeline.ts +438 -438
- package/src/core/parser/boundary-tracker.ts +128 -128
- package/src/core/parser/extractors/base.ts +60 -60
- package/src/core/parser/extractors/frontend.ts +194 -194
- package/src/core/parser/extractors/go.ts +176 -176
- package/src/core/parser/extractors/laravel-semantic.ts +426 -426
- package/src/core/parser/extractors/mcp-cli-semantic.ts +199 -199
- package/src/core/parser/extractors/nestjs-semantic.ts +119 -119
- package/src/core/parser/extractors/php.ts +149 -149
- package/src/core/parser/extractors/python.ts +226 -226
- package/src/core/parser/extractors/registry.ts +49 -49
- package/src/core/parser/extractors/semantic-extractor.interface.ts +21 -21
- package/src/core/parser/extractors/typescript.ts +177 -177
- package/src/core/parser/tree-sitter.ts +39 -39
- package/src/core/resolver/call-graph-tracer.ts +668 -668
- package/src/core/resolver/module-resolver.ts +342 -323
- package/src/core/resolver/symbol-locator.ts +543 -405
- package/src/core/resolver/vertical-slice-tracer.ts +237 -236
- package/src/core/session/session-manager.ts +56 -56
- package/src/core/telemetry/telemetry.ts +86 -86
- package/src/index.ts +18 -18
- package/src/mcp/schemas.ts +68 -68
- package/src/mcp/server.ts +612 -602
- package/src/mcp/tools/check-boundary.ts +102 -102
- package/src/mcp/tools/get-domain-catalog.ts +91 -91
- package/src/mcp/tools/get-feature-context.ts +116 -116
- package/src/mcp/tools/get-symbol-hotspots.ts +49 -49
- package/src/mcp/tools/get-symbol-impact.ts +26 -26
- package/src/mcp/tools/get-symbol.ts +63 -63
- package/src/mcp/tools/locate-symbol.ts +74 -74
- package/src/mcp/tools/register-domain.ts +64 -64
- package/src/mcp/tools/trace-vertical-slice.ts +102 -102
- package/src/types/index.ts +296 -296
- package/src/version.ts +3 -0
- package/src/core/database/schema.sql +0 -92
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
import type { ValidatedSeptumConfig } from "../../core/config/schema.ts";
|
|
2
|
-
import type { SeptumRepository } from "../../core/database/repository.ts";
|
|
3
|
-
import { VerticalSliceTracer } from "../../core/resolver/vertical-slice-tracer.ts";
|
|
4
|
-
import type { VerticalSliceTraceResponse } from "../../types/index.ts";
|
|
5
|
-
|
|
6
|
-
export interface TraceVerticalSliceArgs {
|
|
7
|
-
query: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function handleTraceVerticalSlice(
|
|
11
|
-
repo: SeptumRepository,
|
|
12
|
-
config: ValidatedSeptumConfig,
|
|
13
|
-
args: TraceVerticalSliceArgs
|
|
14
|
-
) {
|
|
15
|
-
if (!args.query) {
|
|
16
|
-
throw new Error(
|
|
17
|
-
"Missing required argument: 'query' (e.g. 'POST /orders/{id}/status', 'OrderController@updateStatus', or task intent 'Ubah status order di dashboard')"
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const tracer = new VerticalSliceTracer(repo);
|
|
22
|
-
const result: VerticalSliceTraceResponse = tracer.trace(args.query);
|
|
23
|
-
|
|
24
|
-
let formattedText = "";
|
|
25
|
-
|
|
26
|
-
if (result.found && result.slice) {
|
|
27
|
-
const s = result.slice;
|
|
28
|
-
formattedText = `=== VERTICAL SLICE TRACE ===\n`;
|
|
29
|
-
formattedText += `Query: ${result.query}\n`;
|
|
30
|
-
formattedText += `Status: RESOLVED\n\n`;
|
|
31
|
-
|
|
32
|
-
formattedText += `• Route:\n`;
|
|
33
|
-
formattedText += ` Method: ${s.route.method}\n`;
|
|
34
|
-
formattedText += ` URI: ${s.route.uri}\n`;
|
|
35
|
-
if (s.route.name) {
|
|
36
|
-
formattedText += ` Name: ${s.route.name}\n`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (s.request) {
|
|
40
|
-
formattedText += `\n• Request / Validation:\n`;
|
|
41
|
-
formattedText += ` Class: ${s.request.class} (${s.request.file || "inline"})\n`;
|
|
42
|
-
const ruleKeys = Object.keys(s.request.rules);
|
|
43
|
-
if (ruleKeys.length > 0) {
|
|
44
|
-
formattedText += ` Rules:\n`;
|
|
45
|
-
for (const k of ruleKeys) {
|
|
46
|
-
formattedText += ` - ${k} => ${s.request.rules[k]}\n`;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
formattedText += `\n• Controller Action:\n`;
|
|
52
|
-
formattedText += ` Class: ${s.controller.class}@${s.controller.action}\n`;
|
|
53
|
-
formattedText += ` File: ${s.controller.file || "unknown"}:${s.controller.line}\n`;
|
|
54
|
-
|
|
55
|
-
if (s.model) {
|
|
56
|
-
formattedText += `\n• Model:\n`;
|
|
57
|
-
formattedText += ` Class: ${s.model.class} (${s.model.file || "unknown"})\n`;
|
|
58
|
-
if (s.model.fillable && s.model.fillable.length > 0) {
|
|
59
|
-
formattedText += ` Fillable: [${s.model.fillable.join(", ")}]\n`;
|
|
60
|
-
}
|
|
61
|
-
if (s.model.casts && Object.keys(s.model.casts).length > 0) {
|
|
62
|
-
formattedText += ` Casts: ${JSON.stringify(s.model.casts)}\n`;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (s.frontend) {
|
|
67
|
-
formattedText += `\n• Frontend Target:\n`;
|
|
68
|
-
formattedText += ` Page: ${s.frontend.target}\n`;
|
|
69
|
-
if (s.frontend.props.length > 0) {
|
|
70
|
-
formattedText += ` Props: [${s.frontend.props.join(", ")}]\n`;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (result.alternatives && result.alternatives.length > 0) {
|
|
75
|
-
formattedText += `\n• Other Matching Slices:\n`;
|
|
76
|
-
for (const alt of result.alternatives) {
|
|
77
|
-
formattedText += ` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}\n`;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
formattedText = `=== VERTICAL SLICE NOT FOUND ===\n`;
|
|
82
|
-
formattedText += `Query: ${result.query}\n`;
|
|
83
|
-
formattedText += `Message: ${result.message}\n`;
|
|
84
|
-
|
|
85
|
-
if (result.alternatives && result.alternatives.length > 0) {
|
|
86
|
-
formattedText += `\nAvailable Slices:\n`;
|
|
87
|
-
for (const alt of result.alternatives) {
|
|
88
|
-
formattedText += ` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}\n`;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
content: [
|
|
95
|
-
{
|
|
96
|
-
type: "text",
|
|
97
|
-
text: formattedText.trim(),
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
metadata: result,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
1
|
+
import type { ValidatedSeptumConfig } from "../../core/config/schema.ts";
|
|
2
|
+
import type { SeptumRepository } from "../../core/database/repository.ts";
|
|
3
|
+
import { VerticalSliceTracer } from "../../core/resolver/vertical-slice-tracer.ts";
|
|
4
|
+
import type { VerticalSliceTraceResponse } from "../../types/index.ts";
|
|
5
|
+
|
|
6
|
+
export interface TraceVerticalSliceArgs {
|
|
7
|
+
query: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function handleTraceVerticalSlice(
|
|
11
|
+
repo: SeptumRepository,
|
|
12
|
+
config: ValidatedSeptumConfig,
|
|
13
|
+
args: TraceVerticalSliceArgs
|
|
14
|
+
) {
|
|
15
|
+
if (!args.query) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
"Missing required argument: 'query' (e.g. 'POST /orders/{id}/status', 'OrderController@updateStatus', or task intent 'Ubah status order di dashboard')"
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const tracer = new VerticalSliceTracer(repo);
|
|
22
|
+
const result: VerticalSliceTraceResponse = tracer.trace(args.query);
|
|
23
|
+
|
|
24
|
+
let formattedText = "";
|
|
25
|
+
|
|
26
|
+
if (result.found && result.slice) {
|
|
27
|
+
const s = result.slice;
|
|
28
|
+
formattedText = `=== VERTICAL SLICE TRACE ===\n`;
|
|
29
|
+
formattedText += `Query: ${result.query}\n`;
|
|
30
|
+
formattedText += `Status: RESOLVED\n\n`;
|
|
31
|
+
|
|
32
|
+
formattedText += `• Route:\n`;
|
|
33
|
+
formattedText += ` Method: ${s.route.method}\n`;
|
|
34
|
+
formattedText += ` URI: ${s.route.uri}\n`;
|
|
35
|
+
if (s.route.name) {
|
|
36
|
+
formattedText += ` Name: ${s.route.name}\n`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (s.request) {
|
|
40
|
+
formattedText += `\n• Request / Validation:\n`;
|
|
41
|
+
formattedText += ` Class: ${s.request.class} (${s.request.file || "inline"})\n`;
|
|
42
|
+
const ruleKeys = Object.keys(s.request.rules);
|
|
43
|
+
if (ruleKeys.length > 0) {
|
|
44
|
+
formattedText += ` Rules:\n`;
|
|
45
|
+
for (const k of ruleKeys) {
|
|
46
|
+
formattedText += ` - ${k} => ${s.request.rules[k]}\n`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
formattedText += `\n• Controller Action:\n`;
|
|
52
|
+
formattedText += ` Class: ${s.controller.class}@${s.controller.action}\n`;
|
|
53
|
+
formattedText += ` File: ${s.controller.file || "unknown"}:${s.controller.line}\n`;
|
|
54
|
+
|
|
55
|
+
if (s.model) {
|
|
56
|
+
formattedText += `\n• Model:\n`;
|
|
57
|
+
formattedText += ` Class: ${s.model.class} (${s.model.file || "unknown"})\n`;
|
|
58
|
+
if (s.model.fillable && s.model.fillable.length > 0) {
|
|
59
|
+
formattedText += ` Fillable: [${s.model.fillable.join(", ")}]\n`;
|
|
60
|
+
}
|
|
61
|
+
if (s.model.casts && Object.keys(s.model.casts).length > 0) {
|
|
62
|
+
formattedText += ` Casts: ${JSON.stringify(s.model.casts)}\n`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (s.frontend) {
|
|
67
|
+
formattedText += `\n• Frontend Target:\n`;
|
|
68
|
+
formattedText += ` Page: ${s.frontend.target}\n`;
|
|
69
|
+
if (s.frontend.props.length > 0) {
|
|
70
|
+
formattedText += ` Props: [${s.frontend.props.join(", ")}]\n`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (result.alternatives && result.alternatives.length > 0) {
|
|
75
|
+
formattedText += `\n• Other Matching Slices:\n`;
|
|
76
|
+
for (const alt of result.alternatives) {
|
|
77
|
+
formattedText += ` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}\n`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
formattedText = `=== VERTICAL SLICE NOT FOUND ===\n`;
|
|
82
|
+
formattedText += `Query: ${result.query}\n`;
|
|
83
|
+
formattedText += `Message: ${result.message}\n`;
|
|
84
|
+
|
|
85
|
+
if (result.alternatives && result.alternatives.length > 0) {
|
|
86
|
+
formattedText += `\nAvailable Slices:\n`;
|
|
87
|
+
for (const alt of result.alternatives) {
|
|
88
|
+
formattedText += ` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}\n`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
content: [
|
|
95
|
+
{
|
|
96
|
+
type: "text",
|
|
97
|
+
text: formattedText.trim(),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
metadata: result,
|
|
101
|
+
};
|
|
102
|
+
}
|