task-o-matic 0.0.11 → 0.0.13

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 (123) hide show
  1. package/dist/commands/tasks/create.d.ts.map +1 -1
  2. package/dist/commands/tasks/create.js +6 -13
  3. package/dist/commands/tasks/document/add.d.ts +3 -0
  4. package/dist/commands/tasks/document/add.d.ts.map +1 -0
  5. package/dist/commands/tasks/document/add.js +35 -0
  6. package/dist/commands/tasks/document/analyze.d.ts +3 -0
  7. package/dist/commands/tasks/document/analyze.d.ts.map +1 -0
  8. package/dist/commands/tasks/document/analyze.js +49 -0
  9. package/dist/commands/tasks/document/get.d.ts +3 -0
  10. package/dist/commands/tasks/document/get.d.ts.map +1 -0
  11. package/dist/commands/tasks/document/get.js +29 -0
  12. package/dist/commands/tasks/document/index.d.ts +8 -0
  13. package/dist/commands/tasks/document/index.d.ts.map +1 -0
  14. package/dist/commands/tasks/document/index.js +13 -0
  15. package/dist/commands/tasks/enhance.d.ts.map +1 -1
  16. package/dist/commands/tasks/enhance.js +64 -61
  17. package/dist/commands/tasks/execute-loop.d.ts.map +1 -1
  18. package/dist/commands/tasks/execute-loop.js +66 -97
  19. package/dist/commands/tasks/execute.d.ts.map +1 -1
  20. package/dist/commands/tasks/execute.js +52 -16
  21. package/dist/commands/tasks/plan/create.d.ts +3 -0
  22. package/dist/commands/tasks/plan/create.d.ts.map +1 -0
  23. package/dist/commands/tasks/plan/create.js +37 -0
  24. package/dist/commands/tasks/plan/delete.d.ts +3 -0
  25. package/dist/commands/tasks/plan/delete.d.ts.map +1 -0
  26. package/dist/commands/tasks/plan/delete.js +14 -0
  27. package/dist/commands/tasks/plan/get.d.ts +3 -0
  28. package/dist/commands/tasks/plan/get.d.ts.map +1 -0
  29. package/dist/commands/tasks/plan/get.js +24 -0
  30. package/dist/commands/tasks/plan/index.d.ts +10 -0
  31. package/dist/commands/tasks/plan/index.d.ts.map +1 -0
  32. package/dist/commands/tasks/plan/index.js +17 -0
  33. package/dist/commands/tasks/plan/list.d.ts +3 -0
  34. package/dist/commands/tasks/plan/list.d.ts.map +1 -0
  35. package/dist/commands/tasks/plan/list.js +21 -0
  36. package/dist/commands/tasks/plan/set.d.ts +3 -0
  37. package/dist/commands/tasks/plan/set.d.ts.map +1 -0
  38. package/dist/commands/tasks/plan/set.js +33 -0
  39. package/dist/commands/tasks/split.d.ts.map +1 -1
  40. package/dist/commands/tasks/split.js +65 -60
  41. package/dist/lib/ai-service/documentation-operations.d.ts.map +1 -1
  42. package/dist/lib/ai-service/documentation-operations.js +22 -12
  43. package/dist/lib/ai-service/prd-operations.d.ts.map +1 -1
  44. package/dist/lib/ai-service/prd-operations.js +18 -25
  45. package/dist/lib/executors/opencode-executor.d.ts.map +1 -1
  46. package/dist/lib/executors/opencode-executor.js +3 -1
  47. package/dist/lib/git-utils.d.ts +45 -0
  48. package/dist/lib/git-utils.d.ts.map +1 -0
  49. package/dist/lib/git-utils.js +160 -0
  50. package/dist/lib/prompt-builder.d.ts +11 -0
  51. package/dist/lib/prompt-builder.d.ts.map +1 -1
  52. package/dist/lib/prompt-builder.js +59 -0
  53. package/dist/lib/prompt-registry.d.ts.map +1 -1
  54. package/dist/lib/prompt-registry.js +158 -0
  55. package/dist/lib/task-execution-core.d.ts +7 -0
  56. package/dist/lib/task-execution-core.d.ts.map +1 -0
  57. package/dist/lib/task-execution-core.js +360 -0
  58. package/dist/lib/task-execution.d.ts +4 -0
  59. package/dist/lib/task-execution.d.ts.map +1 -1
  60. package/dist/lib/task-execution.js +31 -178
  61. package/dist/lib/task-loop-execution.d.ts +1 -19
  62. package/dist/lib/task-loop-execution.d.ts.map +1 -1
  63. package/dist/lib/task-loop-execution.js +50 -592
  64. package/dist/lib/task-planning.d.ts +28 -0
  65. package/dist/lib/task-planning.d.ts.map +1 -0
  66. package/dist/lib/task-planning.js +109 -0
  67. package/dist/lib/task-review.d.ts +27 -0
  68. package/dist/lib/task-review.d.ts.map +1 -0
  69. package/dist/lib/task-review.js +106 -0
  70. package/dist/lib/validation.d.ts +20 -3
  71. package/dist/lib/validation.d.ts.map +1 -1
  72. package/dist/lib/validation.js +39 -10
  73. package/dist/prompts/documentation-recap.d.ts +3 -0
  74. package/dist/prompts/documentation-recap.d.ts.map +1 -0
  75. package/dist/prompts/documentation-recap.js +13 -0
  76. package/dist/prompts/index.d.ts +4 -0
  77. package/dist/prompts/index.d.ts.map +1 -1
  78. package/dist/prompts/index.js +4 -0
  79. package/dist/prompts/prd-question-answer.d.ts +3 -0
  80. package/dist/prompts/prd-question-answer.d.ts.map +1 -0
  81. package/dist/prompts/prd-question-answer.js +27 -0
  82. package/dist/prompts/task-execution.d.ts +3 -0
  83. package/dist/prompts/task-execution.d.ts.map +1 -0
  84. package/dist/prompts/task-execution.js +21 -0
  85. package/dist/prompts/workflow-prompts.d.ts +9 -0
  86. package/dist/prompts/workflow-prompts.d.ts.map +1 -0
  87. package/dist/prompts/workflow-prompts.js +93 -0
  88. package/dist/services/workflow-ai-assistant.d.ts.map +1 -1
  89. package/dist/services/workflow-ai-assistant.js +72 -94
  90. package/dist/test/task-loop-git.test.js +6 -6
  91. package/dist/types/cli-options.d.ts +138 -0
  92. package/dist/types/cli-options.d.ts.map +1 -0
  93. package/dist/types/cli-options.js +6 -0
  94. package/dist/types/index.d.ts +38 -0
  95. package/dist/types/index.d.ts.map +1 -1
  96. package/dist/utils/bulk-operations.d.ts +51 -0
  97. package/dist/utils/bulk-operations.d.ts.map +1 -0
  98. package/dist/utils/bulk-operations.js +68 -0
  99. package/dist/utils/cli-validators.d.ts +54 -0
  100. package/dist/utils/cli-validators.d.ts.map +1 -0
  101. package/dist/utils/cli-validators.js +75 -0
  102. package/dist/utils/command-error-handler.d.ts +32 -0
  103. package/dist/utils/command-error-handler.d.ts.map +1 -0
  104. package/dist/utils/command-error-handler.js +52 -0
  105. package/dist/utils/confirmation.d.ts +19 -0
  106. package/dist/utils/confirmation.d.ts.map +1 -0
  107. package/dist/utils/confirmation.js +39 -0
  108. package/dist/utils/display-helpers.d.ts +81 -0
  109. package/dist/utils/display-helpers.d.ts.map +1 -0
  110. package/dist/utils/display-helpers.js +109 -0
  111. package/dist/utils/model-executor-parser.d.ts +38 -0
  112. package/dist/utils/model-executor-parser.d.ts.map +1 -0
  113. package/dist/utils/model-executor-parser.js +67 -0
  114. package/dist/utils/progress-tracking.d.ts +28 -0
  115. package/dist/utils/progress-tracking.d.ts.map +1 -0
  116. package/dist/utils/progress-tracking.js +43 -0
  117. package/package.json +1 -1
  118. package/dist/commands/tasks/document.d.ts +0 -5
  119. package/dist/commands/tasks/document.d.ts.map +0 -1
  120. package/dist/commands/tasks/document.js +0 -118
  121. package/dist/commands/tasks/plan.d.ts +0 -7
  122. package/dist/commands/tasks/plan.d.ts.map +0 -1
  123. package/dist/commands/tasks/plan.js +0 -131
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,aAAa,SAsDtB,CAAC"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,aAAa,SA+CtB,CAAC"}
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCommand = void 0;
4
4
  const commander_1 = require("commander");
5
5
  const tasks_1 = require("../../services/tasks");
6
- const hooks_1 = require("../../lib/hooks");
7
6
  const streaming_options_1 = require("../../utils/streaming-options");
8
7
  const progress_1 = require("../../cli/display/progress");
9
8
  const common_1 = require("../../cli/display/common");
10
9
  const task_1 = require("../../cli/display/task");
10
+ const progress_tracking_1 = require("../../utils/progress-tracking");
11
11
  exports.createCommand = new commander_1.Command("create")
12
12
  .description("Create a new task with AI enhancement using Context7")
13
13
  .requiredOption("--title <title>", "Task title")
@@ -24,12 +24,8 @@ exports.createCommand = new commander_1.Command("create")
24
24
  .action(async (options) => {
25
25
  try {
26
26
  const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.aiEnhance && options.stream, "Enhancement");
27
- const progressHandler = (payload) => {
28
- (0, progress_1.displayProgress)(payload);
29
- };
30
- hooks_1.hooks.on("task:progress", progressHandler);
31
- try {
32
- const result = await tasks_1.taskService.createTask({
27
+ const result = await (0, progress_tracking_1.withProgressTracking)(async () => {
28
+ return await tasks_1.taskService.createTask({
33
29
  title: options.title,
34
30
  content: options.content,
35
31
  parentId: options.parentId,
@@ -44,12 +40,9 @@ exports.createCommand = new commander_1.Command("create")
44
40
  },
45
41
  streamingOptions,
46
42
  });
47
- (0, common_1.displayEnhancementResult)(options.aiEnhance && options.stream);
48
- (0, task_1.displayCreatedTask)(result.task, result.aiMetadata);
49
- }
50
- finally {
51
- hooks_1.hooks.off("task:progress", progressHandler);
52
- }
43
+ });
44
+ (0, common_1.displayEnhancementResult)(options.aiEnhance && options.stream);
45
+ (0, task_1.displayCreatedTask)(result.task, result.aiMetadata);
53
46
  }
54
47
  catch (error) {
55
48
  (0, progress_1.displayError)(error);
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const addDocumentationCommand: Command;
3
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../src/commands/tasks/document/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,uBAAuB,SAyC/B,CAAC"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.addDocumentationCommand = void 0;
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const tasks_1 = require("../../../services/tasks");
10
+ const command_error_handler_1 = require("../../../utils/command-error-handler");
11
+ exports.addDocumentationCommand = new commander_1.Command("add-documentation")
12
+ .description("Add documentation to a task from a file")
13
+ .requiredOption("--id <id>", "Task ID")
14
+ .requiredOption("--doc-file <path>", "Path to documentation file")
15
+ .option("--overwrite", "Overwrite existing documentation")
16
+ .action((0, command_error_handler_1.wrapCommandHandler)("Add documentation", async (options) => {
17
+ const task = await tasks_1.taskService.getTask(options.id);
18
+ if (!task) {
19
+ throw new Error(`Task with ID ${options.id} not found`);
20
+ }
21
+ // Check if documentation already exists
22
+ const existingDoc = await tasks_1.taskService.getTaskDocumentation(options.id);
23
+ if (existingDoc && !options.overwrite) {
24
+ console.log(chalk_1.default.yellow(`āš ļø Documentation already exists for task ${options.id}`));
25
+ console.log(chalk_1.default.gray(` Use --overwrite to replace existing documentation`));
26
+ return;
27
+ }
28
+ const result = await tasks_1.taskService.addTaskDocumentationFromFile(options.id, options.docFile);
29
+ console.log(chalk_1.default.green(`āœ“ Documentation added to task: ${task.title} (${options.id})`));
30
+ console.log(chalk_1.default.gray(` Source file: ${options.docFile}`));
31
+ console.log(chalk_1.default.gray(` Saved to: ${result.filePath}`));
32
+ if (options.overwrite) {
33
+ console.log(chalk_1.default.cyan(` Previous documentation was overwritten`));
34
+ }
35
+ }));
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const documentCommand: Command;
3
+ //# sourceMappingURL=analyze.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../../src/commands/tasks/document/analyze.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,eAAO,MAAM,eAAe,SA+DvB,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.documentCommand = void 0;
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const tasks_1 = require("../../../services/tasks");
10
+ const streaming_options_1 = require("../../../utils/streaming-options");
11
+ const common_1 = require("../../../cli/display/common");
12
+ const progress_tracking_1 = require("../../../utils/progress-tracking");
13
+ const command_error_handler_1 = require("../../../utils/command-error-handler");
14
+ exports.documentCommand = new commander_1.Command("document")
15
+ .description("Analyze and fetch documentation for a task using AI with Context7")
16
+ .requiredOption("--task-id <id>", "Task ID")
17
+ .option("--force", "Force refresh documentation even if recent")
18
+ .option("--stream", "Show streaming AI output during analysis")
19
+ .option("--ai-provider <provider>", "AI provider override")
20
+ .option("--ai-model <model>", "AI model override")
21
+ .option("--ai-key <key>", "AI API key override")
22
+ .option("--ai-provider-url <url>", "AI provider URL override")
23
+ .option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
24
+ .action((0, command_error_handler_1.wrapCommandHandler)("Task documentation", async (options) => {
25
+ const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, "Analysis");
26
+ const result = await (0, progress_tracking_1.withProgressTracking)(async () => {
27
+ return await tasks_1.taskService.documentTask(options.taskId, options.force, {
28
+ aiProvider: options.aiProvider,
29
+ aiModel: options.aiModel,
30
+ aiKey: options.aiKey,
31
+ aiProviderUrl: options.aiProviderUrl,
32
+ aiReasoning: options.reasoning,
33
+ }, streamingOptions);
34
+ });
35
+ if (result.documentation && !options.force) {
36
+ const daysSinceFetch = (Date.now() - result.documentation.lastFetched) /
37
+ (24 * 60 * 60 * 1000);
38
+ console.log(chalk_1.default.green(`āœ“ Documentation is fresh (${Math.round(daysSinceFetch)} days old)`));
39
+ console.log(chalk_1.default.cyan(`Recap: ${result.documentation.recap}`));
40
+ console.log(chalk_1.default.blue(`Libraries: ${result.documentation.libraries.join(", ")}`));
41
+ return;
42
+ }
43
+ if (result.analysis) {
44
+ (0, common_1.displayDocumentationAnalysis)(result.analysis);
45
+ }
46
+ if (result.documentation?.research) {
47
+ (0, common_1.displayResearchSummary)(result.documentation);
48
+ }
49
+ }));
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const getDocumentationCommand: Command;
3
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/tasks/document/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,uBAAuB,SA2B/B,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getDocumentationCommand = void 0;
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const tasks_1 = require("../../../services/tasks");
10
+ const command_error_handler_1 = require("../../../utils/command-error-handler");
11
+ exports.getDocumentationCommand = new commander_1.Command("get-documentation")
12
+ .description("Get existing documentation for a task")
13
+ .requiredOption("--id <id>", "Task ID")
14
+ .action((0, command_error_handler_1.wrapCommandHandler)("Get documentation", async (options) => {
15
+ const task = await tasks_1.taskService.getTask(options.id);
16
+ if (!task) {
17
+ throw new Error(`Task with ID ${options.id} not found`);
18
+ }
19
+ const documentation = await tasks_1.taskService.getTaskDocumentation(options.id);
20
+ if (!documentation) {
21
+ console.log(chalk_1.default.yellow(`āš ļø No documentation found for task ${options.id}`));
22
+ console.log(chalk_1.default.gray(` Task: ${task.title}`));
23
+ return;
24
+ }
25
+ console.log(chalk_1.default.blue(`\nšŸ“– Documentation for Task: ${task.title} (${options.id})`));
26
+ console.log(chalk_1.default.gray(` File: .task-o-matic/docs/tasks/${options.id}.md`));
27
+ console.log("");
28
+ console.log(documentation);
29
+ }));
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Document command submodules
3
+ * Each command is in its own file for better organization
4
+ */
5
+ export { documentCommand } from "./analyze";
6
+ export { getDocumentationCommand } from "./get";
7
+ export { addDocumentationCommand } from "./add";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/tasks/document/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Document command submodules
4
+ * Each command is in its own file for better organization
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.addDocumentationCommand = exports.getDocumentationCommand = exports.documentCommand = void 0;
8
+ var analyze_1 = require("./analyze");
9
+ Object.defineProperty(exports, "documentCommand", { enumerable: true, get: function () { return analyze_1.documentCommand; } });
10
+ var get_1 = require("./get");
11
+ Object.defineProperty(exports, "getDocumentationCommand", { enumerable: true, get: function () { return get_1.getDocumentationCommand; } });
12
+ var add_1 = require("./add");
13
+ Object.defineProperty(exports, "addDocumentationCommand", { enumerable: true, get: function () { return add_1.addDocumentationCommand; } });
@@ -1 +1 @@
1
- {"version":3,"file":"enhance.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/enhance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,cAAc,SA8GvB,CAAC"}
1
+ {"version":3,"file":"enhance.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/enhance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,eAAO,MAAM,cAAc,SAqGtB,CAAC"}
@@ -7,80 +7,83 @@ exports.enhanceCommand = void 0;
7
7
  const commander_1 = require("commander");
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
9
  const tasks_1 = require("../../services/tasks");
10
- const hooks_1 = require("../../lib/hooks");
11
10
  const streaming_options_1 = require("../../utils/streaming-options");
12
- const progress_1 = require("../../cli/display/progress");
11
+ const progress_tracking_1 = require("../../utils/progress-tracking");
12
+ const cli_validators_1 = require("../../utils/cli-validators");
13
+ const bulk_operations_1 = require("../../utils/bulk-operations");
14
+ const confirmation_1 = require("../../utils/confirmation");
15
+ const command_error_handler_1 = require("../../utils/command-error-handler");
13
16
  exports.enhanceCommand = new commander_1.Command("enhance")
14
17
  .description("Enhance an existing task with AI using Context7 documentation")
15
18
  .option("--task-id <id>", "Task ID to enhance")
16
19
  .option("--all", "Enhance all existing tasks")
20
+ .option("--status <status>", "Filter tasks by status (todo/in-progress/completed)")
21
+ .option("--tag <tag>", "Filter tasks by tag")
22
+ .option("--dry", "Preview what would be enhanced without making changes")
23
+ .option("--force", "Skip confirmation prompt for bulk operations")
17
24
  .option("--stream", "Show streaming AI output during enhancement")
18
25
  .option("--ai-provider <provider>", "AI provider override")
19
26
  .option("--ai-model <model>", "AI model override")
20
27
  .option("--ai-key <key>", "AI API key override")
21
28
  .option("--ai-provider-url <url>", "AI provider URL override")
22
29
  .option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
23
- .action(async (options) => {
24
- try {
25
- if (!options.taskId && !options.all) {
26
- throw new Error("Either --task-id or --all must be specified");
27
- }
28
- if (options.taskId && options.all) {
29
- throw new Error("Cannot specify both --task-id and --all");
30
+ .action((0, command_error_handler_1.wrapCommandHandler)("Task enhancement", async (options) => {
31
+ // Validate mutual exclusivity (only if no filters provided)
32
+ if (!options.status && !options.tag) {
33
+ (0, cli_validators_1.validateMutuallyExclusive)(options, "taskId", "all", "task-id", "all");
34
+ }
35
+ const enhanceSingleTask = async (taskId) => {
36
+ if (options.dry) {
37
+ const task = await tasks_1.taskService.getTask(taskId);
38
+ console.log(chalk_1.default.blue(`[DRY RUN] Would enhance: ${task?.title || taskId}`));
39
+ return;
30
40
  }
31
- const enhanceSingleTask = async (taskId) => {
32
- const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, "Enhancement");
33
- const progressHandler = (payload) => {
34
- (0, progress_1.displayProgress)(payload);
35
- };
36
- hooks_1.hooks.on("task:progress", progressHandler);
37
- try {
38
- const result = await tasks_1.taskService.enhanceTask(taskId, {
39
- aiProvider: options.aiProvider,
40
- aiModel: options.aiModel,
41
- aiKey: options.aiKey,
42
- aiProviderUrl: options.aiProviderUrl,
43
- aiReasoning: options.reasoning,
44
- }, streamingOptions);
45
- if (result.enhancedContent.length > 200) {
46
- console.log(chalk_1.default.cyan(` Enhanced content saved to file.`));
47
- }
48
- else {
49
- console.log(chalk_1.default.cyan(` Enhanced content updated in task description.`));
50
- }
51
- console.log(chalk_1.default.green("āœ“ Task enhanced with Context7 documentation"));
52
- console.log(chalk_1.default.magenta(` šŸ¤– Enhanced using Context7 MCP tools`));
53
- }
54
- finally {
55
- hooks_1.hooks.off("task:progress", progressHandler);
56
- }
57
- };
58
- if (options.taskId) {
59
- await enhanceSingleTask(options.taskId);
41
+ const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, "Enhancement");
42
+ const result = await (0, progress_tracking_1.withProgressTracking)(async () => {
43
+ return await tasks_1.taskService.enhanceTask(taskId, {
44
+ aiProvider: options.aiProvider,
45
+ aiModel: options.aiModel,
46
+ aiKey: options.aiKey,
47
+ aiProviderUrl: options.aiProviderUrl,
48
+ aiReasoning: options.reasoning,
49
+ }, streamingOptions);
50
+ });
51
+ if (result.enhancedContent.length > 200) {
52
+ console.log(chalk_1.default.cyan(` Enhanced content saved to file.`));
60
53
  }
61
- else if (options.all) {
62
- const allTasks = await tasks_1.taskService.listTasks({});
63
- if (allTasks.length === 0) {
64
- console.log(chalk_1.default.yellow("No tasks found to enhance."));
65
- return;
66
- }
67
- console.log(chalk_1.default.blue(`šŸ¤– Enhancing ${allTasks.length} tasks in order...`));
68
- for (let i = 0; i < allTasks.length; i++) {
69
- const task = allTasks[i];
70
- console.log(chalk_1.default.cyan(`\n[${i + 1}/${allTasks.length}] Enhancing: ${task.title} (${task.id})`));
71
- try {
72
- await enhanceSingleTask(task.id);
73
- console.log(chalk_1.default.green(`āœ“ Enhanced task ${task.id}`));
74
- }
75
- catch (error) {
76
- console.log(chalk_1.default.red(`āŒ Failed to enhance task ${task.id}: ${error instanceof Error ? error.message : "Unknown error"}`));
77
- }
78
- }
79
- console.log(chalk_1.default.green(`\nāœ“ Bulk enhancement complete! Processed ${allTasks.length} tasks.`));
54
+ else {
55
+ console.log(chalk_1.default.cyan(` Enhanced content updated in task description.`));
80
56
  }
57
+ console.log(chalk_1.default.green("āœ“ Task enhanced with Context7 documentation"));
58
+ console.log(chalk_1.default.magenta(` šŸ¤– Enhanced using Context7 MCP tools`));
59
+ };
60
+ if (options.taskId) {
61
+ await enhanceSingleTask(options.taskId);
81
62
  }
82
- catch (error) {
83
- (0, progress_1.displayError)(error);
84
- process.exit(1);
63
+ else {
64
+ // Build filters for bulk operation
65
+ const filters = {};
66
+ if (options.status)
67
+ filters.status = options.status;
68
+ if (options.tag)
69
+ filters.tag = options.tag;
70
+ // Get task count for confirmation
71
+ const tasks = await tasks_1.taskService.listTasks(filters);
72
+ if (tasks.length === 0) {
73
+ console.log(chalk_1.default.yellow("No tasks found matching the filters"));
74
+ return;
75
+ }
76
+ // Confirm bulk operation
77
+ const confirmed = await (0, confirmation_1.confirmBulkOperation)("enhance", tasks.length, options.force);
78
+ if (!confirmed) {
79
+ console.log(chalk_1.default.yellow("Operation cancelled"));
80
+ return;
81
+ }
82
+ await (0, bulk_operations_1.executeBulkOperation)((taskId) => enhanceSingleTask(taskId), {
83
+ operationName: "Enhancing",
84
+ operationEmoji: "šŸ¤–",
85
+ successMessage: (taskId) => `āœ“ Enhanced task ${taskId}`,
86
+ filters,
87
+ });
85
88
  }
86
- });
89
+ }));
@@ -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;AAYpC,eAAO,MAAM,kBAAkB,SAkK1B,CAAC"}
@@ -7,39 +7,8 @@ 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
- /**
11
- * Parse --try-models option into ModelAttemptConfig array
12
- * Supports formats:
13
- * - "model1,model2,model3" - just models (uses default executor)
14
- * - "opencode:gpt-4o,claude:sonnet-4" - executor:model format
15
- * - Mixed: "gpt-4o,claude:sonnet-4,gemini:gemini-2.0"
16
- */
17
- function parseTryModels(value) {
18
- return value.split(",").map((item) => {
19
- const trimmed = item.trim();
20
- // Check if it includes executor specification (executor:model format)
21
- if (trimmed.includes(":")) {
22
- 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(", ")}`);
31
- }
32
- return {
33
- executor: executor,
34
- model: model.trim(),
35
- };
36
- }
37
- // Just a model name - use default executor
38
- return {
39
- model: trimmed,
40
- };
41
- });
42
- }
10
+ const model_executor_parser_1 = require("../../utils/model-executor-parser");
11
+ const command_error_handler_1 = require("../../utils/command-error-handler");
43
12
  exports.executeLoopCommand = new commander_1.Command("execute-loop")
44
13
  .description("Execute multiple tasks in a loop with retry logic and verification")
45
14
  .option("--status <status>", "Filter tasks by status (todo/in-progress/completed)")
@@ -51,78 +20,78 @@ exports.executeLoopCommand = new commander_1.Command("execute-loop")
51
20
  .option("--verify <command>", "Verification command to run after each task (can be used multiple times)", (value, previous = []) => {
52
21
  return [...previous, value];
53
22
  })
23
+ .option("--validate <command>", "Alias for --verify (validation command, can be used multiple times)", (value, previous = []) => {
24
+ return [...previous, value];
25
+ })
26
+ .option("--message <message>", "Custom message to send to the tool (overrides task plan)")
27
+ .option("--continue-session", "Continue the last session (for error feedback)", false)
54
28
  .option("--auto-commit", "Automatically commit changes after each task", false)
55
29
  .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')")
30
+ .option("--plan-model <model>", "Model/executor to use for planning (e.g., 'opencode:gpt-4o' or 'gpt-4o')")
57
31
  .option("--review-plan", "Pause for human review of the plan", false)
58
32
  .option("--review", "Run AI review after execution", false)
59
- .option("--review-model <model>", "Model/executor to use for review (e.g., 'opencode:gpt-4o')")
33
+ .option("--review-model <model>", "Model/executor to use for review (e.g., 'opencode:gpt-4o' or 'gpt-4o')")
60
34
  .option("--dry", "Show what would be executed without running it", false)
61
- .action(async (options) => {
62
- try {
63
- // 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(", ")}`));
72
- process.exit(1);
73
- }
74
- // Parse tryModels if provided
75
- let tryModels;
76
- if (options.tryModels) {
77
- try {
78
- tryModels = parseTryModels(options.tryModels);
79
- console.log(chalk_1.default.cyan(`šŸ“Š Progressive model escalation configured with ${tryModels.length} model(s):`));
80
- tryModels.forEach((config, index) => {
81
- const executorInfo = config.executor
82
- ? `${config.executor}:`
83
- : "default:";
84
- const modelInfo = config.model || "default model";
85
- console.log(chalk_1.default.cyan(` ${index + 1}. ${executorInfo}${modelInfo}`));
86
- });
87
- console.log();
88
- }
89
- catch (error) {
90
- console.error(chalk_1.default.red(`Failed to parse --try-models: ${error instanceof Error ? error.message : "Unknown error"}`));
91
- process.exit(1);
92
- }
35
+ .action((0, command_error_handler_1.wrapCommandHandler)("Execute loop", async (options) => {
36
+ // Validate tool
37
+ if (!(0, model_executor_parser_1.validateExecutor)(options.tool)) {
38
+ console.error(chalk_1.default.red(`Invalid tool: ${options.tool}. Must be one of: ${model_executor_parser_1.VALID_EXECUTORS.join(", ")}`));
39
+ process.exit(1);
40
+ }
41
+ // Parse tryModels if provided
42
+ let tryModels;
43
+ if (options.tryModels) {
44
+ try {
45
+ tryModels = (0, model_executor_parser_1.parseTryModels)(options.tryModels);
46
+ console.log(chalk_1.default.cyan(`šŸ“Š Progressive model escalation configured with ${tryModels.length} model(s):`));
47
+ tryModels.forEach((config, index) => {
48
+ const executorInfo = config.executor
49
+ ? `${config.executor}:`
50
+ : "default:";
51
+ const modelInfo = config.model || "default model";
52
+ console.log(chalk_1.default.cyan(` ${index + 1}. ${executorInfo}${modelInfo}`));
53
+ });
54
+ console.log();
93
55
  }
94
- // Build options
95
- const executeOptions = {
96
- filters: {
97
- status: options.status,
98
- tag: options.tag,
99
- taskIds: options.ids,
100
- },
101
- tool: options.tool,
102
- config: {
103
- maxRetries: options.maxRetries,
104
- verificationCommands: options.verify || [],
105
- autoCommit: options.autoCommit,
106
- tryModels,
107
- plan: options.plan,
108
- planModel: options.planModel,
109
- reviewPlan: options.reviewPlan,
110
- review: options.review,
111
- reviewModel: options.reviewModel,
112
- },
113
- dry: options.dry,
114
- };
115
- // Execute task loop
116
- const result = await (0, task_loop_execution_1.executeTaskLoop)(executeOptions);
117
- // Exit with error code if any tasks failed
118
- if (result.failedTasks > 0) {
119
- console.error(chalk_1.default.red(`\nāŒ ${result.failedTasks} task(s) failed. See logs above for details.`));
56
+ catch (error) {
57
+ console.error(chalk_1.default.red(`Failed to parse --try-models: ${error instanceof Error ? error.message : "Unknown error"}`));
120
58
  process.exit(1);
121
59
  }
122
- console.log(chalk_1.default.green(`\nāœ… All ${result.completedTasks} task(s) completed successfully!`));
123
60
  }
124
- catch (error) {
125
- console.error(chalk_1.default.red("Execute loop failed:"), error instanceof Error ? error.message : "Unknown error");
61
+ // Combine both --verify and --validate options
62
+ const verifications = [
63
+ ...(options.verify || []),
64
+ ...(options.validate || []),
65
+ ];
66
+ // Build options
67
+ const executeOptions = {
68
+ filters: {
69
+ status: options.status,
70
+ tag: options.tag,
71
+ taskIds: options.ids,
72
+ },
73
+ tool: options.tool,
74
+ config: {
75
+ maxRetries: options.maxRetries,
76
+ verificationCommands: verifications,
77
+ autoCommit: options.autoCommit,
78
+ tryModels,
79
+ plan: options.plan,
80
+ planModel: options.planModel,
81
+ reviewPlan: options.reviewPlan,
82
+ review: options.review,
83
+ reviewModel: options.reviewModel,
84
+ customMessage: options.message, // NEW: custom message override
85
+ continueSession: options.continueSession, // NEW: session continuation
86
+ },
87
+ dry: options.dry,
88
+ };
89
+ // Execute task loop
90
+ const result = await (0, task_loop_execution_1.executeTaskLoop)(executeOptions);
91
+ // Exit with error code if any tasks failed
92
+ if (result.failedTasks > 0) {
93
+ console.error(chalk_1.default.red(`\nāŒ ${result.failedTasks} task(s) failed. See logs above for details.`));
126
94
  process.exit(1);
127
95
  }
128
- });
96
+ console.log(chalk_1.default.green(`\nāœ… All ${result.completedTasks} task(s) completed successfully!`));
97
+ }));
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,cAAc,SA4CvB,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,cAAc,SA6GtB,CAAC"}