ai-spector 0.4.6 → 0.4.7
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/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/prototype.d.ts +1 -0
- package/dist/commands/prototype.d.ts.map +1 -1
- package/dist/commands/prototype.js +15 -8
- package/dist/commands/prototype.js.map +1 -1
- package/dist/prototype/build-manifest.d.ts +2 -0
- package/dist/prototype/build-manifest.d.ts.map +1 -1
- package/dist/prototype/build-manifest.js +17 -1
- package/dist/prototype/build-manifest.js.map +1 -1
- package/dist/prototype/config.d.ts +2 -1
- package/dist/prototype/config.d.ts.map +1 -1
- package/dist/prototype/config.js +20 -17
- package/dist/prototype/config.js.map +1 -1
- package/dist/prototype/resolve-default-screen.d.ts +17 -0
- package/dist/prototype/resolve-default-screen.d.ts.map +1 -0
- package/dist/prototype/resolve-default-screen.js +31 -0
- package/dist/prototype/resolve-default-screen.js.map +1 -0
- package/dist/prototype/types.d.ts +4 -0
- package/dist/prototype/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/scaffold/cursor/skills/ai-spector-generate-prototype/references/auth-picker.md +3 -3
- package/scaffold/cursor/skills/ai-spector-generate-prototype/references/runbook.md +8 -0
- package/dist/commands/graphify-update.d.ts +0 -18
- package/dist/commands/graphify-update.d.ts.map +0 -1
- package/dist/commands/graphify-update.js +0 -187
- package/dist/commands/graphify-update.js.map +0 -1
- package/dist/commands/index-refresh.d.ts +0 -22
- package/dist/commands/index-refresh.d.ts.map +0 -1
- package/dist/commands/index-refresh.js +0 -315
- package/dist/commands/index-refresh.js.map +0 -1
- package/dist/graphify/graph-index.d.ts +0 -28
- package/dist/graphify/graph-index.d.ts.map +0 -1
- package/dist/graphify/graph-index.js +0 -52
- package/dist/graphify/graph-index.js.map +0 -1
- package/dist/graphify/sources.d.ts +0 -49
- package/dist/graphify/sources.d.ts.map +0 -1
- package/dist/graphify/sources.js +0 -205
- package/dist/graphify/sources.js.map +0 -1
- package/dist/postinstall.d.ts +0 -3
- package/dist/postinstall.d.ts.map +0 -1
- package/dist/postinstall.js +0 -44
- package/dist/postinstall.js.map +0 -1
- package/dist/util/mcp.d.ts +0 -16
- package/dist/util/mcp.d.ts.map +0 -1
- package/dist/util/mcp.js +0 -41
- package/dist/util/mcp.js.map +0 -1
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
import { rm } from "node:fs/promises";
|
|
3
|
-
import { join, resolve } from "node:path";
|
|
4
|
-
import { loadDocflowConfig } from "../config/load.js";
|
|
5
|
-
import { filterSourcesByHashChange, getGraphifySourceSkipReason, isGraphifyNoCodeFilesOutput, resolveGraphifyOutputPath, resolveGraphifySources, } from "../graphify/sources.js";
|
|
6
|
-
import { pathExists, readJson, writeJson } from "../util/fs.js";
|
|
7
|
-
function skipReasonMessage(reason) {
|
|
8
|
-
switch (reason) {
|
|
9
|
-
case "empty":
|
|
10
|
-
return "empty";
|
|
11
|
-
case "no-code-files":
|
|
12
|
-
return "no code files to index";
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function runCommand(command, args, cwd, env) {
|
|
16
|
-
return new Promise((resolvePromise, reject) => {
|
|
17
|
-
const child = spawn(command, args, {
|
|
18
|
-
cwd,
|
|
19
|
-
env,
|
|
20
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
21
|
-
});
|
|
22
|
-
let stdout = "";
|
|
23
|
-
let stderr = "";
|
|
24
|
-
child.stdout?.on("data", (chunk) => {
|
|
25
|
-
stdout += chunk.toString();
|
|
26
|
-
});
|
|
27
|
-
child.stderr?.on("data", (chunk) => {
|
|
28
|
-
stderr += chunk.toString();
|
|
29
|
-
});
|
|
30
|
-
child.on("error", reject);
|
|
31
|
-
child.on("close", (code) => {
|
|
32
|
-
resolvePromise({
|
|
33
|
-
exitCode: code ?? 1,
|
|
34
|
-
stdout,
|
|
35
|
-
stderr,
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
async function runGraphifyCli(args, cwd, env) {
|
|
41
|
-
try {
|
|
42
|
-
const direct = await runCommand("graphify", args, cwd, env);
|
|
43
|
-
return { ...direct, command: `graphify ${args.join(" ")}` };
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
const uvArgs = ["tool", "run", "--from", "graphifyy", "graphify", ...args];
|
|
47
|
-
const viaUv = await runCommand("uv", uvArgs, cwd, env);
|
|
48
|
-
return { ...viaUv, command: `uv ${uvArgs.join(" ")}` };
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export async function runGraphifyUpdate(opts = {}) {
|
|
52
|
-
const { root: projectRoot } = await loadDocflowConfig(opts.root);
|
|
53
|
-
const configPath = join(projectRoot, ".ai-spector/.docflow/config/analyze.graphify.json");
|
|
54
|
-
const config = await readJson(configPath);
|
|
55
|
-
const g = config.graphify ?? {};
|
|
56
|
-
const outputPath = resolveGraphifyOutputPath(projectRoot, g.outputPath);
|
|
57
|
-
const statePath = join(projectRoot, ".ai-spector/.docflow/state.json");
|
|
58
|
-
const state = await readJson(statePath).catch(() => ({
|
|
59
|
-
version: 1,
|
|
60
|
-
graphify: {},
|
|
61
|
-
}));
|
|
62
|
-
const graphifyState = state.graphify ?? {};
|
|
63
|
-
const storedHashes = graphifyState.sourceHashes;
|
|
64
|
-
let specs = resolveGraphifySources(g);
|
|
65
|
-
if (opts.sourcePath) {
|
|
66
|
-
specs = [{ path: opts.sourcePath, key: opts.sourcePath }];
|
|
67
|
-
}
|
|
68
|
-
const { toRun, hashes } = await filterSourcesByHashChange(projectRoot, specs, storedHashes, opts.force === true);
|
|
69
|
-
const sourcesRun = [];
|
|
70
|
-
const sourcesEmptySkipped = [];
|
|
71
|
-
const sourcesNoCodeSkipped = [];
|
|
72
|
-
const sourcesSkipped = specs
|
|
73
|
-
.filter((s) => !toRun.some((r) => r.key === s.key))
|
|
74
|
-
.map((s) => s.path);
|
|
75
|
-
if (toRun.length === 0) {
|
|
76
|
-
console.log("Graphify update: all sources unchanged (use --force to re-index)");
|
|
77
|
-
for (const s of specs) {
|
|
78
|
-
console.log(` ○ ${s.path} (hash ${hashes[s.key] ?? "—"})`);
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
sourcesRun,
|
|
82
|
-
sourcesSkipped,
|
|
83
|
-
sourcesEmptySkipped,
|
|
84
|
-
sourcesNoCodeSkipped,
|
|
85
|
-
sourceHashes: hashes,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
const env = {
|
|
89
|
-
...process.env,
|
|
90
|
-
GRAPHIFY_OUT: outputPath,
|
|
91
|
-
};
|
|
92
|
-
console.log(`Graphify update (${toRun.length} source(s), ${sourcesSkipped.length} unchanged)`);
|
|
93
|
-
console.log(` cwd → ${projectRoot}`);
|
|
94
|
-
console.log(` GRAPHIFY_OUT → ${outputPath}`);
|
|
95
|
-
console.log(" (do not pass --graph to graphify update — use GRAPHIFY_OUT instead)");
|
|
96
|
-
console.log("");
|
|
97
|
-
for (const spec of toRun) {
|
|
98
|
-
const sourcePath = resolve(projectRoot, spec.path);
|
|
99
|
-
if (!(await pathExists(sourcePath))) {
|
|
100
|
-
console.log(` ⊘ skip ${spec.path} (not found)`);
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
const skipReason = await getGraphifySourceSkipReason(projectRoot, spec.path);
|
|
104
|
-
if (skipReason) {
|
|
105
|
-
console.log(` ⊘ skip ${spec.path} (${skipReasonMessage(skipReason)})`);
|
|
106
|
-
if (skipReason === "empty") {
|
|
107
|
-
sourcesEmptySkipped.push(spec.path);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
sourcesNoCodeSkipped.push(spec.path);
|
|
111
|
-
}
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
console.log(` ▶ ${spec.path} (hash ${hashes[spec.key] ?? "—"})`);
|
|
115
|
-
const result = await runGraphifyCli(["update", spec.path], projectRoot, env);
|
|
116
|
-
if (result.stdout.trim()) {
|
|
117
|
-
console.log(result.stdout.trimEnd());
|
|
118
|
-
}
|
|
119
|
-
if (result.stderr.trim()) {
|
|
120
|
-
console.error(result.stderr.trimEnd());
|
|
121
|
-
}
|
|
122
|
-
if (isGraphifyNoCodeFilesOutput(result.stdout, result.stderr, result.exitCode)) {
|
|
123
|
-
console.log(` ⊘ skip ${spec.path} (no code files to index)`);
|
|
124
|
-
sourcesNoCodeSkipped.push(spec.path);
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
if (result.exitCode !== 0) {
|
|
128
|
-
console.error("");
|
|
129
|
-
console.error(`Failed: ${result.command} (exit ${result.exitCode})`);
|
|
130
|
-
throw new Error(`graphify update failed for ${spec.path} (exit ${result.exitCode})`);
|
|
131
|
-
}
|
|
132
|
-
sourcesRun.push(spec.path);
|
|
133
|
-
}
|
|
134
|
-
const graphJson = join(outputPath, "graph.json");
|
|
135
|
-
const graphJsonExists = await pathExists(graphJson);
|
|
136
|
-
const allConfiguredSourcesSkipped = sourcesRun.length === 0 &&
|
|
137
|
-
toRun.length > 0 &&
|
|
138
|
-
sourcesEmptySkipped.length + sourcesNoCodeSkipped.length === toRun.length;
|
|
139
|
-
if (!graphJsonExists && !allConfiguredSourcesSkipped) {
|
|
140
|
-
throw new Error(`Expected graph.json at ${g.graphJsonPath ?? graphJson} after update — check Graphify install (graphify or uv + graphifyy)`);
|
|
141
|
-
}
|
|
142
|
-
const primaryRel = g.defaultDataSource ?? "docs/data-source";
|
|
143
|
-
const primaryAbs = resolve(projectRoot, primaryRel);
|
|
144
|
-
const staleDirs = [
|
|
145
|
-
join(primaryAbs, "graphify-out"),
|
|
146
|
-
join(primaryAbs, ".ai-spector", ".docflow", "graph", "graphify-out"),
|
|
147
|
-
];
|
|
148
|
-
for (const staleOut of staleDirs) {
|
|
149
|
-
if (opts.removeStaleOutput !== false && (await pathExists(staleOut))) {
|
|
150
|
-
await rm(staleOut, { recursive: true, force: true });
|
|
151
|
-
const rel = staleOut.startsWith(projectRoot)
|
|
152
|
-
? staleOut.slice(projectRoot.length + 1)
|
|
153
|
-
: staleOut;
|
|
154
|
-
console.log("");
|
|
155
|
-
console.log(`Removed stale ${rel}/ (GRAPHIFY_OUT was relative to source path)`);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
graphifyState.lastRunAt = new Date().toISOString();
|
|
159
|
-
graphifyState.sourceHashes = hashes;
|
|
160
|
-
graphifyState.sourcesRun = sourcesRun;
|
|
161
|
-
state.graphify = graphifyState;
|
|
162
|
-
await writeJson(statePath, state);
|
|
163
|
-
console.log("");
|
|
164
|
-
if (graphJsonExists) {
|
|
165
|
-
console.log(`OK — ${g.graphJsonPath ?? ".ai-spector/.docflow/graph/graphify-out/graph.json"}`);
|
|
166
|
-
}
|
|
167
|
-
else if (allConfiguredSourcesSkipped) {
|
|
168
|
-
console.log("OK — no Graphify-indexable sources found; graph.json not generated");
|
|
169
|
-
}
|
|
170
|
-
if (sourcesEmptySkipped.length > 0) {
|
|
171
|
-
console.log(`Skipped (empty): ${sourcesEmptySkipped.join(", ")}`);
|
|
172
|
-
}
|
|
173
|
-
if (sourcesNoCodeSkipped.length > 0) {
|
|
174
|
-
console.log(`Skipped (no code files): ${sourcesNoCodeSkipped.join(", ")}`);
|
|
175
|
-
}
|
|
176
|
-
if (sourcesSkipped.length > 0) {
|
|
177
|
-
console.log(`Skipped (unchanged): ${sourcesSkipped.join(", ")}`);
|
|
178
|
-
}
|
|
179
|
-
return {
|
|
180
|
-
sourcesRun,
|
|
181
|
-
sourcesSkipped,
|
|
182
|
-
sourcesEmptySkipped,
|
|
183
|
-
sourcesNoCodeSkipped,
|
|
184
|
-
sourceHashes: hashes,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
//# sourceMappingURL=graphify-update.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphify-update.js","sourceRoot":"","sources":["../../src/commands/graphify-update.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I,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,wBAAwB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,OAAO;QACL,UAAU;QACV,cAAc;QACd,mBAAmB;QACnB,oBAAoB;QACpB,YAAY,EAAE,MAAM;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type IndexStepStatus = "ok" | "skipped" | "failed";
|
|
2
|
-
export interface IndexStepResult {
|
|
3
|
-
id: string;
|
|
4
|
-
label: string;
|
|
5
|
-
status: IndexStepStatus;
|
|
6
|
-
detail?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface IndexRefreshOptions {
|
|
9
|
-
root?: string;
|
|
10
|
-
graphOnly?: boolean;
|
|
11
|
-
docsOnly?: boolean;
|
|
12
|
-
skipGraphify?: boolean;
|
|
13
|
-
skipDocs?: boolean;
|
|
14
|
-
skipMerge?: boolean;
|
|
15
|
-
skipValidate?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface IndexRefreshReport {
|
|
18
|
-
steps: IndexStepResult[];
|
|
19
|
-
failed: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare function runIndexRefresh(opts?: IndexRefreshOptions): Promise<IndexRefreshReport>;
|
|
22
|
-
//# sourceMappingURL=index-refresh.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-refresh.d.ts","sourceRoot":"","sources":["../../src/commands/index-refresh.ts"],"names":[],"mappings":"AA4BA,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,eAAe,CACnC,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CA+R7B"}
|
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import { buildSectionRegistry } from "../registry/build.js";
|
|
4
|
-
import { bootstrapFromRegistry } from "./bootstrap.js";
|
|
5
|
-
import { validateGraph, formatIssues } from "./validate.js";
|
|
6
|
-
import { runGraphMerge } from "./graph-merge.js";
|
|
7
|
-
import { runGraphifyUpdate } from "./graphify-update.js";
|
|
8
|
-
import { resolveProjectPaths } from "../util/paths.js";
|
|
9
|
-
import { pathExists, readJson, writeJson } from "../util/fs.js";
|
|
10
|
-
import { loadDocflowConfig } from "../config/load.js";
|
|
11
|
-
import { knowledgeHasDomainEntries, isKnowledgePayload, } from "../graph/knowledge.js";
|
|
12
|
-
import { computeKnowledgeStats } from "../visualize/stats.js";
|
|
13
|
-
import { loadInMemoryGraph } from "../graph/loadGraph.js";
|
|
14
|
-
import { indexDocsConfigPath, } from "../index/docs-config.js";
|
|
15
|
-
import { buildDocIndex, computeIndexSourceHash, discoverMarkdownFiles, } from "../index/docs-build.js";
|
|
16
|
-
export async function runIndexRefresh(opts = {}) {
|
|
17
|
-
const paths = await resolveProjectPaths(opts.root);
|
|
18
|
-
const { root: projectRoot } = await loadDocflowConfig(opts.root);
|
|
19
|
-
const steps = [];
|
|
20
|
-
let failed = false;
|
|
21
|
-
const record = (step) => {
|
|
22
|
-
steps.push(step);
|
|
23
|
-
if (step.status === "failed") {
|
|
24
|
-
failed = true;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const graphOnly = opts.graphOnly === true;
|
|
28
|
-
const docsOnly = opts.docsOnly === true;
|
|
29
|
-
if (graphOnly && docsOnly) {
|
|
30
|
-
throw new Error("Use only one of --graph-only or --docs-only");
|
|
31
|
-
}
|
|
32
|
-
const runGraph = !docsOnly;
|
|
33
|
-
const runDocs = !graphOnly && !opts.skipDocs;
|
|
34
|
-
const runGraphify = runGraph && !graphOnly && !opts.skipGraphify;
|
|
35
|
-
let graphJson = null;
|
|
36
|
-
if (runGraph) {
|
|
37
|
-
try {
|
|
38
|
-
const registry = await buildSectionRegistry(projectRoot);
|
|
39
|
-
await writeJson(paths.registry, registry);
|
|
40
|
-
const total = registry.documents.reduce((n, d) => n + d.sections.length, 0);
|
|
41
|
-
const graph = bootstrapFromRegistry(registry);
|
|
42
|
-
await writeJson(paths.graph, graph.toTraceabilityGraph());
|
|
43
|
-
graphJson = graph.toTraceabilityGraph();
|
|
44
|
-
const statePath = join(projectRoot, ".ai-spector/.docflow/state.json");
|
|
45
|
-
const state = await readJson(statePath).catch(() => ({
|
|
46
|
-
version: 1,
|
|
47
|
-
analysis: {},
|
|
48
|
-
index: {},
|
|
49
|
-
}));
|
|
50
|
-
const analysis = state.analysis ?? {};
|
|
51
|
-
analysis.graphPreparedAt = new Date().toISOString();
|
|
52
|
-
analysis.indexRefreshedAt = new Date().toISOString();
|
|
53
|
-
state.analysis = analysis;
|
|
54
|
-
await writeJson(statePath, state);
|
|
55
|
-
record({
|
|
56
|
-
id: "graph-structure",
|
|
57
|
-
label: "Traceability graph structure",
|
|
58
|
-
status: "ok",
|
|
59
|
-
detail: `${registry.documents.length} documents, ${total} sections → ${paths.graph}`,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
record({
|
|
64
|
-
id: "graph-structure",
|
|
65
|
-
label: "Traceability graph structure",
|
|
66
|
-
status: "failed",
|
|
67
|
-
detail: err instanceof Error ? err.message : String(err),
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (!opts.skipMerge && !failed) {
|
|
71
|
-
const knowledgePath = join(projectRoot, ".ai-spector/.docflow/analysis/knowledge.json");
|
|
72
|
-
try {
|
|
73
|
-
if (!(await pathExists(knowledgePath))) {
|
|
74
|
-
record({
|
|
75
|
-
id: "knowledge-merge",
|
|
76
|
-
label: "Knowledge → graph merge",
|
|
77
|
-
status: "skipped",
|
|
78
|
-
detail: `No ${knowledgePath} — run /analyze in Cursor to extract knowledge first`,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
const raw = await readJson(knowledgePath);
|
|
83
|
-
if (!isKnowledgePayload(raw) || !knowledgeHasDomainEntries(raw)) {
|
|
84
|
-
record({
|
|
85
|
-
id: "knowledge-merge",
|
|
86
|
-
label: "Knowledge → graph merge",
|
|
87
|
-
status: "skipped",
|
|
88
|
-
detail: "knowledge.json has no domain entries yet",
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
await runGraphMerge({
|
|
93
|
-
root: projectRoot,
|
|
94
|
-
fromKnowledge: true,
|
|
95
|
-
graphPath: paths.graph,
|
|
96
|
-
validate: false,
|
|
97
|
-
});
|
|
98
|
-
graphJson = await readJson(paths.graph);
|
|
99
|
-
const ks = computeKnowledgeStats(raw);
|
|
100
|
-
record({
|
|
101
|
-
id: "knowledge-merge",
|
|
102
|
-
label: "Knowledge → graph merge",
|
|
103
|
-
status: "ok",
|
|
104
|
-
detail: `${ks.useCases} use cases, ${ks.features} features, ${ks.actors} actors merged`,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
record({
|
|
111
|
-
id: "knowledge-merge",
|
|
112
|
-
label: "Knowledge → graph merge",
|
|
113
|
-
status: "failed",
|
|
114
|
-
detail: err instanceof Error ? err.message : String(err),
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
else if (opts.skipMerge) {
|
|
119
|
-
record({
|
|
120
|
-
id: "knowledge-merge",
|
|
121
|
-
label: "Knowledge → graph merge",
|
|
122
|
-
status: "skipped",
|
|
123
|
-
detail: "--skip-merge",
|
|
124
|
-
});
|
|
125
|
-
if (!failed) {
|
|
126
|
-
try {
|
|
127
|
-
graphJson = (await loadInMemoryGraph(paths.graph)).toTraceabilityGraph();
|
|
128
|
-
}
|
|
129
|
-
catch {
|
|
130
|
-
graphJson = null;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (runGraphify && !failed) {
|
|
135
|
-
try {
|
|
136
|
-
await runGraphifyUpdate({ root: projectRoot });
|
|
137
|
-
record({
|
|
138
|
-
id: "graphify-storage",
|
|
139
|
-
label: "Graphify index & graph.json",
|
|
140
|
-
status: "ok",
|
|
141
|
-
detail: ".ai-spector/.docflow/graph/graphify-out/",
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
catch (err) {
|
|
145
|
-
record({
|
|
146
|
-
id: "graphify-storage",
|
|
147
|
-
label: "Graphify index & graph.json",
|
|
148
|
-
status: "failed",
|
|
149
|
-
detail: (err instanceof Error ? err.message : String(err)) +
|
|
150
|
-
" (retry with graphify installed, or use --skip-graphify)",
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
else if (!runGraphify) {
|
|
155
|
-
record({
|
|
156
|
-
id: "graphify-storage",
|
|
157
|
-
label: "Graphify index & graph.json",
|
|
158
|
-
status: "skipped",
|
|
159
|
-
detail: opts.skipGraphify ? "--skip-graphify" : "graph-only / docs-only",
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
if (!opts.skipValidate && !failed) {
|
|
163
|
-
try {
|
|
164
|
-
const issues = await validateGraph({
|
|
165
|
-
graphPath: paths.graph,
|
|
166
|
-
schemaPath: paths.schema,
|
|
167
|
-
registryPath: paths.registry,
|
|
168
|
-
rulesPath: paths.rulesTraceability,
|
|
169
|
-
});
|
|
170
|
-
const errors = issues.filter((i) => i.severity === "error");
|
|
171
|
-
if (errors.length > 0) {
|
|
172
|
-
record({
|
|
173
|
-
id: "graph-validate",
|
|
174
|
-
label: "Graph validate",
|
|
175
|
-
status: "failed",
|
|
176
|
-
detail: formatIssues(errors).trim(),
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
const warns = issues.filter((i) => i.severity === "warn").length;
|
|
181
|
-
record({
|
|
182
|
-
id: "graph-validate",
|
|
183
|
-
label: "Graph validate",
|
|
184
|
-
status: "ok",
|
|
185
|
-
detail: warns > 0 ? `OK (${warns} warnings)` : "OK",
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
catch (err) {
|
|
190
|
-
record({
|
|
191
|
-
id: "graph-validate",
|
|
192
|
-
label: "Graph validate",
|
|
193
|
-
status: "failed",
|
|
194
|
-
detail: err instanceof Error ? err.message : String(err),
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
record({
|
|
200
|
-
id: "graph-validate",
|
|
201
|
-
label: "Graph validate",
|
|
202
|
-
status: "skipped",
|
|
203
|
-
detail: opts.skipValidate ? "--skip-validate" : "prior step failed",
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (runDocs) {
|
|
208
|
-
const configPath = indexDocsConfigPath(projectRoot);
|
|
209
|
-
try {
|
|
210
|
-
if (!(await pathExists(configPath))) {
|
|
211
|
-
record({
|
|
212
|
-
id: "docs-index",
|
|
213
|
-
label: "Document indexes (.ai-spector/index/)",
|
|
214
|
-
status: "skipped",
|
|
215
|
-
detail: `Missing ${configPath} — run ai-spector init`,
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
const config = await readJson(configPath);
|
|
220
|
-
if (!graphJson) {
|
|
221
|
-
try {
|
|
222
|
-
graphJson = (await loadInMemoryGraph(paths.graph)).toTraceabilityGraph();
|
|
223
|
-
}
|
|
224
|
-
catch {
|
|
225
|
-
graphJson = null;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
const indexedAt = new Date().toISOString();
|
|
229
|
-
const hashes = {};
|
|
230
|
-
for (const kind of ["srs", "basicDesign"]) {
|
|
231
|
-
const sourceKey = kind === "srs" ? "srs" : "basicDesign";
|
|
232
|
-
const source = config.sources[sourceKey];
|
|
233
|
-
if (!source) {
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
const files = await discoverMarkdownFiles(projectRoot, source.root, source.glob ?? "**/*.md");
|
|
237
|
-
hashes[sourceKey] = computeIndexSourceHash(files);
|
|
238
|
-
const built = await buildDocIndex({
|
|
239
|
-
kind,
|
|
240
|
-
config,
|
|
241
|
-
projectRoot,
|
|
242
|
-
files,
|
|
243
|
-
graph: graphJson,
|
|
244
|
-
indexedAt,
|
|
245
|
-
});
|
|
246
|
-
const outPath = join(projectRoot, config.outputs[sourceKey]);
|
|
247
|
-
await mkdir(dirname(outPath), { recursive: true });
|
|
248
|
-
await writeFile(outPath, built.markdown, "utf8");
|
|
249
|
-
}
|
|
250
|
-
const statePath = join(projectRoot, ".ai-spector/.docflow/state.json");
|
|
251
|
-
const state = await readJson(statePath).catch(() => ({
|
|
252
|
-
version: 1,
|
|
253
|
-
index: {},
|
|
254
|
-
}));
|
|
255
|
-
const indexState = state.index ?? {};
|
|
256
|
-
indexState.lastRunAt = indexedAt;
|
|
257
|
-
indexState.sourceHashes = hashes;
|
|
258
|
-
state.index = indexState;
|
|
259
|
-
await writeJson(statePath, state);
|
|
260
|
-
record({
|
|
261
|
-
id: "docs-index",
|
|
262
|
-
label: "Document indexes (.ai-spector/index/)",
|
|
263
|
-
status: "ok",
|
|
264
|
-
detail: `srs hash ${hashes.srs ?? "—"}, basic-design hash ${hashes.basicDesign ?? "—"}`,
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
catch (err) {
|
|
269
|
-
record({
|
|
270
|
-
id: "docs-index",
|
|
271
|
-
label: "Document indexes (.ai-spector/index/)",
|
|
272
|
-
status: "failed",
|
|
273
|
-
detail: err instanceof Error ? err.message : String(err),
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
record({
|
|
279
|
-
id: "docs-index",
|
|
280
|
-
label: "Document indexes (.ai-spector/index/)",
|
|
281
|
-
status: "skipped",
|
|
282
|
-
detail: graphOnly || opts.skipDocs ? "--graph-only or --skip-docs" : "docs-only graph skipped",
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
printIndexSummary(steps, failed);
|
|
286
|
-
if (failed) {
|
|
287
|
-
const first = steps.find((s) => s.status === "failed");
|
|
288
|
-
throw new Error(`Index refresh incomplete${first ? ` (${first.label})` : ""}. Fix errors above and re-run: ai-spector index`);
|
|
289
|
-
}
|
|
290
|
-
return { steps, failed };
|
|
291
|
-
}
|
|
292
|
-
function printIndexSummary(steps, failed) {
|
|
293
|
-
console.log("");
|
|
294
|
-
console.log("Index refresh summary");
|
|
295
|
-
console.log("─────────────────────");
|
|
296
|
-
for (const s of steps) {
|
|
297
|
-
const icon = s.status === "ok" ? "✓" : s.status === "skipped" ? "○" : "✗";
|
|
298
|
-
console.log(` ${icon} ${s.label}: ${s.status}`);
|
|
299
|
-
if (s.detail) {
|
|
300
|
-
for (const line of s.detail.split("\n")) {
|
|
301
|
-
console.log(` ${line}`);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
console.log("");
|
|
306
|
-
if (failed) {
|
|
307
|
-
console.log("Some steps failed. Graph/knowledge may be partially updated.");
|
|
308
|
-
console.log("Re-run after fixing, or use flags: --skip-graphify, --skip-merge, --graph-only");
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
console.log("All requested steps completed.");
|
|
312
|
-
console.log("Semantic knowledge re-extract still requires /analyze in Cursor (Graphify MCP).");
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
//# sourceMappingURL=index-refresh.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-refresh.js","sourceRoot":"","sources":["../../src/commands/index-refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,yBAAyB,EAEzB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EACL,mBAAmB,GAEpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,sBAAsB,EACt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C,IAAI,CAAC,EAAE,CAAC;gBACxC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,gFAAgF,CAAC,CAAC;IAChG,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,iFAAiF,CAAC,CAAC;IACjG,CAAC;AACH,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface GraphifyGraphNode {
|
|
2
|
-
id: string;
|
|
3
|
-
label?: string;
|
|
4
|
-
norm_label?: string;
|
|
5
|
-
source_file?: string;
|
|
6
|
-
file_type?: string;
|
|
7
|
-
community?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface GraphifyGraphFile {
|
|
10
|
-
nodes: GraphifyGraphNode[];
|
|
11
|
-
links?: Array<{
|
|
12
|
-
source: string;
|
|
13
|
-
target: string;
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
16
|
-
export interface GraphifyIndex {
|
|
17
|
-
nodes: GraphifyGraphNode[];
|
|
18
|
-
/** Repo-relative path (under data-source root) → graphify node ids in that file */
|
|
19
|
-
byRepoPath: Map<string, string[]>;
|
|
20
|
-
/** Lowercased label / norm_label → graphify node ids */
|
|
21
|
-
byLabel: Map<string, string[]>;
|
|
22
|
-
}
|
|
23
|
-
export declare function graphifyNodeTargetId(nodeId: string): string;
|
|
24
|
-
export declare function isGraphifyNodeTarget(to: string): boolean;
|
|
25
|
-
export declare function repoPathForGraphifyNode(node: GraphifyGraphNode, dataSourceRoot: string): string | undefined;
|
|
26
|
-
export declare function loadGraphifyIndex(graphJsonPath: string, dataSourceRoot: string): Promise<GraphifyIndex | null>;
|
|
27
|
-
export declare function defaultGraphifyJsonPath(projectRoot: string): string;
|
|
28
|
-
//# sourceMappingURL=graph-index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-index.d.ts","sourceRoot":"","sources":["../../src/graphify/graph-index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,mFAAmF;IACnF,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,wDAAwD;IACxD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,iBAAiB,EACvB,cAAc,EAAE,MAAM,GACrB,MAAM,GAAG,SAAS,CAUpB;AAED,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA8B/B;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAKnE"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { pathExists } from "../util/fs.js";
|
|
4
|
-
export function graphifyNodeTargetId(nodeId) {
|
|
5
|
-
return `graphify:${nodeId}`;
|
|
6
|
-
}
|
|
7
|
-
export function isGraphifyNodeTarget(to) {
|
|
8
|
-
return to.startsWith("graphify:");
|
|
9
|
-
}
|
|
10
|
-
export function repoPathForGraphifyNode(node, dataSourceRoot) {
|
|
11
|
-
const sf = node.source_file?.replace(/\\/g, "/").trim();
|
|
12
|
-
if (!sf) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
const root = dataSourceRoot.replace(/\\/g, "/").replace(/\/$/, "");
|
|
16
|
-
if (sf.startsWith("docs/")) {
|
|
17
|
-
return sf;
|
|
18
|
-
}
|
|
19
|
-
return `${root}/${sf.replace(/^\.\//, "")}`;
|
|
20
|
-
}
|
|
21
|
-
export async function loadGraphifyIndex(graphJsonPath, dataSourceRoot) {
|
|
22
|
-
if (!(await pathExists(graphJsonPath))) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
const raw = JSON.parse(await readFile(graphJsonPath, "utf8"));
|
|
26
|
-
const nodes = raw.nodes ?? [];
|
|
27
|
-
const byRepoPath = new Map();
|
|
28
|
-
const byLabel = new Map();
|
|
29
|
-
const addToMap = (map, key, id) => {
|
|
30
|
-
const list = map.get(key) ?? [];
|
|
31
|
-
if (!list.includes(id)) {
|
|
32
|
-
list.push(id);
|
|
33
|
-
map.set(key, list);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
for (const node of nodes) {
|
|
37
|
-
const path = repoPathForGraphifyNode(node, dataSourceRoot);
|
|
38
|
-
if (path) {
|
|
39
|
-
addToMap(byRepoPath, path, node.id);
|
|
40
|
-
}
|
|
41
|
-
for (const label of [node.label, node.norm_label]) {
|
|
42
|
-
if (label?.trim()) {
|
|
43
|
-
addToMap(byLabel, label.trim().toLowerCase(), node.id);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return { nodes, byRepoPath, byLabel };
|
|
48
|
-
}
|
|
49
|
-
export function defaultGraphifyJsonPath(projectRoot) {
|
|
50
|
-
return join(projectRoot, ".ai-spector/.docflow/graph/graphify-out/graph.json");
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=graph-index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-index.js","sourceRoot":"","sources":["../../src/graphify/graph-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAwB3C,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,OAAO,YAAY,MAAM,EAAE,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,EAAU;IAC7C,OAAO,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,IAAuB,EACvB,cAAsB;IAEtB,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACxD,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnE,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC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