@litmers/cursorflow-orchestrator 0.1.18 → 0.1.26

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 (234) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +25 -7
  3. package/commands/cursorflow-clean.md +19 -0
  4. package/commands/cursorflow-runs.md +59 -0
  5. package/commands/cursorflow-stop.md +55 -0
  6. package/dist/cli/clean.js +178 -6
  7. package/dist/cli/clean.js.map +1 -1
  8. package/dist/cli/index.js +12 -1
  9. package/dist/cli/index.js.map +1 -1
  10. package/dist/cli/init.js +8 -7
  11. package/dist/cli/init.js.map +1 -1
  12. package/dist/cli/logs.js +126 -77
  13. package/dist/cli/logs.js.map +1 -1
  14. package/dist/cli/monitor.d.ts +7 -0
  15. package/dist/cli/monitor.js +1021 -202
  16. package/dist/cli/monitor.js.map +1 -1
  17. package/dist/cli/prepare.js +39 -21
  18. package/dist/cli/prepare.js.map +1 -1
  19. package/dist/cli/resume.js +268 -163
  20. package/dist/cli/resume.js.map +1 -1
  21. package/dist/cli/run.js +11 -5
  22. package/dist/cli/run.js.map +1 -1
  23. package/dist/cli/runs.d.ts +5 -0
  24. package/dist/cli/runs.js +214 -0
  25. package/dist/cli/runs.js.map +1 -0
  26. package/dist/cli/setup-commands.js +0 -0
  27. package/dist/cli/signal.js +8 -8
  28. package/dist/cli/signal.js.map +1 -1
  29. package/dist/cli/stop.d.ts +5 -0
  30. package/dist/cli/stop.js +215 -0
  31. package/dist/cli/stop.js.map +1 -0
  32. package/dist/cli/tasks.d.ts +10 -0
  33. package/dist/cli/tasks.js +165 -0
  34. package/dist/cli/tasks.js.map +1 -0
  35. package/dist/core/auto-recovery.d.ts +212 -0
  36. package/dist/core/auto-recovery.js +737 -0
  37. package/dist/core/auto-recovery.js.map +1 -0
  38. package/dist/core/failure-policy.d.ts +156 -0
  39. package/dist/core/failure-policy.js +488 -0
  40. package/dist/core/failure-policy.js.map +1 -0
  41. package/dist/core/orchestrator.d.ts +16 -2
  42. package/dist/core/orchestrator.js +439 -105
  43. package/dist/core/orchestrator.js.map +1 -1
  44. package/dist/core/reviewer.d.ts +2 -0
  45. package/dist/core/reviewer.js +2 -0
  46. package/dist/core/reviewer.js.map +1 -1
  47. package/dist/core/runner.d.ts +33 -10
  48. package/dist/core/runner.js +374 -164
  49. package/dist/core/runner.js.map +1 -1
  50. package/dist/services/logging/buffer.d.ts +67 -0
  51. package/dist/services/logging/buffer.js +309 -0
  52. package/dist/services/logging/buffer.js.map +1 -0
  53. package/dist/services/logging/console.d.ts +89 -0
  54. package/dist/services/logging/console.js +169 -0
  55. package/dist/services/logging/console.js.map +1 -0
  56. package/dist/services/logging/file-writer.d.ts +71 -0
  57. package/dist/services/logging/file-writer.js +516 -0
  58. package/dist/services/logging/file-writer.js.map +1 -0
  59. package/dist/services/logging/formatter.d.ts +39 -0
  60. package/dist/services/logging/formatter.js +227 -0
  61. package/dist/services/logging/formatter.js.map +1 -0
  62. package/dist/services/logging/index.d.ts +11 -0
  63. package/dist/services/logging/index.js +30 -0
  64. package/dist/services/logging/index.js.map +1 -0
  65. package/dist/services/logging/parser.d.ts +31 -0
  66. package/dist/services/logging/parser.js +222 -0
  67. package/dist/services/logging/parser.js.map +1 -0
  68. package/dist/services/process/index.d.ts +59 -0
  69. package/dist/services/process/index.js +257 -0
  70. package/dist/services/process/index.js.map +1 -0
  71. package/dist/types/agent.d.ts +20 -0
  72. package/dist/types/agent.js +6 -0
  73. package/dist/types/agent.js.map +1 -0
  74. package/dist/types/config.d.ts +65 -0
  75. package/dist/types/config.js +6 -0
  76. package/dist/types/config.js.map +1 -0
  77. package/dist/types/events.d.ts +125 -0
  78. package/dist/types/events.js +6 -0
  79. package/dist/types/events.js.map +1 -0
  80. package/dist/types/index.d.ts +12 -0
  81. package/dist/types/index.js +37 -0
  82. package/dist/types/index.js.map +1 -0
  83. package/dist/types/lane.d.ts +43 -0
  84. package/dist/types/lane.js +6 -0
  85. package/dist/types/lane.js.map +1 -0
  86. package/dist/types/logging.d.ts +71 -0
  87. package/dist/types/logging.js +16 -0
  88. package/dist/types/logging.js.map +1 -0
  89. package/dist/types/review.d.ts +17 -0
  90. package/dist/types/review.js +6 -0
  91. package/dist/types/review.js.map +1 -0
  92. package/dist/types/run.d.ts +32 -0
  93. package/dist/types/run.js +6 -0
  94. package/dist/types/run.js.map +1 -0
  95. package/dist/types/task.d.ts +71 -0
  96. package/dist/types/task.js +6 -0
  97. package/dist/types/task.js.map +1 -0
  98. package/dist/ui/components.d.ts +134 -0
  99. package/dist/ui/components.js +389 -0
  100. package/dist/ui/components.js.map +1 -0
  101. package/dist/ui/log-viewer.d.ts +49 -0
  102. package/dist/ui/log-viewer.js +449 -0
  103. package/dist/ui/log-viewer.js.map +1 -0
  104. package/dist/utils/checkpoint.d.ts +87 -0
  105. package/dist/utils/checkpoint.js +317 -0
  106. package/dist/utils/checkpoint.js.map +1 -0
  107. package/dist/utils/config.d.ts +4 -0
  108. package/dist/utils/config.js +18 -8
  109. package/dist/utils/config.js.map +1 -1
  110. package/dist/utils/cursor-agent.js.map +1 -1
  111. package/dist/utils/dependency.d.ts +74 -0
  112. package/dist/utils/dependency.js +420 -0
  113. package/dist/utils/dependency.js.map +1 -0
  114. package/dist/utils/doctor.js +17 -11
  115. package/dist/utils/doctor.js.map +1 -1
  116. package/dist/utils/enhanced-logger.d.ts +10 -33
  117. package/dist/utils/enhanced-logger.js +108 -20
  118. package/dist/utils/enhanced-logger.js.map +1 -1
  119. package/dist/utils/git.d.ts +121 -0
  120. package/dist/utils/git.js +484 -11
  121. package/dist/utils/git.js.map +1 -1
  122. package/dist/utils/health.d.ts +91 -0
  123. package/dist/utils/health.js +556 -0
  124. package/dist/utils/health.js.map +1 -0
  125. package/dist/utils/lock.d.ts +95 -0
  126. package/dist/utils/lock.js +332 -0
  127. package/dist/utils/lock.js.map +1 -0
  128. package/dist/utils/log-buffer.d.ts +17 -0
  129. package/dist/utils/log-buffer.js +14 -0
  130. package/dist/utils/log-buffer.js.map +1 -0
  131. package/dist/utils/log-constants.d.ts +23 -0
  132. package/dist/utils/log-constants.js +28 -0
  133. package/dist/utils/log-constants.js.map +1 -0
  134. package/dist/utils/log-formatter.d.ts +25 -0
  135. package/dist/utils/log-formatter.js +237 -0
  136. package/dist/utils/log-formatter.js.map +1 -0
  137. package/dist/utils/log-service.d.ts +19 -0
  138. package/dist/utils/log-service.js +47 -0
  139. package/dist/utils/log-service.js.map +1 -0
  140. package/dist/utils/logger.d.ts +46 -27
  141. package/dist/utils/logger.js +82 -60
  142. package/dist/utils/logger.js.map +1 -1
  143. package/dist/utils/path.d.ts +19 -0
  144. package/dist/utils/path.js +77 -0
  145. package/dist/utils/path.js.map +1 -0
  146. package/dist/utils/process-manager.d.ts +21 -0
  147. package/dist/utils/process-manager.js +138 -0
  148. package/dist/utils/process-manager.js.map +1 -0
  149. package/dist/utils/retry.d.ts +121 -0
  150. package/dist/utils/retry.js +374 -0
  151. package/dist/utils/retry.js.map +1 -0
  152. package/dist/utils/run-service.d.ts +88 -0
  153. package/dist/utils/run-service.js +412 -0
  154. package/dist/utils/run-service.js.map +1 -0
  155. package/dist/utils/state.d.ts +62 -3
  156. package/dist/utils/state.js +317 -11
  157. package/dist/utils/state.js.map +1 -1
  158. package/dist/utils/task-service.d.ts +82 -0
  159. package/dist/utils/task-service.js +348 -0
  160. package/dist/utils/task-service.js.map +1 -0
  161. package/dist/utils/template.d.ts +14 -0
  162. package/dist/utils/template.js +122 -0
  163. package/dist/utils/template.js.map +1 -0
  164. package/dist/utils/types.d.ts +2 -271
  165. package/dist/utils/types.js +16 -0
  166. package/dist/utils/types.js.map +1 -1
  167. package/package.json +38 -23
  168. package/scripts/ai-security-check.js +0 -1
  169. package/scripts/local-security-gate.sh +0 -0
  170. package/scripts/monitor-lanes.sh +94 -0
  171. package/scripts/patches/test-cursor-agent.js +0 -1
  172. package/scripts/release.sh +0 -0
  173. package/scripts/setup-security.sh +0 -0
  174. package/scripts/stream-logs.sh +72 -0
  175. package/scripts/verify-and-fix.sh +0 -0
  176. package/src/cli/clean.ts +187 -6
  177. package/src/cli/index.ts +12 -1
  178. package/src/cli/init.ts +8 -7
  179. package/src/cli/logs.ts +124 -77
  180. package/src/cli/monitor.ts +1815 -898
  181. package/src/cli/prepare.ts +41 -21
  182. package/src/cli/resume.ts +753 -626
  183. package/src/cli/run.ts +12 -5
  184. package/src/cli/runs.ts +212 -0
  185. package/src/cli/setup-commands.ts +0 -0
  186. package/src/cli/signal.ts +8 -7
  187. package/src/cli/stop.ts +209 -0
  188. package/src/cli/tasks.ts +154 -0
  189. package/src/core/auto-recovery.ts +909 -0
  190. package/src/core/failure-policy.ts +592 -0
  191. package/src/core/orchestrator.ts +1131 -704
  192. package/src/core/reviewer.ts +4 -0
  193. package/src/core/runner.ts +444 -180
  194. package/src/services/logging/buffer.ts +326 -0
  195. package/src/services/logging/console.ts +193 -0
  196. package/src/services/logging/file-writer.ts +526 -0
  197. package/src/services/logging/formatter.ts +268 -0
  198. package/src/services/logging/index.ts +16 -0
  199. package/src/services/logging/parser.ts +232 -0
  200. package/src/services/process/index.ts +261 -0
  201. package/src/types/agent.ts +24 -0
  202. package/src/types/config.ts +79 -0
  203. package/src/types/events.ts +156 -0
  204. package/src/types/index.ts +29 -0
  205. package/src/types/lane.ts +56 -0
  206. package/src/types/logging.ts +96 -0
  207. package/src/types/review.ts +20 -0
  208. package/src/types/run.ts +37 -0
  209. package/src/types/task.ts +79 -0
  210. package/src/ui/components.ts +430 -0
  211. package/src/ui/log-viewer.ts +485 -0
  212. package/src/utils/checkpoint.ts +374 -0
  213. package/src/utils/config.ts +18 -8
  214. package/src/utils/cursor-agent.ts +1 -1
  215. package/src/utils/dependency.ts +482 -0
  216. package/src/utils/doctor.ts +18 -11
  217. package/src/utils/enhanced-logger.ts +122 -60
  218. package/src/utils/git.ts +517 -11
  219. package/src/utils/health.ts +596 -0
  220. package/src/utils/lock.ts +346 -0
  221. package/src/utils/log-buffer.ts +28 -0
  222. package/src/utils/log-constants.ts +26 -0
  223. package/src/utils/log-formatter.ts +245 -0
  224. package/src/utils/log-service.ts +49 -0
  225. package/src/utils/logger.ts +100 -51
  226. package/src/utils/path.ts +45 -0
  227. package/src/utils/process-manager.ts +100 -0
  228. package/src/utils/retry.ts +413 -0
  229. package/src/utils/run-service.ts +433 -0
  230. package/src/utils/state.ts +385 -11
  231. package/src/utils/task-service.ts +370 -0
  232. package/src/utils/template.ts +92 -0
  233. package/src/utils/types.ts +2 -314
  234. package/templates/basic.json +21 -0
@@ -1,318 +1,6 @@
1
1
  /**
2
2
  * Shared type definitions for CursorFlow
3
+ * Re-exports from central types directory for backward compatibility
3
4
  */
4
5
 
5
- export interface LaneConfig {
6
- devPort: number;
7
- autoCreatePr: boolean;
8
- }
9
-
10
- export interface CursorFlowConfig {
11
- tasksDir: string;
12
- logsDir: string;
13
- baseBranch: string;
14
- branchPrefix: string;
15
- executor: 'cursor-agent' | 'cloud';
16
- pollInterval: number;
17
- allowDependencyChange: boolean;
18
- lockfileReadOnly: boolean;
19
- enableReview: boolean;
20
- reviewModel: string;
21
- reviewAllTasks?: boolean;
22
- maxReviewIterations: number;
23
- defaultLaneConfig: LaneConfig;
24
- logLevel: string;
25
- verboseGit: boolean;
26
- worktreePrefix: string;
27
- maxConcurrentLanes: number;
28
- projectRoot: string;
29
- /** Output format for cursor-agent (default: 'stream-json') */
30
- agentOutputFormat: 'stream-json' | 'json' | 'plain';
31
- webhooks?: WebhookConfig[];
32
- /** Enhanced logging configuration */
33
- enhancedLogging?: Partial<EnhancedLogConfig>;
34
- }
35
-
36
- export interface WebhookConfig {
37
- enabled?: boolean;
38
- url: string;
39
- secret?: string;
40
- events?: string[]; // ['*'] for all, ['task.*'] for wildcards
41
- headers?: Record<string, string>;
42
- retries?: number;
43
- timeoutMs?: number;
44
- }
45
-
46
- /**
47
- * Enhanced logging configuration
48
- */
49
- export interface EnhancedLogConfig {
50
- /** Enable enhanced logging features (default: true) */
51
- enabled: boolean;
52
-
53
- /** Strip ANSI escape codes from clean logs (default: true) */
54
- stripAnsi: boolean;
55
-
56
- /** Add timestamps to each line (default: true) */
57
- addTimestamps: boolean;
58
-
59
- /** Maximum size in bytes before rotation (default: 50MB) */
60
- maxFileSize: number;
61
-
62
- /** Number of rotated files to keep (default: 5) */
63
- maxFiles: number;
64
-
65
- /** Write raw output with ANSI codes to separate file (default: true) */
66
- keepRawLogs: boolean;
67
-
68
- /** Write structured JSON log entries (default: true) */
69
- writeJsonLog: boolean;
70
-
71
- /** Timestamp format: 'iso' | 'relative' | 'short' (default: 'iso') */
72
- timestampFormat: 'iso' | 'relative' | 'short';
73
- }
74
-
75
- export interface CursorFlowEvent<T = Record<string, any>> {
76
- id: string;
77
- type: string;
78
- timestamp: string;
79
- runId: string;
80
- payload: T;
81
- }
82
-
83
- export type EventHandler<T = any> = (event: CursorFlowEvent<T>) => void | Promise<void>;
84
-
85
- // Specific Event Payloads
86
- export interface OrchestrationStartedPayload {
87
- runId: string;
88
- tasksDir: string;
89
- laneCount: number;
90
- runRoot: string;
91
- }
92
-
93
- export interface OrchestrationCompletedPayload {
94
- runId: string;
95
- laneCount: number;
96
- completedCount: number;
97
- failedCount: number;
98
- }
99
-
100
- export interface OrchestrationFailedPayload {
101
- error: string;
102
- blockedLanes?: string[];
103
- }
104
-
105
- export interface LaneStartedPayload {
106
- laneName: string;
107
- pid?: number;
108
- logPath: string;
109
- }
110
-
111
- export interface LaneCompletedPayload {
112
- laneName: string;
113
- exitCode: number;
114
- }
115
-
116
- export interface LaneFailedPayload {
117
- laneName: string;
118
- exitCode: number;
119
- error: string;
120
- }
121
-
122
- export interface LaneDependencyRequestedPayload {
123
- laneName: string;
124
- dependencyRequest: DependencyRequestPlan;
125
- }
126
-
127
- export interface TaskStartedPayload {
128
- taskName: string;
129
- taskBranch: string;
130
- index: number;
131
- }
132
-
133
- export interface TaskCompletedPayload {
134
- taskName: string;
135
- taskBranch: string;
136
- status: string;
137
- }
138
-
139
- export interface TaskFailedPayload {
140
- taskName: string;
141
- taskBranch: string;
142
- error: string;
143
- }
144
-
145
- export interface AgentPromptSentPayload {
146
- taskName: string;
147
- model: string;
148
- promptLength: number;
149
- }
150
-
151
- export interface AgentResponseReceivedPayload {
152
- taskName: string;
153
- ok: boolean;
154
- duration: number;
155
- responseLength: number;
156
- error?: string;
157
- }
158
-
159
- export interface ReviewStartedPayload {
160
- taskName: string;
161
- taskBranch: string;
162
- }
163
-
164
- export interface ReviewCompletedPayload {
165
- taskName: string;
166
- status: 'approved' | 'needs_changes';
167
- issueCount: number;
168
- summary: string;
169
- }
170
-
171
- export interface ReviewApprovedPayload {
172
- taskName: string;
173
- iterations: number;
174
- }
175
-
176
- export interface ReviewRejectedPayload {
177
- taskName: string;
178
- reason: string;
179
- iterations: number;
180
- }
181
-
182
- export interface DependencyPolicy {
183
- allowDependencyChange: boolean;
184
- lockfileReadOnly: boolean;
185
- }
186
-
187
- export interface Task {
188
- name: string;
189
- prompt: string;
190
- model?: string;
191
- /** Acceptance criteria for the AI reviewer to validate */
192
- acceptanceCriteria?: string[];
193
- /** Task-level dependencies (format: "lane:task") */
194
- dependsOn?: string[];
195
- /** Task execution timeout in milliseconds. Overrides lane-level timeout. */
196
- timeout?: number;
197
- }
198
-
199
- export interface RunnerConfig {
200
- tasks: Task[];
201
- dependsOn?: string[];
202
- pipelineBranch?: string;
203
- branchPrefix?: string;
204
- worktreeRoot?: string;
205
- baseBranch?: string;
206
- model?: string;
207
- dependencyPolicy: DependencyPolicy;
208
- enableReview?: boolean;
209
- /** Output format for cursor-agent (default: 'stream-json') */
210
- agentOutputFormat?: 'stream-json' | 'json' | 'plain';
211
- reviewModel?: string;
212
- reviewAllTasks?: boolean;
213
- maxReviewIterations?: number;
214
- acceptanceCriteria?: string[];
215
- /** Task execution timeout in milliseconds. Default: 600000 (10 minutes) */
216
- timeout?: number;
217
- /**
218
- * Enable intervention feature (stdin piping for message injection).
219
- * Warning: May cause stdout buffering issues on some systems.
220
- * Default: false
221
- */
222
- enableIntervention?: boolean;
223
- /**
224
- * Disable Git operations (worktree, branch, push, commit).
225
- * Useful for testing or environments without Git remote.
226
- * Default: false
227
- */
228
- noGit?: boolean;
229
- }
230
-
231
- export interface DependencyRequestPlan {
232
- reason: string;
233
- changes: string[];
234
- commands: string[];
235
- notes?: string;
236
- }
237
-
238
- export interface TaskExecutionResult {
239
- taskName: string;
240
- taskBranch: string;
241
- status: 'FINISHED' | 'ERROR' | 'BLOCKED_DEPENDENCY';
242
- error?: string;
243
- dependencyRequest?: DependencyRequestPlan | null;
244
- }
245
-
246
- export interface AgentSendResult {
247
- ok: boolean;
248
- exitCode: number;
249
- error?: string;
250
- sessionId?: string;
251
- resultText?: string;
252
- }
253
-
254
- export interface ReviewIssue {
255
- severity: 'critical' | 'major' | 'minor';
256
- description: string;
257
- file?: string;
258
- suggestion?: string;
259
- }
260
-
261
- export interface ReviewResult {
262
- status: 'approved' | 'needs_changes';
263
- buildSuccess: boolean;
264
- issues: ReviewIssue[];
265
- suggestions: string[];
266
- summary: string;
267
- raw: string;
268
- }
269
-
270
- export interface TaskResult {
271
- taskName: string;
272
- taskBranch: string;
273
- acceptanceCriteria?: string[];
274
- [key: string]: any;
275
- }
276
-
277
- export interface LaneState {
278
- label: string;
279
- status: 'pending' | 'running' | 'completed' | 'failed' | 'paused' | 'waiting' | 'reviewing';
280
- currentTaskIndex: number;
281
- totalTasks: number;
282
- worktreeDir: string | null;
283
- pipelineBranch: string | null;
284
- startTime: number;
285
- endTime: number | null;
286
- error: string | null;
287
- dependencyRequest: DependencyRequestPlan | null;
288
- updatedAt?: number;
289
- tasksFile?: string; // Original tasks file path
290
- dependsOn?: string[];
291
- pid?: number;
292
- /** List of completed task names in this lane */
293
- completedTasks?: string[];
294
- /** Task-level dependencies currently being waited for (format: "lane:task") */
295
- waitingFor?: string[];
296
- }
297
-
298
- export interface ConversationEntry {
299
- timestamp: string;
300
- role: 'user' | 'assistant' | 'reviewer' | 'system';
301
- task: string | null;
302
- fullText: string;
303
- textLength: number;
304
- model: string | null;
305
- }
306
-
307
- export interface GitLogEntry {
308
- timestamp: string;
309
- operation: string;
310
- [key: string]: any;
311
- }
312
-
313
- export interface EventEntry {
314
- timestamp: string;
315
- event: string;
316
- [key: string]: any;
317
- }
318
-
6
+ export * from '../types';
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "basic-template",
3
+ "tasks": [
4
+ {
5
+ "name": "plan",
6
+ "model": "sonnet-4.5-thinking",
7
+ "prompt": "Analyze requirements for {{featureName}} and create a plan.",
8
+ "acceptanceCriteria": ["Plan documented"]
9
+ },
10
+ {
11
+ "name": "implement",
12
+ "model": "sonnet-4.5",
13
+ "prompt": "Implement {{featureName}} based on the plan.",
14
+ "acceptanceCriteria": ["Implementation complete"]
15
+ }
16
+ ],
17
+ "dependencyPolicy": {
18
+ "allowDependencyChange": false,
19
+ "lockfileReadOnly": true
20
+ }
21
+ }