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.
- package/LICENSE +21 -21
- package/README.md +105 -105
- 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 +216 -188
- package/src/cli/commands/ingest.ts +29 -29
- package/src/cli/commands/init.ts +213 -211
- package/src/cli/commands/locate.ts +61 -61
- package/src/cli/commands/query.ts +104 -64
- package/src/cli/commands/serve.ts +5 -5
- package/src/cli/commands/slice.ts +50 -48
- package/src/cli/commands/sync.ts +31 -31
- package/src/cli/index.ts +220 -210
- package/src/cli/templates/hooks.ts +75 -75
- package/src/cli/templates/rules.ts +50 -38
- package/src/cli/templates/skill.ts +65 -69
- package/src/core/boundary/evaluator.ts +429 -210
- package/src/core/config/loader.ts +117 -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 +552 -349
- package/src/core/database/repositories/domain.repository.ts +275 -198
- package/src/core/database/repositories/file.repository.ts +117 -106
- package/src/core/database/repositories/meta.repository.ts +33 -33
- package/src/core/database/repositories/symbol.repository.ts +482 -443
- package/src/core/database/repository.ts +281 -260
- package/src/core/database/schema.ts +154 -153
- package/src/core/discovery/topology-detector.ts +486 -486
- package/src/core/ingestion/hasher.ts +5 -5
- package/src/core/ingestion/pipeline.ts +606 -535
- package/src/core/parser/boundary-tracker.ts +433 -288
- package/src/core/parser/extractors/base.ts +62 -62
- package/src/core/parser/extractors/blade.ts +158 -158
- package/src/core/parser/extractors/frontend.ts +147 -194
- package/src/core/parser/extractors/go.ts +408 -180
- package/src/core/parser/extractors/laravel-semantic.ts +1045 -901
- package/src/core/parser/extractors/mcp-cli-semantic.ts +328 -199
- package/src/core/parser/extractors/nestjs-semantic.ts +134 -119
- package/src/core/parser/extractors/php.ts +415 -153
- package/src/core/parser/extractors/python.ts +460 -228
- 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 +668 -181
- package/src/core/parser/tree-sitter.ts +41 -41
- package/src/core/parser/wasm-loader.ts +271 -0
- package/src/core/resolver/call-graph-tracer.ts +698 -668
- package/src/core/resolver/module-resolver.ts +479 -342
- package/src/core/resolver/path-resolver.ts +147 -147
- package/src/core/resolver/symbol-locator.ts +543 -543
- package/src/core/resolver/vertical-slice-tracer.ts +323 -285
- package/src/core/session/session-manager.ts +56 -56
- package/src/core/telemetry/telemetry.ts +86 -86
- package/src/core/topology/environment-detector.ts +109 -6
- package/src/index.ts +21 -21
- package/src/mcp/schemas.ts +695 -286
- package/src/mcp/server.ts +927 -716
- package/src/mcp/tools/check-boundary.ts +307 -152
- package/src/mcp/tools/get-domain-catalog.ts +155 -121
- package/src/mcp/tools/get-environment-topology.ts +3 -6
- package/src/mcp/tools/get-feature-context.ts +227 -116
- package/src/mcp/tools/get-symbol-hotspots.ts +54 -59
- 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 +169 -190
- package/src/mcp/tools/register-domain.ts +59 -64
- package/src/mcp/tools/register-feature.ts +91 -0
- package/src/mcp/tools/trace-vertical-slice.ts +74 -48
- package/src/types/index.ts +366 -315
- package/src/version.ts +3 -3
|
@@ -1,64 +1,104 @@
|
|
|
1
|
-
import { ConfigLoader } from "../../core/config/loader.ts";
|
|
2
|
-
import { SeptumDatabase } from "../../core/database/client.ts";
|
|
3
|
-
import { SeptumRepository } from "../../core/database/repository.ts";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
console.log(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
1
|
+
import { ConfigLoader } from "../../core/config/loader.ts";
|
|
2
|
+
import { SeptumDatabase } from "../../core/database/client.ts";
|
|
3
|
+
import { SeptumRepository } from "../../core/database/repository.ts";
|
|
4
|
+
import type { DomainCatalogResponse } from "../../types/index.ts";
|
|
5
|
+
|
|
6
|
+
export interface QueryCommandOptions {
|
|
7
|
+
json?: boolean;
|
|
8
|
+
full?: boolean;
|
|
9
|
+
file?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function handleQueryCommand(
|
|
13
|
+
domainName?: string,
|
|
14
|
+
archetype?: string,
|
|
15
|
+
jsonOutputOrOptions?: boolean | QueryCommandOptions,
|
|
16
|
+
extraOptions?: QueryCommandOptions
|
|
17
|
+
): Promise<void> {
|
|
18
|
+
const options: QueryCommandOptions =
|
|
19
|
+
typeof jsonOutputOrOptions === "boolean"
|
|
20
|
+
? { json: jsonOutputOrOptions, ...extraOptions }
|
|
21
|
+
: { ...jsonOutputOrOptions, ...extraOptions };
|
|
22
|
+
|
|
23
|
+
const jsonOutput = Boolean(options.json);
|
|
24
|
+
const detailLevel: "compact" | "full" = options.full ? "full" : "compact";
|
|
25
|
+
const fileFilter = options.file;
|
|
26
|
+
|
|
27
|
+
const config = ConfigLoader.load();
|
|
28
|
+
const db = new SeptumDatabase(config.settings.db_path);
|
|
29
|
+
const repo = new SeptumRepository(db.raw);
|
|
30
|
+
|
|
31
|
+
if (!domainName) {
|
|
32
|
+
const allDomains = repo.getAllDomains();
|
|
33
|
+
if (allDomains.length === 0) {
|
|
34
|
+
console.log("[Septum] No domains found in database. Run 'septum ingest' first.");
|
|
35
|
+
db.close();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.log("=== Registered Domains in Septum ===");
|
|
40
|
+
for (const d of allDomains) {
|
|
41
|
+
console.log(`- ${d.name} (root: ${d.root_path})`);
|
|
42
|
+
}
|
|
43
|
+
db.close();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const catalog: DomainCatalogResponse | null = (repo.getDomainCatalog as any)(
|
|
48
|
+
domainName,
|
|
49
|
+
archetype,
|
|
50
|
+
{ detailLevel, fileFilter }
|
|
51
|
+
);
|
|
52
|
+
if (!catalog) {
|
|
53
|
+
console.error(`[Septum Error] Domain '${domainName}' not found in database. Run 'septum ingest' first.`);
|
|
54
|
+
db.close();
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (jsonOutput) {
|
|
59
|
+
console.log(JSON.stringify(catalog, null, 2));
|
|
60
|
+
} else {
|
|
61
|
+
console.log(`=================================================`);
|
|
62
|
+
console.log(` Domain: ${catalog.domain.toUpperCase()} (Root: ${catalog.root})`);
|
|
63
|
+
console.log(`=================================================`);
|
|
64
|
+
console.log(` Detail Level: ${catalog.detail_level ?? detailLevel}`);
|
|
65
|
+
console.log(` Allowed Dependencies: [${catalog.allowed_dependencies.join(", ")}]`);
|
|
66
|
+
console.log(` Forbidden Dependencies: [${catalog.forbidden_dependencies.join(", ")}]`);
|
|
67
|
+
console.log(` Total Files Cataloged: ${catalog.total_files ?? catalog.files.length} (Showing: ${catalog.showing_files ?? catalog.files.length})`);
|
|
68
|
+
console.log(`-------------------------------------------------`);
|
|
69
|
+
|
|
70
|
+
for (const file of catalog.files) {
|
|
71
|
+
const lineInfo = file.line_count ? `, ${file.line_count} lines` : "";
|
|
72
|
+
console.log(`\n File: ${file.path} [archetype: ${file.archetype}${lineInfo}]`);
|
|
73
|
+
if (file.connections) {
|
|
74
|
+
const importsStr = file.connections.imports_from.length > 0 ? file.connections.imports_from.join(", ") : "none";
|
|
75
|
+
console.log(` ↔ Connections: imports [${importsStr}] | imported by ${file.connections.imported_by_count} file(s)`);
|
|
76
|
+
}
|
|
77
|
+
for (const sym of file.symbols) {
|
|
78
|
+
const spanStr = sym.line_span ? ` (L${sym.line_span})` : "";
|
|
79
|
+
const countsStr =
|
|
80
|
+
sym.methods_count !== undefined
|
|
81
|
+
? ` [${sym.methods_count} methods${sym.properties_count ? `, ${sym.properties_count} props` : ""}]`
|
|
82
|
+
: "";
|
|
83
|
+
console.log(` • ${sym.kind.toUpperCase()} ${sym.name}${spanStr}${countsStr}`);
|
|
84
|
+
if (sym.methods && sym.methods.length > 0) {
|
|
85
|
+
for (const m of sym.methods) {
|
|
86
|
+
console.log(` - ${m}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (sym.signatures && sym.signatures.length > 0) {
|
|
90
|
+
for (const s of sym.signatures) {
|
|
91
|
+
console.log(` - ${s}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (catalog.agent_hint) {
|
|
97
|
+
console.log(`\n 💡 ${catalog.agent_hint}`);
|
|
98
|
+
}
|
|
99
|
+
console.log(`\n=================================================`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
db.close();
|
|
103
|
+
}
|
|
104
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { runMCPServer } from "../../mcp/server.ts";
|
|
2
|
-
|
|
3
|
-
export async function handleServeCommand(): Promise<void> {
|
|
4
|
-
await runMCPServer();
|
|
5
|
-
}
|
|
1
|
+
import { runMCPServer } from "../../mcp/server.ts";
|
|
2
|
+
|
|
3
|
+
export async function handleServeCommand(): Promise<void> {
|
|
4
|
+
await runMCPServer();
|
|
5
|
+
}
|
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
import { ConfigLoader } from "../../core/config/loader.ts";
|
|
2
|
-
import { SeptumDatabase } from "../../core/database/client.ts";
|
|
3
|
-
import { SeptumRepository } from "../../core/database/repository.ts";
|
|
4
|
-
import { VerticalSliceTracer } from "../../core/resolver/vertical-slice-tracer.ts";
|
|
5
|
-
|
|
6
|
-
export async function handleSliceCommand(
|
|
7
|
-
query: string,
|
|
8
|
-
options?: { json?: boolean }
|
|
9
|
-
): Promise<void> {
|
|
10
|
-
const config = ConfigLoader.load();
|
|
11
|
-
const db = new SeptumDatabase(config.settings.db_path);
|
|
12
|
-
const repo = new SeptumRepository(db.raw);
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
console.log(
|
|
35
|
-
console.log(`
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
1
|
+
import { ConfigLoader } from "../../core/config/loader.ts";
|
|
2
|
+
import { SeptumDatabase } from "../../core/database/client.ts";
|
|
3
|
+
import { SeptumRepository } from "../../core/database/repository.ts";
|
|
4
|
+
import { VerticalSliceTracer } from "../../core/resolver/vertical-slice-tracer.ts";
|
|
5
|
+
|
|
6
|
+
export async function handleSliceCommand(
|
|
7
|
+
query: string,
|
|
8
|
+
options?: { json?: boolean; maxDepth?: number }
|
|
9
|
+
): Promise<void> {
|
|
10
|
+
const config = ConfigLoader.load();
|
|
11
|
+
const db = new SeptumDatabase(config.settings.db_path);
|
|
12
|
+
const repo = new SeptumRepository(db.raw);
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
const maxDepth = Math.min(Math.max(Math.trunc(Number(options?.maxDepth ?? 5)), 1), 8);
|
|
16
|
+
const tracer = new VerticalSliceTracer(repo);
|
|
17
|
+
const result = (tracer.trace as any)(query, maxDepth);
|
|
18
|
+
|
|
19
|
+
if (options?.json) {
|
|
20
|
+
console.log(JSON.stringify(result, null, 2));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (result.found) {
|
|
25
|
+
console.log(`\n${result.message}\n`);
|
|
26
|
+
if (result.alternatives && result.alternatives.length > 0) {
|
|
27
|
+
console.log(` • Alternative Matches:`);
|
|
28
|
+
for (const alt of result.alternatives) {
|
|
29
|
+
console.log(` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}`);
|
|
30
|
+
}
|
|
31
|
+
console.log(``);
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
console.log(`\n❌ Vertical Slice Not Found:`);
|
|
35
|
+
console.log(` Query: ${result.query}`);
|
|
36
|
+
console.log(` Message: ${result.message}`);
|
|
37
|
+
|
|
38
|
+
if (result.alternatives && result.alternatives.length > 0) {
|
|
39
|
+
console.log(`\n Available Slices:`);
|
|
40
|
+
for (const alt of result.alternatives) {
|
|
41
|
+
console.log(` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
console.log(``);
|
|
45
|
+
}
|
|
46
|
+
} finally {
|
|
47
|
+
db.close();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
package/src/cli/commands/sync.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { ConfigLoader } from "../../core/config/loader.ts";
|
|
2
|
-
import { SeptumDatabase } from "../../core/database/client.ts";
|
|
3
|
-
import { SeptumRepository } from "../../core/database/repository.ts";
|
|
4
|
-
import { IngestionPipeline } from "../../core/ingestion/pipeline.ts";
|
|
5
|
-
|
|
6
|
-
export interface SyncCommandOptions {
|
|
7
|
-
json?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export async function handleSyncCommand(options: SyncCommandOptions = {}): Promise<void> {
|
|
11
|
-
const config = ConfigLoader.load();
|
|
12
|
-
const db = new SeptumDatabase(config.settings.db_path);
|
|
13
|
-
const repo = new SeptumRepository(db.raw);
|
|
14
|
-
const pipeline = new IngestionPipeline(repo);
|
|
15
|
-
|
|
16
|
-
const metrics = await pipeline.run(config);
|
|
17
|
-
|
|
18
|
-
if (options.json) {
|
|
19
|
-
console.log(JSON.stringify(metrics, null, 2));
|
|
20
|
-
} else {
|
|
21
|
-
console.log(
|
|
22
|
-
`[Septum Sync] Ingested in ${metrics.duration_ms.toFixed(0)}ms: ` +
|
|
23
|
-
`${metrics.files_updated} updated/added, ` +
|
|
24
|
-
`${metrics.files_skipped} unchanged, ` +
|
|
25
|
-
`${metrics.symbols_indexed} symbols, ` +
|
|
26
|
-
`${metrics.dependencies_indexed} deps.`
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
db.close();
|
|
31
|
-
}
|
|
1
|
+
import { ConfigLoader } from "../../core/config/loader.ts";
|
|
2
|
+
import { SeptumDatabase } from "../../core/database/client.ts";
|
|
3
|
+
import { SeptumRepository } from "../../core/database/repository.ts";
|
|
4
|
+
import { IngestionPipeline } from "../../core/ingestion/pipeline.ts";
|
|
5
|
+
|
|
6
|
+
export interface SyncCommandOptions {
|
|
7
|
+
json?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function handleSyncCommand(options: SyncCommandOptions = {}): Promise<void> {
|
|
11
|
+
const config = ConfigLoader.load();
|
|
12
|
+
const db = new SeptumDatabase(config.settings.db_path);
|
|
13
|
+
const repo = new SeptumRepository(db.raw);
|
|
14
|
+
const pipeline = new IngestionPipeline(repo);
|
|
15
|
+
|
|
16
|
+
const metrics = await pipeline.run(config);
|
|
17
|
+
|
|
18
|
+
if (options.json) {
|
|
19
|
+
console.log(JSON.stringify(metrics, null, 2));
|
|
20
|
+
} else {
|
|
21
|
+
console.log(
|
|
22
|
+
`[Septum Sync] Ingested in ${metrics.duration_ms.toFixed(0)}ms: ` +
|
|
23
|
+
`${metrics.files_updated} updated/added, ` +
|
|
24
|
+
`${metrics.files_skipped} unchanged, ` +
|
|
25
|
+
`${metrics.symbols_indexed} symbols, ` +
|
|
26
|
+
`${metrics.dependencies_indexed} deps.`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
db.close();
|
|
31
|
+
}
|