mcp-spec-cli 1.0.9 → 1.2.0
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/api/spec-workflow.openapi.yaml +31 -23
- package/dist/cli.js +25 -14
- package/dist/cli.js.map +1 -1
- package/dist/features/shared/MarkdownTaskUpdater.d.ts +14 -0
- package/dist/features/shared/MarkdownTaskUpdater.d.ts.map +1 -0
- package/dist/features/shared/MarkdownTaskUpdater.js +75 -0
- package/dist/features/shared/MarkdownTaskUpdater.js.map +1 -0
- package/dist/features/shared/SpecManager.d.ts +4 -1
- package/dist/features/shared/SpecManager.d.ts.map +1 -1
- package/dist/features/shared/SpecManager.js +16 -16
- package/dist/features/shared/SpecManager.js.map +1 -1
- package/dist/features/shared/TaskGuidanceRepository.d.ts +36 -0
- package/dist/features/shared/TaskGuidanceRepository.d.ts.map +1 -0
- package/dist/features/shared/TaskGuidanceRepository.js +23 -0
- package/dist/features/shared/TaskGuidanceRepository.js.map +1 -0
- package/dist/features/shared/TaskLexer.d.ts +18 -0
- package/dist/features/shared/TaskLexer.d.ts.map +1 -0
- package/dist/features/shared/TaskLexer.js +60 -0
- package/dist/features/shared/TaskLexer.js.map +1 -0
- package/dist/features/shared/TemplateRepository.d.ts +14 -0
- package/dist/features/shared/TemplateRepository.d.ts.map +1 -0
- package/dist/features/shared/TemplateRepository.js +40 -0
- package/dist/features/shared/TemplateRepository.js.map +1 -0
- package/dist/features/shared/WorkflowStateRepository.d.ts +18 -0
- package/dist/features/shared/WorkflowStateRepository.d.ts.map +1 -0
- package/dist/features/shared/WorkflowStateRepository.js +30 -0
- package/dist/features/shared/WorkflowStateRepository.js.map +1 -0
- package/dist/features/shared/markdownTaskUpdater.d.ts +14 -0
- package/dist/features/shared/markdownTaskUpdater.d.ts.map +1 -0
- package/dist/features/shared/markdownTaskUpdater.js +75 -0
- package/dist/features/shared/markdownTaskUpdater.js.map +1 -0
- package/dist/features/shared/openApiLoader.d.ts +37 -42
- package/dist/features/shared/openApiLoader.d.ts.map +1 -1
- package/dist/features/shared/openApiLoader.js +13 -127
- package/dist/features/shared/openApiLoader.js.map +1 -1
- package/dist/features/shared/taskGuidanceRepository.d.ts +36 -0
- package/dist/features/shared/taskGuidanceRepository.d.ts.map +1 -0
- package/dist/features/shared/taskGuidanceRepository.js +23 -0
- package/dist/features/shared/taskGuidanceRepository.js.map +1 -0
- package/dist/features/shared/taskLexer.d.ts +18 -0
- package/dist/features/shared/taskLexer.d.ts.map +1 -0
- package/dist/features/shared/taskLexer.js +66 -0
- package/dist/features/shared/taskLexer.js.map +1 -0
- package/dist/features/shared/taskParser.d.ts +32 -13
- package/dist/features/shared/taskParser.d.ts.map +1 -1
- package/dist/features/shared/taskParser.js +72 -240
- package/dist/features/shared/taskParser.js.map +1 -1
- package/dist/features/shared/templateRepository.d.ts +14 -0
- package/dist/features/shared/templateRepository.d.ts.map +1 -0
- package/dist/features/shared/templateRepository.js +40 -0
- package/dist/features/shared/templateRepository.js.map +1 -0
- package/dist/features/shared/workflowStateRepository.d.ts +18 -0
- package/dist/features/shared/workflowStateRepository.d.ts.map +1 -0
- package/dist/features/shared/workflowStateRepository.js +30 -0
- package/dist/features/shared/workflowStateRepository.js.map +1 -0
- package/dist/features/task/TaskGuidancePresenter.d.ts +20 -0
- package/dist/features/task/TaskGuidancePresenter.d.ts.map +1 -0
- package/dist/features/task/TaskGuidancePresenter.js +84 -0
- package/dist/features/task/TaskGuidancePresenter.js.map +1 -0
- package/dist/features/task/completeTask.d.ts +3 -3
- package/dist/features/task/completeTask.d.ts.map +1 -1
- package/dist/features/task/completeTask.js +63 -309
- package/dist/features/task/completeTask.js.map +1 -1
- package/dist/features/task/taskGuidancePresenter.d.ts +20 -0
- package/dist/features/task/taskGuidancePresenter.d.ts.map +1 -0
- package/dist/features/task/taskGuidancePresenter.js +84 -0
- package/dist/features/task/taskGuidancePresenter.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TaskGuidancePresenter handles the construction of complex UI guidance strings
|
|
3
|
+
* for "Next Step" and model prompts during task implementation.
|
|
4
|
+
*/
|
|
5
|
+
export declare class TaskGuidancePresenter {
|
|
6
|
+
private static get template();
|
|
7
|
+
/**
|
|
8
|
+
* Build task guidance text after task completion.
|
|
9
|
+
*/
|
|
10
|
+
static buildNextStepGuidance(tasksContent: string, completedTaskNumber?: string, isFirstTask?: boolean): string;
|
|
11
|
+
/**
|
|
12
|
+
* Extract the first uncompleted task with its context using TaskLexer.
|
|
13
|
+
*/
|
|
14
|
+
static extractFirstUncompletedSubtask(tasksContent: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get formatted completion message.
|
|
17
|
+
*/
|
|
18
|
+
static getCompletionMessage(type: 'taskCompleted' | 'allCompleted' | 'alreadyCompleted' | 'batchSucceeded' | 'batchCompleted', taskNumber?: string): string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=taskGuidancePresenter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taskGuidancePresenter.d.ts","sourceRoot":"","sources":["../../../src/features/task/taskGuidancePresenter.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,KAAK,QAAQ,GAG1B;IAED;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAC1B,YAAY,EAAE,MAAM,EACpB,mBAAmB,CAAC,EAAE,MAAM,EAC5B,WAAW,GAAE,OAAe,GAC3B,MAAM;IA8CT;;OAEG;IACH,MAAM,CAAC,8BAA8B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAcnE;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,cAAc,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,gBAAgB,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM;CAY5J"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { openApiLoader, OpenApiLoader } from '../shared/openApiLoader.js';
|
|
2
|
+
import { TaskLexer } from '../shared/taskLexer.js';
|
|
3
|
+
/**
|
|
4
|
+
* TaskGuidancePresenter handles the construction of complex UI guidance strings
|
|
5
|
+
* for "Next Step" and model prompts during task implementation.
|
|
6
|
+
*/
|
|
7
|
+
export class TaskGuidancePresenter {
|
|
8
|
+
static get template() {
|
|
9
|
+
openApiLoader.loadSpec();
|
|
10
|
+
return openApiLoader.getTaskGuidanceTemplate();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Build task guidance text after task completion.
|
|
14
|
+
*/
|
|
15
|
+
static buildNextStepGuidance(tasksContent, completedTaskNumber, isFirstTask = false) {
|
|
16
|
+
const template = this.template;
|
|
17
|
+
if (!template) {
|
|
18
|
+
throw new Error('Failed to load task guidance template from OpenAPI specification');
|
|
19
|
+
}
|
|
20
|
+
const firstSubtask = this.extractFirstUncompletedSubtask(tasksContent);
|
|
21
|
+
const parts = [];
|
|
22
|
+
// Add separator line
|
|
23
|
+
parts.push(template.separator);
|
|
24
|
+
parts.push('');
|
|
25
|
+
// Add task header
|
|
26
|
+
parts.push(template.header);
|
|
27
|
+
parts.push(tasksContent);
|
|
28
|
+
parts.push('');
|
|
29
|
+
// Add model instructions
|
|
30
|
+
parts.push(template.instructions.prefix);
|
|
31
|
+
const taskFocusText = OpenApiLoader.replaceVariables(template.instructions.taskFocus, { firstSubtask });
|
|
32
|
+
parts.push(taskFocusText);
|
|
33
|
+
parts.push('');
|
|
34
|
+
parts.push(template.instructions.progressTracking);
|
|
35
|
+
parts.push(template.instructions.workflow);
|
|
36
|
+
parts.push('');
|
|
37
|
+
// Add model prompt based on scenario
|
|
38
|
+
let prompt;
|
|
39
|
+
if (isFirstTask) {
|
|
40
|
+
prompt = OpenApiLoader.replaceVariables(template.prompts.firstTask, { firstSubtask });
|
|
41
|
+
}
|
|
42
|
+
else if (completedTaskNumber) {
|
|
43
|
+
if (completedTaskNumber.includes('.')) {
|
|
44
|
+
prompt = OpenApiLoader.replaceVariables(template.prompts.continueTask, { taskNumber: completedTaskNumber, firstSubtask });
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
prompt = OpenApiLoader.replaceVariables(template.prompts.nextTask, { taskNumber: completedTaskNumber, firstSubtask });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
prompt = OpenApiLoader.replaceVariables(template.prompts.batchContinue, { firstSubtask });
|
|
52
|
+
}
|
|
53
|
+
parts.push(prompt);
|
|
54
|
+
return parts.join('\n');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Extract the first uncompleted task with its context using TaskLexer.
|
|
58
|
+
*/
|
|
59
|
+
static extractFirstUncompletedSubtask(tasksContent) {
|
|
60
|
+
const tokens = TaskLexer.lex(tasksContent);
|
|
61
|
+
// Find the first list item that is NOT checked
|
|
62
|
+
const uncompletedTaskToken = tokens.find(token => token.type === 'list_item' && !token.checked);
|
|
63
|
+
if (uncompletedTaskToken) {
|
|
64
|
+
// Clean the text to return only the task description
|
|
65
|
+
return uncompletedTaskToken.text.replace(/\[\s?\]\s*/, '').trim();
|
|
66
|
+
}
|
|
67
|
+
return 'Next task';
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get formatted completion message.
|
|
71
|
+
*/
|
|
72
|
+
static getCompletionMessage(type, taskNumber) {
|
|
73
|
+
const template = this.template;
|
|
74
|
+
if (!template) {
|
|
75
|
+
throw new Error('Failed to load task guidance template from OpenAPI specification');
|
|
76
|
+
}
|
|
77
|
+
const message = template.completionMessages[type];
|
|
78
|
+
if (taskNumber && message.includes('${taskNumber}')) {
|
|
79
|
+
return OpenApiLoader.replaceVariables(message, { taskNumber });
|
|
80
|
+
}
|
|
81
|
+
return message;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=taskGuidancePresenter.js.map
|
|
@@ -0,0 +1 @@
|
|
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AC,GAAG,CAAC,YAAY,CAAC,CAAC;QAE3C,+CAA+C;QAC/C,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEhG,IAAI,oBAAoB,EAAE,CAAC;YACzB,qDAAqD;YACrD,OAAO,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACpE,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,IAAiG,EAAE,UAAmB;QAChJ,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;QAED,MAAM,OAAO,GAAG,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YACpD,OAAO,aAAa,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-spec-cli",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "MCP server for managing spec workflow (requirements, design, implementation)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "git+https://github.com/
|
|
29
|
+
"url": "git+https://github.com/benjamesmurray/mcp-spec-cli.git"
|
|
30
30
|
},
|
|
31
31
|
"bugs": {
|
|
32
|
-
"url": "https://github.com/
|
|
32
|
+
"url": "https://github.com/benjamesmurray/mcp-spec-cli/issues"
|
|
33
33
|
},
|
|
34
|
-
"homepage": "https://github.com/
|
|
34
|
+
"homepage": "https://github.com/benjamesmurray/mcp-spec-cli#readme",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.0.6",
|
|
37
37
|
"@types/js-yaml": "^4.0.9",
|