specweave 0.22.14 → 0.23.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/CLAUDE.md +178 -1
- package/dist/src/cli/commands/import-external.d.ts +22 -0
- package/dist/src/cli/commands/import-external.d.ts.map +1 -0
- package/dist/src/cli/commands/import-external.js +282 -0
- package/dist/src/cli/commands/import-external.js.map +1 -0
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +46 -0
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/helpers/github-repo-selector.d.ts +59 -0
- package/dist/src/cli/helpers/github-repo-selector.d.ts.map +1 -0
- package/dist/src/cli/helpers/github-repo-selector.js +265 -0
- package/dist/src/cli/helpers/github-repo-selector.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.js +5 -17
- package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
- package/dist/src/config/types.d.ts +16 -16
- package/dist/src/core/increment/ac-status-manager.d.ts.map +1 -1
- package/dist/src/core/increment/ac-status-manager.js +4 -2
- package/dist/src/core/increment/ac-status-manager.js.map +1 -1
- package/dist/src/core/increment/completion-validator.d.ts +30 -1
- package/dist/src/core/increment/completion-validator.d.ts.map +1 -1
- package/dist/src/core/increment/completion-validator.js +151 -3
- package/dist/src/core/increment/completion-validator.js.map +1 -1
- package/dist/src/core/increment/increment-archiver.d.ts +25 -0
- package/dist/src/core/increment/increment-archiver.d.ts.map +1 -1
- package/dist/src/core/increment/increment-archiver.js +130 -3
- package/dist/src/core/increment/increment-archiver.js.map +1 -1
- package/dist/src/core/living-docs/feature-archiver.d.ts +37 -0
- package/dist/src/core/living-docs/feature-archiver.d.ts.map +1 -1
- package/dist/src/core/living-docs/feature-archiver.js +262 -18
- package/dist/src/core/living-docs/feature-archiver.js.map +1 -1
- package/dist/src/core/living-docs/feature-id-manager.d.ts +17 -0
- package/dist/src/core/living-docs/feature-id-manager.d.ts.map +1 -1
- package/dist/src/core/living-docs/feature-id-manager.js +25 -0
- package/dist/src/core/living-docs/feature-id-manager.js.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.d.ts +14 -0
- package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.js +46 -0
- package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
- package/dist/src/core/repo-structure/repo-id-generator.d.ts +20 -0
- package/dist/src/core/repo-structure/repo-id-generator.d.ts.map +1 -1
- package/dist/src/core/repo-structure/repo-id-generator.js +44 -0
- package/dist/src/core/repo-structure/repo-id-generator.js.map +1 -1
- package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
- package/dist/src/core/repo-structure/repo-structure-manager.js +5 -2
- package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
- package/dist/src/core/sync/sync-event-logger.d.ts +15 -1
- package/dist/src/core/sync/sync-event-logger.d.ts.map +1 -1
- package/dist/src/core/sync/sync-event-logger.js +39 -1
- package/dist/src/core/sync/sync-event-logger.js.map +1 -1
- package/dist/src/core/types/sync-config-validator.d.ts +57 -0
- package/dist/src/core/types/sync-config-validator.d.ts.map +1 -0
- package/dist/src/core/types/sync-config-validator.js +116 -0
- package/dist/src/core/types/sync-config-validator.js.map +1 -0
- package/dist/src/importers/duplicate-detector.d.ts +107 -0
- package/dist/src/importers/duplicate-detector.d.ts.map +1 -0
- package/dist/src/importers/duplicate-detector.js +189 -0
- package/dist/src/importers/duplicate-detector.js.map +1 -0
- package/dist/src/importers/import-coordinator.d.ts +15 -0
- package/dist/src/importers/import-coordinator.d.ts.map +1 -1
- package/dist/src/importers/import-coordinator.js +43 -1
- package/dist/src/importers/import-coordinator.js.map +1 -1
- package/dist/src/importers/item-converter.d.ts +5 -0
- package/dist/src/importers/item-converter.d.ts.map +1 -1
- package/dist/src/importers/item-converter.js +27 -2
- package/dist/src/importers/item-converter.js.map +1 -1
- package/dist/src/importers/rate-limiter.d.ts +128 -0
- package/dist/src/importers/rate-limiter.d.ts.map +1 -0
- package/dist/src/importers/rate-limiter.js +200 -0
- package/dist/src/importers/rate-limiter.js.map +1 -0
- package/dist/src/init/compliance/types.d.ts +2 -2
- package/dist/src/integrations/ado/ado-client.d.ts +6 -0
- package/dist/src/integrations/ado/ado-client.d.ts.map +1 -1
- package/dist/src/integrations/ado/ado-client.js +23 -0
- package/dist/src/integrations/ado/ado-client.js.map +1 -1
- package/dist/src/integrations/jira/jira-client.d.ts +6 -0
- package/dist/src/integrations/jira/jira-client.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-client.js +38 -0
- package/dist/src/integrations/jira/jira-client.js.map +1 -1
- package/dist/src/sync/external-item-sync-service.d.ts +150 -0
- package/dist/src/sync/external-item-sync-service.d.ts.map +1 -0
- package/dist/src/sync/external-item-sync-service.js +241 -0
- package/dist/src/sync/external-item-sync-service.js.map +1 -0
- package/dist/src/sync/format-preservation-sync.d.ts +90 -0
- package/dist/src/sync/format-preservation-sync.d.ts.map +1 -0
- package/dist/src/sync/format-preservation-sync.js +173 -0
- package/dist/src/sync/format-preservation-sync.js.map +1 -0
- package/dist/src/sync/index.d.ts +8 -0
- package/dist/src/sync/index.d.ts.map +1 -0
- package/dist/src/sync/index.js +6 -0
- package/dist/src/sync/index.js.map +1 -0
- package/dist/src/sync/sync-coordinator.d.ts +49 -0
- package/dist/src/sync/sync-coordinator.d.ts.map +1 -0
- package/dist/src/sync/sync-coordinator.js +248 -0
- package/dist/src/sync/sync-coordinator.js.map +1 -0
- package/dist/src/sync/sync-metadata.d.ts +75 -0
- package/dist/src/sync/sync-metadata.d.ts.map +1 -0
- package/dist/src/sync/sync-metadata.js +100 -0
- package/dist/src/sync/sync-metadata.js.map +1 -0
- package/dist/src/types/living-docs-us-file.d.ts +63 -0
- package/dist/src/types/living-docs-us-file.d.ts.map +1 -0
- package/dist/src/types/living-docs-us-file.js +27 -0
- package/dist/src/types/living-docs-us-file.js.map +1 -0
- package/dist/src/validators/format-preservation-validator.d.ts +127 -0
- package/dist/src/validators/format-preservation-validator.d.ts.map +1 -0
- package/dist/src/validators/format-preservation-validator.js +187 -0
- package/dist/src/validators/format-preservation-validator.js.map +1 -0
- package/package.json +3 -2
- package/plugins/specweave/.claude-plugin/plugin.json +20 -0
- package/plugins/specweave/commands/specweave-archive-features.md +11 -1
- package/plugins/specweave/commands/specweave-archive.md +51 -15
- package/plugins/specweave/commands/specweave-import-docs.md +88 -278
- package/plugins/specweave/commands/specweave-import-external.md +407 -0
- package/plugins/specweave/hooks/post-edit-spec.sh +94 -0
- package/plugins/specweave/hooks/post-increment-completion.sh +0 -0
- package/plugins/specweave/hooks/post-spec-update.sh +0 -0
- package/plugins/specweave/hooks/post-task-completion.sh +13 -3
- package/plugins/specweave/hooks/post-write-spec.sh +91 -0
- package/plugins/specweave/lib/hooks/auto-transition.js +1 -1
- package/plugins/specweave/lib/hooks/auto-transition.js.bak +50 -0
- package/plugins/specweave/lib/hooks/auto-transition.ts +1 -1
- package/plugins/specweave/lib/hooks/auto-transition.ts.bak +84 -0
- package/plugins/specweave/lib/hooks/git-diff-analyzer.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/git-diff-analyzer.d.ts.bak +89 -0
- package/plugins/specweave/lib/hooks/git-diff-analyzer.js.bak +142 -0
- package/plugins/specweave/lib/hooks/git-diff-analyzer.ts.bak +269 -0
- package/plugins/specweave/lib/hooks/invoke-translator-skill.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/invoke-translator-skill.d.ts.bak +60 -0
- package/plugins/specweave/lib/hooks/invoke-translator-skill.js +1 -1
- package/plugins/specweave/lib/hooks/invoke-translator-skill.js.bak +155 -0
- package/plugins/specweave/lib/hooks/invoke-translator-skill.ts +1 -1
- package/plugins/specweave/lib/hooks/invoke-translator-skill.ts.bak +264 -0
- package/plugins/specweave/lib/hooks/prepare-reflection-context.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/prepare-reflection-context.d.ts.bak +42 -0
- package/plugins/specweave/lib/hooks/prepare-reflection-context.js.bak +110 -0
- package/plugins/specweave/lib/hooks/prepare-reflection-context.ts.bak +178 -0
- package/plugins/specweave/lib/hooks/reflection-config-loader.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/reflection-config-loader.d.ts.bak +45 -0
- package/plugins/specweave/lib/hooks/reflection-config-loader.js.bak +92 -0
- package/plugins/specweave/lib/hooks/reflection-config-loader.ts.bak +156 -0
- package/plugins/specweave/lib/hooks/reflection-parser.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/reflection-parser.d.ts.bak +33 -0
- package/plugins/specweave/lib/hooks/reflection-parser.js.bak +301 -0
- package/plugins/specweave/lib/hooks/reflection-parser.ts.bak +484 -0
- package/plugins/specweave/lib/hooks/reflection-prompt-builder.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/reflection-prompt-builder.d.ts.bak +56 -0
- package/plugins/specweave/lib/hooks/reflection-prompt-builder.js.bak +182 -0
- package/plugins/specweave/lib/hooks/reflection-prompt-builder.ts.bak +306 -0
- package/plugins/specweave/lib/hooks/reflection-storage.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/reflection-storage.d.ts.bak +64 -0
- package/plugins/specweave/lib/hooks/reflection-storage.js.bak +231 -0
- package/plugins/specweave/lib/hooks/reflection-storage.ts.bak +369 -0
- package/plugins/specweave/lib/hooks/run-self-reflection.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/run-self-reflection.d.ts.bak +43 -0
- package/plugins/specweave/lib/hooks/run-self-reflection.js.bak +132 -0
- package/plugins/specweave/lib/hooks/run-self-reflection.ts.bak +258 -0
- package/plugins/specweave/lib/hooks/sync-cache.js.bak +294 -0
- package/plugins/specweave/lib/hooks/sync-living-docs.d.js.bak +1 -0
- package/plugins/specweave/lib/hooks/sync-living-docs.d.ts.bak +27 -0
- package/plugins/specweave/lib/hooks/sync-living-docs.js +35 -1
- package/plugins/specweave/lib/hooks/sync-living-docs.js.bak +339 -0
- package/plugins/specweave/lib/hooks/sync-us-tasks.js +179 -3
- package/plugins/specweave/lib/hooks/sync-us-tasks.js.bak +476 -0
- package/plugins/specweave/lib/hooks/translate-file.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/translate-file.d.ts.bak +59 -0
- package/plugins/specweave/lib/hooks/translate-file.js +1 -1
- package/plugins/specweave/lib/hooks/translate-file.js.bak +289 -0
- package/plugins/specweave/lib/hooks/translate-file.ts +1 -1
- package/plugins/specweave/lib/hooks/translate-file.ts.bak +428 -0
- package/plugins/specweave/lib/hooks/translate-living-docs.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/translate-living-docs.d.ts.bak +13 -0
- package/plugins/specweave/lib/hooks/translate-living-docs.js.bak +119 -0
- package/plugins/specweave/lib/hooks/translate-living-docs.ts.bak +224 -0
- package/plugins/specweave/lib/hooks/update-ac-status.js +1 -1
- package/plugins/specweave/lib/hooks/update-ac-status.js.bak +51 -0
- package/plugins/specweave/lib/hooks/update-ac-status.ts +1 -1
- package/plugins/specweave/lib/hooks/update-ac-status.ts.bak +103 -0
- package/plugins/specweave/lib/hooks/update-tasks-md.d.js.bak +1 -0
- package/plugins/specweave/lib/hooks/update-tasks-md.d.ts.bak +29 -0
- package/plugins/specweave/lib/hooks/update-tasks-md.js.bak +296 -0
- package/plugins/specweave/lib/hooks/update-tasks-md.ts.bak +489 -0
- package/plugins/specweave/lib/vendor/core/increment/ac-status-manager.d.ts +115 -0
- package/plugins/specweave/lib/vendor/core/increment/ac-status-manager.js +345 -0
- package/plugins/specweave/lib/vendor/core/increment/ac-status-manager.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/increment/active-increment-manager.d.ts +106 -0
- package/plugins/specweave/lib/vendor/core/increment/active-increment-manager.js +220 -0
- package/plugins/specweave/lib/vendor/core/increment/active-increment-manager.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/increment/auto-transition-manager.d.ts +60 -0
- package/plugins/specweave/lib/vendor/core/increment/auto-transition-manager.js +192 -0
- package/plugins/specweave/lib/vendor/core/increment/auto-transition-manager.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/increment/duplicate-detector.d.ts +52 -0
- package/plugins/specweave/lib/vendor/core/increment/duplicate-detector.js +276 -0
- package/plugins/specweave/lib/vendor/core/increment/duplicate-detector.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/increment/metadata-manager.d.ts +163 -0
- package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +541 -0
- package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/types/increment-metadata.d.ts +157 -0
- package/plugins/specweave/lib/vendor/core/types/increment-metadata.js +191 -0
- package/plugins/specweave/lib/vendor/core/types/increment-metadata.js.map +1 -0
- package/plugins/specweave/lib/vendor/generators/spec/task-parser.d.ts +95 -0
- package/plugins/specweave/lib/vendor/generators/spec/task-parser.js +301 -0
- package/plugins/specweave/lib/vendor/generators/spec/task-parser.js.map +1 -0
- package/plugins/specweave/lib/vendor/utils/logger.d.ts +48 -0
- package/plugins/specweave/lib/vendor/utils/logger.js +53 -0
- package/plugins/specweave/lib/vendor/utils/logger.js.map +1 -0
- package/plugins/specweave/lib/vendor/utils/translation.d.ts +187 -0
- package/plugins/specweave/lib/vendor/utils/translation.js +414 -0
- package/plugins/specweave/lib/vendor/utils/translation.js.map +1 -0
- package/plugins/specweave-github/commands/specweave-github-update-user-story.md +1 -1
- package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +1 -1
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +531 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
async function updateTasksMd(incrementId) {
|
|
5
|
+
try {
|
|
6
|
+
console.log(`
|
|
7
|
+
\u{1F504} Updating tasks.md for increment: ${incrementId}`);
|
|
8
|
+
const incrementDir = path.join(process.cwd(), ".specweave", "increments", incrementId);
|
|
9
|
+
if (!fs.existsSync(incrementDir)) {
|
|
10
|
+
console.error(`\u274C Increment directory not found: ${incrementDir}`);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
const tasksPath = path.join(incrementDir, "tasks.md");
|
|
14
|
+
if (!fs.existsSync(tasksPath)) {
|
|
15
|
+
console.error(`\u274C tasks.md not found: ${tasksPath}`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
const originalContent = await fs.readFile(tasksPath, "utf-8");
|
|
19
|
+
const lines = originalContent.split("\n");
|
|
20
|
+
console.log(`\u{1F4D6} Read tasks.md (${lines.length} lines)`);
|
|
21
|
+
const tasks = parseTaskStatus(lines);
|
|
22
|
+
console.log(`\u{1F4CB} Found ${tasks.length} tasks`);
|
|
23
|
+
const { completedTasks, fixes } = detectCompletedTasks(lines);
|
|
24
|
+
let updatedContent = originalContent;
|
|
25
|
+
let autoFixedCount = 0;
|
|
26
|
+
if (fixes.length > 0) {
|
|
27
|
+
console.log(`\u{1F527} Auto-fixing ${fixes.length} task consistency issue(s)...`);
|
|
28
|
+
updatedContent = applyConsistencyFixes(originalContent, fixes);
|
|
29
|
+
autoFixedCount = fixes.length;
|
|
30
|
+
console.log("\u2705 Task consistency auto-fixed");
|
|
31
|
+
}
|
|
32
|
+
if (completedTasks.length === 0 && fixes.length === 0) {
|
|
33
|
+
console.log("\u2705 No new task completions or consistency fixes needed");
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (completedTasks.length > 0) {
|
|
37
|
+
console.log(`\u{1F3AF} Detected ${completedTasks.length} completed task(s):`, completedTasks);
|
|
38
|
+
}
|
|
39
|
+
for (const taskId of completedTasks) {
|
|
40
|
+
updatedContent = markTaskComplete(updatedContent, taskId);
|
|
41
|
+
}
|
|
42
|
+
const updatedLines = updatedContent.split("\n");
|
|
43
|
+
const totalTasks = countTotalTasks(updatedLines);
|
|
44
|
+
const completedCount = countCompletedTasks(updatedLines);
|
|
45
|
+
const progress = Math.round(completedCount / totalTasks * 100);
|
|
46
|
+
console.log(`\u{1F4CA} Progress: ${completedCount}/${totalTasks} (${progress}%)`);
|
|
47
|
+
updatedContent = updateProgressHeader(updatedContent, completedCount, totalTasks, progress);
|
|
48
|
+
await fs.writeFile(tasksPath, updatedContent, "utf-8");
|
|
49
|
+
console.log(`\u2705 Updated ${tasksPath}`);
|
|
50
|
+
if (autoFixedCount > 0) {
|
|
51
|
+
console.log(`\u{1F527} Auto-fixed ${autoFixedCount} consistency issue(s)`);
|
|
52
|
+
}
|
|
53
|
+
console.log(` Completed: ${completedCount}/${totalTasks}`);
|
|
54
|
+
console.log(` Progress: ${progress}%
|
|
55
|
+
`);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error("\u274C Error updating tasks.md:", error);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function parseTaskStatus(lines) {
|
|
62
|
+
const tasks = [];
|
|
63
|
+
const taskPattern = /^###\s+(T-?\d+[-A-Z]*):?\s+(.+)/;
|
|
64
|
+
lines.forEach((line, index) => {
|
|
65
|
+
const match = line.match(taskPattern);
|
|
66
|
+
if (match) {
|
|
67
|
+
const taskId = match[1];
|
|
68
|
+
let status = "pending";
|
|
69
|
+
for (let i = index + 1; i < Math.min(index + 5, lines.length); i++) {
|
|
70
|
+
const nextLine = lines[i];
|
|
71
|
+
if (nextLine.includes("**Status**:")) {
|
|
72
|
+
if (nextLine.includes("[x] Completed")) {
|
|
73
|
+
status = "completed";
|
|
74
|
+
} else if (nextLine.includes("\u23F3 Pending") || nextLine.includes("[ ] Pending")) {
|
|
75
|
+
status = "pending";
|
|
76
|
+
} else if (nextLine.includes("\u{1F504} In Progress") || nextLine.includes("in_progress")) {
|
|
77
|
+
status = "in_progress";
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
tasks.push({
|
|
83
|
+
taskId,
|
|
84
|
+
lineNumber: index,
|
|
85
|
+
currentStatus: status
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return tasks;
|
|
90
|
+
}
|
|
91
|
+
function detectCompletedTasks(lines) {
|
|
92
|
+
const completedTasks = [];
|
|
93
|
+
const fixes = [];
|
|
94
|
+
const warnings = [];
|
|
95
|
+
const taskPattern = /^###\s+(T-\d+[-A-Z]*):?\s+(.+)/;
|
|
96
|
+
for (let i = 0; i < lines.length; i++) {
|
|
97
|
+
const line = lines[i];
|
|
98
|
+
const taskMatch = line.match(taskPattern);
|
|
99
|
+
if (!taskMatch) continue;
|
|
100
|
+
const taskId = taskMatch[1];
|
|
101
|
+
const taskTitle = taskMatch[2];
|
|
102
|
+
const hasCompleteMarker = taskTitle.includes("\u2705 COMPLETE");
|
|
103
|
+
const taskEndIndex = findNextTaskStart(lines, i + 1);
|
|
104
|
+
const implementationSection = findImplementationSection(lines, i, taskEndIndex);
|
|
105
|
+
let allCheckboxesComplete = false;
|
|
106
|
+
if (implementationSection) {
|
|
107
|
+
allCheckboxesComplete = checkAllCheckboxesComplete(implementationSection);
|
|
108
|
+
}
|
|
109
|
+
if (hasCompleteMarker && implementationSection) {
|
|
110
|
+
if (allCheckboxesComplete) {
|
|
111
|
+
if (!completedTasks.includes(taskId)) {
|
|
112
|
+
completedTasks.push(taskId);
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
fixes.push({
|
|
116
|
+
taskId,
|
|
117
|
+
lineNumber: i,
|
|
118
|
+
action: "remove-complete-marker",
|
|
119
|
+
currentLine: line
|
|
120
|
+
});
|
|
121
|
+
warnings.push(`${taskId}: Header has \u2705 COMPLETE but not all checkboxes checked`);
|
|
122
|
+
}
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (hasCompleteMarker && !implementationSection) {
|
|
126
|
+
fixes.push({
|
|
127
|
+
taskId,
|
|
128
|
+
lineNumber: i,
|
|
129
|
+
action: "remove-complete-marker",
|
|
130
|
+
currentLine: line
|
|
131
|
+
});
|
|
132
|
+
warnings.push(`${taskId}: Header has \u2705 COMPLETE but no implementation section to verify`);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (!hasCompleteMarker && implementationSection && allCheckboxesComplete) {
|
|
136
|
+
fixes.push({
|
|
137
|
+
taskId,
|
|
138
|
+
lineNumber: i,
|
|
139
|
+
action: "add-complete-marker",
|
|
140
|
+
currentLine: line
|
|
141
|
+
});
|
|
142
|
+
warnings.push(`${taskId}: All checkboxes checked but header missing \u2705 COMPLETE`);
|
|
143
|
+
if (!completedTasks.includes(taskId)) {
|
|
144
|
+
completedTasks.push(taskId);
|
|
145
|
+
}
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
for (let j = i + 1; j < Math.min(i + 10, taskEndIndex); j++) {
|
|
149
|
+
const statusLine = lines[j];
|
|
150
|
+
if (statusLine.includes("**Status**:") && statusLine.includes("[x] Completed")) {
|
|
151
|
+
if (!completedTasks.includes(taskId)) {
|
|
152
|
+
completedTasks.push(taskId);
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (warnings.length > 0) {
|
|
159
|
+
console.warn("\n\u26A0\uFE0F Task Consistency Warnings:");
|
|
160
|
+
warnings.forEach((w) => console.warn(` ${w}`));
|
|
161
|
+
console.warn("");
|
|
162
|
+
}
|
|
163
|
+
return { completedTasks, fixes };
|
|
164
|
+
}
|
|
165
|
+
function applyConsistencyFixes(content, fixes) {
|
|
166
|
+
const lines = content.split("\n");
|
|
167
|
+
for (const fix of fixes.reverse()) {
|
|
168
|
+
const line = lines[fix.lineNumber];
|
|
169
|
+
if (fix.action === "remove-complete-marker") {
|
|
170
|
+
const fixed = line.replace(/\s*✅\s*COMPLETE\s*/g, "");
|
|
171
|
+
lines[fix.lineNumber] = fixed;
|
|
172
|
+
} else if (fix.action === "add-complete-marker") {
|
|
173
|
+
const fixed = line.trim() + " \u2705 COMPLETE";
|
|
174
|
+
lines[fix.lineNumber] = fixed;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return lines.join("\n");
|
|
178
|
+
}
|
|
179
|
+
function findNextTaskStart(lines, startIndex) {
|
|
180
|
+
const taskPattern = /^###\s+T-\d+/;
|
|
181
|
+
for (let i = startIndex; i < lines.length; i++) {
|
|
182
|
+
if (taskPattern.test(lines[i])) {
|
|
183
|
+
return i;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return lines.length;
|
|
187
|
+
}
|
|
188
|
+
function findImplementationSection(lines, taskStartIndex, taskEndIndex) {
|
|
189
|
+
let inImplementation = false;
|
|
190
|
+
const implementationLines = [];
|
|
191
|
+
for (let i = taskStartIndex; i < taskEndIndex; i++) {
|
|
192
|
+
const line = lines[i];
|
|
193
|
+
if (line.includes("**Implementation**:")) {
|
|
194
|
+
inImplementation = true;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (inImplementation) {
|
|
198
|
+
if (line.trim().startsWith("**") && !line.startsWith("- [")) {
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
if (line.trim().startsWith("---")) {
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
if (line.trim().startsWith("###")) {
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
implementationLines.push(line);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return implementationLines.length > 0 ? implementationLines : null;
|
|
211
|
+
}
|
|
212
|
+
function checkAllCheckboxesComplete(implementationLines) {
|
|
213
|
+
const checkboxes = implementationLines.filter((line) => line.includes("- ["));
|
|
214
|
+
if (checkboxes.length === 0) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
const allComplete = checkboxes.every((line) => line.includes("- [x]"));
|
|
218
|
+
const noneIncomplete = checkboxes.every((line) => !line.includes("- [ ]"));
|
|
219
|
+
return allComplete && noneIncomplete;
|
|
220
|
+
}
|
|
221
|
+
function markTaskComplete(content, taskId) {
|
|
222
|
+
let updated = content;
|
|
223
|
+
const statusPattern = new RegExp(
|
|
224
|
+
`(###\\s+${taskId.replace(/[-]/g, "\\-")}[^\\n]*[\\s\\S]*?\\*\\*Status\\*\\*:)\\s*\\[?\\s*\\]?\\s*\u23F3?\\s*Pending`,
|
|
225
|
+
"i"
|
|
226
|
+
);
|
|
227
|
+
updated = updated.replace(statusPattern, "$1 [x] Completed");
|
|
228
|
+
return updated;
|
|
229
|
+
}
|
|
230
|
+
function countTotalTasks(lines) {
|
|
231
|
+
let count = 0;
|
|
232
|
+
const taskPattern = /^###\s+(T-?\d+[-A-Z]*):?\s+/;
|
|
233
|
+
for (const line of lines) {
|
|
234
|
+
if (taskPattern.test(line)) {
|
|
235
|
+
count++;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return count;
|
|
239
|
+
}
|
|
240
|
+
function countCompletedTasks(lines) {
|
|
241
|
+
let count = 0;
|
|
242
|
+
const taskPattern = /^###\s+(T-?\d+[-A-Z]*):?\s+(.+)/;
|
|
243
|
+
for (let i = 0; i < lines.length; i++) {
|
|
244
|
+
const line = lines[i];
|
|
245
|
+
const taskMatch = line.match(taskPattern);
|
|
246
|
+
if (taskMatch) {
|
|
247
|
+
const taskTitle = taskMatch[2];
|
|
248
|
+
if (taskTitle.includes("\u2705 COMPLETE")) {
|
|
249
|
+
count++;
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
let found = false;
|
|
253
|
+
for (let j = i + 1; j < Math.min(i + 10, lines.length); j++) {
|
|
254
|
+
const nextLine = lines[j];
|
|
255
|
+
if (nextLine.includes("**Status**:") && nextLine.includes("[x] Completed")) {
|
|
256
|
+
count++;
|
|
257
|
+
found = true;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (found) continue;
|
|
262
|
+
const taskEndIndex = findNextTaskStart(lines, i + 1);
|
|
263
|
+
const implementationSection = findImplementationSection(lines, i, taskEndIndex);
|
|
264
|
+
if (implementationSection) {
|
|
265
|
+
const allCheckboxesComplete = checkAllCheckboxesComplete(implementationSection);
|
|
266
|
+
if (allCheckboxesComplete) {
|
|
267
|
+
count++;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return count;
|
|
273
|
+
}
|
|
274
|
+
function updateProgressHeader(content, completed, total, progress) {
|
|
275
|
+
let updated = content;
|
|
276
|
+
updated = updated.replace(/\*\*Completed\*\*:\s*\d+/, `**Completed**: ${completed}`);
|
|
277
|
+
updated = updated.replace(/\*\*Progress\*\*:\s*\d+%/, `**Progress**: ${progress}%`);
|
|
278
|
+
updated = updated.replace(/\*\*Total Tasks\*\*:\s*\d+/, `**Total Tasks**: ${total}`);
|
|
279
|
+
return updated;
|
|
280
|
+
}
|
|
281
|
+
const isMainModule = import.meta.url === `file://${process.argv[1]}`;
|
|
282
|
+
if (isMainModule) {
|
|
283
|
+
const incrementId = process.argv[2];
|
|
284
|
+
if (!incrementId) {
|
|
285
|
+
console.error("\u274C Usage: update-tasks-md <incrementId>");
|
|
286
|
+
console.error(" Example: update-tasks-md 0006-llm-native-i18n");
|
|
287
|
+
process.exit(1);
|
|
288
|
+
}
|
|
289
|
+
updateTasksMd(incrementId).catch((error) => {
|
|
290
|
+
console.error("\u274C Fatal error:", error);
|
|
291
|
+
process.exit(1);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
export {
|
|
295
|
+
updateTasksMd
|
|
296
|
+
};
|