maestro-flow 0.5.3 → 0.5.31
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/learn-follow/SKILL.md +114 -114
- package/.agents/skills/learn-investigate/SKILL.md +138 -139
- package/.agents/skills/learn-second-opinion/SKILL.md +105 -109
- package/.agents/skills/maestro/SKILL.md +2 -10
- package/.agents/skills/maestro-amend/SKILL.md +152 -152
- package/.agents/skills/maestro-analyze/SKILL.md +201 -252
- package/.agents/skills/maestro-blueprint/SKILL.md +175 -190
- package/.agents/skills/maestro-brainstorm/SKILL.md +196 -200
- package/.agents/skills/maestro-collab/SKILL.md +159 -159
- package/.agents/skills/maestro-companion/SKILL.md +517 -517
- package/.agents/skills/maestro-composer/SKILL.md +173 -164
- package/.agents/skills/maestro-execute/SKILL.md +169 -170
- package/.agents/skills/maestro-fork/SKILL.md +97 -96
- package/.agents/skills/maestro-grill/SKILL.md +161 -162
- package/.agents/skills/maestro-guard/SKILL.md +93 -92
- package/.agents/skills/maestro-impeccable/SKILL.md +296 -253
- package/.agents/skills/maestro-init/SKILL.md +117 -118
- package/.agents/skills/maestro-merge/SKILL.md +73 -66
- package/.agents/skills/maestro-milestone-audit/SKILL.md +4 -10
- package/.agents/skills/maestro-milestone-complete/SKILL.md +6 -7
- package/.agents/skills/maestro-milestone-release/SKILL.md +122 -131
- package/.agents/skills/maestro-next/SKILL.md +241 -245
- package/.agents/skills/maestro-overlay/SKILL.md +176 -166
- package/.agents/skills/maestro-plan/SKILL.md +211 -197
- package/.agents/skills/maestro-player/SKILL.md +167 -167
- package/.agents/skills/maestro-quick/SKILL.md +69 -63
- package/.agents/skills/maestro-ralph/SKILL.md +2 -36
- package/.agents/skills/maestro-ralph-beta/SKILL.md +861 -872
- package/.agents/skills/maestro-ralph-execute/SKILL.md +234 -234
- package/.agents/skills/maestro-roadmap/SKILL.md +159 -172
- package/.agents/skills/maestro-swarm-workflow/SKILL.md +229 -250
- package/.agents/skills/maestro-tools-execute/SKILL.md +108 -103
- package/.agents/skills/maestro-tools-register/SKILL.md +148 -143
- package/.agents/skills/maestro-ui-codify/SKILL.md +103 -86
- package/.agents/skills/maestro-universal-workflow/SKILL.md +534 -547
- package/.agents/skills/maestro-update/SKILL.md +109 -106
- package/.agents/skills/manage-codebase-rebuild/SKILL.md +73 -71
- package/.agents/skills/manage-harvest/SKILL.md +83 -81
- package/.agents/skills/manage-issue/SKILL.md +59 -60
- package/.agents/skills/manage-issue-discover/SKILL.md +70 -68
- package/.agents/skills/manage-kg-extractors/SKILL.md +130 -0
- package/.agents/skills/manage-knowhow/SKILL.md +70 -66
- package/.agents/skills/manage-knowhow-capture/SKILL.md +79 -69
- package/.agents/skills/manage-knowledge-audit/SKILL.md +91 -74
- package/.agents/skills/manage-status/SKILL.md +52 -42
- package/.agents/skills/manage-wiki/SKILL.md +69 -58
- package/.agents/skills/odyssey-debug/SKILL.md +445 -459
- package/.agents/skills/odyssey-improve/SKILL.md +477 -491
- package/.agents/skills/odyssey-planex/SKILL.md +576 -587
- package/.agents/skills/odyssey-review-test-fix/SKILL.md +400 -413
- package/.agents/skills/odyssey-ui/SKILL.md +431 -448
- package/.agents/skills/quality-auto-test/SKILL.md +140 -123
- package/.agents/skills/quality-debug/SKILL.md +145 -106
- package/.agents/skills/quality-refactor/SKILL.md +91 -53
- package/.agents/skills/quality-retrospective/SKILL.md +109 -63
- package/.agents/skills/quality-review/SKILL.md +141 -114
- package/.agents/skills/quality-sync/SKILL.md +74 -38
- package/.agents/skills/quality-test/SKILL.md +133 -103
- package/.agents/skills/security-audit/SKILL.md +217 -166
- package/.agents/skills/spec-add/SKILL.md +66 -59
- package/.agents/skills/spec-load/SKILL.md +68 -68
- package/.agents/skills/spec-remove/SKILL.md +42 -42
- package/.agents/skills/spec-setup/SKILL.md +38 -41
- package/.agy/skills/learn-follow/SKILL.md +114 -114
- package/.agy/skills/learn-investigate/SKILL.md +138 -139
- package/.agy/skills/learn-second-opinion/SKILL.md +105 -109
- package/.agy/skills/maestro/SKILL.md +2 -10
- package/.agy/skills/maestro-amend/SKILL.md +152 -152
- package/.agy/skills/maestro-analyze/SKILL.md +201 -252
- package/.agy/skills/maestro-blueprint/SKILL.md +175 -190
- package/.agy/skills/maestro-brainstorm/SKILL.md +196 -200
- package/.agy/skills/maestro-collab/SKILL.md +159 -159
- package/.agy/skills/maestro-companion/SKILL.md +517 -517
- package/.agy/skills/maestro-composer/SKILL.md +173 -164
- package/.agy/skills/maestro-execute/SKILL.md +169 -170
- package/.agy/skills/maestro-fork/SKILL.md +97 -96
- package/.agy/skills/maestro-grill/SKILL.md +161 -162
- package/.agy/skills/maestro-guard/SKILL.md +93 -92
- package/.agy/skills/maestro-impeccable/SKILL.md +296 -253
- package/.agy/skills/maestro-init/SKILL.md +117 -118
- package/.agy/skills/maestro-merge/SKILL.md +73 -66
- package/.agy/skills/maestro-milestone-audit/SKILL.md +4 -10
- package/.agy/skills/maestro-milestone-complete/SKILL.md +6 -7
- package/.agy/skills/maestro-milestone-release/SKILL.md +122 -131
- package/.agy/skills/maestro-next/SKILL.md +241 -245
- package/.agy/skills/maestro-overlay/SKILL.md +176 -166
- package/.agy/skills/maestro-plan/SKILL.md +211 -197
- package/.agy/skills/maestro-player/SKILL.md +167 -167
- package/.agy/skills/maestro-quick/SKILL.md +69 -63
- package/.agy/skills/maestro-ralph/SKILL.md +2 -36
- package/.agy/skills/maestro-ralph-beta/SKILL.md +861 -872
- package/.agy/skills/maestro-ralph-execute/SKILL.md +234 -234
- package/.agy/skills/maestro-roadmap/SKILL.md +159 -172
- package/.agy/skills/maestro-swarm-workflow/SKILL.md +229 -250
- package/.agy/skills/maestro-tools-execute/SKILL.md +108 -103
- package/.agy/skills/maestro-tools-register/SKILL.md +148 -143
- package/.agy/skills/maestro-ui-codify/SKILL.md +103 -86
- package/.agy/skills/maestro-universal-workflow/SKILL.md +534 -547
- package/.agy/skills/maestro-update/SKILL.md +109 -106
- package/.agy/skills/manage-codebase-rebuild/SKILL.md +73 -71
- package/.agy/skills/manage-harvest/SKILL.md +83 -81
- package/.agy/skills/manage-issue/SKILL.md +59 -60
- package/.agy/skills/manage-issue-discover/SKILL.md +70 -68
- package/.agy/skills/manage-kg-extractors/SKILL.md +130 -0
- package/.agy/skills/manage-knowhow/SKILL.md +70 -66
- package/.agy/skills/manage-knowhow-capture/SKILL.md +79 -69
- package/.agy/skills/manage-knowledge-audit/SKILL.md +91 -74
- package/.agy/skills/manage-status/SKILL.md +52 -42
- package/.agy/skills/manage-wiki/SKILL.md +69 -58
- package/.agy/skills/odyssey-debug/SKILL.md +445 -459
- package/.agy/skills/odyssey-improve/SKILL.md +477 -491
- package/.agy/skills/odyssey-planex/SKILL.md +576 -587
- package/.agy/skills/odyssey-review-test-fix/SKILL.md +400 -413
- package/.agy/skills/odyssey-ui/SKILL.md +431 -448
- package/.agy/skills/quality-auto-test/SKILL.md +140 -123
- package/.agy/skills/quality-debug/SKILL.md +145 -106
- package/.agy/skills/quality-refactor/SKILL.md +91 -53
- package/.agy/skills/quality-retrospective/SKILL.md +109 -63
- package/.agy/skills/quality-review/SKILL.md +141 -114
- package/.agy/skills/quality-sync/SKILL.md +74 -38
- package/.agy/skills/quality-test/SKILL.md +133 -103
- package/.agy/skills/security-audit/SKILL.md +217 -166
- package/.agy/skills/spec-add/SKILL.md +66 -59
- package/.agy/skills/spec-load/SKILL.md +68 -68
- package/.agy/skills/spec-remove/SKILL.md +42 -42
- package/.agy/skills/spec-setup/SKILL.md +38 -41
- package/.claude/commands/learn-follow.md +127 -127
- package/.claude/commands/learn-investigate.md +151 -152
- package/.claude/commands/learn-second-opinion.md +118 -122
- package/.claude/commands/maestro-amend.md +164 -164
- package/.claude/commands/maestro-analyze.md +215 -266
- package/.claude/commands/maestro-blueprint.md +189 -204
- package/.claude/commands/maestro-brainstorm.md +209 -213
- package/.claude/commands/maestro-collab.md +172 -172
- package/.claude/commands/maestro-companion.md +531 -531
- package/.claude/commands/maestro-composer.md +188 -179
- package/.claude/commands/maestro-execute.md +183 -184
- package/.claude/commands/maestro-fork.md +111 -110
- package/.claude/commands/maestro-grill.md +175 -176
- package/.claude/commands/maestro-guard.md +103 -102
- package/.claude/commands/maestro-impeccable.md +311 -268
- package/.claude/commands/maestro-init.md +130 -131
- package/.claude/commands/maestro-merge.md +87 -80
- package/.claude/commands/maestro-milestone-audit.md +4 -10
- package/.claude/commands/maestro-milestone-complete.md +6 -7
- package/.claude/commands/maestro-milestone-release.md +136 -145
- package/.claude/commands/maestro-next.md +253 -257
- package/.claude/commands/maestro-overlay.md +188 -178
- package/.claude/commands/maestro-plan.md +225 -211
- package/.claude/commands/maestro-player.md +182 -182
- package/.claude/commands/maestro-quick.md +83 -77
- package/.claude/commands/maestro-ralph-beta.md +875 -886
- package/.claude/commands/maestro-ralph-execute.md +247 -247
- package/.claude/commands/maestro-ralph.md +2 -36
- package/.claude/commands/maestro-roadmap.md +173 -186
- package/.claude/commands/maestro-swarm-workflow.md +243 -264
- package/.claude/commands/maestro-tools-execute.md +122 -117
- package/.claude/commands/maestro-tools-register.md +162 -157
- package/.claude/commands/maestro-ui-codify.md +117 -100
- package/.claude/commands/maestro-universal-workflow.md +548 -561
- package/.claude/commands/maestro-update.md +122 -119
- package/.claude/commands/maestro.md +2 -10
- package/.claude/commands/manage-codebase-rebuild.md +87 -85
- package/.claude/commands/manage-harvest.md +97 -95
- package/.claude/commands/manage-issue-discover.md +83 -81
- package/.claude/commands/manage-issue.md +72 -73
- package/.claude/commands/manage-kg-extractors.md +128 -0
- package/.claude/commands/manage-knowhow-capture.md +92 -82
- package/.claude/commands/manage-knowhow.md +83 -79
- package/.claude/commands/manage-knowledge-audit.md +105 -88
- package/.claude/commands/manage-status.md +62 -52
- package/.claude/commands/manage-wiki.md +82 -71
- package/.claude/commands/odyssey-debug.md +459 -473
- package/.claude/commands/odyssey-improve.md +491 -505
- package/.claude/commands/odyssey-planex.md +590 -601
- package/.claude/commands/odyssey-review-test-fix.md +414 -427
- package/.claude/commands/odyssey-ui.md +445 -462
- package/.claude/commands/quality-auto-test.md +153 -136
- package/.claude/commands/quality-debug.md +159 -120
- package/.claude/commands/quality-refactor.md +105 -67
- package/.claude/commands/quality-retrospective.md +123 -77
- package/.claude/commands/quality-review.md +155 -128
- package/.claude/commands/quality-sync.md +88 -52
- package/.claude/commands/quality-test.md +147 -117
- package/.claude/commands/security-audit.md +230 -179
- package/.claude/commands/spec-add.md +77 -70
- package/.claude/commands/spec-load.md +78 -78
- package/.claude/commands/spec-remove.md +55 -55
- package/.claude/commands/spec-setup.md +49 -52
- package/dist/src/cli.js +1 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/kg.d.ts.map +1 -1
- package/dist/src/commands/kg.js +11 -5
- package/dist/src/commands/kg.js.map +1 -1
- package/dist/src/graph/kg/extraction/code/code-extractor.d.ts +2 -0
- package/dist/src/graph/kg/extraction/code/code-extractor.d.ts.map +1 -1
- package/dist/src/graph/kg/extraction/code/code-extractor.js +32 -3
- package/dist/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
- package/dist/src/graph/kg/extraction/code/plugin-engine.d.ts +35 -0
- package/dist/src/graph/kg/extraction/code/plugin-engine.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/plugin-engine.js +573 -0
- package/dist/src/graph/kg/extraction/code/plugin-engine.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/plugin-types.d.ts +95 -0
- package/dist/src/graph/kg/extraction/code/plugin-types.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/plugin-types.js +5 -0
- package/dist/src/graph/kg/extraction/code/plugin-types.js.map +1 -0
- package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -1
- package/dist/src/graph/kg/extraction/orchestrator.js +17 -5
- package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
- package/dist/src/graph/kg/schema.sql +16 -11
- package/dist/src/graph/kg/surface/cli.d.ts.map +1 -1
- package/dist/src/graph/kg/surface/cli.js +153 -56
- package/dist/src/graph/kg/surface/cli.js.map +1 -1
- package/dist/src/hooks/workspace.d.ts +4 -2
- package/dist/src/hooks/workspace.d.ts.map +1 -1
- package/dist/src/hooks/workspace.js +6 -2
- package/dist/src/hooks/workspace.js.map +1 -1
- package/package.json +91 -91
- package/workflows/analyze.md +25 -49
- package/workflows/auto-test.md +699 -699
- package/workflows/blueprint.md +403 -431
- package/workflows/brainstorm.md +54 -195
- package/workflows/business-test.md +570 -570
- package/workflows/claude-instructions.md +23 -51
- package/workflows/codex-instructions.md +27 -77
- package/workflows/coding-philosophy.md +69 -69
- package/workflows/command-authoring.md +823 -823
- package/workflows/debug.md +43 -98
- package/workflows/delegate-usage.md +39 -241
- package/workflows/execute.md +4 -53
- package/workflows/grill.md +12 -56
- package/workflows/harvest.md +22 -68
- package/workflows/init.md +148 -148
- package/workflows/instruction-authoring-guide.md +97 -0
- package/workflows/issue-execute.md +110 -110
- package/workflows/issue-gaps-analyze.codex.md +260 -260
- package/workflows/issue-gaps-analyze.md +216 -216
- package/workflows/issue-plan.md +110 -110
- package/workflows/issue.md +338 -346
- package/workflows/knowhow.md +0 -32
- package/workflows/learn.md +277 -277
- package/workflows/maestro-chain-execute.md +20 -20
- package/workflows/refactor.md +22 -44
- package/workflows/retrospective.md +16 -65
- package/workflows/review.md +446 -486
- package/workflows/roadmap.md +35 -132
- package/workflows/skill-authoring.md +265 -265
- package/workflows/spec-generate.md +470 -470
- package/workflows/specs-remove.md +104 -104
- package/workflows/sync.md +11 -41
- package/workflows/test-gen.md +226 -226
- package/workflows/test.md +385 -475
- package/workflows/ui-design.md +391 -391
- package/workflows/ui-style.md +199 -199
- package/workflows/wiki-connect.md +151 -151
- package/workflows/wiki-digest.md +178 -178
- package/workflows/wiki-manage.md +109 -109
- package/workflows/cli-tools-usage.md +0 -252
- package/workflows/delegate-protocol.codex.md +0 -65
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Language } from '../../db/types.js';
|
|
2
|
+
import type { ExtractedSymbol, ExtractedReference } from './tree-sitter-types.js';
|
|
3
|
+
export interface ExtractorPluginConfig {
|
|
4
|
+
version: 1;
|
|
5
|
+
defaults?: PluginDefaults;
|
|
6
|
+
plugins: PluginDefinition[];
|
|
7
|
+
}
|
|
8
|
+
export interface PluginDefaults {
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
onError?: 'warn' | 'fail';
|
|
11
|
+
conflictPolicy?: ConflictPolicy;
|
|
12
|
+
}
|
|
13
|
+
export type ConflictPolicy = 'core-wins' | 'plugin-wins' | 'merge-metadata';
|
|
14
|
+
export interface PluginDefinition {
|
|
15
|
+
id: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
languages: (Language | 'all')[];
|
|
19
|
+
filePatterns?: string[];
|
|
20
|
+
excludePatterns?: string[];
|
|
21
|
+
priority?: number;
|
|
22
|
+
mode: 'declarative' | 'script';
|
|
23
|
+
declarative?: DeclarativeSpec;
|
|
24
|
+
script?: ScriptSpec;
|
|
25
|
+
}
|
|
26
|
+
export interface DeclarativeSpec {
|
|
27
|
+
rules: PatternRule[];
|
|
28
|
+
}
|
|
29
|
+
export interface PatternRule {
|
|
30
|
+
id: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
match: PatternMatch;
|
|
33
|
+
extract: ExtractSpec;
|
|
34
|
+
}
|
|
35
|
+
export type PatternMatchType = 'call' | 'assignment' | 'regex';
|
|
36
|
+
export type PatternScope = 'module' | 'class' | 'any';
|
|
37
|
+
export interface PatternMatch {
|
|
38
|
+
type: PatternMatchType;
|
|
39
|
+
pattern: string;
|
|
40
|
+
nameRegex?: string;
|
|
41
|
+
scope?: PatternScope;
|
|
42
|
+
}
|
|
43
|
+
export interface ExtractSpec {
|
|
44
|
+
kind: string;
|
|
45
|
+
name?: string;
|
|
46
|
+
qualifiedName?: string;
|
|
47
|
+
signature?: string;
|
|
48
|
+
visibility?: string;
|
|
49
|
+
isExported?: boolean;
|
|
50
|
+
isStatic?: boolean;
|
|
51
|
+
decorators?: string[];
|
|
52
|
+
metadata?: Record<string, string | boolean | number>;
|
|
53
|
+
}
|
|
54
|
+
export interface ScriptSpec {
|
|
55
|
+
module: string;
|
|
56
|
+
export?: string;
|
|
57
|
+
timeoutMs?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface PluginExtractionResult {
|
|
60
|
+
symbols: PluginExtractedSymbol[];
|
|
61
|
+
references?: ExtractedReference[];
|
|
62
|
+
edges?: Array<{
|
|
63
|
+
source: string;
|
|
64
|
+
target: string;
|
|
65
|
+
kind: string;
|
|
66
|
+
line?: number;
|
|
67
|
+
col?: number;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
export interface PluginExtractedSymbol extends ExtractedSymbol {
|
|
71
|
+
pluginMetadata?: Record<string, unknown>;
|
|
72
|
+
sourcePluginId?: string;
|
|
73
|
+
sourceRuleId?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface PluginContext {
|
|
76
|
+
filePath: string;
|
|
77
|
+
language: Language;
|
|
78
|
+
sourceCode: string;
|
|
79
|
+
tree: unknown;
|
|
80
|
+
findAll(nodeType: string): AstNodeView[];
|
|
81
|
+
text(startLine: number, endLine: number): string;
|
|
82
|
+
makeSymbol(input: Partial<PluginExtractedSymbol>): PluginExtractedSymbol;
|
|
83
|
+
}
|
|
84
|
+
export interface AstNodeView {
|
|
85
|
+
type: string;
|
|
86
|
+
text: string;
|
|
87
|
+
startLine: number;
|
|
88
|
+
endLine: number;
|
|
89
|
+
startColumn: number;
|
|
90
|
+
endColumn: number;
|
|
91
|
+
children: AstNodeView[];
|
|
92
|
+
namedChildren: AstNodeView[];
|
|
93
|
+
childForFieldName(name: string): AstNodeView | null;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=plugin-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-types.d.ts","sourceRoot":"","sources":["../../../../../../src/graph/kg/extraction/code/plugin-types.ts"],"names":[],"mappings":"A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xB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAMD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,CAAC;IACzC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACjD,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CAAC;CAC1E;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,aAAa,EAAE,WAAW,EAAE,CAAC;IAC7B,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;CACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-types.js","sourceRoot":"","sources":["../../../../../../src/graph/kg/extraction/code/plugin-types.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,6CAA6C;AAC7C,4DAA4D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../../../src/graph/kg/extraction/orchestrator.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE7D,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;CAAE,GACnD,OAAO,CAAC,UAAU,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../../../src/graph/kg/extraction/orchestrator.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE7D,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;CAAE,GACnD,OAAO,CAAC,UAAU,EAAE,CAAC,CA+NvB"}
|
|
@@ -139,12 +139,13 @@ export async function syncKnowledgeGraph(projectPath, options) {
|
|
|
139
139
|
if (shouldSync('codegraph')) {
|
|
140
140
|
const startMs = Date.now();
|
|
141
141
|
const removedCode = queries.deleteNodesBySourceType('codegraph');
|
|
142
|
-
const
|
|
143
|
-
const srcDirs =
|
|
142
|
+
const preferredDirs = ['src', 'lib', 'app', 'packages', 'apps', 'dashboard/src'];
|
|
143
|
+
const srcDirs = preferredDirs
|
|
144
144
|
.map(d => resolve(projectPath, d))
|
|
145
145
|
.filter(d => existsSync(d));
|
|
146
|
-
if (srcDirs.length === 0)
|
|
147
|
-
srcDirs.push(
|
|
146
|
+
if (srcDirs.length === 0) {
|
|
147
|
+
srcDirs.push(projectPath);
|
|
148
|
+
}
|
|
148
149
|
let totalNodes = 0;
|
|
149
150
|
let totalEdges = 0;
|
|
150
151
|
for (const srcDir of srcDirs) {
|
|
@@ -152,12 +153,23 @@ export async function syncKnowledgeGraph(projectPath, options) {
|
|
|
152
153
|
continue;
|
|
153
154
|
const codeResult = await extractCode({
|
|
154
155
|
srcDir,
|
|
156
|
+
projectRoot: projectPath,
|
|
155
157
|
includeTests: false,
|
|
156
158
|
maxFileSize: 500 * 1024,
|
|
157
159
|
});
|
|
158
160
|
for (const result of codeResult.results) {
|
|
159
161
|
if (result.nodes.length > 0) {
|
|
160
|
-
|
|
162
|
+
try {
|
|
163
|
+
mg.insertExtractionResults(result);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// FK or unique constraint — insert nodes only, skip edges
|
|
167
|
+
try {
|
|
168
|
+
mg.getQueryBuilder().insertNodes(result.nodes);
|
|
169
|
+
mg.getQueryBuilder().upsertFile(result.fileRecord);
|
|
170
|
+
}
|
|
171
|
+
catch { /* skip this file entirely */ }
|
|
172
|
+
}
|
|
161
173
|
}
|
|
162
174
|
}
|
|
163
175
|
totalNodes += codeResult.stats.nodesCreated;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../../../../src/graph/kg/extraction/orchestrator.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,2DAA2D;AAE3D,OAAO,EAAE,OAAO,EAAQ,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAG5E,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,WAAmB,EACnB,OAAoD;IAEpD,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACvD,MAAM,OAAO,GAAiB,EAAE,CAAC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EAAE,aAAa,CAAC,UAAU;SACrC,CAAC,CAAC;QAEH,kEAAkE;QAClE,IAAI,CAAC;YACH,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;YAC5E,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC;YAC3D,MAAM,gBAAgB,GAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YAC1F,MAAM,cAAc,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,OAAO,CACnD,oDAAoD,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,uCAAuC,CACrI,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAwC,CAAC;YAClE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACzB,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;gBAClC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,uEAAuE;QACzE,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -151,13 +151,14 @@ CREATE INDEX IF NOT EXISTS idx_unresolved_from_name ON unresolved_refs(from_node
|
|
|
151
151
|
-- knowledge_fts 使用 trigram (支持 CJK 子串匹配)
|
|
152
152
|
-- ============================================================================
|
|
153
153
|
|
|
154
|
-
-- 代码 FTS5
|
|
154
|
+
-- 代码 FTS5 (keywords 列存放 camelCase 分词,unicode61 自动按 JSON 标点拆分)
|
|
155
155
|
CREATE VIRTUAL TABLE IF NOT EXISTS code_fts USING fts5(
|
|
156
156
|
id,
|
|
157
157
|
name,
|
|
158
158
|
qualified_name,
|
|
159
159
|
docstring,
|
|
160
160
|
signature,
|
|
161
|
+
keywords,
|
|
161
162
|
tokenize = 'unicode61 remove_diacritics 2',
|
|
162
163
|
content = 'nodes',
|
|
163
164
|
content_rowid = 'rowid'
|
|
@@ -178,8 +179,8 @@ CREATE VIRTUAL TABLE IF NOT EXISTS knowledge_fts USING fts5(
|
|
|
178
179
|
|
|
179
180
|
-- FTS5 同步触发器 — 按 source_type 路由到不同索引 (D3.4: 移除 NULL 分支)
|
|
180
181
|
CREATE TRIGGER IF NOT EXISTS nodes_ai AFTER INSERT ON nodes BEGIN
|
|
181
|
-
INSERT INTO code_fts(rowid, id, name, qualified_name, docstring, signature)
|
|
182
|
-
SELECT NEW.rowid, NEW.id, NEW.name, NEW.qualified_name, NEW.docstring, NEW.signature
|
|
182
|
+
INSERT INTO code_fts(rowid, id, name, qualified_name, docstring, signature, keywords)
|
|
183
|
+
SELECT NEW.rowid, NEW.id, NEW.name, NEW.qualified_name, NEW.docstring, NEW.signature, NEW.keywords
|
|
183
184
|
WHERE NEW.source_type = 'codegraph';
|
|
184
185
|
|
|
185
186
|
INSERT INTO knowledge_fts(rowid, id, name, definition, body, aliases, keywords)
|
|
@@ -188,22 +189,26 @@ CREATE TRIGGER IF NOT EXISTS nodes_ai AFTER INSERT ON nodes BEGIN
|
|
|
188
189
|
END;
|
|
189
190
|
|
|
190
191
|
CREATE TRIGGER IF NOT EXISTS nodes_ad AFTER DELETE ON nodes BEGIN
|
|
191
|
-
INSERT INTO code_fts(code_fts, rowid, id, name, qualified_name, docstring, signature)
|
|
192
|
-
|
|
192
|
+
INSERT INTO code_fts(code_fts, rowid, id, name, qualified_name, docstring, signature, keywords)
|
|
193
|
+
SELECT 'delete', OLD.rowid, OLD.id, OLD.name, OLD.qualified_name, OLD.docstring, OLD.signature, OLD.keywords
|
|
194
|
+
WHERE OLD.source_type = 'codegraph';
|
|
193
195
|
|
|
194
196
|
INSERT INTO knowledge_fts(knowledge_fts, rowid, id, name, definition, body, aliases, keywords)
|
|
195
|
-
|
|
197
|
+
SELECT 'delete', OLD.rowid, OLD.id, OLD.name, OLD.definition, OLD.body, OLD.aliases, OLD.keywords
|
|
198
|
+
WHERE OLD.source_type != 'codegraph';
|
|
196
199
|
END;
|
|
197
200
|
|
|
198
201
|
CREATE TRIGGER IF NOT EXISTS nodes_au AFTER UPDATE ON nodes BEGIN
|
|
199
|
-
INSERT INTO code_fts(code_fts, rowid, id, name, qualified_name, docstring, signature)
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
INSERT INTO code_fts(code_fts, rowid, id, name, qualified_name, docstring, signature, keywords)
|
|
203
|
+
SELECT 'delete', OLD.rowid, OLD.id, OLD.name, OLD.qualified_name, OLD.docstring, OLD.signature, OLD.keywords
|
|
204
|
+
WHERE OLD.source_type = 'codegraph';
|
|
205
|
+
INSERT INTO code_fts(rowid, id, name, qualified_name, docstring, signature, keywords)
|
|
206
|
+
SELECT NEW.rowid, NEW.id, NEW.name, NEW.qualified_name, NEW.docstring, NEW.signature, NEW.keywords
|
|
203
207
|
WHERE NEW.source_type = 'codegraph';
|
|
204
208
|
|
|
205
209
|
INSERT INTO knowledge_fts(knowledge_fts, rowid, id, name, definition, body, aliases, keywords)
|
|
206
|
-
|
|
210
|
+
SELECT 'delete', OLD.rowid, OLD.id, OLD.name, OLD.definition, OLD.body, OLD.aliases, OLD.keywords
|
|
211
|
+
WHERE OLD.source_type != 'codegraph';
|
|
207
212
|
INSERT INTO knowledge_fts(rowid, id, name, definition, body, aliases, keywords)
|
|
208
213
|
SELECT NEW.rowid, NEW.id, NEW.name, NEW.definition, NEW.body, NEW.aliases, NEW.keywords
|
|
209
214
|
WHERE NEW.source_type != 'codegraph';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../../src/graph/kg/surface/cli.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../../src/graph/kg/surface/cli.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsFzC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqiBzD"}
|
|
@@ -7,6 +7,65 @@ import { parseQuery } from '../query/search.js';
|
|
|
7
7
|
import { findShortestPath } from '../query/traversal.js';
|
|
8
8
|
import { syncKnowledgeGraph } from '../extraction/orchestrator.js';
|
|
9
9
|
import { getKgDatabasePath } from '../db/connection.js';
|
|
10
|
+
function parseCsv(value) {
|
|
11
|
+
return value
|
|
12
|
+
? value.split(',').map((s) => s.trim()).filter(Boolean)
|
|
13
|
+
: undefined;
|
|
14
|
+
}
|
|
15
|
+
function normalizeSources(value) {
|
|
16
|
+
return parseCsv(value);
|
|
17
|
+
}
|
|
18
|
+
function printSyncResults(results) {
|
|
19
|
+
let totalNodes = 0;
|
|
20
|
+
let totalEdges = 0;
|
|
21
|
+
for (const r of results) {
|
|
22
|
+
totalNodes += r.nodesAdded;
|
|
23
|
+
totalEdges += r.edgesAdded;
|
|
24
|
+
console.log(` ${r.source}: +${r.nodesAdded} nodes, +${r.edgesAdded} edges (${r.durationMs}ms)`);
|
|
25
|
+
}
|
|
26
|
+
console.log(`\nTotal: ${totalNodes} nodes, ${totalEdges} edges`);
|
|
27
|
+
}
|
|
28
|
+
async function syncProject(opts, label = 'Syncing MaestroGraph...') {
|
|
29
|
+
const projectRoot = resolve('.');
|
|
30
|
+
const sources = normalizeSources(opts.source);
|
|
31
|
+
if (!opts.json)
|
|
32
|
+
console.log(label);
|
|
33
|
+
const results = await syncKnowledgeGraph(projectRoot, {
|
|
34
|
+
full: opts.full,
|
|
35
|
+
sources,
|
|
36
|
+
});
|
|
37
|
+
if (opts.json) {
|
|
38
|
+
console.log(JSON.stringify(results, null, 2));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
printSyncResults(results);
|
|
42
|
+
}
|
|
43
|
+
async function openGraph() {
|
|
44
|
+
const projectRoot = resolve('.');
|
|
45
|
+
if (!MaestroGraph.isInitialized(projectRoot)) {
|
|
46
|
+
console.error('MaestroGraph not initialized for this project.');
|
|
47
|
+
console.error(' Run: maestro kg sync');
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
return MaestroGraph.open(projectRoot);
|
|
51
|
+
}
|
|
52
|
+
function formatNodeLabel(node) {
|
|
53
|
+
const loc = node.filePath ? ` ${node.filePath}:${node.startLine}` : '';
|
|
54
|
+
const detail = node.signature || node.definition;
|
|
55
|
+
const suffix = detail ? ` -- ${detail.substring(0, 80)}` : '';
|
|
56
|
+
return `[${node.sourceType}:${node.kind}] ${node.name}${loc}${suffix}`;
|
|
57
|
+
}
|
|
58
|
+
function resolveNodeOrExit(mg, query) {
|
|
59
|
+
const direct = mg.getNode(query);
|
|
60
|
+
if (direct)
|
|
61
|
+
return direct;
|
|
62
|
+
const matches = mg.searchUnified(query, { sourceTypes: ['codegraph'], limit: 5 }).directMatches;
|
|
63
|
+
if (matches.length === 0) {
|
|
64
|
+
console.error(`Node not found: ${query}`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
return matches[0].node;
|
|
68
|
+
}
|
|
10
69
|
// ---------------------------------------------------------------------------
|
|
11
70
|
// 注册 maestro kg 子命令
|
|
12
71
|
// ---------------------------------------------------------------------------
|
|
@@ -36,22 +95,20 @@ export function registerKgCommands(program) {
|
|
|
36
95
|
.option('--full', 'Full rebuild (ignore file hashes)')
|
|
37
96
|
.option('--source <sources>', 'Comma-separated sources: domain,spec,knowhow,codebase,issue,codegraph')
|
|
38
97
|
.option('--json', 'Output as JSON')
|
|
39
|
-
.action(async (opts) =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
});
|
|
98
|
+
.action(async (opts) => syncProject(opts));
|
|
99
|
+
kg
|
|
100
|
+
.command('sync-all')
|
|
101
|
+
.description('Compatibility alias for sync — sync all MaestroGraph sources')
|
|
102
|
+
.option('--full', 'Full rebuild (ignore file hashes)')
|
|
103
|
+
.option('--source <sources>', 'Comma-separated sources: domain,spec,knowhow,codebase,issue,codegraph')
|
|
104
|
+
.option('--json', 'Output as JSON')
|
|
105
|
+
.action(async (opts) => syncProject(opts, 'Syncing MaestroGraph (all knowledge sources)...'));
|
|
106
|
+
kg
|
|
107
|
+
.command('index')
|
|
108
|
+
.description('Compatibility alias for sync --source codegraph')
|
|
109
|
+
.option('--src <path>', 'Accepted for compatibility; MaestroGraph auto-detects source roots')
|
|
110
|
+
.option('--json', 'Output as JSON')
|
|
111
|
+
.action(async (opts) => syncProject({ source: 'codegraph', json: opts.json }, 'Indexing code with MaestroGraph...'));
|
|
55
112
|
// ── query ─────────────────────────────────────────────────────────
|
|
56
113
|
kg
|
|
57
114
|
.command('query <text>')
|
|
@@ -94,21 +151,54 @@ export function registerKgCommands(program) {
|
|
|
94
151
|
mg.close();
|
|
95
152
|
}
|
|
96
153
|
});
|
|
154
|
+
kg
|
|
155
|
+
.command('search <text>')
|
|
156
|
+
.description('Compatibility alias for query')
|
|
157
|
+
.option('--source <types>', 'Filter by source type (comma-separated)')
|
|
158
|
+
.option('--kind <types>', 'Filter by node kind')
|
|
159
|
+
.option('--limit <n>', 'Max results', '20')
|
|
160
|
+
.option('--json', 'Output as JSON')
|
|
161
|
+
.action(async (text, opts) => {
|
|
162
|
+
const mg = await openGraph();
|
|
163
|
+
try {
|
|
164
|
+
const parsed = parseQuery(text);
|
|
165
|
+
const sourceTypes = parseCsv(opts.source) ?? (parsed.sourceTypes.length > 0 ? parsed.sourceTypes : undefined);
|
|
166
|
+
const kinds = parseCsv(opts.kind) ?? (parsed.kinds.length > 0 ? parsed.kinds : undefined);
|
|
167
|
+
const effectiveText = parsed.text || text;
|
|
168
|
+
const output = mg.searchUnified(effectiveText, {
|
|
169
|
+
sourceTypes: sourceTypes,
|
|
170
|
+
kinds,
|
|
171
|
+
limit: Math.min(Number(opts.limit) || 20, 500),
|
|
172
|
+
});
|
|
173
|
+
if (opts.json) {
|
|
174
|
+
console.log(JSON.stringify({
|
|
175
|
+
query: text,
|
|
176
|
+
total: output.directMatches.length,
|
|
177
|
+
nodes: output.directMatches.map(r => ({ ...r.node, score: r.score })),
|
|
178
|
+
engine: 'maestrograph',
|
|
179
|
+
}, null, 2));
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
console.log(`Search: "${effectiveText}" (${output.directMatches.length} results, MaestroGraph)`);
|
|
183
|
+
for (const r of output.directMatches) {
|
|
184
|
+
console.log(` ${r.node.id} ${formatNodeLabel(r.node)} (${r.score.toFixed(1)})`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
mg.close();
|
|
189
|
+
}
|
|
190
|
+
});
|
|
97
191
|
// ── context ───────────────────────────────────────────────────────
|
|
98
192
|
kg
|
|
99
|
-
.command('context <node
|
|
100
|
-
.description('Show full context for a node (all related layers)')
|
|
193
|
+
.command('context <node>')
|
|
194
|
+
.description('Show full context for a node id or symbol name (all related layers)')
|
|
101
195
|
.option('--depth <n>', 'Graph traversal depth', '1')
|
|
102
196
|
.option('--json', 'Output as JSON')
|
|
103
|
-
.action(async (
|
|
104
|
-
const mg = await
|
|
197
|
+
.action(async (nodeQuery, opts) => {
|
|
198
|
+
const mg = await openGraph();
|
|
105
199
|
try {
|
|
106
|
-
const node = mg
|
|
107
|
-
|
|
108
|
-
console.error(`Node not found: ${nodeId}`);
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
const traversal = mg.traverse(nodeId, {
|
|
200
|
+
const node = resolveNodeOrExit(mg, nodeQuery);
|
|
201
|
+
const traversal = mg.traverse(node.id, {
|
|
112
202
|
maxDepth: Math.min(Number(opts.depth) || 1, 10),
|
|
113
203
|
});
|
|
114
204
|
if (opts.json) {
|
|
@@ -118,9 +208,12 @@ export function registerKgCommands(program) {
|
|
|
118
208
|
id: n.id, kind: n.kind, name: n.name, sourceType: n.sourceType,
|
|
119
209
|
})),
|
|
120
210
|
edges: traversal.edges,
|
|
211
|
+
resolvedFrom: nodeQuery,
|
|
121
212
|
}, null, 2));
|
|
122
213
|
return;
|
|
123
214
|
}
|
|
215
|
+
if (node.id !== nodeQuery)
|
|
216
|
+
console.log(`Resolved "${nodeQuery}" -> ${node.id}`);
|
|
124
217
|
console.log(`Node: [${node.sourceType}:${node.kind}] ${node.name}`);
|
|
125
218
|
if (node.definition)
|
|
126
219
|
console.log(` Definition: ${node.definition}`);
|
|
@@ -129,7 +222,7 @@ export function registerKgCommands(program) {
|
|
|
129
222
|
if (traversal.nodes.size > 1) {
|
|
130
223
|
console.log(`\nRelated (${traversal.nodes.size - 1}):`);
|
|
131
224
|
for (const [id, related] of traversal.nodes) {
|
|
132
|
-
if (id ===
|
|
225
|
+
if (id === node.id)
|
|
133
226
|
continue;
|
|
134
227
|
console.log(` [${related.sourceType}:${related.kind}] ${related.name}`);
|
|
135
228
|
}
|
|
@@ -171,23 +264,24 @@ export function registerKgCommands(program) {
|
|
|
171
264
|
});
|
|
172
265
|
// ── callers ───────────────────────────────────────────────────────
|
|
173
266
|
kg
|
|
174
|
-
.command('callers <node
|
|
175
|
-
.description('Show callers of a function/method')
|
|
267
|
+
.command('callers <node>')
|
|
268
|
+
.description('Show callers of a function/method by node id or symbol name')
|
|
176
269
|
.option('--depth <n>', 'Traversal depth', '1')
|
|
177
270
|
.option('--json', 'Output as JSON')
|
|
178
|
-
.action(async (
|
|
179
|
-
const mg = await
|
|
271
|
+
.action(async (nodeQuery, opts) => {
|
|
272
|
+
const mg = await openGraph();
|
|
180
273
|
try {
|
|
181
|
-
const
|
|
274
|
+
const node = resolveNodeOrExit(mg, nodeQuery);
|
|
275
|
+
const callers = mg.getCallers(node.id, Math.min(Number(opts.depth) || 1, 10));
|
|
182
276
|
if (opts.json) {
|
|
183
|
-
console.log(JSON.stringify(callers.map(c => ({
|
|
184
|
-
|
|
185
|
-
|
|
277
|
+
console.log(JSON.stringify({ node: node.id, callers: callers.map(c => ({
|
|
278
|
+
id: c.node.id, name: c.node.name, kind: c.node.kind, edgeKind: c.edge.kind,
|
|
279
|
+
})) }, null, 2));
|
|
186
280
|
return;
|
|
187
281
|
}
|
|
188
|
-
console.log(`Callers of ${
|
|
282
|
+
console.log(`Callers of ${node.id} (${callers.length}):`);
|
|
189
283
|
for (const { node, edge } of callers) {
|
|
190
|
-
console.log(`
|
|
284
|
+
console.log(` ${formatNodeLabel(node)} --${edge.kind}-->`);
|
|
191
285
|
}
|
|
192
286
|
}
|
|
193
287
|
finally {
|
|
@@ -196,23 +290,24 @@ export function registerKgCommands(program) {
|
|
|
196
290
|
});
|
|
197
291
|
// ── callees ───────────────────────────────────────────────────────
|
|
198
292
|
kg
|
|
199
|
-
.command('callees <node
|
|
200
|
-
.description('Show callees of a function/method')
|
|
293
|
+
.command('callees <node>')
|
|
294
|
+
.description('Show callees of a function/method by node id or symbol name')
|
|
201
295
|
.option('--depth <n>', 'Traversal depth', '1')
|
|
202
296
|
.option('--json', 'Output as JSON')
|
|
203
|
-
.action(async (
|
|
204
|
-
const mg = await
|
|
297
|
+
.action(async (nodeQuery, opts) => {
|
|
298
|
+
const mg = await openGraph();
|
|
205
299
|
try {
|
|
206
|
-
const
|
|
300
|
+
const node = resolveNodeOrExit(mg, nodeQuery);
|
|
301
|
+
const callees = mg.getCallees(node.id, Math.min(Number(opts.depth) || 1, 10));
|
|
207
302
|
if (opts.json) {
|
|
208
|
-
console.log(JSON.stringify(callees.map(c => ({
|
|
209
|
-
|
|
210
|
-
|
|
303
|
+
console.log(JSON.stringify({ node: node.id, callees: callees.map(c => ({
|
|
304
|
+
id: c.node.id, name: c.node.name, kind: c.node.kind, edgeKind: c.edge.kind,
|
|
305
|
+
})) }, null, 2));
|
|
211
306
|
return;
|
|
212
307
|
}
|
|
213
|
-
console.log(`Callees of ${
|
|
308
|
+
console.log(`Callees of ${node.id} (${callees.length}):`);
|
|
214
309
|
for (const { node, edge } of callees) {
|
|
215
|
-
console.log(` --${edge.kind}-->
|
|
310
|
+
console.log(` --${edge.kind}--> ${formatNodeLabel(node)}`);
|
|
216
311
|
}
|
|
217
312
|
}
|
|
218
313
|
finally {
|
|
@@ -221,27 +316,29 @@ export function registerKgCommands(program) {
|
|
|
221
316
|
});
|
|
222
317
|
// ── impact ────────────────────────────────────────────────────────
|
|
223
318
|
kg
|
|
224
|
-
.command('impact <node
|
|
225
|
-
.description('Show transitive impact radius')
|
|
319
|
+
.command('impact <node>')
|
|
320
|
+
.description('Show transitive impact radius by node id or symbol name')
|
|
226
321
|
.option('--depth <n>', 'Max depth', '3')
|
|
227
322
|
.option('--json', 'Output as JSON')
|
|
228
|
-
.action(async (
|
|
229
|
-
const mg = await
|
|
323
|
+
.action(async (nodeQuery, opts) => {
|
|
324
|
+
const mg = await openGraph();
|
|
230
325
|
try {
|
|
231
|
-
const
|
|
326
|
+
const node = resolveNodeOrExit(mg, nodeQuery);
|
|
327
|
+
const impact = mg.getImpact(node.id, Math.min(Number(opts.depth) || 3, 10));
|
|
232
328
|
if (opts.json) {
|
|
233
329
|
console.log(JSON.stringify({
|
|
330
|
+
node: node.id,
|
|
234
331
|
nodeCount: impact.nodes.size,
|
|
235
332
|
edgeCount: impact.edges.length,
|
|
236
333
|
nodes: [...impact.nodes.values()].map(n => ({ id: n.id, kind: n.kind, name: n.name })),
|
|
237
334
|
}, null, 2));
|
|
238
335
|
return;
|
|
239
336
|
}
|
|
240
|
-
console.log(`Impact radius for ${
|
|
241
|
-
for (const
|
|
242
|
-
if (
|
|
337
|
+
console.log(`Impact radius for ${node.id}: ${impact.nodes.size} nodes, ${impact.edges.length} edges`);
|
|
338
|
+
for (const related of impact.nodes.values()) {
|
|
339
|
+
if (related.id === node.id)
|
|
243
340
|
continue;
|
|
244
|
-
console.log(`
|
|
341
|
+
console.log(` ${formatNodeLabel(related)}`);
|
|
245
342
|
}
|
|
246
343
|
}
|
|
247
344
|
finally {
|