cast-code 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +217 -0
  3. package/dist/app.module.js +45 -0
  4. package/dist/app.module.js.map +1 -0
  5. package/dist/common/common.module.js +49 -0
  6. package/dist/common/common.module.js.map +1 -0
  7. package/dist/common/constants/index.js +105 -0
  8. package/dist/common/constants/index.js.map +1 -0
  9. package/dist/common/index.js +24 -0
  10. package/dist/common/index.js.map +1 -0
  11. package/dist/common/services/config.service.js +119 -0
  12. package/dist/common/services/config.service.js.map +1 -0
  13. package/dist/common/services/llm.service.js +56 -0
  14. package/dist/common/services/llm.service.js.map +1 -0
  15. package/dist/common/services/markdown-parser.service.js +101 -0
  16. package/dist/common/services/markdown-parser.service.js.map +1 -0
  17. package/dist/common/services/markdown-renderer.service.js +220 -0
  18. package/dist/common/services/markdown-renderer.service.js.map +1 -0
  19. package/dist/common/services/multi-llm.service.js +115 -0
  20. package/dist/common/services/multi-llm.service.js.map +1 -0
  21. package/dist/common/types/index.js +20 -0
  22. package/dist/common/types/index.js.map +1 -0
  23. package/dist/common/types/markdown.types.js +6 -0
  24. package/dist/common/types/markdown.types.js.map +1 -0
  25. package/dist/main.js +84 -0
  26. package/dist/main.js.map +1 -0
  27. package/dist/modules/agents/agents.module.js +43 -0
  28. package/dist/modules/agents/agents.module.js.map +1 -0
  29. package/dist/modules/agents/definitions/architect.md +35 -0
  30. package/dist/modules/agents/definitions/backend.md +43 -0
  31. package/dist/modules/agents/definitions/coder.md +34 -0
  32. package/dist/modules/agents/definitions/devops.md +42 -0
  33. package/dist/modules/agents/definitions/frontend.md +46 -0
  34. package/dist/modules/agents/definitions/reviewer.md +35 -0
  35. package/dist/modules/agents/definitions/tester.md +41 -0
  36. package/dist/modules/agents/index.js +23 -0
  37. package/dist/modules/agents/index.js.map +1 -0
  38. package/dist/modules/agents/services/agent-loader.service.js +150 -0
  39. package/dist/modules/agents/services/agent-loader.service.js.map +1 -0
  40. package/dist/modules/agents/services/agent-registry.service.js +108 -0
  41. package/dist/modules/agents/services/agent-registry.service.js.map +1 -0
  42. package/dist/modules/agents/types/agent.types.js +6 -0
  43. package/dist/modules/agents/types/agent.types.js.map +1 -0
  44. package/dist/modules/agents/types/index.js +20 -0
  45. package/dist/modules/agents/types/index.js.map +1 -0
  46. package/dist/modules/config/config.module.js +38 -0
  47. package/dist/modules/config/config.module.js.map +1 -0
  48. package/dist/modules/config/index.js +24 -0
  49. package/dist/modules/config/index.js.map +1 -0
  50. package/dist/modules/config/services/config-commands.service.js +405 -0
  51. package/dist/modules/config/services/config-commands.service.js.map +1 -0
  52. package/dist/modules/config/services/config-manager.service.js +175 -0
  53. package/dist/modules/config/services/config-manager.service.js.map +1 -0
  54. package/dist/modules/config/services/init-config.service.js +238 -0
  55. package/dist/modules/config/services/init-config.service.js.map +1 -0
  56. package/dist/modules/config/types/config.types.js +163 -0
  57. package/dist/modules/config/types/config.types.js.map +1 -0
  58. package/dist/modules/config/types/index.js +20 -0
  59. package/dist/modules/config/types/index.js.map +1 -0
  60. package/dist/modules/core/core.module.js +60 -0
  61. package/dist/modules/core/core.module.js.map +1 -0
  62. package/dist/modules/core/index.js +22 -0
  63. package/dist/modules/core/index.js.map +1 -0
  64. package/dist/modules/core/services/deep-agent.service.js +575 -0
  65. package/dist/modules/core/services/deep-agent.service.js.map +1 -0
  66. package/dist/modules/core/services/plan-mode.service.js +225 -0
  67. package/dist/modules/core/services/plan-mode.service.js.map +1 -0
  68. package/dist/modules/git/git.module.js +48 -0
  69. package/dist/modules/git/git.module.js.map +1 -0
  70. package/dist/modules/git/index.js +23 -0
  71. package/dist/modules/git/index.js.map +1 -0
  72. package/dist/modules/git/services/code-review.service.js +330 -0
  73. package/dist/modules/git/services/code-review.service.js.map +1 -0
  74. package/dist/modules/git/services/commit-generator.service.js +403 -0
  75. package/dist/modules/git/services/commit-generator.service.js.map +1 -0
  76. package/dist/modules/git/services/index.js +21 -0
  77. package/dist/modules/git/services/index.js.map +1 -0
  78. package/dist/modules/git/services/monorepo-detector.service.js +338 -0
  79. package/dist/modules/git/services/monorepo-detector.service.js.map +1 -0
  80. package/dist/modules/git/services/pr-generator.service.js +429 -0
  81. package/dist/modules/git/services/pr-generator.service.js.map +1 -0
  82. package/dist/modules/git/services/release-notes.service.js +426 -0
  83. package/dist/modules/git/services/release-notes.service.js.map +1 -0
  84. package/dist/modules/git/types/git.types.js +6 -0
  85. package/dist/modules/git/types/git.types.js.map +1 -0
  86. package/dist/modules/git/types/index.js +20 -0
  87. package/dist/modules/git/types/index.js.map +1 -0
  88. package/dist/modules/mcp/catalog/mcp-templates.js +606 -0
  89. package/dist/modules/mcp/catalog/mcp-templates.js.map +1 -0
  90. package/dist/modules/mcp/index.js +23 -0
  91. package/dist/modules/mcp/index.js.map +1 -0
  92. package/dist/modules/mcp/mcp.module.js +35 -0
  93. package/dist/modules/mcp/mcp.module.js.map +1 -0
  94. package/dist/modules/mcp/services/mcp-client.service.js +289 -0
  95. package/dist/modules/mcp/services/mcp-client.service.js.map +1 -0
  96. package/dist/modules/mcp/services/mcp-registry.service.js +197 -0
  97. package/dist/modules/mcp/services/mcp-registry.service.js.map +1 -0
  98. package/dist/modules/mcp/types/index.js +20 -0
  99. package/dist/modules/mcp/types/index.js.map +1 -0
  100. package/dist/modules/mcp/types/mcp.types.js +6 -0
  101. package/dist/modules/mcp/types/mcp.types.js.map +1 -0
  102. package/dist/modules/memory/index.js +23 -0
  103. package/dist/modules/memory/index.js.map +1 -0
  104. package/dist/modules/memory/memory.module.js +35 -0
  105. package/dist/modules/memory/memory.module.js.map +1 -0
  106. package/dist/modules/memory/services/memory-tools.service.js +78 -0
  107. package/dist/modules/memory/services/memory-tools.service.js.map +1 -0
  108. package/dist/modules/memory/services/memory.service.js +169 -0
  109. package/dist/modules/memory/services/memory.service.js.map +1 -0
  110. package/dist/modules/memory/types/index.js +20 -0
  111. package/dist/modules/memory/types/index.js.map +1 -0
  112. package/dist/modules/memory/types/memory.types.js +6 -0
  113. package/dist/modules/memory/types/memory.types.js.map +1 -0
  114. package/dist/modules/mentions/index.js +22 -0
  115. package/dist/modules/mentions/index.js.map +1 -0
  116. package/dist/modules/mentions/mentions.module.js +32 -0
  117. package/dist/modules/mentions/mentions.module.js.map +1 -0
  118. package/dist/modules/mentions/services/mentions.service.js +336 -0
  119. package/dist/modules/mentions/services/mentions.service.js.map +1 -0
  120. package/dist/modules/mentions/types/index.js +20 -0
  121. package/dist/modules/mentions/types/index.js.map +1 -0
  122. package/dist/modules/mentions/types/mention.types.js +19 -0
  123. package/dist/modules/mentions/types/mention.types.js.map +1 -0
  124. package/dist/modules/permissions/index.js +23 -0
  125. package/dist/modules/permissions/index.js.map +1 -0
  126. package/dist/modules/permissions/permissions.module.js +35 -0
  127. package/dist/modules/permissions/permissions.module.js.map +1 -0
  128. package/dist/modules/permissions/services/permission.service.js +269 -0
  129. package/dist/modules/permissions/services/permission.service.js.map +1 -0
  130. package/dist/modules/permissions/services/prompt.service.js +116 -0
  131. package/dist/modules/permissions/services/prompt.service.js.map +1 -0
  132. package/dist/modules/permissions/types/permission.types.js +32 -0
  133. package/dist/modules/permissions/types/permission.types.js.map +1 -0
  134. package/dist/modules/project/index.js +24 -0
  135. package/dist/modules/project/index.js.map +1 -0
  136. package/dist/modules/project/project.module.js +38 -0
  137. package/dist/modules/project/project.module.js.map +1 -0
  138. package/dist/modules/project/services/project-analyzer.service.js +1063 -0
  139. package/dist/modules/project/services/project-analyzer.service.js.map +1 -0
  140. package/dist/modules/project/services/project-context.service.js +62 -0
  141. package/dist/modules/project/services/project-context.service.js.map +1 -0
  142. package/dist/modules/project/services/project-loader.service.js +147 -0
  143. package/dist/modules/project/services/project-loader.service.js.map +1 -0
  144. package/dist/modules/project/types/index.js +20 -0
  145. package/dist/modules/project/types/index.js.map +1 -0
  146. package/dist/modules/project/types/project.types.js +6 -0
  147. package/dist/modules/project/types/project.types.js.map +1 -0
  148. package/dist/modules/repl/index.js +21 -0
  149. package/dist/modules/repl/index.js.map +1 -0
  150. package/dist/modules/repl/repl.module.js +66 -0
  151. package/dist/modules/repl/repl.module.js.map +1 -0
  152. package/dist/modules/repl/services/commands/agent-commands.service.js +196 -0
  153. package/dist/modules/repl/services/commands/agent-commands.service.js.map +1 -0
  154. package/dist/modules/repl/services/commands/git-commands.service.js +500 -0
  155. package/dist/modules/repl/services/commands/git-commands.service.js.map +1 -0
  156. package/dist/modules/repl/services/commands/mcp-commands.service.js +579 -0
  157. package/dist/modules/repl/services/commands/mcp-commands.service.js.map +1 -0
  158. package/dist/modules/repl/services/commands/project-commands.service.js +226 -0
  159. package/dist/modules/repl/services/commands/project-commands.service.js.map +1 -0
  160. package/dist/modules/repl/services/commands/repl-commands.service.js +254 -0
  161. package/dist/modules/repl/services/commands/repl-commands.service.js.map +1 -0
  162. package/dist/modules/repl/services/repl.service.js +647 -0
  163. package/dist/modules/repl/services/repl.service.js.map +1 -0
  164. package/dist/modules/repl/services/smart-input.js +544 -0
  165. package/dist/modules/repl/services/smart-input.js.map +1 -0
  166. package/dist/modules/repl/services/welcome-screen.service.js +117 -0
  167. package/dist/modules/repl/services/welcome-screen.service.js.map +1 -0
  168. package/dist/modules/repl/utils/prompts-with-esc.js +187 -0
  169. package/dist/modules/repl/utils/prompts-with-esc.js.map +1 -0
  170. package/dist/modules/repl/utils/theme.js +185 -0
  171. package/dist/modules/repl/utils/theme.js.map +1 -0
  172. package/dist/modules/skills/definitions/general/file-operations.md +60 -0
  173. package/dist/modules/skills/definitions/general/git-operations.md +59 -0
  174. package/dist/modules/skills/definitions/general/planning.md +86 -0
  175. package/dist/modules/skills/definitions/general/search.md +59 -0
  176. package/dist/modules/skills/definitions/specialized/api-design.md +85 -0
  177. package/dist/modules/skills/definitions/specialized/database-operations.md +78 -0
  178. package/dist/modules/skills/definitions/specialized/frontend-bootstrap.md +71 -0
  179. package/dist/modules/skills/definitions/specialized/react-patterns.md +77 -0
  180. package/dist/modules/skills/definitions/specialized/testing-strategies.md +79 -0
  181. package/dist/modules/skills/index.js +23 -0
  182. package/dist/modules/skills/index.js.map +1 -0
  183. package/dist/modules/skills/services/skill-loader.service.js +130 -0
  184. package/dist/modules/skills/services/skill-loader.service.js.map +1 -0
  185. package/dist/modules/skills/services/skill-registry.service.js +96 -0
  186. package/dist/modules/skills/services/skill-registry.service.js.map +1 -0
  187. package/dist/modules/skills/skills.module.js +38 -0
  188. package/dist/modules/skills/skills.module.js.map +1 -0
  189. package/dist/modules/skills/types/index.js +20 -0
  190. package/dist/modules/skills/types/index.js.map +1 -0
  191. package/dist/modules/skills/types/skill.types.js +6 -0
  192. package/dist/modules/skills/types/skill.types.js.map +1 -0
  193. package/dist/modules/tasks/index.js +24 -0
  194. package/dist/modules/tasks/index.js.map +1 -0
  195. package/dist/modules/tasks/services/plan-executor.service.js +199 -0
  196. package/dist/modules/tasks/services/plan-executor.service.js.map +1 -0
  197. package/dist/modules/tasks/services/plan-mode.service.js +118 -0
  198. package/dist/modules/tasks/services/plan-mode.service.js.map +1 -0
  199. package/dist/modules/tasks/services/plan-persistence.service.js +148 -0
  200. package/dist/modules/tasks/services/plan-persistence.service.js.map +1 -0
  201. package/dist/modules/tasks/services/task-management.service.js +255 -0
  202. package/dist/modules/tasks/services/task-management.service.js.map +1 -0
  203. package/dist/modules/tasks/services/task-tools.service.js +270 -0
  204. package/dist/modules/tasks/services/task-tools.service.js.map +1 -0
  205. package/dist/modules/tasks/tasks.module.js +49 -0
  206. package/dist/modules/tasks/tasks.module.js.map +1 -0
  207. package/dist/modules/tasks/types/task.types.js +21 -0
  208. package/dist/modules/tasks/types/task.types.js.map +1 -0
  209. package/dist/modules/tools/index.js +24 -0
  210. package/dist/modules/tools/index.js.map +1 -0
  211. package/dist/modules/tools/services/filesystem-tools.service.js +450 -0
  212. package/dist/modules/tools/services/filesystem-tools.service.js.map +1 -0
  213. package/dist/modules/tools/services/search-tools.service.js +63 -0
  214. package/dist/modules/tools/services/search-tools.service.js.map +1 -0
  215. package/dist/modules/tools/services/shell-tools.service.js +194 -0
  216. package/dist/modules/tools/services/shell-tools.service.js.map +1 -0
  217. package/dist/modules/tools/services/tools-registry.service.js +83 -0
  218. package/dist/modules/tools/services/tools-registry.service.js.map +1 -0
  219. package/dist/modules/tools/tools.module.js +46 -0
  220. package/dist/modules/tools/tools.module.js.map +1 -0
  221. package/package.json +74 -0
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "PlanModeService", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return PlanModeService;
9
+ }
10
+ });
11
+ const _common = require("@nestjs/common");
12
+ const _taskmanagementservice = require("./task-management.service");
13
+ const _planexecutorservice = require("./plan-executor.service");
14
+ const _promptservice = require("../../permissions/services/prompt.service");
15
+ function _ts_decorate(decorators, target, key, desc) {
16
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
18
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
19
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
20
+ }
21
+ function _ts_metadata(k, v) {
22
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
23
+ }
24
+ function _ts_param(paramIndex, decorator) {
25
+ return function(target, key) {
26
+ decorator(target, key, paramIndex);
27
+ };
28
+ }
29
+ let PlanModeService = class PlanModeService {
30
+ async enterPlanMode(title, description) {
31
+ if (this.inPlanMode) {
32
+ throw new Error('Already in plan mode');
33
+ }
34
+ this.inPlanMode = true;
35
+ this.planContext.clear();
36
+ console.log('');
37
+ console.log('━'.repeat(60));
38
+ this.promptService.info('📋 Entering PLAN MODE');
39
+ console.log('━'.repeat(60));
40
+ console.log('');
41
+ console.log(`Planning: ${title}`);
42
+ console.log(description);
43
+ console.log('');
44
+ this.promptService.info('I will ask you some questions and create an execution plan.');
45
+ console.log('');
46
+ }
47
+ async exitPlanMode(tasks) {
48
+ if (!this.inPlanMode) {
49
+ throw new Error('Not in plan mode');
50
+ }
51
+ console.log('');
52
+ console.log('━'.repeat(60));
53
+ this.promptService.info('📋 Saindo do MODO PLANEJAMENTO - Apresentando Plano');
54
+ console.log('━'.repeat(60));
55
+ console.log('');
56
+ const planTitle = this.planContext.get('title') || 'Plano de Execução';
57
+ const planDescription = this.planContext.get('description') || '';
58
+ const plan = this.taskService.createPlan(planTitle, planDescription, tasks);
59
+ this.currentPlan = plan;
60
+ const result = await this.taskService.approvePlan(plan.id);
61
+ if (result.approved) {
62
+ // Configurar contexto de execução
63
+ this.taskService.setExecutionContext({
64
+ planId: plan.id,
65
+ autoApprove: result.autoApprove,
66
+ currentTaskIndex: 0,
67
+ startedAt: Date.now()
68
+ });
69
+ // Executar plano usando PlanExecutorService
70
+ await this.planExecutor.executePlan(plan.id, result.autoApprove);
71
+ }
72
+ this.inPlanMode = false;
73
+ return {
74
+ approved: result.approved,
75
+ autoApprove: result.autoApprove,
76
+ modification: result.modificationRequested
77
+ };
78
+ }
79
+ isInPlanMode() {
80
+ return this.inPlanMode;
81
+ }
82
+ setPlanContext(key, value) {
83
+ this.planContext.set(key, value);
84
+ }
85
+ getPlanContext(key) {
86
+ return this.planContext.get(key);
87
+ }
88
+ cancelPlanMode() {
89
+ if (!this.inPlanMode) return;
90
+ this.promptService.warn('Plan mode cancelled');
91
+ this.inPlanMode = false;
92
+ this.currentPlan = null;
93
+ this.planContext.clear();
94
+ }
95
+ getCurrentPlan() {
96
+ return this.currentPlan;
97
+ }
98
+ constructor(taskService, planExecutor, promptService){
99
+ this.taskService = taskService;
100
+ this.planExecutor = planExecutor;
101
+ this.promptService = promptService;
102
+ this.inPlanMode = false;
103
+ this.currentPlan = null;
104
+ this.planContext = new Map();
105
+ }
106
+ };
107
+ PlanModeService = _ts_decorate([
108
+ (0, _common.Injectable)(),
109
+ _ts_param(1, (0, _common.Inject)((0, _common.forwardRef)(()=>_planexecutorservice.PlanExecutorService))),
110
+ _ts_metadata("design:type", Function),
111
+ _ts_metadata("design:paramtypes", [
112
+ typeof _taskmanagementservice.TaskManagementService === "undefined" ? Object : _taskmanagementservice.TaskManagementService,
113
+ typeof _planexecutorservice.PlanExecutorService === "undefined" ? Object : _planexecutorservice.PlanExecutorService,
114
+ typeof _promptservice.PromptService === "undefined" ? Object : _promptservice.PromptService
115
+ ])
116
+ ], PlanModeService);
117
+
118
+ //# sourceMappingURL=plan-mode.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/tasks/services/plan-mode.service.ts"],"sourcesContent":["import { Injectable, forwardRef, Inject } from '@nestjs/common';\nimport { TaskManagementService } from './task-management.service';\nimport { PlanExecutorService } from './plan-executor.service';\nimport { PromptService } from '../../permissions/services/prompt.service';\nimport { CreateTaskOptions, TaskPlan } from '../types/task.types';\n\n@Injectable()\nexport class PlanModeService {\n private inPlanMode = false;\n private currentPlan: TaskPlan | null = null;\n private planContext: Map<string, any> = new Map();\n\n constructor(\n private taskService: TaskManagementService,\n @Inject(forwardRef(() => PlanExecutorService))\n private planExecutor: PlanExecutorService,\n private promptService: PromptService,\n ) {}\n\n async enterPlanMode(title: string, description: string): Promise<void> {\n if (this.inPlanMode) {\n throw new Error('Already in plan mode');\n }\n\n this.inPlanMode = true;\n this.planContext.clear();\n\n console.log('');\n console.log('━'.repeat(60));\n this.promptService.info('📋 Entering PLAN MODE');\n console.log('━'.repeat(60));\n console.log('');\n console.log(`Planning: ${title}`);\n console.log(description);\n console.log('');\n this.promptService.info('I will ask you some questions and create an execution plan.');\n console.log('');\n }\n\n async exitPlanMode(tasks: CreateTaskOptions[]): Promise<{ approved: boolean; autoApprove: boolean; modification?: string }> {\n if (!this.inPlanMode) {\n throw new Error('Not in plan mode');\n }\n\n console.log('');\n console.log('━'.repeat(60));\n this.promptService.info('📋 Saindo do MODO PLANEJAMENTO - Apresentando Plano');\n console.log('━'.repeat(60));\n console.log('');\n\n const planTitle = this.planContext.get('title') || 'Plano de Execução';\n const planDescription = this.planContext.get('description') || '';\n\n const plan = this.taskService.createPlan(planTitle, planDescription, tasks);\n this.currentPlan = plan;\n\n const result = await this.taskService.approvePlan(plan.id);\n\n if (result.approved) {\n // Configurar contexto de execução\n this.taskService.setExecutionContext({\n planId: plan.id,\n autoApprove: result.autoApprove,\n currentTaskIndex: 0,\n startedAt: Date.now(),\n });\n\n // Executar plano usando PlanExecutorService\n await this.planExecutor.executePlan(plan.id, result.autoApprove);\n }\n\n this.inPlanMode = false;\n\n return {\n approved: result.approved,\n autoApprove: result.autoApprove,\n modification: result.modificationRequested,\n };\n }\n\n isInPlanMode(): boolean {\n return this.inPlanMode;\n }\n\n setPlanContext(key: string, value: any): void {\n this.planContext.set(key, value);\n }\n\n getPlanContext(key: string): any {\n return this.planContext.get(key);\n }\n\n cancelPlanMode(): void {\n if (!this.inPlanMode) return;\n\n this.promptService.warn('Plan mode cancelled');\n this.inPlanMode = false;\n this.currentPlan = null;\n this.planContext.clear();\n }\n\n getCurrentPlan(): TaskPlan | null {\n return this.currentPlan;\n }\n}\n"],"names":["PlanModeService","enterPlanMode","title","description","inPlanMode","Error","planContext","clear","console","log","repeat","promptService","info","exitPlanMode","tasks","planTitle","get","planDescription","plan","taskService","createPlan","currentPlan","result","approvePlan","id","approved","setExecutionContext","planId","autoApprove","currentTaskIndex","startedAt","Date","now","planExecutor","executePlan","modification","modificationRequested","isInPlanMode","setPlanContext","key","value","set","getPlanContext","cancelPlanMode","warn","getCurrentPlan","Map","PlanExecutorService"],"mappings":";;;;+BAOaA;;;eAAAA;;;wBAPkC;uCACT;qCACF;+BACN;;;;;;;;;;;;;;;AAIvB,IAAA,AAAMA,kBAAN,MAAMA;IAYX,MAAMC,cAAcC,KAA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QT,KAAKM,EAAE;gBACfI,aAAaN,OAAOM,WAAW;gBAC/BC,kBAAkB;gBAClBC,WAAWC,KAAKC,GAAG;YACrB;YAEA,4CAA4C;YAC5C,MAAM,IAAI,CAACC,YAAY,CAACC,WAAW,CAAChB,KAAKM,EAAE,EAAEF,OAAOM,WAAW;QACjE;QAEA,IAAI,CAACxB,UAAU,GAAG;QAElB,OAAO;YACLqB,UAAUH,OAAOG,QAAQ;YACzBG,aAAaN,OAAOM,WAAW;YAC/BO,cAAcb,OAAOc,qBAAqB;QAC5C;IACF;IAEAC,eAAwB;QACtB,OAAO,IAAI,CAACjC,UAAU;IACxB;IAEAkC,eAAeC,GAAW,EAAEC,KAAU,EAAQ;QAC5C,IAAI,CAAClC,WAAW,CAACmC,GAAG,CAACF,KAAKC;IAC5B;IAEAE,eAAeH,GAAW,EAAO;QAC/B,OAAO,IAAI,CAACjC,WAAW,CAACU,GAAG,CAACuB;IAC9B;IAEAI,iBAAuB;QACrB,IAAI,CAAC,IAAI,CAACvC,UAAU,EAAE;QAEtB,IAAI,CAACO,aAAa,CAACiC,IAAI,CAAC;QACxB,IAAI,CAACxC,UAAU,GAAG;QAClB,IAAI,CAACiB,WAAW,GAAG;QACnB,IAAI,CAACf,WAAW,CAACC,KAAK;IACxB;IAEAsC,iBAAkC;QAChC,OAAO,IAAI,CAACxB,WAAW;IACzB;IA3FA,YACE,AAAQF,WAAkC,EAC1C,AACQc,YAAiC,EACzC,AAAQtB,aAA4B,CACpC;aAJQQ,cAAAA;aAEAc,eAAAA;aACAtB,gBAAAA;aARFP,aAAa;aACbiB,cAA+B;aAC/Bf,cAAgC,IAAIwC;IAOzC;AAuFL;;;iEA1F6BC,wCAAmB"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "PlanPersistenceService", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return PlanPersistenceService;
9
+ }
10
+ });
11
+ const _common = require("@nestjs/common");
12
+ const _fs = /*#__PURE__*/ _interop_require_wildcard(require("fs"));
13
+ const _path = /*#__PURE__*/ _interop_require_wildcard(require("path"));
14
+ function _getRequireWildcardCache(nodeInterop) {
15
+ if (typeof WeakMap !== "function") return null;
16
+ var cacheBabelInterop = new WeakMap();
17
+ var cacheNodeInterop = new WeakMap();
18
+ return (_getRequireWildcardCache = function(nodeInterop) {
19
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
20
+ })(nodeInterop);
21
+ }
22
+ function _interop_require_wildcard(obj, nodeInterop) {
23
+ if (!nodeInterop && obj && obj.__esModule) {
24
+ return obj;
25
+ }
26
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
27
+ return {
28
+ default: obj
29
+ };
30
+ }
31
+ var cache = _getRequireWildcardCache(nodeInterop);
32
+ if (cache && cache.has(obj)) {
33
+ return cache.get(obj);
34
+ }
35
+ var newObj = {
36
+ __proto__: null
37
+ };
38
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
39
+ for(var key in obj){
40
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
41
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
42
+ if (desc && (desc.get || desc.set)) {
43
+ Object.defineProperty(newObj, key, desc);
44
+ } else {
45
+ newObj[key] = obj[key];
46
+ }
47
+ }
48
+ }
49
+ newObj.default = obj;
50
+ if (cache) {
51
+ cache.set(obj, newObj);
52
+ }
53
+ return newObj;
54
+ }
55
+ function _ts_decorate(decorators, target, key, desc) {
56
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
57
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
58
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
59
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
60
+ }
61
+ function _ts_metadata(k, v) {
62
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
63
+ }
64
+ let PlanPersistenceService = class PlanPersistenceService {
65
+ ensurePlansDir() {
66
+ if (!_fs.existsSync(this.plansDir)) {
67
+ _fs.mkdirSync(this.plansDir, {
68
+ recursive: true
69
+ });
70
+ }
71
+ }
72
+ generateFilename(plan) {
73
+ const date = new Date(plan.createdAt);
74
+ const timestamp = date.toISOString().replace(/[:.]/g, '-').slice(0, 19);
75
+ const safeName = plan.title.toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 50);
76
+ return `${timestamp}-${safeName}.md`;
77
+ }
78
+ async savePlan(plan, autoApprove) {
79
+ const filename = this.generateFilename(plan);
80
+ const filepath = _path.join(this.plansDir, filename);
81
+ const content = this.formatPlanAsMarkdown(plan, autoApprove);
82
+ _fs.writeFileSync(filepath, content, 'utf-8');
83
+ return filepath;
84
+ }
85
+ async updatePlanProgress(filepath, progress) {
86
+ let content = _fs.readFileSync(filepath, 'utf-8');
87
+ // Atualizar seção de progresso
88
+ const progressSection = `## Progresso\n\nTarefa atual: ${progress.currentTask}\nTarefas completadas: ${progress.completedTasks}\nStatus: ${progress.status}\n`;
89
+ if (content.includes('## Progresso')) {
90
+ content = content.replace(/## Progresso[\s\S]*?(?=\n##|$)/, progressSection);
91
+ } else {
92
+ content += '\n' + progressSection;
93
+ }
94
+ _fs.writeFileSync(filepath, content, 'utf-8');
95
+ }
96
+ async markPlanCompleted(filepath, result) {
97
+ let content = _fs.readFileSync(filepath, 'utf-8');
98
+ const resultSection = `\n## Resultado\n\n${result.success ? '✓' : '✗'} ${result.success ? 'Concluído com sucesso' : 'Concluído com erros'}\nDuração: ${(result.duration / 1000).toFixed(1)}s\n${result.errors ? `\nErros:\n${result.errors.map((e)=>`- ${e}`).join('\n')}` : ''}\n`;
99
+ content += resultSection;
100
+ _fs.writeFileSync(filepath, content, 'utf-8');
101
+ }
102
+ formatPlanAsMarkdown(plan, autoApprove) {
103
+ const lines = [];
104
+ lines.push('---');
105
+ lines.push(`id: ${plan.id}`);
106
+ lines.push(`title: "${plan.title}"`);
107
+ lines.push(`status: ${plan.status}`);
108
+ lines.push(`created: ${new Date(plan.createdAt).toISOString()}`);
109
+ lines.push(`auto_approve: ${autoApprove}`);
110
+ lines.push('---');
111
+ lines.push('');
112
+ lines.push(`# ${plan.title}`);
113
+ lines.push('');
114
+ lines.push('## Descrição');
115
+ lines.push('');
116
+ lines.push(plan.description);
117
+ lines.push('');
118
+ lines.push('## Tarefas');
119
+ lines.push('');
120
+ plan.tasks.forEach((task, index)=>{
121
+ lines.push(`### ${index + 1}. ${task.subject}`);
122
+ lines.push('');
123
+ lines.push(`**Status:** ${task.status}`);
124
+ if (task.dependencies.length > 0) {
125
+ lines.push(`**Dependências:** ${task.dependencies.join(', ')}`);
126
+ }
127
+ lines.push('');
128
+ lines.push(task.description);
129
+ lines.push('');
130
+ });
131
+ lines.push('## Progresso');
132
+ lines.push('');
133
+ lines.push('_O progresso será atualizado durante a execução_');
134
+ lines.push('');
135
+ return lines.join('\n');
136
+ }
137
+ constructor(){
138
+ this.plansDir = _path.join(process.cwd(), '.cast', 'plans');
139
+ this.ensurePlansDir();
140
+ }
141
+ };
142
+ PlanPersistenceService = _ts_decorate([
143
+ (0, _common.Injectable)(),
144
+ _ts_metadata("design:type", Function),
145
+ _ts_metadata("design:paramtypes", [])
146
+ ], PlanPersistenceService);
147
+
148
+ //# sourceMappingURL=plan-persistence.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/tasks/services/plan-persistence.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { TaskPlan, Task } from '../types/task.types';\n\n@Injectable()\nexport class PlanPersistenceService {\n private plansDir: string;\n\n constructor() {\n this.plansDir = path.join(process.cwd(), '.cast', 'plans');\n this.ensurePlansDir();\n }\n\n private ensurePlansDir(): void {\n if (!fs.existsSync(this.plansDir)) {\n fs.mkdirSync(this.plansDir, { recursive: true });\n }\n }\n\n generateFilename(plan: TaskPlan): string {\n const date = new Date(plan.createdAt);\n const timestamp = date.toISOString().replace(/[:.]/g, '-').slice(0, 19);\n const safeName = plan.title\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .slice(0, 50);\n return `${timestamp}-${safeName}.md`;\n }\n\n async savePlan(plan: TaskPlan, autoApprove: boolean): Promise<string> {\n const filename = this.generateFilename(plan);\n const filepath = path.join(this.plansDir, filename);\n\n const content = this.formatPlanAsMarkdown(plan, autoApprove);\n\n fs.writeFileSync(filepath, content, 'utf-8');\n\n return filepath;\n }\n\n async updatePlanProgress(filepath: string, progress: {\n currentTask: number;\n completedTasks: number;\n status: string;\n }): Promise<void> {\n let content = fs.readFileSync(filepath, 'utf-8');\n\n // Atualizar seção de progresso\n const progressSection = `## Progresso\\n\\nTarefa atual: ${progress.currentTask}\\nTarefas completadas: ${progress.completedTasks}\\nStatus: ${progress.status}\\n`;\n\n if (content.includes('## Progresso')) {\n content = content.replace(/## Progresso[\\s\\S]*?(?=\\n##|$)/, progressSection);\n } else {\n content += '\\n' + progressSection;\n }\n\n fs.writeFileSync(filepath, content, 'utf-8');\n }\n\n async markPlanCompleted(filepath: string, result: {\n success: boolean;\n duration: number;\n errors?: string[];\n }): Promise<void> {\n let content = fs.readFileSync(filepath, 'utf-8');\n\n const resultSection = `\\n## Resultado\\n\\n${result.success ? '✓' : '✗'} ${result.success ? 'Concluído com sucesso' : 'Concluído com erros'}\\nDuração: ${(result.duration / 1000).toFixed(1)}s\\n${result.errors ? `\\nErros:\\n${result.errors.map(e => `- ${e}`).join('\\n')}` : ''}\\n`;\n\n content += resultSection;\n\n fs.writeFileSync(filepath, content, 'utf-8');\n }\n\n private formatPlanAsMarkdown(plan: TaskPlan, autoApprove: boolean): string {\n const lines: string[] = [];\n\n lines.push('---');\n lines.push(`id: ${plan.id}`);\n lines.push(`title: \"${plan.title}\"`);\n lines.push(`status: ${plan.status}`);\n lines.push(`created: ${new Date(plan.createdAt).toISOString()}`);\n lines.push(`auto_approve: ${autoApprove}`);\n lines.push('---');\n lines.push('');\n lines.push(`# ${plan.title}`);\n lines.push('');\n lines.push('## Descrição');\n lines.push('');\n lines.push(plan.description);\n lines.push('');\n lines.push('## Tarefas');\n lines.push('');\n\n plan.tasks.forEach((task, index) => {\n lines.push(`### ${index + 1}. ${task.subject}`);\n lines.push('');\n lines.push(`**Status:** ${task.status}`);\n\n if (task.dependencies.length > 0) {\n lines.push(`**Dependências:** ${task.dependencies.join(', ')}`);\n }\n\n lines.push('');\n lines.push(task.description);\n lines.push('');\n });\n\n lines.push('## Progresso');\n lines.push('');\n lines.push('_O progresso será atualizado durante a execução_');\n lines.push('');\n\n return lines.join('\\n');\n }\n}\n"],"names":["PlanPersistenceService","ensurePlansDir","fs","existsSync","plansDir","mkdirSync","recursive","generateFilename","plan","date","Date","createdAt","timestamp","toISOString","replace","slice","safeName","title","toLowerCase","savePlan","autoApprove","filename","filepath","path","join","content","formatPlanAsMarkdown","writeFileSync","updatePlanProgress","progress","readFileSync","progressSection","currentTask","completedTasks","status","includes","markPlanCompleted","result","resultSection","success","duration","toFixed","errors","map","e","lines","push","id","description","tasks","forEach","task","index","subject","dependencies","length","process","cwd"],"mappings":";;;;+BAMaA;;;eAAAA;;;wBANc;4DACP;8DACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIf,IAAA,AAAMA,yBAAN,MAAMA;IAQHC,iBAAuB;QAC7B,IAAI,CAACC,IAAGC,UAAU,CAAC,IAAI,CAACC,QAAQ,GAAG;YACjCF,IAAGG,SAAS,CAAC,IAAI,CAACD,QAAQ,EAAE;gBAAEE,WAAW;YAAK;QAChD;IACF;IAEAC,iBAAiBC,IAAc,EAAU;QACvC,MAAMC,OAAO,IAAIC,KAAKF,KAAKG,SAAS;QACp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AC,CAAC,YAAY,EAAEK,KAAKjB,MAAM,EAAE;YAEvC,IAAIiB,KAAKG,YAAY,CAACC,MAAM,GAAG,GAAG;gBAChCV,MAAMC,IAAI,CAAC,CAAC,kBAAkB,EAAEK,KAAKG,YAAY,CAAC9B,IAAI,CAAC,OAAO;YAChE;YAEAqB,MAAMC,IAAI,CAAC;YACXD,MAAMC,IAAI,CAACK,KAAKH,WAAW;YAC3BH,MAAMC,IAAI,CAAC;QACb;QAEAD,MAAMC,IAAI,CAAC;QACXD,MAAMC,IAAI,CAAC;QACXD,MAAMC,IAAI,CAAC;QACXD,MAAMC,IAAI,CAAC;QAEX,OAAOD,MAAMrB,IAAI,CAAC;IACpB;IAzGA,aAAc;QACZ,IAAI,CAACpB,QAAQ,GAAGmB,MAAKC,IAAI,CAACgC,QAAQC,GAAG,IAAI,SAAS;QAClD,IAAI,CAACxD,cAAc;IACrB;AAuGF"}
@@ -0,0 +1,255 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "TaskManagementService", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return TaskManagementService;
9
+ }
10
+ });
11
+ const _common = require("@nestjs/common");
12
+ const _tasktypes = require("../types/task.types");
13
+ const _promptservice = require("../../permissions/services/prompt.service");
14
+ const _theme = require("../../repl/utils/theme");
15
+ function _ts_decorate(decorators, target, key, desc) {
16
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
18
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
19
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
20
+ }
21
+ function _ts_metadata(k, v) {
22
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
23
+ }
24
+ let TaskManagementService = class TaskManagementService {
25
+ createTask(options) {
26
+ const id = `task-${++this.taskCounter}`;
27
+ const task = {
28
+ id,
29
+ subject: options.subject,
30
+ description: options.description,
31
+ activeForm: options.activeForm || this.generateActiveForm(options.subject),
32
+ status: _tasktypes.TaskStatus.PENDING,
33
+ createdAt: Date.now(),
34
+ updatedAt: Date.now(),
35
+ dependencies: options.dependencies || [],
36
+ blocks: [],
37
+ metadata: options.metadata || {}
38
+ };
39
+ this.tasks.set(id, task);
40
+ for (const depId of task.dependencies){
41
+ const dep = this.tasks.get(depId);
42
+ if (dep) {
43
+ dep.blocks.push(id);
44
+ }
45
+ }
46
+ return task;
47
+ }
48
+ updateTask(taskId, options) {
49
+ const task = this.tasks.get(taskId);
50
+ if (!task) return null;
51
+ if (options.status) task.status = options.status;
52
+ if (options.subject) task.subject = options.subject;
53
+ if (options.description) task.description = options.description;
54
+ if (options.activeForm) task.activeForm = options.activeForm;
55
+ if (options.addDependencies) {
56
+ task.dependencies.push(...options.addDependencies);
57
+ }
58
+ if (options.removeDependencies) {
59
+ task.dependencies = task.dependencies.filter((id)=>!options.removeDependencies?.includes(id));
60
+ }
61
+ if (options.metadata) {
62
+ task.metadata = {
63
+ ...task.metadata,
64
+ ...options.metadata
65
+ };
66
+ }
67
+ task.updatedAt = Date.now();
68
+ return task;
69
+ }
70
+ getTask(taskId) {
71
+ return this.tasks.get(taskId) || null;
72
+ }
73
+ listTasks() {
74
+ return Array.from(this.tasks.values());
75
+ }
76
+ listPendingTasks() {
77
+ return this.listTasks().filter((task)=>{
78
+ if (task.status !== _tasktypes.TaskStatus.PENDING) return false;
79
+ return task.dependencies.every((depId)=>{
80
+ const dep = this.tasks.get(depId);
81
+ return dep && dep.status === _tasktypes.TaskStatus.COMPLETED;
82
+ });
83
+ });
84
+ }
85
+ createPlan(title, description, tasks) {
86
+ const id = `plan-${++this.planCounter}`;
87
+ const createdTasks = tasks.map((taskOpt)=>this.createTask(taskOpt));
88
+ const plan = {
89
+ id,
90
+ title,
91
+ description,
92
+ tasks: createdTasks,
93
+ status: 'draft',
94
+ createdAt: Date.now()
95
+ };
96
+ this.plans.set(id, plan);
97
+ return plan;
98
+ }
99
+ async approvePlan(planId) {
100
+ const plan = this.plans.get(planId);
101
+ if (!plan) {
102
+ this.promptService.error('Plan not found');
103
+ return {
104
+ approved: false,
105
+ autoApprove: false
106
+ };
107
+ }
108
+ // Renderizar plano
109
+ console.log('\n' + '='.repeat(60));
110
+ this.promptService.info(`📋 PLANO: ${plan.title}`);
111
+ console.log('='.repeat(60));
112
+ console.log('');
113
+ console.log(plan.description);
114
+ console.log('');
115
+ console.log(`${_theme.Colors.bold}Tarefas (${plan.tasks.length}):${_theme.Colors.reset}`);
116
+ console.log('');
117
+ plan.tasks.forEach((task, index)=>{
118
+ const depInfo = task.dependencies.length > 0 ? ` ${_theme.Colors.muted}(depende de: ${task.dependencies.join(', ')})${_theme.Colors.reset}` : '';
119
+ console.log(` ${_theme.Colors.primary}${index + 1}.${_theme.Colors.reset} ${_theme.Colors.bold}${task.subject}${_theme.Colors.reset}${depInfo}`);
120
+ console.log(` ${_theme.Colors.dim}${task.description}${_theme.Colors.reset}`);
121
+ console.log('');
122
+ });
123
+ console.log('='.repeat(60));
124
+ console.log('');
125
+ // Opções aprimoradas
126
+ const choices = [
127
+ {
128
+ key: 'approve',
129
+ label: '1 - Sim',
130
+ description: 'Executar o plano'
131
+ },
132
+ {
133
+ key: 'auto-approve',
134
+ label: '2 - Sim com auto-approve',
135
+ description: 'Executar sem pedir aprovação em cada etapa'
136
+ },
137
+ {
138
+ key: 'modify',
139
+ label: '4 - Digite algo',
140
+ description: 'Modificar o plano antes de executar'
141
+ },
142
+ {
143
+ key: 'cancel',
144
+ label: '3 - Não',
145
+ description: 'Cancelar e não executar'
146
+ }
147
+ ];
148
+ const choice = await this.promptService.choice('O que você deseja fazer?', choices);
149
+ switch(choice){
150
+ case 'approve':
151
+ plan.status = 'approved';
152
+ this.promptService.success('✓ Plano aprovado! Iniciando execução...');
153
+ return {
154
+ approved: true,
155
+ autoApprove: false
156
+ };
157
+ case 'auto-approve':
158
+ plan.status = 'approved';
159
+ this.promptService.success('✓ Plano aprovado com auto-approve! Execução automática ativada.');
160
+ return {
161
+ approved: true,
162
+ autoApprove: true
163
+ };
164
+ case 'modify':
165
+ const modification = await this.promptService.question(`${_theme.Colors.accent}Como deseja modificar o plano?${_theme.Colors.reset}`);
166
+ plan.status = 'draft';
167
+ return {
168
+ approved: false,
169
+ autoApprove: false,
170
+ modificationRequested: modification
171
+ };
172
+ case 'cancel':
173
+ plan.status = 'cancelled';
174
+ this.promptService.info('Plano cancelado');
175
+ return {
176
+ approved: false,
177
+ autoApprove: false
178
+ };
179
+ default:
180
+ return {
181
+ approved: false,
182
+ autoApprove: false
183
+ };
184
+ }
185
+ }
186
+ async executePlan(planId) {
187
+ const plan = this.plans.get(planId);
188
+ if (!plan) {
189
+ throw new Error('Plan not found');
190
+ }
191
+ if (plan.status !== 'approved') {
192
+ throw new Error('Plan must be approved before execution');
193
+ }
194
+ plan.status = 'executing';
195
+ this.promptService.info('Starting plan execution...');
196
+ }
197
+ generateActiveForm(subject) {
198
+ const firstWord = subject.split(' ')[0].toLowerCase();
199
+ const rest = subject.slice(firstWord.length);
200
+ const gerundMap = {
201
+ create: 'Creating',
202
+ add: 'Adding',
203
+ implement: 'Implementing',
204
+ fix: 'Fixing',
205
+ update: 'Updating',
206
+ remove: 'Removing',
207
+ delete: 'Deleting',
208
+ refactor: 'Refactoring',
209
+ test: 'Testing',
210
+ write: 'Writing',
211
+ read: 'Reading'
212
+ };
213
+ const gerund = gerundMap[firstWord] || subject + 'ing';
214
+ return gerund + rest;
215
+ }
216
+ clearCompletedTasks() {
217
+ for (const [id, task] of this.tasks.entries()){
218
+ if (task.status === _tasktypes.TaskStatus.COMPLETED || task.status === _tasktypes.TaskStatus.CANCELLED) {
219
+ this.tasks.delete(id);
220
+ }
221
+ }
222
+ }
223
+ setExecutionContext(context) {
224
+ this.executionContext = context;
225
+ }
226
+ getExecutionContext() {
227
+ return this.executionContext;
228
+ }
229
+ clearExecutionContext() {
230
+ this.executionContext = null;
231
+ }
232
+ isAutoApproveActive() {
233
+ return this.executionContext?.autoApprove ?? false;
234
+ }
235
+ getPlans() {
236
+ return this.plans;
237
+ }
238
+ constructor(promptService){
239
+ this.promptService = promptService;
240
+ this.tasks = new Map();
241
+ this.plans = new Map();
242
+ this.taskCounter = 0;
243
+ this.planCounter = 0;
244
+ this.executionContext = null;
245
+ }
246
+ };
247
+ TaskManagementService = _ts_decorate([
248
+ (0, _common.Injectable)(),
249
+ _ts_metadata("design:type", Function),
250
+ _ts_metadata("design:paramtypes", [
251
+ typeof _promptservice.PromptService === "undefined" ? Object : _promptservice.PromptService
252
+ ])
253
+ ], TaskManagementService);
254
+
255
+ //# sourceMappingURL=task-management.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/tasks/services/task-management.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport {\n Task,\n TaskStatus,\n TaskPlan,\n CreateTaskOptions,\n UpdateTaskOptions,\n PlanApprovalOptions,\n PlanExecutionContext,\n} from '../types/task.types';\nimport { PromptService } from '../../permissions/services/prompt.service';\nimport { Colors } from '../../repl/utils/theme';\n\n\n@Injectable()\nexport class TaskManagementService {\n private tasks: Map<string, Task> = new Map();\n private plans: Map<string, TaskPlan> = new Map();\n private taskCounter = 0;\n private planCounter = 0;\n private executionContext: PlanExecutionContext | null = null;\n\n constructor(private promptService: PromptService) {}\n\n createTask(options: CreateTaskOptions): Task {\n const id = `task-${++this.taskCounter}`;\n\n const task: Task = {\n id,\n subject: options.subject,\n description: options.description,\n activeForm: options.activeForm || this.generateActiveForm(options.subject),\n status: TaskStatus.PENDING,\n createdAt: Date.now(),\n updatedAt: Date.now(),\n dependencies: options.dependencies || [],\n blocks: [],\n metadata: options.metadata || {},\n };\n\n this.tasks.set(id, task);\n\n for (const depId of task.dependencies) {\n const dep = this.tasks.get(depId);\n if (dep) {\n dep.blocks.push(id);\n }\n }\n\n return task;\n }\n\n updateTask(taskId: string, options: UpdateTaskOptions): Task | null {\n const task = this.tasks.get(taskId);\n if (!task) return null;\n\n if (options.status) task.status = options.status;\n if (options.subject) task.subject = options.subject;\n if (options.description) task.description = options.description;\n if (options.activeForm) task.activeForm = options.activeForm;\n\n if (options.addDependencies) {\n task.dependencies.push(...options.addDependencies);\n }\n\n if (options.removeDependencies) {\n task.dependencies = task.dependencies.filter(\n (id) => !options.removeDependencies?.includes(id),\n );\n }\n\n if (options.metadata) {\n task.metadata = { ...task.metadata, ...options.metadata };\n }\n\n task.updatedAt = Date.now();\n return task;\n }\n\n getTask(taskId: string): Task | null {\n return this.tasks.get(taskId) || null;\n }\n\n listTasks(): Task[] {\n return Array.from(this.tasks.values());\n }\n\n listPendingTasks(): Task[] {\n return this.listTasks().filter((task) => {\n if (task.status !== TaskStatus.PENDING) return false;\n\n return task.dependencies.every((depId) => {\n const dep = this.tasks.get(depId);\n return dep && dep.status === TaskStatus.COMPLETED;\n });\n });\n }\n\n createPlan(title: string, description: string, tasks: CreateTaskOptions[]): TaskPlan {\n const id = `plan-${++this.planCounter}`;\n\n const createdTasks = tasks.map((taskOpt) => this.createTask(taskOpt));\n\n const plan: TaskPlan = {\n id,\n title,\n description,\n tasks: createdTasks,\n status: 'draft',\n createdAt: Date.now(),\n };\n\n this.plans.set(id, plan);\n return plan;\n }\n\n async approvePlan(planId: string): Promise<PlanApprovalOptions> {\n const plan = this.plans.get(planId);\n if (!plan) {\n this.promptService.error('Plan not found');\n return { approved: false, autoApprove: false };\n }\n\n // Renderizar plano\n console.log('\\n' + '='.repeat(60));\n this.promptService.info(`📋 PLANO: ${plan.title}`);\n console.log('='.repeat(60));\n console.log('');\n console.log(plan.description);\n console.log('');\n console.log(`${Colors.bold}Tarefas (${plan.tasks.length}):${Colors.reset}`);\n console.log('');\n\n plan.tasks.forEach((task, index) => {\n const depInfo =\n task.dependencies.length > 0\n ? ` ${Colors.muted}(depende de: ${task.dependencies.join(', ')})${Colors.reset}`\n : '';\n console.log(` ${Colors.primary}${index + 1}.${Colors.reset} ${Colors.bold}${task.subject}${Colors.reset}${depInfo}`);\n console.log(` ${Colors.dim}${task.description}${Colors.reset}`);\n console.log('');\n });\n\n console.log('='.repeat(60));\n console.log('');\n\n // Opções aprimoradas\n const choices = [\n {\n key: 'approve',\n label: '1 - Sim',\n description: 'Executar o plano'\n },\n {\n key: 'auto-approve',\n label: '2 - Sim com auto-approve',\n description: 'Executar sem pedir aprovação em cada etapa'\n },\n {\n key: 'modify',\n label: '4 - Digite algo',\n description: 'Modificar o plano antes de executar'\n },\n {\n key: 'cancel',\n label: '3 - Não',\n description: 'Cancelar e não executar'\n },\n ];\n\n const choice = await this.promptService.choice('O que você deseja fazer?', choices);\n\n switch (choice) {\n case 'approve':\n plan.status = 'approved';\n this.promptService.success('✓ Plano aprovado! Iniciando execução...');\n return { approved: true, autoApprove: false };\n\n case 'auto-approve':\n plan.status = 'approved';\n this.promptService.success('✓ Plano aprovado com auto-approve! Execução automática ativada.');\n return { approved: true, autoApprove: true };\n\n case 'modify':\n const modification = await this.promptService.question(\n `${Colors.accent}Como deseja modificar o plano?${Colors.reset}`\n );\n plan.status = 'draft';\n return {\n approved: false,\n autoApprove: false,\n modificationRequested: modification\n };\n\n case 'cancel':\n plan.status = 'cancelled';\n this.promptService.info('Plano cancelado');\n return { approved: false, autoApprove: false };\n\n default:\n return { approved: false, autoApprove: false };\n }\n }\n\n async executePlan(planId: string): Promise<void> {\n const plan = this.plans.get(planId);\n if (!plan) {\n throw new Error('Plan not found');\n }\n\n if (plan.status !== 'approved') {\n throw new Error('Plan must be approved before execution');\n }\n\n plan.status = 'executing';\n this.promptService.info('Starting plan execution...');\n }\n\n private generateActiveForm(subject: string): string {\n const firstWord = subject.split(' ')[0].toLowerCase();\n const rest = subject.slice(firstWord.length);\n\n const gerundMap: Record<string, string> = {\n create: 'Creating',\n add: 'Adding',\n implement: 'Implementing',\n fix: 'Fixing',\n update: 'Updating',\n remove: 'Removing',\n delete: 'Deleting',\n refactor: 'Refactoring',\n test: 'Testing',\n write: 'Writing',\n read: 'Reading',\n };\n\n const gerund = gerundMap[firstWord] || subject + 'ing';\n return gerund + rest;\n }\n\n clearCompletedTasks(): void {\n for (const [id, task] of this.tasks.entries()) {\n if (task.status === TaskStatus.COMPLETED || task.status === TaskStatus.CANCELLED) {\n this.tasks.delete(id);\n }\n }\n }\n\n setExecutionContext(context: PlanExecutionContext): void {\n this.executionContext = context;\n }\n\n getExecutionContext(): PlanExecutionContext | null {\n return this.executionContext;\n }\n\n clearExecutionContext(): void {\n this.executionContext = null;\n }\n\n isAutoApproveActive(): boolean {\n return this.executionContext?.autoApprove ?? false;\n }\n\n getPlans(): Map<string, TaskPlan> {\n return this.plans;\n }\n}\n"],"names":["TaskManagementService","createTask","options","id","taskCounter","task","subject","description","activeForm","generateActiveForm","status","TaskStatus","PENDING","createdAt","Date","now","updatedAt","dependencies","blocks","metadata","tasks","set","depId","dep","get","push","updateTask","taskId","addDependencies","removeDependencies","filter","includes","getTask","listTasks","Array","from","values","listPendingTasks","every","COMPLETED","createPlan","title","planCounter","createdTasks","map","taskOpt","plan","plans","approvePlan","planId","promptService","error","approved","autoApprove","console","log","repeat","info","Colors","bold","length","reset","forEach","index","depInfo","muted","join","primary","dim","choices","key","label","choice","success","modification","question","accent","modificationRequested","executePlan","Error","firstWord","split","toLowerCase","rest","slice","gerundMap","create","add","implement","fix","update","remove","delete","refactor","test","write","read","gerund","clearCompletedTasks","entries","CANCELLED","setExecutionContext","context","executionContext","getExecutionContext","clearExecutionContext","isAutoApproveActive","getPlans","Map"],"mappings":";;;;+BAeaA;;;eAAAA;;;wBAfc;2BASpB;+BACuB;uBACP;;;;;;;;;;AAIhB,IAAA,AAAMA,wBAAN,MAAMA;IASXC,WAAWC,OAA0B,EAAQ;QAC3C,MAAMC,KAAK,CAAC,KAAK,EAAE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