@litmers/cursorflow-orchestrator 0.1.31 → 0.1.36

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 (150) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +182 -59
  3. package/commands/cursorflow-add.md +159 -0
  4. package/commands/cursorflow-doctor.md +45 -23
  5. package/commands/cursorflow-monitor.md +23 -2
  6. package/commands/cursorflow-new.md +87 -0
  7. package/commands/cursorflow-run.md +60 -111
  8. package/dist/cli/add.d.ts +7 -0
  9. package/dist/cli/add.js +377 -0
  10. package/dist/cli/add.js.map +1 -0
  11. package/dist/cli/clean.js +1 -0
  12. package/dist/cli/clean.js.map +1 -1
  13. package/dist/cli/config.d.ts +7 -0
  14. package/dist/cli/config.js +181 -0
  15. package/dist/cli/config.js.map +1 -0
  16. package/dist/cli/doctor.js +47 -4
  17. package/dist/cli/doctor.js.map +1 -1
  18. package/dist/cli/index.js +34 -30
  19. package/dist/cli/index.js.map +1 -1
  20. package/dist/cli/logs.js +17 -34
  21. package/dist/cli/logs.js.map +1 -1
  22. package/dist/cli/monitor.js +62 -65
  23. package/dist/cli/monitor.js.map +1 -1
  24. package/dist/cli/new.d.ts +7 -0
  25. package/dist/cli/new.js +232 -0
  26. package/dist/cli/new.js.map +1 -0
  27. package/dist/cli/prepare.js +95 -193
  28. package/dist/cli/prepare.js.map +1 -1
  29. package/dist/cli/resume.js +57 -68
  30. package/dist/cli/resume.js.map +1 -1
  31. package/dist/cli/run.js +60 -30
  32. package/dist/cli/run.js.map +1 -1
  33. package/dist/cli/stop.js +6 -0
  34. package/dist/cli/stop.js.map +1 -1
  35. package/dist/cli/tasks.d.ts +5 -3
  36. package/dist/cli/tasks.js +181 -29
  37. package/dist/cli/tasks.js.map +1 -1
  38. package/dist/core/failure-policy.d.ts +9 -0
  39. package/dist/core/failure-policy.js +9 -0
  40. package/dist/core/failure-policy.js.map +1 -1
  41. package/dist/core/orchestrator.d.ts +20 -6
  42. package/dist/core/orchestrator.js +215 -334
  43. package/dist/core/orchestrator.js.map +1 -1
  44. package/dist/core/runner/agent.d.ts +27 -0
  45. package/dist/core/runner/agent.js +294 -0
  46. package/dist/core/runner/agent.js.map +1 -0
  47. package/dist/core/runner/index.d.ts +5 -0
  48. package/dist/core/runner/index.js +22 -0
  49. package/dist/core/runner/index.js.map +1 -0
  50. package/dist/core/runner/pipeline.d.ts +9 -0
  51. package/dist/core/runner/pipeline.js +539 -0
  52. package/dist/core/runner/pipeline.js.map +1 -0
  53. package/dist/core/runner/prompt.d.ts +25 -0
  54. package/dist/core/runner/prompt.js +175 -0
  55. package/dist/core/runner/prompt.js.map +1 -0
  56. package/dist/core/runner/task.d.ts +26 -0
  57. package/dist/core/runner/task.js +283 -0
  58. package/dist/core/runner/task.js.map +1 -0
  59. package/dist/core/runner/utils.d.ts +37 -0
  60. package/dist/core/runner/utils.js +161 -0
  61. package/dist/core/runner/utils.js.map +1 -0
  62. package/dist/core/runner.d.ts +2 -96
  63. package/dist/core/runner.js +11 -1136
  64. package/dist/core/runner.js.map +1 -1
  65. package/dist/core/stall-detection.d.ts +326 -0
  66. package/dist/core/stall-detection.js +781 -0
  67. package/dist/core/stall-detection.js.map +1 -0
  68. package/dist/services/logging/console.js +2 -1
  69. package/dist/services/logging/console.js.map +1 -1
  70. package/dist/types/config.d.ts +6 -6
  71. package/dist/types/flow.d.ts +84 -0
  72. package/dist/types/flow.js +10 -0
  73. package/dist/types/flow.js.map +1 -0
  74. package/dist/types/index.d.ts +1 -0
  75. package/dist/types/index.js +3 -3
  76. package/dist/types/index.js.map +1 -1
  77. package/dist/types/lane.d.ts +0 -2
  78. package/dist/types/logging.d.ts +5 -1
  79. package/dist/types/task.d.ts +7 -11
  80. package/dist/utils/config.d.ts +5 -1
  81. package/dist/utils/config.js +15 -16
  82. package/dist/utils/config.js.map +1 -1
  83. package/dist/utils/dependency.d.ts +36 -1
  84. package/dist/utils/dependency.js +256 -1
  85. package/dist/utils/dependency.js.map +1 -1
  86. package/dist/utils/doctor.js +40 -8
  87. package/dist/utils/doctor.js.map +1 -1
  88. package/dist/utils/enhanced-logger.d.ts +45 -82
  89. package/dist/utils/enhanced-logger.js +239 -844
  90. package/dist/utils/enhanced-logger.js.map +1 -1
  91. package/dist/utils/flow.d.ts +9 -0
  92. package/dist/utils/flow.js +73 -0
  93. package/dist/utils/flow.js.map +1 -0
  94. package/dist/utils/git.d.ts +29 -0
  95. package/dist/utils/git.js +115 -5
  96. package/dist/utils/git.js.map +1 -1
  97. package/dist/utils/state.js +0 -2
  98. package/dist/utils/state.js.map +1 -1
  99. package/dist/utils/task-service.d.ts +2 -2
  100. package/dist/utils/task-service.js +40 -31
  101. package/dist/utils/task-service.js.map +1 -1
  102. package/package.json +4 -3
  103. package/src/cli/add.ts +397 -0
  104. package/src/cli/clean.ts +1 -0
  105. package/src/cli/config.ts +177 -0
  106. package/src/cli/doctor.ts +48 -4
  107. package/src/cli/index.ts +36 -32
  108. package/src/cli/logs.ts +20 -33
  109. package/src/cli/monitor.ts +70 -75
  110. package/src/cli/new.ts +235 -0
  111. package/src/cli/prepare.ts +98 -205
  112. package/src/cli/resume.ts +61 -76
  113. package/src/cli/run.ts +333 -306
  114. package/src/cli/stop.ts +8 -0
  115. package/src/cli/tasks.ts +200 -21
  116. package/src/core/failure-policy.ts +9 -0
  117. package/src/core/orchestrator.ts +279 -379
  118. package/src/core/runner/agent.ts +314 -0
  119. package/src/core/runner/index.ts +6 -0
  120. package/src/core/runner/pipeline.ts +567 -0
  121. package/src/core/runner/prompt.ts +174 -0
  122. package/src/core/runner/task.ts +320 -0
  123. package/src/core/runner/utils.ts +142 -0
  124. package/src/core/runner.ts +8 -1347
  125. package/src/core/stall-detection.ts +936 -0
  126. package/src/services/logging/console.ts +2 -1
  127. package/src/types/config.ts +6 -6
  128. package/src/types/flow.ts +91 -0
  129. package/src/types/index.ts +15 -3
  130. package/src/types/lane.ts +0 -2
  131. package/src/types/logging.ts +5 -1
  132. package/src/types/task.ts +7 -11
  133. package/src/utils/config.ts +16 -17
  134. package/src/utils/dependency.ts +311 -2
  135. package/src/utils/doctor.ts +36 -8
  136. package/src/utils/enhanced-logger.ts +264 -927
  137. package/src/utils/flow.ts +42 -0
  138. package/src/utils/git.ts +145 -5
  139. package/src/utils/state.ts +0 -2
  140. package/src/utils/task-service.ts +48 -40
  141. package/commands/cursorflow-review.md +0 -56
  142. package/commands/cursorflow-runs.md +0 -59
  143. package/dist/cli/runs.d.ts +0 -5
  144. package/dist/cli/runs.js +0 -214
  145. package/dist/cli/runs.js.map +0 -1
  146. package/dist/core/reviewer.d.ts +0 -66
  147. package/dist/core/reviewer.js +0 -265
  148. package/dist/core/reviewer.js.map +0 -1
  149. package/src/cli/runs.ts +0 -212
  150. package/src/core/reviewer.ts +0 -285
@@ -1,96 +1,57 @@
1
1
  /**
2
- * Enhanced Logger - Comprehensive terminal output capture and management
2
+ * Enhanced Logger - Simplified terminal output capture
3
3
  *
4
4
  * Features:
5
- * - ANSI escape sequence stripping for clean logs
6
- * - Automatic timestamps on each line
7
- * - Log rotation and size management
8
- * - Session headers with context
9
- * - Raw and clean log file options
10
- * - Structured JSON logs for programmatic access
11
- * - Streaming output support for real-time capture
5
+ * - Raw log: Original output as-is
6
+ * - Readable log: Formatted with formatMessageForConsole style
12
7
  */
13
- import { Transform, TransformCallback } from 'stream';
14
- import { EnhancedLogConfig, ParsedMessage, JsonLogEntry, LogSession } from '../types';
15
- export { EnhancedLogConfig, ParsedMessage, JsonLogEntry, LogSession };
16
- export declare const DEFAULT_LOG_CONFIG: EnhancedLogConfig;
17
- /**
18
- * Streaming JSON Parser - Parses cursor-agent stream-json output
19
- * and combines tokens into readable messages
20
- */
21
- export declare class StreamingMessageParser {
22
- private currentMessage;
23
- private currentRole;
24
- private messageStartTime;
25
- private onMessage;
26
- constructor(onMessage: (msg: ParsedMessage) => void);
27
- /**
28
- * Parse a line of JSON output from cursor-agent
29
- */
30
- parseLine(line: string): void;
31
- private handleJsonMessage;
32
- /**
33
- * Flush accumulated message
34
- */
35
- flush(): void;
36
- private emitMessage;
8
+ import { EnhancedLogConfig, ParsedMessage, LogSession } from '../types';
9
+ export { EnhancedLogConfig, ParsedMessage, LogSession };
10
+ export interface JsonLogEntry {
11
+ timestamp: string;
12
+ level: string;
13
+ lane?: string;
14
+ task?: string;
15
+ message: string;
16
+ metadata?: Record<string, any>;
17
+ source?: string;
18
+ raw?: string;
37
19
  }
20
+ export declare const DEFAULT_LOG_CONFIG: EnhancedLogConfig;
38
21
  /**
39
22
  * Strip ANSI escape sequences from text
40
23
  */
41
24
  export declare function stripAnsi(text: string): string;
42
25
  /**
43
- * Format timestamp based on format preference
26
+ * Format timestamp
44
27
  */
45
28
  export declare function formatTimestamp(format: 'iso' | 'relative' | 'short', startTime?: number): string;
46
29
  /**
47
- * Transform stream that strips ANSI and adds timestamps
48
- */
49
- export declare class CleanLogTransform extends Transform {
50
- private config;
51
- private session;
52
- private buffer;
53
- constructor(config: EnhancedLogConfig, session: LogSession);
54
- _transform(chunk: Buffer, encoding: BufferEncoding, callback: TransformCallback): void;
55
- _flush(callback: TransformCallback): void;
56
- }
57
- /**
58
- * Enhanced Log Manager - Manages log files with rotation and multiple outputs
30
+ * Simplified Log Manager - Only raw and readable logs
59
31
  */
60
32
  export declare class EnhancedLogManager {
61
33
  private config;
62
34
  private session;
63
35
  private logDir;
64
- private cleanLogPath;
65
36
  private rawLogPath;
66
- private absoluteRawLogPath;
67
- private jsonLogPath;
68
37
  private readableLogPath;
69
- private cleanLogFd;
70
38
  private rawLogFd;
71
- private absoluteRawLogFd;
72
- private jsonLogFd;
73
39
  private readableLogFd;
74
- private cleanLogSize;
75
40
  private rawLogSize;
76
- private absoluteRawLogSize;
77
- private cleanTransform;
78
- private streamingParser;
79
- private lineBuffer;
80
41
  private onParsedMessage?;
81
42
  constructor(logDir: string, session: LogSession, config?: Partial<EnhancedLogConfig>, onParsedMessage?: (msg: ParsedMessage) => void);
82
43
  /**
83
- * Initialize log files and write session headers
44
+ * Get short time format (HH:MM:SS)
84
45
  */
85
- private initLogFiles;
46
+ private getShortTime;
86
47
  /**
87
- * Write a parsed message to the readable log
48
+ * Get lane-task label like [L1-T2-lanename10]
88
49
  */
89
- private writeReadableMessage;
50
+ private getLaneTaskLabel;
90
51
  /**
91
- * Indent text with a prefix
52
+ * Initialize log files and write session headers
92
53
  */
93
- private indentText;
54
+ private initLogFiles;
94
55
  /**
95
56
  * Write session header to logs
96
57
  */
@@ -103,30 +64,26 @@ export declare class EnhancedLogManager {
103
64
  * Rotate a log file
104
65
  */
105
66
  private rotateLog;
106
- /**
107
- * Write to clean log with size tracking
108
- */
109
- private writeToCleanLog;
110
67
  /**
111
68
  * Write to raw log with size tracking
112
69
  */
113
70
  private writeToRawLog;
114
71
  /**
115
- * Write to absolute raw log with size tracking
72
+ * Write to readable log
116
73
  */
117
- private writeToAbsoluteRawLog;
74
+ private writeToReadableLog;
118
75
  /**
119
- * Write a JSON log entry
76
+ * Write a parsed message to the readable log using formatMessageForConsole style
120
77
  */
121
- private writeJsonEntry;
78
+ writeReadableMessage(msg: ParsedMessage): void;
122
79
  /**
123
80
  * Write stdout data
124
81
  */
125
82
  writeStdout(data: Buffer | string): void;
126
83
  /**
127
- * Parse streaming JSON data for readable log - legacy, integrated into writeStdout
84
+ * Parse cursor-agent JSON output to ParsedMessage
128
85
  */
129
- private parseStreamingData;
86
+ private parseJsonToMessage;
130
87
  /**
131
88
  * Write stderr data
132
89
  */
@@ -142,9 +99,9 @@ export declare class EnhancedLogManager {
142
99
  /**
143
100
  * Update task context
144
101
  */
145
- setTask(taskName: string, model?: string): void;
102
+ setTask(taskName: string, model?: string, taskIndex?: number): void;
146
103
  /**
147
- * Check if a log line is noise (progress bars, spinners, etc.)
104
+ * Check if a log line is noise
148
105
  */
149
106
  private isNoiseLog;
150
107
  /**
@@ -152,9 +109,7 @@ export declare class EnhancedLogManager {
152
109
  */
153
110
  getLogPaths(): {
154
111
  clean: string;
155
- raw?: string;
156
- absoluteRaw?: string;
157
- json?: string;
112
+ raw: string;
158
113
  readable: string;
159
114
  };
160
115
  /**
@@ -165,11 +120,11 @@ export declare class EnhancedLogManager {
165
120
  stderr: number;
166
121
  };
167
122
  /**
168
- * Close all log files and ensure all data is flushed to disk
123
+ * Close all log files
169
124
  */
170
125
  close(): void;
171
126
  /**
172
- * Extract the last error message from the clean log file
127
+ * Extract the last error message from the log
173
128
  */
174
129
  getLastError(): string | null;
175
130
  /**
@@ -180,12 +135,20 @@ export declare class EnhancedLogManager {
180
135
  /**
181
136
  * Create a log manager for a lane
182
137
  */
183
- export declare function createLogManager(laneRunDir: string, laneName: string, config?: Partial<EnhancedLogConfig>, onParsedMessage?: (msg: ParsedMessage) => void): EnhancedLogManager;
138
+ export declare function createLogManager(laneRunDir: string, laneName: string, config?: Partial<EnhancedLogConfig>, onParsedMessage?: (msg: ParsedMessage) => void, laneIndex?: number): EnhancedLogManager;
184
139
  /**
185
- * Read and parse JSON log file
140
+ * Read and parse JSON log file (legacy compatibility - returns empty array)
186
141
  */
187
142
  export declare function readJsonLog(logPath: string): JsonLogEntry[];
188
143
  /**
189
- * Export logs to various formats
144
+ * Export logs (legacy compatibility)
190
145
  */
191
146
  export declare function exportLogs(laneRunDir: string, format: 'text' | 'json' | 'markdown' | 'html', outputPath?: string): string;
147
+ export declare class StreamingMessageParser {
148
+ constructor(onMessage: (msg: ParsedMessage) => void);
149
+ parseLine(line: string): void;
150
+ flush(): void;
151
+ }
152
+ export declare class CleanLogTransform {
153
+ constructor(config: EnhancedLogConfig, session: LogSession);
154
+ }