septum 0.1.4 → 0.1.5

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.
Files changed (67) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +105 -105
  3. package/bin/septum.ts +4 -4
  4. package/package.json +63 -63
  5. package/src/cli/commands/check.ts +161 -161
  6. package/src/cli/commands/hook.ts +188 -188
  7. package/src/cli/commands/ingest.ts +29 -29
  8. package/src/cli/commands/init.ts +211 -211
  9. package/src/cli/commands/locate.ts +61 -61
  10. package/src/cli/commands/query.ts +64 -64
  11. package/src/cli/commands/serve.ts +5 -5
  12. package/src/cli/commands/slice.ts +48 -48
  13. package/src/cli/commands/sync.ts +31 -31
  14. package/src/cli/index.ts +210 -210
  15. package/src/cli/templates/hooks.ts +75 -75
  16. package/src/cli/templates/rules.ts +38 -38
  17. package/src/cli/templates/skill.ts +69 -69
  18. package/src/core/boundary/evaluator.ts +232 -210
  19. package/src/core/config/loader.ts +97 -97
  20. package/src/core/config/schema.ts +39 -39
  21. package/src/core/database/client.ts +44 -44
  22. package/src/core/database/repositories/dependency.repository.ts +366 -349
  23. package/src/core/database/repositories/domain.repository.ts +218 -198
  24. package/src/core/database/repositories/file.repository.ts +116 -106
  25. package/src/core/database/repositories/meta.repository.ts +33 -33
  26. package/src/core/database/repositories/symbol.repository.ts +443 -443
  27. package/src/core/database/repository.ts +264 -260
  28. package/src/core/database/schema.ts +153 -153
  29. package/src/core/discovery/topology-detector.ts +486 -486
  30. package/src/core/ingestion/hasher.ts +5 -5
  31. package/src/core/ingestion/pipeline.ts +584 -535
  32. package/src/core/parser/boundary-tracker.ts +288 -288
  33. package/src/core/parser/extractors/base.ts +62 -62
  34. package/src/core/parser/extractors/blade.ts +158 -158
  35. package/src/core/parser/extractors/frontend.ts +194 -194
  36. package/src/core/parser/extractors/go.ts +229 -180
  37. package/src/core/parser/extractors/laravel-semantic.ts +1039 -901
  38. package/src/core/parser/extractors/mcp-cli-semantic.ts +199 -199
  39. package/src/core/parser/extractors/nestjs-semantic.ts +119 -119
  40. package/src/core/parser/extractors/php.ts +153 -153
  41. package/src/core/parser/extractors/python.ts +228 -228
  42. package/src/core/parser/extractors/registry.ts +70 -70
  43. package/src/core/parser/extractors/semantic-extractor.interface.ts +21 -21
  44. package/src/core/parser/extractors/typescript.ts +181 -181
  45. package/src/core/parser/tree-sitter.ts +41 -41
  46. package/src/core/resolver/call-graph-tracer.ts +666 -668
  47. package/src/core/resolver/module-resolver.ts +408 -342
  48. package/src/core/resolver/path-resolver.ts +147 -147
  49. package/src/core/resolver/symbol-locator.ts +543 -543
  50. package/src/core/resolver/vertical-slice-tracer.ts +301 -285
  51. package/src/core/session/session-manager.ts +56 -56
  52. package/src/core/telemetry/telemetry.ts +86 -86
  53. package/src/index.ts +21 -21
  54. package/src/mcp/schemas.ts +578 -286
  55. package/src/mcp/server.ts +875 -716
  56. package/src/mcp/tools/check-boundary.ts +171 -152
  57. package/src/mcp/tools/get-domain-catalog.ts +145 -121
  58. package/src/mcp/tools/get-feature-context.ts +212 -116
  59. package/src/mcp/tools/get-symbol-hotspots.ts +60 -59
  60. package/src/mcp/tools/get-symbol-impact.ts +28 -26
  61. package/src/mcp/tools/get-symbol.ts +65 -63
  62. package/src/mcp/tools/locate-symbol.ts +171 -190
  63. package/src/mcp/tools/register-domain.ts +68 -64
  64. package/src/mcp/tools/register-feature.ts +100 -0
  65. package/src/mcp/tools/trace-vertical-slice.ts +74 -48
  66. package/src/types/index.ts +335 -315
  67. package/src/version.ts +3 -3
@@ -1,48 +1,74 @@
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 workspaceRoot = (config.settings as Record<string, unknown>)?.workspace_root as string || process.cwd();
22
- const tracer = new VerticalSliceTracer(repo, workspaceRoot);
23
- const result: VerticalSliceTraceResponse = tracer.trace(args.query);
24
-
25
- let formattedText = result.message;
26
-
27
- if (result.found && result.alternatives && result.alternatives.length > 0) {
28
- formattedText += `\n\n• Other Matching Slices:\n`;
29
- for (const alt of result.alternatives) {
30
- formattedText += ` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}\n`;
31
- }
32
- } else if (!result.found && result.alternatives && result.alternatives.length > 0) {
33
- formattedText += `\n\nAvailable Slices:\n`;
34
- for (const alt of result.alternatives) {
35
- formattedText += ` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}\n`;
36
- }
37
- }
38
-
39
- return {
40
- content: [
41
- {
42
- type: "text",
43
- text: formattedText.trim(),
44
- },
45
- ],
46
- metadata: result,
47
- };
48
- }
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
+ symbol?: string;
9
+ route?: string;
10
+ max_depth?: number;
11
+ }
12
+
13
+ export function handleTraceVerticalSlice(
14
+ repo: SeptumRepository,
15
+ config: ValidatedSeptumConfig,
16
+ args: TraceVerticalSliceArgs,
17
+ workspaceRoot?: string
18
+ ) {
19
+ const query = (
20
+ args.query ||
21
+ args.symbol ||
22
+ args.route ||
23
+ ""
24
+ ).toString().trim();
25
+
26
+ if (!query) {
27
+ throw new Error(
28
+ "Missing required argument: 'query' (e.g. 'POST /orders/{id}/status', 'OrderController@updateStatus', or task intent 'Ubah status order di dashboard')"
29
+ );
30
+ }
31
+
32
+ const root =
33
+ workspaceRoot ||
34
+ ((config.settings as Record<string, unknown>)?.workspace_root as string) ||
35
+ process.cwd();
36
+ const tracer = new VerticalSliceTracer(repo, root);
37
+ const result: VerticalSliceTraceResponse = tracer.trace(query);
38
+ const chain = result.chain || result.slice || [];
39
+
40
+ let summary = "";
41
+ if (result.found && chain.length > 0) {
42
+ summary = chain
43
+ .map((node) => `[${(node.stage || "STAGE").toUpperCase()}] ${node.symbol}`)
44
+ .join(" ➔ ");
45
+ } else if (result.found && result.entrypoint) {
46
+ summary = `[ENTRYPOINT] ${result.entrypoint.method} ${result.entrypoint.uri} ➔ ${result.entrypoint.controller}@${result.entrypoint.action}`;
47
+ } else {
48
+ summary = `[NOT FOUND] No vertical slice matching '${query}'`;
49
+ }
50
+
51
+ const payload = {
52
+ status: result.found ? "success" : "not_found",
53
+ query,
54
+ found: result.found,
55
+ confidence: result.confidence || (result.found ? "exact" : undefined),
56
+ is_exact_match: result.is_exact_match,
57
+ architecture_style: result.architecture_style,
58
+ entrypoint: result.entrypoint || null,
59
+ chain,
60
+ alternatives: result.alternatives || [],
61
+ summary,
62
+ message: result.message || summary,
63
+ };
64
+
65
+ return {
66
+ content: [
67
+ {
68
+ type: "text" as const,
69
+ text: JSON.stringify(payload, null, 2),
70
+ },
71
+ ],
72
+ metadata: payload,
73
+ };
74
+ }