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,64 +1,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
|
-
|
|
5
|
-
export async function handleQueryCommand(domainName?: string, archetype?: string, jsonOutput?: boolean): Promise<void> {
|
|
6
|
-
const config = ConfigLoader.load();
|
|
7
|
-
const db = new SeptumDatabase(config.settings.db_path);
|
|
8
|
-
const repo = new SeptumRepository(db.raw);
|
|
9
|
-
|
|
10
|
-
if (!domainName) {
|
|
11
|
-
const allDomains = repo.getAllDomains();
|
|
12
|
-
if (allDomains.length === 0) {
|
|
13
|
-
console.log("[Septum] No domains found in database. Run 'septum ingest' first.");
|
|
14
|
-
db.close();
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
console.log("=== Registered Domains in Septum ===");
|
|
19
|
-
for (const d of allDomains) {
|
|
20
|
-
console.log(`- ${d.name} (root: ${d.root_path})`);
|
|
21
|
-
}
|
|
22
|
-
db.close();
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const catalog = repo.getDomainCatalog(domainName, archetype);
|
|
27
|
-
if (!catalog) {
|
|
28
|
-
console.error(`[Septum Error] Domain '${domainName}' not found in database. Run 'septum ingest' first.`);
|
|
29
|
-
db.close();
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (jsonOutput) {
|
|
34
|
-
console.log(JSON.stringify(catalog, null, 2));
|
|
35
|
-
} else {
|
|
36
|
-
console.log(`=================================================`);
|
|
37
|
-
console.log(` Domain: ${catalog.domain.toUpperCase()} (Root: ${catalog.root})`);
|
|
38
|
-
console.log(`=================================================`);
|
|
39
|
-
console.log(` Allowed Dependencies: [${catalog.allowed_dependencies.join(", ")}]`);
|
|
40
|
-
console.log(` Forbidden Dependencies: [${catalog.forbidden_dependencies.join(", ")}]`);
|
|
41
|
-
console.log(` Total Files Cataloged: ${catalog.files.length}`);
|
|
42
|
-
console.log(`-------------------------------------------------`);
|
|
43
|
-
|
|
44
|
-
for (const file of catalog.files) {
|
|
45
|
-
console.log(`\n File: ${file.path} [archetype: ${file.archetype}]`);
|
|
46
|
-
for (const sym of file.symbols) {
|
|
47
|
-
console.log(` • ${sym.kind.toUpperCase()} ${sym.name}`);
|
|
48
|
-
if (sym.methods && sym.methods.length > 0) {
|
|
49
|
-
for (const m of sym.methods) {
|
|
50
|
-
console.log(` - ${m}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (sym.signatures && sym.signatures.length > 0) {
|
|
54
|
-
for (const s of sym.signatures) {
|
|
55
|
-
console.log(` - ${s}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
console.log(`\n=================================================`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
db.close();
|
|
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
|
+
|
|
5
|
+
export async function handleQueryCommand(domainName?: string, archetype?: string, jsonOutput?: boolean): Promise<void> {
|
|
6
|
+
const config = ConfigLoader.load();
|
|
7
|
+
const db = new SeptumDatabase(config.settings.db_path);
|
|
8
|
+
const repo = new SeptumRepository(db.raw);
|
|
9
|
+
|
|
10
|
+
if (!domainName) {
|
|
11
|
+
const allDomains = repo.getAllDomains();
|
|
12
|
+
if (allDomains.length === 0) {
|
|
13
|
+
console.log("[Septum] No domains found in database. Run 'septum ingest' first.");
|
|
14
|
+
db.close();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
console.log("=== Registered Domains in Septum ===");
|
|
19
|
+
for (const d of allDomains) {
|
|
20
|
+
console.log(`- ${d.name} (root: ${d.root_path})`);
|
|
21
|
+
}
|
|
22
|
+
db.close();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const catalog = repo.getDomainCatalog(domainName, archetype);
|
|
27
|
+
if (!catalog) {
|
|
28
|
+
console.error(`[Septum Error] Domain '${domainName}' not found in database. Run 'septum ingest' first.`);
|
|
29
|
+
db.close();
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (jsonOutput) {
|
|
34
|
+
console.log(JSON.stringify(catalog, null, 2));
|
|
35
|
+
} else {
|
|
36
|
+
console.log(`=================================================`);
|
|
37
|
+
console.log(` Domain: ${catalog.domain.toUpperCase()} (Root: ${catalog.root})`);
|
|
38
|
+
console.log(`=================================================`);
|
|
39
|
+
console.log(` Allowed Dependencies: [${catalog.allowed_dependencies.join(", ")}]`);
|
|
40
|
+
console.log(` Forbidden Dependencies: [${catalog.forbidden_dependencies.join(", ")}]`);
|
|
41
|
+
console.log(` Total Files Cataloged: ${catalog.files.length}`);
|
|
42
|
+
console.log(`-------------------------------------------------`);
|
|
43
|
+
|
|
44
|
+
for (const file of catalog.files) {
|
|
45
|
+
console.log(`\n File: ${file.path} [archetype: ${file.archetype}]`);
|
|
46
|
+
for (const sym of file.symbols) {
|
|
47
|
+
console.log(` • ${sym.kind.toUpperCase()} ${sym.name}`);
|
|
48
|
+
if (sym.methods && sym.methods.length > 0) {
|
|
49
|
+
for (const m of sym.methods) {
|
|
50
|
+
console.log(` - ${m}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (sym.signatures && sym.signatures.length > 0) {
|
|
54
|
+
for (const s of sym.signatures) {
|
|
55
|
+
console.log(` - ${s}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
console.log(`\n=================================================`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
db.close();
|
|
64
|
+
}
|
|
@@ -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,90 +1,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 }
|
|
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 tracer = new VerticalSliceTracer(repo);
|
|
16
|
-
const result = tracer.trace(query);
|
|
17
|
-
|
|
18
|
-
if (options?.json) {
|
|
19
|
-
console.log(JSON.stringify(result, null, 2));
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (result.found
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
console.log(`\n • Model:`);
|
|
50
|
-
console.log(` Class: ${s.model.class} (${s.model.file || "unknown"})`);
|
|
51
|
-
if (s.model.fillable && s.model.fillable.length > 0) {
|
|
52
|
-
console.log(` Fillable: [${s.model.fillable.join(", ")}]`);
|
|
53
|
-
}
|
|
54
|
-
if (s.model.casts && Object.keys(s.model.casts).length > 0) {
|
|
55
|
-
console.log(` Casts: ${JSON.stringify(s.model.casts)}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (s.frontend) {
|
|
60
|
-
console.log(`\n • Frontend Target:`);
|
|
61
|
-
console.log(` Page: ${s.frontend.target}`);
|
|
62
|
-
if (s.frontend.props.length > 0) {
|
|
63
|
-
console.log(` Props: [${s.frontend.props.join(", ")}]`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (result.alternatives && result.alternatives.length > 0) {
|
|
68
|
-
console.log(`\n • Alternative Matches:`);
|
|
69
|
-
for (const alt of result.alternatives) {
|
|
70
|
-
console.log(` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
console.log(`\n=================================================\n`);
|
|
74
|
-
} else {
|
|
75
|
-
console.log(`\n❌ Vertical Slice Not Found:`);
|
|
76
|
-
console.log(` Query: ${result.query}`);
|
|
77
|
-
console.log(` Message: ${result.message}`);
|
|
78
|
-
|
|
79
|
-
if (result.alternatives && result.alternatives.length > 0) {
|
|
80
|
-
console.log(`\n Available Slices:`);
|
|
81
|
-
for (const alt of result.alternatives) {
|
|
82
|
-
console.log(` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
console.log(``);
|
|
86
|
-
}
|
|
87
|
-
} finally {
|
|
88
|
-
db.close();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
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 tracer = new VerticalSliceTracer(repo);
|
|
16
|
+
const result = tracer.trace(query);
|
|
17
|
+
|
|
18
|
+
if (options?.json) {
|
|
19
|
+
console.log(JSON.stringify(result, null, 2));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (result.found) {
|
|
24
|
+
console.log(`\n${result.message}\n`);
|
|
25
|
+
if (result.alternatives && result.alternatives.length > 0) {
|
|
26
|
+
console.log(` • Alternative Matches:`);
|
|
27
|
+
for (const alt of result.alternatives) {
|
|
28
|
+
console.log(` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}`);
|
|
29
|
+
}
|
|
30
|
+
console.log(``);
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
console.log(`\n❌ Vertical Slice Not Found:`);
|
|
34
|
+
console.log(` Query: ${result.query}`);
|
|
35
|
+
console.log(` Message: ${result.message}`);
|
|
36
|
+
|
|
37
|
+
if (result.alternatives && result.alternatives.length > 0) {
|
|
38
|
+
console.log(`\n Available Slices:`);
|
|
39
|
+
for (const alt of result.alternatives) {
|
|
40
|
+
console.log(` - ${alt.method} ${alt.uri} -> ${alt.controller}@${alt.action}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
console.log(``);
|
|
44
|
+
}
|
|
45
|
+
} finally {
|
|
46
|
+
db.close();
|
|
47
|
+
}
|
|
48
|
+
}
|
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
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { SeptumDatabase } from "../../core/database/client.ts";
|
|
2
|
+
import { SeptumRepository } from "../../core/database/repository.ts";
|
|
3
|
+
import { EnvironmentDetector } from "../../core/topology/environment-detector.ts";
|
|
4
|
+
import type { EnvironmentLayer, TopologyNode } from "../../core/topology/types.ts";
|
|
5
|
+
|
|
6
|
+
export async function handleTopologyCommand(
|
|
7
|
+
subcommand?: string,
|
|
8
|
+
arg1?: string,
|
|
9
|
+
arg2?: string,
|
|
10
|
+
arg3?: string,
|
|
11
|
+
arg4?: string
|
|
12
|
+
): Promise<void> {
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
const db = new SeptumDatabase();
|
|
15
|
+
const repo = new SeptumRepository(db.raw);
|
|
16
|
+
|
|
17
|
+
if (subcommand === "resolve" && arg1 && arg2) {
|
|
18
|
+
const layer = arg1.toLowerCase() as EnvironmentLayer;
|
|
19
|
+
const platform = arg2;
|
|
20
|
+
// Fix: Preserve existing constraints instead of overwriting with empty array
|
|
21
|
+
const existing = repo.environment.getLayer(layer);
|
|
22
|
+
repo.environment.saveLayer({
|
|
23
|
+
layer,
|
|
24
|
+
platform,
|
|
25
|
+
canonical_tag: EnvironmentDetector.matchCanonicalTag(platform),
|
|
26
|
+
status: "VERIFIED",
|
|
27
|
+
detected_from: ["CLI Manual Resolution"],
|
|
28
|
+
constraints: existing?.constraints && existing.constraints.length > 0 ? existing.constraints : [
|
|
29
|
+
`Configured manually as '${platform}'.`
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
console.log(`[Septum Topology] Layer '${layer}' successfully verified as '${platform}' in SQLite SSOT.\n`);
|
|
33
|
+
} else if (subcommand === "add-node" && arg1 && arg2 && arg3) {
|
|
34
|
+
const nodeId = arg1;
|
|
35
|
+
const layer = arg2.toLowerCase() as EnvironmentLayer;
|
|
36
|
+
const platform = arg3;
|
|
37
|
+
const domainOrIp = arg4;
|
|
38
|
+
|
|
39
|
+
const node: TopologyNode = {
|
|
40
|
+
id: nodeId,
|
|
41
|
+
layer,
|
|
42
|
+
name: nodeId,
|
|
43
|
+
platform,
|
|
44
|
+
canonical_tag: EnvironmentDetector.matchCanonicalTag(platform),
|
|
45
|
+
domain_or_ip: domainOrIp,
|
|
46
|
+
status: "VERIFIED",
|
|
47
|
+
detected_from: ["CLI Manual Node Resolution"],
|
|
48
|
+
constraints: [`Node added manually with platform '${platform}'.`],
|
|
49
|
+
};
|
|
50
|
+
repo.environment.saveNode(node);
|
|
51
|
+
console.log(`[Septum Topology] Node '${nodeId}' (${layer.toUpperCase()}) added to distributed topology graph.\n`);
|
|
52
|
+
} else if (subcommand === "remove-node" && arg1) {
|
|
53
|
+
repo.environment.deleteNode(arg1);
|
|
54
|
+
console.log(`[Septum Topology] Node '${arg1}' removed from distributed topology graph.\n`);
|
|
55
|
+
} else if (subcommand === "clear") {
|
|
56
|
+
repo.environment.clearAll();
|
|
57
|
+
console.log("[Septum Topology] Cleared environment topology and nodes in SQLite SSOT.\n");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const topology = EnvironmentDetector.detect(cwd, repo);
|
|
61
|
+
|
|
62
|
+
console.log("================================================================================");
|
|
63
|
+
console.log("🌐 SEPTUM SELF-AWARE ENVIRONMENT TOPOLOGY PLANE");
|
|
64
|
+
console.log("================================================================================");
|
|
65
|
+
console.log(`Overall Status: ${topology.overall_status}`);
|
|
66
|
+
console.log(`Topology Mode: ${topology.is_distributed ? "DISTRIBUTED MULTI-NODE GRAPH" : "MONOLITHIC SINGLE-NODE"}`);
|
|
67
|
+
console.log(`Summary: ${topology.architectural_summary}\n`);
|
|
68
|
+
|
|
69
|
+
if (topology.nodes.length > 0) {
|
|
70
|
+
console.log("--- DISTRIBUTED TOPOLOGY NODES ---");
|
|
71
|
+
for (const node of topology.nodes) {
|
|
72
|
+
const statusIcon = node.status === "VERIFIED" ? "✓ [VERIFIED]" : node.status === "DETECTED" ? "• [DETECTED]" : "? [AMBIGUOUS]";
|
|
73
|
+
const domainStr = node.domain_or_ip ? ` @ ${node.domain_or_ip}` : "";
|
|
74
|
+
const roleStr = node.role ? ` [Role: ${node.role}]` : "";
|
|
75
|
+
console.log(` ${statusIcon} ${node.id.padEnd(20)} (${node.layer.toUpperCase()}): ${node.platform}${domainStr}${roleStr}`);
|
|
76
|
+
if (node.connected_to && node.connected_to.length > 0) {
|
|
77
|
+
console.log(` ➔ Connected to: ${node.connected_to.join(", ")}`);
|
|
78
|
+
}
|
|
79
|
+
if (node.constraints && node.constraints.length > 0) {
|
|
80
|
+
for (const c of node.constraints) {
|
|
81
|
+
console.log(` - ${c}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
console.log("");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
console.log("--- 6-LAYER PRODUCTION SUMMARY PLANE ---");
|
|
89
|
+
for (const [layerKey, info] of Object.entries(topology.layers)) {
|
|
90
|
+
const statusIcon = info.status === "VERIFIED" ? "✓ [VERIFIED]" : info.status === "DETECTED" ? "• [DETECTED]" : "? [AMBIGUOUS]";
|
|
91
|
+
console.log(` ${statusIcon} ${layerKey.toUpperCase().padEnd(10)}: ${info.platform || "Unresolved"}`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (topology.interplays.length > 0) {
|
|
95
|
+
console.log("\n--- CROSS-LAYER & DISTRIBUTED INVARIANTS ---");
|
|
96
|
+
for (const interplay of topology.interplays) {
|
|
97
|
+
console.log(` ⚡ ${interplay.title} (${interplay.involved_layers.join(" ➔ ")})`);
|
|
98
|
+
console.log(` Rule: ${interplay.risk_or_rule}`);
|
|
99
|
+
console.log(` Action: ${interplay.required_action}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (topology.pending_inquiries.length > 0) {
|
|
104
|
+
console.log("\n--- PENDING ARCHITECTURAL INQUIRIES ---");
|
|
105
|
+
console.log("Action Required: Please clarify these ambiguous layers/nodes for your AI Agent:\n");
|
|
106
|
+
for (const inquiry of topology.pending_inquiries) {
|
|
107
|
+
console.log(` ❓ ${inquiry}`);
|
|
108
|
+
}
|
|
109
|
+
console.log("\nTip: To resolve an inquiry or add distributed nodes, run:");
|
|
110
|
+
console.log(" septum topology resolve <layer> \"<Platform Name>\"");
|
|
111
|
+
console.log(" septum topology add-node <id> <layer> \"<Platform Name>\" [domain_or_ip]");
|
|
112
|
+
console.log("Example:");
|
|
113
|
+
console.log(" septum topology add-node host:vps-worker host \"Ubuntu 24.04 (Dedicated Worker)\" 10.0.0.6");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
console.log("================================================================================\n");
|
|
117
|
+
|
|
118
|
+
db.close();
|
|
119
|
+
}
|