@krr2020/taskflow-core 0.1.0-beta.3 โ 0.1.0-beta.5
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 +1 -1
- package/dist/cli/index.js +42 -4
- package/dist/commands/base.d.ts +41 -0
- package/dist/commands/base.js +141 -0
- package/dist/commands/configure.d.ts +29 -0
- package/dist/commands/configure.js +187 -0
- package/dist/commands/init.js +21 -7
- package/dist/commands/prd/create.d.ts +1 -1
- package/dist/commands/prd/create.js +29 -11
- package/dist/commands/prd/generate-arch.d.ts +1 -1
- package/dist/commands/prd/generate-arch.js +6 -5
- package/dist/commands/retro/list.js +6 -5
- package/dist/commands/tasks/generate.d.ts +1 -1
- package/dist/commands/tasks/generate.js +83 -56
- package/dist/commands/upgrade.js +49 -16
- package/dist/commands/workflow/check.d.ts +17 -0
- package/dist/commands/workflow/check.js +482 -35
- package/dist/commands/workflow/commit.js +117 -60
- package/dist/commands/workflow/do.d.ts +1 -0
- package/dist/commands/workflow/do.js +206 -13
- package/dist/commands/workflow/next.js +4 -4
- package/dist/commands/workflow/resume.js +9 -6
- package/dist/commands/workflow/start.js +11 -11
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/lib/config-paths.d.ts +15 -15
- package/dist/lib/config-paths.js +20 -15
- package/dist/lib/file-validator.d.ts +119 -0
- package/dist/lib/file-validator.js +291 -0
- package/dist/lib/git.js +4 -2
- package/dist/lib/log-parser.d.ts +91 -0
- package/dist/lib/log-parser.js +178 -0
- package/dist/lib/retrospective.d.ts +27 -0
- package/dist/lib/retrospective.js +111 -1
- package/dist/lib/types.d.ts +19 -6
- package/dist/lib/types.js +20 -1
- package/dist/lib/validation.d.ts +0 -3
- package/dist/lib/validation.js +1 -15
- package/dist/llm/base.d.ts +52 -0
- package/dist/llm/base.js +35 -0
- package/dist/llm/factory.d.ts +39 -0
- package/dist/llm/factory.js +102 -0
- package/dist/llm/index.d.ts +7 -0
- package/dist/llm/index.js +7 -0
- package/dist/llm/model-selector.d.ts +71 -0
- package/dist/llm/model-selector.js +139 -0
- package/dist/llm/providers/anthropic.d.ts +31 -0
- package/dist/llm/providers/anthropic.js +116 -0
- package/dist/llm/providers/index.d.ts +6 -0
- package/dist/llm/providers/index.js +6 -0
- package/dist/llm/providers/ollama.d.ts +28 -0
- package/dist/llm/providers/ollama.js +91 -0
- package/dist/llm/providers/openai-compatible.d.ts +30 -0
- package/dist/llm/providers/openai-compatible.js +93 -0
- package/dist/schemas/config.d.ts +82 -0
- package/dist/schemas/config.js +35 -0
- package/dist/schemas/task.d.ts +2 -2
- package/dist/state-machine.d.ts +12 -0
- package/dist/state-machine.js +2 -2
- package/package.json +1 -1
- package/dist/lib/package-manager.d.ts +0 -17
- package/dist/lib/package-manager.js +0 -53
|
@@ -10,6 +10,7 @@ import { BaseCommand } from "../base.js";
|
|
|
10
10
|
export class CommitCommand extends BaseCommand {
|
|
11
11
|
async execute(bulletPoints) {
|
|
12
12
|
const configLoader = new ConfigLoader(this.context.projectRoot);
|
|
13
|
+
const config = configLoader.load();
|
|
13
14
|
const paths = configLoader.getPaths();
|
|
14
15
|
// Load tasks progress
|
|
15
16
|
const tasksProgress = loadTasksProgress(paths.tasksDir);
|
|
@@ -72,6 +73,120 @@ export class CommitCommand extends BaseCommand {
|
|
|
72
73
|
updateTaskStatus(paths.tasksDir, tasksProgress, taskId, "completed");
|
|
73
74
|
// Find next available task
|
|
74
75
|
const nextTask = findNextAvailableTask(tasksProgress, taskId);
|
|
76
|
+
// Check AI config for context management and auto-continue
|
|
77
|
+
const autoContinue = config.ai?.autoContinueTask ?? false;
|
|
78
|
+
const clearContext = config.ai?.clearContextOnComplete ?? true;
|
|
79
|
+
// Build context clearing instruction
|
|
80
|
+
const contextInstruction = clearContext && nextTask
|
|
81
|
+
? [
|
|
82
|
+
"",
|
|
83
|
+
"๐งน CONTEXT MANAGEMENT:",
|
|
84
|
+
"โโโโโโโโโโโโโโโโโโโโโโโโโ",
|
|
85
|
+
"IMPORTANT: Clear your AI model context before starting the next task.",
|
|
86
|
+
"",
|
|
87
|
+
"Why? Each SETUP state loads all reference files (RETROSPECTIVE, AI PROTOCOL,",
|
|
88
|
+
"ARCHITECTURE RULES, CODING STANDARDS, SKILLS). This context accumulates",
|
|
89
|
+
"and can reduce model performance.",
|
|
90
|
+
"",
|
|
91
|
+
"Action:",
|
|
92
|
+
"- Clear/reset your AI assistant's context window",
|
|
93
|
+
"- Start fresh with only the next task's context",
|
|
94
|
+
"",
|
|
95
|
+
"This ensures optimal performance for each task.",
|
|
96
|
+
].join("\n")
|
|
97
|
+
: [];
|
|
98
|
+
// Build auto-continue instruction
|
|
99
|
+
const continueInstruction = autoContinue && nextTask
|
|
100
|
+
? [
|
|
101
|
+
"",
|
|
102
|
+
"๐ AUTO-CONTINUE ENABLED:",
|
|
103
|
+
"โโโโโโโโโโโโโโโโโโโโโโโโโโโ",
|
|
104
|
+
"You are configured to automatically continue to the next task.",
|
|
105
|
+
"",
|
|
106
|
+
"IMMEDIATE ACTION:",
|
|
107
|
+
"โโโโโโโโโโโโโโโโโโ",
|
|
108
|
+
`Run this command NOW: taskflow start ${nextTask.task.id}`,
|
|
109
|
+
"",
|
|
110
|
+
"Do NOT wait for user confirmation.",
|
|
111
|
+
"Do NOT ask for permission.",
|
|
112
|
+
"",
|
|
113
|
+
"Proceed directly to the next task without any delay.",
|
|
114
|
+
].join("\n")
|
|
115
|
+
: [];
|
|
116
|
+
// Build next steps based on auto-continue flag
|
|
117
|
+
const nextSteps = nextTask
|
|
118
|
+
? autoContinue
|
|
119
|
+
? [
|
|
120
|
+
`๐ฏ AUTO-CONTINUE TO NEXT TASK:`,
|
|
121
|
+
`Run: taskflow start ${nextTask.task.id}`,
|
|
122
|
+
"",
|
|
123
|
+
`Task: ${nextTask.task.title}`,
|
|
124
|
+
`Story: ${nextTask.story.title}`,
|
|
125
|
+
`Feature: ${nextTask.feature.title}`,
|
|
126
|
+
].join("\n")
|
|
127
|
+
: [
|
|
128
|
+
`1. Start the next task:`,
|
|
129
|
+
` taskflow start ${nextTask.task.id}`,
|
|
130
|
+
"",
|
|
131
|
+
` Task: ${nextTask.task.title}`,
|
|
132
|
+
` Story: ${nextTask.story.title}`,
|
|
133
|
+
` Feature: ${nextTask.feature.title}`,
|
|
134
|
+
].join("\n")
|
|
135
|
+
: [
|
|
136
|
+
"All tasks completed! ๐",
|
|
137
|
+
"",
|
|
138
|
+
"Options:",
|
|
139
|
+
"1. Run 'taskflow status' to see project overview",
|
|
140
|
+
"2. Generate more tasks with 'taskflow tasks generate'",
|
|
141
|
+
"3. Create a new PRD with 'taskflow prd create'",
|
|
142
|
+
].join("\n");
|
|
143
|
+
// Build AI guidance
|
|
144
|
+
const aiGuidance = nextTask
|
|
145
|
+
? [
|
|
146
|
+
"Task Completed Successfully!",
|
|
147
|
+
"",
|
|
148
|
+
"WHAT JUST HAPPENED:",
|
|
149
|
+
"โโโโโโโโโโโโโโโโโโโ",
|
|
150
|
+
"1. โ Changes committed with proper message format",
|
|
151
|
+
"2. โ Pushed to remote repository",
|
|
152
|
+
"3. โ Task marked as completed",
|
|
153
|
+
"4. โ Next task identified",
|
|
154
|
+
"",
|
|
155
|
+
"NEXT TASK:",
|
|
156
|
+
"โโโโโโโโโโ",
|
|
157
|
+
`ID: ${nextTask.task.id}`,
|
|
158
|
+
`Title: ${nextTask.task.title}`,
|
|
159
|
+
`Story: ${nextTask.story.title}`,
|
|
160
|
+
`Feature: ${nextTask.feature.title}`,
|
|
161
|
+
"",
|
|
162
|
+
...contextInstruction,
|
|
163
|
+
...continueInstruction,
|
|
164
|
+
"TO START NEXT TASK:",
|
|
165
|
+
"โโโโโโโโโโโโโโโโโโโโโ",
|
|
166
|
+
`Run: taskflow start ${nextTask.task.id}`,
|
|
167
|
+
"",
|
|
168
|
+
"This will:",
|
|
169
|
+
"1. Check out the correct story branch",
|
|
170
|
+
"2. Load task requirements",
|
|
171
|
+
"3. Provide all context files",
|
|
172
|
+
"4. Set status to SETUP",
|
|
173
|
+
"",
|
|
174
|
+
"Then follow the workflow again:",
|
|
175
|
+
"SETUP โ PLANNING โ IMPLEMENTING โ VERIFYING โ VALIDATING โ COMMITTING โ COMPLETED",
|
|
176
|
+
].join("\n")
|
|
177
|
+
: [
|
|
178
|
+
"Task Completed Successfully!",
|
|
179
|
+
"",
|
|
180
|
+
"All Tasks Complete! ๐",
|
|
181
|
+
"โโโโโโโโโโโโโโโโโโโโโโโ",
|
|
182
|
+
"You've completed all available tasks.",
|
|
183
|
+
...contextInstruction,
|
|
184
|
+
"",
|
|
185
|
+
"What's next:",
|
|
186
|
+
"1. Review project progress: taskflow status",
|
|
187
|
+
"2. Create new tasks: taskflow tasks generate",
|
|
188
|
+
"3. Start a new feature: taskflow prd create",
|
|
189
|
+
].join("\n");
|
|
75
190
|
return this.success([
|
|
76
191
|
`โ Task ${taskId} completed!`,
|
|
77
192
|
`โ Changes committed and pushed`,
|
|
@@ -85,66 +200,8 @@ export class CommitCommand extends BaseCommand {
|
|
|
85
200
|
nextTask
|
|
86
201
|
? `NEXT TASK: ${nextTask.task.id} - ${nextTask.task.title}`
|
|
87
202
|
: "No more tasks available",
|
|
88
|
-
].join("\n"),
|
|
89
|
-
|
|
90
|
-
`1. Start the next task:`,
|
|
91
|
-
` taskflow start ${nextTask.task.id}`,
|
|
92
|
-
"",
|
|
93
|
-
` Task: ${nextTask.task.title}`,
|
|
94
|
-
` Story: ${nextTask.story.title}`,
|
|
95
|
-
` Feature: ${nextTask.feature.title}`,
|
|
96
|
-
].join("\n")
|
|
97
|
-
: [
|
|
98
|
-
"All tasks completed! ๐",
|
|
99
|
-
"",
|
|
100
|
-
"Options:",
|
|
101
|
-
"1. Run 'taskflow status' to see project overview",
|
|
102
|
-
"2. Generate more tasks with 'taskflow tasks generate'",
|
|
103
|
-
"3. Create a new PRD with 'taskflow prd create'",
|
|
104
|
-
].join("\n"), {
|
|
105
|
-
aiGuidance: nextTask
|
|
106
|
-
? [
|
|
107
|
-
"Task Completed Successfully!",
|
|
108
|
-
"",
|
|
109
|
-
"WHAT JUST HAPPENED:",
|
|
110
|
-
"โโโโโโโโโโโโโโโโโโโ",
|
|
111
|
-
"1. โ Changes committed with proper message format",
|
|
112
|
-
"2. โ Pushed to remote repository",
|
|
113
|
-
"3. โ Task marked as completed",
|
|
114
|
-
"4. โ Next task identified",
|
|
115
|
-
"",
|
|
116
|
-
"NEXT TASK:",
|
|
117
|
-
"โโโโโโโโโโ",
|
|
118
|
-
`ID: ${nextTask.task.id}`,
|
|
119
|
-
`Title: ${nextTask.task.title}`,
|
|
120
|
-
`Story: ${nextTask.story.title}`,
|
|
121
|
-
`Feature: ${nextTask.feature.title}`,
|
|
122
|
-
"",
|
|
123
|
-
"TO START:",
|
|
124
|
-
"โโโโโโโโโโ",
|
|
125
|
-
`Run: taskflow start ${nextTask.task.id}`,
|
|
126
|
-
"",
|
|
127
|
-
"This will:",
|
|
128
|
-
"1. Check out the correct story branch",
|
|
129
|
-
"2. Load task requirements",
|
|
130
|
-
"3. Provide all context files",
|
|
131
|
-
"4. Set status to SETUP",
|
|
132
|
-
"",
|
|
133
|
-
"Then follow the workflow again:",
|
|
134
|
-
"SETUP โ IMPLEMENTING โ VERIFYING โ VALIDATING โ COMMITTING โ COMPLETED",
|
|
135
|
-
].join("\n")
|
|
136
|
-
: [
|
|
137
|
-
"Task Completed Successfully!",
|
|
138
|
-
"",
|
|
139
|
-
"All Tasks Complete! ๐",
|
|
140
|
-
"โโโโโโโโโโโโโโโโโโโโโโโ",
|
|
141
|
-
"You've completed all available tasks.",
|
|
142
|
-
"",
|
|
143
|
-
"What's next:",
|
|
144
|
-
"1. Review project progress: taskflow status",
|
|
145
|
-
"2. Create new tasks: taskflow tasks generate",
|
|
146
|
-
"3. Start a new feature: taskflow prd create",
|
|
147
|
-
].join("\n"),
|
|
203
|
+
].join("\n"), nextSteps, {
|
|
204
|
+
aiGuidance,
|
|
148
205
|
warnings: [
|
|
149
206
|
"Task is now completed and cannot be reopened",
|
|
150
207
|
"If you need to make changes, create a new task or hotfix",
|
|
@@ -36,16 +36,19 @@ export class DoCommand extends BaseCommand {
|
|
|
36
36
|
let result = {};
|
|
37
37
|
switch (status) {
|
|
38
38
|
case "setup":
|
|
39
|
-
result = this.getSetupState(paths.refDir, content, taskId);
|
|
39
|
+
result = await this.getSetupState(paths.refDir, content, taskId);
|
|
40
|
+
break;
|
|
41
|
+
case "planning":
|
|
42
|
+
result = await this.getPlanningState(paths.refDir, content, taskId);
|
|
40
43
|
break;
|
|
41
44
|
case "implementing":
|
|
42
|
-
result = this.getImplementState(paths.refDir, content, taskId);
|
|
45
|
+
result = await this.getImplementState(paths.refDir, content, taskId);
|
|
43
46
|
break;
|
|
44
47
|
case "verifying":
|
|
45
|
-
result = this.getVerifyState(paths.refDir, content, taskId);
|
|
48
|
+
result = await this.getVerifyState(paths.refDir, content, taskId);
|
|
46
49
|
break;
|
|
47
50
|
case "validating":
|
|
48
|
-
result = this.getValidateState();
|
|
51
|
+
result = await this.getValidateState();
|
|
49
52
|
break;
|
|
50
53
|
case "committing":
|
|
51
54
|
result = this.getCommitState(feature.id, taskId, task.title);
|
|
@@ -96,7 +99,7 @@ export class DoCommand extends BaseCommand {
|
|
|
96
99
|
}
|
|
97
100
|
return parts.join("\n");
|
|
98
101
|
}
|
|
99
|
-
getSetupState(refDir, taskContent, taskId) {
|
|
102
|
+
async getSetupState(refDir, taskContent, taskId) {
|
|
100
103
|
const skill = taskContent.skill || "backend";
|
|
101
104
|
parseTaskId(taskId);
|
|
102
105
|
const outputParts = [];
|
|
@@ -121,10 +124,28 @@ export class DoCommand extends BaseCommand {
|
|
|
121
124
|
outputParts.push("1. Read RETROSPECTIVE to avoid known errors");
|
|
122
125
|
outputParts.push("2. Read AI PROTOCOL to understand workflow rules");
|
|
123
126
|
outputParts.push("3. Review TASK DETAILS and subtasks");
|
|
127
|
+
// Get LLM guidance if available
|
|
128
|
+
let llmGuidance = "Read and understand. Do not code yet.";
|
|
129
|
+
if (this.isLLMAvailable()) {
|
|
130
|
+
try {
|
|
131
|
+
const enhancedGuidance = await this.getLLMGuidance({
|
|
132
|
+
task: taskContent.title,
|
|
133
|
+
status: "setup",
|
|
134
|
+
files: taskContent.context,
|
|
135
|
+
instructions: "Focus on understanding the task context, not on implementation. Emphasize files to read and patterns to learn.",
|
|
136
|
+
});
|
|
137
|
+
if (enhancedGuidance) {
|
|
138
|
+
llmGuidance = enhancedGuidance;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// Use default guidance if LLM call fails
|
|
143
|
+
}
|
|
144
|
+
}
|
|
124
145
|
return {
|
|
125
146
|
output: outputParts.join("\n"),
|
|
126
|
-
nextSteps: " When you understand the task, run 'taskflow check' to advance to
|
|
127
|
-
aiGuidance:
|
|
147
|
+
nextSteps: " When you understand the task, run 'taskflow check' to advance to PLANNING",
|
|
148
|
+
aiGuidance: llmGuidance,
|
|
128
149
|
contextFiles: [
|
|
129
150
|
REF_FILES.aiProtocol,
|
|
130
151
|
REF_FILES.retrospective,
|
|
@@ -132,7 +153,128 @@ export class DoCommand extends BaseCommand {
|
|
|
132
153
|
],
|
|
133
154
|
};
|
|
134
155
|
}
|
|
135
|
-
|
|
156
|
+
async getPlanningState(refDir, taskContent, taskId) {
|
|
157
|
+
const skill = taskContent.skill || "backend";
|
|
158
|
+
const outputParts = [];
|
|
159
|
+
outputParts.push(colors.infoBold(`${icons.brain} PLANNING STATE - CREATE EXECUTION PLAN`));
|
|
160
|
+
outputParts.push(colors.info("DO: Analyze context, create implementation plan"));
|
|
161
|
+
outputParts.push(colors.error("DO NOT: Write code yet - planning must come first"));
|
|
162
|
+
// TASK DETAILS
|
|
163
|
+
outputParts.push(this.formatTaskDetails(taskId, taskContent.title, skill, taskContent.description, taskContent.subtasks || [], taskContent.context || []));
|
|
164
|
+
// CRITICAL CONTEXT
|
|
165
|
+
outputParts.push(this.formatReference("RETROSPECTIVE - KNOWN ERRORS TO AVOID", getRefFilePath(refDir, REF_FILES.retrospective), colors.error));
|
|
166
|
+
outputParts.push(this.formatReference("AI PROTOCOL - WORKFLOW RULES", getRefFilePath(refDir, REF_FILES.aiProtocol), colors.warning));
|
|
167
|
+
// REFERENCE SECTION
|
|
168
|
+
outputParts.push("", colors.infoBold(`${icons.memo} REFERENCE (Read as Needed)`));
|
|
169
|
+
outputParts.push(colors.info("โ".repeat(50)));
|
|
170
|
+
outputParts.push(this.formatReference(`SKILL: ${skill.toUpperCase()}`, getSkillFilePath(refDir, skill), colors.command));
|
|
171
|
+
outputParts.push(this.formatReference("ARCHITECTURE RULES", getRefFilePath(refDir, REF_FILES.architectureRules), colors.info));
|
|
172
|
+
outputParts.push(this.formatReference("CODING STANDARDS", getRefFilePath(refDir, REF_FILES.codingStandards), colors.info));
|
|
173
|
+
// PLANNING CHECKLIST
|
|
174
|
+
outputParts.push("", colors.warningBold(`${icons.info} PLANNING CHECKLIST`));
|
|
175
|
+
outputParts.push("โก 1. Reviewed RETROSPECTIVE - know what NOT to do");
|
|
176
|
+
outputParts.push("โก 2. Understood TASK DETAILS and requirements");
|
|
177
|
+
outputParts.push("โก 3. Identified files to modify");
|
|
178
|
+
outputParts.push("โก 4. Determined implementation approach");
|
|
179
|
+
outputParts.push("โก 5. Planned subtask execution order");
|
|
180
|
+
outputParts.push("โก 6. Considered edge cases and error handling");
|
|
181
|
+
// QUICK START
|
|
182
|
+
outputParts.push("", colors.successBold(`${icons.rocket} PLAN CREATION STEPS`));
|
|
183
|
+
outputParts.push("1. Search for similar implementations");
|
|
184
|
+
outputParts.push("2. List files to modify and patterns to follow");
|
|
185
|
+
outputParts.push("3. Define implementation approach");
|
|
186
|
+
outputParts.push("4. Order subtasks logically");
|
|
187
|
+
outputParts.push("5. Document your plan");
|
|
188
|
+
// Get LLM guidance if available
|
|
189
|
+
let llmGuidance = [
|
|
190
|
+
"Current Status: PLANNING",
|
|
191
|
+
"Your Goal: Create a clear, documented plan before coding",
|
|
192
|
+
"",
|
|
193
|
+
"PLANNING PROCESS:",
|
|
194
|
+
"โโโโโโโโโโโโโโโโ",
|
|
195
|
+
"1. SEARCH FIRST:",
|
|
196
|
+
" - Find existing implementations to match",
|
|
197
|
+
" - Study patterns used in similar code",
|
|
198
|
+
" - Identify relevant files and modules",
|
|
199
|
+
"",
|
|
200
|
+
"2. CONTEXT REVIEW:",
|
|
201
|
+
" - RETROSPECTIVE: Learn what NOT to do",
|
|
202
|
+
" - AI PROTOCOL: Understand workflow rules",
|
|
203
|
+
" - SKILL GUIDES: Domain-specific patterns",
|
|
204
|
+
" - ARCHITECTURE/STANDARDS: Project conventions",
|
|
205
|
+
"",
|
|
206
|
+
"3. PLAN CREATION:",
|
|
207
|
+
" - List files to modify",
|
|
208
|
+
" - Define implementation approach",
|
|
209
|
+
" - Order subtasks logically",
|
|
210
|
+
" - Note integration points",
|
|
211
|
+
" - Plan error handling",
|
|
212
|
+
"",
|
|
213
|
+
"4. RISK CHECK:",
|
|
214
|
+
" - Check RETROSPECTIVE for similar issues",
|
|
215
|
+
" - Identify edge cases",
|
|
216
|
+
" - Consider backward compatibility",
|
|
217
|
+
"",
|
|
218
|
+
"CRITICAL RULES:",
|
|
219
|
+
"โโโโโโโโโโโโโโโ",
|
|
220
|
+
"- Search BEFORE planning",
|
|
221
|
+
"- Match existing patterns, don't invent new ones",
|
|
222
|
+
"- Consider all subtasks in your plan",
|
|
223
|
+
"- Document the approach clearly",
|
|
224
|
+
"",
|
|
225
|
+
"DO NOT:",
|
|
226
|
+
"โโโโโโโ",
|
|
227
|
+
"- Skip planning and start coding",
|
|
228
|
+
"- Assume patterns without searching",
|
|
229
|
+
"- Ignore RETROSPECTIVE warnings",
|
|
230
|
+
"- Create vague or incomplete plans",
|
|
231
|
+
"",
|
|
232
|
+
"WHEN READY:",
|
|
233
|
+
"โโโโโโโโโโโโ",
|
|
234
|
+
"Run 'taskflow check' to advance to IMPLEMENTING",
|
|
235
|
+
"Be ready to execute your plan",
|
|
236
|
+
].join("\n");
|
|
237
|
+
if (this.isLLMAvailable()) {
|
|
238
|
+
try {
|
|
239
|
+
// Read retrospective to include known error patterns in LLM guidance
|
|
240
|
+
const retrospectivePath = getRefFilePath(refDir, REF_FILES.retrospective);
|
|
241
|
+
const retrospectiveContent = loadReferenceFile(retrospectivePath);
|
|
242
|
+
// Build instructions with retrospective context
|
|
243
|
+
let instructions = "Focus on planning guidance: files to modify, patterns to follow, subtask order, potential pitfalls. Keep under 200 words.";
|
|
244
|
+
if (retrospectiveContent) {
|
|
245
|
+
instructions += `\n\nIMPORTANT - Learn from known errors in this project:\n${retrospectiveContent}\n\nAvoid repeating these mistakes in your plan.`;
|
|
246
|
+
}
|
|
247
|
+
const enhancedGuidance = await this.getLLMGuidance({
|
|
248
|
+
task: taskContent.title,
|
|
249
|
+
status: "planning",
|
|
250
|
+
files: taskContent.context,
|
|
251
|
+
instructions,
|
|
252
|
+
});
|
|
253
|
+
if (enhancedGuidance) {
|
|
254
|
+
llmGuidance = enhancedGuidance;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
catch {
|
|
258
|
+
// Use default guidance if LLM call fails
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
output: outputParts.join("\n"),
|
|
263
|
+
nextSteps: [
|
|
264
|
+
"1. Search codebase for similar implementations",
|
|
265
|
+
"2. Create execution plan (files, approach, order)",
|
|
266
|
+
"3. Complete all planning checklist items",
|
|
267
|
+
"4. taskflow check (When plan is ready)",
|
|
268
|
+
].join("\n"),
|
|
269
|
+
aiGuidance: llmGuidance,
|
|
270
|
+
warnings: [
|
|
271
|
+
"Most common AI mistake: Skipping planning and writing code immediately",
|
|
272
|
+
"Always search for existing implementations first",
|
|
273
|
+
"Your plan should be specific and actionable",
|
|
274
|
+
],
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
async getImplementState(refDir, taskContent, taskId) {
|
|
136
278
|
const skill = taskContent.skill || "backend";
|
|
137
279
|
const outputParts = [];
|
|
138
280
|
outputParts.push(colors.successBold(`${icons.code} IMPLEMENTING STATE - WRITE CODE NOW`));
|
|
@@ -140,6 +282,24 @@ export class DoCommand extends BaseCommand {
|
|
|
140
282
|
outputParts.push(colors.error("DO NOT: Modify .taskflow/ or tasks/ directly"));
|
|
141
283
|
outputParts.push(this.formatTaskDetails(taskId, taskContent.title, skill, taskContent.description, taskContent.subtasks || [], taskContent.context || []));
|
|
142
284
|
outputParts.push(this.formatReference("AVOID THESE KNOWN ERRORS", getRefFilePath(refDir, REF_FILES.retrospective), colors.error));
|
|
285
|
+
// Get LLM guidance if available
|
|
286
|
+
let llmGuidance = "Implement subtasks one by one. Check off subtasks mostly mentally or via subtask command if available.";
|
|
287
|
+
if (this.isLLMAvailable()) {
|
|
288
|
+
try {
|
|
289
|
+
const enhancedGuidance = await this.getLLMGuidance({
|
|
290
|
+
task: taskContent.title,
|
|
291
|
+
status: "implementing",
|
|
292
|
+
files: taskContent.context,
|
|
293
|
+
instructions: "Focus on implementation guidance: files to modify, patterns to follow, subtask execution order. Keep under 200 words.",
|
|
294
|
+
});
|
|
295
|
+
if (enhancedGuidance) {
|
|
296
|
+
llmGuidance = enhancedGuidance;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
// Use default guidance if LLM call fails
|
|
301
|
+
}
|
|
302
|
+
}
|
|
143
303
|
return {
|
|
144
304
|
output: outputParts.join("\n"),
|
|
145
305
|
nextSteps: [
|
|
@@ -147,10 +307,10 @@ export class DoCommand extends BaseCommand {
|
|
|
147
307
|
"2. Test your changes locally",
|
|
148
308
|
"3. taskflow check (When ALL subtasks are complete)",
|
|
149
309
|
].join("\n"),
|
|
150
|
-
aiGuidance:
|
|
310
|
+
aiGuidance: llmGuidance,
|
|
151
311
|
};
|
|
152
312
|
}
|
|
153
|
-
getVerifyState(refDir, taskContent, _taskId) {
|
|
313
|
+
async getVerifyState(refDir, taskContent, _taskId) {
|
|
154
314
|
const outputParts = [];
|
|
155
315
|
outputParts.push(colors.infoBold(`${icons.search} VERIFYING STATE - SELF-REVIEW YOUR CODE`));
|
|
156
316
|
outputParts.push("DO: Review ALL code changes. Verify against checklists.");
|
|
@@ -169,6 +329,23 @@ export class DoCommand extends BaseCommand {
|
|
|
169
329
|
}
|
|
170
330
|
}
|
|
171
331
|
outputParts.push(this.formatReference("CHECK AGAINST RETROSPECTIVE", getRefFilePath(refDir, REF_FILES.retrospective), colors.error));
|
|
332
|
+
// Get LLM guidance if available
|
|
333
|
+
let llmGuidance = "Self-review strictly. Don't skip this step.";
|
|
334
|
+
if (this.isLLMAvailable()) {
|
|
335
|
+
try {
|
|
336
|
+
const enhancedGuidance = await this.getLLMGuidance({
|
|
337
|
+
task: taskContent.title,
|
|
338
|
+
status: "verifying",
|
|
339
|
+
instructions: "Focus on self-review guidance: common mistakes to check, patterns to verify. Keep under 200 words.",
|
|
340
|
+
});
|
|
341
|
+
if (enhancedGuidance) {
|
|
342
|
+
llmGuidance = enhancedGuidance;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
catch {
|
|
346
|
+
// Use default guidance if LLM call fails
|
|
347
|
+
}
|
|
348
|
+
}
|
|
172
349
|
return {
|
|
173
350
|
output: outputParts.join("\n"),
|
|
174
351
|
nextSteps: [
|
|
@@ -176,19 +353,35 @@ export class DoCommand extends BaseCommand {
|
|
|
176
353
|
"2. Fix any issues found",
|
|
177
354
|
"3. taskflow check (When self-review is complete)",
|
|
178
355
|
].join("\n"),
|
|
179
|
-
aiGuidance:
|
|
356
|
+
aiGuidance: llmGuidance,
|
|
180
357
|
};
|
|
181
358
|
}
|
|
182
|
-
getValidateState() {
|
|
359
|
+
async getValidateState() {
|
|
183
360
|
const outputParts = [];
|
|
184
361
|
outputParts.push(colors.infoBold(`${icons.test} VALIDATING STATE - AUTOMATED CHECKS`));
|
|
185
362
|
outputParts.push("System will run configured checks (format, lint, test, etc.)");
|
|
186
363
|
outputParts.push("", "ON SUCCESS: Advances to COMMITTING");
|
|
187
364
|
outputParts.push("ON FAILURE: Stay in VALIDATING details, fix errors.");
|
|
365
|
+
// Get LLM guidance if available
|
|
366
|
+
let llmGuidance = "Run validation. If fails, fix and retry.";
|
|
367
|
+
if (this.isLLMAvailable()) {
|
|
368
|
+
try {
|
|
369
|
+
const enhancedGuidance = await this.getLLMGuidance({
|
|
370
|
+
status: "validating",
|
|
371
|
+
instructions: "Focus on validation guidance: how to fix errors, error analysis approach. Keep under 200 words.",
|
|
372
|
+
});
|
|
373
|
+
if (enhancedGuidance) {
|
|
374
|
+
llmGuidance = enhancedGuidance;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
catch {
|
|
378
|
+
// Use default guidance if LLM call fails
|
|
379
|
+
}
|
|
380
|
+
}
|
|
188
381
|
return {
|
|
189
382
|
output: outputParts.join("\n"),
|
|
190
383
|
nextSteps: "Run 'taskflow check' to run validations",
|
|
191
|
-
aiGuidance:
|
|
384
|
+
aiGuidance: llmGuidance,
|
|
192
385
|
};
|
|
193
386
|
}
|
|
194
387
|
getCommitState(featureId, taskId, taskTitle) {
|
|
@@ -118,15 +118,15 @@ export class NextCommand extends BaseCommand {
|
|
|
118
118
|
"",
|
|
119
119
|
"This will begin the SETUP phase where you'll:",
|
|
120
120
|
"1. Read the task file with full requirements",
|
|
121
|
-
"2. Review
|
|
122
|
-
"3. Check
|
|
123
|
-
"4. Study
|
|
121
|
+
"2. Review ai-protocol.md for operating discipline",
|
|
122
|
+
"3. Check retrospective.md for known mistakes",
|
|
123
|
+
"4. Study coding-standards.md and architecture-rules.md",
|
|
124
124
|
"5. Review skill-specific guidelines",
|
|
125
125
|
"6. Understand the complete task before coding",
|
|
126
126
|
"",
|
|
127
127
|
"WORKFLOW PHASES:",
|
|
128
128
|
"โโโโโโโโโโโโโโโโโ",
|
|
129
|
-
"SETUP โ IMPLEMENTING โ VERIFYING โ VALIDATING โ COMMITTING โ COMPLETED",
|
|
129
|
+
"SETUP โ PLANNING โ IMPLEMENTING โ VERIFYING โ VALIDATING โ COMMITTING โ COMPLETED",
|
|
130
130
|
"",
|
|
131
131
|
"Each phase has specific requirements and checks.",
|
|
132
132
|
"The system will guide you through each transition.",
|
|
@@ -73,9 +73,9 @@ export class ResumeCommand extends BaseCommand {
|
|
|
73
73
|
next: "Read context files and understand the task",
|
|
74
74
|
actions: [
|
|
75
75
|
"1. Review the task file completely",
|
|
76
|
-
"2. Read
|
|
77
|
-
"3. Check
|
|
78
|
-
"4. Study
|
|
76
|
+
"2. Read ai-protocol.md for operating discipline",
|
|
77
|
+
"3. Check retrospective.md for known mistakes",
|
|
78
|
+
"4. Study coding-standards.md and architecture-rules.md",
|
|
79
79
|
"5. When ready, run: taskflow check",
|
|
80
80
|
],
|
|
81
81
|
},
|
|
@@ -96,7 +96,7 @@ export class ResumeCommand extends BaseCommand {
|
|
|
96
96
|
"2. Look for 'any' types",
|
|
97
97
|
"3. Verify error handling",
|
|
98
98
|
"4. Ensure imports are correct",
|
|
99
|
-
"5. Review against
|
|
99
|
+
"5. Review against retrospective.md",
|
|
100
100
|
"6. When self-review is complete, run: taskflow check",
|
|
101
101
|
],
|
|
102
102
|
},
|
|
@@ -115,6 +115,9 @@ export class ResumeCommand extends BaseCommand {
|
|
|
115
115
|
},
|
|
116
116
|
};
|
|
117
117
|
const guidance = statusGuidance[targetStatus];
|
|
118
|
+
if (!guidance) {
|
|
119
|
+
throw new Error(`No guidance found for status: ${targetStatus}`);
|
|
120
|
+
}
|
|
118
121
|
return this.success([
|
|
119
122
|
`โ Task ${taskId} resumed!`,
|
|
120
123
|
`โ Status: ${content.status} โ ${targetStatus}`,
|
|
@@ -153,7 +156,7 @@ export class ResumeCommand extends BaseCommand {
|
|
|
153
156
|
...guidance.actions,
|
|
154
157
|
"",
|
|
155
158
|
"Remember to:",
|
|
156
|
-
"- Review
|
|
159
|
+
"- Review retrospective.md to avoid known mistakes",
|
|
157
160
|
"- Follow existing code patterns",
|
|
158
161
|
"- Verify imports before using them",
|
|
159
162
|
"- Handle errors properly",
|
|
@@ -161,7 +164,7 @@ export class ResumeCommand extends BaseCommand {
|
|
|
161
164
|
contextFiles,
|
|
162
165
|
warnings: [
|
|
163
166
|
"Review previous work before making changes",
|
|
164
|
-
"Check
|
|
167
|
+
"Check retrospective.md for mistakes related to the block reason",
|
|
165
168
|
"DO NOT rush - understand why it was blocked first",
|
|
166
169
|
],
|
|
167
170
|
});
|
|
@@ -81,10 +81,10 @@ export class StartCommand extends BaseCommand {
|
|
|
81
81
|
"1. Read ALL context files listed above",
|
|
82
82
|
" CRITICAL: Read these files in order:",
|
|
83
83
|
" a) Task file - understand requirements",
|
|
84
|
-
" b)
|
|
85
|
-
" c)
|
|
86
|
-
" d)
|
|
87
|
-
" e)
|
|
84
|
+
" b) ai-protocol.md - core discipline",
|
|
85
|
+
" c) retrospective.md - avoid known mistakes",
|
|
86
|
+
" d) coding-standards.md - follow project standards",
|
|
87
|
+
" e) architecture-rules.md - follow project architecture",
|
|
88
88
|
` f) skills/${taskContent.skill || "backend"}.md - skill-specific guidance`,
|
|
89
89
|
"",
|
|
90
90
|
"2. Understand the complete task before proceeding",
|
|
@@ -95,7 +95,7 @@ export class StartCommand extends BaseCommand {
|
|
|
95
95
|
"",
|
|
96
96
|
"3. When you've read everything and understand the task, run:",
|
|
97
97
|
" taskflow check",
|
|
98
|
-
" This will advance you to
|
|
98
|
+
" This will advance you to PLANNING status",
|
|
99
99
|
].join("\n"), {
|
|
100
100
|
aiGuidance: [
|
|
101
101
|
"Current Status: SETUP",
|
|
@@ -111,9 +111,9 @@ export class StartCommand extends BaseCommand {
|
|
|
111
111
|
"CRITICAL - Discovery First:",
|
|
112
112
|
"โโโโโโโโโโโโโโโโโโโโโโโโโโโโ",
|
|
113
113
|
"1. Read the task file completely",
|
|
114
|
-
"2. Read
|
|
115
|
-
"3. Read
|
|
116
|
-
"4. Read project standards (
|
|
114
|
+
"2. Read ai-protocol.md - this is your operating manual",
|
|
115
|
+
"3. Read retrospective.md - these are mistakes already made",
|
|
116
|
+
"4. Read project standards (coding-standards.md, architecture-rules.md)",
|
|
117
117
|
`5. Read skill file (skills/${taskContent.skill || "backend"}.md)`,
|
|
118
118
|
"6. Search for similar implementations in the codebase",
|
|
119
119
|
"7. Understand existing patterns before writing code",
|
|
@@ -127,13 +127,13 @@ export class StartCommand extends BaseCommand {
|
|
|
127
127
|
"",
|
|
128
128
|
"WHEN READY:",
|
|
129
129
|
"โโโโโโโโโโโโ",
|
|
130
|
-
"Run 'taskflow check' to advance to
|
|
131
|
-
"
|
|
130
|
+
"Run 'taskflow check' to advance to PLANNING status",
|
|
131
|
+
"Then create your execution plan before writing code",
|
|
132
132
|
].join("\n"),
|
|
133
133
|
contextFiles,
|
|
134
134
|
warnings: [
|
|
135
135
|
"DO NOT write code in SETUP status - read and understand first",
|
|
136
|
-
"DO NOT skip reading
|
|
136
|
+
"DO NOT skip reading retrospective.md - it contains critical learnings",
|
|
137
137
|
"DO NOT edit .taskflow/ or tasks/ directories - use taskflow commands only",
|
|
138
138
|
"DO NOT proceed without reading ALL context files",
|
|
139
139
|
],
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export * from "./cli/index.js";
|
|
6
6
|
export * from "./commands/base.js";
|
|
7
|
+
export * from "./commands/configure.js";
|
|
7
8
|
export * from "./commands/init.js";
|
|
8
9
|
export * from "./commands/prd/create.js";
|
|
9
10
|
export * from "./commands/prd/generate-arch.js";
|
|
@@ -23,9 +24,12 @@ export * from "./lib/config-loader.js";
|
|
|
23
24
|
export * from "./lib/config-paths.js";
|
|
24
25
|
export * from "./lib/data-access.js";
|
|
25
26
|
export * from "./lib/errors.js";
|
|
27
|
+
export * from "./lib/file-validator.js";
|
|
26
28
|
export * from "./lib/git.js";
|
|
29
|
+
export * from "./lib/log-parser.js";
|
|
27
30
|
export * from "./lib/output.js";
|
|
28
31
|
export * from "./lib/retrospective.js";
|
|
29
32
|
export type { ActiveStatus, Criticality, ErrorCategory, Feature, RetrospectiveItem, Story, Subtask, TaskFileContent, TaskflowConfig, TaskRef, TaskStatus, TasksProgress, TimeEntry, } from "./lib/types.js";
|
|
30
33
|
export { parseTaskId, STATUS_TRANSITIONS, TaskStatusSchema, } from "./lib/types.js";
|
|
31
34
|
export * from "./lib/validation.js";
|
|
35
|
+
export * from "./llm/index.js";
|