@litmers/cursorflow-orchestrator 0.1.15 → 0.1.18

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 (59) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +1 -0
  3. package/commands/cursorflow-run.md +2 -0
  4. package/commands/cursorflow-triggers.md +250 -0
  5. package/dist/cli/clean.js +1 -1
  6. package/dist/cli/clean.js.map +1 -1
  7. package/dist/cli/init.js +13 -8
  8. package/dist/cli/init.js.map +1 -1
  9. package/dist/cli/logs.js +24 -15
  10. package/dist/cli/logs.js.map +1 -1
  11. package/dist/cli/monitor.js +12 -3
  12. package/dist/cli/monitor.js.map +1 -1
  13. package/dist/cli/prepare.js +36 -13
  14. package/dist/cli/prepare.js.map +1 -1
  15. package/dist/cli/resume.js.map +1 -1
  16. package/dist/core/orchestrator.js +10 -6
  17. package/dist/core/orchestrator.js.map +1 -1
  18. package/dist/core/reviewer.d.ts +6 -4
  19. package/dist/core/reviewer.js +7 -5
  20. package/dist/core/reviewer.js.map +1 -1
  21. package/dist/core/runner.d.ts +8 -0
  22. package/dist/core/runner.js +166 -14
  23. package/dist/core/runner.js.map +1 -1
  24. package/dist/utils/config.js +13 -4
  25. package/dist/utils/config.js.map +1 -1
  26. package/dist/utils/doctor.js +28 -1
  27. package/dist/utils/doctor.js.map +1 -1
  28. package/dist/utils/enhanced-logger.d.ts +2 -2
  29. package/dist/utils/enhanced-logger.js +102 -34
  30. package/dist/utils/enhanced-logger.js.map +1 -1
  31. package/dist/utils/repro-thinking-logs.d.ts +1 -0
  32. package/dist/utils/repro-thinking-logs.js +80 -0
  33. package/dist/utils/repro-thinking-logs.js.map +1 -0
  34. package/dist/utils/types.d.ts +12 -0
  35. package/dist/utils/webhook.js +3 -0
  36. package/dist/utils/webhook.js.map +1 -1
  37. package/package.json +4 -2
  38. package/scripts/ai-security-check.js +3 -0
  39. package/scripts/local-security-gate.sh +9 -1
  40. package/scripts/verify-and-fix.sh +37 -0
  41. package/src/cli/clean.ts +1 -1
  42. package/src/cli/init.ts +12 -9
  43. package/src/cli/logs.ts +25 -15
  44. package/src/cli/monitor.ts +13 -4
  45. package/src/cli/prepare.ts +36 -15
  46. package/src/cli/resume.ts +1 -1
  47. package/src/core/orchestrator.ts +10 -6
  48. package/src/core/reviewer.ts +14 -9
  49. package/src/core/runner.ts +173 -15
  50. package/src/utils/config.ts +12 -5
  51. package/src/utils/doctor.ts +31 -1
  52. package/src/utils/enhanced-logger.ts +105 -40
  53. package/src/utils/repro-thinking-logs.ts +54 -0
  54. package/src/utils/types.ts +12 -0
  55. package/src/utils/webhook.ts +3 -0
  56. package/scripts/simple-logging-test.sh +0 -97
  57. package/scripts/test-real-cursor-lifecycle.sh +0 -289
  58. package/scripts/test-real-logging.sh +0 -289
  59. package/scripts/test-streaming-multi-task.sh +0 -247
@@ -1,247 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # Comprehensive Streaming Output Test with Multi-Task Dependencies
4
- #
5
- # This test verifies:
6
- # 1. Streaming output from cursor-agent (not just final JSON)
7
- # 2. Multiple tasks execution in sequence
8
- # 3. Dependency handling between tasks
9
- # 4. Raw log capture and parsed log quality
10
- #
11
-
12
- set -e
13
-
14
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
- PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
16
-
17
- # Colors
18
- RED='\033[0;31m'
19
- GREEN='\033[0;32m'
20
- YELLOW='\033[1;33m'
21
- CYAN='\033[0;36m'
22
- MAGENTA='\033[0;35m'
23
- NC='\033[0m'
24
-
25
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
26
- echo -e "${CYAN} 🧪 Streaming Multi-Task Test${NC}"
27
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
28
- echo ""
29
-
30
- # Check cursor-agent
31
- if ! command -v cursor-agent &> /dev/null; then
32
- echo -e "${RED}❌ cursor-agent not found${NC}"
33
- exit 1
34
- fi
35
-
36
- # Check auth
37
- echo -e "${YELLOW}Checking cursor-agent authentication...${NC}"
38
- if ! cursor-agent create-chat &> /dev/null; then
39
- echo -e "${RED}❌ cursor-agent authentication failed${NC}"
40
- exit 1
41
- fi
42
- echo -e "${GREEN}✓ cursor-agent authenticated${NC}"
43
-
44
- cd "$PROJECT_ROOT"
45
-
46
- # Build
47
- echo -e "${YELLOW}Building project...${NC}"
48
- npm run build > /dev/null 2>&1
49
- echo -e "${GREEN}✓ Build complete${NC}"
50
-
51
- # Setup test directory
52
- TEST_DIR="$PROJECT_ROOT/_test-streaming"
53
- rm -rf "$TEST_DIR"
54
- mkdir -p "$TEST_DIR/lane"
55
-
56
- # Create multi-task configuration with dependencies
57
- cat > "$TEST_DIR/multi-task.json" << 'EOF'
58
- {
59
- "baseBranch": "main",
60
- "branchPrefix": "test/stream-",
61
- "timeout": 120000,
62
- "dependencyPolicy": {
63
- "allowDependencyChange": false,
64
- "lockfileReadOnly": true
65
- },
66
- "tasks": [
67
- {
68
- "name": "task-1-analyze",
69
- "prompt": "Analyze this codebase. List the top 3 most important files and briefly explain what each does. Keep your response under 200 words. Do not make any file changes.",
70
- "model": "sonnet-4.5"
71
- },
72
- {
73
- "name": "task-2-summary",
74
- "prompt": "Based on your previous analysis, write a 2-sentence summary of what this project does. Do not make any file changes.",
75
- "model": "sonnet-4.5"
76
- }
77
- ]
78
- }
79
- EOF
80
-
81
- echo -e "${GREEN}✓ Test configuration created (2 tasks)${NC}"
82
- echo ""
83
-
84
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
85
- echo -e "${CYAN} Running orchestration with STREAMING enabled...${NC}"
86
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
87
- echo ""
88
-
89
- LANE_DIR="$TEST_DIR/lane"
90
-
91
- # Run spawnLane directly to test streaming
92
- node -e "
93
- const { spawnLane, waitChild } = require('./dist/core/orchestrator');
94
- const fs = require('fs');
95
- const path = require('path');
96
-
97
- const tasksFile = path.join('$TEST_DIR', 'multi-task.json');
98
- const laneRunDir = '$LANE_DIR';
99
-
100
- console.log('Spawning lane with streaming output enabled...');
101
- console.log('');
102
-
103
- const result = spawnLane({
104
- laneName: 'stream-test',
105
- tasksFile,
106
- laneRunDir,
107
- executor: 'cursor-agent',
108
- startIndex: 0,
109
- enhancedLogConfig: {
110
- enabled: true,
111
- stripAnsi: true,
112
- streamOutput: true, // Enable streaming!
113
- addTimestamps: true,
114
- keepRawLogs: true,
115
- writeJsonLog: true,
116
- timestampFormat: 'iso',
117
- },
118
- });
119
-
120
- console.log('Lane spawned, PID:', result.child.pid);
121
- console.log('Waiting for completion (may take 2-3 minutes)...');
122
- console.log('');
123
-
124
- const timeout = setTimeout(() => {
125
- console.log('\\nTimeout reached (3 min)');
126
- result.child.kill('SIGTERM');
127
- }, 180000);
128
-
129
- waitChild(result.child).then((code) => {
130
- clearTimeout(timeout);
131
- console.log('');
132
- console.log('Lane completed with exit code:', code);
133
- result.logManager?.close();
134
- process.exit(code === 0 ? 0 : 1);
135
- }).catch(e => {
136
- clearTimeout(timeout);
137
- console.error('Error:', e);
138
- process.exit(1);
139
- });
140
- " 2>&1
141
-
142
- EXIT_CODE=$?
143
-
144
- echo ""
145
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
146
- echo -e "${CYAN} 📋 Log File Analysis${NC}"
147
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
148
- echo ""
149
-
150
- # Check files
151
- echo -e "${YELLOW}Log files created:${NC}"
152
- ls -la "$LANE_DIR"/*.log "$LANE_DIR"/*.jsonl 2>/dev/null || echo "No log files found"
153
- echo ""
154
-
155
- # Count streaming entries in JSON log
156
- if [ -f "$LANE_DIR/terminal.jsonl" ]; then
157
- TOTAL_ENTRIES=$(wc -l < "$LANE_DIR/terminal.jsonl")
158
- STDOUT_ENTRIES=$(grep -c '"level":"stdout"' "$LANE_DIR/terminal.jsonl" || echo "0")
159
- STREAMING_ENTRIES=$(grep -c '"type":' "$LANE_DIR/terminal.jsonl" || echo "0")
160
-
161
- echo -e "${YELLOW}JSON Log Statistics:${NC}"
162
- echo " Total entries: $TOTAL_ENTRIES"
163
- echo " stdout entries: $STDOUT_ENTRIES"
164
- echo " Entries with streaming 'type': $STREAMING_ENTRIES"
165
- echo ""
166
- fi
167
-
168
- # Check for streaming content markers in raw log
169
- if [ -f "$LANE_DIR/terminal-raw.log" ]; then
170
- RAW_SIZE=$(wc -c < "$LANE_DIR/terminal-raw.log")
171
- RAW_LINES=$(wc -l < "$LANE_DIR/terminal-raw.log")
172
-
173
- # Look for streaming indicators
174
- HAS_TYPE_TEXT=$(grep -c '"type":"text"' "$LANE_DIR/terminal-raw.log" 2>/dev/null || echo "0")
175
- HAS_TYPE_RESULT=$(grep -c '"type":"result"' "$LANE_DIR/terminal-raw.log" 2>/dev/null || echo "0")
176
- HAS_CONTENT=$(grep -c '"content":' "$LANE_DIR/terminal-raw.log" 2>/dev/null || echo "0")
177
-
178
- echo -e "${YELLOW}Raw Log Statistics:${NC}"
179
- echo " Size: $RAW_SIZE bytes"
180
- echo " Lines: $RAW_LINES"
181
- echo ""
182
- echo -e "${YELLOW}Streaming Markers Found:${NC}"
183
- echo " type:'text' entries: $HAS_TYPE_TEXT"
184
- echo " type:'result' entries: $HAS_TYPE_RESULT"
185
- echo " content entries: $HAS_CONTENT"
186
- echo ""
187
- fi
188
-
189
- # Show sample of streaming output
190
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
191
- echo -e "${CYAN} 📝 Sample Streaming Output (first 30 lines of stdout)${NC}"
192
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
193
- echo ""
194
-
195
- if [ -f "$LANE_DIR/terminal.log" ]; then
196
- # Show lines containing cursor-agent output (streaming JSON)
197
- echo -e "${MAGENTA}Looking for streaming JSON output...${NC}"
198
- grep -E '^\[.*\] \{"type":' "$LANE_DIR/terminal.log" | head -20 || echo "No streaming JSON found"
199
- echo ""
200
- fi
201
-
202
- # Test the logs CLI command
203
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
204
- echo -e "${CYAN} 🔍 Testing cursorflow logs command${NC}"
205
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
206
- echo ""
207
-
208
- # Create a fake runs directory structure for the CLI
209
- FAKE_RUN_DIR="$TEST_DIR/runs/run-test"
210
- mkdir -p "$FAKE_RUN_DIR/lanes"
211
- ln -sf "$LANE_DIR" "$FAKE_RUN_DIR/lanes/stream-test"
212
-
213
- echo -e "${YELLOW}Testing: cursorflow logs --tail 15${NC}"
214
- node dist/cli/index.js logs "$FAKE_RUN_DIR" --tail 15 2>&1 || true
215
-
216
- echo ""
217
- echo -e "${YELLOW}Testing: cursorflow logs --filter 'type.*text'${NC}"
218
- node dist/cli/index.js logs "$FAKE_RUN_DIR" --filter '"type":"text"' --tail 10 2>&1 || true
219
-
220
- echo ""
221
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
222
- echo -e "${CYAN} 📊 Test Summary${NC}"
223
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
224
- echo ""
225
-
226
- # Determine if streaming worked
227
- if [ "$HAS_TYPE_TEXT" -gt "0" ] || [ "$HAS_CONTENT" -gt "10" ]; then
228
- echo -e "${GREEN}✅ Streaming output captured successfully!${NC}"
229
- echo " Found $HAS_TYPE_TEXT text stream entries"
230
- echo " Found $HAS_CONTENT content entries"
231
- else
232
- echo -e "${YELLOW}⚠️ Limited streaming content detected${NC}"
233
- echo " This may indicate:"
234
- echo " - stream-json format not outputting expected data"
235
- echo " - Or cursor-agent only provides final results"
236
- fi
237
-
238
- echo ""
239
- echo "Log files saved at: $LANE_DIR"
240
- echo ""
241
-
242
- # Cleanup git
243
- git worktree remove _cursorflow/worktrees/test/stream-* --force 2>/dev/null || true
244
- git branch -D $(git branch | grep "test/stream-") 2>/dev/null || true
245
-
246
- exit $EXIT_CODE
247
-