task-o-matic 0.0.11 → 0.0.12

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.
Files changed (35) hide show
  1. package/dist/commands/tasks/execute-loop.d.ts.map +1 -1
  2. package/dist/commands/tasks/execute-loop.js +13 -18
  3. package/dist/lib/ai-service/documentation-operations.d.ts.map +1 -1
  4. package/dist/lib/ai-service/documentation-operations.js +22 -12
  5. package/dist/lib/ai-service/prd-operations.d.ts.map +1 -1
  6. package/dist/lib/ai-service/prd-operations.js +18 -25
  7. package/dist/lib/executors/opencode-executor.d.ts.map +1 -1
  8. package/dist/lib/executors/opencode-executor.js +3 -1
  9. package/dist/lib/prompt-builder.d.ts +11 -0
  10. package/dist/lib/prompt-builder.d.ts.map +1 -1
  11. package/dist/lib/prompt-builder.js +59 -0
  12. package/dist/lib/prompt-registry.d.ts.map +1 -1
  13. package/dist/lib/prompt-registry.js +158 -0
  14. package/dist/lib/task-execution.d.ts.map +1 -1
  15. package/dist/lib/task-execution.js +13 -42
  16. package/dist/lib/task-loop-execution.d.ts.map +1 -1
  17. package/dist/lib/task-loop-execution.js +31 -38
  18. package/dist/prompts/documentation-recap.d.ts +3 -0
  19. package/dist/prompts/documentation-recap.d.ts.map +1 -0
  20. package/dist/prompts/documentation-recap.js +13 -0
  21. package/dist/prompts/index.d.ts +4 -0
  22. package/dist/prompts/index.d.ts.map +1 -1
  23. package/dist/prompts/index.js +4 -0
  24. package/dist/prompts/prd-question-answer.d.ts +3 -0
  25. package/dist/prompts/prd-question-answer.d.ts.map +1 -0
  26. package/dist/prompts/prd-question-answer.js +27 -0
  27. package/dist/prompts/task-execution.d.ts +3 -0
  28. package/dist/prompts/task-execution.d.ts.map +1 -0
  29. package/dist/prompts/task-execution.js +21 -0
  30. package/dist/prompts/workflow-prompts.d.ts +9 -0
  31. package/dist/prompts/workflow-prompts.d.ts.map +1 -0
  32. package/dist/prompts/workflow-prompts.js +93 -0
  33. package/dist/services/workflow-ai-assistant.d.ts.map +1 -1
  34. package/dist/services/workflow-ai-assistant.js +72 -94
  35. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"execute-loop.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/execute-loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmDpC,eAAO,MAAM,kBAAkB,SAwJ3B,CAAC"}
1
+ {"version":3,"file":"execute-loop.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/execute-loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqDpC,eAAO,MAAM,kBAAkB,SAkJ3B,CAAC"}
@@ -7,6 +7,13 @@ exports.executeLoopCommand = void 0;
7
7
  const commander_1 = require("commander");
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
9
  const task_loop_execution_1 = require("../../lib/task-loop-execution");
10
+ // Valid executor tools
11
+ const VALID_EXECUTORS = [
12
+ "opencode",
13
+ "claude",
14
+ "gemini",
15
+ "codex",
16
+ ];
10
17
  /**
11
18
  * Parse --try-models option into ModelAttemptConfig array
12
19
  * Supports formats:
@@ -20,14 +27,8 @@ function parseTryModels(value) {
20
27
  // Check if it includes executor specification (executor:model format)
21
28
  if (trimmed.includes(":")) {
22
29
  const [executor, model] = trimmed.split(":");
23
- const validExecutors = [
24
- "opencode",
25
- "claude",
26
- "gemini",
27
- "codex",
28
- ];
29
- if (!validExecutors.includes(executor)) {
30
- throw new Error(`Invalid executor "${executor}" in --try-models. Must be one of: ${validExecutors.join(", ")}`);
30
+ if (!VALID_EXECUTORS.includes(executor)) {
31
+ throw new Error(`Invalid executor "${executor}" in --try-models. Must be one of: ${VALID_EXECUTORS.join(", ")}`);
31
32
  }
32
33
  return {
33
34
  executor: executor,
@@ -53,22 +54,16 @@ exports.executeLoopCommand = new commander_1.Command("execute-loop")
53
54
  })
54
55
  .option("--auto-commit", "Automatically commit changes after each task", false)
55
56
  .option("--plan", "Generate an implementation plan before execution", false)
56
- .option("--plan-model <model>", "Model/executor to use for planning (e.g., 'opencode:gpt-4o')")
57
+ .option("--plan-model <model>", "Model/executor to use for planning (e.g., 'opencode:gpt-4o' or 'gpt-4o')")
57
58
  .option("--review-plan", "Pause for human review of the plan", false)
58
59
  .option("--review", "Run AI review after execution", false)
59
- .option("--review-model <model>", "Model/executor to use for review (e.g., 'opencode:gpt-4o')")
60
+ .option("--review-model <model>", "Model/executor to use for review (e.g., 'opencode:gpt-4o' or 'gpt-4o')")
60
61
  .option("--dry", "Show what would be executed without running it", false)
61
62
  .action(async (options) => {
62
63
  try {
63
64
  // Validate tool
64
- const validTools = [
65
- "opencode",
66
- "claude",
67
- "gemini",
68
- "codex",
69
- ];
70
- if (!validTools.includes(options.tool)) {
71
- console.error(chalk_1.default.red(`Invalid tool: ${options.tool}. Must be one of: ${validTools.join(", ")}`));
65
+ if (!VALID_EXECUTORS.includes(options.tool)) {
66
+ console.error(chalk_1.default.red(`Invalid tool: ${options.tool}. Must be one of: ${VALID_EXECUTORS.join(", ")}`));
72
67
  process.exit(1);
73
68
  }
74
69
  // Parse tryModels if provided
@@ -1 +1 @@
1
- {"version":3,"file":"documentation-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/documentation-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAAa,uBAAwB,SAAQ,cAAc;IACnD,4BAA4B,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,GACvE,OAAO,CAAC,MAAM,CAAC;IAiJZ,yBAAyB,CAC7B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,EAAE,CAAC,iBAAiB,GAAG,SAAS,CAAC,EAAE,GACnD,OAAO,CAAC,sBAAsB,CAAC;IAiM5B,0BAA0B,CAC9B,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EACtE,gBAAgB,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,EAC7D,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CA8BnB"}
1
+ {"version":3,"file":"documentation-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/documentation-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAAa,uBAAwB,SAAQ,cAAc;IACnD,4BAA4B,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,GACvE,OAAO,CAAC,MAAM,CAAC;IAiJZ,yBAAyB,CAC7B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,EAAE,CAAC,iBAAiB,GAAG,SAAS,CAAC,EAAE,GACnD,OAAO,CAAC,sBAAsB,CAAC;IAiM5B,0BAA0B,CAC9B,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EACtE,gBAAgB,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,EAC7D,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CA8CnB"}
@@ -270,21 +270,31 @@ ${existingResearchContext}`,
270
270
  });
271
271
  }
272
272
  async generateDocumentationRecap(libraries, documentContents, streamingOptions, retryConfig) {
273
- const prompt = `Create a concise recap of the documentation fetched for these libraries:
274
-
275
- Libraries:
276
- ${libraries
273
+ // Build variables for PromptBuilder
274
+ const librariesList = libraries
277
275
  .map((lib) => `- ${lib.name} (${lib.context7Id}): ${lib.reason}`)
278
- .join("\n")}
279
-
280
- Documentation Contents:
281
- ${documentContents
276
+ .join("\n");
277
+ const documentationContents = documentContents
282
278
  .map((doc) => `## ${doc.library}\n${doc.content.substring(0, 500)}...`)
283
- .join("\n\n")}
284
-
285
- Please provide a 2-3 sentence summary of what documentation is available and how it relates to the task.`;
279
+ .join("\n\n");
280
+ const promptResult = prompt_builder_1.PromptBuilder.buildPrompt({
281
+ name: "documentation-recap",
282
+ type: "user",
283
+ variables: {
284
+ LIBRARIES_LIST: librariesList,
285
+ DOCUMENTATION_CONTENTS: documentationContents,
286
+ },
287
+ });
288
+ if (!promptResult.success) {
289
+ throw new Error(`Failed to build documentation recap prompt: ${promptResult.error}`);
290
+ }
291
+ const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
292
+ name: "documentation-recap",
293
+ type: "system",
294
+ variables: {},
295
+ });
286
296
  return this.retryHandler.executeWithRetry(async () => {
287
- return this.streamText(prompt, undefined, "You are a technical writer who creates concise summaries of documentation collections.", undefined, streamingOptions, { maxAttempts: 1 });
297
+ return this.streamText(promptResult.prompt, undefined, systemPromptResult.prompt, undefined, streamingOptions, { maxAttempts: 1 });
288
298
  }, retryConfig, "Documentation recap generation");
289
299
  }
290
300
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prd-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/prd-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAER,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EAIZ,MAAM,aAAa,CAAC;AAYrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAAa,aAAc,SAAQ,cAAc;IACzC,QAAQ,CACZ,UAAU,EAAE,MAAM,EAClB,M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E,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;IAqBZ,WAAW,CACf,IAAI,EAAE,MAAM,EAAE,EACd,mBAAmB,EAAE,MAAM,EAC3B,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CA0BnB"}
@@ -341,31 +341,24 @@ Use these tools to understand the current project structure, existing code patte
341
341
  ? `Project Description: ${contextInfo.projectDescription}\n`
342
342
  : ""}`
343
343
  : "";
344
- const prompt = `You are a product expert helping to clarify a PRD.
345
-
346
- PRD Content:
347
- ${prdContent}${contextText}
348
-
349
- Please answer the following questions based on the PRD and context:
350
-
351
- ${questionsText}
352
-
353
- Provide thoughtful, specific answers that will help refine the PRD.
354
- Format your response as JSON with the following structure:
355
- {
356
- "answers": {
357
- "1": "answer to question 1",
358
- "2": "answer to question 2",
359
- ...
360
- }
361
- }`;
362
- const systemPrompt = `You are a product expert analyzing PRDs and answering clarifying questions.
363
- Your answers should be:
364
- - Specific and actionable
365
- - Based on the PRD content and project context
366
- - Helpful for refining the PRD
367
- - Formatted as JSON`;
368
- const response = await this.streamText("", config, systemPrompt, prompt, streamingOptions, { maxAttempts: 1 });
344
+ const promptResult = prompt_builder_1.PromptBuilder.buildPrompt({
345
+ name: "prd-question-answer",
346
+ type: "user",
347
+ variables: {
348
+ PRD_CONTENT: prdContent,
349
+ QUESTIONS_TEXT: questionsText,
350
+ CONTEXT_TEXT: contextText,
351
+ },
352
+ });
353
+ if (!promptResult.success) {
354
+ throw new Error(`Failed to build PRD question answer prompt: ${promptResult.error}`);
355
+ }
356
+ const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
357
+ name: "prd-question-answer",
358
+ type: "system",
359
+ variables: {},
360
+ });
361
+ const response = await this.streamText("", config, systemPromptResult.prompt, promptResult.prompt, streamingOptions, { maxAttempts: 1 });
369
362
  const parseResult = this.jsonParser.parseJSONFromResponse(response);
370
363
  if (!parseResult.success) {
371
364
  throw new Error(parseResult.error || "Failed to parse PRD answers response");
@@ -1 +1 @@
1
- {"version":3,"file":"opencode-executor.d.ts","sourceRoot":"","sources":["../../../src/lib/executors/opencode-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI/D,qBAAa,gBAAiB,YAAW,gBAAgB;IACvD,IAAI,SAAc;IAClB,OAAO,CAAC,MAAM,CAAC,CAAiB;gBAEpB,MAAM,CAAC,EAAE,cAAc;IAInC,yBAAyB,IAAI,OAAO;IAI9B,OAAO,CACX,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,OAAe,EACpB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC;CAuDjB"}
1
+ {"version":3,"file":"opencode-executor.d.ts","sourceRoot":"","sources":["../../../src/lib/executors/opencode-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI/D,qBAAa,gBAAiB,YAAW,gBAAgB;IACvD,IAAI,SAAc;IAClB,OAAO,CAAC,MAAM,CAAC,CAAiB;gBAEpB,MAAM,CAAC,EAAE,cAAc;IAInC,yBAAyB,IAAI,OAAO;IAI9B,OAAO,CACX,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,OAAe,EACpB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC;CA2DjB"}
@@ -38,7 +38,9 @@ class OpencodeExecutor {
38
38
  args.push("-p", message);
39
39
  if (dry) {
40
40
  console.log(chalk_1.default.cyan(`🔧 Using executor: ${this.name}`));
41
- console.log(chalk_1.default.cyan(`opencode ${args.join(" ")}`));
41
+ // Quote arguments that contain spaces for display
42
+ const quotedArgs = args.map((arg) => arg.includes(" ") ? `"${arg.replace(/"/g, '\\"')}"` : arg);
43
+ console.log(chalk_1.default.cyan(`opencode ${quotedArgs.join(" ")}`));
42
44
  return;
43
45
  }
44
46
  // Launch opencode and wait for it to complete
@@ -54,5 +54,16 @@ export declare class PromptBuilder {
54
54
  * Format prompt for specific executor
55
55
  */
56
56
  static formatForExecutor(prompt: string, executor: "opencode" | "claude" | "gemini" | "codex"): string;
57
+ /**
58
+ * Build execution prompt with task context
59
+ */
60
+ static buildExecutionPrompt(options: {
61
+ taskTitle: string;
62
+ taskDescription?: string;
63
+ taskPlan?: string;
64
+ stack?: any;
65
+ documentation?: any;
66
+ retryContext?: string;
67
+ }): PromptBuilderResult;
57
68
  }
58
69
  //# sourceMappingURL=prompt-builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-builder.d.ts","sourceRoot":"","sources":["../../src/lib/prompt-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOnE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,cAAc,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EG;IACH,MAAM,CAAC,iBAAiB,CACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GACnD,MAAM;IAoBT;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE;QACnC,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,GAAG,CAAC;QACZ,aAAa,CAAC,EAAE,GAAG,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,mBAAmB;CAmExB"}
@@ -274,5 +274,64 @@ class PromptBuilder {
274
274
  return prompt;
275
275
  }
276
276
  }
277
+ /**
278
+ * Build execution prompt with task context
279
+ */
280
+ static buildExecutionPrompt(options) {
281
+ const { taskTitle, taskDescription, taskPlan, stack, documentation, retryContext, } = options;
282
+ // Build TASK_PLAN variable
283
+ let taskPlanText = "";
284
+ if (taskPlan) {
285
+ taskPlanText = `# Task Plan\n\n${taskPlan}\n`;
286
+ }
287
+ else {
288
+ taskPlanText = `# Task: ${taskTitle}\n\n${taskDescription || "No description"}\n`;
289
+ }
290
+ // Build STACK_INFO variable
291
+ let stackInfo = "";
292
+ if (stack) {
293
+ const stackParts = [];
294
+ stackParts.push(`- **Project**: ${stack.projectName}`);
295
+ stackParts.push(`- **Frontend**: ${stack.frontend}`);
296
+ stackParts.push(`- **Backend**: ${stack.backend}`);
297
+ if (stack.database !== "none") {
298
+ stackParts.push(`- **Database**: ${stack.database}`);
299
+ }
300
+ if (stack.orm !== "none") {
301
+ stackParts.push(`- **ORM**: ${stack.orm}`);
302
+ }
303
+ stackParts.push(`- **Auth**: ${stack.auth}`);
304
+ if (stack.addons && stack.addons.length > 0) {
305
+ stackParts.push(`- **Addons**: ${stack.addons.join(", ")}`);
306
+ }
307
+ stackParts.push(`- **Package Manager**: ${stack.packageManager}`);
308
+ stackInfo = stackParts.join("\n");
309
+ }
310
+ // Build DOCUMENTATION_CONTEXT variable
311
+ let docContext = "";
312
+ if (documentation) {
313
+ const docParts = [];
314
+ docParts.push(`\n# Documentation Context\n`);
315
+ docParts.push(documentation.recap);
316
+ if (documentation.files && documentation.files.length > 0) {
317
+ docParts.push(`\n**Relevant Documentation Files**:`);
318
+ documentation.files.forEach((file) => {
319
+ docParts.push(`- ${file.path}`);
320
+ });
321
+ }
322
+ docContext = docParts.join("\n");
323
+ }
324
+ // Build RETRY_CONTEXT variable
325
+ const retryCtx = retryContext || "";
326
+ return this.buildPrompt({
327
+ name: "task-execution",
328
+ variables: {
329
+ RETRY_CONTEXT: retryCtx,
330
+ TASK_PLAN: taskPlanText,
331
+ STACK_INFO: stackInfo,
332
+ DOCUMENTATION_CONTEXT: docContext,
333
+ },
334
+ });
335
+ }
277
336
  }
278
337
  exports.PromptBuilder = PromptBuilder;
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-registry.d.ts","sourceRoot":"","sources":["../../src/lib/prompt-registry.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,OAAO,CA8JnB;IAEH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI1D,MAAM,CAAC,aAAa,IAAI,cAAc,EAAE;IAIxC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,cAAc,EAAE;IAMlE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIvC,MAAM,CAAC,WAAW,IAAI,MAAM;IAiD5B,MAAM,CAAC,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC;QACD,KAAK,EAAE,OAAO,CAAC;QACf,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;KAC3B;CAuBF"}
1
+ {"version":3,"file":"prompt-registry.d.ts","sourceRoot":"","sources":["../../src/lib/prompt-registry.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,OAAO,CAiUnB;IAEH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI1D,MAAM,CAAC,aAAa,IAAI,cAAc,EAAE;IAIxC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,cAAc,EAAE;IAMlE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIvC,MAAM,CAAC,WAAW,IAAI,MAAM;IAiD5B,MAAM,CAAC,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC;QACD,KAAK,EAAE,OAAO,CAAC;QACf,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;KAC3B;CAuBF"}
@@ -131,6 +131,29 @@ class PromptRegistry {
131
131
  promptText: prompts_1.TASK_PLANNING_SYSTEM_PROMPT,
132
132
  },
133
133
  ],
134
+ // Task Execution Prompts
135
+ [
136
+ "task-execution",
137
+ {
138
+ name: "task-execution",
139
+ description: "Execute task with full project context",
140
+ type: "user",
141
+ requiredVariables: ["TASK_PLAN", "STACK_INFO"],
142
+ optionalVariables: ["RETRY_CONTEXT", "DOCUMENTATION_CONTEXT"],
143
+ promptText: prompts_1.TASK_EXECUTION_PROMPT,
144
+ },
145
+ ],
146
+ [
147
+ "task-execution-system",
148
+ {
149
+ name: "task-execution-system",
150
+ description: "System prompt for task execution",
151
+ type: "system",
152
+ requiredVariables: [],
153
+ optionalVariables: [],
154
+ promptText: prompts_1.TASK_EXECUTION_SYSTEM_PROMPT,
155
+ },
156
+ ],
134
157
  // PRD Question Prompts
135
158
  [
136
159
  "prd-question",
@@ -154,6 +177,141 @@ class PromptRegistry {
154
177
  promptText: prompts_1.PRD_QUESTION_SYSTEM_PROMPT,
155
178
  },
156
179
  ],
180
+ // Documentation Recap Prompts
181
+ [
182
+ "documentation-recap",
183
+ {
184
+ name: "documentation-recap",
185
+ description: "Create concise recap of fetched documentation",
186
+ type: "user",
187
+ requiredVariables: ["LIBRARIES_LIST", "DOCUMENTATION_CONTENTS"],
188
+ optionalVariables: [],
189
+ promptText: prompts_1.DOCUMENTATION_RECAP_PROMPT,
190
+ },
191
+ ],
192
+ [
193
+ "documentation-recap-system",
194
+ {
195
+ name: "documentation-recap-system",
196
+ description: "System prompt for documentation recap",
197
+ type: "system",
198
+ requiredVariables: [],
199
+ optionalVariables: [],
200
+ promptText: prompts_1.DOCUMENTATION_RECAP_SYSTEM_PROMPT,
201
+ },
202
+ ],
203
+ // PRD Question Answer Prompts
204
+ [
205
+ "prd-question-answer",
206
+ {
207
+ name: "prd-question-answer",
208
+ description: "Answer questions about PRD",
209
+ type: "user",
210
+ requiredVariables: ["PRD_CONTENT", "QUESTIONS_TEXT"],
211
+ optionalVariables: ["CONTEXT_TEXT"],
212
+ promptText: prompts_1.PRD_QUESTION_ANSWER_PROMPT,
213
+ },
214
+ ],
215
+ [
216
+ "prd-question-answer-system",
217
+ {
218
+ name: "prd-question-answer-system",
219
+ description: "System prompt for PRD question answering",
220
+ type: "system",
221
+ requiredVariables: [],
222
+ optionalVariables: [],
223
+ promptText: prompts_1.PRD_QUESTION_ANSWER_SYSTEM_PROMPT,
224
+ },
225
+ ],
226
+ // Workflow Prompts
227
+ [
228
+ "project-init-suggestion",
229
+ {
230
+ name: "project-init-suggestion",
231
+ description: "Suggest project initialization configuration",
232
+ type: "user",
233
+ requiredVariables: ["USER_DESCRIPTION"],
234
+ optionalVariables: [],
235
+ promptText: prompts_1.PROJECT_INIT_SUGGESTION_PROMPT,
236
+ },
237
+ ],
238
+ [
239
+ "project-init-suggestion-system",
240
+ {
241
+ name: "project-init-suggestion-system",
242
+ description: "System prompt for project initialization",
243
+ type: "system",
244
+ requiredVariables: [],
245
+ optionalVariables: [],
246
+ promptText: prompts_1.PROJECT_INIT_SUGGESTION_SYSTEM_PROMPT,
247
+ },
248
+ ],
249
+ [
250
+ "prd-improvement",
251
+ {
252
+ name: "prd-improvement",
253
+ description: "Improve PRD based on user feedback",
254
+ type: "user",
255
+ requiredVariables: ["CURRENT_PRD", "USER_FEEDBACK"],
256
+ optionalVariables: [],
257
+ promptText: prompts_1.PRD_IMPROVEMENT_PROMPT,
258
+ },
259
+ ],
260
+ [
261
+ "prd-improvement-system",
262
+ {
263
+ name: "prd-improvement-system",
264
+ description: "System prompt for PRD improvement",
265
+ type: "system",
266
+ requiredVariables: [],
267
+ optionalVariables: [],
268
+ promptText: prompts_1.PRD_IMPROVEMENT_SYSTEM_PROMPT,
269
+ },
270
+ ],
271
+ [
272
+ "task-prioritization",
273
+ {
274
+ name: "task-prioritization",
275
+ description: "Prioritize tasks based on user guidance",
276
+ type: "user",
277
+ requiredVariables: ["TASKS_DESCRIPTION", "USER_GUIDANCE"],
278
+ optionalVariables: [],
279
+ promptText: prompts_1.TASK_PRIORITIZATION_PROMPT,
280
+ },
281
+ ],
282
+ [
283
+ "task-prioritization-system",
284
+ {
285
+ name: "task-prioritization-system",
286
+ description: "System prompt for task prioritization",
287
+ type: "system",
288
+ requiredVariables: [],
289
+ optionalVariables: [],
290
+ promptText: prompts_1.TASK_PRIORITIZATION_SYSTEM_PROMPT,
291
+ },
292
+ ],
293
+ [
294
+ "task-splitting-assistance",
295
+ {
296
+ name: "task-splitting-assistance",
297
+ description: "Generate task splitting instructions",
298
+ type: "user",
299
+ requiredVariables: ["TASK_TITLE", "USER_GUIDANCE"],
300
+ optionalVariables: ["TASK_CONTENT"],
301
+ promptText: prompts_1.TASK_SPLITTING_ASSISTANCE_PROMPT,
302
+ },
303
+ ],
304
+ [
305
+ "task-splitting-assistance-system",
306
+ {
307
+ name: "task-splitting-assistance-system",
308
+ description: "System prompt for task splitting assistance",
309
+ type: "system",
310
+ requiredVariables: [],
311
+ optionalVariables: [],
312
+ promptText: prompts_1.TASK_SPLITTING_ASSISTANCE_SYSTEM_PROMPT,
313
+ },
314
+ ],
157
315
  ]);
158
316
  static getPrompt(name) {
159
317
  return this.prompts.get(name);
@@ -1 +1 @@
1
- {"version":3,"file":"task-execution.d.ts","sourceRoot":"","sources":["../../src/lib/task-execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAgC,MAAM,UAAU,CAAC;AAgM5E,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgF5E"}
1
+ {"version":3,"file":"task-execution.d.ts","sourceRoot":"","sources":["../../src/lib/task-execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAgC,MAAM,UAAU,CAAC;AA0J5E,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgF5E"}
@@ -9,6 +9,7 @@ const executor_factory_1 = require("./executors/executor-factory");
9
9
  const validation_1 = require("./validation");
10
10
  const ai_service_factory_1 = require("../utils/ai-service-factory");
11
11
  const hooks_1 = require("./hooks");
12
+ const prompt_builder_1 = require("./prompt-builder");
12
13
  const chalk_1 = __importDefault(require("chalk"));
13
14
  async function executeSingleTask(taskId, tool, dry, executorConfig) {
14
15
  // Load task
@@ -20,50 +21,20 @@ async function executeSingleTask(taskId, tool, dry, executorConfig) {
20
21
  // Build comprehensive execution message with full context
21
22
  const contextBuilder = (0, ai_service_factory_1.getContextBuilder)();
22
23
  const taskContext = await contextBuilder.buildContext(taskId);
23
- // Build execution message with ALL context
24
- const messageParts = [];
25
- // Add task plan if available
24
+ // Get task plan if available
26
25
  const planData = await tasks_1.taskService.getTaskPlan(taskId);
27
- if (planData) {
28
- messageParts.push(`# Task Plan\n\n${planData.plan}\n`);
26
+ // Build execution prompt using PromptBuilder
27
+ const promptResult = prompt_builder_1.PromptBuilder.buildExecutionPrompt({
28
+ taskTitle: task.title,
29
+ taskDescription: task.description,
30
+ taskPlan: planData?.plan,
31
+ stack: taskContext.stack,
32
+ documentation: taskContext.documentation,
33
+ });
34
+ if (!promptResult.success) {
35
+ throw new Error(`Failed to build execution prompt: ${promptResult.error}`);
29
36
  }
30
- else {
31
- messageParts.push(`# Task: ${task.title}\n\n${task.description || "No description"}\n`);
32
- }
33
- // Add PRD context if available
34
- if (taskContext.prdContent) {
35
- messageParts.push(`\n# Product Requirements Document\n\n${taskContext.prdContent}\n`);
36
- }
37
- // Add stack/technology context
38
- if (taskContext.stack) {
39
- messageParts.push(`\n# Technology Stack\n\n`);
40
- messageParts.push(`- **Project**: ${taskContext.stack.projectName}\n`);
41
- messageParts.push(`- **Frontend**: ${taskContext.stack.frontend}\n`);
42
- messageParts.push(`- **Backend**: ${taskContext.stack.backend}\n`);
43
- if (taskContext.stack.database !== "none") {
44
- messageParts.push(`- **Database**: ${taskContext.stack.database}\n`);
45
- }
46
- if (taskContext.stack.orm !== "none") {
47
- messageParts.push(`- **ORM**: ${taskContext.stack.orm}\n`);
48
- }
49
- messageParts.push(`- **Auth**: ${taskContext.stack.auth}\n`);
50
- if (taskContext.stack.addons.length > 0) {
51
- messageParts.push(`- **Addons**: ${taskContext.stack.addons.join(", ")}\n`);
52
- }
53
- messageParts.push(`- **Package Manager**: ${taskContext.stack.packageManager}\n`);
54
- }
55
- // Add documentation context if available
56
- if (taskContext.documentation) {
57
- messageParts.push(`\n# Documentation Context\n\n`);
58
- messageParts.push(`${taskContext.documentation.recap}\n`);
59
- if (taskContext.documentation.files.length > 0) {
60
- messageParts.push(`\n**Relevant Documentation Files**:\n`);
61
- taskContext.documentation.files.forEach((file) => {
62
- messageParts.push(`- ${file.path}\n`);
63
- });
64
- }
65
- }
66
- const executionMessage = messageParts.join("");
37
+ const executionMessage = promptResult.prompt;
67
38
  if (!dry) {
68
39
  // Update task status to in-progress
69
40
  await tasks_1.taskService.setTaskStatus(taskId, "in-progress");
@@ -1 +1 @@
1
- {"version":3,"file":"task-loop-execution.d.ts","sourceRoot":"","sources":["../../src/lib/task-loop-execution.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EAMlB,MAAM,UAAU,CAAC;AAelB;;;GAGG;AACH;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE;IACR,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,OAAO,CAAC;CAChC,EACD,MAAM,GAAE,CACN,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAa,EAC5D,KAAK,GAAE,GAAuB,GAC7B,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA+G/C;AA4pBD;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CAmK5B"}
1
+ {"version":3,"file":"task-loop-execution.d.ts","sourceRoot":"","sources":["../../src/lib/task-loop-execution.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EAMlB,MAAM,UAAU,CAAC;AAgBlB;;;GAGG;AACH;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE;IACR,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,OAAO,CAAC;CAChC,EACD,MAAM,GAAE,CACN,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAa,EAC5D,KAAK,GAAE,GAAuB,GAC7B,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA+G/C;AA6oBD;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CAmK5B"}
@@ -9,6 +9,7 @@ const tasks_1 = require("../services/tasks");
9
9
  const executor_factory_1 = require("./executors/executor-factory");
10
10
  const ai_service_factory_1 = require("../utils/ai-service-factory");
11
11
  const hooks_1 = require("./hooks");
12
+ const prompt_builder_1 = require("./prompt-builder");
12
13
  const chalk_1 = __importDefault(require("chalk"));
13
14
  const child_process_1 = require("child_process");
14
15
  const util_1 = require("util");
@@ -290,55 +291,47 @@ Please update the plan file "${planFileName}" to incorporate this feedback.`;
290
291
  // Build execution message with context
291
292
  const contextBuilder = (0, ai_service_factory_1.getContextBuilder)();
292
293
  const taskContext = await contextBuilder.buildContext(task.id);
293
- const messageParts = [];
294
- // Add retry context if this is a retry attempt
294
+ // Build retry context if this is a retry attempt
295
+ let retryContext = "";
295
296
  if (currentAttempt > 1 && lastError) {
296
- messageParts.push(`# RETRY ATTEMPT ${currentAttempt}/${maxRetries}\n\n`);
297
+ const retryParts = [];
298
+ retryParts.push(`# RETRY ATTEMPT ${currentAttempt}/${maxRetries}\n\n`);
297
299
  // Add model escalation context
298
300
  if (currentModel) {
299
- messageParts.push(`**Note**: You are ${currentExecutor} using the ${currentModel} model. This is a more capable model than the previous attempt.\n\n`);
301
+ retryParts.push(`**Note**: You are ${currentExecutor} using the ${currentModel} model. This is a more capable model than the previous attempt.\n\n`);
300
302
  }
301
- messageParts.push(`## Previous Attempt Failed With Error:\n\n${lastError}\n\n`);
302
- messageParts.push(`Please analyze the error carefully and fix it. The error might be due to:\n`);
303
- messageParts.push(`- Syntax errors\n`);
304
- messageParts.push(`- Logic errors\n`);
305
- messageParts.push(`- Missing dependencies or imports\n`);
306
- messageParts.push(`- Incorrect configuration\n`);
307
- messageParts.push(`- Build or test failures\n\n`);
308
- messageParts.push(`Please fix the error above and complete the task successfully.\n\n`);
303
+ retryParts.push(`## Previous Attempt Failed With Error:\n\n${lastError}\n\n`);
304
+ retryParts.push(`Please analyze the error carefully and fix it. The error might be due to:\n`);
305
+ retryParts.push(`- Syntax errors\n`);
306
+ retryParts.push(`- Logic errors\n`);
307
+ retryParts.push(`- Missing dependencies or imports\n`);
308
+ retryParts.push(`- Incorrect configuration\n`);
309
+ retryParts.push(`- Build or test failures\n\n`);
310
+ retryParts.push(`Please fix the error above and complete the task successfully.\n\n`);
311
+ retryContext = retryParts.join("");
309
312
  }
310
- // Add task plan if available (from planning phase or service)
313
+ // Get task plan if available (from planning phase or service)
311
314
  const storedPlanData = await tasks_1.taskService.getTaskPlan(task.id);
315
+ let finalPlan;
312
316
  if (planContent) {
313
- messageParts.push(`# Implementation Plan\n\n${planContent}\n\nPlease follow this plan to implement the task.\n`);
317
+ finalPlan = `${planContent}\n\nPlease follow this plan to implement the task.`;
314
318
  }
315
319
  else if (storedPlanData) {
316
- messageParts.push(`# Task Plan\n\n${storedPlanData.plan}\n`);
320
+ finalPlan = storedPlanData.plan;
317
321
  }
318
- else {
319
- messageParts.push(`# Task: ${task.title}\n\n${task.description || "No description"}\n`);
320
- }
321
- // Add PRD context if available
322
- if (taskContext.prdContent) {
323
- messageParts.push(`\n# Product Requirements Document\n\n${taskContext.prdContent}\n`);
324
- }
325
- // Add stack/technology context
326
- if (taskContext.stack) {
327
- messageParts.push(`\n# Technology Stack\n\n`);
328
- messageParts.push(`- **Project**: ${taskContext.stack.projectName}\n`);
329
- messageParts.push(`- **Frontend**: ${taskContext.stack.frontend}\n`);
330
- messageParts.push(`- **Backend**: ${taskContext.stack.backend}\n`);
331
- if (taskContext.stack.database !== "none") {
332
- messageParts.push(`- **Database**: ${taskContext.stack.database}\n`);
333
- }
334
- messageParts.push(`- **Auth**: ${taskContext.stack.auth}\n`);
335
- }
336
- // Add documentation context if available
337
- if (taskContext.documentation) {
338
- messageParts.push(`\n# Documentation Context\n\n`);
339
- messageParts.push(`${taskContext.documentation.recap}\n`);
322
+ // Build execution prompt using PromptBuilder
323
+ const promptResult = prompt_builder_1.PromptBuilder.buildExecutionPrompt({
324
+ taskTitle: task.title,
325
+ taskDescription: task.description,
326
+ taskPlan: finalPlan,
327
+ stack: taskContext.stack,
328
+ documentation: taskContext.documentation,
329
+ retryContext,
330
+ });
331
+ if (!promptResult.success) {
332
+ throw new Error(`Failed to build execution prompt: ${promptResult.error}`);
340
333
  }
341
- const executionMessage = messageParts.join("");
334
+ const executionMessage = promptResult.prompt;
342
335
  // Update task status to in-progress
343
336
  if (!dry) {
344
337
  await tasks_1.taskService.setTaskStatus(task.id, "in-progress");
@@ -0,0 +1,3 @@
1
+ export declare const DOCUMENTATION_RECAP_PROMPT = "Create a concise recap of the documentation fetched for these libraries:\n\nLibraries:\n{LIBRARIES_LIST}\n\nDocumentation Contents:\n{DOCUMENTATION_CONTENTS}\n\nPlease provide a 2-3 sentence summary of what documentation is available and how it relates to the task.";
2
+ export declare const DOCUMENTATION_RECAP_SYSTEM_PROMPT = "You are a technical writer who creates concise summaries of documentation collections.";
3
+ //# sourceMappingURL=documentation-recap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentation-recap.d.ts","sourceRoot":"","sources":["../../src/prompts/documentation-recap.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,8QAQkE,CAAC;AAE1G,eAAO,MAAM,iCAAiC,2FAA2F,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DOCUMENTATION_RECAP_SYSTEM_PROMPT = exports.DOCUMENTATION_RECAP_PROMPT = void 0;
4
+ exports.DOCUMENTATION_RECAP_PROMPT = `Create a concise recap of the documentation fetched for these libraries:
5
+
6
+ Libraries:
7
+ {LIBRARIES_LIST}
8
+
9
+ Documentation Contents:
10
+ {DOCUMENTATION_CONTENTS}
11
+
12
+ Please provide a 2-3 sentence summary of what documentation is available and how it relates to the task.`;
13
+ exports.DOCUMENTATION_RECAP_SYSTEM_PROMPT = `You are a technical writer who creates concise summaries of documentation collections.`;
@@ -4,7 +4,11 @@ export * from "./task-enhancement";
4
4
  export * from "./prd-rework";
5
5
  export * from "./documentation-detection";
6
6
  export * from "./task-planning";
7
+ export * from "./task-execution";
7
8
  export * from "./prd-question";
8
9
  export * from "./prd-generation";
9
10
  export * from "./prd-combination";
11
+ export * from "./documentation-recap";
12
+ export * from "./prd-question-answer";
13
+ export * from "./workflow-prompts";
10
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
@@ -20,6 +20,10 @@ __exportStar(require("./task-enhancement"), exports);
20
20
  __exportStar(require("./prd-rework"), exports);
21
21
  __exportStar(require("./documentation-detection"), exports);
22
22
  __exportStar(require("./task-planning"), exports);
23
+ __exportStar(require("./task-execution"), exports);
23
24
  __exportStar(require("./prd-question"), exports);
24
25
  __exportStar(require("./prd-generation"), exports);
25
26
  __exportStar(require("./prd-combination"), exports);
27
+ __exportStar(require("./documentation-recap"), exports);
28
+ __exportStar(require("./prd-question-answer"), exports);
29
+ __exportStar(require("./workflow-prompts"), exports);
@@ -0,0 +1,3 @@
1
+ export declare const PRD_QUESTION_ANSWER_PROMPT = "You are a product expert helping to clarify a PRD.\n\nPRD Content:\n{PRD_CONTENT}{CONTEXT_TEXT}\n\nPlease answer the following questions based on the PRD and context:\n\n{QUESTIONS_TEXT}\n\nProvide thoughtful, specific answers that will help refine the PRD.\nFormat your response as JSON with the following structure:\n{\n \"answers\": {\n \"1\": \"answer to question 1\",\n \"2\": \"answer to question 2\",\n ...\n }\n}";
2
+ export declare const PRD_QUESTION_ANSWER_SYSTEM_PROMPT = "You are a product expert analyzing PRDs and answering clarifying questions.\nYour answers should be:\n- Specific and actionable\n- Based on the PRD content and project context\n- Helpful for refining the PRD\n- Formatted as JSON";
3
+ //# sourceMappingURL=prd-question-answer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prd-question-answer.d.ts","sourceRoot":"","sources":["../../src/prompts/prd-question-answer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,obAiBrC,CAAC;AAEH,eAAO,MAAM,iCAAiC,yOAK1B,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PRD_QUESTION_ANSWER_SYSTEM_PROMPT = exports.PRD_QUESTION_ANSWER_PROMPT = void 0;
4
+ exports.PRD_QUESTION_ANSWER_PROMPT = `You are a product expert helping to clarify a PRD.
5
+
6
+ PRD Content:
7
+ {PRD_CONTENT}{CONTEXT_TEXT}
8
+
9
+ Please answer the following questions based on the PRD and context:
10
+
11
+ {QUESTIONS_TEXT}
12
+
13
+ Provide thoughtful, specific answers that will help refine the PRD.
14
+ Format your response as JSON with the following structure:
15
+ {
16
+ "answers": {
17
+ "1": "answer to question 1",
18
+ "2": "answer to question 2",
19
+ ...
20
+ }
21
+ }`;
22
+ exports.PRD_QUESTION_ANSWER_SYSTEM_PROMPT = `You are a product expert analyzing PRDs and answering clarifying questions.
23
+ Your answers should be:
24
+ - Specific and actionable
25
+ - Based on the PRD content and project context
26
+ - Helpful for refining the PRD
27
+ - Formatted as JSON`;
@@ -0,0 +1,3 @@
1
+ export declare const TASK_EXECUTION_PROMPT = "{RETRY_CONTEXT}{TASK_PLAN}\n# Technology Stack\n{STACK_INFO}\n{DOCUMENTATION_CONTEXT}";
2
+ export declare const TASK_EXECUTION_SYSTEM_PROMPT = "\nYou are an expert software developer. Execute the task according to the implementation plan and project context provided.\n\n## Guidelines:\n1. Follow the implementation plan step-by-step\n2. Use the technology stack and libraries specified\n3. Refer to the documentation context for API usage\n4. Write clean, maintainable code following best practices\n5. Handle errors appropriately\n6. Test your changes\n\n## On Retries:\nIf this is a retry attempt, carefully analyze the previous error and fix it before proceeding.\n";
3
+ //# sourceMappingURL=task-execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-execution.d.ts","sourceRoot":"","sources":["../../src/prompts/task-execution.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,0FAGV,CAAC;AAEzB,eAAO,MAAM,4BAA4B,khBAaxC,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TASK_EXECUTION_SYSTEM_PROMPT = exports.TASK_EXECUTION_PROMPT = void 0;
4
+ exports.TASK_EXECUTION_PROMPT = `{RETRY_CONTEXT}{TASK_PLAN}
5
+ # Technology Stack
6
+ {STACK_INFO}
7
+ {DOCUMENTATION_CONTEXT}`;
8
+ exports.TASK_EXECUTION_SYSTEM_PROMPT = `
9
+ You are an expert software developer. Execute the task according to the implementation plan and project context provided.
10
+
11
+ ## Guidelines:
12
+ 1. Follow the implementation plan step-by-step
13
+ 2. Use the technology stack and libraries specified
14
+ 3. Refer to the documentation context for API usage
15
+ 4. Write clean, maintainable code following best practices
16
+ 5. Handle errors appropriately
17
+ 6. Test your changes
18
+
19
+ ## On Retries:
20
+ If this is a retry attempt, carefully analyze the previous error and fix it before proceeding.
21
+ `;
@@ -0,0 +1,9 @@
1
+ export declare const PROJECT_INIT_SUGGESTION_PROMPT = "You are helping a developer configure their project initialization and tech stack.\n\nAvailable Options:\n- AI Providers: openrouter, anthropic, openai, custom\n- Frontend Frameworks: next, tanstack-router, react-router, vite-react, remix\n- Backend Frameworks: hono, express, elysia, fastify\n- Databases: sqlite, postgres, mysql, mongodb, turso, neon\n- Authentication: better-auth (recommended), clerk, auth0, custom\n\nUser's Description:\n\"{USER_DESCRIPTION}\"\n\nBased on the user's description, recommend a complete configuration. Consider:\n1. Project complexity and scale\n2. Developer experience level (infer from description)\n3. Modern best practices for 2025\n4. Compatibility between chosen technologies\n\nRespond in JSON format:\n{\n \"projectName\": \"suggested-project-name\",\n \"aiProvider\": \"recommended-provider\",\n \"aiModel\": \"recommended-model\",\n \"frontend\": \"recommended-frontend\",\n \"backend\": \"recommended-backend\",\n \"database\": \"recommended-database\",\n \"auth\": true/false,\n \"reasoning\": \"Brief explanation of your choices\"\n}";
2
+ export declare const PROJECT_INIT_SUGGESTION_SYSTEM_PROMPT = "You are an expert full-stack developer helping to configure modern web projects.";
3
+ export declare const PRD_IMPROVEMENT_PROMPT = "You are a product manager reviewing and improving a PRD.\n\nCurrent PRD:\n{CURRENT_PRD}\n\nUser's Feedback:\n\"{USER_FEEDBACK}\"\n\nImprove the PRD based on the feedback. Consider:\n1. Clarity and specificity\n2. Completeness of requirements\n3. Feasibility and scope\n4. Technical details\n5. Success criteria\n\nReturn the improved PRD in the same format, incorporating the user's feedback.";
4
+ export declare const PRD_IMPROVEMENT_SYSTEM_PROMPT = "You are an experienced product manager specializing in writing clear, actionable PRDs.";
5
+ export declare const TASK_PRIORITIZATION_PROMPT = "You are a project manager helping to prioritize tasks.\n\nTasks:\n{TASKS_DESCRIPTION}\n\nUser's Guidance:\n\"{USER_GUIDANCE}\"\n\nPrioritize these tasks (1 = highest priority) based on:\n1. Dependencies (what needs to be done first)\n2. User's guidance\n3. MVP vs. nice-to-have\n4. Risk and complexity\n\nRespond in JSON format:\n{\n \"prioritizedTasks\": [\n {\"id\": \"task-id\", \"priority\": 1, \"reasoning\": \"why this priority\"},\n ...\n ],\n \"recommendations\": \"Overall recommendations for task execution\"\n}";
6
+ export declare const TASK_PRIORITIZATION_SYSTEM_PROMPT = "You are an experienced project manager with expertise in agile methodologies and task prioritization.";
7
+ export declare const TASK_SPLITTING_ASSISTANCE_PROMPT = "You are a technical lead helping to break down a complex task.\n\nTask: {TASK_TITLE}\n{TASK_CONTENT}\n\nUser's Guidance:\n\"{USER_GUIDANCE}\"\n\nGenerate specific instructions for how to split this task into subtasks. Consider:\n1. Logical breakdown points\n2. Size constraints (e.g., 2-4 hour chunks)\n3. Dependencies between subtasks\n4. Testing and validation steps\n\nProvide clear, actionable instructions for the AI that will perform the split.";
8
+ export declare const TASK_SPLITTING_ASSISTANCE_SYSTEM_PROMPT = "You are a technical lead with deep expertise in breaking down complex software development tasks into manageable pieces.";
9
+ //# sourceMappingURL=workflow-prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-prompts.d.ts","sourceRoot":"","sources":["../../src/prompts/workflow-prompts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,8BAA8B,wkCA4BzC,CAAC;AAEH,eAAO,MAAM,qCAAqC,qFAAqF,CAAC;AAGxI,eAAO,MAAM,sBAAsB,6YAe4C,CAAC;AAEhF,eAAO,MAAM,6BAA6B,2FAA2F,CAAC;AAGtI,eAAO,MAAM,0BAA0B,uhBAqBrC,CAAC;AAEH,eAAO,MAAM,iCAAiC,0GAA0G,CAAC;AAGzJ,eAAO,MAAM,gCAAgC,ucAckC,CAAC;AAEhF,eAAO,MAAM,uCAAuC,6HAA6H,CAAC"}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TASK_SPLITTING_ASSISTANCE_SYSTEM_PROMPT = exports.TASK_SPLITTING_ASSISTANCE_PROMPT = exports.TASK_PRIORITIZATION_SYSTEM_PROMPT = exports.TASK_PRIORITIZATION_PROMPT = exports.PRD_IMPROVEMENT_SYSTEM_PROMPT = exports.PRD_IMPROVEMENT_PROMPT = exports.PROJECT_INIT_SUGGESTION_SYSTEM_PROMPT = exports.PROJECT_INIT_SUGGESTION_PROMPT = void 0;
4
+ // Project Initialization Suggestion
5
+ exports.PROJECT_INIT_SUGGESTION_PROMPT = `You are helping a developer configure their project initialization and tech stack.
6
+
7
+ Available Options:
8
+ - AI Providers: openrouter, anthropic, openai, custom
9
+ - Frontend Frameworks: next, tanstack-router, react-router, vite-react, remix
10
+ - Backend Frameworks: hono, express, elysia, fastify
11
+ - Databases: sqlite, postgres, mysql, mongodb, turso, neon
12
+ - Authentication: better-auth (recommended), clerk, auth0, custom
13
+
14
+ User's Description:
15
+ "{USER_DESCRIPTION}"
16
+
17
+ Based on the user's description, recommend a complete configuration. Consider:
18
+ 1. Project complexity and scale
19
+ 2. Developer experience level (infer from description)
20
+ 3. Modern best practices for 2025
21
+ 4. Compatibility between chosen technologies
22
+
23
+ Respond in JSON format:
24
+ {
25
+ "projectName": "suggested-project-name",
26
+ "aiProvider": "recommended-provider",
27
+ "aiModel": "recommended-model",
28
+ "frontend": "recommended-frontend",
29
+ "backend": "recommended-backend",
30
+ "database": "recommended-database",
31
+ "auth": true/false,
32
+ "reasoning": "Brief explanation of your choices"
33
+ }`;
34
+ exports.PROJECT_INIT_SUGGESTION_SYSTEM_PROMPT = `You are an expert full-stack developer helping to configure modern web projects.`;
35
+ // PRD Improvement
36
+ exports.PRD_IMPROVEMENT_PROMPT = `You are a product manager reviewing and improving a PRD.
37
+
38
+ Current PRD:
39
+ {CURRENT_PRD}
40
+
41
+ User's Feedback:
42
+ "{USER_FEEDBACK}"
43
+
44
+ Improve the PRD based on the feedback. Consider:
45
+ 1. Clarity and specificity
46
+ 2. Completeness of requirements
47
+ 3. Feasibility and scope
48
+ 4. Technical details
49
+ 5. Success criteria
50
+
51
+ Return the improved PRD in the same format, incorporating the user's feedback.`;
52
+ exports.PRD_IMPROVEMENT_SYSTEM_PROMPT = `You are an experienced product manager specializing in writing clear, actionable PRDs.`;
53
+ // Task Prioritization
54
+ exports.TASK_PRIORITIZATION_PROMPT = `You are a project manager helping to prioritize tasks.
55
+
56
+ Tasks:
57
+ {TASKS_DESCRIPTION}
58
+
59
+ User's Guidance:
60
+ "{USER_GUIDANCE}"
61
+
62
+ Prioritize these tasks (1 = highest priority) based on:
63
+ 1. Dependencies (what needs to be done first)
64
+ 2. User's guidance
65
+ 3. MVP vs. nice-to-have
66
+ 4. Risk and complexity
67
+
68
+ Respond in JSON format:
69
+ {
70
+ "prioritizedTasks": [
71
+ {"id": "task-id", "priority": 1, "reasoning": "why this priority"},
72
+ ...
73
+ ],
74
+ "recommendations": "Overall recommendations for task execution"
75
+ }`;
76
+ exports.TASK_PRIORITIZATION_SYSTEM_PROMPT = `You are an experienced project manager with expertise in agile methodologies and task prioritization.`;
77
+ // Task Splitting Assistance
78
+ exports.TASK_SPLITTING_ASSISTANCE_PROMPT = `You are a technical lead helping to break down a complex task.
79
+
80
+ Task: {TASK_TITLE}
81
+ {TASK_CONTENT}
82
+
83
+ User's Guidance:
84
+ "{USER_GUIDANCE}"
85
+
86
+ Generate specific instructions for how to split this task into subtasks. Consider:
87
+ 1. Logical breakdown points
88
+ 2. Size constraints (e.g., 2-4 hour chunks)
89
+ 3. Dependencies between subtasks
90
+ 4. Testing and validation steps
91
+
92
+ Provide clear, actionable instructions for the AI that will perform the split.`;
93
+ exports.TASK_SPLITTING_ASSISTANCE_SYSTEM_PROMPT = `You are a technical lead with deep expertise in breaking down complex software development tasks into manageable pieces.`;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-ai-assistant.d.ts","sourceRoot":"","sources":["../../src/services/workflow-ai-assistant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAiB,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGtE;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B;;OAEG;IACG,gBAAgB,CAAC,KAAK,EAAE;QAC5B,eAAe,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC,GAAG,OAAO,CAAC;QACV,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,Q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AAE;QACpC,KAAK,EAAE,KAAK,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClE,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC,GAAG,OAAO,CAAC;QACV,gBAAgB,EAAE,KAAK,CAAC;YACtB,EAAE,EAAE,MAAM,CAAC;YACX,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC,CAAC;QACH,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IA6DF;;OAEG;IACG,mBAAmB,CAAC,KAAK,EAAE;QAC/B,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC,GAAG,OAAO,CAAC,MAAM,CAAC;CAuCpB;AAGD,eAAO,MAAM,mBAAmB,qBAA4B,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.workflowAIAssistant = exports.WorkflowAIAssistant = void 0;
4
4
  const ai_service_factory_1 = require("../utils/ai-service-factory");
5
5
  const ai_config_builder_1 = require("../utils/ai-config-builder");
6
+ const prompt_builder_1 = require("../lib/prompt-builder");
6
7
  /**
7
8
  * WorkflowAIAssistant - AI-powered decision making for workflow steps
8
9
  * Helps users make configuration choices using natural language
@@ -13,38 +14,22 @@ class WorkflowAIAssistant {
13
14
  */
14
15
  async assistInitConfig(input) {
15
16
  const aiConfig = (0, ai_config_builder_1.buildAIConfig)(input.aiOptions);
16
- const prompt = `You are helping a developer configure their project initialization and tech stack.
17
-
18
- Available Options:
19
- - AI Providers: openrouter, anthropic, openai, custom
20
- - Frontend Frameworks: next, tanstack-router, react-router, vite-react, remix
21
- - Backend Frameworks: hono, express, elysia, fastify
22
- - Databases: sqlite, postgres, mysql, mongodb, turso, neon
23
- - Authentication: better-auth (recommended), clerk, auth0, custom
24
-
25
- User's Description:
26
- "${input.userDescription}"
27
-
28
- Based on the user's description, recommend a complete configuration. Consider:
29
- 1. Project complexity and scale
30
- 2. Developer experience level (infer from description)
31
- 3. Modern best practices for 2025
32
- 4. Compatibility between chosen technologies
33
-
34
- Respond in JSON format:
35
- {
36
- "projectName": "suggested-project-name",
37
- "aiProvider": "recommended-provider",
38
- "aiModel": "recommended-model",
39
- "frontend": "recommended-frontend",
40
- "backend": "recommended-backend",
41
- "database": "recommended-database",
42
- "auth": true/false,
43
- "reasoning": "Brief explanation of your choices"
44
- }`;
45
- const result = await (0, ai_service_factory_1.getAIOperations)().streamText(prompt, aiConfig, undefined, // system prompt
46
- undefined, // user message (prompt is used)
47
- input.streamingOptions);
17
+ const promptResult = prompt_builder_1.PromptBuilder.buildPrompt({
18
+ name: "project-init-suggestion",
19
+ type: "user",
20
+ variables: {
21
+ USER_DESCRIPTION: input.userDescription,
22
+ },
23
+ });
24
+ if (!promptResult.success) {
25
+ throw new Error(`Failed to build project init prompt: ${promptResult.error}`);
26
+ }
27
+ const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
28
+ name: "project-init-suggestion",
29
+ type: "system",
30
+ variables: {},
31
+ });
32
+ const result = await (0, ai_service_factory_1.getAIOperations)().streamText(promptResult.prompt, aiConfig, systemPromptResult.prompt, undefined, input.streamingOptions);
48
33
  // Parse AI response
49
34
  try {
50
35
  const jsonMatch = result.match(/\{[\s\S]*\}/);
@@ -79,25 +64,23 @@ Respond in JSON format:
79
64
  */
80
65
  async assistPRDRefinement(input) {
81
66
  const aiConfig = (0, ai_config_builder_1.buildAIConfig)(input.aiOptions);
82
- const prompt = `You are a product manager reviewing and improving a PRD.
83
-
84
- Current PRD:
85
- ${input.currentPRD}
86
-
87
- User's Feedback:
88
- "${input.userFeedback}"
89
-
90
- Improve the PRD based on the feedback. Consider:
91
- 1. Clarity and specificity
92
- 2. Completeness of requirements
93
- 3. Feasibility and scope
94
- 4. Technical details
95
- 5. Success criteria
96
-
97
- Return the improved PRD in the same format, incorporating the user's feedback.`;
98
- const result = await (0, ai_service_factory_1.getAIOperations)().streamText(prompt, aiConfig, undefined, // system prompt
99
- undefined, // user message (prompt is used)
100
- input.streamingOptions);
67
+ const promptResult = prompt_builder_1.PromptBuilder.buildPrompt({
68
+ name: "prd-improvement",
69
+ type: "user",
70
+ variables: {
71
+ CURRENT_PRD: input.currentPRD,
72
+ USER_FEEDBACK: input.userFeedback,
73
+ },
74
+ });
75
+ if (!promptResult.success) {
76
+ throw new Error(`Failed to build PRD improvement prompt: ${promptResult.error}`);
77
+ }
78
+ const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
79
+ name: "prd-improvement",
80
+ type: "system",
81
+ variables: {},
82
+ });
83
+ const result = await (0, ai_service_factory_1.getAIOperations)().streamText(promptResult.prompt, aiConfig, systemPromptResult.prompt, undefined, input.streamingOptions);
101
84
  return result;
102
85
  }
103
86
  /**
@@ -108,31 +91,23 @@ Return the improved PRD in the same format, incorporating the user's feedback.`;
108
91
  const tasksDescription = input.tasks
109
92
  .map((t, i) => `${i + 1}. [${t.id}] ${t.title}${t.description ? `: ${t.description}` : ""}`)
110
93
  .join("\n");
111
- const prompt = `You are a project manager helping to prioritize tasks.
112
-
113
- Tasks:
114
- ${tasksDescription}
115
-
116
- User's Guidance:
117
- "${input.userGuidance}"
118
-
119
- Prioritize these tasks (1 = highest priority) based on:
120
- 1. Dependencies (what needs to be done first)
121
- 2. User's guidance
122
- 3. MVP vs. nice-to-have
123
- 4. Risk and complexity
124
-
125
- Respond in JSON format:
126
- {
127
- "prioritizedTasks": [
128
- {"id": "task-id", "priority": 1, "reasoning": "why this priority"},
129
- ...
130
- ],
131
- "recommendations": "Overall recommendations for task execution"
132
- }`;
133
- const result = await (0, ai_service_factory_1.getAIOperations)().streamText(prompt, aiConfig, undefined, // system prompt
134
- undefined, // user message (prompt is used)
135
- input.streamingOptions);
94
+ const promptResult = prompt_builder_1.PromptBuilder.buildPrompt({
95
+ name: "task-prioritization",
96
+ type: "user",
97
+ variables: {
98
+ TASKS_DESCRIPTION: tasksDescription,
99
+ USER_GUIDANCE: input.userGuidance,
100
+ },
101
+ });
102
+ if (!promptResult.success) {
103
+ throw new Error(`Failed to build task prioritization prompt: ${promptResult.error}`);
104
+ }
105
+ const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
106
+ name: "task-prioritization",
107
+ type: "system",
108
+ variables: {},
109
+ });
110
+ const result = await (0, ai_service_factory_1.getAIOperations)().streamText(promptResult.prompt, aiConfig, systemPromptResult.prompt, undefined, input.streamingOptions);
136
111
  // Parse AI response
137
112
  try {
138
113
  const jsonMatch = result.match(/\{[\s\S]*\}/);
@@ -158,24 +133,27 @@ Respond in JSON format:
158
133
  */
159
134
  async assistTaskSplitting(input) {
160
135
  const aiConfig = (0, ai_config_builder_1.buildAIConfig)(input.aiOptions);
161
- const prompt = `You are a technical lead helping to break down a complex task.
162
-
163
- Task: ${input.taskTitle}
164
- ${input.taskContent ? `Description: ${input.taskContent}` : ""}
165
-
166
- User's Guidance:
167
- "${input.userGuidance}"
168
-
169
- Generate specific instructions for how to split this task into subtasks. Consider:
170
- 1. Logical breakdown points
171
- 2. Size constraints (e.g., 2-4 hour chunks)
172
- 3. Dependencies between subtasks
173
- 4. Testing and validation steps
174
-
175
- Provide clear, actionable instructions for the AI that will perform the split.`;
176
- const result = await (0, ai_service_factory_1.getAIOperations)().streamText(prompt, aiConfig, undefined, // system prompt
177
- undefined, // user message (prompt is used)
178
- input.streamingOptions);
136
+ const taskContentText = input.taskContent
137
+ ? `Description: ${input.taskContent}`
138
+ : "";
139
+ const promptResult = prompt_builder_1.PromptBuilder.buildPrompt({
140
+ name: "task-splitting-assistance",
141
+ type: "user",
142
+ variables: {
143
+ TASK_TITLE: input.taskTitle,
144
+ TASK_CONTENT: taskContentText,
145
+ USER_GUIDANCE: input.userGuidance,
146
+ },
147
+ });
148
+ if (!promptResult.success) {
149
+ throw new Error(`Failed to build task splitting prompt: ${promptResult.error}`);
150
+ }
151
+ const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
152
+ name: "task-splitting-assistance",
153
+ type: "system",
154
+ variables: {},
155
+ });
156
+ const result = await (0, ai_service_factory_1.getAIOperations)().streamText(promptResult.prompt, aiConfig, systemPromptResult.prompt, undefined, input.streamingOptions);
179
157
  return result;
180
158
  }
181
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "task-o-matic",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "AI-powered task management CLI",
5
5
  "keywords": [
6
6
  "task-management",