@litmers/cursorflow-orchestrator 0.1.39 → 0.2.2

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 (214) hide show
  1. package/CHANGELOG.md +0 -2
  2. package/README.md +20 -16
  3. package/commands/cursorflow-init.md +0 -4
  4. package/dist/cli/logs.js +108 -9
  5. package/dist/cli/logs.js.map +1 -1
  6. package/dist/cli/models.js +20 -3
  7. package/dist/cli/models.js.map +1 -1
  8. package/dist/cli/monitor.d.ts +7 -10
  9. package/dist/cli/monitor.js +1088 -1240
  10. package/dist/cli/monitor.js.map +1 -1
  11. package/dist/cli/prepare.js +0 -1
  12. package/dist/cli/prepare.js.map +1 -1
  13. package/dist/cli/resume.js +23 -5
  14. package/dist/cli/resume.js.map +1 -1
  15. package/dist/cli/run.js +28 -9
  16. package/dist/cli/run.js.map +1 -1
  17. package/dist/cli/signal.d.ts +6 -1
  18. package/dist/cli/signal.js +94 -12
  19. package/dist/cli/signal.js.map +1 -1
  20. package/dist/cli/tasks.js +3 -46
  21. package/dist/cli/tasks.js.map +1 -1
  22. package/dist/core/agent-supervisor.d.ts +23 -0
  23. package/dist/core/agent-supervisor.js +42 -0
  24. package/dist/core/agent-supervisor.js.map +1 -0
  25. package/dist/core/auto-recovery.d.ts +2 -1
  26. package/dist/core/auto-recovery.js +6 -1
  27. package/dist/core/auto-recovery.js.map +1 -1
  28. package/dist/core/failure-policy.d.ts +0 -1
  29. package/dist/core/failure-policy.js +0 -1
  30. package/dist/core/failure-policy.js.map +1 -1
  31. package/dist/core/git-lifecycle-manager.d.ts +284 -0
  32. package/dist/core/git-lifecycle-manager.js +778 -0
  33. package/dist/core/git-lifecycle-manager.js.map +1 -0
  34. package/dist/core/git-pipeline-coordinator.d.ts +21 -0
  35. package/dist/core/git-pipeline-coordinator.js +205 -0
  36. package/dist/core/git-pipeline-coordinator.js.map +1 -0
  37. package/dist/core/intervention.d.ts +176 -0
  38. package/dist/core/intervention.js +424 -0
  39. package/dist/core/intervention.js.map +1 -0
  40. package/dist/core/lane-state-machine.d.ts +423 -0
  41. package/dist/core/lane-state-machine.js +890 -0
  42. package/dist/core/lane-state-machine.js.map +1 -0
  43. package/dist/core/orchestrator.d.ts +4 -1
  44. package/dist/core/orchestrator.js +38 -63
  45. package/dist/core/orchestrator.js.map +1 -1
  46. package/dist/core/runner/agent.d.ts +7 -1
  47. package/dist/core/runner/agent.js +45 -30
  48. package/dist/core/runner/agent.js.map +1 -1
  49. package/dist/core/runner/pipeline.js +283 -109
  50. package/dist/core/runner/pipeline.js.map +1 -1
  51. package/dist/core/runner/task.d.ts +4 -5
  52. package/dist/core/runner/task.js +6 -77
  53. package/dist/core/runner/task.js.map +1 -1
  54. package/dist/core/runner.js +11 -2
  55. package/dist/core/runner.js.map +1 -1
  56. package/dist/core/stall-detection.d.ts +27 -4
  57. package/dist/core/stall-detection.js +116 -28
  58. package/dist/core/stall-detection.js.map +1 -1
  59. package/dist/hooks/contexts/index.d.ts +104 -0
  60. package/dist/hooks/contexts/index.js +134 -0
  61. package/dist/hooks/contexts/index.js.map +1 -0
  62. package/dist/hooks/data-accessor.d.ts +86 -0
  63. package/dist/hooks/data-accessor.js +410 -0
  64. package/dist/hooks/data-accessor.js.map +1 -0
  65. package/dist/hooks/flow-controller.d.ts +136 -0
  66. package/dist/hooks/flow-controller.js +351 -0
  67. package/dist/hooks/flow-controller.js.map +1 -0
  68. package/dist/hooks/index.d.ts +68 -0
  69. package/dist/hooks/index.js +105 -0
  70. package/dist/hooks/index.js.map +1 -0
  71. package/dist/hooks/manager.d.ts +129 -0
  72. package/dist/hooks/manager.js +389 -0
  73. package/dist/hooks/manager.js.map +1 -0
  74. package/dist/hooks/types.d.ts +463 -0
  75. package/dist/hooks/types.js +45 -0
  76. package/dist/hooks/types.js.map +1 -0
  77. package/dist/services/logging/buffer.d.ts +2 -2
  78. package/dist/services/logging/buffer.js +95 -42
  79. package/dist/services/logging/buffer.js.map +1 -1
  80. package/dist/services/logging/console.js +8 -5
  81. package/dist/services/logging/console.js.map +1 -1
  82. package/dist/services/logging/formatter.d.ts +9 -3
  83. package/dist/services/logging/formatter.js +64 -17
  84. package/dist/services/logging/formatter.js.map +1 -1
  85. package/dist/services/logging/index.d.ts +0 -1
  86. package/dist/services/logging/index.js +0 -1
  87. package/dist/services/logging/index.js.map +1 -1
  88. package/dist/services/logging/paths.d.ts +8 -0
  89. package/dist/services/logging/paths.js +48 -0
  90. package/dist/services/logging/paths.js.map +1 -0
  91. package/dist/services/logging/raw-log.d.ts +6 -0
  92. package/dist/services/logging/raw-log.js +37 -0
  93. package/dist/services/logging/raw-log.js.map +1 -0
  94. package/dist/services/process/index.js +1 -1
  95. package/dist/services/process/index.js.map +1 -1
  96. package/dist/types/agent.d.ts +15 -0
  97. package/dist/types/config.d.ts +24 -1
  98. package/dist/types/event-categories.d.ts +601 -0
  99. package/dist/types/event-categories.js +233 -0
  100. package/dist/types/event-categories.js.map +1 -0
  101. package/dist/types/events.d.ts +0 -20
  102. package/dist/types/flow.d.ts +10 -6
  103. package/dist/types/index.d.ts +1 -1
  104. package/dist/types/index.js +17 -3
  105. package/dist/types/index.js.map +1 -1
  106. package/dist/types/lane.d.ts +1 -1
  107. package/dist/types/logging.d.ts +1 -1
  108. package/dist/types/task.d.ts +13 -2
  109. package/dist/ui/log-viewer.d.ts +3 -0
  110. package/dist/ui/log-viewer.js +3 -0
  111. package/dist/ui/log-viewer.js.map +1 -1
  112. package/dist/utils/config.js +15 -1
  113. package/dist/utils/config.js.map +1 -1
  114. package/dist/utils/cursor-agent.d.ts +11 -1
  115. package/dist/utils/cursor-agent.js +63 -16
  116. package/dist/utils/cursor-agent.js.map +1 -1
  117. package/dist/utils/enhanced-logger.d.ts +5 -1
  118. package/dist/utils/enhanced-logger.js +99 -20
  119. package/dist/utils/enhanced-logger.js.map +1 -1
  120. package/dist/utils/event-registry.d.ts +222 -0
  121. package/dist/utils/event-registry.js +463 -0
  122. package/dist/utils/event-registry.js.map +1 -0
  123. package/dist/utils/events.d.ts +1 -13
  124. package/dist/utils/events.js.map +1 -1
  125. package/dist/utils/flow.d.ts +10 -0
  126. package/dist/utils/flow.js +75 -0
  127. package/dist/utils/flow.js.map +1 -1
  128. package/dist/utils/git.d.ts +12 -1
  129. package/dist/utils/git.js +54 -1
  130. package/dist/utils/git.js.map +1 -1
  131. package/dist/utils/log-constants.d.ts +1 -0
  132. package/dist/utils/log-constants.js +2 -1
  133. package/dist/utils/log-constants.js.map +1 -1
  134. package/dist/utils/log-formatter.d.ts +3 -2
  135. package/dist/utils/log-formatter.js +11 -11
  136. package/dist/utils/log-formatter.js.map +1 -1
  137. package/dist/utils/logger.d.ts +11 -0
  138. package/dist/utils/logger.js +82 -3
  139. package/dist/utils/logger.js.map +1 -1
  140. package/dist/utils/repro-thinking-logs.js +0 -13
  141. package/dist/utils/repro-thinking-logs.js.map +1 -1
  142. package/dist/utils/run-service.js +1 -1
  143. package/dist/utils/run-service.js.map +1 -1
  144. package/examples/README.md +0 -2
  145. package/examples/demo-project/README.md +1 -2
  146. package/package.json +18 -28
  147. package/scripts/setup-security.sh +0 -1
  148. package/scripts/test-log-parser.ts +171 -0
  149. package/scripts/verify-change.sh +272 -0
  150. package/src/cli/logs.ts +121 -10
  151. package/src/cli/models.ts +20 -3
  152. package/src/cli/monitor.ts +1257 -1342
  153. package/src/cli/prepare.ts +0 -1
  154. package/src/cli/resume.ts +29 -5
  155. package/src/cli/run.ts +29 -11
  156. package/src/cli/signal.ts +115 -17
  157. package/src/cli/tasks.ts +2 -59
  158. package/src/core/agent-supervisor.ts +64 -0
  159. package/src/core/auto-recovery.ts +7 -1
  160. package/src/core/failure-policy.ts +0 -1
  161. package/src/core/git-lifecycle-manager.ts +1011 -0
  162. package/src/core/git-pipeline-coordinator.ts +221 -0
  163. package/src/core/intervention.ts +481 -0
  164. package/src/core/lane-state-machine.ts +1097 -0
  165. package/src/core/orchestrator.ts +45 -62
  166. package/src/core/runner/agent.ts +66 -33
  167. package/src/core/runner/pipeline.ts +318 -122
  168. package/src/core/runner/task.ts +12 -93
  169. package/src/core/runner.ts +12 -2
  170. package/src/core/stall-detection.ts +145 -28
  171. package/src/hooks/contexts/index.ts +256 -0
  172. package/src/hooks/data-accessor.ts +488 -0
  173. package/src/hooks/flow-controller.ts +425 -0
  174. package/src/hooks/index.ts +154 -0
  175. package/src/hooks/manager.ts +434 -0
  176. package/src/hooks/types.ts +544 -0
  177. package/src/services/logging/buffer.ts +104 -43
  178. package/src/services/logging/console.ts +9 -5
  179. package/src/services/logging/formatter.ts +74 -17
  180. package/src/services/logging/index.ts +0 -2
  181. package/src/services/logging/paths.ts +14 -0
  182. package/src/services/logging/raw-log.ts +43 -0
  183. package/src/services/process/index.ts +1 -1
  184. package/src/types/agent.ts +15 -0
  185. package/src/types/config.ts +25 -1
  186. package/src/types/event-categories.ts +663 -0
  187. package/src/types/events.ts +0 -25
  188. package/src/types/flow.ts +10 -6
  189. package/src/types/index.ts +50 -4
  190. package/src/types/lane.ts +1 -2
  191. package/src/types/logging.ts +2 -1
  192. package/src/types/task.ts +13 -2
  193. package/src/ui/log-viewer.ts +3 -0
  194. package/src/utils/config.ts +17 -1
  195. package/src/utils/cursor-agent.ts +68 -16
  196. package/src/utils/enhanced-logger.ts +106 -20
  197. package/src/utils/event-registry.ts +595 -0
  198. package/src/utils/events.ts +0 -16
  199. package/src/utils/flow.ts +84 -0
  200. package/src/utils/git.ts +59 -1
  201. package/src/utils/log-constants.ts +2 -1
  202. package/src/utils/log-formatter.ts +11 -12
  203. package/src/utils/logger.ts +49 -3
  204. package/src/utils/repro-thinking-logs.ts +0 -15
  205. package/src/utils/run-service.ts +1 -1
  206. package/dist/services/logging/file-writer.d.ts +0 -71
  207. package/dist/services/logging/file-writer.js +0 -516
  208. package/dist/services/logging/file-writer.js.map +0 -1
  209. package/dist/types/review.d.ts +0 -17
  210. package/dist/types/review.js +0 -6
  211. package/dist/types/review.js.map +0 -1
  212. package/scripts/ai-security-check.js +0 -233
  213. package/src/services/logging/file-writer.ts +0 -526
  214. package/src/types/review.ts +0 -20
@@ -0,0 +1,272 @@
1
+ #!/bin/bash
2
+ #
3
+ # verify-change.sh - Post-change verification script
4
+ #
5
+ # Runs a series of checks to verify that code changes don't break functionality.
6
+ # Use this after making changes to ensure everything still works.
7
+ #
8
+ # Usage:
9
+ # ./scripts/verify-change.sh # Run all checks
10
+ # ./scripts/verify-change.sh --quick # Skip slow tests
11
+ # ./scripts/verify-change.sh --smoke # Only run smoke tests
12
+ #
13
+
14
+ set -e
15
+
16
+ # Colors for output
17
+ RED='\033[0;31m'
18
+ GREEN='\033[0;32m'
19
+ YELLOW='\033[1;33m'
20
+ BLUE='\033[0;34m'
21
+ NC='\033[0m' # No Color
22
+
23
+ # Script directory
24
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
25
+ ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
26
+
27
+ # Parse arguments
28
+ QUICK_MODE=false
29
+ SMOKE_ONLY=false
30
+ VERBOSE=false
31
+
32
+ while [[ $# -gt 0 ]]; do
33
+ case $1 in
34
+ --quick|-q)
35
+ QUICK_MODE=true
36
+ shift
37
+ ;;
38
+ --smoke|-s)
39
+ SMOKE_ONLY=true
40
+ shift
41
+ ;;
42
+ --verbose|-v)
43
+ VERBOSE=true
44
+ shift
45
+ ;;
46
+ --help|-h)
47
+ echo "Usage: $0 [options]"
48
+ echo ""
49
+ echo "Options:"
50
+ echo " --quick, -q Skip slow tests (integration, e2e)"
51
+ echo " --smoke, -s Only run smoke tests"
52
+ echo " --verbose, -v Show detailed output"
53
+ echo " --help, -h Show this help message"
54
+ exit 0
55
+ ;;
56
+ *)
57
+ echo -e "${RED}Unknown option: $1${NC}"
58
+ exit 1
59
+ ;;
60
+ esac
61
+ done
62
+
63
+ # Logging functions
64
+ log_step() {
65
+ echo -e "\n${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
66
+ echo -e "${BLUE}▶ $1${NC}"
67
+ echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
68
+ }
69
+
70
+ log_success() {
71
+ echo -e "${GREEN}✓ $1${NC}"
72
+ }
73
+
74
+ log_error() {
75
+ echo -e "${RED}✗ $1${NC}"
76
+ }
77
+
78
+ log_warning() {
79
+ echo -e "${YELLOW}⚠ $1${NC}"
80
+ }
81
+
82
+ # Track results
83
+ RESULTS=()
84
+ FAILED=false
85
+
86
+ run_check() {
87
+ local name="$1"
88
+ local command="$2"
89
+
90
+ if $VERBOSE; then
91
+ echo -e "${YELLOW}Running: $command${NC}"
92
+ fi
93
+
94
+ if eval "$command"; then
95
+ log_success "$name"
96
+ RESULTS+=("✓ $name")
97
+ else
98
+ log_error "$name"
99
+ RESULTS+=("✗ $name")
100
+ FAILED=true
101
+ fi
102
+ }
103
+
104
+ cd "$ROOT_DIR"
105
+
106
+ echo -e "${BLUE}"
107
+ echo "╔═══════════════════════════════════════════════════════════╗"
108
+ echo "║ CursorFlow Change Verification ║"
109
+ echo "╚═══════════════════════════════════════════════════════════╝"
110
+ echo -e "${NC}"
111
+
112
+ # Step 1: TypeScript Compilation
113
+ log_step "Step 1: TypeScript Compilation"
114
+
115
+ BUILD_OUTPUT=$(mktemp)
116
+ if npm run build > "$BUILD_OUTPUT" 2>&1; then
117
+ log_success "TypeScript compilation passed"
118
+ RESULTS+=("✓ TypeScript compilation")
119
+ else
120
+ log_error "TypeScript compilation failed"
121
+ echo "Build output:"
122
+ cat "$BUILD_OUTPUT"
123
+ RESULTS+=("✗ TypeScript compilation")
124
+ FAILED=true
125
+ fi
126
+ rm -f "$BUILD_OUTPUT"
127
+
128
+ # Exit early if build failed
129
+ if $FAILED; then
130
+ log_error "Build failed, skipping further checks"
131
+ exit 1
132
+ fi
133
+
134
+ # Step 2: Lint Check (if available)
135
+ log_step "Step 2: Lint Check"
136
+ if command -v eslint &> /dev/null && [ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ]; then
137
+ run_check "ESLint" "npx eslint src/ --quiet 2>/dev/null || true"
138
+ else
139
+ log_warning "ESLint not configured, skipping"
140
+ RESULTS+=("⚠ ESLint (skipped)")
141
+ fi
142
+
143
+ # Step 3: Unit Tests (unless smoke-only mode)
144
+ if ! $SMOKE_ONLY; then
145
+ log_step "Step 3: Unit Tests"
146
+ run_check "Unit tests" "npm run test:unit -- --passWithNoTests --silent"
147
+ fi
148
+
149
+ # Step 4: CLI Smoke Tests
150
+ log_step "Step 4: CLI Smoke Tests"
151
+
152
+ # Test 1: Version command
153
+ echo -e "${YELLOW}Testing: cursorflow --version${NC}"
154
+ VERSION_OUTPUT=$(node dist/cli/index.js --version 2>&1 || true)
155
+ if echo "$VERSION_OUTPUT" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+'; then
156
+ log_success "Version command works"
157
+ RESULTS+=("✓ Version command")
158
+ else
159
+ log_error "Version command failed"
160
+ echo "Output: $VERSION_OUTPUT"
161
+ RESULTS+=("✗ Version command")
162
+ FAILED=true
163
+ fi
164
+
165
+ # Test 2: Help command
166
+ echo -e "${YELLOW}Testing: cursorflow --help${NC}"
167
+ HELP_OUTPUT=$(node dist/cli/index.js --help 2>&1 || true)
168
+ if echo "$HELP_OUTPUT" | grep -qiE 'usage|commands|options'; then
169
+ log_success "Help command works"
170
+ RESULTS+=("✓ Help command")
171
+ else
172
+ log_error "Help command failed"
173
+ echo "Output: $HELP_OUTPUT"
174
+ RESULTS+=("✗ Help command")
175
+ FAILED=true
176
+ fi
177
+
178
+ # Test 3: Doctor command (in a temp directory to avoid git issues)
179
+ echo -e "${YELLOW}Testing: cursorflow doctor${NC}"
180
+ TEMP_DIR=$(mktemp -d)
181
+ cd "$TEMP_DIR"
182
+ git init -q 2>/dev/null || true
183
+ git config user.email "test@test.com" 2>/dev/null || true
184
+ git config user.name "Test" 2>/dev/null || true
185
+ touch README.md
186
+ git add . 2>/dev/null || true
187
+ git commit -m "init" -q 2>/dev/null || true
188
+
189
+ DOCTOR_OUTPUT=$(node "$ROOT_DIR/dist/cli/index.js" doctor 2>&1 || true)
190
+ cd "$ROOT_DIR"
191
+ rm -rf "$TEMP_DIR"
192
+
193
+ # Doctor should produce some output (even if checks fail)
194
+ if [ -n "$DOCTOR_OUTPUT" ] && ! echo "$DOCTOR_OUTPUT" | grep -qiE 'undefined is not|cannot read'; then
195
+ log_success "Doctor command works"
196
+ RESULTS+=("✓ Doctor command")
197
+ else
198
+ log_error "Doctor command has runtime errors"
199
+ echo "Output: $DOCTOR_OUTPUT"
200
+ RESULTS+=("✗ Doctor command")
201
+ FAILED=true
202
+ fi
203
+
204
+ # Step 5: Output Format Verification
205
+ log_step "Step 5: Output Format Verification"
206
+
207
+ # Check for common issues in CLI output
208
+ check_output_format() {
209
+ local cmd="$1"
210
+ local name="$2"
211
+
212
+ OUTPUT=$(node dist/cli/index.js $cmd 2>&1 || true)
213
+
214
+ # Check for runtime errors
215
+ if echo "$OUTPUT" | grep -qiE 'undefined is not|cannot read propert|null is not'; then
216
+ log_error "$name has JavaScript runtime errors"
217
+ return 1
218
+ fi
219
+
220
+ # Check for unhandled stack traces (but allow intentional error messages)
221
+ if echo "$OUTPUT" | grep -qE 'at\s+Object\.<anonymous>|at\s+Module\._compile'; then
222
+ log_warning "$name may have unhandled errors (stack trace detected)"
223
+ fi
224
+
225
+ return 0
226
+ }
227
+
228
+ run_check "Version output format" "check_output_format '--version' 'Version'"
229
+ run_check "Help output format" "check_output_format '--help' 'Help'"
230
+
231
+ # Step 6: Integration Tests (unless quick or smoke-only mode)
232
+ if ! $QUICK_MODE && ! $SMOKE_ONLY; then
233
+ log_step "Step 6: Integration Tests"
234
+ run_check "Integration tests" "npm run test:integration -- --passWithNoTests 2>/dev/null || true"
235
+ fi
236
+
237
+ # Step 7: Jest Smoke Tests
238
+ log_step "Step 7: Jest Smoke Tests"
239
+ if [ -f "tests/smoke/smoke.test.ts" ]; then
240
+ run_check "Jest smoke tests" "npx jest tests/smoke --passWithNoTests --runInBand 2>/dev/null"
241
+ else
242
+ log_warning "Smoke test file not found"
243
+ RESULTS+=("⚠ Jest smoke tests (skipped)")
244
+ fi
245
+
246
+ # Summary
247
+ echo -e "\n${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
248
+ echo -e "${BLUE} VERIFICATION SUMMARY ${NC}"
249
+ echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
250
+
251
+ for result in "${RESULTS[@]}"; do
252
+ if [[ "$result" == ✓* ]]; then
253
+ echo -e "${GREEN}$result${NC}"
254
+ elif [[ "$result" == ✗* ]]; then
255
+ echo -e "${RED}$result${NC}"
256
+ else
257
+ echo -e "${YELLOW}$result${NC}"
258
+ fi
259
+ done
260
+
261
+ echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
262
+
263
+ if $FAILED; then
264
+ echo -e "\n${RED}❌ Verification FAILED${NC}"
265
+ echo -e "${RED}Some checks did not pass. Please fix the issues before committing.${NC}"
266
+ exit 1
267
+ else
268
+ echo -e "\n${GREEN}✅ All verifications PASSED${NC}"
269
+ echo -e "${GREEN}Your changes look good!${NC}"
270
+ exit 0
271
+ fi
272
+
package/src/cli/logs.ts CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  JsonLogEntry
15
15
  } from '../utils/enhanced-logger';
16
16
  import { formatPotentialJsonMessage } from '../utils/log-formatter';
17
+ import { MAIN_LOG_FILENAME } from '../utils/log-constants';
17
18
  import { startLogViewer } from '../ui/log-viewer';
18
19
 
19
20
  interface LogsOptions {
@@ -44,13 +45,13 @@ function printHelp(): void {
44
45
  console.log(`
45
46
  Usage: cursorflow logs [run-dir] [options]
46
47
 
47
- View and export lane logs.
48
+ View and export logs.
48
49
 
49
50
  Options:
50
51
  [run-dir] Run directory (default: latest)
51
52
  --run <id> Specific run directory
52
- --lane <name> Filter to specific lane
53
- --all, -a View all lanes merged (sorted by timestamp)
53
+ --lane <name> View a specific lane (subprocess) log
54
+ --all, -a View all lane logs merged (sorted by timestamp)
54
55
  --format <fmt> Output format: text, json, markdown, html (default: text)
55
56
  --output <path> Write output to file instead of stdout
56
57
  --tail <n> Show last n lines/entries (default: all)
@@ -58,13 +59,13 @@ Options:
58
59
  --interactive, -i Open interactive log viewer
59
60
  --filter <pattern> Filter entries by regex pattern
60
61
  --level <level> Filter by log level: stdout, stderr, info, error, debug
61
- --readable, -r Show readable log (parsed AI output) (default)
62
- --clean Show clean terminal logs without ANSI codes
62
+ --readable, -r Show readable lane log (parsed AI output) (default for lanes)
63
+ --clean Strip ANSI codes (default is raw for main logs)
63
64
  --raw Show raw terminal logs with ANSI codes
64
65
  --help, -h Show help
65
66
 
66
67
  Examples:
67
- cursorflow logs # View latest run logs summary
68
+ cursorflow logs # View latest run main log (raw)
68
69
  cursorflow logs --lane api-setup # View readable parsed log (default)
69
70
  cursorflow logs --lane api-setup --clean # View clean terminal logs
70
71
  cursorflow logs --all # View all lanes merged by time
@@ -195,6 +196,35 @@ function displayTextLogs(
195
196
  console.log(lines.join('\n'));
196
197
  }
197
198
 
199
+ /**
200
+ * Read and display main process logs
201
+ */
202
+ function displayMainLogs(runDir: string, options: LogsOptions): void {
203
+ const logFile = safeJoin(runDir, MAIN_LOG_FILENAME);
204
+ if (!fs.existsSync(logFile)) {
205
+ console.log('No main log file found.');
206
+ return;
207
+ }
208
+
209
+ let content = fs.readFileSync(logFile, 'utf8');
210
+ let lines = content.split('\n');
211
+
212
+ if (options.filter) {
213
+ const filterLower = options.filter.toLowerCase();
214
+ lines = lines.filter(line => line.toLowerCase().includes(filterLower));
215
+ }
216
+
217
+ if (options.tail && lines.length > options.tail) {
218
+ lines = lines.slice(-options.tail);
219
+ }
220
+
221
+ if (options.clean) {
222
+ lines = lines.map(line => stripAnsi(line));
223
+ }
224
+
225
+ console.log(lines.join('\n'));
226
+ }
227
+
198
228
  /**
199
229
  * Read and display JSON logs
200
230
  */
@@ -751,6 +781,68 @@ function followLogs(laneDir: string, options: LogsOptions): void {
751
781
  });
752
782
  }
753
783
 
784
+ /**
785
+ * Follow main process log in real-time
786
+ */
787
+ function followMainLogs(runDir: string, options: LogsOptions): void {
788
+ const logFile = safeJoin(runDir, MAIN_LOG_FILENAME);
789
+
790
+ if (!fs.existsSync(logFile)) {
791
+ console.log('Waiting for main log file...');
792
+ }
793
+
794
+ let lastSize = 0;
795
+ try {
796
+ lastSize = fs.statSync(logFile).size;
797
+ } catch {
798
+ lastSize = 0;
799
+ }
800
+
801
+ console.log(`${logger.COLORS.cyan}Following ${logFile}... (Ctrl+C to stop)${logger.COLORS.reset}\n`);
802
+
803
+ const checkInterval = setInterval(() => {
804
+ let fd: number | null = null;
805
+ try {
806
+ fd = fs.openSync(logFile, 'r');
807
+ const stats = fs.fstatSync(fd);
808
+ if (stats.size > lastSize) {
809
+ const buffer = Buffer.alloc(stats.size - lastSize);
810
+ fs.readSync(fd, buffer, 0, buffer.length, lastSize);
811
+
812
+ let content = buffer.toString();
813
+
814
+ if (options.filter) {
815
+ const filterLower = options.filter.toLowerCase();
816
+ const lines = content.split('\n');
817
+ content = lines.filter(line => line.toLowerCase().includes(filterLower)).join('\n');
818
+ }
819
+
820
+ if (options.clean) {
821
+ content = stripAnsi(content);
822
+ }
823
+
824
+ if (content.trim()) {
825
+ process.stdout.write(content);
826
+ }
827
+
828
+ lastSize = stats.size;
829
+ }
830
+ } catch {
831
+ // Ignore errors (file might be rotating)
832
+ } finally {
833
+ if (fd !== null) {
834
+ try { fs.closeSync(fd); } catch { /* ignore */ }
835
+ }
836
+ }
837
+ }, 100);
838
+
839
+ process.on('SIGINT', () => {
840
+ clearInterval(checkInterval);
841
+ console.log('\n\nStopped following logs.');
842
+ process.exit(0);
843
+ });
844
+ }
845
+
754
846
  /**
755
847
  * Display logs summary for all lanes
756
848
  */
@@ -865,10 +957,30 @@ async function logs(args: string[]): Promise<void> {
865
957
  return;
866
958
  }
867
959
 
868
- // If no lane specified, show summary
960
+ // If no lane specified, show main process log by default
869
961
  if (!options.lane) {
870
- displaySummary(runDir);
871
- console.log(`${logger.COLORS.gray}Use --lane <name> to view logs (default: readable), --clean for terminal logs, or --all to view all lanes merged${logger.COLORS.reset}`);
962
+ if (options.follow) {
963
+ followMainLogs(runDir, options);
964
+ return;
965
+ }
966
+
967
+ if (options.output) {
968
+ const logFile = safeJoin(runDir, MAIN_LOG_FILENAME);
969
+ if (!fs.existsSync(logFile)) {
970
+ console.log('No main log file found.');
971
+ return;
972
+ }
973
+ let content = fs.readFileSync(logFile, 'utf8');
974
+ if (options.clean) {
975
+ content = stripAnsi(content);
976
+ }
977
+ fs.writeFileSync(options.output, content, 'utf8');
978
+ console.log(`Exported main log to: ${options.output}`);
979
+ return;
980
+ }
981
+
982
+ displayMainLogs(runDir, options);
983
+ console.log(`${logger.COLORS.gray}Use --lane <name> for lane logs, --all to merge lanes, or --clean to strip ANSI codes.${logger.COLORS.reset}`);
872
984
  return;
873
985
  }
874
986
 
@@ -904,4 +1016,3 @@ async function logs(args: string[]): Promise<void> {
904
1016
  }
905
1017
 
906
1018
  export = logs;
907
-
package/src/cli/models.ts CHANGED
@@ -9,16 +9,33 @@ import { getAvailableModels } from '../utils/cursor-agent';
9
9
 
10
10
  /**
11
11
  * Model details metadata
12
+ * Reference: docs/CURSOR_AGENT_GUIDE.md (2025.12 version)
12
13
  */
13
14
  const MODEL_METADATA: Record<string, { name: string; provider: string; description: string }> = {
15
+ // Special modes
16
+ 'composer-1': { name: 'Composer 1', provider: 'Cursor', description: 'Multi-file orchestration mode' },
17
+ 'auto': { name: 'Auto', provider: 'Cursor', description: 'Automatic model selection' },
18
+ // Anthropic Claude models
14
19
  'sonnet-4.5': { name: 'Claude 3.7 Sonnet', provider: 'Anthropic', description: 'General implementation, fast work (Most versatile)' },
15
- 'sonnet-4.5-thinking': { name: 'Claude 3.7 Sonnet (Thinking)', provider: 'Anthropic', description: 'Code review, deeper reasoning (Thinking model)' },
20
+ 'sonnet-4.5-thinking': { name: 'Claude 3.7 Sonnet (Thinking)', provider: 'Anthropic', description: 'Deeper reasoning (Thinking model)' },
16
21
  'opus-4.5': { name: 'Claude 4.0 Opus', provider: 'Anthropic', description: 'Complex tasks, high quality (Advanced)' },
17
22
  'opus-4.5-thinking': { name: 'Claude 4.0 Opus (Thinking)', provider: 'Anthropic', description: 'Architecture design (Premium)' },
23
+ 'opus-4.1': { name: 'Claude 4.1 Opus', provider: 'Anthropic', description: 'Latest Opus model' },
24
+ // Google Gemini models
25
+ 'gemini-3-flash': { name: 'Gemini 3 Flash', provider: 'Google', description: 'Fast, general tasks (Default)' },
26
+ 'gemini-3-pro': { name: 'Gemini 3 Pro', provider: 'Google', description: 'Advanced reasoning (High performance)' },
27
+ // OpenAI GPT models
18
28
  'gpt-5.2': { name: 'GPT-5.2', provider: 'OpenAI', description: 'General tasks' },
19
29
  'gpt-5.2-high': { name: 'GPT-5.2 High Reasoning', provider: 'OpenAI', description: 'Advanced reasoning (High performance)' },
20
- 'gemini-3-flash': { name: 'Gemini 3 Flash', provider: 'Google', description: 'General tasks' },
21
- 'gemini-3-pro': { name: 'Gemini 3 Pro', provider: 'Google', description: 'Advanced reasoning (High performance)' }
30
+ 'gpt-5.1': { name: 'GPT-5.1', provider: 'OpenAI', description: 'General tasks' },
31
+ 'gpt-5.1-high': { name: 'GPT-5.1 High Reasoning', provider: 'OpenAI', description: 'Advanced reasoning' },
32
+ // OpenAI Codex models
33
+ 'gpt-5.1-codex': { name: 'GPT-5.1 Codex', provider: 'OpenAI', description: 'Code-optimized model' },
34
+ 'gpt-5.1-codex-high': { name: 'GPT-5.1 Codex High', provider: 'OpenAI', description: 'Code-optimized (High performance)' },
35
+ 'gpt-5.1-codex-max': { name: 'GPT-5.1 Codex Max', provider: 'OpenAI', description: 'Code-optimized (Maximum)' },
36
+ 'gpt-5.1-codex-max-high': { name: 'GPT-5.1 Codex Max High', provider: 'OpenAI', description: 'Code-optimized (Maximum, High performance)' },
37
+ // xAI
38
+ 'grok': { name: 'Grok', provider: 'xAI', description: 'xAI Grok model' },
22
39
  };
23
40
 
24
41
  function printHelp(): void {