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,315 +1,366 @@
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: string;
64
- domain: string;
65
- description?: string;
66
- allowed_touchpoints: string[];
67
- reuse_symbols: Array<{
68
- name: string;
69
- kind: string;
70
- signature?: string;
71
- methods?: string[];
72
- properties?: string[];
73
- file_path?: string;
74
- domain?: string;
75
- }>;
76
- input_contract: Record<string, unknown>;
77
- output_contract: Record<string, unknown>;
78
- governance_directives?: string[];
79
- }
80
-
81
- export interface CheckBoundaryArgs {
82
- file_path: string;
83
- proposed_imports: string[];
84
- feature_key?: string;
85
- }
86
-
87
- export interface DomainRecord {
88
- id: number;
89
- name: string;
90
- root_path: string;
91
- allowed_deps_json: string;
92
- forbidden_deps_json: string;
93
- archetypes_json: string;
94
- created_at: string;
95
- updated_at: string;
96
- }
97
-
98
- export interface FileRecord {
99
- id: number;
100
- domain_id: number;
101
- path: string;
102
- archetype: ArchetypeKind;
103
- content_hash: string;
104
- line_count: number;
105
- mtime_ms: number;
106
- size_bytes: number;
107
- last_scanned_at: string;
108
- }
109
-
110
- export interface ActiveFeatureSession {
111
- feature_key: string;
112
- domain: string;
113
- touchpoints: string[];
114
- locked_at: string;
115
- }
116
-
117
- export interface SymbolRecord {
118
- id: number;
119
- file_id: number;
120
- name: string;
121
- kind: SymbolKind;
122
- signature: string;
123
- visibility: Visibility;
124
- line_start: number;
125
- line_end: number;
126
- line_count: number;
127
- nesting_depth: number;
128
- }
129
-
130
- export interface DependencyRecord {
131
- id: number;
132
- source_file_id: number;
133
- target_symbol_or_path: string;
134
- import_statement: string;
135
- line_number: number;
136
- is_external: boolean;
137
- }
138
-
139
- export interface ExtractedSymbol {
140
- name: string;
141
- kind: SymbolKind;
142
- signature: string;
143
- visibility: Visibility;
144
- line_start: number;
145
- line_end: number;
146
- line_count: number;
147
- nesting_depth?: number;
148
- }
149
-
150
- export interface ExtractedDependency {
151
- target: string;
152
- statement: string;
153
- line_number: number;
154
- is_external: boolean;
155
- }
156
-
157
- export interface ParsedFileAST {
158
- symbols: ExtractedSymbol[];
159
- dependencies: ExtractedDependency[];
160
- }
161
-
162
- export type BoundaryViolationRule =
163
- | "forbidden_dependency"
164
- | "disallowed_dependency"
165
- | "touchpoint_violation"
166
- | "unknown_feature";
167
-
168
- export interface BoundaryViolation {
169
- file: string;
170
- line: number;
171
- source_domain: string;
172
- target_domain: string;
173
- imported_target: string;
174
- rule: BoundaryViolationRule;
175
- message: string;
176
- }
177
-
178
- export interface DomainCatalogResponse {
179
- domain: string;
180
- root: string;
181
- allowed_dependencies: string[];
182
- forbidden_dependencies: string[];
183
- files: Array<{
184
- path: string;
185
- archetype: ArchetypeKind;
186
- symbols: Array<{
187
- name: string;
188
- kind: SymbolKind;
189
- properties?: string[];
190
- methods?: string[];
191
- signatures?: string[];
192
- }>;
193
- }>;
194
- }
195
-
196
- export interface ExecutionChainNode {
197
- stage:
198
- | "ingress"
199
- | "guard"
200
- | "validation"
201
- | "controller"
202
- | "orchestrator"
203
- | "use_case"
204
- | "domain"
205
- | "entity"
206
- | "side_effect"
207
- | "job"
208
- | "event"
209
- | "transaction"
210
- | "egress"
211
- | "repository"
212
- | string;
213
- symbol: string;
214
- file?: string;
215
- line?: number;
216
- description?: string;
217
- table?: string;
218
- schema_file?: string;
219
- columns_summary?: string;
220
- guards?: string[];
221
- mutations?: string[];
222
- emits?: string[];
223
- dispatches?: string[];
224
- transactions?: boolean;
225
- }
226
-
227
- export interface VerticalSliceRecord {
228
- id: number;
229
- domain_id: number | null;
230
- feature_key: string | null;
231
- http_method: string;
232
- route_uri: string;
233
- route_name: string | null;
234
- controller_class: string;
235
- action_name: string;
236
- controller_file: string | null;
237
- controller_line: number;
238
- architecture_style: string;
239
- entry_kind: string;
240
- execution_chain_json: string;
241
- created_at: string;
242
- }
243
-
244
- export interface VerticalSliceTraceResponse {
245
- query: string;
246
- found: boolean;
247
- confidence?: "exact" | "inferred";
248
- is_exact_match?: boolean;
249
- architecture_style?: string;
250
- entrypoint?: {
251
- method: string;
252
- uri: string;
253
- name?: string | null;
254
- controller: string;
255
- action: string;
256
- file?: string | null;
257
- line?: number;
258
- };
259
- chain?: ExecutionChainNode[];
260
- alternatives?: Array<{
261
- method: string;
262
- uri: string;
263
- controller: string;
264
- action: string;
265
- }>;
266
- message: string;
267
- }
268
-
269
- export interface GetSymbolArgs {
270
- symbol: string;
271
- domain?: string;
272
- include_dependencies?: boolean;
273
- }
274
-
275
- export interface SymbolExactRange {
276
- start_line: number;
277
- end_line: number;
278
- total_lines: number;
279
- }
280
-
281
- export interface GetSymbolDetailsResponse {
282
- symbol: string;
283
- kind: SymbolKind | string;
284
- file_path: string;
285
- domain?: string;
286
- exact_range: SymbolExactRange;
287
- signature: string;
288
- visibility?: Visibility | string;
289
- dependencies_injected: string[];
290
- outbound_calls: string[];
291
- sibling_methods?: string[];
292
- }
293
-
294
- export interface GetSymbolImpactArgs {
295
- symbol: string;
296
- }
297
-
298
- export interface InboundCaller {
299
- file: string;
300
- caller: string;
301
- line: number;
302
- kind?: string;
303
- domain?: string;
304
- }
305
-
306
- export interface GetSymbolImpactResponse {
307
- target_symbol: string;
308
- impact_summary: {
309
- total_dependents: number;
310
- risk_level: "low" | "medium" | "high";
311
- affected_files_count: number;
312
- };
313
- inbound_callers: InboundCaller[];
314
- }
315
-
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
+ | "struct"
26
+ | "method"
27
+ | "function"
28
+ | "type"
29
+ | "property"
30
+ | "constant"
31
+ | "variable"
32
+ | "component"
33
+ | "view";
34
+
35
+ export type Visibility = "public" | "protected" | "private";
36
+
37
+ export interface SeptumConfig {
38
+ version: string;
39
+ settings: {
40
+ enforcement: EnforcementMode;
41
+ db_path?: string;
42
+ ignore_patterns?: string[];
43
+ };
44
+ domains: Record<string, DomainConfig>;
45
+ features?: Record<string, FeatureConfig>;
46
+ }
47
+
48
+ export interface DomainConfig {
49
+ root: string;
50
+ allowed_dependencies?: string[];
51
+ forbidden_dependencies?: string[];
52
+ archetypes?: Record<string, string>;
53
+ description?: string;
54
+ }
55
+
56
+ export interface FeatureConfig {
57
+ domain: string;
58
+ description?: string;
59
+ allowed_touchpoints: string[];
60
+ reuse_symbols?: string[];
61
+ input_contract?: Record<string, unknown>;
62
+ output_contract?: Record<string, unknown>;
63
+ }
64
+
65
+ export interface FeatureContextResponse {
66
+ feature_key: string;
67
+ feature?: string;
68
+ domain: string;
69
+ description?: string;
70
+ allowed_touchpoints: string[];
71
+ reuse_symbols: Array<{
72
+ name: string;
73
+ kind: string;
74
+ signature?: string;
75
+ methods?: string[];
76
+ properties?: string[];
77
+ file_path?: string;
78
+ domain?: string;
79
+ }>;
80
+ input_contract: Record<string, unknown>;
81
+ output_contract: Record<string, unknown>;
82
+ governance_directives?: string[];
83
+ is_inferred?: boolean;
84
+ }
85
+
86
+ export interface RegisterFeatureArgs {
87
+ feature_key: string;
88
+ feature?: string;
89
+ domain: string;
90
+ description?: string;
91
+ allowed_touchpoints?: string[];
92
+ reuse_symbols?: string[];
93
+ input_contract?: Record<string, unknown>;
94
+ output_contract?: Record<string, unknown>;
95
+ workspace_path?: string;
96
+ }
97
+
98
+ export interface CheckBoundaryArgs {
99
+ file_path?: string;
100
+ file_paths?: string[];
101
+ proposed_imports?: string[];
102
+ feature_key?: string;
103
+ scope?: "file" | "all" | "staged" | "domain";
104
+ domain?: string;
105
+ workspace_path?: string;
106
+ }
107
+
108
+ export interface DomainRecord {
109
+ id: number;
110
+ name: string;
111
+ root_path: string;
112
+ allowed_deps_json: string;
113
+ forbidden_deps_json: string;
114
+ archetypes_json: string;
115
+ created_at: string;
116
+ updated_at: string;
117
+ }
118
+
119
+ export interface FileRecord {
120
+ id: number;
121
+ domain_id: number;
122
+ path: string;
123
+ archetype: ArchetypeKind;
124
+ content_hash: string;
125
+ line_count: number;
126
+ mtime_ms: number;
127
+ size_bytes: number;
128
+ last_scanned_at: string;
129
+ }
130
+
131
+ export interface ActiveFeatureSession {
132
+ feature_key: string;
133
+ domain: string;
134
+ touchpoints: string[];
135
+ locked_at: string;
136
+ }
137
+
138
+ export interface SymbolRecord {
139
+ id: number;
140
+ file_id: number;
141
+ name: string;
142
+ kind: SymbolKind;
143
+ signature: string;
144
+ visibility: Visibility;
145
+ line_start: number;
146
+ line_end: number;
147
+ line_count: number;
148
+ nesting_depth: number;
149
+ }
150
+
151
+ export interface DependencyRecord {
152
+ id: number;
153
+ source_file_id: number;
154
+ target_symbol_or_path: string;
155
+ import_statement: string;
156
+ line_number: number;
157
+ is_external: boolean;
158
+ }
159
+
160
+ export interface ExtractedSymbol {
161
+ name: string;
162
+ kind: SymbolKind;
163
+ signature: string;
164
+ visibility: Visibility;
165
+ line_start: number;
166
+ line_end: number;
167
+ line_count: number;
168
+ nesting_depth?: number;
169
+ }
170
+
171
+ export interface ExtractedDependency {
172
+ target: string;
173
+ statement: string;
174
+ line_number: number;
175
+ is_external: boolean;
176
+ imported_symbols?: string[];
177
+ }
178
+
179
+ export interface ParsedFileAST {
180
+ symbols: ExtractedSymbol[];
181
+ dependencies: ExtractedDependency[];
182
+ }
183
+
184
+ export type BoundaryViolationRule =
185
+ | "forbidden_dependency"
186
+ | "disallowed_dependency"
187
+ | "touchpoint_violation"
188
+ | "unknown_feature"
189
+ | "unmapped_domain"
190
+ | "circular_dependency";
191
+
192
+ export interface BoundaryViolation {
193
+ file: string;
194
+ line: number;
195
+ source_domain: string;
196
+ target_domain: string;
197
+ imported_target: string;
198
+ rule: BoundaryViolationRule;
199
+ message: string;
200
+ }
201
+
202
+ export interface FileConnectionsSummary {
203
+ imports_from: string[];
204
+ imported_by_count: number;
205
+ imported_by?: string[];
206
+ }
207
+
208
+ export interface DomainCatalogResponse {
209
+ domain: string;
210
+ root: string;
211
+ detail_level?: "compact" | "full";
212
+ total_files?: number;
213
+ showing_files?: number;
214
+ allowed_dependencies: string[];
215
+ forbidden_dependencies: string[];
216
+ files: Array<{
217
+ path: string;
218
+ archetype: ArchetypeKind;
219
+ line_count?: number;
220
+ connections?: FileConnectionsSummary;
221
+ symbols: Array<{
222
+ name: string;
223
+ kind: SymbolKind;
224
+ line_span?: string;
225
+ methods_count?: number;
226
+ properties_count?: number;
227
+ properties?: string[];
228
+ methods?: string[];
229
+ signatures?: string[];
230
+ }>;
231
+ }>;
232
+ agent_hint?: string;
233
+ }
234
+
235
+ export interface ExecutionChainNode {
236
+ stage:
237
+ | "ingress"
238
+ | "guard"
239
+ | "validation"
240
+ | "controller"
241
+ | "action"
242
+ | "service"
243
+ | "orchestrator"
244
+ | "use_case"
245
+ | "domain"
246
+ | "entity"
247
+ | "side_effect"
248
+ | "job"
249
+ | "event"
250
+ | "transaction"
251
+ | "egress"
252
+ | "repository"
253
+ | string;
254
+ symbol: string;
255
+ file?: string;
256
+ line?: number;
257
+ description?: string;
258
+ table?: string;
259
+ schema_file?: string;
260
+ columns_summary?: string;
261
+ guards?: string[];
262
+ mutations?: string[];
263
+ emits?: string[];
264
+ dispatches?: string[];
265
+ transactions?: boolean;
266
+ payload_props?: string[];
267
+ }
268
+
269
+ export interface VerticalSliceRecord {
270
+ id: number;
271
+ domain_id: number | null;
272
+ feature_key: string | null;
273
+ http_method: string;
274
+ route_uri: string;
275
+ route_name: string | null;
276
+ controller_class: string;
277
+ action_name: string;
278
+ controller_file: string | null;
279
+ controller_line: number;
280
+ architecture_style: string;
281
+ entry_kind: string;
282
+ execution_chain_json: string;
283
+ created_at: string;
284
+ }
285
+
286
+ export interface VerticalSliceTraceResponse {
287
+ query: string;
288
+ found: boolean;
289
+ confidence?: "exact" | "inferred";
290
+ is_exact_match?: boolean;
291
+ architecture_style?: string;
292
+ max_depth_applied?: number;
293
+ entrypoint?: {
294
+ method: string;
295
+ uri: string;
296
+ name?: string | null;
297
+ controller: string;
298
+ action: string;
299
+ file?: string | null;
300
+ line?: number;
301
+ };
302
+ chain?: ExecutionChainNode[];
303
+ slice?: ExecutionChainNode[];
304
+ alternatives?: Array<{
305
+ method: string;
306
+ uri: string;
307
+ controller: string;
308
+ action: string;
309
+ }>;
310
+ message: string;
311
+ }
312
+
313
+ export interface GetSymbolArgs {
314
+ symbol: string;
315
+ query?: string;
316
+ domain?: string;
317
+ include_dependencies?: boolean;
318
+ workspace_path?: string;
319
+ }
320
+
321
+ export interface SymbolExactRange {
322
+ start_line: number;
323
+ end_line: number;
324
+ total_lines: number;
325
+ }
326
+
327
+ export interface GetSymbolDetailsResponse {
328
+ symbol: string;
329
+ kind: SymbolKind | string;
330
+ file_path: string;
331
+ domain?: string;
332
+ exact_range: SymbolExactRange;
333
+ signature: string;
334
+ visibility?: Visibility | string;
335
+ dependencies_injected: string[];
336
+ outbound_calls: string[];
337
+ sibling_methods?: string[];
338
+ connected_files?: FileConnectionsSummary;
339
+ }
340
+
341
+ export interface GetSymbolImpactArgs {
342
+ symbol: string;
343
+ query?: string;
344
+ workspace_path?: string;
345
+ }
346
+
347
+ export interface InboundCaller {
348
+ file: string;
349
+ caller: string;
350
+ line: number;
351
+ kind?: string;
352
+ domain?: string;
353
+ }
354
+
355
+ export interface GetSymbolImpactResponse {
356
+ target_symbol: string;
357
+ found_in_index: boolean;
358
+ warning?: string;
359
+ impact_summary: {
360
+ total_dependents: number;
361
+ risk_level: "low" | "medium" | "high";
362
+ affected_files_count: number;
363
+ };
364
+ inbound_callers: InboundCaller[];
365
+ }
366
+