septum 0.1.3 → 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 (74) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +105 -102
  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 -90
  13. package/src/cli/commands/sync.ts +31 -31
  14. package/src/cli/commands/topology.ts +119 -0
  15. package/src/cli/index.ts +210 -199
  16. package/src/cli/templates/hooks.ts +75 -75
  17. package/src/cli/templates/rules.ts +38 -38
  18. package/src/cli/templates/skill.ts +69 -69
  19. package/src/core/boundary/evaluator.ts +232 -210
  20. package/src/core/config/loader.ts +97 -97
  21. package/src/core/config/schema.ts +39 -39
  22. package/src/core/database/client.ts +44 -44
  23. package/src/core/database/repositories/dependency.repository.ts +366 -349
  24. package/src/core/database/repositories/domain.repository.ts +218 -198
  25. package/src/core/database/repositories/environment.repository.ts +207 -0
  26. package/src/core/database/repositories/file.repository.ts +116 -106
  27. package/src/core/database/repositories/meta.repository.ts +33 -33
  28. package/src/core/database/repositories/symbol.repository.ts +443 -424
  29. package/src/core/database/repository.ts +264 -255
  30. package/src/core/database/schema.ts +34 -1
  31. package/src/core/discovery/topology-detector.ts +486 -486
  32. package/src/core/ingestion/hasher.ts +5 -5
  33. package/src/core/ingestion/pipeline.ts +584 -535
  34. package/src/core/parser/behavioral-analyzer.ts +119 -0
  35. package/src/core/parser/boundary-tracker.ts +288 -128
  36. package/src/core/parser/extractors/base.ts +62 -61
  37. package/src/core/parser/extractors/frontend.ts +194 -194
  38. package/src/core/parser/extractors/go.ts +229 -176
  39. package/src/core/parser/extractors/laravel-semantic.ts +1039 -585
  40. package/src/core/parser/extractors/mcp-cli-semantic.ts +199 -199
  41. package/src/core/parser/extractors/nestjs-semantic.ts +119 -119
  42. package/src/core/parser/extractors/php.ts +153 -149
  43. package/src/core/parser/extractors/python.ts +228 -226
  44. package/src/core/parser/extractors/registry.ts +70 -70
  45. package/src/core/parser/extractors/semantic-extractor.interface.ts +21 -21
  46. package/src/core/parser/extractors/typescript.ts +181 -177
  47. package/src/core/parser/schema/providers/laravel-migration-provider.ts +215 -0
  48. package/src/core/parser/schema/providers/prisma-schema-provider.ts +89 -0
  49. package/src/core/parser/schema/schema-provider-registry.ts +43 -0
  50. package/src/core/parser/schema/schema-provider.interface.ts +33 -0
  51. package/src/core/parser/tree-sitter.ts +41 -41
  52. package/src/core/resolver/call-graph-tracer.ts +666 -668
  53. package/src/core/resolver/module-resolver.ts +408 -342
  54. package/src/core/resolver/symbol-locator.ts +543 -543
  55. package/src/core/resolver/vertical-slice-tracer.ts +301 -252
  56. package/src/core/session/session-manager.ts +56 -56
  57. package/src/core/telemetry/telemetry.ts +86 -86
  58. package/src/core/topology/environment-detector.ts +860 -0
  59. package/src/core/topology/types.ts +83 -0
  60. package/src/index.ts +21 -18
  61. package/src/mcp/schemas.ts +578 -238
  62. package/src/mcp/server.ts +875 -656
  63. package/src/mcp/tools/check-boundary.ts +171 -152
  64. package/src/mcp/tools/get-domain-catalog.ts +145 -121
  65. package/src/mcp/tools/get-environment-topology.ts +141 -0
  66. package/src/mcp/tools/get-feature-context.ts +212 -116
  67. package/src/mcp/tools/get-symbol-hotspots.ts +60 -49
  68. package/src/mcp/tools/get-symbol-impact.ts +28 -26
  69. package/src/mcp/tools/get-symbol.ts +65 -63
  70. package/src/mcp/tools/locate-symbol.ts +171 -190
  71. package/src/mcp/tools/register-domain.ts +68 -64
  72. package/src/mcp/tools/register-feature.ts +100 -0
  73. package/src/mcp/tools/trace-vertical-slice.ts +74 -103
  74. package/src/types/index.ts +335 -299
@@ -1,299 +1,335 @@
1
- export type EnforcementMode = "strict" | "warn";
2
-
3
- export type ArchetypeKind =
4
- | "controller"
5
- | "service"
6
- | "model"
7
- | "repository"
8
- | "action"
9
- | "job"
10
- | "event"
11
- | "listener"
12
- | "middleware"
13
- | "request"
14
- | "resource"
15
- | "util"
16
- | "view"
17
- | "unknown";
18
-
19
- export type SymbolKind =
20
- | "class"
21
- | "interface"
22
- | "trait"
23
- | "enum"
24
- | "method"
25
- | "function"
26
- | "type"
27
- | "property"
28
- | "component"
29
- | "view";
30
-
31
- export type Visibility = "public" | "protected" | "private";
32
-
33
- export interface SeptumConfig {
34
- version: string;
35
- settings: {
36
- enforcement: EnforcementMode;
37
- db_path?: string;
38
- ignore_patterns?: string[];
39
- };
40
- domains: Record<string, DomainConfig>;
41
- features?: Record<string, FeatureConfig>;
42
- }
43
-
44
- export interface DomainConfig {
45
- root: string;
46
- allowed_dependencies?: string[];
47
- forbidden_dependencies?: string[];
48
- archetypes?: Record<string, string>;
49
- description?: string;
50
- }
51
-
52
- export interface FeatureConfig {
53
- domain: string;
54
- description?: string;
55
- allowed_touchpoints: string[];
56
- reuse_symbols?: string[];
57
- input_contract?: Record<string, unknown>;
58
- output_contract?: Record<string, unknown>;
59
- }
60
-
61
- export interface FeatureContextResponse {
62
- feature: string;
63
- domain: string;
64
- description?: string;
65
- allowed_touchpoints: string[];
66
- reuse_symbols: Array<{
67
- name: string;
68
- kind: string;
69
- signature?: string;
70
- methods?: string[];
71
- properties?: string[];
72
- file_path?: string;
73
- domain?: string;
74
- }>;
75
- input_contract: Record<string, unknown>;
76
- output_contract: Record<string, unknown>;
77
- governance_directives?: string[];
78
- }
79
-
80
- export interface CheckBoundaryArgs {
81
- file_path: string;
82
- proposed_imports: string[];
83
- feature_key?: string;
84
- }
85
-
86
- export interface DomainRecord {
87
- id: number;
88
- name: string;
89
- root_path: string;
90
- allowed_deps_json: string;
91
- forbidden_deps_json: string;
92
- archetypes_json: string;
93
- created_at: string;
94
- updated_at: string;
95
- }
96
-
97
- export interface FileRecord {
98
- id: number;
99
- domain_id: number;
100
- path: string;
101
- archetype: ArchetypeKind;
102
- content_hash: string;
103
- line_count: number;
104
- mtime_ms: number;
105
- size_bytes: number;
106
- last_scanned_at: string;
107
- }
108
-
109
- export interface ActiveFeatureSession {
110
- feature_key: string;
111
- domain: string;
112
- touchpoints: string[];
113
- locked_at: string;
114
- }
115
-
116
- export interface SymbolRecord {
117
- id: number;
118
- file_id: number;
119
- name: string;
120
- kind: SymbolKind;
121
- signature: string;
122
- visibility: Visibility;
123
- line_start: number;
124
- line_end: number;
125
- line_count: number;
126
- }
127
-
128
- export interface DependencyRecord {
129
- id: number;
130
- source_file_id: number;
131
- target_symbol_or_path: string;
132
- import_statement: string;
133
- line_number: number;
134
- is_external: boolean;
135
- }
136
-
137
- export interface ExtractedSymbol {
138
- name: string;
139
- kind: SymbolKind;
140
- signature: string;
141
- visibility: Visibility;
142
- line_start: number;
143
- line_end: number;
144
- line_count: number;
145
- }
146
-
147
- export interface ExtractedDependency {
148
- target: string;
149
- statement: string;
150
- line_number: number;
151
- is_external: boolean;
152
- }
153
-
154
- export interface ParsedFileAST {
155
- symbols: ExtractedSymbol[];
156
- dependencies: ExtractedDependency[];
157
- }
158
-
159
- export type BoundaryViolationRule =
160
- | "forbidden_dependency"
161
- | "disallowed_dependency"
162
- | "touchpoint_violation"
163
- | "unknown_feature";
164
-
165
- export interface BoundaryViolation {
166
- file: string;
167
- line: number;
168
- source_domain: string;
169
- target_domain: string;
170
- imported_target: string;
171
- rule: BoundaryViolationRule;
172
- message: string;
173
- }
174
-
175
- export interface DomainCatalogResponse {
176
- domain: string;
177
- root: string;
178
- allowed_dependencies: string[];
179
- forbidden_dependencies: string[];
180
- files: Array<{
181
- path: string;
182
- archetype: ArchetypeKind;
183
- symbols: Array<{
184
- name: string;
185
- kind: SymbolKind;
186
- properties?: string[];
187
- methods?: string[];
188
- signatures?: string[];
189
- }>;
190
- }>;
191
- }
192
-
193
- export interface ExecutionChainNode {
194
- stage:
195
- | "ingress"
196
- | "validation"
197
- | "controller"
198
- | "orchestrator"
199
- | "use_case"
200
- | "domain"
201
- | "entity"
202
- | "egress"
203
- | "repository"
204
- | string;
205
- symbol: string;
206
- file?: string;
207
- line?: number;
208
- description?: string;
209
- }
210
-
211
- export interface VerticalSliceRecord {
212
- id: number;
213
- domain_id: number | null;
214
- feature_key: string | null;
215
- http_method: string;
216
- route_uri: string;
217
- route_name: string | null;
218
- controller_class: string;
219
- action_name: string;
220
- controller_file: string | null;
221
- controller_line: number;
222
- architecture_style: string;
223
- entry_kind: string;
224
- execution_chain_json: string;
225
- created_at: string;
226
- }
227
-
228
- export interface VerticalSliceTraceResponse {
229
- query: string;
230
- found: boolean;
231
- confidence?: "exact" | "inferred";
232
- is_exact_match?: boolean;
233
- architecture_style?: string;
234
- entrypoint?: {
235
- method: string;
236
- uri: string;
237
- name?: string | null;
238
- controller: string;
239
- action: string;
240
- file?: string | null;
241
- line?: number;
242
- };
243
- chain?: ExecutionChainNode[];
244
- alternatives?: Array<{
245
- method: string;
246
- uri: string;
247
- controller: string;
248
- action: string;
249
- }>;
250
- message: string;
251
- }
252
-
253
- export interface GetSymbolArgs {
254
- symbol: string;
255
- domain?: string;
256
- include_dependencies?: boolean;
257
- }
258
-
259
- export interface SymbolExactRange {
260
- start_line: number;
261
- end_line: number;
262
- total_lines: number;
263
- }
264
-
265
- export interface GetSymbolDetailsResponse {
266
- symbol: string;
267
- kind: SymbolKind | string;
268
- file_path: string;
269
- domain?: string;
270
- exact_range: SymbolExactRange;
271
- signature: string;
272
- visibility?: Visibility | string;
273
- dependencies_injected: string[];
274
- outbound_calls: string[];
275
- sibling_methods?: string[];
276
- }
277
-
278
- export interface GetSymbolImpactArgs {
279
- symbol: string;
280
- }
281
-
282
- export interface InboundCaller {
283
- file: string;
284
- caller: string;
285
- line: number;
286
- kind?: string;
287
- domain?: string;
288
- }
289
-
290
- export interface GetSymbolImpactResponse {
291
- target_symbol: string;
292
- impact_summary: {
293
- total_dependents: number;
294
- risk_level: "low" | "medium" | "high";
295
- affected_files_count: number;
296
- };
297
- inbound_callers: InboundCaller[];
298
- }
299
-
1
+ export type EnforcementMode = "strict" | "warn";
2
+
3
+ export type ArchetypeKind =
4
+ | "controller"
5
+ | "service"
6
+ | "model"
7
+ | "repository"
8
+ | "action"
9
+ | "job"
10
+ | "event"
11
+ | "listener"
12
+ | "middleware"
13
+ | "request"
14
+ | "resource"
15
+ | "route"
16
+ | "util"
17
+ | "view"
18
+ | "unknown";
19
+
20
+ export type SymbolKind =
21
+ | "class"
22
+ | "interface"
23
+ | "trait"
24
+ | "enum"
25
+ | "method"
26
+ | "function"
27
+ | "type"
28
+ | "property"
29
+ | "component"
30
+ | "view";
31
+
32
+ export type Visibility = "public" | "protected" | "private";
33
+
34
+ export interface SeptumConfig {
35
+ version: string;
36
+ settings: {
37
+ enforcement: EnforcementMode;
38
+ db_path?: string;
39
+ ignore_patterns?: string[];
40
+ };
41
+ domains: Record<string, DomainConfig>;
42
+ features?: Record<string, FeatureConfig>;
43
+ }
44
+
45
+ export interface DomainConfig {
46
+ root: string;
47
+ allowed_dependencies?: string[];
48
+ forbidden_dependencies?: string[];
49
+ archetypes?: Record<string, string>;
50
+ description?: string;
51
+ }
52
+
53
+ export interface FeatureConfig {
54
+ domain: string;
55
+ description?: string;
56
+ allowed_touchpoints: string[];
57
+ reuse_symbols?: string[];
58
+ input_contract?: Record<string, unknown>;
59
+ output_contract?: Record<string, unknown>;
60
+ }
61
+
62
+ export interface FeatureContextResponse {
63
+ feature_key: string;
64
+ feature?: string;
65
+ domain: string;
66
+ description?: string;
67
+ allowed_touchpoints: string[];
68
+ reuse_symbols: Array<{
69
+ name: string;
70
+ kind: string;
71
+ signature?: string;
72
+ methods?: string[];
73
+ properties?: string[];
74
+ file_path?: string;
75
+ domain?: string;
76
+ }>;
77
+ input_contract: Record<string, unknown>;
78
+ output_contract: Record<string, unknown>;
79
+ governance_directives?: string[];
80
+ is_inferred?: boolean;
81
+ }
82
+
83
+ export interface RegisterFeatureArgs {
84
+ feature_key: string;
85
+ domain: string;
86
+ description?: string;
87
+ allowed_touchpoints: string[];
88
+ reuse_symbols?: string[];
89
+ input_contract?: Record<string, unknown>;
90
+ output_contract?: Record<string, unknown>;
91
+ persist_to_config?: boolean;
92
+ }
93
+
94
+ export interface CheckBoundaryArgs {
95
+ file_path: string;
96
+ proposed_imports: string[];
97
+ feature_key?: string;
98
+ }
99
+
100
+ export interface DomainRecord {
101
+ id: number;
102
+ name: string;
103
+ root_path: string;
104
+ allowed_deps_json: string;
105
+ forbidden_deps_json: string;
106
+ archetypes_json: string;
107
+ created_at: string;
108
+ updated_at: string;
109
+ }
110
+
111
+ export interface FileRecord {
112
+ id: number;
113
+ domain_id: number;
114
+ path: string;
115
+ archetype: ArchetypeKind;
116
+ content_hash: string;
117
+ line_count: number;
118
+ mtime_ms: number;
119
+ size_bytes: number;
120
+ last_scanned_at: string;
121
+ }
122
+
123
+ export interface ActiveFeatureSession {
124
+ feature_key: string;
125
+ domain: string;
126
+ touchpoints: string[];
127
+ locked_at: string;
128
+ }
129
+
130
+ export interface SymbolRecord {
131
+ id: number;
132
+ file_id: number;
133
+ name: string;
134
+ kind: SymbolKind;
135
+ signature: string;
136
+ visibility: Visibility;
137
+ line_start: number;
138
+ line_end: number;
139
+ line_count: number;
140
+ nesting_depth: number;
141
+ }
142
+
143
+ export interface DependencyRecord {
144
+ id: number;
145
+ source_file_id: number;
146
+ target_symbol_or_path: string;
147
+ import_statement: string;
148
+ line_number: number;
149
+ is_external: boolean;
150
+ }
151
+
152
+ export interface ExtractedSymbol {
153
+ name: string;
154
+ kind: SymbolKind;
155
+ signature: string;
156
+ visibility: Visibility;
157
+ line_start: number;
158
+ line_end: number;
159
+ line_count: number;
160
+ nesting_depth?: number;
161
+ }
162
+
163
+ export interface ExtractedDependency {
164
+ target: string;
165
+ statement: string;
166
+ line_number: number;
167
+ is_external: boolean;
168
+ }
169
+
170
+ export interface ParsedFileAST {
171
+ symbols: ExtractedSymbol[];
172
+ dependencies: ExtractedDependency[];
173
+ }
174
+
175
+ export type BoundaryViolationRule =
176
+ | "forbidden_dependency"
177
+ | "disallowed_dependency"
178
+ | "touchpoint_violation"
179
+ | "unknown_feature"
180
+ | "unmapped_domain";
181
+
182
+ export interface BoundaryViolation {
183
+ file: string;
184
+ line: number;
185
+ source_domain: string;
186
+ target_domain: string;
187
+ imported_target: string;
188
+ rule: BoundaryViolationRule;
189
+ message: string;
190
+ }
191
+
192
+ export interface DomainCatalogResponse {
193
+ domain: string;
194
+ root: string;
195
+ allowed_dependencies: string[];
196
+ forbidden_dependencies: string[];
197
+ files: Array<{
198
+ path: string;
199
+ archetype: ArchetypeKind;
200
+ symbols: Array<{
201
+ name: string;
202
+ kind: SymbolKind;
203
+ properties?: string[];
204
+ methods?: string[];
205
+ signatures?: string[];
206
+ }>;
207
+ }>;
208
+ }
209
+
210
+ export interface ExecutionChainNode {
211
+ stage:
212
+ | "ingress"
213
+ | "guard"
214
+ | "validation"
215
+ | "controller"
216
+ | "action"
217
+ | "service"
218
+ | "orchestrator"
219
+ | "use_case"
220
+ | "domain"
221
+ | "entity"
222
+ | "side_effect"
223
+ | "job"
224
+ | "event"
225
+ | "transaction"
226
+ | "egress"
227
+ | "repository"
228
+ | string;
229
+ symbol: string;
230
+ file?: string;
231
+ line?: number;
232
+ description?: string;
233
+ table?: string;
234
+ schema_file?: string;
235
+ columns_summary?: string;
236
+ guards?: string[];
237
+ mutations?: string[];
238
+ emits?: string[];
239
+ dispatches?: string[];
240
+ transactions?: boolean;
241
+ payload_props?: string[];
242
+ }
243
+
244
+ export interface VerticalSliceRecord {
245
+ id: number;
246
+ domain_id: number | null;
247
+ feature_key: string | null;
248
+ http_method: string;
249
+ route_uri: string;
250
+ route_name: string | null;
251
+ controller_class: string;
252
+ action_name: string;
253
+ controller_file: string | null;
254
+ controller_line: number;
255
+ architecture_style: string;
256
+ entry_kind: string;
257
+ execution_chain_json: string;
258
+ created_at: string;
259
+ }
260
+
261
+ export interface VerticalSliceTraceResponse {
262
+ query: string;
263
+ found: boolean;
264
+ confidence?: "exact" | "inferred";
265
+ is_exact_match?: boolean;
266
+ architecture_style?: string;
267
+ entrypoint?: {
268
+ method: string;
269
+ uri: string;
270
+ name?: string | null;
271
+ controller: string;
272
+ action: string;
273
+ file?: string | null;
274
+ line?: number;
275
+ };
276
+ chain?: ExecutionChainNode[];
277
+ slice?: ExecutionChainNode[];
278
+ alternatives?: Array<{
279
+ method: string;
280
+ uri: string;
281
+ controller: string;
282
+ action: string;
283
+ }>;
284
+ message: string;
285
+ }
286
+
287
+ export interface GetSymbolArgs {
288
+ symbol: string;
289
+ domain?: string;
290
+ include_dependencies?: boolean;
291
+ }
292
+
293
+ export interface SymbolExactRange {
294
+ start_line: number;
295
+ end_line: number;
296
+ total_lines: number;
297
+ }
298
+
299
+ export interface GetSymbolDetailsResponse {
300
+ symbol: string;
301
+ kind: SymbolKind | string;
302
+ file_path: string;
303
+ domain?: string;
304
+ exact_range: SymbolExactRange;
305
+ signature: string;
306
+ visibility?: Visibility | string;
307
+ dependencies_injected: string[];
308
+ outbound_calls: string[];
309
+ sibling_methods?: string[];
310
+ }
311
+
312
+ export interface GetSymbolImpactArgs {
313
+ symbol: string;
314
+ }
315
+
316
+ export interface InboundCaller {
317
+ file: string;
318
+ caller: string;
319
+ line: number;
320
+ kind?: string;
321
+ domain?: string;
322
+ }
323
+
324
+ export interface GetSymbolImpactResponse {
325
+ target_symbol: string;
326
+ found_in_index: boolean;
327
+ warning?: string;
328
+ impact_summary: {
329
+ total_dependents: number;
330
+ risk_level: "low" | "medium" | "high";
331
+ affected_files_count: number;
332
+ };
333
+ inbound_callers: InboundCaller[];
334
+ }
335
+