ai-spector 0.8.5 → 0.8.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/interfaces/mcp/schemas.d.ts +27 -0
- package/dist/interfaces/mcp/schemas.d.ts.map +1 -1
- package/dist/interfaces/mcp/schemas.js +20 -0
- package/dist/interfaces/mcp/schemas.js.map +1 -1
- package/dist/interfaces/mcp/server.js +56 -3
- package/dist/interfaces/mcp/server.js.map +1 -1
- package/dist/interfaces/mcp/tools/analyze.d.ts +47 -0
- package/dist/interfaces/mcp/tools/analyze.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/analyze.js +94 -0
- package/dist/interfaces/mcp/tools/analyze.js.map +1 -0
- package/dist/interfaces/mcp/tools/cocoindex.d.ts +24 -1
- package/dist/interfaces/mcp/tools/cocoindex.d.ts.map +1 -1
- package/dist/interfaces/mcp/tools/cocoindex.js +62 -1
- package/dist/interfaces/mcp/tools/cocoindex.js.map +1 -1
- package/dist/interfaces/mcp/tools/graph.d.ts +2 -1
- package/dist/interfaces/mcp/tools/graph.d.ts.map +1 -1
- package/dist/interfaces/mcp/tools/graph.js +4 -0
- package/dist/interfaces/mcp/tools/graph.js.map +1 -1
- package/dist/interfaces/mcp/tools/lang.d.ts +21 -0
- package/dist/interfaces/mcp/tools/lang.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/lang.js +31 -0
- package/dist/interfaces/mcp/tools/lang.js.map +1 -0
- package/package.json +1 -1
- package/scaffold/claude/.claude/skills/ai-spector-graph/skill.md +42 -40
- package/scaffold/claude/.claude/skills/ai-spector-lang-status/skill.md +14 -5
- package/scaffold/claude/CLAUDE.md +35 -12
- package/scaffold/cursor/WORKFLOW.md +15 -15
- package/scaffold/cursor/skills/ai-spector/SKILL.md +30 -4
- package/scaffold/cursor/skills/ai-spector-graph/references/analyze.md +11 -2
- package/scaffold/cursor/skills/ai-spector-lang-status/SKILL.md +15 -5
- package/scaffold/cursor/skills/ai-spector-search/SKILL.md +34 -15
|
@@ -82,6 +82,12 @@ export declare const DocsSearchSchema: z.ZodObject<{
|
|
|
82
82
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
83
83
|
threshold: z.ZodOptional<z.ZodNumber>;
|
|
84
84
|
}, z.core.$strip>;
|
|
85
|
+
export declare const CocoindexStatusSchema: z.ZodObject<{
|
|
86
|
+
root: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
export declare const CocoindexIndexSchema: z.ZodObject<{
|
|
89
|
+
root: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, z.core.$strip>;
|
|
85
91
|
export declare const GraphQueryFuzzySchema: z.ZodObject<{
|
|
86
92
|
root: z.ZodOptional<z.ZodString>;
|
|
87
93
|
query: z.ZodString;
|
|
@@ -93,6 +99,27 @@ export declare const GraphQueryFuzzySchema: z.ZodObject<{
|
|
|
93
99
|
depth: z.ZodOptional<z.ZodNumber>;
|
|
94
100
|
threshold: z.ZodOptional<z.ZodNumber>;
|
|
95
101
|
}, z.core.$strip>;
|
|
102
|
+
export declare const AnalyzeSchema: z.ZodObject<{
|
|
103
|
+
root: z.ZodOptional<z.ZodString>;
|
|
104
|
+
merge: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
export declare const KnowledgeStatusSchema: z.ZodObject<{
|
|
107
|
+
root: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
export declare const KnowledgeValidateSchema: z.ZodObject<{
|
|
110
|
+
root: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
export declare const LangQueueSchema: z.ZodObject<{
|
|
113
|
+
root: z.ZodOptional<z.ZodString>;
|
|
114
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
115
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
117
|
+
pending: "pending";
|
|
118
|
+
resolved: "resolved";
|
|
119
|
+
failed: "failed";
|
|
120
|
+
all: "all";
|
|
121
|
+
}>>;
|
|
122
|
+
}, z.core.$strip>;
|
|
96
123
|
export declare const TemplateListSchema: z.ZodObject<{
|
|
97
124
|
root: z.ZodOptional<z.ZodString>;
|
|
98
125
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/interfaces/mcp/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU;;iBAErB,CAAC;AAIH,eAAO,MAAM,gBAAgB;;;;;;;;;;iBAW3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;iBAO5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;iBAAa,CAAC;AAE9C,eAAO,MAAM,gBAAgB;;;iBAK3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;iBAK5B,CAAC;AAIH,eAAO,MAAM,WAAW;;;;;;;;iBAUtB,CAAC;AAIH,eAAO,MAAM,kBAAkB;;;;;;;;iBAM7B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;iBAM9B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;iBAG7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;iBAKhC,CAAC;AAIH,eAAO,MAAM,gBAAgB;;;;;iBAe3B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAahC,CAAC;AAIH,eAAO,MAAM,kBAAkB;;iBAAa,CAAC;AAE7C,eAAO,MAAM,qBAAqB;;;iBAEhC,CAAC"}
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/interfaces/mcp/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU;;iBAErB,CAAC;AAIH,eAAO,MAAM,gBAAgB;;;;;;;;;;iBAW3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;iBAO5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;iBAAa,CAAC;AAE9C,eAAO,MAAM,gBAAgB;;;iBAK3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;iBAK5B,CAAC;AAIH,eAAO,MAAM,WAAW;;;;;;;;iBAUtB,CAAC;AAIH,eAAO,MAAM,kBAAkB;;;;;;;;iBAM7B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;iBAM9B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;iBAG7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;iBAKhC,CAAC;AAIH,eAAO,MAAM,gBAAgB;;;;;iBAe3B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;iBAAa,CAAC;AAEhD,eAAO,MAAM,oBAAoB;;iBAAa,CAAC;AAE/C,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAahC,CAAC;AAIH,eAAO,MAAM,aAAa;;;iBAKxB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;iBAAa,CAAC;AAEhD,eAAO,MAAM,uBAAuB;;iBAAa,CAAC;AAIlD,eAAO,MAAM,eAAe;;;;;;;;;;iBAO1B,CAAC;AAIH,eAAO,MAAM,kBAAkB;;iBAAa,CAAC;AAE7C,eAAO,MAAM,qBAAqB;;;iBAEhC,CAAC"}
|
|
@@ -91,6 +91,8 @@ export const DocsSearchSchema = RootSchema.extend({
|
|
|
91
91
|
.optional()
|
|
92
92
|
.describe("Minimum similarity score 0–1 (default: 0.75)"),
|
|
93
93
|
});
|
|
94
|
+
export const CocoindexStatusSchema = RootSchema;
|
|
95
|
+
export const CocoindexIndexSchema = RootSchema;
|
|
94
96
|
export const GraphQueryFuzzySchema = RootSchema.extend({
|
|
95
97
|
query: z.string().describe("Natural language description of the graph node to find"),
|
|
96
98
|
direction: z
|
|
@@ -105,6 +107,24 @@ export const GraphQueryFuzzySchema = RootSchema.extend({
|
|
|
105
107
|
.optional()
|
|
106
108
|
.describe("Minimum similarity score for node resolution (default: 0.75)"),
|
|
107
109
|
});
|
|
110
|
+
// ── Analyze / Knowledge ───────────────────────────────────────────────────────
|
|
111
|
+
export const AnalyzeSchema = RootSchema.extend({
|
|
112
|
+
merge: z
|
|
113
|
+
.boolean()
|
|
114
|
+
.optional()
|
|
115
|
+
.describe("Also merge knowledge.json into graph after prep (if knowledge.json exists)"),
|
|
116
|
+
});
|
|
117
|
+
export const KnowledgeStatusSchema = RootSchema;
|
|
118
|
+
export const KnowledgeValidateSchema = RootSchema;
|
|
119
|
+
// ── Lang queue ────────────────────────────────────────────────────────────────
|
|
120
|
+
export const LangQueueSchema = RootSchema.extend({
|
|
121
|
+
lang: z.string().optional().describe("Filter by language code (e.g. 'jp', 'vi')"),
|
|
122
|
+
limit: z.number().int().min(1).optional().describe("Max pending jobs to return (default: all)"),
|
|
123
|
+
status: z
|
|
124
|
+
.enum(["pending", "failed", "resolved", "all"])
|
|
125
|
+
.optional()
|
|
126
|
+
.describe("Which queue to read (default: pending)"),
|
|
127
|
+
});
|
|
108
128
|
// ── Template ──────────────────────────────────────────────────────────────────
|
|
109
129
|
export const TemplateListSchema = RootSchema;
|
|
110
130
|
export const TemplateInspectSchema = RootSchema.extend({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/interfaces/mcp/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iFAAiF;AAEjF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;CAC1F,CAAC,CAAC;AAEH,iFAAiF;AAEjF,MAAM,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@@
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
|
-
import { GraphQuerySchema, GraphImpactSchema, GraphValidateSchema, GraphMergeSchema, IndexSchema, CommentsListSchema, CommentsInboxSchema, CommentsShowSchema, CommentsResolveSchema, TemplateListSchema, TemplateInspectSchema, DocsSearchSchema, GraphQueryFuzzySchema, } from "./schemas.js";
|
|
6
|
-
import { toolGraphQuery, toolGraphImpact, toolGraphValidate, toolGraphMerge } from "./tools/graph.js";
|
|
5
|
+
import { GraphQuerySchema, GraphImpactSchema, GraphValidateSchema, GraphMergeSchema, GraphReportSchema, IndexSchema, AnalyzeSchema, KnowledgeStatusSchema, KnowledgeValidateSchema, LangQueueSchema, CommentsListSchema, CommentsInboxSchema, CommentsShowSchema, CommentsResolveSchema, TemplateListSchema, TemplateInspectSchema, DocsSearchSchema, GraphQueryFuzzySchema, CocoindexStatusSchema, CocoindexIndexSchema, } from "./schemas.js";
|
|
6
|
+
import { toolGraphQuery, toolGraphImpact, toolGraphValidate, toolGraphMerge, toolGraphReport } from "./tools/graph.js";
|
|
7
|
+
import { toolAnalyze, toolKnowledgeStatus, toolKnowledgeValidate } from "./tools/analyze.js";
|
|
8
|
+
import { toolLangQueue } from "./tools/lang.js";
|
|
7
9
|
import { toolIndex } from "./tools/index.js";
|
|
8
10
|
import { toolCommentsList, toolCommentsInbox, toolCommentsShow, toolCommentsResolve, } from "./tools/comments.js";
|
|
9
11
|
import { toolTemplateList, toolTemplateInspect } from "./tools/template.js";
|
|
10
|
-
import { toolDocsSearch, toolGraphQueryFuzzy } from "./tools/cocoindex.js";
|
|
12
|
+
import { toolDocsSearch, toolGraphQueryFuzzy, toolCocoindexStatus, toolCocoindexIndex } from "./tools/cocoindex.js";
|
|
11
13
|
const require = createRequire(import.meta.url);
|
|
12
14
|
const pkg = require("../../../package.json");
|
|
13
15
|
const server = new McpServer({
|
|
@@ -43,6 +45,43 @@ server.registerTool("graph_merge", {
|
|
|
43
45
|
const result = await toolGraphMerge(input);
|
|
44
46
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
45
47
|
});
|
|
48
|
+
server.registerTool("graph_report", {
|
|
49
|
+
description: "Audit graph layer health — returns provenance coverage, hub completeness, empty domain layers, and missing traceability links",
|
|
50
|
+
inputSchema: GraphReportSchema.shape,
|
|
51
|
+
}, async (input) => {
|
|
52
|
+
const result = await toolGraphReport(input);
|
|
53
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
54
|
+
});
|
|
55
|
+
// ── Analyze / Knowledge tools ─────────────────────────────────────────────────
|
|
56
|
+
server.registerTool("analyze", {
|
|
57
|
+
description: "Prepare graph scaffold from project templates — creates section/document nodes and writes the section registry. Run before entity extraction. Replaces `npx ai-spector analyze` for the structure-prep step.",
|
|
58
|
+
inputSchema: AnalyzeSchema.shape,
|
|
59
|
+
}, async (input) => {
|
|
60
|
+
const result = await toolAnalyze(input);
|
|
61
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
62
|
+
});
|
|
63
|
+
server.registerTool("knowledge_status", {
|
|
64
|
+
description: "Check whether knowledge.json is present and report entity counts (actors, useCases, features, …). Use before graph_merge to confirm extraction is complete.",
|
|
65
|
+
inputSchema: KnowledgeStatusSchema.shape,
|
|
66
|
+
}, async (input) => {
|
|
67
|
+
const result = await toolKnowledgeStatus(input);
|
|
68
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
69
|
+
});
|
|
70
|
+
server.registerTool("knowledge_validate", {
|
|
71
|
+
description: "Validate knowledge.json against schema.knowledge.json and return any errors or warnings. Run after entity extraction and before graph_merge.",
|
|
72
|
+
inputSchema: KnowledgeValidateSchema.shape,
|
|
73
|
+
}, async (input) => {
|
|
74
|
+
const result = await toolKnowledgeValidate(input);
|
|
75
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
76
|
+
});
|
|
77
|
+
// ── Lang queue tool ───────────────────────────────────────────────────────────
|
|
78
|
+
server.registerTool("lang_queue", {
|
|
79
|
+
description: "Read the translation queue — returns pending/failed/resolved jobs and summary counts. Use after doc edits or before starting translation work to see what needs updating.",
|
|
80
|
+
inputSchema: LangQueueSchema.shape,
|
|
81
|
+
}, async (input) => {
|
|
82
|
+
const result = await toolLangQueue(input);
|
|
83
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
84
|
+
});
|
|
46
85
|
// ── Index tool ────────────────────────────────────────────────────────────────
|
|
47
86
|
server.registerTool("index", {
|
|
48
87
|
description: "Re-index the project: rebuild graph structure, merge knowledge, build doc indexes",
|
|
@@ -96,6 +135,20 @@ server.registerTool("template_inspect", {
|
|
|
96
135
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
97
136
|
});
|
|
98
137
|
// ── CocoIndex tools ───────────────────────────────────────────────────────────
|
|
138
|
+
server.registerTool("cocoindex_status", {
|
|
139
|
+
description: "Check whether CocoIndex is configured and ready: Python version, dependencies installed, index built. Use to diagnose why cocoindexSync was skipped or docs_search returned no results.",
|
|
140
|
+
inputSchema: CocoindexStatusSchema.shape,
|
|
141
|
+
}, async (input) => {
|
|
142
|
+
const result = await toolCocoindexStatus(input);
|
|
143
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
144
|
+
});
|
|
145
|
+
server.registerTool("cocoindex_index", {
|
|
146
|
+
description: "Run the CocoIndex pipeline update — rebuilds semantic embeddings from project docs. Call after adding or editing doc files. Equivalent to `npx ai-spector cocoindex index`.",
|
|
147
|
+
inputSchema: CocoindexIndexSchema.shape,
|
|
148
|
+
}, async (input) => {
|
|
149
|
+
const result = await toolCocoindexIndex(input);
|
|
150
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
151
|
+
});
|
|
99
152
|
server.registerTool("docs_search", {
|
|
100
153
|
description: "Semantic search over project documentation. Returns matching sections with similarity scores and traceability graph node IDs. Requires CocoIndex to be set up (npx ai-spector cocoindex setup).",
|
|
101
154
|
inputSchema: DocsSearchSchema.shape,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/interfaces/mcp/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/interfaces/mcp/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAk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E,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAChF,CAAC,CACF,CAAC;AAEF,iFAAiF;AAEjF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AnalyzeSchema, KnowledgeStatusSchema, KnowledgeValidateSchema } from "../schemas.js";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export declare function toolAnalyze(input: z.infer<typeof AnalyzeSchema>): Promise<import("../../../core/operations/analyze.js").AnalyzePrepResult>;
|
|
4
|
+
export declare function toolKnowledgeStatus(input: z.infer<typeof KnowledgeStatusSchema>): Promise<{
|
|
5
|
+
ready: boolean;
|
|
6
|
+
knowledgeExists: boolean;
|
|
7
|
+
gapsExists: boolean;
|
|
8
|
+
scopeExists: boolean;
|
|
9
|
+
message: string;
|
|
10
|
+
lastModified?: undefined;
|
|
11
|
+
entityCounts?: undefined;
|
|
12
|
+
totalEntities?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
ready: boolean;
|
|
15
|
+
knowledgeExists: boolean;
|
|
16
|
+
gapsExists: boolean;
|
|
17
|
+
scopeExists: boolean;
|
|
18
|
+
lastModified: string;
|
|
19
|
+
entityCounts: {
|
|
20
|
+
actors: number;
|
|
21
|
+
useCases: number;
|
|
22
|
+
features: number;
|
|
23
|
+
functionalRequirements: number;
|
|
24
|
+
nonFunctionalRequirements: number;
|
|
25
|
+
dataEntities: number;
|
|
26
|
+
};
|
|
27
|
+
totalEntities: number;
|
|
28
|
+
message: string;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function toolKnowledgeValidate(input: z.infer<typeof KnowledgeValidateSchema>): Promise<{
|
|
31
|
+
valid: boolean;
|
|
32
|
+
errors: {
|
|
33
|
+
message: string;
|
|
34
|
+
path: string;
|
|
35
|
+
}[];
|
|
36
|
+
warnings: never[];
|
|
37
|
+
knowledgePath?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
valid: boolean;
|
|
40
|
+
errors: {
|
|
41
|
+
path: string;
|
|
42
|
+
message: string;
|
|
43
|
+
}[];
|
|
44
|
+
warnings: never[];
|
|
45
|
+
knowledgePath: string;
|
|
46
|
+
}>;
|
|
47
|
+
//# sourceMappingURL=analyze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/analyze.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,wBAAsB,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,4EAGrE;AAaD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;GAmDrF;AAID,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC;;;;;;;;;;;;;;;;GAyCzF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { loadDocflowConfig } from "../../../core/config/load.js";
|
|
3
|
+
import { runAnalyzePrep } from "../../../core/operations/analyze.js";
|
|
4
|
+
import { pathExists, readJson } from "../../../core/util/fs.js";
|
|
5
|
+
import { packageBundleRoot } from "../../../core/config/load.js";
|
|
6
|
+
// ── analyze ───────────────────────────────────────────────────────────────────
|
|
7
|
+
export async function toolAnalyze(input) {
|
|
8
|
+
const result = await runAnalyzePrep(input.root, { merge: input.merge });
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
export async function toolKnowledgeStatus(input) {
|
|
12
|
+
const { root: projectRoot } = await loadDocflowConfig(input.root);
|
|
13
|
+
const analysisDir = join(projectRoot, ".ai-spector/.docflow/analysis");
|
|
14
|
+
const knowledgePath = join(analysisDir, "knowledge.json");
|
|
15
|
+
const gapsPath = join(analysisDir, "gaps.json");
|
|
16
|
+
const scopePath = join(analysisDir, "scope.json");
|
|
17
|
+
const [knowledgeExists, gapsExists, scopeExists] = await Promise.all([
|
|
18
|
+
pathExists(knowledgePath),
|
|
19
|
+
pathExists(gapsPath),
|
|
20
|
+
pathExists(scopePath),
|
|
21
|
+
]);
|
|
22
|
+
if (!knowledgeExists) {
|
|
23
|
+
return {
|
|
24
|
+
ready: false,
|
|
25
|
+
knowledgeExists: false,
|
|
26
|
+
gapsExists,
|
|
27
|
+
scopeExists,
|
|
28
|
+
message: "knowledge.json not found — run 'analyze' to extract entities from data-source",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const [knowledge, knowledgeStat] = await Promise.all([
|
|
32
|
+
readJson(knowledgePath),
|
|
33
|
+
import("node:fs/promises").then((fs) => fs.stat(knowledgePath)),
|
|
34
|
+
]);
|
|
35
|
+
const counts = {
|
|
36
|
+
actors: knowledge.actors?.length ?? 0,
|
|
37
|
+
useCases: knowledge.useCases?.length ?? 0,
|
|
38
|
+
features: knowledge.features?.length ?? 0,
|
|
39
|
+
functionalRequirements: knowledge.functionalRequirements?.length ?? 0,
|
|
40
|
+
nonFunctionalRequirements: knowledge.nonFunctionalRequirements?.length ?? 0,
|
|
41
|
+
dataEntities: knowledge.dataEntities?.length ?? 0,
|
|
42
|
+
};
|
|
43
|
+
const total = Object.values(counts).reduce((a, b) => a + b, 0);
|
|
44
|
+
return {
|
|
45
|
+
ready: total > 0,
|
|
46
|
+
knowledgeExists: true,
|
|
47
|
+
gapsExists,
|
|
48
|
+
scopeExists,
|
|
49
|
+
lastModified: knowledgeStat.mtime.toISOString(),
|
|
50
|
+
entityCounts: counts,
|
|
51
|
+
totalEntities: total,
|
|
52
|
+
message: total === 0
|
|
53
|
+
? "knowledge.json exists but contains no entities — re-run analysis"
|
|
54
|
+
: `${total} entities ready to merge`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// ── knowledge_validate ────────────────────────────────────────────────────────
|
|
58
|
+
export async function toolKnowledgeValidate(input) {
|
|
59
|
+
const { root: projectRoot } = await loadDocflowConfig(input.root);
|
|
60
|
+
const knowledgePath = join(projectRoot, ".ai-spector/.docflow/analysis/knowledge.json");
|
|
61
|
+
if (!(await pathExists(knowledgePath))) {
|
|
62
|
+
return {
|
|
63
|
+
valid: false,
|
|
64
|
+
errors: [{ message: "knowledge.json not found", path: knowledgePath }],
|
|
65
|
+
warnings: [],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const { createRequire } = await import("node:module");
|
|
69
|
+
const _require = createRequire(import.meta.url);
|
|
70
|
+
const Ajv = _require("ajv/dist/2020.js");
|
|
71
|
+
const addFormats = _require("ajv-formats");
|
|
72
|
+
const schemaPath = join(packageBundleRoot(), "schemas/schema.knowledge.json");
|
|
73
|
+
const [knowledge, schema] = await Promise.all([
|
|
74
|
+
readJson(knowledgePath),
|
|
75
|
+
readJson(schemaPath),
|
|
76
|
+
]);
|
|
77
|
+
const ajv = new Ajv({ allErrors: true, strict: false });
|
|
78
|
+
addFormats(ajv);
|
|
79
|
+
const validateFn = ajv.compile(schema);
|
|
80
|
+
const valid = validateFn(knowledge);
|
|
81
|
+
const errors = valid
|
|
82
|
+
? []
|
|
83
|
+
: (validateFn.errors ?? []).map((e) => ({
|
|
84
|
+
path: e.instancePath || "/",
|
|
85
|
+
message: e.message ?? "unknown error",
|
|
86
|
+
}));
|
|
87
|
+
return {
|
|
88
|
+
valid,
|
|
89
|
+
errors,
|
|
90
|
+
warnings: [],
|
|
91
|
+
knowledgePath,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=analyze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.js","sourceR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AG,UAAU,CAAC,SAAS,CAAC,CAAC;IAEpC,MAAM,MAAM,GAAG,KAAK;QAClB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpC,IAAI,EAAE,CAAC,CAAC,YAAY,IAAI,GAAG;YAC3B,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,eAAe;SACtC,CAAC,CAAC,CAAC;IAER,OAAO;QACL,KAAK;QACL,MAAM;QACN,QAAQ,EAAE,EAAE;QACZ,aAAa;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
import type { DocsSearchSchema, GraphQueryFuzzySchema } from "../schemas.js";
|
|
1
|
+
import type { DocsSearchSchema, GraphQueryFuzzySchema, CocoindexStatusSchema, CocoindexIndexSchema } from "../schemas.js";
|
|
2
2
|
import type { z } from "zod";
|
|
3
3
|
export declare function toolDocsSearch(input: z.infer<typeof DocsSearchSchema>): Promise<import("../../../core/operations/cocoindex.js").CocoindexSearchResult | {
|
|
4
4
|
error: string;
|
|
5
5
|
cocoindexConfigured: boolean;
|
|
6
6
|
}>;
|
|
7
|
+
export declare function toolCocoindexStatus(input: z.infer<typeof CocoindexStatusSchema>): Promise<{
|
|
8
|
+
configured: boolean;
|
|
9
|
+
message: string;
|
|
10
|
+
pythonBin?: undefined;
|
|
11
|
+
pythonVersion?: undefined;
|
|
12
|
+
depsInstalled?: undefined;
|
|
13
|
+
indexed?: undefined;
|
|
14
|
+
ready?: undefined;
|
|
15
|
+
issues?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
configured: boolean;
|
|
18
|
+
pythonBin: string | null;
|
|
19
|
+
pythonVersion: string | null;
|
|
20
|
+
depsInstalled: boolean;
|
|
21
|
+
indexed: boolean;
|
|
22
|
+
ready: boolean;
|
|
23
|
+
issues: string[];
|
|
24
|
+
message?: undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function toolCocoindexIndex(input: z.infer<typeof CocoindexIndexSchema>): Promise<{
|
|
27
|
+
updated: boolean;
|
|
28
|
+
output: string;
|
|
29
|
+
}>;
|
|
7
30
|
export declare function toolGraphQueryFuzzy(input: z.infer<typeof GraphQueryFuzzySchema>): Promise<import("../../../core/operations/cocoindex.js").FuzzyQueryResult | {
|
|
8
31
|
error: string;
|
|
9
32
|
cocoindexConfigured: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cocoindex.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/cocoindex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cocoindex.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/cocoindex.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,wBAAsB,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC;;;GAmB3E;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;GA0BrF;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC;;;GAiCnF;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC;;;;;;GAsBrF"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { runCocoindexSearch, runGraphQueryFuzzy, isCocoindexConfigured, checkCocoindexReadiness, cocoindexDir, cocoindexPipelinePath, findPython, } from "../../../core/operations/cocoindex.js";
|
|
3
|
+
import { loadDocflowConfig } from "../../../core/config/load.js";
|
|
2
4
|
export async function toolDocsSearch(input) {
|
|
3
5
|
const root = input.root;
|
|
4
6
|
const configured = await isCocoindexConfigured(root ?? process.cwd());
|
|
@@ -16,6 +18,65 @@ export async function toolDocsSearch(input) {
|
|
|
16
18
|
});
|
|
17
19
|
return result;
|
|
18
20
|
}
|
|
21
|
+
export async function toolCocoindexStatus(input) {
|
|
22
|
+
const { root: projectRoot } = await loadDocflowConfig(input.root);
|
|
23
|
+
const readiness = await checkCocoindexReadiness(projectRoot);
|
|
24
|
+
if (!readiness.configured) {
|
|
25
|
+
return {
|
|
26
|
+
configured: false,
|
|
27
|
+
message: "CocoIndex not set up. Run: npx ai-spector cocoindex setup",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const issues = [];
|
|
31
|
+
if (!readiness.pythonBin)
|
|
32
|
+
issues.push("Python not found (need Python 3.11+)");
|
|
33
|
+
else if (!readiness.pythonVersion)
|
|
34
|
+
issues.push("Could not determine Python version");
|
|
35
|
+
if (!readiness.depsInstalled)
|
|
36
|
+
issues.push("Dependencies not installed — run: npx ai-spector cocoindex setup");
|
|
37
|
+
if (!readiness.indexed)
|
|
38
|
+
issues.push("Index not built yet — run: cocoindex_index or npx ai-spector cocoindex index");
|
|
39
|
+
return {
|
|
40
|
+
configured: true,
|
|
41
|
+
pythonBin: readiness.pythonBin,
|
|
42
|
+
pythonVersion: readiness.pythonVersion,
|
|
43
|
+
depsInstalled: readiness.depsInstalled,
|
|
44
|
+
indexed: readiness.indexed,
|
|
45
|
+
ready: issues.length === 0,
|
|
46
|
+
issues,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export async function toolCocoindexIndex(input) {
|
|
50
|
+
const { root: projectRoot } = await loadDocflowConfig(input.root);
|
|
51
|
+
const readiness = await checkCocoindexReadiness(projectRoot);
|
|
52
|
+
if (!readiness.configured) {
|
|
53
|
+
throw new Error("CocoIndex not set up. Run: npx ai-spector cocoindex setup");
|
|
54
|
+
}
|
|
55
|
+
if (!readiness.depsInstalled) {
|
|
56
|
+
throw new Error("CocoIndex dependencies not installed. Run: npx ai-spector cocoindex setup");
|
|
57
|
+
}
|
|
58
|
+
const cocoDir = cocoindexDir(projectRoot);
|
|
59
|
+
const pipelinePath = cocoindexPipelinePath(projectRoot);
|
|
60
|
+
const pythonBin = await findPython(cocoDir);
|
|
61
|
+
const { execFile } = await import("node:child_process");
|
|
62
|
+
const { promisify } = await import("node:util");
|
|
63
|
+
const exec = promisify(execFile);
|
|
64
|
+
try {
|
|
65
|
+
const { stdout, stderr } = await exec(pythonBin, [pipelinePath, "update"], {
|
|
66
|
+
cwd: cocoDir,
|
|
67
|
+
env: {
|
|
68
|
+
...process.env,
|
|
69
|
+
AI_SPECTOR_ROOT: projectRoot,
|
|
70
|
+
COCOINDEX_DB: join(cocoDir, "cocoindex_state"),
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
return { updated: true, output: stdout || stderr || "Index updated." };
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
77
|
+
throw new Error(`CocoIndex update failed: ${msg}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
19
80
|
export async function toolGraphQueryFuzzy(input) {
|
|
20
81
|
const configured = await isCocoindexConfigured(input.root ?? process.cwd());
|
|
21
82
|
if (!configured) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cocoindex.js","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/cocoindex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"cocoindex.js","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/cocoindex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,O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,KAAK,CAAC,SAAS;SAC3B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;IACrE,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GraphQuerySchema, GraphImpactSchema, GraphValidateSchema, GraphMergeSchema } from "../schemas.js";
|
|
1
|
+
import type { GraphQuerySchema, GraphImpactSchema, GraphValidateSchema, GraphMergeSchema, GraphReportSchema } from "../schemas.js";
|
|
2
2
|
import type { z } from "zod";
|
|
3
3
|
export declare function toolGraphQuery(input: z.infer<typeof GraphQuerySchema>): Promise<import("../../../core/graph/query.js").GraphQueryResult>;
|
|
4
4
|
export declare function toolGraphImpact(input: z.infer<typeof GraphImpactSchema>): Promise<import("../../../core/graph/impact.js").ImpactResult | {
|
|
@@ -21,4 +21,5 @@ export declare function toolGraphValidate(input: z.infer<typeof GraphValidateSch
|
|
|
21
21
|
export declare function toolGraphMerge(input: z.infer<typeof GraphMergeSchema>): Promise<{
|
|
22
22
|
merged: boolean;
|
|
23
23
|
}>;
|
|
24
|
+
export declare function toolGraphReport(input: z.infer<typeof GraphReportSchema>): Promise<import("../../sdk/index.js").LayerAuditReport>;
|
|
24
25
|
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/graph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/graph.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,wBAAsB,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,oEAyB3E;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC;;;;;;;;;;;GA0C7E;AAED,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC;;;;GAWjF;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC;;GAS3E;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,0DAE7E"}
|
|
@@ -6,6 +6,7 @@ import { resolveImpactOrigins, pickPrimaryImpactOrigin, resolveFromGitDiff, pars
|
|
|
6
6
|
import { collectGitDiff } from "../../../core/util/git-diff.js";
|
|
7
7
|
import { validateGraph } from "../../../core/operations/validate.js";
|
|
8
8
|
import { runGraphMerge } from "../../../core/operations/graph-merge.js";
|
|
9
|
+
import { runGraphReport } from "../../../core/operations/graph-report.js";
|
|
9
10
|
export async function toolGraphQuery(input) {
|
|
10
11
|
const paths = await resolveProjectPaths(input.root);
|
|
11
12
|
const g = await loadInMemoryGraph(paths.graph);
|
|
@@ -84,4 +85,7 @@ export async function toolGraphMerge(input) {
|
|
|
84
85
|
});
|
|
85
86
|
return { merged: true };
|
|
86
87
|
}
|
|
88
|
+
export async function toolGraphReport(input) {
|
|
89
|
+
return runGraphReport({ root: input.root });
|
|
90
|
+
}
|
|
87
91
|
//# sourceMappingURL=graph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/graph.ts"],"names":[],"mappings":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AC;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,KAAwC;IAC5E,OAAO,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LangQueueSchema } from "../schemas.js";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export declare function toolLangQueue(input: z.infer<typeof LangQueueSchema>): Promise<{
|
|
4
|
+
skipped: boolean;
|
|
5
|
+
skipReason: string | undefined;
|
|
6
|
+
jobs: never[];
|
|
7
|
+
summary?: undefined;
|
|
8
|
+
status?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
skipped: boolean;
|
|
11
|
+
summary: {
|
|
12
|
+
pending: number;
|
|
13
|
+
enqueued: number;
|
|
14
|
+
resolved: number;
|
|
15
|
+
failed: number;
|
|
16
|
+
};
|
|
17
|
+
status: "pending" | "resolved" | "failed" | "all";
|
|
18
|
+
jobs: unknown[];
|
|
19
|
+
skipReason?: undefined;
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=lang.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lang.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/lang.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,wBAAsB,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC;;;;;;;;;;;;;;;;;GA+BzE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { runLangQueueScan, runLangQueuePending, runLangQueueFailed, runLangQueueResolved, } from "../../../core/operations/lang-queue.js";
|
|
2
|
+
export async function toolLangQueue(input) {
|
|
3
|
+
const opts = { root: input.root, lang: input.lang, limit: input.limit };
|
|
4
|
+
const status = input.status ?? "pending";
|
|
5
|
+
const scan = await runLangQueueScan(opts);
|
|
6
|
+
if (scan.skipped) {
|
|
7
|
+
return { skipped: true, skipReason: scan.skipReason, jobs: [] };
|
|
8
|
+
}
|
|
9
|
+
let jobs = [];
|
|
10
|
+
if (status === "pending" || status === "all") {
|
|
11
|
+
jobs = [...jobs, ...(await runLangQueuePending(opts))];
|
|
12
|
+
}
|
|
13
|
+
if (status === "failed" || status === "all") {
|
|
14
|
+
jobs = [...jobs, ...(await runLangQueueFailed(opts))];
|
|
15
|
+
}
|
|
16
|
+
if (status === "resolved" || status === "all") {
|
|
17
|
+
jobs = [...jobs, ...(await runLangQueueResolved(opts))];
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
skipped: false,
|
|
21
|
+
summary: {
|
|
22
|
+
pending: scan.pendingCount ?? 0,
|
|
23
|
+
enqueued: scan.enqueued ?? 0,
|
|
24
|
+
resolved: scan.resolved ?? 0,
|
|
25
|
+
failed: scan.failed ?? 0,
|
|
26
|
+
},
|
|
27
|
+
status,
|
|
28
|
+
jobs,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lang.js","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/lang.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAIhD,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAsC;IACxE,MAAM,IAAI,GA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AAM,IAAI,CAAC;SACzB;QACD,MAAM;QACN,IAAI;KACL,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -13,86 +13,88 @@ description: "Runs AI Spector traceability graph operations: analyze data-source
|
|
|
13
13
|
- "what's the impact of my changes", "what should I regenerate"
|
|
14
14
|
- "visualize the graph"
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Invocation rule
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
1. Identify intent → pick runbook below
|
|
20
|
-
2. Run CLI from project root (npx ai-spector)
|
|
21
|
-
3. On failure: show output, offer fix/workaround/pause
|
|
22
|
-
4. If the tool or workflow caused friction (even if recovered): offer to write a feedback report to docs/feedback/
|
|
23
|
-
```
|
|
18
|
+
Use **MCP tools** when `ai-spector` server is configured. CLI is fallback only.
|
|
24
19
|
|
|
25
20
|
## Runbooks by intent
|
|
26
21
|
|
|
27
22
|
### Analyze (ingest data-source)
|
|
28
23
|
|
|
29
|
-
```
|
|
30
|
-
|
|
24
|
+
```
|
|
25
|
+
analyze({}) # MCP — prepare graph scaffold
|
|
26
|
+
# agent extracts entities → writes knowledge.json
|
|
27
|
+
knowledge_validate({}) # MCP — validate before merge
|
|
28
|
+
knowledge_status({}) # MCP — confirm entity counts
|
|
29
|
+
graph_merge({ fromKnowledge: true }) # MCP — commit to graph
|
|
30
|
+
graph_validate({}) # MCP — verify result
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
CLI fallback: `npx ai-spector analyze` → `npx ai-spector graph merge --from-knowledge` → `npx ai-spector graph validate`
|
|
34
34
|
|
|
35
35
|
### Index (refresh after doc edits)
|
|
36
36
|
|
|
37
|
-
```bash
|
|
38
|
-
npx ai-spector index
|
|
39
37
|
```
|
|
38
|
+
index({ cocoindexSync: true }) # MCP — refresh graph + embeddings
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
CLI fallback: `npx ai-spector index && npx ai-spector cocoindex index`
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
**Always run index before checking translation status.**
|
|
42
44
|
|
|
43
45
|
### Validate
|
|
44
46
|
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
+
```
|
|
48
|
+
graph_validate({}) # MCP
|
|
49
|
+
graph_report({}) # MCP — layer health audit
|
|
47
50
|
```
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
CLI fallback: `npx ai-spector graph validate`
|
|
50
53
|
|
|
51
54
|
### Impact (what to regenerate)
|
|
52
55
|
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# Specific file
|
|
58
|
-
npx ai-spector graph impact --file <repo-relative-path> --json
|
|
59
|
-
|
|
60
|
-
# Specific node
|
|
61
|
-
npx ai-spector graph impact <originId> --change content_change --json
|
|
56
|
+
```
|
|
57
|
+
graph_impact({ git: true, change: "content_change" }) # git diff
|
|
58
|
+
graph_impact({ originId: "<id>", change: "content_change" }) # specific node
|
|
59
|
+
graph_impact({ file: "<path>", change: "content_change" }) # specific file
|
|
62
60
|
```
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
- `noTraceabilityImpact: true` → changed files not in graph (config, source code, etc.) — no doc regen needed
|
|
66
|
-
- `truncated: true` → BFS hit propagation cap — results may be incomplete, warn user
|
|
62
|
+
CLI fallback: `npx ai-spector graph impact --git --change content_change --json`
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
Output buckets: `regenerate` (must redo), `review` (may need update), `semanticSuggestions` (CocoIndex).
|
|
65
|
+
- `noTraceabilityImpact: true` → changed files not in graph — no doc regen needed
|
|
66
|
+
- `truncated: true` → BFS hit cap — results may be incomplete, warn user
|
|
69
67
|
|
|
70
|
-
**Run
|
|
68
|
+
**Run after every doc edit**, then `index({ cocoindexSync: true })`.
|
|
71
69
|
|
|
72
|
-
###
|
|
70
|
+
### Query a node
|
|
73
71
|
|
|
74
|
-
```
|
|
75
|
-
|
|
72
|
+
```
|
|
73
|
+
graph_query({ seedId: "<id>" }) # MCP — walk subgraph
|
|
74
|
+
graph_query_fuzzy({ query: "…" }) # MCP — natural language lookup
|
|
76
75
|
```
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
CLI fallback: `npx ai-spector graph query <id> --json`
|
|
78
|
+
|
|
79
|
+
### Visualize
|
|
79
80
|
|
|
80
81
|
```bash
|
|
81
|
-
npx ai-spector graph
|
|
82
|
+
npx ai-spector graph visualize --open # CLI only — no MCP equivalent
|
|
82
83
|
```
|
|
83
84
|
|
|
84
85
|
## Checklist
|
|
85
86
|
|
|
86
87
|
```
|
|
87
88
|
- [ ] Identified correct runbook
|
|
88
|
-
- [ ]
|
|
89
|
+
- [ ] Used MCP tools (not CLI) when ai-spector server is configured
|
|
90
|
+
- [ ] After doc edits: graph_impact + index({ cocoindexSync: true })
|
|
89
91
|
- [ ] Presented output to user (impact table, validate errors, etc.)
|
|
90
|
-
- [ ] After doc edits: ran impact + index
|
|
91
92
|
- [ ] On failure: showed output, offered fix/workaround
|
|
92
93
|
```
|
|
93
94
|
|
|
94
95
|
## Rules
|
|
95
96
|
|
|
96
|
-
- Do not implement impact BFS manually — always use CLI
|
|
97
|
-
- Do not invent regen lists if impact
|
|
98
|
-
- Do not run whole-repo regen outside
|
|
97
|
+
- Do not implement impact BFS manually — always use MCP or CLI tool
|
|
98
|
+
- Do not invent regen lists if impact tool failed
|
|
99
|
+
- Do not run whole-repo regen outside tool buckets
|
|
100
|
+
- Never skip `cocoindexSync` when CocoIndex is configured and docs changed
|
|
@@ -21,14 +21,23 @@ If only one language: reply "Only one language configured — nothing to compare
|
|
|
21
21
|
|
|
22
22
|
### 2. Refresh the index first (MANDATORY)
|
|
23
23
|
|
|
24
|
-
```
|
|
25
|
-
|
|
24
|
+
```
|
|
25
|
+
index({}) # MCP preferred
|
|
26
|
+
npx ai-spector index # CLI fallback
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
The queue is only accurate after indexing. **Never skip this step** — reading `pending.json` without indexing shows stale data.
|
|
29
30
|
|
|
30
31
|
### 3. Read the queue
|
|
31
32
|
|
|
33
|
+
**MCP (preferred):**
|
|
34
|
+
```
|
|
35
|
+
lang_queue({}) # pending + summary
|
|
36
|
+
lang_queue({ status: "failed" }) # failed jobs
|
|
37
|
+
lang_queue({ lang: "jp" }) # filter by language
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**CLI fallback:**
|
|
32
41
|
```bash
|
|
33
42
|
npx ai-spector lang queue pending --json
|
|
34
43
|
npx ai-spector lang queue failed --json
|
|
@@ -70,9 +79,9 @@ If queue is empty or missing after index, fall back to git mtime comparison acro
|
|
|
70
79
|
|
|
71
80
|
```
|
|
72
81
|
- [ ] Read docflow.config.json → languages[]
|
|
73
|
-
- [ ] Ran npx ai-spector index
|
|
74
|
-
- [ ] Ran lang queue pending --json
|
|
75
|
-
- [ ] Ran lang queue failed --json
|
|
82
|
+
- [ ] Ran index({}) MCP (or npx ai-spector index) — mandatory before queue read
|
|
83
|
+
- [ ] Ran lang_queue({}) MCP (or lang queue pending --json)
|
|
84
|
+
- [ ] Ran lang_queue({ status: "failed" }) MCP (or lang queue failed --json)
|
|
76
85
|
- [ ] Rendered pending + failed tables
|
|
77
86
|
- [ ] Offered resolve-translation if pending jobs exist
|
|
78
87
|
```
|
|
@@ -30,33 +30,46 @@ npx ai-spector index # CLI fallback
|
|
|
30
30
|
|
|
31
31
|
Then read the queue. **Never read `.ai-spector/.docflow/translation-queue/pending.json` without running index first** — the queue is only accurate after indexing.
|
|
32
32
|
|
|
33
|
-
### 3. Check impact
|
|
33
|
+
### 3. Check impact and refresh embeddings after any doc edit
|
|
34
34
|
|
|
35
|
-
After editing any file under `docs/srs/`, `docs/basic-design/`, or `docs/detail-design
|
|
35
|
+
After editing any file under `docs/srs/`, `docs/basic-design/`, or `docs/detail-design/`:
|
|
36
36
|
|
|
37
|
+
**a) Impact:**
|
|
37
38
|
```
|
|
38
39
|
graph_impact({ git: true, change: "content_change" }) # MCP preferred
|
|
39
40
|
npx ai-spector graph impact --git --change content_change --json # CLI fallback
|
|
40
41
|
```
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
**b) Re-index + embeddings (mandatory when CocoIndex is configured):**
|
|
44
|
+
```
|
|
45
|
+
index({ cocoindexSync: true }) # preferred — refreshes graph + embeddings in one call
|
|
46
|
+
```
|
|
43
47
|
|
|
48
|
+
Or separately:
|
|
44
49
|
```
|
|
45
50
|
index({})
|
|
51
|
+
cocoindex_index({})
|
|
46
52
|
```
|
|
47
53
|
|
|
48
|
-
|
|
54
|
+
CLI fallback: `npx ai-spector index && npx ai-spector cocoindex index`
|
|
55
|
+
|
|
56
|
+
Skip impact/index only when the user explicitly says it was a typo-only fix with no traceability concern. **Never skip `cocoindexSync` when CocoIndex is configured** — semantic search goes stale silently.
|
|
49
57
|
|
|
50
58
|
### 4. Use MCP/graph — not file search
|
|
51
59
|
|
|
52
60
|
| Need | MCP (preferred) | CLI fallback |
|
|
53
61
|
|------|-----------------|--------------|
|
|
62
|
+
| Prepare graph scaffold | `analyze({})` | `npx ai-spector analyze` |
|
|
63
|
+
| Check knowledge.json before merge | `knowledge_status({})` · `knowledge_validate({})` | *(no CLI)* |
|
|
64
|
+
| Merge knowledge → graph | `graph_merge({ fromKnowledge: true })` | `npx ai-spector graph merge --from-knowledge` |
|
|
54
65
|
| Find what needs regeneration | `graph_impact({ git: true, change: "content_change" })` | `npx ai-spector graph impact --git --json` |
|
|
55
|
-
| Find node by exact ID | `graph_query({
|
|
56
|
-
| Find node by concept | `graph_query_fuzzy(query: "…")` — requires CocoIndex | — |
|
|
57
|
-
| Search docs by meaning | `docs_search(query: "…")` — requires CocoIndex | — |
|
|
58
|
-
| Check graph health | `graph_validate({})` | `npx ai-spector graph validate` |
|
|
59
|
-
|
|
|
66
|
+
| Find node by exact ID | `graph_query({ seedId: "…" })` | `npx ai-spector graph query <id> --json` |
|
|
67
|
+
| Find node by concept | `graph_query_fuzzy({ query: "…" })` — requires CocoIndex | — |
|
|
68
|
+
| Search docs by meaning | `docs_search({ query: "…" })` — requires CocoIndex | — |
|
|
69
|
+
| Check graph health | `graph_validate({})` · `graph_report({})` | `npx ai-spector graph validate` |
|
|
70
|
+
| Translation queue | `lang_queue({})` | `npx ai-spector lang queue pending --json` (after index) |
|
|
71
|
+
| CocoIndex readiness | `cocoindex_status({})` | `npx ai-spector setup --check` |
|
|
72
|
+
| Rebuild embeddings | `cocoindex_index({})` or `index({ cocoindexSync: true })` | `npx ai-spector cocoindex index` |
|
|
60
73
|
|
|
61
74
|
**Only fall back to `grep` or `Read` when the tool returns no results or you need raw file content for editing.**
|
|
62
75
|
|
|
@@ -83,11 +96,21 @@ Skip only when the user explicitly says it was a typo-only fix with no traceabil
|
|
|
83
96
|
|
|
84
97
|
| Tool | Purpose |
|
|
85
98
|
|------|---------|
|
|
86
|
-
| `
|
|
99
|
+
| `analyze({})` | Prepare graph scaffold from templates |
|
|
100
|
+
| `knowledge_status({})` | Check knowledge.json entity counts |
|
|
101
|
+
| `knowledge_validate({})` | Validate knowledge.json schema |
|
|
87
102
|
| `graph_merge({ fromKnowledge: true })` | Merge knowledge.json into graph |
|
|
88
103
|
| `graph_validate({})` | Check graph integrity |
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
104
|
+
| `graph_report({})` | Graph layer health audit |
|
|
105
|
+
| `graph_impact({ git: true, change: "…" })` | Impact of current git diff |
|
|
106
|
+
| `graph_query({ seedId: "…" })` | Walk graph from a node |
|
|
107
|
+
| `index({})` | Refresh graph + translation queue |
|
|
108
|
+
| `index({ cocoindexSync: true })` | Refresh graph + translation queue + embeddings |
|
|
109
|
+
| `lang_queue({})` | Translation queue status |
|
|
110
|
+
| `cocoindex_status({})` | CocoIndex readiness check |
|
|
111
|
+
| `cocoindex_index({})` | Rebuild semantic embeddings |
|
|
112
|
+
| `docs_search({ query })` | Semantic doc search (CocoIndex) |
|
|
113
|
+
| `graph_query_fuzzy({ query })` | Natural language graph lookup (CocoIndex) |
|
|
91
114
|
|
|
92
115
|
### CLI (fallback / MCP-unavailable or no tool equivalent)
|
|
93
116
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AI Spector workflow
|
|
2
2
|
|
|
3
|
-
**You describe what you need in chat.** Cursor picks the right **skill**; the agent
|
|
3
|
+
**You describe what you need in chat.** Cursor picks the right **skill**; the agent calls **MCP tools** (when `ai-spector` server is configured) or falls back to **`npx ai-spector`** CLI. You do not need to memorize command names.
|
|
4
4
|
|
|
5
5
|
Enable all skills under `.cursor/skills/` (see [skills/README.md](./skills/README.md)). On CLI or tool failure: agent pauses, shows output, and offers fix / workaround / pause — [cli-failures](./skills/ai-spector/references/cli-failures.md).
|
|
6
6
|
|
|
@@ -21,24 +21,24 @@ Then: add files under `docs/data-source/`, enable **all** skills under `.cursor/
|
|
|
21
21
|
|
|
22
22
|
## What to say → skill → agent does
|
|
23
23
|
|
|
24
|
-
| You want to… | Say (examples) | Skill | Agent runs (
|
|
25
|
-
|
|
24
|
+
| You want to… | Say (examples) | Skill | Agent runs (MCP preferred) |
|
|
25
|
+
|--------------|----------------|-------|---------------------------|
|
|
26
26
|
| **Setup project** | “setup ai-spector”, “initialize project”, “get started” | `ai-spector-setup` | `setup --check` → `setup -y` → enable skills checklist |
|
|
27
|
-
| Ingest sources | “analyze my data source”, “build the knowledge graph” | `ai-spector-graph` | `analyze` →
|
|
28
|
-
| Check graph | “validate the graph”, “graph errors” | `ai-spector-graph` | `
|
|
29
|
-
| Refresh after edits | “re-index”, “sync the graph” | `ai-spector-graph` | `
|
|
30
|
-
| Write SRS | “generate SRS”, “write use cases” | `ai-spector-generate-srs` | DAG waves → docs/srs →
|
|
31
|
-
| Basic design | “screen list”, “API design”, “wireframes” | `ai-spector-generate-basic-design` | docs/basic-design →
|
|
27
|
+
| Ingest sources | “analyze my data source”, “build the knowledge graph” | `ai-spector-graph` | `analyze({})` → agent extracts → `knowledge_validate` → `graph_merge` → `graph_validate` |
|
|
28
|
+
| Check graph health | “validate the graph”, “graph errors”, “graph report” | `ai-spector-graph` | `graph_validate({})` · `graph_report({})` |
|
|
29
|
+
| Refresh after edits | “re-index”, “sync the graph” | `ai-spector-graph` | `index({ cocoindexSync: true })` (or `index({})` if no CocoIndex) |
|
|
30
|
+
| Write SRS | “generate SRS”, “write use cases” | `ai-spector-generate-srs` | DAG waves → docs/srs → `graph_merge` → `index({ cocoindexSync: true })` |
|
|
31
|
+
| Basic design | “screen list”, “API design”, “wireframes” | `ai-spector-generate-basic-design` | docs/basic-design → `graph_merge` → `index({ cocoindexSync: true })` each wave |
|
|
32
32
|
| Detail design | “detail design for checkout” | `ai-spector-generate-detail-design` | docs/detail-design |
|
|
33
33
|
| HTML prototype | “HTML mockup”, “prototype with stripe theme” | `ai-spector-generate-prototype` | auth picker (if needed) → theme picker → setup → HTML → validate |
|
|
34
|
-
| Pick / preview UI theme | “help me pick a theme”, “show me themes
|
|
35
|
-
| What to redo | “what’s impacted”, “what should I regenerate” | `ai-spector-graph` | `
|
|
36
|
-
| Find docs by concept | “find all mentions of rate limiting”, “which docs describe login?” | `ai-spector-search` | `docs_search
|
|
37
|
-
| Find graph node by name | “show graph for user login” (node ID unknown) | `ai-spector-search` | `graph_query_fuzzy` MCP
|
|
38
|
-
| Translation status | “what’s stale in JP”, “pending translations” | `ai-spector-lang-status` | `
|
|
39
|
-
| Sync translations | “resolve translations”, “update JP from EN” | `ai-spector-resolve-translation` | read queue → translate → `index` |
|
|
34
|
+
| Pick / preview UI theme | “help me pick a theme”, “show me themes” | `ai-spector-generate-prototype` | read project context → recommend 3 → `prototype preview` ×3 |
|
|
35
|
+
| What to redo | “what’s impacted”, “what should I regenerate” | `ai-spector-graph` | `graph_impact({ git: true, change: “…” })` — includes `semanticSuggestions` when CocoIndex ready |
|
|
36
|
+
| Find docs by concept | “find all mentions of rate limiting”, “which docs describe login?” | `ai-spector-search` | `docs_search({ query })` MCP |
|
|
37
|
+
| Find graph node by name | “show graph for user login” (node ID unknown) | `ai-spector-search` | `graph_query_fuzzy({ query })` MCP |
|
|
38
|
+
| Translation status | “what’s stale in JP”, “pending translations” | `ai-spector-lang-status` | `lang_queue({})` MCP |
|
|
39
|
+
| Sync translations | “resolve translations”, “update JP from EN” | `ai-spector-resolve-translation` | read queue → translate → `index({ cocoindexSync: true })` |
|
|
40
40
|
| Review comments | “resolve comments”, “fix C-001” | `ai-spector-resolve-comments` | inbox → plan → edit → commit |
|
|
41
|
-
| Explore graph | “show the graph” | `ai-spector-graph` | `graph visualize --open` |
|
|
41
|
+
| Explore graph | “show the graph” | `ai-spector-graph` | `npx ai-spector graph visualize --open` (no MCP equivalent) |
|
|
42
42
|
|
|
43
43
|
Unsure? The agent uses [skills/_skill-router.md](./skills/_skill-router.md) or asks one clarifying question.
|
|
44
44
|
|
|
@@ -18,14 +18,40 @@ When the `ai-spector` MCP server is enabled (`.cursor/mcp.json` or `.mcp.json` l
|
|
|
18
18
|
|
|
19
19
|
| Operation | MCP tool | CLI fallback |
|
|
20
20
|
|-----------|----------|--------------|
|
|
21
|
-
|
|
|
21
|
+
| Prepare graph scaffold | `analyze({})` | `npx ai-spector analyze` |
|
|
22
|
+
| Check knowledge.json entity counts | `knowledge_status({})` | *(no CLI equivalent)* |
|
|
23
|
+
| Validate knowledge.json schema | `knowledge_validate({})` | *(no CLI equivalent)* |
|
|
22
24
|
| Merge knowledge → graph | `graph_merge({ fromKnowledge: true })` | `npx ai-spector graph merge --from-knowledge` |
|
|
23
25
|
| Validate graph | `graph_validate({})` | `npx ai-spector graph validate` |
|
|
26
|
+
| Graph layer health audit | `graph_report({})` | `npx ai-spector graph report --json` |
|
|
24
27
|
| Impact analysis | `graph_impact({ originId, change })` | `npx ai-spector graph impact …` |
|
|
25
|
-
| Walk graph from node | `graph_query({
|
|
26
|
-
|
|
|
28
|
+
| Walk graph from node | `graph_query({ seedId })` | `npx ai-spector graph query <id> --json` |
|
|
29
|
+
| Re-index project | `index({})` | `npx ai-spector index` |
|
|
30
|
+
| Re-index + refresh embeddings | `index({ cocoindexSync: true })` | `npx ai-spector index && npx ai-spector cocoindex index` |
|
|
31
|
+
| Translation queue status | `lang_queue({})` | `npx ai-spector lang queue pending --json` |
|
|
32
|
+
| CocoIndex readiness | `cocoindex_status({})` | `npx ai-spector setup --check` |
|
|
33
|
+
| Rebuild semantic embeddings | `cocoindex_index({})` | `npx ai-spector cocoindex index` |
|
|
34
|
+
| Semantic doc search | `docs_search({ query })` | `npx ai-spector cocoindex search --query …` |
|
|
35
|
+
| Natural language graph lookup | `graph_query_fuzzy({ query })` | *(no CLI equivalent)* |
|
|
36
|
+
| **Visualize graph** | *(no MCP tool)* | `npx ai-spector graph visualize --open` |
|
|
37
|
+
|
|
38
|
+
Use CLI **only** when: MCP server is not configured, the tool errors, or no MCP equivalent exists (visualize, `lang add`, template mutations).
|
|
39
|
+
|
|
40
|
+
### After any batch of doc edits
|
|
41
|
+
|
|
42
|
+
When you finish editing files under `docs/` — always close out with:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
index({ cocoindexSync: true }) # preferred: refreshes graph + embeddings in one call
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or if CocoIndex is not configured:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
index({})
|
|
52
|
+
```
|
|
27
53
|
|
|
28
|
-
|
|
54
|
+
**Never skip the embedding refresh** when CocoIndex is set up — semantic search and `graph_impact` `semanticSuggestions` go stale silently.
|
|
29
55
|
|
|
30
56
|
## CLI and tool failure (non-negotiable)
|
|
31
57
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Ingest `docs/data-source/` and commit knowledge into the traceability graph.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
All steps have MCP equivalents. Use MCP when the `ai-spector` server is configured.
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
@@ -20,6 +20,12 @@ Step 0 (`npx ai-spector analyze`) is **CLI-only** — no MCP equivalent. Steps B
|
|
|
20
20
|
|
|
21
21
|
### 0. Prepare graph structure
|
|
22
22
|
|
|
23
|
+
**MCP (preferred):**
|
|
24
|
+
```
|
|
25
|
+
analyze({})
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**CLI fallback:**
|
|
23
29
|
```bash
|
|
24
30
|
npx ai-spector analyze
|
|
25
31
|
```
|
|
@@ -82,7 +88,10 @@ Update `state.json`: `analysis.lastRunAt`, `analysis.dataSource`, scope hash. Me
|
|
|
82
88
|
|
|
83
89
|
| Step | MCP (preferred) | CLI fallback |
|
|
84
90
|
|------|-----------------|--------------|
|
|
85
|
-
| 0 |
|
|
91
|
+
| 0 prepare | `analyze({})` | `npx ai-spector analyze` |
|
|
92
|
+
| A extraction | Agent writes `knowledge.json` | Agent writes `knowledge.json` |
|
|
93
|
+
| A verify | `knowledge_status({})` → check `ready: true` | *(no CLI)* |
|
|
94
|
+
| A validate | `knowledge_validate({})` → check `valid: true` | *(no CLI)* |
|
|
86
95
|
| B merge | `graph_merge({ fromKnowledge: true })` | `npx ai-spector graph merge --from-knowledge` |
|
|
87
96
|
| B validate | `graph_validate({})` | `npx ai-spector graph validate` |
|
|
88
97
|
|
|
@@ -20,14 +20,24 @@ paths:
|
|
|
20
20
|
|
|
21
21
|
2. **Refresh the index first** — the queue is only accurate after indexing:
|
|
22
22
|
|
|
23
|
-
```bash
|
|
24
|
-
npx ai-spector index
|
|
25
23
|
```
|
|
24
|
+
index({}) # MCP preferred
|
|
25
|
+
npx ai-spector index # CLI fallback
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Skip only if the user explicitly says they just ran it.
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
3. Read the translation queue (primary source of truth):
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
**MCP (preferred):**
|
|
33
|
+
```
|
|
34
|
+
lang_queue({}) # pending jobs + summary
|
|
35
|
+
lang_queue({ status: "failed" }) # failed jobs
|
|
36
|
+
lang_queue({ status: "all" }) # everything
|
|
37
|
+
lang_queue({ lang: "jp" }) # filter by language
|
|
38
|
+
```
|
|
30
39
|
|
|
40
|
+
**CLI fallback:**
|
|
31
41
|
```bash
|
|
32
42
|
npx ai-spector lang queue pending --json
|
|
33
43
|
npx ai-spector lang queue failed --json
|
|
@@ -113,7 +123,7 @@ List actionable items per job:
|
|
|
113
123
|
|
|
114
124
|
## After any file edit (outside of generate skills)
|
|
115
125
|
|
|
116
|
-
When the user edits any language file directly, run `
|
|
126
|
+
When the user edits any language file directly, run `index({})` (MCP) or `npx ai-spector index`. The queue enqueues section-level sync jobs automatically — no manual stale notes needed.
|
|
117
127
|
|
|
118
128
|
If the user defers translation, the job stays in `pending.json` until processed.
|
|
119
129
|
|
|
@@ -35,15 +35,16 @@ surface related docs that have no formal graph edge.
|
|
|
35
35
|
|
|
36
36
|
Find all document sections about a concept:
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
npx ai-spector cocoindex search --query "rate limiting" --json
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Or via MCP:
|
|
38
|
+
**MCP (preferred):**
|
|
43
39
|
```
|
|
44
40
|
docs_search(query: "rate limiting", limit: 5)
|
|
45
41
|
```
|
|
46
42
|
|
|
43
|
+
**CLI fallback:**
|
|
44
|
+
```bash
|
|
45
|
+
npx ai-spector cocoindex search --query "rate limiting" --json
|
|
46
|
+
```
|
|
47
|
+
|
|
47
48
|
Response includes `graphNodeId` when the matched section maps to a traceability node.
|
|
48
49
|
Use that to run `graph_query` for full context.
|
|
49
50
|
|
|
@@ -109,19 +110,37 @@ No code change needed — chain two MCP calls:
|
|
|
109
110
|
|
|
110
111
|
## Setup check
|
|
111
112
|
|
|
112
|
-
Before using any semantic workflow, verify CocoIndex is
|
|
113
|
+
Before using any semantic workflow, verify CocoIndex is ready:
|
|
114
|
+
|
|
115
|
+
**MCP (preferred):**
|
|
116
|
+
```
|
|
117
|
+
cocoindex_status({})
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Check `ready: true`. If any issue is listed, fix it before searching.
|
|
113
121
|
|
|
122
|
+
**CLI fallback:**
|
|
114
123
|
```bash
|
|
115
124
|
npx ai-spector setup --check
|
|
116
125
|
```
|
|
117
126
|
|
|
118
|
-
If CocoIndex is missing
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
If CocoIndex is missing, run `npx ai-spector cocoindex setup` (or ask agent to set it up via `ai-spector-setup` skill).
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Rebuild embeddings after doc edits
|
|
132
|
+
|
|
133
|
+
Semantic search goes stale when docs change. After any batch of doc edits:
|
|
134
|
+
|
|
135
|
+
**Preferred — one call:**
|
|
136
|
+
```
|
|
137
|
+
index({ cocoindexSync: true })
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Or separately:**
|
|
141
|
+
```
|
|
142
|
+
cocoindex_index({})
|
|
143
|
+
index({})
|
|
125
144
|
```
|
|
126
145
|
|
|
127
146
|
---
|
|
@@ -129,8 +148,8 @@ python pipeline.py cocoindex update
|
|
|
129
148
|
## Checklist
|
|
130
149
|
|
|
131
150
|
```
|
|
132
|
-
- [ ]
|
|
133
|
-
- [ ] Embeddings
|
|
151
|
+
- [ ] cocoindex_status({}) → ready: true (or setup done)
|
|
152
|
+
- [ ] Embeddings refreshed after doc edits: index({ cocoindexSync: true })
|
|
134
153
|
- [ ] Used graph_query_fuzzy when node ID is unknown (not graph_query with a guess)
|
|
135
154
|
- [ ] Treated semanticSuggestions as "review recommended", not "must regenerate"
|
|
136
155
|
```
|