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.
- package/LICENSE +21 -21
- package/README.md +105 -102
- package/bin/septum.ts +4 -4
- package/package.json +63 -63
- package/src/cli/commands/check.ts +161 -161
- package/src/cli/commands/hook.ts +188 -188
- package/src/cli/commands/ingest.ts +29 -29
- package/src/cli/commands/init.ts +211 -211
- package/src/cli/commands/locate.ts +61 -61
- package/src/cli/commands/query.ts +64 -64
- package/src/cli/commands/serve.ts +5 -5
- package/src/cli/commands/slice.ts +48 -90
- package/src/cli/commands/sync.ts +31 -31
- package/src/cli/commands/topology.ts +119 -0
- package/src/cli/index.ts +210 -199
- package/src/cli/templates/hooks.ts +75 -75
- package/src/cli/templates/rules.ts +38 -38
- package/src/cli/templates/skill.ts +69 -69
- package/src/core/boundary/evaluator.ts +232 -210
- package/src/core/config/loader.ts +97 -97
- package/src/core/config/schema.ts +39 -39
- package/src/core/database/client.ts +44 -44
- package/src/core/database/repositories/dependency.repository.ts +366 -349
- package/src/core/database/repositories/domain.repository.ts +218 -198
- package/src/core/database/repositories/environment.repository.ts +207 -0
- package/src/core/database/repositories/file.repository.ts +116 -106
- package/src/core/database/repositories/meta.repository.ts +33 -33
- package/src/core/database/repositories/symbol.repository.ts +443 -424
- package/src/core/database/repository.ts +264 -255
- package/src/core/database/schema.ts +34 -1
- package/src/core/discovery/topology-detector.ts +486 -486
- package/src/core/ingestion/hasher.ts +5 -5
- package/src/core/ingestion/pipeline.ts +584 -535
- package/src/core/parser/behavioral-analyzer.ts +119 -0
- package/src/core/parser/boundary-tracker.ts +288 -128
- package/src/core/parser/extractors/base.ts +62 -61
- package/src/core/parser/extractors/frontend.ts +194 -194
- package/src/core/parser/extractors/go.ts +229 -176
- package/src/core/parser/extractors/laravel-semantic.ts +1039 -585
- package/src/core/parser/extractors/mcp-cli-semantic.ts +199 -199
- package/src/core/parser/extractors/nestjs-semantic.ts +119 -119
- package/src/core/parser/extractors/php.ts +153 -149
- package/src/core/parser/extractors/python.ts +228 -226
- package/src/core/parser/extractors/registry.ts +70 -70
- package/src/core/parser/extractors/semantic-extractor.interface.ts +21 -21
- package/src/core/parser/extractors/typescript.ts +181 -177
- package/src/core/parser/schema/providers/laravel-migration-provider.ts +215 -0
- package/src/core/parser/schema/providers/prisma-schema-provider.ts +89 -0
- package/src/core/parser/schema/schema-provider-registry.ts +43 -0
- package/src/core/parser/schema/schema-provider.interface.ts +33 -0
- package/src/core/parser/tree-sitter.ts +41 -41
- package/src/core/resolver/call-graph-tracer.ts +666 -668
- package/src/core/resolver/module-resolver.ts +408 -342
- package/src/core/resolver/symbol-locator.ts +543 -543
- package/src/core/resolver/vertical-slice-tracer.ts +301 -252
- package/src/core/session/session-manager.ts +56 -56
- package/src/core/telemetry/telemetry.ts +86 -86
- package/src/core/topology/environment-detector.ts +860 -0
- package/src/core/topology/types.ts +83 -0
- package/src/index.ts +21 -18
- package/src/mcp/schemas.ts +578 -238
- package/src/mcp/server.ts +875 -656
- package/src/mcp/tools/check-boundary.ts +171 -152
- package/src/mcp/tools/get-domain-catalog.ts +145 -121
- package/src/mcp/tools/get-environment-topology.ts +141 -0
- package/src/mcp/tools/get-feature-context.ts +212 -116
- package/src/mcp/tools/get-symbol-hotspots.ts +60 -49
- package/src/mcp/tools/get-symbol-impact.ts +28 -26
- package/src/mcp/tools/get-symbol.ts +65 -63
- package/src/mcp/tools/locate-symbol.ts +171 -190
- package/src/mcp/tools/register-domain.ts +68 -64
- package/src/mcp/tools/register-feature.ts +100 -0
- package/src/mcp/tools/trace-vertical-slice.ts +74 -103
- package/src/types/index.ts +335 -299
|
@@ -1,255 +1,264 @@
|
|
|
1
|
-
import type { Database } from "bun:sqlite";
|
|
2
|
-
import type {
|
|
3
|
-
ArchetypeKind,
|
|
4
|
-
DomainCatalogResponse,
|
|
5
|
-
DomainConfig,
|
|
6
|
-
DomainRecord,
|
|
7
|
-
ExtractedDependency,
|
|
8
|
-
ExtractedSymbol,
|
|
9
|
-
FileRecord,
|
|
10
|
-
GetSymbolDetailsResponse,
|
|
11
|
-
GetSymbolImpactResponse,
|
|
12
|
-
InboundCaller,
|
|
13
|
-
SymbolKind,
|
|
14
|
-
SymbolRecord,
|
|
15
|
-
VerticalSliceRecord,
|
|
16
|
-
} from "../../types/index.ts";
|
|
17
|
-
|
|
18
|
-
export type {
|
|
19
|
-
ArchetypeKind,
|
|
20
|
-
DomainCatalogResponse,
|
|
21
|
-
DomainConfig,
|
|
22
|
-
DomainRecord,
|
|
23
|
-
ExtractedDependency,
|
|
24
|
-
ExtractedSymbol,
|
|
25
|
-
FileRecord,
|
|
26
|
-
GetSymbolDetailsResponse,
|
|
27
|
-
GetSymbolImpactResponse,
|
|
28
|
-
InboundCaller,
|
|
29
|
-
SymbolKind,
|
|
30
|
-
SymbolRecord,
|
|
31
|
-
VerticalSliceRecord,
|
|
32
|
-
} from "../../types/index.ts";
|
|
33
|
-
import { DependencyRepository } from "./repositories/dependency.repository.ts";
|
|
34
|
-
import { DomainRepository } from "./repositories/domain.repository.ts";
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
public readonly
|
|
44
|
-
public readonly
|
|
45
|
-
public readonly
|
|
46
|
-
public readonly
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
):
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return this.dependencies.
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
this.
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import type {
|
|
3
|
+
ArchetypeKind,
|
|
4
|
+
DomainCatalogResponse,
|
|
5
|
+
DomainConfig,
|
|
6
|
+
DomainRecord,
|
|
7
|
+
ExtractedDependency,
|
|
8
|
+
ExtractedSymbol,
|
|
9
|
+
FileRecord,
|
|
10
|
+
GetSymbolDetailsResponse,
|
|
11
|
+
GetSymbolImpactResponse,
|
|
12
|
+
InboundCaller,
|
|
13
|
+
SymbolKind,
|
|
14
|
+
SymbolRecord,
|
|
15
|
+
VerticalSliceRecord,
|
|
16
|
+
} from "../../types/index.ts";
|
|
17
|
+
|
|
18
|
+
export type {
|
|
19
|
+
ArchetypeKind,
|
|
20
|
+
DomainCatalogResponse,
|
|
21
|
+
DomainConfig,
|
|
22
|
+
DomainRecord,
|
|
23
|
+
ExtractedDependency,
|
|
24
|
+
ExtractedSymbol,
|
|
25
|
+
FileRecord,
|
|
26
|
+
GetSymbolDetailsResponse,
|
|
27
|
+
GetSymbolImpactResponse,
|
|
28
|
+
InboundCaller,
|
|
29
|
+
SymbolKind,
|
|
30
|
+
SymbolRecord,
|
|
31
|
+
VerticalSliceRecord,
|
|
32
|
+
} from "../../types/index.ts";
|
|
33
|
+
import { DependencyRepository } from "./repositories/dependency.repository.ts";
|
|
34
|
+
import { DomainRepository } from "./repositories/domain.repository.ts";
|
|
35
|
+
import { EnvironmentRepository } from "./repositories/environment.repository.ts";
|
|
36
|
+
import { FileRepository } from "./repositories/file.repository.ts";
|
|
37
|
+
import { MetaRepository } from "./repositories/meta.repository.ts";
|
|
38
|
+
import { SymbolRepository } from "./repositories/symbol.repository.ts";
|
|
39
|
+
|
|
40
|
+
export type DatabaseRepository = SeptumRepository;
|
|
41
|
+
|
|
42
|
+
export class SeptumRepository {
|
|
43
|
+
public readonly domains: DomainRepository;
|
|
44
|
+
public readonly files: FileRepository;
|
|
45
|
+
public readonly symbols: SymbolRepository;
|
|
46
|
+
public readonly dependencies: DependencyRepository;
|
|
47
|
+
public readonly meta: MetaRepository;
|
|
48
|
+
public readonly environment: EnvironmentRepository;
|
|
49
|
+
|
|
50
|
+
constructor(private db: Database) {
|
|
51
|
+
this.domains = new DomainRepository(db);
|
|
52
|
+
this.files = new FileRepository(db);
|
|
53
|
+
this.symbols = new SymbolRepository(db);
|
|
54
|
+
this.dependencies = new DependencyRepository(db);
|
|
55
|
+
this.meta = new MetaRepository(db);
|
|
56
|
+
this.environment = new EnvironmentRepository(db);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public runInTransaction<T>(fn: () => T): T {
|
|
60
|
+
return this.db.transaction(fn)();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// --- Domain Methods ---
|
|
64
|
+
public upsertDomain(name: string, config: DomainConfig): number {
|
|
65
|
+
return this.domains.upsertDomain(name, config);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public getDomainByName(name: string): DomainRecord | null {
|
|
69
|
+
return this.domains.getDomainByName(name);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public getAllDomains(): DomainRecord[] {
|
|
73
|
+
return this.domains.getAllDomains();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// --- File Methods ---
|
|
77
|
+
public getFileByPath(path: string): FileRecord | null {
|
|
78
|
+
return this.files.getFileByPath(path);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public countFiles(): number {
|
|
82
|
+
return this.files.countFiles();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public getFilesByDomain(domainId: number): FileRecord[] {
|
|
86
|
+
return this.files.getFilesByDomain(domainId);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public getAllFiles(): FileRecord[] {
|
|
90
|
+
return this.files.getAllFiles();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public upsertFile(
|
|
94
|
+
domainId: number,
|
|
95
|
+
path: string,
|
|
96
|
+
archetype: ArchetypeKind,
|
|
97
|
+
contentHash: string,
|
|
98
|
+
lineCount: number,
|
|
99
|
+
mtimeMs: number = 0,
|
|
100
|
+
sizeBytes: number = 0
|
|
101
|
+
): number {
|
|
102
|
+
return this.files.upsertFile(
|
|
103
|
+
domainId,
|
|
104
|
+
path,
|
|
105
|
+
archetype,
|
|
106
|
+
contentHash,
|
|
107
|
+
lineCount,
|
|
108
|
+
mtimeMs,
|
|
109
|
+
sizeBytes
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
public updateFileMetadataOnly(id: number, mtimeMs: number, sizeBytes: number): void {
|
|
114
|
+
this.files.updateFileMetadataOnly(id, mtimeMs, sizeBytes);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public deleteFilesNotInPaths(domainId: number, validPaths: string[]): number {
|
|
118
|
+
return this.files.deleteFilesNotInPaths(domainId, validPaths);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public deleteFile(path: string): void {
|
|
122
|
+
this.files.deleteFile(path);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public getDomainCatalog(
|
|
126
|
+
domainName: string,
|
|
127
|
+
archetypeFilter?: string
|
|
128
|
+
): DomainCatalogResponse | null {
|
|
129
|
+
return this.domains.getDomainCatalog(domainName, archetypeFilter);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// --- Symbol Methods ---
|
|
133
|
+
public replaceFileSymbols(fileId: number, symbols: ExtractedSymbol[]): void {
|
|
134
|
+
this.symbols.replaceFileSymbols(fileId, symbols);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
public getSymbolsByFileId(fileId: number): SymbolRecord[] {
|
|
138
|
+
return this.symbols.getSymbolsByFileId(fileId);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
public findSymbolsByName(name: string): Array<SymbolRecord & { file_path: string }> {
|
|
142
|
+
return this.symbols.findSymbolsByName(name);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
public findContainers(
|
|
146
|
+
containerName: string
|
|
147
|
+
): Array<{ file: FileRecord; symbol?: SymbolRecord }> {
|
|
148
|
+
return this.symbols.findContainers(containerName);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
public getAllSymbolsWithFiles(): Array<SymbolRecord & { file_path: string }> {
|
|
152
|
+
return this.symbols.getAllSymbolsWithFiles();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// --- Dependency & Slice Methods ---
|
|
156
|
+
public replaceFileDependencies(fileId: number, deps: ExtractedDependency[]): void {
|
|
157
|
+
this.dependencies.replaceFileDependencies(fileId, deps);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public upsertVerticalSlice(
|
|
161
|
+
slice: Omit<VerticalSliceRecord, "id" | "created_at">
|
|
162
|
+
): void {
|
|
163
|
+
this.dependencies.upsertVerticalSlice(slice);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
public findVerticalSlices(searchTerm: string): VerticalSliceRecord[] {
|
|
167
|
+
return this.dependencies.findVerticalSlices(searchTerm);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public getAllVerticalSlices(): VerticalSliceRecord[] {
|
|
171
|
+
return this.dependencies.getAllVerticalSlices();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public clearVerticalSlices(domainId?: number): void {
|
|
175
|
+
this.dependencies.clearVerticalSlices(domainId);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
public getAllDependenciesWithDomains(): Array<{
|
|
179
|
+
source_file: string;
|
|
180
|
+
source_domain: string;
|
|
181
|
+
line_number: number;
|
|
182
|
+
target: string;
|
|
183
|
+
statement: string;
|
|
184
|
+
is_external: boolean;
|
|
185
|
+
}> {
|
|
186
|
+
return this.dependencies.getAllDependenciesWithDomains();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
public findSymbolWithDomain(
|
|
190
|
+
symbolName: string
|
|
191
|
+
): {
|
|
192
|
+
symbol_name: string;
|
|
193
|
+
kind: string;
|
|
194
|
+
file_path: string;
|
|
195
|
+
domain_name: string;
|
|
196
|
+
} | null {
|
|
197
|
+
return this.symbols.findSymbolWithDomain(symbolName);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public findSymbolWithMembers(symbolName: string): {
|
|
201
|
+
symbol_name: string;
|
|
202
|
+
kind: string;
|
|
203
|
+
signature: string;
|
|
204
|
+
file_path: string;
|
|
205
|
+
domain_name: string;
|
|
206
|
+
methods: string[];
|
|
207
|
+
properties: string[];
|
|
208
|
+
} | null {
|
|
209
|
+
return this.symbols.findSymbolWithMembers(symbolName);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
public getFileWithDomain(filePath: string): {
|
|
213
|
+
file_id: number;
|
|
214
|
+
file_path: string;
|
|
215
|
+
domain_name: string;
|
|
216
|
+
} | null {
|
|
217
|
+
return this.symbols.getFileWithDomain(filePath);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
public getHotspotSymbols(options: {
|
|
221
|
+
minLines?: number;
|
|
222
|
+
minNesting?: number;
|
|
223
|
+
kind?: SymbolKind;
|
|
224
|
+
domain?: string;
|
|
225
|
+
limit?: number;
|
|
226
|
+
sortBy?: "lines" | "nesting" | "risk_score";
|
|
227
|
+
} = {}): Array<SymbolRecord & { file_path: string; domain_name: string; risk_score: number }> {
|
|
228
|
+
return this.symbols.getHotspotSymbols(options);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
public getSymbolDetails(
|
|
232
|
+
symbolQuery: string,
|
|
233
|
+
options: { domain?: string; includeDependencies?: boolean } = {}
|
|
234
|
+
): GetSymbolDetailsResponse | null {
|
|
235
|
+
return this.symbols.getSymbolDetails(symbolQuery, options);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
public getSymbolImpact(symbolName: string): GetSymbolImpactResponse {
|
|
239
|
+
return this.dependencies.getSymbolImpact(symbolName);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
public getFileInboundImpact(filePath: string): {
|
|
243
|
+
direct_dependents_count: number;
|
|
244
|
+
top_consumers: string[];
|
|
245
|
+
symbols_count: number;
|
|
246
|
+
risk_level: "low" | "medium" | "high";
|
|
247
|
+
} {
|
|
248
|
+
return this.dependencies.getFileInboundImpact(filePath);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// --- Metadata Methods ---
|
|
252
|
+
public getMeta(key: string): string | null {
|
|
253
|
+
return this.meta.getMeta(key);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
public setMeta(key: string, value: string): void {
|
|
257
|
+
this.meta.setMeta(key, value);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
public getAllMeta(): Record<string, string> {
|
|
261
|
+
return this.meta.getAllMeta();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
2
|
|
|
3
|
-
export const CURRENT_SCHEMA_VERSION =
|
|
3
|
+
export const CURRENT_SCHEMA_VERSION = 4;
|
|
4
4
|
|
|
5
5
|
export const TABLE_STATEMENTS = [
|
|
6
6
|
`CREATE TABLE IF NOT EXISTS domains (
|
|
@@ -37,6 +37,7 @@ export const TABLE_STATEMENTS = [
|
|
|
37
37
|
line_start INTEGER NOT NULL DEFAULT 0,
|
|
38
38
|
line_end INTEGER NOT NULL DEFAULT 0,
|
|
39
39
|
line_count INTEGER NOT NULL DEFAULT 1,
|
|
40
|
+
nesting_depth INTEGER NOT NULL DEFAULT 1,
|
|
40
41
|
FOREIGN KEY (file_id) REFERENCES files(id) ON DELETE CASCADE
|
|
41
42
|
);`,
|
|
42
43
|
|
|
@@ -73,6 +74,32 @@ export const TABLE_STATEMENTS = [
|
|
|
73
74
|
value TEXT NOT NULL,
|
|
74
75
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
75
76
|
);`,
|
|
77
|
+
|
|
78
|
+
`CREATE TABLE IF NOT EXISTS environment_topology (
|
|
79
|
+
layer TEXT PRIMARY KEY,
|
|
80
|
+
platform TEXT,
|
|
81
|
+
status TEXT NOT NULL,
|
|
82
|
+
detected_from_json TEXT NOT NULL DEFAULT '[]',
|
|
83
|
+
constraints_json TEXT NOT NULL DEFAULT '[]',
|
|
84
|
+
unresolved_inquiry TEXT,
|
|
85
|
+
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
86
|
+
);`,
|
|
87
|
+
|
|
88
|
+
`CREATE TABLE IF NOT EXISTS environment_nodes (
|
|
89
|
+
id TEXT PRIMARY KEY,
|
|
90
|
+
layer TEXT NOT NULL,
|
|
91
|
+
name TEXT NOT NULL,
|
|
92
|
+
platform TEXT NOT NULL,
|
|
93
|
+
canonical_tag TEXT NOT NULL DEFAULT 'unspecified',
|
|
94
|
+
domain_or_ip TEXT,
|
|
95
|
+
role TEXT,
|
|
96
|
+
status TEXT NOT NULL,
|
|
97
|
+
detected_from_json TEXT NOT NULL DEFAULT '[]',
|
|
98
|
+
constraints_json TEXT NOT NULL DEFAULT '[]',
|
|
99
|
+
connected_to_json TEXT NOT NULL DEFAULT '[]',
|
|
100
|
+
unresolved_inquiry TEXT,
|
|
101
|
+
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
102
|
+
);`,
|
|
76
103
|
];
|
|
77
104
|
|
|
78
105
|
export const INDEX_STATEMENTS = [
|
|
@@ -83,14 +110,20 @@ export const INDEX_STATEMENTS = [
|
|
|
83
110
|
"CREATE INDEX IF NOT EXISTS idx_symbols_name ON symbols(name);",
|
|
84
111
|
"CREATE INDEX IF NOT EXISTS idx_symbols_kind ON symbols(kind);",
|
|
85
112
|
"CREATE INDEX IF NOT EXISTS idx_symbols_line_count ON symbols(kind, line_count DESC);",
|
|
113
|
+
"CREATE INDEX IF NOT EXISTS idx_symbols_nesting_depth ON symbols(nesting_depth DESC);",
|
|
86
114
|
"CREATE INDEX IF NOT EXISTS idx_dependencies_source ON dependencies(source_file_id);",
|
|
87
115
|
"CREATE INDEX IF NOT EXISTS idx_dependencies_target ON dependencies(target_symbol_or_path);",
|
|
88
116
|
"CREATE INDEX IF NOT EXISTS idx_slices_route_uri ON vertical_slices(route_uri);",
|
|
89
117
|
"CREATE INDEX IF NOT EXISTS idx_slices_route_name ON vertical_slices(route_name);",
|
|
90
118
|
"CREATE INDEX IF NOT EXISTS idx_slices_controller ON vertical_slices(controller_class, action_name);",
|
|
119
|
+
"CREATE INDEX IF NOT EXISTS idx_env_topology_status ON environment_topology(status);",
|
|
120
|
+
"CREATE INDEX IF NOT EXISTS idx_env_nodes_layer ON environment_nodes(layer);",
|
|
121
|
+
"CREATE INDEX IF NOT EXISTS idx_env_nodes_status ON environment_nodes(status);",
|
|
91
122
|
];
|
|
92
123
|
|
|
93
124
|
const DROP_ALL_TABLES = `
|
|
125
|
+
DROP TABLE IF EXISTS environment_nodes;
|
|
126
|
+
DROP TABLE IF EXISTS environment_topology;
|
|
94
127
|
DROP TABLE IF EXISTS repo_meta;
|
|
95
128
|
DROP TABLE IF EXISTS vertical_slices;
|
|
96
129
|
DROP TABLE IF EXISTS dependencies;
|