septum 0.1.4 → 0.1.6

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 (70) 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 +216 -188
  7. package/src/cli/commands/ingest.ts +29 -29
  8. package/src/cli/commands/init.ts +213 -211
  9. package/src/cli/commands/locate.ts +61 -61
  10. package/src/cli/commands/query.ts +104 -64
  11. package/src/cli/commands/serve.ts +5 -5
  12. package/src/cli/commands/slice.ts +50 -48
  13. package/src/cli/commands/sync.ts +31 -31
  14. package/src/cli/index.ts +220 -210
  15. package/src/cli/templates/hooks.ts +75 -75
  16. package/src/cli/templates/rules.ts +50 -38
  17. package/src/cli/templates/skill.ts +65 -69
  18. package/src/core/boundary/evaluator.ts +429 -210
  19. package/src/core/config/loader.ts +117 -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 +552 -349
  23. package/src/core/database/repositories/domain.repository.ts +275 -198
  24. package/src/core/database/repositories/file.repository.ts +117 -106
  25. package/src/core/database/repositories/meta.repository.ts +33 -33
  26. package/src/core/database/repositories/symbol.repository.ts +482 -443
  27. package/src/core/database/repository.ts +281 -260
  28. package/src/core/database/schema.ts +154 -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 +606 -535
  32. package/src/core/parser/boundary-tracker.ts +433 -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 +147 -194
  36. package/src/core/parser/extractors/go.ts +408 -180
  37. package/src/core/parser/extractors/laravel-semantic.ts +1045 -901
  38. package/src/core/parser/extractors/mcp-cli-semantic.ts +328 -199
  39. package/src/core/parser/extractors/nestjs-semantic.ts +134 -119
  40. package/src/core/parser/extractors/php.ts +415 -153
  41. package/src/core/parser/extractors/python.ts +460 -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 +668 -181
  45. package/src/core/parser/tree-sitter.ts +41 -41
  46. package/src/core/parser/wasm-loader.ts +271 -0
  47. package/src/core/resolver/call-graph-tracer.ts +698 -668
  48. package/src/core/resolver/module-resolver.ts +479 -342
  49. package/src/core/resolver/path-resolver.ts +147 -147
  50. package/src/core/resolver/symbol-locator.ts +543 -543
  51. package/src/core/resolver/vertical-slice-tracer.ts +323 -285
  52. package/src/core/session/session-manager.ts +56 -56
  53. package/src/core/telemetry/telemetry.ts +86 -86
  54. package/src/core/topology/environment-detector.ts +109 -6
  55. package/src/index.ts +21 -21
  56. package/src/mcp/schemas.ts +695 -286
  57. package/src/mcp/server.ts +927 -716
  58. package/src/mcp/tools/check-boundary.ts +307 -152
  59. package/src/mcp/tools/get-domain-catalog.ts +155 -121
  60. package/src/mcp/tools/get-environment-topology.ts +3 -6
  61. package/src/mcp/tools/get-feature-context.ts +227 -116
  62. package/src/mcp/tools/get-symbol-hotspots.ts +54 -59
  63. package/src/mcp/tools/get-symbol-impact.ts +28 -26
  64. package/src/mcp/tools/get-symbol.ts +65 -63
  65. package/src/mcp/tools/locate-symbol.ts +169 -190
  66. package/src/mcp/tools/register-domain.ts +59 -64
  67. package/src/mcp/tools/register-feature.ts +91 -0
  68. package/src/mcp/tools/trace-vertical-slice.ts +74 -48
  69. package/src/types/index.ts +366 -315
  70. package/src/version.ts +3 -3
@@ -1,59 +1,54 @@
1
- import type { ValidatedSeptumConfig } from "../../core/config/schema.ts";
2
- import type { DatabaseRepository } from "../../core/database/repository.ts";
3
- import type { SymbolKind } from "../../types/index.ts";
4
-
5
- export interface GetSymbolHotspotsArgs {
6
- min_lines?: number;
7
- min_nesting?: number;
8
- kind?: SymbolKind | string;
9
- domain?: string;
10
- limit?: number;
11
- sort_by?: "lines" | "nesting" | "risk_score";
12
- }
13
-
14
- export function handleGetSymbolHotspots(
15
- repo: DatabaseRepository,
16
- _config: ValidatedSeptumConfig,
17
- args: GetSymbolHotspotsArgs
18
- ) {
19
- const minLines = args.min_lines ?? (args.min_nesting ? 0 : 30);
20
- const minNesting = args.min_nesting ?? 1;
21
- const limit = args.limit ?? 30;
22
- const sortBy = args.sort_by ?? "risk_score";
23
-
24
- const hotspots = repo.getHotspotSymbols({
25
- minLines,
26
- minNesting,
27
- kind: args.kind as SymbolKind | undefined,
28
- domain: args.domain,
29
- limit,
30
- sortBy,
31
- });
32
-
33
- const payload = {
34
- total_found: hotspots.length,
35
- threshold_min_lines: minLines,
36
- threshold_min_nesting: minNesting,
37
- sort_by: sortBy,
38
- hotspots: hotspots.map((h) => ({
39
- name: h.name,
40
- kind: h.kind,
41
- line_count: h.line_count,
42
- nesting_depth: (h as any).nesting_depth ?? 1,
43
- risk_score: (h as any).risk_score ?? h.line_count,
44
- line_span: `${h.line_start}-${h.line_end}`,
45
- file_path: h.file_path,
46
- domain: h.domain_name,
47
- signature: h.signature,
48
- })),
49
- };
50
-
51
- return {
52
- content: [
53
- {
54
- type: "text" as const,
55
- text: JSON.stringify(payload, null, 2),
56
- },
57
- ],
58
- };
59
- }
1
+ import type { ValidatedSeptumConfig } from "../../core/config/schema.ts";
2
+ import type { SeptumRepository } from "../../core/database/repository.ts";
3
+ import type { SymbolKind } from "../../types/index.ts";
4
+ import type { GetSymbolHotspotsArgs } from "../schemas.ts";
5
+
6
+ export type { GetSymbolHotspotsArgs } from "../schemas.ts";
7
+
8
+ export function handleGetSymbolHotspots(
9
+ repo: SeptumRepository,
10
+ _config: ValidatedSeptumConfig,
11
+ args: GetSymbolHotspotsArgs,
12
+ _workspaceRoot?: string
13
+ ) {
14
+ const minLines = args.min_lines ?? (args.min_nesting ? 0 : 30);
15
+ const minNesting = args.min_nesting ?? 1;
16
+ const limit = args.limit ?? 30;
17
+ const sortBy = args.sort_by ?? "risk_score";
18
+
19
+ const hotspots = repo.getHotspotSymbols({
20
+ minLines,
21
+ minNesting,
22
+ kind: args.kind as SymbolKind | undefined,
23
+ domain: args.domain,
24
+ limit,
25
+ sortBy,
26
+ });
27
+
28
+ const payload = {
29
+ total_found: hotspots.length,
30
+ threshold_min_lines: minLines,
31
+ threshold_min_nesting: minNesting,
32
+ sort_by: sortBy,
33
+ hotspots: hotspots.map((h) => ({
34
+ name: h.name,
35
+ kind: h.kind,
36
+ line_count: h.line_count,
37
+ nesting_depth: (h as any).nesting_depth ?? 1,
38
+ risk_score: (h as any).risk_score ?? h.line_count,
39
+ line_span: `${h.line_start}-${h.line_end}`,
40
+ file_path: h.file_path,
41
+ domain: h.domain_name,
42
+ signature: h.signature,
43
+ })),
44
+ };
45
+
46
+ return {
47
+ content: [
48
+ {
49
+ type: "text" as const,
50
+ text: JSON.stringify(payload, null, 2),
51
+ },
52
+ ],
53
+ };
54
+ }
@@ -1,26 +1,28 @@
1
- import type { ValidatedSeptumConfig } from "../../core/config/schema.ts";
2
- import type { SeptumRepository } from "../../core/database/repository.ts";
3
- import type { GetSymbolImpactArgs } from "../../types/index.ts";
4
-
5
- export function handleGetSymbolImpact(
6
- repo: SeptumRepository,
7
- _config: ValidatedSeptumConfig,
8
- args: GetSymbolImpactArgs
9
- ) {
10
- if (!args.symbol) {
11
- throw new Error(
12
- "Missing required argument: 'symbol' (e.g. 'OrderService::cancelOrder', 'OrderService', or 'cancelOrder')"
13
- );
14
- }
15
-
16
- const impact = repo.getSymbolImpact(args.symbol);
17
-
18
- return {
19
- content: [
20
- {
21
- type: "text" as const,
22
- text: JSON.stringify(impact, null, 2),
23
- },
24
- ],
25
- };
26
- }
1
+ import type { ValidatedSeptumConfig } from "../../core/config/schema.ts";
2
+ import type { SeptumRepository } from "../../core/database/repository.ts";
3
+ import type { GetSymbolImpactArgs } from "../../types/index.ts";
4
+
5
+ export function handleGetSymbolImpact(
6
+ repo: SeptumRepository,
7
+ _config: ValidatedSeptumConfig,
8
+ args: GetSymbolImpactArgs,
9
+ _workspaceRoot?: string
10
+ ) {
11
+ const symbol = (args.symbol || (args as unknown as Record<string, unknown>).query || "").toString().trim();
12
+ if (!symbol) {
13
+ throw new Error(
14
+ "Missing required argument: 'symbol' (e.g. 'OrderService::cancelOrder', 'OrderService', or 'cancelOrder')"
15
+ );
16
+ }
17
+
18
+ const impact = repo.getSymbolImpact(symbol);
19
+
20
+ return {
21
+ content: [
22
+ {
23
+ type: "text" as const,
24
+ text: JSON.stringify(impact, null, 2),
25
+ },
26
+ ],
27
+ };
28
+ }
@@ -1,63 +1,65 @@
1
- import type { ValidatedSeptumConfig } from "../../core/config/schema.ts";
2
- import type { SeptumRepository } from "../../core/database/repository.ts";
3
- import { SymbolLocator } from "../../core/resolver/symbol-locator.ts";
4
- import type { GetSymbolArgs } from "../../types/index.ts";
5
-
6
- export function handleGetSymbol(
7
- repo: SeptumRepository,
8
- _config: ValidatedSeptumConfig,
9
- args: GetSymbolArgs
10
- ) {
11
- if (!args.symbol) {
12
- throw new Error(
13
- "Missing required argument: 'symbol' (e.g. 'OrderController::cancelOrder', 'OrderService', or 'cancelOrder')"
14
- );
15
- }
16
-
17
- const details = repo.getSymbolDetails(args.symbol, {
18
- domain: args.domain,
19
- includeDependencies: args.include_dependencies,
20
- });
21
-
22
- if (details) {
23
- return {
24
- content: [
25
- {
26
- type: "text" as const,
27
- text: JSON.stringify(details, null, 2),
28
- },
29
- ],
30
- };
31
- }
32
-
33
- // Fallback to fuzzy SymbolLocator to provide actionable hints
34
- const locator = new SymbolLocator(repo);
35
- const fallback = locator.locate(args.symbol, args.domain);
36
-
37
- const payload = {
38
- symbol: args.symbol,
39
- found: false,
40
- message: `Symbol '${args.symbol}' was not found in the deterministic catalog.`,
41
- suggestions: fallback.suggestions.map((s) => ({
42
- name: s.name,
43
- similarity_score: Math.round(s.similarity_score * 100) / 100,
44
- exact_range: {
45
- start_line: s.line_start,
46
- end_line: s.line_end,
47
- total_lines: s.line_end - s.line_start + 1,
48
- },
49
- signature: s.signature,
50
- file_path: s.file_path,
51
- })),
52
- sibling_methods: fallback.sibling_methods,
53
- };
54
-
55
- return {
56
- content: [
57
- {
58
- type: "text" as const,
59
- text: JSON.stringify(payload, null, 2),
60
- },
61
- ],
62
- };
63
- }
1
+ import type { ValidatedSeptumConfig } from "../../core/config/schema.ts";
2
+ import type { SeptumRepository } from "../../core/database/repository.ts";
3
+ import { SymbolLocator } from "../../core/resolver/symbol-locator.ts";
4
+ import type { GetSymbolArgs } from "../../types/index.ts";
5
+
6
+ export function handleGetSymbol(
7
+ repo: SeptumRepository,
8
+ _config: ValidatedSeptumConfig,
9
+ args: GetSymbolArgs,
10
+ _workspaceRoot?: string
11
+ ) {
12
+ const symbol = (args.symbol || (args as unknown as Record<string, unknown>).query || "").toString().trim();
13
+ if (!symbol) {
14
+ throw new Error(
15
+ "Missing required argument: 'symbol' (e.g. 'OrderController::cancelOrder', 'OrderService', or 'cancelOrder')"
16
+ );
17
+ }
18
+
19
+ const details = repo.getSymbolDetails(symbol, {
20
+ domain: args.domain,
21
+ includeDependencies: args.include_dependencies,
22
+ });
23
+
24
+ if (details) {
25
+ return {
26
+ content: [
27
+ {
28
+ type: "text" as const,
29
+ text: JSON.stringify(details, null, 2),
30
+ },
31
+ ],
32
+ };
33
+ }
34
+
35
+ // Fallback to fuzzy SymbolLocator to provide actionable hints
36
+ const locator = new SymbolLocator(repo);
37
+ const fallback = locator.locate(symbol, args.domain);
38
+
39
+ const payload = {
40
+ symbol,
41
+ found: false,
42
+ message: `Symbol '${symbol}' was not found in the deterministic catalog.`,
43
+ suggestions: fallback.suggestions.map((s) => ({
44
+ name: s.name,
45
+ similarity_score: Math.round(s.similarity_score * 100) / 100,
46
+ exact_range: {
47
+ start_line: s.line_start,
48
+ end_line: s.line_end,
49
+ total_lines: s.line_end - s.line_start + 1,
50
+ },
51
+ signature: s.signature,
52
+ file_path: s.file_path,
53
+ })),
54
+ sibling_methods: fallback.sibling_methods,
55
+ };
56
+
57
+ return {
58
+ content: [
59
+ {
60
+ type: "text" as const,
61
+ text: JSON.stringify(payload, null, 2),
62
+ },
63
+ ],
64
+ };
65
+ }