maestro-flow 0.4.24 → 0.4.25
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/.agents/skills/maestro-impeccable/SKILL.md +5 -1
- package/.agents/skills/maestro-next/SKILL.md +7 -1
- package/.agents/skills/maestro-player/SKILL.md +9 -2
- package/.agents/skills/maestro-tools-execute/SKILL.md +4 -4
- package/.agents/skills/spec-load/SKILL.md +11 -4
- package/.agy/skills/maestro-impeccable/SKILL.md +5 -1
- package/.agy/skills/maestro-next/SKILL.md +7 -1
- package/.agy/skills/maestro-player/SKILL.md +9 -2
- package/.agy/skills/maestro-tools-execute/SKILL.md +4 -4
- package/.agy/skills/spec-load/SKILL.md +11 -4
- package/.claude/commands/maestro-impeccable.md +5 -1
- package/.claude/commands/maestro-next.md +7 -1
- package/.claude/commands/maestro-player.md +9 -2
- package/.claude/commands/maestro-tools-execute.md +4 -4
- package/.claude/commands/spec-load.md +11 -4
- package/dashboard/dist-server/dashboard/src/server/routes/specs.js +96 -25
- package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/constants.d.ts +1 -0
- package/dashboard/dist-server/dashboard/src/shared/constants.js +1 -0
- package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
- package/dashboard/dist-server/src/graph/types.d.ts +98 -0
- package/dashboard/dist-server/src/graph/types.js +19 -1
- package/dashboard/dist-server/src/graph/types.js.map +1 -1
- package/dist/src/commands/kg.d.ts.map +1 -1
- package/dist/src/commands/kg.js +345 -2
- package/dist/src/commands/kg.js.map +1 -1
- package/dist/src/commands/spec.d.ts.map +1 -1
- package/dist/src/commands/spec.js +82 -38
- package/dist/src/commands/spec.js.map +1 -1
- package/dist/src/graph/db/connection.d.ts +22 -0
- package/dist/src/graph/db/connection.d.ts.map +1 -0
- package/dist/src/graph/db/connection.js +113 -0
- package/dist/src/graph/db/connection.js.map +1 -0
- package/dist/src/graph/db/index.d.ts +4 -0
- package/dist/src/graph/db/index.d.ts.map +1 -0
- package/dist/src/graph/db/index.js +4 -0
- package/dist/src/graph/db/index.js.map +1 -0
- package/dist/src/graph/db/migrations.d.ts +5 -0
- package/dist/src/graph/db/migrations.d.ts.map +1 -0
- package/dist/src/graph/db/migrations.js +18 -0
- package/dist/src/graph/db/migrations.js.map +1 -0
- package/dist/src/graph/db/queries.d.ts +50 -0
- package/dist/src/graph/db/queries.d.ts.map +1 -0
- package/dist/src/graph/db/queries.js +313 -0
- package/dist/src/graph/db/queries.js.map +1 -0
- package/dist/src/graph/db/schema.sql +131 -0
- package/dist/src/graph/facade.d.ts +53 -0
- package/dist/src/graph/facade.d.ts.map +1 -0
- package/dist/src/graph/facade.js +172 -0
- package/dist/src/graph/facade.js.map +1 -0
- package/dist/src/graph/graph-queries.d.ts +24 -0
- package/dist/src/graph/graph-queries.d.ts.map +1 -0
- package/dist/src/graph/graph-queries.js +173 -0
- package/dist/src/graph/graph-queries.js.map +1 -0
- package/dist/src/graph/index.d.ts +8 -0
- package/dist/src/graph/index.d.ts.map +1 -1
- package/dist/src/graph/index.js +9 -0
- package/dist/src/graph/index.js.map +1 -1
- package/dist/src/graph/loader.d.ts +8 -0
- package/dist/src/graph/loader.d.ts.map +1 -1
- package/dist/src/graph/loader.js +20 -0
- package/dist/src/graph/loader.js.map +1 -1
- package/dist/src/graph/migration.d.ts +8 -0
- package/dist/src/graph/migration.d.ts.map +1 -0
- package/dist/src/graph/migration.js +134 -0
- package/dist/src/graph/migration.js.map +1 -0
- package/dist/src/graph/search/index.d.ts +4 -0
- package/dist/src/graph/search/index.d.ts.map +1 -0
- package/dist/src/graph/search/index.js +3 -0
- package/dist/src/graph/search/index.js.map +1 -0
- package/dist/src/graph/search/query-parser.d.ts +11 -0
- package/dist/src/graph/search/query-parser.d.ts.map +1 -0
- package/dist/src/graph/search/query-parser.js +111 -0
- package/dist/src/graph/search/query-parser.js.map +1 -0
- package/dist/src/graph/search/query-utils.d.ts +12 -0
- package/dist/src/graph/search/query-utils.d.ts.map +1 -0
- package/dist/src/graph/search/query-utils.js +184 -0
- package/dist/src/graph/search/query-utils.js.map +1 -0
- package/dist/src/graph/sync/content-hash.d.ts +7 -0
- package/dist/src/graph/sync/content-hash.d.ts.map +1 -0
- package/dist/src/graph/sync/content-hash.js +33 -0
- package/dist/src/graph/sync/content-hash.js.map +1 -0
- package/dist/src/graph/sync/incremental-sync.d.ts +23 -0
- package/dist/src/graph/sync/incremental-sync.d.ts.map +1 -0
- package/dist/src/graph/sync/incremental-sync.js +338 -0
- package/dist/src/graph/sync/incremental-sync.js.map +1 -0
- package/dist/src/graph/sync/index.d.ts +7 -0
- package/dist/src/graph/sync/index.d.ts.map +1 -0
- package/dist/src/graph/sync/index.js +5 -0
- package/dist/src/graph/sync/index.js.map +1 -0
- package/dist/src/graph/sync/watch-policy.d.ts +2 -0
- package/dist/src/graph/sync/watch-policy.d.ts.map +1 -0
- package/dist/src/graph/sync/watch-policy.js +38 -0
- package/dist/src/graph/sync/watch-policy.js.map +1 -0
- package/dist/src/graph/sync/watcher.d.ts +44 -0
- package/dist/src/graph/sync/watcher.d.ts.map +1 -0
- package/dist/src/graph/sync/watcher.js +153 -0
- package/dist/src/graph/sync/watcher.js.map +1 -0
- package/dist/src/graph/traversal.d.ts +37 -0
- package/dist/src/graph/traversal.d.ts.map +1 -0
- package/dist/src/graph/traversal.js +335 -0
- package/dist/src/graph/traversal.js.map +1 -0
- package/dist/src/graph/types.d.ts +98 -0
- package/dist/src/graph/types.d.ts.map +1 -1
- package/dist/src/graph/types.js +19 -1
- package/dist/src/graph/types.js.map +1 -1
- package/dist/src/utils/update-notices.js +11 -0
- package/dist/src/utils/update-notices.js.map +1 -1
- package/package.json +4 -2
- package/workflows/analyze.md +19 -13
|
@@ -73,6 +73,7 @@ export const SPECS_API_ENDPOINTS = {
|
|
|
73
73
|
SPECS: '/api/specs',
|
|
74
74
|
SPECS_FILES: '/api/specs/files',
|
|
75
75
|
SPECS_FILE: '/api/specs/file/:name',
|
|
76
|
+
SPECS_SCOPES: '/api/specs/scopes',
|
|
76
77
|
};
|
|
77
78
|
// ---------------------------------------------------------------------------
|
|
78
79
|
// Wiki API endpoint paths
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/shared/constants.ts"],"names":[],"mappings":"AAKA,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,MAAM,CAAC,MAAM,cAAc,GAA2B;IACpD,aAAa;IACb,UAAU;IACV,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,aAAa,GAA0B;IAClD,SAAS;IACT,aAAa;IACb,WAAW;IACX,QAAQ;CACA,CAAC;AAaX,MAAM,CAAC,MAAM,iBAAiB,GAAgC;IAC5D,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,aAAa,CAAC,EAAE;IAC9D,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/C,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE;IAChF,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE;IACvE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE;IACjE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE;CAC3C,CAAC;AAEX,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,eAAe,GAA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7,6 +7,104 @@ export interface GraphNode {
|
|
|
7
7
|
tags: string[];
|
|
8
8
|
complexity?: string;
|
|
9
9
|
}
|
|
10
|
+
export declare const NODE_KINDS: readonly ["file", "module", "class", "struct", "interface", "trait", "protocol", "function", "method", "property", "field", "variable", "constant", "enum", "enum_member", "type_alias", "namespace", "parameter", "import", "export", "route", "component"];
|
|
11
|
+
export type NodeKind = typeof NODE_KINDS[number];
|
|
12
|
+
export declare const EDGE_KINDS: readonly ["contains", "calls", "imports", "exports", "extends", "implements", "references", "type_of", "returns", "instantiates", "overrides", "decorates"];
|
|
13
|
+
export type EdgeKind = typeof EDGE_KINDS[number];
|
|
14
|
+
export declare const LANGUAGES: readonly ["typescript", "javascript", "tsx", "jsx", "python", "go", "rust", "java", "c", "cpp", "csharp", "php", "ruby", "swift", "kotlin", "dart", "svelte", "vue", "lua", "luau", "objc", "scala", "pascal", "yaml", "xml", "properties", "unknown"];
|
|
15
|
+
export type Language = typeof LANGUAGES[number];
|
|
16
|
+
export type Visibility = 'public' | 'private' | 'protected' | 'internal';
|
|
17
|
+
export interface EnhancedNode {
|
|
18
|
+
id: string;
|
|
19
|
+
kind: NodeKind;
|
|
20
|
+
name: string;
|
|
21
|
+
qualifiedName: string;
|
|
22
|
+
filePath: string;
|
|
23
|
+
language: Language;
|
|
24
|
+
startLine: number;
|
|
25
|
+
endLine: number;
|
|
26
|
+
startColumn: number;
|
|
27
|
+
endColumn: number;
|
|
28
|
+
docstring: string;
|
|
29
|
+
signature: string;
|
|
30
|
+
visibility: Visibility | '';
|
|
31
|
+
isExported: boolean;
|
|
32
|
+
isAsync: boolean;
|
|
33
|
+
isStatic: boolean;
|
|
34
|
+
isAbstract: boolean;
|
|
35
|
+
decorators: string[];
|
|
36
|
+
typeParameters: string[];
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
}
|
|
39
|
+
export interface EnhancedEdge {
|
|
40
|
+
id?: number;
|
|
41
|
+
source: string;
|
|
42
|
+
target: string;
|
|
43
|
+
kind: EdgeKind;
|
|
44
|
+
metadata?: Record<string, unknown>;
|
|
45
|
+
line?: number;
|
|
46
|
+
column?: number;
|
|
47
|
+
provenance?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface FileRecord {
|
|
50
|
+
path: string;
|
|
51
|
+
contentHash: string;
|
|
52
|
+
language: Language;
|
|
53
|
+
size: number;
|
|
54
|
+
modifiedAt: string;
|
|
55
|
+
indexedAt: string;
|
|
56
|
+
nodeCount: number;
|
|
57
|
+
errors: string[];
|
|
58
|
+
}
|
|
59
|
+
export interface UnresolvedReference {
|
|
60
|
+
id?: number;
|
|
61
|
+
fromNodeId: string;
|
|
62
|
+
referenceName: string;
|
|
63
|
+
referenceKind: string;
|
|
64
|
+
line: number;
|
|
65
|
+
column: number;
|
|
66
|
+
candidates: string[];
|
|
67
|
+
filePath: string;
|
|
68
|
+
language: Language;
|
|
69
|
+
}
|
|
70
|
+
export interface Subgraph {
|
|
71
|
+
nodes: Map<string, EnhancedNode>;
|
|
72
|
+
edges: EnhancedEdge[];
|
|
73
|
+
roots: string[];
|
|
74
|
+
}
|
|
75
|
+
export interface TraversalOptions {
|
|
76
|
+
maxDepth?: number;
|
|
77
|
+
edgeKinds?: EdgeKind[];
|
|
78
|
+
nodeKinds?: NodeKind[];
|
|
79
|
+
direction?: 'outgoing' | 'incoming' | 'both';
|
|
80
|
+
limit?: number;
|
|
81
|
+
includeStart?: boolean;
|
|
82
|
+
}
|
|
83
|
+
export interface GraphStats {
|
|
84
|
+
nodeCount: number;
|
|
85
|
+
edgeCount: number;
|
|
86
|
+
fileCount: number;
|
|
87
|
+
unresolvedRefCount: number;
|
|
88
|
+
nodesByKind: Record<string, number>;
|
|
89
|
+
edgesByKind: Record<string, number>;
|
|
90
|
+
nodesByLanguage: Record<string, number>;
|
|
91
|
+
dbSizeBytes: number;
|
|
92
|
+
}
|
|
93
|
+
export interface NodeContext {
|
|
94
|
+
focal: EnhancedNode;
|
|
95
|
+
ancestors: EnhancedNode[];
|
|
96
|
+
children: EnhancedNode[];
|
|
97
|
+
incomingRefs: Array<{
|
|
98
|
+
node: EnhancedNode;
|
|
99
|
+
edge: EnhancedEdge;
|
|
100
|
+
}>;
|
|
101
|
+
outgoingRefs: Array<{
|
|
102
|
+
node: EnhancedNode;
|
|
103
|
+
edge: EnhancedEdge;
|
|
104
|
+
}>;
|
|
105
|
+
types: EnhancedNode[];
|
|
106
|
+
imports: EnhancedNode[];
|
|
107
|
+
}
|
|
10
108
|
export interface GraphEdge {
|
|
11
109
|
source: string;
|
|
12
110
|
target: string;
|
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Enhanced types (codegraph-derived)
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
export const NODE_KINDS = [
|
|
5
|
+
'file', 'module', 'class', 'struct', 'interface', 'trait', 'protocol',
|
|
6
|
+
'function', 'method', 'property', 'field', 'variable', 'constant',
|
|
7
|
+
'enum', 'enum_member', 'type_alias', 'namespace', 'parameter',
|
|
8
|
+
'import', 'export', 'route', 'component',
|
|
9
|
+
];
|
|
10
|
+
export const EDGE_KINDS = [
|
|
11
|
+
'contains', 'calls', 'imports', 'exports', 'extends', 'implements',
|
|
12
|
+
'references', 'type_of', 'returns', 'instantiates', 'overrides', 'decorates',
|
|
13
|
+
];
|
|
14
|
+
export const LANGUAGES = [
|
|
15
|
+
'typescript', 'javascript', 'tsx', 'jsx', 'python', 'go', 'rust',
|
|
16
|
+
'java', 'c', 'cpp', 'csharp', 'php', 'ruby', 'swift', 'kotlin',
|
|
17
|
+
'dart', 'svelte', 'vue', 'lua', 'luau', 'objc', 'scala', 'pascal',
|
|
18
|
+
'yaml', 'xml', 'properties', 'unknown',
|
|
19
|
+
];
|
|
2
20
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/graph/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/graph/types.ts"],"names":[],"mappings":"AAUA,8EAA8E;AAC9E,qCAAqC;AACrC,8EAA8E;AAE9E,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU;IACrE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU;IACjE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW;IAC7D,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW;CAChC,CAAC;AAGX,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY;IAClE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW;CACpE,CAAC;AAGX,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM;IAChE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ;IAC9D,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ;IACjE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS;CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kg.d.ts","sourceRoot":"","sources":["../../../src/commands/kg.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"kg.d.ts","sourceRoot":"","sources":["../../../src/commands/kg.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0GzC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmxBxD"}
|
package/dist/src/commands/kg.js
CHANGED
|
@@ -12,6 +12,13 @@ import { execSync } from 'node:child_process';
|
|
|
12
12
|
import { loadGraph } from '../graph/loader.js';
|
|
13
13
|
import { searchNodes, findPath, diffChanges, countBy, truncate } from '../graph/query.js';
|
|
14
14
|
import { FsAnalyzer } from '../graph/analyzers/fs-analyzer.js';
|
|
15
|
+
import { DatabaseConnection, getDatabasePath, QueryBuilder } from '../graph/db/index.js';
|
|
16
|
+
import { GraphTraverser } from '../graph/traversal.js';
|
|
17
|
+
import { GraphQueryManager } from '../graph/graph-queries.js';
|
|
18
|
+
import { IncrementalSync } from '../graph/sync/incremental-sync.js';
|
|
19
|
+
import { FileWatcher } from '../graph/sync/watcher.js';
|
|
20
|
+
import { parseQuery } from '../graph/search/query-parser.js';
|
|
21
|
+
import { migrateJsonToSqlite, exportSqliteToJson } from '../graph/migration.js';
|
|
15
22
|
import { WikiIndexer } from '#maestro-dashboard/wiki/wiki-indexer.js';
|
|
16
23
|
function loadGraphOrExit() {
|
|
17
24
|
try {
|
|
@@ -75,11 +82,26 @@ async function findRelatedWikiEntries(nodeId, filePath) {
|
|
|
75
82
|
return [];
|
|
76
83
|
}
|
|
77
84
|
}
|
|
85
|
+
// ── SQLite helpers ────────────────────────────────────────────────────
|
|
86
|
+
function openSqliteOrExit() {
|
|
87
|
+
const dbPath = getDatabasePath();
|
|
88
|
+
if (!existsSync(dbPath)) {
|
|
89
|
+
console.error(`SQLite graph not found: ${dbPath}`);
|
|
90
|
+
console.error(' Hint: run "maestro kg index --sqlite" to create one');
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
const conn = new DatabaseConnection();
|
|
94
|
+
conn.open(dbPath);
|
|
95
|
+
return { conn, queries: new QueryBuilder(conn) };
|
|
96
|
+
}
|
|
97
|
+
function hasSqliteDb() {
|
|
98
|
+
return existsSync(getDatabasePath());
|
|
99
|
+
}
|
|
78
100
|
// ── Registration ───────────────────────────────────────────────────────
|
|
79
101
|
export function registerKgCommand(program) {
|
|
80
102
|
const kg = program
|
|
81
103
|
.command('kg')
|
|
82
|
-
.description('Query codebase knowledge graph (
|
|
104
|
+
.description('Query codebase knowledge graph (JSON or SQLite backend)');
|
|
83
105
|
// ── stats ──────────────────────────────────────────────────────────
|
|
84
106
|
kg
|
|
85
107
|
.command('stats')
|
|
@@ -124,8 +146,36 @@ export function registerKgCommand(program) {
|
|
|
124
146
|
.option('--type <nodeType>', 'Filter by node type')
|
|
125
147
|
.option('--json', 'Output as JSON')
|
|
126
148
|
.action((text, opts) => {
|
|
127
|
-
const graph = loadGraphOrExit();
|
|
128
149
|
const limit = Number(opts.limit) || 10;
|
|
150
|
+
if (hasSqliteDb()) {
|
|
151
|
+
const { conn, queries } = openSqliteOrExit();
|
|
152
|
+
try {
|
|
153
|
+
const parsed = parseQuery(text);
|
|
154
|
+
const kinds = parsed.kinds.length > 0 ? parsed.kinds : undefined;
|
|
155
|
+
const results = queries.searchNodes(parsed.text || text, {
|
|
156
|
+
kinds,
|
|
157
|
+
languages: parsed.languages.length > 0 ? parsed.languages : undefined,
|
|
158
|
+
pathFilters: parsed.pathFilters.length > 0 ? parsed.pathFilters : undefined,
|
|
159
|
+
nameFilters: parsed.nameFilters.length > 0 ? parsed.nameFilters : undefined,
|
|
160
|
+
limit,
|
|
161
|
+
});
|
|
162
|
+
if (opts.json) {
|
|
163
|
+
console.log(JSON.stringify({ query: text, total: results.length, nodes: results }, null, 2));
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
console.log(`Query: "${text}" (${results.length} results, SQLite)`);
|
|
167
|
+
for (const n of results) {
|
|
168
|
+
const exported = n.isExported ? 'Exported ' : '';
|
|
169
|
+
const desc = n.signature ? truncate(n.signature, 60) : `${exported}${n.kind} "${n.name}" in ${n.filePath}`;
|
|
170
|
+
console.log(` [${n.kind}] ${n.id} -- ${desc}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
finally {
|
|
174
|
+
conn.close();
|
|
175
|
+
}
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const graph = loadGraphOrExit();
|
|
129
179
|
const matches = searchNodes(graph, text, { limit, type: opts.type });
|
|
130
180
|
const total = searchNodes(graph, text, { limit: Infinity, type: opts.type }).length;
|
|
131
181
|
if (opts.json) {
|
|
@@ -398,6 +448,7 @@ export function registerKgCommand(program) {
|
|
|
398
448
|
.command('index')
|
|
399
449
|
.description('Scan codebase and generate knowledge graph')
|
|
400
450
|
.option('--src <path>', 'Source directory to scan', 'src')
|
|
451
|
+
.option('--sqlite', 'Use SQLite backend (recommended for large projects)')
|
|
401
452
|
.option('--json', 'Output stats as JSON after indexing')
|
|
402
453
|
.action(async (opts) => {
|
|
403
454
|
const srcPath = resolve(opts.src);
|
|
@@ -405,6 +456,48 @@ export function registerKgCommand(program) {
|
|
|
405
456
|
console.error(`Source directory not found: ${srcPath}`);
|
|
406
457
|
process.exit(1);
|
|
407
458
|
}
|
|
459
|
+
// SQLite mode — use IncrementalSync for full index
|
|
460
|
+
if (opts.sqlite) {
|
|
461
|
+
const dbPath = getDatabasePath();
|
|
462
|
+
const outDir = resolve('.workflow', 'codebase');
|
|
463
|
+
mkdirSync(outDir, { recursive: true });
|
|
464
|
+
const conn = new DatabaseConnection();
|
|
465
|
+
const isNew = !existsSync(dbPath);
|
|
466
|
+
if (isNew)
|
|
467
|
+
conn.initialize(dbPath);
|
|
468
|
+
else
|
|
469
|
+
conn.open(dbPath);
|
|
470
|
+
const queries = new QueryBuilder(conn);
|
|
471
|
+
if (!isNew)
|
|
472
|
+
queries.clear();
|
|
473
|
+
console.log(`Indexing ${srcPath} to SQLite ...`);
|
|
474
|
+
const sync = new IncrementalSync(srcPath, conn);
|
|
475
|
+
const result = sync.sync();
|
|
476
|
+
queries.setMetadata('projectRoot', srcPath);
|
|
477
|
+
const stats = queries.getStats(conn.getSize());
|
|
478
|
+
conn.close();
|
|
479
|
+
if (opts.json) {
|
|
480
|
+
console.log(JSON.stringify({ ...stats, ...result, output: dbPath }, null, 2));
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
console.log('');
|
|
484
|
+
console.log(`Nodes: ${stats.nodeCount}`);
|
|
485
|
+
for (const [kind, count] of Object.entries(stats.nodesByKind)) {
|
|
486
|
+
console.log(` ${kind}: ${count}`);
|
|
487
|
+
}
|
|
488
|
+
console.log('');
|
|
489
|
+
console.log(`Edges: ${stats.edgeCount}`);
|
|
490
|
+
for (const [kind, count] of Object.entries(stats.edgesByKind)) {
|
|
491
|
+
console.log(` ${kind}: ${count}`);
|
|
492
|
+
}
|
|
493
|
+
console.log('');
|
|
494
|
+
console.log(`Files: ${stats.fileCount}`);
|
|
495
|
+
console.log(`DB size: ${(stats.dbSizeBytes / 1024).toFixed(1)} KB`);
|
|
496
|
+
console.log(`Duration: ${result.durationMs}ms`);
|
|
497
|
+
console.log(`Written to: ${dbPath}`);
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
// JSON mode (legacy)
|
|
408
501
|
const analyzer = new FsAnalyzer();
|
|
409
502
|
console.log(`Scanning ${srcPath} ...`);
|
|
410
503
|
const graph = await analyzer.analyze(srcPath);
|
|
@@ -482,5 +575,255 @@ export function registerKgCommand(program) {
|
|
|
482
575
|
console.log('');
|
|
483
576
|
console.log(`Written to: ${outPath}`);
|
|
484
577
|
});
|
|
578
|
+
// ── sync (incremental) ────────────────────────────────────────────
|
|
579
|
+
kg
|
|
580
|
+
.command('sync')
|
|
581
|
+
.description('Incremental sync — only re-index changed files (SQLite)')
|
|
582
|
+
.option('--json', 'Output as JSON')
|
|
583
|
+
.action((opts) => {
|
|
584
|
+
const { conn, queries } = openSqliteOrExit();
|
|
585
|
+
try {
|
|
586
|
+
const projectRoot = queries.getMetadata('projectRoot') ?? process.cwd();
|
|
587
|
+
const sync = new IncrementalSync(projectRoot, conn);
|
|
588
|
+
const result = sync.sync();
|
|
589
|
+
if (opts.json) {
|
|
590
|
+
console.log(JSON.stringify(result, null, 2));
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
console.log(`Sync complete: ${result.filesChanged} files changed, ${result.nodesAdded} nodes, ${result.edgesAdded} edges (${result.durationMs}ms)`);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
finally {
|
|
597
|
+
conn.close();
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
// ── watch ──────────────────────────────────────────────────────────
|
|
601
|
+
kg
|
|
602
|
+
.command('watch')
|
|
603
|
+
.description('Watch for file changes and auto-sync (SQLite)')
|
|
604
|
+
.option('--debounce <ms>', 'Debounce delay in milliseconds', '2000')
|
|
605
|
+
.action((opts) => {
|
|
606
|
+
const dbPath = getDatabasePath();
|
|
607
|
+
if (!existsSync(dbPath)) {
|
|
608
|
+
console.error(`SQLite graph not found. Run "maestro kg index --sqlite" first.`);
|
|
609
|
+
process.exit(1);
|
|
610
|
+
}
|
|
611
|
+
const conn = new DatabaseConnection();
|
|
612
|
+
conn.open(dbPath);
|
|
613
|
+
const queries = new QueryBuilder(conn);
|
|
614
|
+
const projectRoot = queries.getMetadata('projectRoot') ?? process.cwd();
|
|
615
|
+
const debounceMs = Number(opts.debounce) || 2000;
|
|
616
|
+
const watcher = new FileWatcher(projectRoot, async () => {
|
|
617
|
+
const sync = new IncrementalSync(projectRoot, conn);
|
|
618
|
+
const result = sync.sync();
|
|
619
|
+
return { filesChanged: result.filesChanged, durationMs: result.durationMs };
|
|
620
|
+
}, {
|
|
621
|
+
debounceMs,
|
|
622
|
+
onSyncComplete: (result) => {
|
|
623
|
+
if (result.filesChanged > 0) {
|
|
624
|
+
console.log(`[sync] ${result.filesChanged} files updated (${result.durationMs}ms)`);
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
onSyncError: (err) => {
|
|
628
|
+
console.error(`[sync error] ${err.message}`);
|
|
629
|
+
},
|
|
630
|
+
});
|
|
631
|
+
const started = watcher.start();
|
|
632
|
+
if (!started) {
|
|
633
|
+
console.error('Could not start file watcher (unsupported filesystem?)');
|
|
634
|
+
conn.close();
|
|
635
|
+
process.exit(1);
|
|
636
|
+
}
|
|
637
|
+
console.log(`Watching for changes (debounce: ${debounceMs}ms) — press Ctrl+C to stop`);
|
|
638
|
+
process.on('SIGINT', () => {
|
|
639
|
+
watcher.stop();
|
|
640
|
+
conn.close();
|
|
641
|
+
console.log('\nWatcher stopped.');
|
|
642
|
+
process.exit(0);
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
// ── callers ────────────────────────────────────────────────────────
|
|
646
|
+
kg
|
|
647
|
+
.command('callers <node-id>')
|
|
648
|
+
.description('Show callers of a function/method (SQLite)')
|
|
649
|
+
.option('--depth <n>', 'Max traversal depth', '2')
|
|
650
|
+
.option('--json', 'Output as JSON')
|
|
651
|
+
.action((nodeId, opts) => {
|
|
652
|
+
const { conn, queries } = openSqliteOrExit();
|
|
653
|
+
try {
|
|
654
|
+
const traverser = new GraphTraverser(queries);
|
|
655
|
+
const callers = traverser.getCallers(nodeId, Number(opts.depth) || 2);
|
|
656
|
+
if (opts.json) {
|
|
657
|
+
console.log(JSON.stringify(callers.map(c => ({
|
|
658
|
+
id: c.node.id, kind: c.node.kind, name: c.node.name,
|
|
659
|
+
filePath: c.node.filePath, edgeKind: c.edge.kind,
|
|
660
|
+
})), null, 2));
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
console.log(`Callers of ${nodeId} (${callers.length}):`);
|
|
664
|
+
for (const { node, edge } of callers) {
|
|
665
|
+
console.log(` [${node.kind}] ${node.id} --${edge.kind}-->`);
|
|
666
|
+
if (node.signature)
|
|
667
|
+
console.log(` ${node.signature}`);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
finally {
|
|
671
|
+
conn.close();
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
// ── callees ────────────────────────────────────────────────────────
|
|
675
|
+
kg
|
|
676
|
+
.command('callees <node-id>')
|
|
677
|
+
.description('Show callees of a function/method (SQLite)')
|
|
678
|
+
.option('--depth <n>', 'Max traversal depth', '2')
|
|
679
|
+
.option('--json', 'Output as JSON')
|
|
680
|
+
.action((nodeId, opts) => {
|
|
681
|
+
const { conn, queries } = openSqliteOrExit();
|
|
682
|
+
try {
|
|
683
|
+
const traverser = new GraphTraverser(queries);
|
|
684
|
+
const callees = traverser.getCallees(nodeId, Number(opts.depth) || 2);
|
|
685
|
+
if (opts.json) {
|
|
686
|
+
console.log(JSON.stringify(callees.map(c => ({
|
|
687
|
+
id: c.node.id, kind: c.node.kind, name: c.node.name,
|
|
688
|
+
filePath: c.node.filePath, edgeKind: c.edge.kind,
|
|
689
|
+
})), null, 2));
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
console.log(`Callees of ${nodeId} (${callees.length}):`);
|
|
693
|
+
for (const { node, edge } of callees) {
|
|
694
|
+
console.log(` --${edge.kind}--> [${node.kind}] ${node.id}`);
|
|
695
|
+
if (node.signature)
|
|
696
|
+
console.log(` ${node.signature}`);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
finally {
|
|
700
|
+
conn.close();
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
// ── impact ─────────────────────────────────────────────────────────
|
|
704
|
+
kg
|
|
705
|
+
.command('impact <node-id>')
|
|
706
|
+
.description('Show transitive impact radius (SQLite)')
|
|
707
|
+
.option('--depth <n>', 'Max depth', '3')
|
|
708
|
+
.option('--json', 'Output as JSON')
|
|
709
|
+
.action((nodeId, opts) => {
|
|
710
|
+
const { conn, queries } = openSqliteOrExit();
|
|
711
|
+
try {
|
|
712
|
+
const traverser = new GraphTraverser(queries);
|
|
713
|
+
const subgraph = traverser.getImpactRadius(nodeId, Number(opts.depth) || 3);
|
|
714
|
+
if (opts.json) {
|
|
715
|
+
const nodes = [...subgraph.nodes.values()].map(n => ({
|
|
716
|
+
id: n.id, kind: n.kind, name: n.name, filePath: n.filePath,
|
|
717
|
+
}));
|
|
718
|
+
console.log(JSON.stringify({ nodeCount: nodes.length, edgeCount: subgraph.edges.length, nodes }, null, 2));
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
console.log(`Impact radius for ${nodeId}: ${subgraph.nodes.size} nodes, ${subgraph.edges.length} edges`);
|
|
722
|
+
for (const node of subgraph.nodes.values()) {
|
|
723
|
+
if (node.id === nodeId)
|
|
724
|
+
continue;
|
|
725
|
+
console.log(` [${node.kind}] ${node.id}`);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
finally {
|
|
729
|
+
conn.close();
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
// ── dead-code ──────────────────────────────────────────────────────
|
|
733
|
+
kg
|
|
734
|
+
.command('dead-code')
|
|
735
|
+
.description('Find unreferenced symbols (SQLite)')
|
|
736
|
+
.option('--kinds <kinds>', 'Comma-separated node kinds to check', 'function,method,class')
|
|
737
|
+
.option('--json', 'Output as JSON')
|
|
738
|
+
.action((opts) => {
|
|
739
|
+
const { conn, queries } = openSqliteOrExit();
|
|
740
|
+
try {
|
|
741
|
+
const kinds = opts.kinds.split(',').map((k) => k.trim());
|
|
742
|
+
const manager = new GraphQueryManager(queries);
|
|
743
|
+
const deadCode = manager.findDeadCode(kinds);
|
|
744
|
+
if (opts.json) {
|
|
745
|
+
console.log(JSON.stringify(deadCode.map(n => ({
|
|
746
|
+
id: n.id, kind: n.kind, name: n.name, filePath: n.filePath,
|
|
747
|
+
startLine: n.startLine, signature: n.signature,
|
|
748
|
+
})), null, 2));
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
console.log(`Dead code (${deadCode.length} unreferenced symbols):`);
|
|
752
|
+
for (const node of deadCode) {
|
|
753
|
+
console.log(` [${node.kind}] ${node.name} — ${node.filePath}:${node.startLine}`);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
finally {
|
|
757
|
+
conn.close();
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
// ── cycles ─────────────────────────────────────────────────────────
|
|
761
|
+
kg
|
|
762
|
+
.command('cycles')
|
|
763
|
+
.description('Find circular import dependencies (SQLite)')
|
|
764
|
+
.option('--json', 'Output as JSON')
|
|
765
|
+
.action((opts) => {
|
|
766
|
+
const { conn, queries } = openSqliteOrExit();
|
|
767
|
+
try {
|
|
768
|
+
const manager = new GraphQueryManager(queries);
|
|
769
|
+
const cycles = manager.findCircularDependencies();
|
|
770
|
+
if (opts.json) {
|
|
771
|
+
console.log(JSON.stringify(cycles, null, 2));
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
if (cycles.length === 0) {
|
|
775
|
+
console.log('No circular dependencies detected.');
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
console.log(`Circular dependencies (${cycles.length}):`);
|
|
779
|
+
for (let i = 0; i < cycles.length; i++) {
|
|
780
|
+
console.log(` Cycle ${i + 1}: ${cycles[i].join(' → ')} → ${cycles[i][0]}`);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
finally {
|
|
784
|
+
conn.close();
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
// ── migrate ────────────────────────────────────────────────────────
|
|
788
|
+
kg
|
|
789
|
+
.command('migrate')
|
|
790
|
+
.description('Convert JSON knowledge graph to SQLite')
|
|
791
|
+
.option('--json', 'Output result as JSON')
|
|
792
|
+
.action((opts) => {
|
|
793
|
+
const jsonPath = resolve('.workflow', 'codebase', 'knowledge-graph.json');
|
|
794
|
+
if (!existsSync(jsonPath)) {
|
|
795
|
+
console.error(`JSON graph not found: ${jsonPath}`);
|
|
796
|
+
console.error(' Hint: run "maestro kg index" to generate a JSON graph first');
|
|
797
|
+
process.exit(1);
|
|
798
|
+
}
|
|
799
|
+
console.log('Migrating JSON graph to SQLite ...');
|
|
800
|
+
const result = migrateJsonToSqlite(jsonPath);
|
|
801
|
+
if (opts.json) {
|
|
802
|
+
console.log(JSON.stringify(result, null, 2));
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
console.log(`Migrated: ${result.nodes} nodes, ${result.edges} edges`);
|
|
806
|
+
console.log(`Written to: ${result.dbPath}`);
|
|
807
|
+
});
|
|
808
|
+
// ── export-json ────────────────────────────────────────────────────
|
|
809
|
+
kg
|
|
810
|
+
.command('export-json')
|
|
811
|
+
.description('Export SQLite graph as JSON')
|
|
812
|
+
.option('--out <path>', 'Output path', '.workflow/codebase/knowledge-graph-export.json')
|
|
813
|
+
.action((opts) => {
|
|
814
|
+
const dbPath = getDatabasePath();
|
|
815
|
+
if (!existsSync(dbPath)) {
|
|
816
|
+
console.error(`SQLite graph not found: ${dbPath}`);
|
|
817
|
+
process.exit(1);
|
|
818
|
+
}
|
|
819
|
+
console.log('Exporting SQLite graph to JSON ...');
|
|
820
|
+
const graph = exportSqliteToJson(dbPath);
|
|
821
|
+
const outPath = resolve(opts.out);
|
|
822
|
+
const outDir = resolve(outPath, '..');
|
|
823
|
+
mkdirSync(outDir, { recursive: true });
|
|
824
|
+
writeFileSync(outPath, JSON.stringify(graph, null, 2), 'utf-8');
|
|
825
|
+
console.log(`Exported: ${graph.nodes.length} nodes, ${graph.edges.length} edges`);
|
|
826
|
+
console.log(`Written to: ${outPath}`);
|
|
827
|
+
});
|
|
485
828
|
}
|
|
486
829
|
//# sourceMappingURL=kg.js.map
|