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,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,48 +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
- 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
- }
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
+ }
@@ -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
+ }