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
|
@@ -259,8 +259,9 @@ components:
|
|
|
259
259
|
1. Read the requirements-guide below
|
|
260
260
|
2. First read ${path}/requirements.md, then start writing the document
|
|
261
261
|
3. After completing the document, use specs-workflow tool with action.type="check" to check the document format
|
|
262
|
-
4. When check passes, the model must
|
|
263
|
-
5.
|
|
262
|
+
4. When check passes, the model must check if there are any ambiguities or uncertainties to be addressed before proceeding. The model should address these itself unless there is a type of uncertainty which needs guidance from the user.
|
|
263
|
+
5. Once all ambiguities are resolved, the model must ask the user "Do the requirements look good?", and must not proceed to the design document until getting explicit approval (e.g., "yes", "approved", "looks good", etc.)
|
|
264
|
+
6. When the user approves, the model must use the specs-workflow tool with action.type="confirm" to enter the design phase
|
|
264
265
|
|
|
265
266
|
Special case - Skip requirements phase:
|
|
266
267
|
- Only consider skipping when user explicitly requests (e.g., "skip requirements document", "go directly to design")
|
|
@@ -316,8 +317,9 @@ components:
|
|
|
316
317
|
1. Read the requirements-guide below
|
|
317
318
|
2. First read ${path}/requirements.md, then start writing the document
|
|
318
319
|
3. After completing the document, use specs-workflow tool with action.type="check" to check the document format
|
|
319
|
-
4. When check passes, the model must
|
|
320
|
-
5.
|
|
320
|
+
4. When check passes, the model must check if there are any ambiguities or uncertainties to be addressed before proceeding. The model should address these itself unless there is a type of uncertainty which needs guidance from the user.
|
|
321
|
+
5. Once all ambiguities are resolved, the model must ask the user "Do the requirements look good?", and must not proceed to the design document until getting explicit approval (e.g., "yes", "approved", "looks good", etc.)
|
|
322
|
+
6. When the user approves, the model must use the specs-workflow tool with action.type="confirm" to enter the design phase
|
|
321
323
|
|
|
322
324
|
Special case - Skip requirements phase:
|
|
323
325
|
- Only consider skipping when user explicitly requests (e.g., "skip requirements document", "go directly to design")
|
|
@@ -344,10 +346,11 @@ components:
|
|
|
344
346
|
🔄 Current status: Checking requirements document (current) → Next step: get user approval
|
|
345
347
|
|
|
346
348
|
Model please continue with the following actions:
|
|
347
|
-
1.
|
|
348
|
-
2.
|
|
349
|
-
3.
|
|
350
|
-
4.
|
|
349
|
+
1. Check if there are any ambiguities or uncertainties to be addressed before proceeding. Address these yourself unless there is a type of uncertainty which needs guidance from the user.
|
|
350
|
+
2. Once all ambiguities are resolved, ask the user "Do the requirements look good?"
|
|
351
|
+
3. Wait for explicit user approval (e.g., "yes", "approved", "looks good", etc.)
|
|
352
|
+
4. After approval, use the specs-workflow tool with action.type="confirm"
|
|
353
|
+
5. Enter the design phase
|
|
351
354
|
|
|
352
355
|
- stage: design
|
|
353
356
|
progress:
|
|
@@ -371,8 +374,9 @@ components:
|
|
|
371
374
|
1. Read the design-guide below
|
|
372
375
|
2. First read ${path}/design.md, then start writing the document
|
|
373
376
|
3. After completing the document, use specs-workflow tool with action.type="check" to check the document format
|
|
374
|
-
4. When check passes, the model must
|
|
375
|
-
5.
|
|
377
|
+
4. When check passes, the model must check if there are any ambiguities or uncertainties to be addressed before proceeding. The model should address these itself unless there is a type of uncertainty which needs guidance from the user.
|
|
378
|
+
5. Once all ambiguities are resolved, the model must ask the user "Does the design look good?", and must not proceed to task writing until getting explicit approval (e.g., "yes", "approved", "looks good", etc.)
|
|
379
|
+
6. When the user approves, the model must use the specs-workflow tool with action.type="confirm" to enter the tasks phase
|
|
376
380
|
|
|
377
381
|
Special case - Skip design phase:
|
|
378
382
|
- Only consider skipping when user explicitly requests (e.g., "skip design document", "go directly to tasks")
|
|
@@ -402,11 +406,12 @@ components:
|
|
|
402
406
|
🔄 Current status: Checking design document (current) → Next step: get user approval
|
|
403
407
|
|
|
404
408
|
Model please continue with the following actions:
|
|
405
|
-
1.
|
|
406
|
-
2.
|
|
407
|
-
3.
|
|
408
|
-
4.
|
|
409
|
-
5.
|
|
409
|
+
1. Check if there are any ambiguities or uncertainties to be addressed before proceeding. Address these yourself unless there is a type of uncertainty which needs guidance from the user.
|
|
410
|
+
2. Once all ambiguities are resolved, ask the user "Does the design look good?"
|
|
411
|
+
3. Wait for explicit user approval (e.g., "yes", "approved", "looks good", etc.)
|
|
412
|
+
4. Must not proceed to task writing until getting explicit approval
|
|
413
|
+
5. After approval, use the specs-workflow tool with action.type="confirm"
|
|
414
|
+
6. Enter the tasks phase
|
|
410
415
|
|
|
411
416
|
- stage: tasks
|
|
412
417
|
progress:
|
|
@@ -429,9 +434,10 @@ components:
|
|
|
429
434
|
Model please continue with the following actions:
|
|
430
435
|
1. Read the task writing guide below
|
|
431
436
|
2. First read ${path}/tasks.md, then start writing the document
|
|
432
|
-
3.
|
|
433
|
-
4.
|
|
434
|
-
5. When
|
|
437
|
+
3. Once the tasks are documented, do a refresh of the tasks.md document by adding dependencies between the tasks, structuring the tasks into a sensible order of execution, and annotating the tasks with information from the requirements and the design docs.
|
|
438
|
+
4. After completing the refresh, use specs-workflow tool with action.type="check" to check the document format
|
|
439
|
+
5. When check passes, the model must ask the user "Does the task plan look good?", and continue after getting explicit approval
|
|
440
|
+
6. When the user approves, the model must use the specs-workflow tool with action.type="confirm" to complete the workflow
|
|
435
441
|
|
|
436
442
|
|
|
437
443
|
- stage: tasks
|
|
@@ -611,8 +617,9 @@ components:
|
|
|
611
617
|
1. Read the design-guide below
|
|
612
618
|
2. First read ${path}/design.md, then start writing the document
|
|
613
619
|
3. After completing the document, use specs-workflow tool with action.type="check" to check the document format
|
|
614
|
-
4. When check passes, the model must
|
|
615
|
-
5.
|
|
620
|
+
4. When check passes, the model must check if there are any ambiguities or uncertainties to be addressed before proceeding. The model should address these itself unless there is a type of uncertainty which needs guidance from the user.
|
|
621
|
+
5. Once all ambiguities are resolved, the model must ask the user "Does the design look good?", and must not proceed to task writing until getting explicit approval (e.g., "yes", "approved", "looks good", etc.)
|
|
622
|
+
6. When the user approves, the model must use the specs-workflow tool with action.type="confirm" to enter the tasks phase
|
|
616
623
|
|
|
617
624
|
Special case - Skip design phase:
|
|
618
625
|
- Only consider skipping when user explicitly requests (e.g., "skip design document", "go directly to tasks")
|
|
@@ -646,9 +653,10 @@ components:
|
|
|
646
653
|
Model please continue with the following actions:
|
|
647
654
|
1. Read the task writing guide below
|
|
648
655
|
2. First read ${path}/tasks.md, then start writing the document
|
|
649
|
-
3.
|
|
650
|
-
4.
|
|
651
|
-
5. When
|
|
656
|
+
3. Once the tasks are documented, do a refresh of the tasks.md document by adding dependencies between the tasks, structuring the tasks into a sensible order of execution, and annotating the tasks with information from the requirements and the design docs.
|
|
657
|
+
4. After completing the refresh, use specs-workflow tool with action.type="check" to check the document format
|
|
658
|
+
5. When check passes, the model must ask the user "Does the task plan look good?", and continue after getting explicit approval
|
|
659
|
+
6. When the user approves, the model must use the specs-workflow tool with action.type="confirm" to complete the workflow
|
|
652
660
|
|
|
653
661
|
|
|
654
662
|
- stage: tasks
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,8 @@ import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import { parseArgs } from 'util';
|
|
5
5
|
import { SpecManager } from './features/shared/SpecManager.js';
|
|
6
|
-
import {
|
|
6
|
+
import { TemplateRepository } from './features/shared/templateRepository.js';
|
|
7
|
+
import { WorkflowStateRepository } from './features/shared/workflowStateRepository.js';
|
|
7
8
|
import { completeTask } from './features/task/completeTask.js';
|
|
8
9
|
import { Logger } from './logger.js';
|
|
9
10
|
const { positionals, values } = parseArgs({
|
|
@@ -65,9 +66,12 @@ Options:
|
|
|
65
66
|
mkdirSync(featurePath, { recursive: true });
|
|
66
67
|
}
|
|
67
68
|
SpecManager.resolveFeaturePath(baseDir, featureName);
|
|
68
|
-
const reqPath = join(featurePath, 'requirements
|
|
69
|
+
const reqPath = join(featurePath, WorkflowStateRepository.getStageFileName('requirements'));
|
|
69
70
|
if (!existsSync(reqPath)) {
|
|
70
|
-
const content =
|
|
71
|
+
const content = TemplateRepository.getInterpolatedTemplate('requirements', {
|
|
72
|
+
featureName,
|
|
73
|
+
introduction: values.description || 'Initial requirements'
|
|
74
|
+
});
|
|
71
75
|
writeFileSync(reqPath, content, 'utf-8');
|
|
72
76
|
}
|
|
73
77
|
output = SpecManager.getStatusSummary(baseDir, featureName);
|
|
@@ -78,33 +82,40 @@ Options:
|
|
|
78
82
|
const state = SpecManager.getWorkflowState(featurePath);
|
|
79
83
|
let message = '';
|
|
80
84
|
if (!state.requirements.exists) {
|
|
81
|
-
const content =
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
const content = TemplateRepository.getInterpolatedTemplate('requirements', {
|
|
86
|
+
featureName: featurePath.split('/').pop() || 'feature',
|
|
87
|
+
introduction: values.instruction || ''
|
|
88
|
+
});
|
|
89
|
+
writeFileSync(join(featurePath, WorkflowStateRepository.getStageFileName('requirements')), content, 'utf-8');
|
|
90
|
+
message = `Initialized ${WorkflowStateRepository.getStageFileName('requirements')}.`;
|
|
84
91
|
}
|
|
85
92
|
else if (!state.requirements.edited) {
|
|
86
|
-
message =
|
|
93
|
+
message = `Please finish editing ${WorkflowStateRepository.getStageFileName('requirements')} (remove all <template> tags) before advancing.`;
|
|
87
94
|
if (values.instruction)
|
|
88
95
|
message += `\n> Reminder instruction: ${values.instruction}`;
|
|
89
96
|
}
|
|
90
97
|
else if (!state.design.exists) {
|
|
91
|
-
let content =
|
|
98
|
+
let content = TemplateRepository.getInterpolatedTemplate('design', {
|
|
99
|
+
featureName: featurePath.split('/').pop() || 'feature'
|
|
100
|
+
});
|
|
92
101
|
if (values.instruction)
|
|
93
102
|
content += `\n\n> **Guidance:** ${values.instruction}`;
|
|
94
|
-
writeFileSync(join(featurePath, 'design
|
|
95
|
-
message =
|
|
103
|
+
writeFileSync(join(featurePath, WorkflowStateRepository.getStageFileName('design')), content, 'utf-8');
|
|
104
|
+
message = `Requirements complete. Scaffolding ${WorkflowStateRepository.getStageFileName('design')}.`;
|
|
96
105
|
}
|
|
97
106
|
else if (!state.design.edited) {
|
|
98
|
-
message =
|
|
107
|
+
message = `Please finish editing ${WorkflowStateRepository.getStageFileName('design')} (remove all <template> tags) before advancing.`;
|
|
99
108
|
if (values.instruction)
|
|
100
109
|
message += `\n> Reminder instruction: ${values.instruction}`;
|
|
101
110
|
}
|
|
102
111
|
else if (!state.tasks.exists) {
|
|
103
|
-
let content =
|
|
112
|
+
let content = TemplateRepository.getInterpolatedTemplate('tasks', {
|
|
113
|
+
featureName: featurePath.split('/').pop() || 'feature'
|
|
114
|
+
});
|
|
104
115
|
if (values.instruction)
|
|
105
116
|
content += `\n\n> **Guidance:** ${values.instruction}`;
|
|
106
|
-
writeFileSync(join(featurePath, 'tasks
|
|
107
|
-
message =
|
|
117
|
+
writeFileSync(join(featurePath, WorkflowStateRepository.getStageFileName('tasks')), content, 'utf-8');
|
|
118
|
+
message = `Design complete. Scaffolding ${WorkflowStateRepository.getStageFileName('tasks')}.`;
|
|
108
119
|
}
|
|
109
120
|
else {
|
|
110
121
|
message = 'All documents exist. Proceed with `exec todo`.';
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,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OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,GAAG,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACtB,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MarkdownTaskUpdater performs surgical updates to task checkboxes in Markdown content.
|
|
3
|
+
*/
|
|
4
|
+
export declare class MarkdownTaskUpdater {
|
|
5
|
+
/**
|
|
6
|
+
* Updates the checkbox for a task and its ancestors if they become fully completed.
|
|
7
|
+
*/
|
|
8
|
+
static updateTaskStatus(content: string, taskId: string, completed: boolean): string;
|
|
9
|
+
/**
|
|
10
|
+
* Updates the checkbox for multiple tasks specified by their IDs.
|
|
11
|
+
*/
|
|
12
|
+
static updateBatchTaskStatus(content: string, taskIds: string[], completed: boolean): string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=MarkdownTaskUpdater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownTaskUpdater.d.ts","sourceRoot":"","sources":["../../../src/features/shared/MarkdownTaskUpdater.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,mBAAmB;IAC9B;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM;IAuDpF;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM;CAW7F"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { TaskLexer } from './TaskLexer.js';
|
|
2
|
+
/**
|
|
3
|
+
* MarkdownTaskUpdater performs surgical updates to task checkboxes in Markdown content.
|
|
4
|
+
*/
|
|
5
|
+
export class MarkdownTaskUpdater {
|
|
6
|
+
/**
|
|
7
|
+
* Updates the checkbox for a task and its ancestors if they become fully completed.
|
|
8
|
+
*/
|
|
9
|
+
static updateTaskStatus(content, taskId, completed) {
|
|
10
|
+
const taskTokens = TaskLexer.lex(content);
|
|
11
|
+
let lines = content.split('\n');
|
|
12
|
+
const tasksToUpdate = new Set();
|
|
13
|
+
tasksToUpdate.add(taskId);
|
|
14
|
+
// Auto-mark parent tasks if all siblings are completed
|
|
15
|
+
if (completed && taskId.includes('.')) {
|
|
16
|
+
const parts = taskId.split('.');
|
|
17
|
+
let currentId = taskId;
|
|
18
|
+
while (currentId.includes('.')) {
|
|
19
|
+
const parentId = currentId.split('.').slice(0, -1).join('.');
|
|
20
|
+
const siblingTokens = taskTokens.filter(t => {
|
|
21
|
+
if (t.type !== 'list_item')
|
|
22
|
+
return false;
|
|
23
|
+
const match = t.text.match(/^(\d+(?:\.\d+)*)\./);
|
|
24
|
+
if (!match)
|
|
25
|
+
return false;
|
|
26
|
+
const id = match[1];
|
|
27
|
+
return id.startsWith(parentId + '.') && id.split('.').length === parentId.split('.').length + 1;
|
|
28
|
+
});
|
|
29
|
+
const allSiblingsDone = siblingTokens.every(t => {
|
|
30
|
+
const match = t.text.match(/^(\d+(?:\.\d+)*)\./);
|
|
31
|
+
const id = match ? match[1] : '';
|
|
32
|
+
return id === currentId ? true : !!t.checked;
|
|
33
|
+
});
|
|
34
|
+
if (allSiblingsDone) {
|
|
35
|
+
tasksToUpdate.add(parentId);
|
|
36
|
+
currentId = parentId;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
for (const id of tasksToUpdate) {
|
|
44
|
+
const taskToken = taskTokens.find(token => {
|
|
45
|
+
if (token.type !== 'list_item')
|
|
46
|
+
return false;
|
|
47
|
+
const idMatch = token.text.match(/^(\d+(?:\.\d+)*)\./);
|
|
48
|
+
return idMatch && idMatch[1] === id;
|
|
49
|
+
});
|
|
50
|
+
if (taskToken) {
|
|
51
|
+
const lineIndex = taskToken.line - 1;
|
|
52
|
+
const originalLine = lines[lineIndex];
|
|
53
|
+
const newStatus = completed ? '[x]' : '[ ]';
|
|
54
|
+
lines[lineIndex] = originalLine.replace(/\[\s?[x ]?\s?\]/, newStatus);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return lines.join('\n');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Updates the checkbox for multiple tasks specified by their IDs.
|
|
61
|
+
*/
|
|
62
|
+
static updateBatchTaskStatus(content, taskIds, completed) {
|
|
63
|
+
let updatedContent = content;
|
|
64
|
+
for (const taskId of taskIds) {
|
|
65
|
+
try {
|
|
66
|
+
updatedContent = this.updateTaskStatus(updatedContent, taskId, completed);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.warn(`Could not update task ${taskId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return updatedContent;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=MarkdownTaskUpdater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownTaskUpdater.js","sourceRoot":"","sources":["../../../src/features/shared/MarkdownTaskUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAe,EAAE,MAAc,EAAE,SAAkB;QACzE,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEhC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;QACxC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAE1B,uDAAuD;QACvD,IAAI,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,SAAS,GAAG,MAAM,CAAC;YAEvB,OAAO,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC7D,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;oBAC1C,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW;wBAAE,OAAO,KAAK,CAAC;oBACzC,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAA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E,CAAC;YACtC,CAAC,CAAC,CAAC;YAEH,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC;gBACrC,MAAM,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;gBACtC,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;gBAC5C,KAAK,CAAC,SAAS,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,OAAe,EAAE,OAAiB,EAAE,SAAkB;QACjF,IAAI,cAAc,GAAG,OAAO,CAAC;QAC7B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;YAC5E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,yBAAyB,MAAM,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC7G,CAAC;QACH,CAAC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -14,6 +14,9 @@ export interface WorkflowState {
|
|
|
14
14
|
};
|
|
15
15
|
featurePath: string;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* SpecManager manages the feature path resolution and overall workflow state.
|
|
19
|
+
*/
|
|
17
20
|
export declare class SpecManager {
|
|
18
21
|
private static LAST_USED_FILE;
|
|
19
22
|
/**
|
|
@@ -26,7 +29,7 @@ export declare class SpecManager {
|
|
|
26
29
|
*/
|
|
27
30
|
static getWorkflowState(featurePath: string): WorkflowState;
|
|
28
31
|
/**
|
|
29
|
-
* Returns a dense Markdown output
|
|
32
|
+
* Returns a dense Markdown output representing the current status.
|
|
30
33
|
*/
|
|
31
34
|
static getStatusSummary(baseDir: string, featureName?: string): string;
|
|
32
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpecManager.d.ts","sourceRoot":"","sources":["../../../src/features/shared/SpecManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SpecManager.d.ts","sourceRoot":"","sources":["../../../src/features/shared/SpecManager.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG,sBAAsB,GAAG,wBAAwB,GAAG,kBAAkB,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAExI,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IACnD,MAAM,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAC7C,KAAK,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAqB;IAElD;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM;IA6BxE,OAAO,CAAC,MAAM,CAAC,WAAW;IAI1B;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa;IAkB3D;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM;CAqCvE"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { isDocumentEdited } from './documentAnalyzer.js';
|
|
4
|
+
import { WorkflowStateRepository } from './workflowStateRepository.js';
|
|
5
|
+
/**
|
|
6
|
+
* SpecManager manages the feature path resolution and overall workflow state.
|
|
7
|
+
*/
|
|
4
8
|
export class SpecManager {
|
|
5
9
|
static LAST_USED_FILE = '.spec_last_used';
|
|
6
10
|
/**
|
|
@@ -8,12 +12,10 @@ export class SpecManager {
|
|
|
8
12
|
*/
|
|
9
13
|
static resolveFeaturePath(baseDir, featureName) {
|
|
10
14
|
if (featureName) {
|
|
11
|
-
// 1. Exact match in base
|
|
12
15
|
if (existsSync(join(baseDir, featureName))) {
|
|
13
16
|
this.setLastUsed(baseDir, featureName);
|
|
14
17
|
return join(baseDir, featureName);
|
|
15
18
|
}
|
|
16
|
-
// 2. Look in common subdirectories
|
|
17
19
|
const commonDirs = ['specs', 'docs'];
|
|
18
20
|
for (const dir of commonDirs) {
|
|
19
21
|
if (existsSync(join(baseDir, dir, featureName))) {
|
|
@@ -21,12 +23,9 @@ export class SpecManager {
|
|
|
21
23
|
return join(baseDir, dir, featureName);
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
|
-
// 3. Fallback: create in baseDir
|
|
25
|
-
// If it doesn't exist anywhere, assume we are creating it in the current dir
|
|
26
26
|
this.setLastUsed(baseDir, featureName);
|
|
27
27
|
return join(baseDir, featureName);
|
|
28
28
|
}
|
|
29
|
-
// Implicit Context (no featureName provided)
|
|
30
29
|
const lastUsedPath = join(baseDir, this.LAST_USED_FILE);
|
|
31
30
|
if (existsSync(lastUsedPath)) {
|
|
32
31
|
const lastUsed = readFileSync(lastUsedPath, 'utf-8').trim();
|
|
@@ -44,7 +43,8 @@ export class SpecManager {
|
|
|
44
43
|
* Infers the workflow state dynamically.
|
|
45
44
|
*/
|
|
46
45
|
static getWorkflowState(featurePath) {
|
|
47
|
-
const checkDoc = (
|
|
46
|
+
const checkDoc = (stage) => {
|
|
47
|
+
const fileName = WorkflowStateRepository.getStageFileName(stage);
|
|
48
48
|
const filePath = join(featurePath, fileName);
|
|
49
49
|
return {
|
|
50
50
|
exists: existsSync(filePath),
|
|
@@ -52,34 +52,34 @@ export class SpecManager {
|
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
54
|
return {
|
|
55
|
-
requirements: checkDoc('requirements
|
|
56
|
-
design: checkDoc('design
|
|
57
|
-
tasks: checkDoc('tasks
|
|
55
|
+
requirements: checkDoc('requirements'),
|
|
56
|
+
design: checkDoc('design'),
|
|
57
|
+
tasks: checkDoc('tasks'),
|
|
58
58
|
featurePath
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* Returns a dense Markdown output
|
|
62
|
+
* Returns a dense Markdown output representing the current status.
|
|
63
63
|
*/
|
|
64
64
|
static getStatusSummary(baseDir, featureName) {
|
|
65
65
|
try {
|
|
66
66
|
const featurePath = this.resolveFeaturePath(baseDir, featureName);
|
|
67
67
|
const state = this.getWorkflowState(featurePath);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
const reqStatus = state.requirements.exists ? (state.requirements.edited ? 'Approved' : 'Pending Edits') : 'Missing';
|
|
69
|
+
const desStatus = state.design.exists ? (state.design.edited ? 'Approved' : 'Pending Edits') : 'Missing';
|
|
70
|
+
const tskStatus = state.tasks.exists ? (state.tasks.edited ? 'Active' : 'Pending Edits') : 'Missing';
|
|
71
71
|
let nextSteps = '';
|
|
72
72
|
let phase = 'Specify';
|
|
73
73
|
if (!state.requirements.exists || !state.requirements.edited) {
|
|
74
|
-
phase = '
|
|
74
|
+
phase = WorkflowStateRepository.getStageDisplayName('requirements');
|
|
75
75
|
nextSteps = 'Run `sc_exec plan` to finalize specifications/requirements.';
|
|
76
76
|
}
|
|
77
77
|
else if (!state.design.exists || !state.design.edited) {
|
|
78
|
-
phase = '
|
|
78
|
+
phase = WorkflowStateRepository.getStageDisplayName('design');
|
|
79
79
|
nextSteps = 'Run `sc_exec plan` to create an implementation plan (design).';
|
|
80
80
|
}
|
|
81
81
|
else if (!state.tasks.exists || !state.tasks.edited) {
|
|
82
|
-
phase = '
|
|
82
|
+
phase = WorkflowStateRepository.getStageDisplayName('tasks');
|
|
83
83
|
nextSteps = 'Run `sc_exec plan` to scaffold tasks.';
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpecManager.js","sourceRoot":"","sources":["../../../src/features/shared/SpecManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"SpecManager.js","sourceRoot":"","sources":["../../../src/features/shared/SpecManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAWvE;;GAEG;AACH,MAAM,OAAO,WAAW;IACd,MAAM,CAAC,cAAc,GAAG,iBAAiB,CAAC;IAElD;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAe,EAAE,WAAoB;QAC7D,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;gBAC3C,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;gBACvC,OAAO,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YACpC,CAAC;YACD,MAAM,UAAU,GAAG,CAAC,OAAO,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Repository {
|
|
5
|
+
/**
|
|
6
|
+
* Loads the guidance template structure from the spec.
|
|
7
|
+
*/
|
|
8
|
+
static getGuidanceTemplate(): {
|
|
9
|
+
separator: string;
|
|
10
|
+
header: string;
|
|
11
|
+
instructions: {
|
|
12
|
+
prefix: string;
|
|
13
|
+
taskFocus: string;
|
|
14
|
+
progressTracking: string;
|
|
15
|
+
workflow: string;
|
|
16
|
+
};
|
|
17
|
+
prompts: {
|
|
18
|
+
firstTask: string;
|
|
19
|
+
nextTask: string;
|
|
20
|
+
continueTask: string;
|
|
21
|
+
batchContinue: string;
|
|
22
|
+
};
|
|
23
|
+
completionMessages: {
|
|
24
|
+
taskCompleted: string;
|
|
25
|
+
allCompleted: string;
|
|
26
|
+
alreadyCompleted: string;
|
|
27
|
+
batchSucceeded: string;
|
|
28
|
+
batchCompleted: string;
|
|
29
|
+
};
|
|
30
|
+
} | null;
|
|
31
|
+
/**
|
|
32
|
+
* Gets a specific completion message by key.
|
|
33
|
+
*/
|
|
34
|
+
static getCompletionMessage(key: string): string;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=TaskGuidanceRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskGuidanceRepository.d.ts","sourceRoot":"","sources":["../../../src/features/shared/TaskGuidanceRepository.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;IAK1B;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAKjD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { openApiLoader } from './openApiLoader.js';
|
|
2
|
+
/**
|
|
3
|
+
* TaskGuidanceRepository manages guidance-related data from the OpenAPI spec.
|
|
4
|
+
*/
|
|
5
|
+
export class TaskGuidanceRepository {
|
|
6
|
+
/**
|
|
7
|
+
* Loads the guidance template structure from the spec.
|
|
8
|
+
*/
|
|
9
|
+
static getGuidanceTemplate() {
|
|
10
|
+
openApiLoader.loadSpec();
|
|
11
|
+
return openApiLoader.getTaskGuidanceTemplate();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Gets a specific completion message by key.
|
|
15
|
+
*/
|
|
16
|
+
static getCompletionMessage(key) {
|
|
17
|
+
const template = this.getGuidanceTemplate();
|
|
18
|
+
if (!template)
|
|
19
|
+
throw new Error('Task guidance template not found');
|
|
20
|
+
return template.completionMessages[key] || '';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=TaskGuidanceRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskGuidanceRepository.js","sourceRoot":"","sources":["../../../src/features/shared/TaskGuidanceRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,mBAAmB;QACxB,aAAa,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,aAAa,CAAC,uBAAuB,EAAE,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,GAAW;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC5C,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACnE,OAAQ,QAAQ,CAAC,kBAA0B,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface TaskToken {
|
|
2
|
+
type: 'heading' | 'list_item';
|
|
3
|
+
text: string;
|
|
4
|
+
depth?: number;
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
raw: string;
|
|
7
|
+
line: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* TaskLexer uses 'marked' to extract relevant task tokens and their line numbers.
|
|
11
|
+
*/
|
|
12
|
+
export declare class TaskLexer {
|
|
13
|
+
/**
|
|
14
|
+
* Lexes the markdown content into a stream of task-related tokens.
|
|
15
|
+
*/
|
|
16
|
+
static lex(content: string): TaskToken[];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=TaskLexer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskLexer.d.ts","sourceRoot":"","sources":["../../../src/features/shared/TaskLexer.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,SAAS,GAAG,WAAW,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE;CAqDzC"}
|