@ai-coders/context 0.6.0 → 0.6.1
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/README.md +3 -0
- package/dist/services/ai/schemas.d.ts +2 -0
- package/dist/services/ai/schemas.d.ts.map +1 -1
- package/dist/services/ai/schemas.js +5 -1
- package/dist/services/ai/schemas.js.map +1 -1
- package/dist/services/ai/tools/fillScaffoldingTool.d.ts +17 -0
- package/dist/services/ai/tools/fillScaffoldingTool.d.ts.map +1 -1
- package/dist/services/ai/tools/fillScaffoldingTool.js +17 -0
- package/dist/services/ai/tools/fillScaffoldingTool.js.map +1 -1
- package/dist/services/ai/tools/index.d.ts +1 -1
- package/dist/services/ai/tools/index.d.ts.map +1 -1
- package/dist/services/ai/tools/index.js +5 -1
- package/dist/services/ai/tools/index.js.map +1 -1
- package/dist/services/ai/tools/initializeContextTool.d.ts +13 -3
- package/dist/services/ai/tools/initializeContextTool.d.ts.map +1 -1
- package/dist/services/ai/tools/initializeContextTool.js +169 -14
- package/dist/services/ai/tools/initializeContextTool.js.map +1 -1
- package/dist/services/ai/tools/scaffoldPlanTool.d.ts +5 -0
- package/dist/services/ai/tools/scaffoldPlanTool.d.ts.map +1 -1
- package/dist/services/ai/tools/scaffoldPlanTool.js +63 -4
- package/dist/services/ai/tools/scaffoldPlanTool.js.map +1 -1
- package/dist/services/mcp/mcpServer.d.ts.map +1 -1
- package/dist/services/mcp/mcpServer.js +244 -50
- package/dist/services/mcp/mcpServer.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ export declare const scaffoldPlanTool: import("ai").Tool<{
|
|
|
5
5
|
title?: string | undefined;
|
|
6
6
|
summary?: string | undefined;
|
|
7
7
|
semantic?: boolean | undefined;
|
|
8
|
+
autoFill?: boolean | undefined;
|
|
8
9
|
}, {
|
|
9
10
|
success: boolean;
|
|
10
11
|
planPath: string;
|
|
@@ -14,6 +15,8 @@ export declare const scaffoldPlanTool: import("ai").Tool<{
|
|
|
14
15
|
confidence: "high" | "medium" | "low";
|
|
15
16
|
reasoning: string[];
|
|
16
17
|
};
|
|
18
|
+
fillInstructions: string | undefined;
|
|
19
|
+
instructions: string;
|
|
17
20
|
error?: undefined;
|
|
18
21
|
} | {
|
|
19
22
|
success: boolean;
|
|
@@ -21,5 +24,7 @@ export declare const scaffoldPlanTool: import("ai").Tool<{
|
|
|
21
24
|
planPath?: undefined;
|
|
22
25
|
planContent?: undefined;
|
|
23
26
|
classification?: undefined;
|
|
27
|
+
fillInstructions?: undefined;
|
|
28
|
+
instructions?: undefined;
|
|
24
29
|
}>;
|
|
25
30
|
//# sourceMappingURL=scaffoldPlanTool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffoldPlanTool.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/tools/scaffoldPlanTool.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"scaffoldPlanTool.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/tools/scaffoldPlanTool.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4E3B,CAAC"}
|
|
@@ -41,10 +41,12 @@ const schemas_1 = require("../schemas");
|
|
|
41
41
|
const planGenerator_1 = require("../../../generators/plans/planGenerator");
|
|
42
42
|
const stack_1 = require("../../stack");
|
|
43
43
|
exports.scaffoldPlanTool = (0, ai_1.tool)({
|
|
44
|
-
description:
|
|
44
|
+
description: `Create a plan template in .context/plans/.
|
|
45
|
+
When autoFill is true (default), returns semantic context and fill instructions.
|
|
46
|
+
The AI agent MUST then fill the plan with specific implementation details.`,
|
|
45
47
|
inputSchema: schemas_1.ScaffoldPlanInputSchema,
|
|
46
48
|
execute: async (input) => {
|
|
47
|
-
const { planName, repoPath: customRepoPath, outputDir: customOutputDir, title, summary, semantic = true } = input;
|
|
49
|
+
const { planName, repoPath: customRepoPath, outputDir: customOutputDir, title, summary, semantic = true, autoFill = true, } = input;
|
|
48
50
|
const repoPath = customRepoPath ? path.resolve(customRepoPath) : process.cwd();
|
|
49
51
|
const outputDir = customOutputDir
|
|
50
52
|
? path.resolve(customOutputDir)
|
|
@@ -58,6 +60,8 @@ exports.scaffoldPlanTool = (0, ai_1.tool)({
|
|
|
58
60
|
const filteredAgents = (0, stack_1.getAgentsForProjectType)(classification.primaryType);
|
|
59
61
|
const filteredDocs = (0, stack_1.getDocsForProjectType)(classification.primaryType);
|
|
60
62
|
const planGenerator = new planGenerator_1.PlanGenerator();
|
|
63
|
+
// When autoFill is true, enable semantic analysis for richer content
|
|
64
|
+
const enableSemantic = autoFill && semantic;
|
|
61
65
|
const result = await planGenerator.generatePlan({
|
|
62
66
|
planName,
|
|
63
67
|
outputDir,
|
|
@@ -65,13 +69,15 @@ exports.scaffoldPlanTool = (0, ai_1.tool)({
|
|
|
65
69
|
summary,
|
|
66
70
|
force: true, // MCP calls should always overwrite (non-interactive)
|
|
67
71
|
verbose: false,
|
|
68
|
-
semantic,
|
|
69
|
-
projectPath:
|
|
72
|
+
semantic: enableSemantic,
|
|
73
|
+
projectPath: enableSemantic ? repoPath : undefined,
|
|
70
74
|
selectedAgentTypes: filteredAgents,
|
|
71
75
|
selectedDocKeys: filteredDocs,
|
|
72
76
|
});
|
|
73
77
|
// Read the generated content to return
|
|
74
78
|
const planContent = await fs.readFile(result.planPath, 'utf-8');
|
|
79
|
+
// Build fill instructions for the plan
|
|
80
|
+
const fillInstructions = autoFill ? buildPlanFillInstructions(planName, result.planPath, summary) : undefined;
|
|
75
81
|
return {
|
|
76
82
|
success: true,
|
|
77
83
|
planPath: result.planPath,
|
|
@@ -81,6 +87,10 @@ exports.scaffoldPlanTool = (0, ai_1.tool)({
|
|
|
81
87
|
confidence: classification.confidence,
|
|
82
88
|
reasoning: classification.reasoning,
|
|
83
89
|
},
|
|
90
|
+
fillInstructions,
|
|
91
|
+
instructions: autoFill
|
|
92
|
+
? 'IMPORTANT: Review the generated plan and fill in the specific implementation details. The plan template has been created with codebase context - you must now customize it with the actual tasks, phases, and deliverables for this feature/project.'
|
|
93
|
+
: 'The plan template has been created. You can customize it manually or use fillScaffolding to get suggested content.',
|
|
84
94
|
};
|
|
85
95
|
}
|
|
86
96
|
catch (error) {
|
|
@@ -91,4 +101,53 @@ exports.scaffoldPlanTool = (0, ai_1.tool)({
|
|
|
91
101
|
}
|
|
92
102
|
}
|
|
93
103
|
});
|
|
104
|
+
/**
|
|
105
|
+
* Build fill instructions for a plan file
|
|
106
|
+
*/
|
|
107
|
+
function buildPlanFillInstructions(planName, planPath, summary) {
|
|
108
|
+
const lines = [];
|
|
109
|
+
lines.push('# Plan Fill Instructions');
|
|
110
|
+
lines.push('');
|
|
111
|
+
lines.push(`A plan template has been created at: \`${planPath}\``);
|
|
112
|
+
lines.push('');
|
|
113
|
+
lines.push('You MUST now fill in the following sections with specific implementation details:');
|
|
114
|
+
lines.push('');
|
|
115
|
+
lines.push('## Required Sections to Fill');
|
|
116
|
+
lines.push('');
|
|
117
|
+
lines.push('### 1. Goal & Scope');
|
|
118
|
+
lines.push('- Define the specific objective of this plan');
|
|
119
|
+
lines.push('- List what is included and excluded from scope');
|
|
120
|
+
if (summary) {
|
|
121
|
+
lines.push(`- Initial summary provided: "${summary}"`);
|
|
122
|
+
}
|
|
123
|
+
lines.push('');
|
|
124
|
+
lines.push('### 2. Phases');
|
|
125
|
+
lines.push('- Break down the implementation into logical phases');
|
|
126
|
+
lines.push('- Each phase should have:');
|
|
127
|
+
lines.push(' - Clear objective');
|
|
128
|
+
lines.push(' - Specific steps with owners (agent types)');
|
|
129
|
+
lines.push(' - Deliverables and evidence of completion');
|
|
130
|
+
lines.push(' - Git commit checkpoint message');
|
|
131
|
+
lines.push('');
|
|
132
|
+
lines.push('### 3. Agent Lineup');
|
|
133
|
+
lines.push('- Assign specific agents to phases');
|
|
134
|
+
lines.push('- Define focus areas for each agent');
|
|
135
|
+
lines.push('');
|
|
136
|
+
lines.push('### 4. Documentation Touchpoints');
|
|
137
|
+
lines.push('- List which docs need to be updated');
|
|
138
|
+
lines.push('- Specify which sections and why');
|
|
139
|
+
lines.push('');
|
|
140
|
+
lines.push('### 5. Success Criteria');
|
|
141
|
+
lines.push('- Define measurable success criteria');
|
|
142
|
+
lines.push('- Include testing and validation requirements');
|
|
143
|
+
lines.push('');
|
|
144
|
+
lines.push('## Action Required');
|
|
145
|
+
lines.push('');
|
|
146
|
+
lines.push('1. Read the generated plan template');
|
|
147
|
+
lines.push('2. Fill in each section with specific, actionable content');
|
|
148
|
+
lines.push('3. Write the completed plan back to the file');
|
|
149
|
+
lines.push('');
|
|
150
|
+
lines.push('DO NOT leave placeholder text. Each section must have concrete, implementation-ready content.');
|
|
151
|
+
return lines.join('\n');
|
|
152
|
+
}
|
|
94
153
|
//# sourceMappingURL=scaffoldPlanTool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffoldPlanTool.js","sourceRoot":"","sources":["../../../../src/services/ai/tools/scaffoldPlanTool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA0B;AAC1B,2CAA6B;AAC7B,6CAA+B;AAC/B,wCAA6E;AAC7E,2EAAwE;AACxE,uCAKqB;AAER,QAAA,gBAAgB,GAAG,IAAA,SAAI,EAAC;IACnC,WAAW,EAAE
|
|
1
|
+
{"version":3,"file":"scaffoldPlanTool.js","sourceRoot":"","sources":["../../../../src/services/ai/tools/scaffoldPlanTool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA0B;AAC1B,2CAA6B;AAC7B,6CAA+B;AAC/B,wCAA6E;AAC7E,2EAAwE;AACxE,uCAKqB;AAER,QAAA,gBAAgB,GAAG,IAAA,SAAI,EAAC;IACnC,WAAW,EAAE;;2EAE4D;IACzE,WAAW,EAAE,iCAAuB;IACpC,OAAO,EAAE,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AAsC,CAAC,CAAC;IACnD,KAAK,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAC/C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACtC,KAAK,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACnD,KAAK,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;IAC5D,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACjC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IAClD,KAAK,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IACxE,KAAK,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;IAC3D,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,+FAA+F,CAAC,CAAC;IAE5G,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../../../src/services/mcp/mcpServer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../../../src/services/mcp/mcpServer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiDH,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,SAAS,CAAqC;gBAE1C,OAAO,GAAE,gBAAqB;IAkB1C;;OAEG;IACH,OAAO,CAAC,aAAa;IAuYrB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA8U7B;;OAEG;IACH,OAAO,CAAC,6BAA6B;IA0NrC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwUzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiFzB;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA4DjC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAwNlC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAqW1B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B;;OAEG;IACH,OAAO,CAAC,GAAG;CAKZ;AA0ID;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAIhG"}
|
|
@@ -4,12 +4,46 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Exposes code analysis tools and semantic context as MCP resources.
|
|
6
6
|
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
7
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
41
|
exports.AIContextMCPServer = void 0;
|
|
9
42
|
exports.startMCPServer = startMCPServer;
|
|
10
43
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
11
44
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
12
45
|
const zod_1 = require("zod");
|
|
46
|
+
const path = __importStar(require("path"));
|
|
13
47
|
const tools_1 = require("../ai/tools");
|
|
14
48
|
const toolRegistry_1 = require("../ai/toolRegistry");
|
|
15
49
|
const contextBuilder_1 = require("../semantic/contextBuilder");
|
|
@@ -212,16 +246,19 @@ class AIContextMCPServer {
|
|
|
212
246
|
semantic: zod_1.z.boolean().default(true).optional()
|
|
213
247
|
.describe('Enable semantic analysis for richer templates'),
|
|
214
248
|
include: zod_1.z.array(zod_1.z.string()).optional().describe('Include patterns'),
|
|
215
|
-
exclude: zod_1.z.array(zod_1.z.string()).optional().describe('Exclude patterns')
|
|
249
|
+
exclude: zod_1.z.array(zod_1.z.string()).optional().describe('Exclude patterns'),
|
|
250
|
+
autoFill: zod_1.z.boolean().default(true).optional()
|
|
251
|
+
.describe('Automatically fill scaffolding with codebase-aware content (default: true)')
|
|
216
252
|
}
|
|
217
|
-
}, async ({ repoPath, type, outputDir, semantic, include, exclude }) => {
|
|
253
|
+
}, async ({ repoPath, type, outputDir, semantic, include, exclude, autoFill }) => {
|
|
218
254
|
const result = await tools_1.initializeContextTool.execute({
|
|
219
255
|
repoPath: repoPath || this.options.repoPath || process.cwd(),
|
|
220
256
|
type,
|
|
221
257
|
outputDir,
|
|
222
258
|
semantic,
|
|
223
259
|
include,
|
|
224
|
-
exclude
|
|
260
|
+
exclude,
|
|
261
|
+
autoFill
|
|
225
262
|
}, { toolCallId: '', messages: [] });
|
|
226
263
|
return {
|
|
227
264
|
content: [{
|
|
@@ -239,16 +276,19 @@ class AIContextMCPServer {
|
|
|
239
276
|
outputDir: zod_1.z.string().optional().describe('Output directory'),
|
|
240
277
|
title: zod_1.z.string().optional().describe('Plan title (defaults to formatted planName)'),
|
|
241
278
|
summary: zod_1.z.string().optional().describe('Plan summary/goal'),
|
|
242
|
-
semantic: zod_1.z.boolean().default(true).optional().describe('Enable semantic analysis')
|
|
279
|
+
semantic: zod_1.z.boolean().default(true).optional().describe('Enable semantic analysis'),
|
|
280
|
+
autoFill: zod_1.z.boolean().default(true).optional()
|
|
281
|
+
.describe('Automatically fill plan with codebase-aware content (default: true)')
|
|
243
282
|
}
|
|
244
|
-
}, async ({ planName, repoPath, outputDir, title, summary, semantic }) => {
|
|
283
|
+
}, async ({ planName, repoPath, outputDir, title, summary, semantic, autoFill }) => {
|
|
245
284
|
const result = await tools_1.scaffoldPlanTool.execute({
|
|
246
285
|
planName,
|
|
247
286
|
repoPath: repoPath || this.options.repoPath || process.cwd(),
|
|
248
287
|
outputDir,
|
|
249
288
|
title,
|
|
250
289
|
summary,
|
|
251
|
-
semantic
|
|
290
|
+
semantic,
|
|
291
|
+
autoFill
|
|
252
292
|
}, { toolCallId: '', messages: [] });
|
|
253
293
|
return {
|
|
254
294
|
content: [{
|
|
@@ -378,12 +418,16 @@ class AIContextMCPServer {
|
|
|
378
418
|
}
|
|
379
419
|
}, async ({ name, description, scale }) => {
|
|
380
420
|
try {
|
|
381
|
-
const
|
|
421
|
+
const resolvedRepoPath = path.resolve(repoPath);
|
|
422
|
+
const service = new workflow_1.WorkflowService(resolvedRepoPath);
|
|
382
423
|
const status = await service.init({
|
|
383
424
|
name,
|
|
384
425
|
description,
|
|
385
426
|
scale: scale,
|
|
386
427
|
});
|
|
428
|
+
// Include file paths for visibility
|
|
429
|
+
const contextPath = path.join(resolvedRepoPath, '.context');
|
|
430
|
+
const statusFilePath = path.join(contextPath, 'workflow', 'status.yaml');
|
|
387
431
|
return {
|
|
388
432
|
content: [{
|
|
389
433
|
type: 'text',
|
|
@@ -393,6 +437,8 @@ class AIContextMCPServer {
|
|
|
393
437
|
scale: (0, workflow_2.getScaleName)(status.project.scale),
|
|
394
438
|
currentPhase: status.project.current_phase,
|
|
395
439
|
phases: Object.keys(status.phases).filter((p) => status.phases[p].status !== 'skipped'),
|
|
440
|
+
statusFilePath,
|
|
441
|
+
contextPath,
|
|
396
442
|
}, null, 2)
|
|
397
443
|
}]
|
|
398
444
|
};
|
|
@@ -415,20 +461,23 @@ class AIContextMCPServer {
|
|
|
415
461
|
inputSchema: {}
|
|
416
462
|
}, async () => {
|
|
417
463
|
try {
|
|
418
|
-
const
|
|
464
|
+
const resolvedRepoPath = path.resolve(repoPath);
|
|
465
|
+
const service = new workflow_1.WorkflowService(resolvedRepoPath);
|
|
419
466
|
if (!(await service.hasWorkflow())) {
|
|
420
467
|
return {
|
|
421
468
|
content: [{
|
|
422
469
|
type: 'text',
|
|
423
470
|
text: JSON.stringify({
|
|
424
471
|
success: false,
|
|
425
|
-
error: 'No workflow found. Run workflowInit first.'
|
|
472
|
+
error: 'No workflow found. Run workflowInit first.',
|
|
473
|
+
statusFilePath: path.join(resolvedRepoPath, '.context', 'workflow', 'status.yaml')
|
|
426
474
|
}, null, 2)
|
|
427
475
|
}]
|
|
428
476
|
};
|
|
429
477
|
}
|
|
430
478
|
const summary = await service.getSummary();
|
|
431
479
|
const status = await service.getStatus();
|
|
480
|
+
const statusFilePath = path.join(resolvedRepoPath, '.context', 'workflow', 'status.yaml');
|
|
432
481
|
return {
|
|
433
482
|
content: [{
|
|
434
483
|
type: 'text',
|
|
@@ -444,6 +493,7 @@ class AIContextMCPServer {
|
|
|
444
493
|
isComplete: summary.isComplete,
|
|
445
494
|
phases: status.phases,
|
|
446
495
|
roles: status.roles,
|
|
496
|
+
statusFilePath,
|
|
447
497
|
}, null, 2)
|
|
448
498
|
}]
|
|
449
499
|
};
|
|
@@ -1755,57 +1805,92 @@ class AIContextMCPServer {
|
|
|
1755
1805
|
};
|
|
1756
1806
|
}
|
|
1757
1807
|
});
|
|
1758
|
-
// fillSkills -
|
|
1808
|
+
// fillSkills - Return fill instructions for skill files (NO API key required)
|
|
1759
1809
|
this.server.registerTool('fillSkills', {
|
|
1760
|
-
description:
|
|
1810
|
+
description: `Fill/personalize skill files with codebase-aware content.
|
|
1811
|
+
Returns semantic context and fill instructions for the AI agent to process.
|
|
1812
|
+
The AI agent MUST then fill each skill file using the provided context and instructions.`,
|
|
1761
1813
|
inputSchema: {
|
|
1762
1814
|
skills: zod_1.z.array(zod_1.z.string()).optional().describe('Specific skills to fill (default: all scaffolded)'),
|
|
1763
|
-
force: zod_1.z.boolean().optional().describe('
|
|
1764
|
-
useSemanticContext: zod_1.z.boolean().default(true).optional().describe('Use semantic context mode (more token efficient)'),
|
|
1765
|
-
useLsp: zod_1.z.boolean().optional().describe('Enable LSP for deeper analysis'),
|
|
1815
|
+
force: zod_1.z.boolean().optional().describe('Include already-filled skills'),
|
|
1766
1816
|
}
|
|
1767
|
-
}, async ({ skills, force
|
|
1817
|
+
}, async ({ skills, force }) => {
|
|
1768
1818
|
try {
|
|
1769
|
-
const
|
|
1770
|
-
const
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1819
|
+
const fs = require('fs-extra');
|
|
1820
|
+
const registry = createSkillRegistry(repoPath);
|
|
1821
|
+
const skillsDir = path.join(repoPath, '.context', 'skills');
|
|
1822
|
+
// Check if skills directory exists
|
|
1823
|
+
if (!await fs.pathExists(skillsDir)) {
|
|
1824
|
+
return {
|
|
1825
|
+
content: [{
|
|
1826
|
+
type: 'text',
|
|
1827
|
+
text: JSON.stringify({
|
|
1828
|
+
success: false,
|
|
1829
|
+
error: 'Skills directory does not exist. Run scaffoldSkills first.',
|
|
1830
|
+
skillsDir,
|
|
1831
|
+
}, null, 2)
|
|
1832
|
+
}]
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
// Discover skills to fill
|
|
1836
|
+
const discovered = await registry.discoverAll();
|
|
1837
|
+
let skillsToFill = discovered.all;
|
|
1838
|
+
// Filter by specific skills if provided
|
|
1839
|
+
if (skills && skills.length > 0) {
|
|
1840
|
+
skillsToFill = skillsToFill.filter((s) => skills.includes(s.slug));
|
|
1841
|
+
}
|
|
1842
|
+
// Filter out already-filled skills unless force is set
|
|
1843
|
+
if (!force) {
|
|
1844
|
+
skillsToFill = skillsToFill.filter((s) => {
|
|
1845
|
+
// Check if skill file exists and has minimal content (likely a template)
|
|
1846
|
+
if (!fs.existsSync(s.path))
|
|
1847
|
+
return true;
|
|
1848
|
+
const content = fs.readFileSync(s.path, 'utf-8');
|
|
1849
|
+
// Consider it unfilled if it's a template (has placeholder markers)
|
|
1850
|
+
return content.includes('<!-- TODO') || content.includes('[PLACEHOLDER]') || content.length < 500;
|
|
1851
|
+
});
|
|
1852
|
+
}
|
|
1853
|
+
if (skillsToFill.length === 0) {
|
|
1854
|
+
return {
|
|
1855
|
+
content: [{
|
|
1856
|
+
type: 'text',
|
|
1857
|
+
text: JSON.stringify({
|
|
1858
|
+
success: true,
|
|
1859
|
+
message: 'No skills need filling. Use force=true to refill existing skills.',
|
|
1860
|
+
skillsDir,
|
|
1861
|
+
}, null, 2)
|
|
1862
|
+
}]
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
// Build semantic context
|
|
1866
|
+
let semanticContext;
|
|
1867
|
+
try {
|
|
1868
|
+
semanticContext = await (0, tools_1.getOrBuildContext)(repoPath);
|
|
1869
|
+
}
|
|
1870
|
+
catch (contextError) {
|
|
1871
|
+
// Continue without semantic context
|
|
1872
|
+
semanticContext = undefined;
|
|
1873
|
+
}
|
|
1874
|
+
// Build fill instructions for each skill
|
|
1875
|
+
const fillInstructions = skillsToFill.map((skill) => ({
|
|
1876
|
+
skillPath: skill.path,
|
|
1877
|
+
skillSlug: skill.slug,
|
|
1878
|
+
skillName: skill.metadata.name || skill.slug,
|
|
1879
|
+
description: skill.metadata.description || '',
|
|
1880
|
+
isBuiltIn: skill.isBuiltIn,
|
|
1881
|
+
instructions: getSkillFillInstructions(skill.slug),
|
|
1882
|
+
}));
|
|
1883
|
+
// Build comprehensive fill prompt
|
|
1884
|
+
const fillPrompt = buildSkillFillPrompt(fillInstructions, semanticContext);
|
|
1800
1885
|
return {
|
|
1801
1886
|
content: [{
|
|
1802
1887
|
type: 'text',
|
|
1803
1888
|
text: JSON.stringify({
|
|
1804
1889
|
success: true,
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1890
|
+
skillsToFill: fillInstructions,
|
|
1891
|
+
semanticContext,
|
|
1892
|
+
fillPrompt,
|
|
1893
|
+
instructions: 'IMPORTANT: You MUST now fill each skill file using the semantic context and fill instructions provided. Write the content to each skillPath.',
|
|
1809
1894
|
}, null, 2)
|
|
1810
1895
|
}]
|
|
1811
1896
|
};
|
|
@@ -1850,6 +1935,115 @@ class AIContextMCPServer {
|
|
|
1850
1935
|
}
|
|
1851
1936
|
}
|
|
1852
1937
|
exports.AIContextMCPServer = AIContextMCPServer;
|
|
1938
|
+
/**
|
|
1939
|
+
* Get fill instructions for a skill based on its type
|
|
1940
|
+
*/
|
|
1941
|
+
function getSkillFillInstructions(skillSlug) {
|
|
1942
|
+
const instructions = {
|
|
1943
|
+
'commit-message': `Fill this skill with:
|
|
1944
|
+
- Commit message format conventions for this project
|
|
1945
|
+
- Examples of good commit messages from the codebase
|
|
1946
|
+
- Branch naming conventions if applicable
|
|
1947
|
+
- Semantic versioning guidelines`,
|
|
1948
|
+
'pr-review': `Fill this skill with:
|
|
1949
|
+
- PR review checklist specific to this codebase
|
|
1950
|
+
- Code quality standards to check
|
|
1951
|
+
- Testing requirements before merge
|
|
1952
|
+
- Documentation expectations`,
|
|
1953
|
+
'code-review': `Fill this skill with:
|
|
1954
|
+
- Code review guidelines for this project
|
|
1955
|
+
- Common patterns to look for
|
|
1956
|
+
- Security and performance considerations
|
|
1957
|
+
- Style and convention checks`,
|
|
1958
|
+
'test-generation': `Fill this skill with:
|
|
1959
|
+
- Testing framework and conventions used
|
|
1960
|
+
- Test file organization patterns
|
|
1961
|
+
- Mocking strategies for this codebase
|
|
1962
|
+
- Coverage requirements`,
|
|
1963
|
+
'documentation': `Fill this skill with:
|
|
1964
|
+
- Documentation standards for this project
|
|
1965
|
+
- JSDoc/TSDoc conventions
|
|
1966
|
+
- README structure expectations
|
|
1967
|
+
- API documentation guidelines`,
|
|
1968
|
+
'refactoring': `Fill this skill with:
|
|
1969
|
+
- Refactoring patterns common in this codebase
|
|
1970
|
+
- Code smell detection guidelines
|
|
1971
|
+
- Safe refactoring procedures
|
|
1972
|
+
- Testing requirements after refactoring`,
|
|
1973
|
+
'bug-investigation': `Fill this skill with:
|
|
1974
|
+
- Debugging workflow for this codebase
|
|
1975
|
+
- Common bug patterns and their fixes
|
|
1976
|
+
- Logging and error handling conventions
|
|
1977
|
+
- Test verification steps`,
|
|
1978
|
+
'feature-breakdown': `Fill this skill with:
|
|
1979
|
+
- Feature decomposition approach
|
|
1980
|
+
- Task estimation guidelines
|
|
1981
|
+
- Dependency identification process
|
|
1982
|
+
- Integration points to consider`,
|
|
1983
|
+
'api-design': `Fill this skill with:
|
|
1984
|
+
- API design patterns used in this project
|
|
1985
|
+
- Endpoint naming conventions
|
|
1986
|
+
- Request/response format standards
|
|
1987
|
+
- Versioning and deprecation policies`,
|
|
1988
|
+
'security-audit': `Fill this skill with:
|
|
1989
|
+
- Security checklist for this codebase
|
|
1990
|
+
- Common vulnerabilities to check
|
|
1991
|
+
- Authentication/authorization patterns
|
|
1992
|
+
- Data validation requirements`,
|
|
1993
|
+
};
|
|
1994
|
+
return instructions[skillSlug] || `Fill this skill with project-specific content for ${skillSlug}:
|
|
1995
|
+
- Identify relevant patterns from the codebase
|
|
1996
|
+
- Include specific examples from the project
|
|
1997
|
+
- Add conventions and best practices
|
|
1998
|
+
- Reference important files and components`;
|
|
1999
|
+
}
|
|
2000
|
+
/**
|
|
2001
|
+
* Build comprehensive fill prompt for skills
|
|
2002
|
+
*/
|
|
2003
|
+
function buildSkillFillPrompt(skills, semanticContext) {
|
|
2004
|
+
const lines = [];
|
|
2005
|
+
lines.push('# Skill Fill Instructions');
|
|
2006
|
+
lines.push('');
|
|
2007
|
+
lines.push('You MUST fill each of the following skill files with codebase-specific content.');
|
|
2008
|
+
lines.push('');
|
|
2009
|
+
if (semanticContext) {
|
|
2010
|
+
lines.push('## Codebase Context');
|
|
2011
|
+
lines.push('');
|
|
2012
|
+
lines.push('Use this semantic context to understand the codebase:');
|
|
2013
|
+
lines.push('');
|
|
2014
|
+
lines.push('```');
|
|
2015
|
+
lines.push(semanticContext.length > 6000 ? semanticContext.substring(0, 6000) + '\n...(truncated)' : semanticContext);
|
|
2016
|
+
lines.push('```');
|
|
2017
|
+
lines.push('');
|
|
2018
|
+
}
|
|
2019
|
+
lines.push('## Skills to Fill');
|
|
2020
|
+
lines.push('');
|
|
2021
|
+
for (const skill of skills) {
|
|
2022
|
+
lines.push(`### ${skill.skillName} (${skill.skillSlug})`);
|
|
2023
|
+
lines.push(`**Path:** \`${skill.skillPath}\``);
|
|
2024
|
+
if (skill.description) {
|
|
2025
|
+
lines.push(`**Description:** ${skill.description}`);
|
|
2026
|
+
}
|
|
2027
|
+
lines.push('');
|
|
2028
|
+
lines.push('**Fill Instructions:**');
|
|
2029
|
+
lines.push(skill.instructions);
|
|
2030
|
+
lines.push('');
|
|
2031
|
+
}
|
|
2032
|
+
lines.push('## Action Required');
|
|
2033
|
+
lines.push('');
|
|
2034
|
+
lines.push('For each skill listed above:');
|
|
2035
|
+
lines.push('1. Read the current skill template');
|
|
2036
|
+
lines.push('2. Generate codebase-specific content based on the instructions and context');
|
|
2037
|
+
lines.push('3. Write the filled content to the skill file');
|
|
2038
|
+
lines.push('');
|
|
2039
|
+
lines.push('Each skill should be personalized with:');
|
|
2040
|
+
lines.push('- Specific examples from this codebase');
|
|
2041
|
+
lines.push('- Project-specific conventions and patterns');
|
|
2042
|
+
lines.push('- References to relevant files and components');
|
|
2043
|
+
lines.push('');
|
|
2044
|
+
lines.push('DO NOT leave placeholder text. Each skill must have meaningful, project-specific content.');
|
|
2045
|
+
return lines.join('\n');
|
|
2046
|
+
}
|
|
1853
2047
|
/**
|
|
1854
2048
|
* Create and start an MCP server
|
|
1855
2049
|
*/
|