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,315 +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
- | "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
+ | "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
+
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
- import packageJson from "../package.json" with { type: "json" };
2
-
3
- export const SEPTUM_VERSION: string = packageJson.version;
1
+ import packageJson from "../package.json" with { type: "json" };
2
+
3
+ export const SEPTUM_VERSION: string = packageJson.version;