@sylphx/flow 0.2.13 → 1.0.1
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.
- package/CHANGELOG.md +318 -0
- package/LOOP_MODE.md +446 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +59398 -698
- package/dist/lancedb.linux-x64-gnu-b7f0jgsz.node +0 -0
- package/dist/lancedb.linux-x64-musl-tgcv22rx.node +0 -0
- package/dist/shared/chunk-25dwp0dp.js +89 -0
- package/dist/shared/chunk-3pjb6063.js +208 -0
- package/dist/shared/chunk-4d6ydpw7.js +2854 -0
- package/dist/shared/chunk-4wjcadjk.js +225 -0
- package/dist/shared/chunk-5j4w74t6.js +30 -0
- package/dist/shared/chunk-5j8m3dh3.js +58 -0
- package/dist/shared/chunk-5thh3qem.js +91 -0
- package/dist/shared/chunk-6g9xy73m.js +252 -0
- package/dist/shared/chunk-7eq34c42.js +23 -0
- package/dist/shared/chunk-c2gwgx3r.js +115 -0
- package/dist/shared/chunk-cjd3mk4c.js +1320 -0
- package/dist/shared/chunk-g5cv6703.js +368 -0
- package/dist/shared/chunk-hpkhykhq.js +574 -0
- package/dist/shared/chunk-m2322pdk.js +122 -0
- package/dist/shared/chunk-nd5fdvaq.js +26 -0
- package/dist/shared/chunk-pgd3m6zf.js +108 -0
- package/dist/shared/chunk-qk8n91hw.js +494 -0
- package/dist/shared/chunk-rkkn8szp.js +16855 -0
- package/dist/shared/chunk-t16rfxh0.js +61 -0
- package/dist/shared/chunk-t4fbfa5v.js +19 -0
- package/dist/shared/chunk-t77h86w6.js +276 -0
- package/dist/shared/chunk-v0ez4aef.js +71 -0
- package/dist/shared/chunk-v29j2r3s.js +32051 -0
- package/dist/shared/chunk-vfbc6ew5.js +765 -0
- package/dist/shared/chunk-vmeqwm1c.js +204 -0
- package/dist/shared/chunk-x66eh37x.js +137 -0
- package/package.json +45 -93
- package/README.md +0 -625
- package/assets/agents/coder.md +0 -32
- package/assets/agents/orchestrator.md +0 -36
- package/assets/agents/reviewer.md +0 -30
- package/assets/agents/writer.md +0 -30
- package/assets/knowledge/data/sql.md +0 -216
- package/assets/knowledge/guides/saas-template.md +0 -85
- package/assets/knowledge/guides/system-prompt.md +0 -344
- package/assets/knowledge/guides/tech-stack.md +0 -92
- package/assets/knowledge/guides/ui-ux.md +0 -44
- package/assets/knowledge/stacks/nextjs-app.md +0 -165
- package/assets/knowledge/stacks/node-api.md +0 -220
- package/assets/knowledge/stacks/react-app.md +0 -232
- package/assets/knowledge/universal/deployment.md +0 -109
- package/assets/knowledge/universal/performance.md +0 -121
- package/assets/knowledge/universal/security.md +0 -79
- package/assets/knowledge/universal/testing.md +0 -111
- package/assets/output-styles/silent.md +0 -23
- package/assets/rules/core.md +0 -197
- package/assets/slash-commands/commit.md +0 -23
- package/assets/slash-commands/context.md +0 -112
- package/assets/slash-commands/explain.md +0 -35
- package/assets/slash-commands/mep.md +0 -63
- package/assets/slash-commands/review.md +0 -39
- package/assets/slash-commands/test.md +0 -30
- package/dist/assets/agents/coder.md +0 -32
- package/dist/assets/agents/orchestrator.md +0 -36
- package/dist/assets/agents/reviewer.md +0 -30
- package/dist/assets/agents/writer.md +0 -30
- package/dist/assets/knowledge/data/sql.md +0 -216
- package/dist/assets/knowledge/guides/saas-template.md +0 -85
- package/dist/assets/knowledge/guides/system-prompt.md +0 -344
- package/dist/assets/knowledge/guides/tech-stack.md +0 -92
- package/dist/assets/knowledge/guides/ui-ux.md +0 -44
- package/dist/assets/knowledge/stacks/nextjs-app.md +0 -165
- package/dist/assets/knowledge/stacks/node-api.md +0 -220
- package/dist/assets/knowledge/stacks/react-app.md +0 -232
- package/dist/assets/knowledge/universal/deployment.md +0 -109
- package/dist/assets/knowledge/universal/performance.md +0 -121
- package/dist/assets/knowledge/universal/security.md +0 -79
- package/dist/assets/knowledge/universal/testing.md +0 -111
- package/dist/assets/output-styles/silent.md +0 -23
- package/dist/assets/rules/core.md +0 -197
- package/dist/assets/slash-commands/commit.md +0 -23
- package/dist/assets/slash-commands/context.md +0 -112
- package/dist/assets/slash-commands/explain.md +0 -35
- package/dist/assets/slash-commands/mep.md +0 -63
- package/dist/assets/slash-commands/review.md +0 -39
- package/dist/assets/slash-commands/test.md +0 -30
- package/dist/chunk-01gv4qey.js +0 -4
- package/dist/chunk-01gv4qey.js.map +0 -11
- package/dist/chunk-1e8xf3f6.js +0 -27
- package/dist/chunk-1e8xf3f6.js.map +0 -23
- package/dist/chunk-3m9whg4q.js +0 -4
- package/dist/chunk-3m9whg4q.js.map +0 -9
- package/dist/chunk-3qxj0zy3.js +0 -23
- package/dist/chunk-3qxj0zy3.js.map +0 -11
- package/dist/chunk-3w6pd43t.js +0 -25
- package/dist/chunk-3w6pd43t.js.map +0 -61
- package/dist/chunk-4e5g3df9.js +0 -105
- package/dist/chunk-4e5g3df9.js.map +0 -27
- package/dist/chunk-4nm4ere4.js +0 -4
- package/dist/chunk-4nm4ere4.js.map +0 -11
- package/dist/chunk-4vrj3f8r.js +0 -26
- package/dist/chunk-4vrj3f8r.js.map +0 -75
- package/dist/chunk-5njgv5k5.js +0 -161
- package/dist/chunk-5njgv5k5.js.map +0 -83
- package/dist/chunk-67n29s4q.js +0 -7
- package/dist/chunk-67n29s4q.js.map +0 -10
- package/dist/chunk-7yyg008s.js +0 -27
- package/dist/chunk-7yyg008s.js.map +0 -14
- package/dist/chunk-86ce45n6.js +0 -3
- package/dist/chunk-86ce45n6.js.map +0 -10
- package/dist/chunk-99pz5wm0.js +0 -75
- package/dist/chunk-99pz5wm0.js.map +0 -12
- package/dist/chunk-cv1nhr27.js +0 -2
- package/dist/chunk-cv1nhr27.js.map +0 -9
- package/dist/chunk-g4baca7p.js +0 -10
- package/dist/chunk-g4baca7p.js.map +0 -23
- package/dist/chunk-gc66xe7z.js +0 -4
- package/dist/chunk-gc66xe7z.js.map +0 -11
- package/dist/chunk-hj6qtsqp.js +0 -15
- package/dist/chunk-hj6qtsqp.js.map +0 -10
- package/dist/chunk-jbd95k1f.js +0 -14
- package/dist/chunk-jbd95k1f.js.map +0 -20
- package/dist/chunk-jk1ebfqn.js +0 -23
- package/dist/chunk-jk1ebfqn.js.map +0 -132
- package/dist/chunk-kn908zkk.js +0 -4
- package/dist/chunk-kn908zkk.js.map +0 -10
- package/dist/chunk-mw13a082.js +0 -4
- package/dist/chunk-mw13a082.js.map +0 -10
- package/dist/chunk-n8vzewr3.js +0 -4
- package/dist/chunk-n8vzewr3.js.map +0 -12
- package/dist/chunk-nke51f3c.js +0 -4
- package/dist/chunk-nke51f3c.js.map +0 -10
- package/dist/chunk-ns5atzyz.js +0 -3
- package/dist/chunk-ns5atzyz.js.map +0 -10
- package/dist/chunk-q4nh3vst.js +0 -54
- package/dist/chunk-q4nh3vst.js.map +0 -53
- package/dist/chunk-q5gqgs0p.js +0 -4
- package/dist/chunk-q5gqgs0p.js.map +0 -10
- package/dist/chunk-qpej66sh.js +0 -6
- package/dist/chunk-qpej66sh.js.map +0 -11
- package/dist/chunk-s9bsh0gp.js +0 -4
- package/dist/chunk-s9bsh0gp.js.map +0 -10
- package/dist/chunk-waemzsf4.js +0 -4
- package/dist/chunk-waemzsf4.js.map +0 -10
- package/dist/chunk-wnhhwtsy.js +0 -19
- package/dist/chunk-wnhhwtsy.js.map +0 -11
- package/dist/chunk-xs370t8p.js +0 -119
- package/dist/chunk-xs370t8p.js.map +0 -26
- package/dist/chunk-xtrn4wn0.js +0 -3
- package/dist/chunk-xtrn4wn0.js.map +0 -10
- package/dist/index.js.map +0 -920
- package/drizzle/0000_wooden_lady_bullseye.sql +0 -52
- package/drizzle/0001_material_pyro.sql +0 -85
- package/drizzle/0002_lyrical_random.sql +0 -2
- package/drizzle/0003_romantic_lockjaw.sql +0 -4
- package/drizzle/0004_blushing_meteorite.sql +0 -6
- package/drizzle/meta/0000_snapshot.json +0 -310
- package/drizzle/meta/0001_snapshot.json +0 -906
- package/drizzle/meta/0002_snapshot.json +0 -920
- package/drizzle/meta/0003_snapshot.json +0 -920
- package/drizzle/meta/0004_snapshot.json +0 -921
- package/drizzle/meta/_journal.json +0 -41
package/LOOP_MODE.md
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
# 🔄 Loop Mode - Continuous Autonomous Execution
|
|
2
|
+
|
|
3
|
+
Loop mode enables the LLM to continuously execute the same task, automatically preserving context, until you manually stop it.
|
|
4
|
+
|
|
5
|
+
## 🎯 Core Concept
|
|
6
|
+
|
|
7
|
+
**Simple: Keep working on X until I stop you**
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun dev:flow "process all GitHub issues" --loop
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Behavior:**
|
|
14
|
+
1. Execute task (fresh start)
|
|
15
|
+
2. Immediately execute with `--continue` (preserve context)
|
|
16
|
+
3. Immediately execute with `--continue` again
|
|
17
|
+
4. ... infinite loop until Ctrl+C or max-runs
|
|
18
|
+
|
|
19
|
+
**With wait time:**
|
|
20
|
+
```bash
|
|
21
|
+
bun dev:flow "check for new issues" --loop 300
|
|
22
|
+
```
|
|
23
|
+
1. Execute task
|
|
24
|
+
2. Wait 300 seconds (5 minutes)
|
|
25
|
+
3. Execute with `--continue`
|
|
26
|
+
4. Wait 300 seconds
|
|
27
|
+
5. ... continue until stopped
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 🚀 Basic Usage
|
|
32
|
+
|
|
33
|
+
### Simplest - Use default (no wait time)
|
|
34
|
+
```bash
|
|
35
|
+
bun dev:flow "task" --loop
|
|
36
|
+
# Execute continuously with no wait between iterations
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Specify wait time
|
|
40
|
+
```bash
|
|
41
|
+
bun dev:flow "task" --loop 120
|
|
42
|
+
# Wait 120 seconds between each iteration
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Add safety limit
|
|
46
|
+
```bash
|
|
47
|
+
bun dev:flow "task" --loop 60 --max-runs 20
|
|
48
|
+
# Stop after 20 iterations
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Combined usage
|
|
52
|
+
```bash
|
|
53
|
+
# Default interval + max runs
|
|
54
|
+
bun dev:flow "task" --loop --max-runs 10
|
|
55
|
+
|
|
56
|
+
# Custom interval + max runs
|
|
57
|
+
bun dev:flow "task" --loop 300 --max-runs 5
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 💡 Use Cases
|
|
63
|
+
|
|
64
|
+
### 1. GitHub Issue Handling
|
|
65
|
+
```bash
|
|
66
|
+
bun dev:flow "check github issues and handle them one by one" --loop 300
|
|
67
|
+
# Check every 5 minutes, continuously process issues
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Code Review
|
|
71
|
+
```bash
|
|
72
|
+
bun dev:flow "review recent commits and provide feedback" --loop 3600
|
|
73
|
+
# Review new commits every hour
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 3. Documentation Updates
|
|
77
|
+
```bash
|
|
78
|
+
bun dev:flow "check if docs need update and fix them" --loop 1800
|
|
79
|
+
# Sync documentation every 30 minutes
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 4. Test Fixing
|
|
83
|
+
```bash
|
|
84
|
+
bun dev:flow "run tests, if fail try to fix" --loop 60 --max-runs 10
|
|
85
|
+
# Try up to 10 times, wait 60 seconds each time
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 5. Incremental Refactoring
|
|
89
|
+
```bash
|
|
90
|
+
bun dev:flow "continue refactoring legacy code" --loop 600 --max-runs 6
|
|
91
|
+
# Work every 10 minutes, total 1 hour
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 📚 API Reference
|
|
97
|
+
|
|
98
|
+
### `--loop [seconds]`
|
|
99
|
+
Enable loop mode with optional wait time between iterations
|
|
100
|
+
|
|
101
|
+
**Default:** 0 seconds (no wait - execute immediately after previous task completes)
|
|
102
|
+
|
|
103
|
+
**When to use wait time:**
|
|
104
|
+
- Rate limiting: Prevent hitting API limits
|
|
105
|
+
- Resource management: Give system time to recover
|
|
106
|
+
- Polling: Check for changes periodically
|
|
107
|
+
- Natural pacing: Space out operations
|
|
108
|
+
|
|
109
|
+
**Recommended values:**
|
|
110
|
+
- No wait: 0 seconds (default - for continuous work)
|
|
111
|
+
- Quick polling: 30-60 seconds
|
|
112
|
+
- Standard polling: 60-300 seconds (1-5 minutes)
|
|
113
|
+
- Long polling: 600-3600 seconds (10-60 minutes)
|
|
114
|
+
|
|
115
|
+
**Examples:**
|
|
116
|
+
```bash
|
|
117
|
+
--loop # No wait (immediate re-execution after task completes)
|
|
118
|
+
--loop 0 # Same as above
|
|
119
|
+
--loop 60 # Wait 60 seconds between iterations
|
|
120
|
+
--loop 300 # Wait 5 minutes between iterations
|
|
121
|
+
--loop 3600 # Wait 1 hour between iterations
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Note:** `[seconds]` is optional - defaults to 0 (no wait time)
|
|
125
|
+
|
|
126
|
+
**Why 0s default?**
|
|
127
|
+
- LLM tasks typically take 2-5 minutes
|
|
128
|
+
- Task execution time is already a natural interval
|
|
129
|
+
- No wasted idle time
|
|
130
|
+
- Add wait time only when needed (rate limits, polling, etc.)
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### `--max-runs <count>`
|
|
135
|
+
Maximum number of iterations (optional, default: infinite)
|
|
136
|
+
|
|
137
|
+
Purpose: Prevent forgetting to stop loop, or set work time limit
|
|
138
|
+
|
|
139
|
+
**Examples:**
|
|
140
|
+
```bash
|
|
141
|
+
--max-runs 10 # Maximum 10 iterations
|
|
142
|
+
--max-runs 100 # Maximum 100 iterations
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 🎨 Output Format
|
|
148
|
+
|
|
149
|
+
### Loop Start
|
|
150
|
+
```
|
|
151
|
+
━━━ 🔄 Loop Mode Activated
|
|
152
|
+
|
|
153
|
+
Wait time: 0s
|
|
154
|
+
Max runs: ∞
|
|
155
|
+
Stop: Ctrl+C or max-runs limit
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Each Iteration
|
|
159
|
+
```
|
|
160
|
+
🔄 Loop iteration 3/∞
|
|
161
|
+
Started: 14:32:15
|
|
162
|
+
|
|
163
|
+
[... task execution ...]
|
|
164
|
+
|
|
165
|
+
⏳ Waiting 0s until next run... (completed: 3/∞)
|
|
166
|
+
```
|
|
167
|
+
or with wait time:
|
|
168
|
+
```
|
|
169
|
+
⏳ Waiting 60s until next run... (completed: 3/∞)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Loop End
|
|
173
|
+
```
|
|
174
|
+
⚠️ Interrupt received - finishing current iteration...
|
|
175
|
+
|
|
176
|
+
━━━ 🏁 Loop Summary
|
|
177
|
+
|
|
178
|
+
Total iterations: 5
|
|
179
|
+
Successful: 4
|
|
180
|
+
Errors: 1
|
|
181
|
+
Duration: 5m 30s
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 🛡️ Safety Features
|
|
187
|
+
|
|
188
|
+
### 1. Graceful Shutdown
|
|
189
|
+
Press `Ctrl+C` to stop gracefully:
|
|
190
|
+
- Complete current iteration
|
|
191
|
+
- Display summary
|
|
192
|
+
- Clean up resources
|
|
193
|
+
|
|
194
|
+
### 2. Error Resilience
|
|
195
|
+
Continues execution when encountering errors (won't stop):
|
|
196
|
+
```
|
|
197
|
+
⚠️ Task encountered error (continuing...)
|
|
198
|
+
Error: API rate limit
|
|
199
|
+
|
|
200
|
+
⏳ Waiting 60s until next run...
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 3. Auto-headless Mode
|
|
204
|
+
Loop mode automatically enables headless mode:
|
|
205
|
+
- No interactive prompts
|
|
206
|
+
- Output only
|
|
207
|
+
- Suitable for background execution
|
|
208
|
+
|
|
209
|
+
### 4. Context Persistence
|
|
210
|
+
**First iteration:** Fresh start
|
|
211
|
+
**2nd+ iterations:** Auto `--continue` (LLM builds on previous work)
|
|
212
|
+
|
|
213
|
+
This allows the LLM to continuously improve without repeating the same work.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 📊 Work Time Calculation
|
|
218
|
+
|
|
219
|
+
**Note:** These estimates assume ~2-3 minutes average task execution time + wait time between iterations.
|
|
220
|
+
|
|
221
|
+
| Wait Time | Max Runs | Approx Total Time |
|
|
222
|
+
|-----------|----------|-------------------|
|
|
223
|
+
| 0s (no wait) | 10 | ~20-30 minutes (task time only) |
|
|
224
|
+
| 0s (no wait) | 30 | ~1-1.5 hours (task time only) |
|
|
225
|
+
| 60s wait | 10 | ~30-40 minutes (task + wait) |
|
|
226
|
+
| 60s wait | 30 | ~1.5-2 hours (task + wait) |
|
|
227
|
+
| 300s (5min) | 12 | ~2-3 hours |
|
|
228
|
+
| 600s (10min) | 6 | ~1.5-2 hours |
|
|
229
|
+
| 3600s (1 hour) | 8 | ~8-9 hours |
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## 🎯 Best Practices
|
|
234
|
+
|
|
235
|
+
### ✅ DO
|
|
236
|
+
|
|
237
|
+
1. **Use default (0s) for most cases**
|
|
238
|
+
```bash
|
|
239
|
+
--loop # No wait - continuous execution
|
|
240
|
+
--loop 60 # Add wait time if needed (e.g., API rate limits, polling)
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
2. **Use max-runs for safety**
|
|
244
|
+
```bash
|
|
245
|
+
--max-runs 50 # Prevent infinite loop
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
3. **Clear task definition**
|
|
249
|
+
```bash
|
|
250
|
+
# Good
|
|
251
|
+
"check new github issues and reply to them"
|
|
252
|
+
|
|
253
|
+
# Bad (too vague)
|
|
254
|
+
"do stuff"
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
4. **Test with small max-runs first**
|
|
258
|
+
```bash
|
|
259
|
+
--loop --max-runs 3 # Test with 3 iterations first
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### ❌ DON'T
|
|
263
|
+
|
|
264
|
+
1. **Don't add wait time unnecessarily**
|
|
265
|
+
```bash
|
|
266
|
+
# Unnecessary - task already takes time
|
|
267
|
+
--loop 60 # Only use if you need wait time for specific reason (rate limits, polling)
|
|
268
|
+
|
|
269
|
+
# Better for continuous work
|
|
270
|
+
--loop # No wait - task execution time is the natural interval
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
2. **Don't run production without max-runs**
|
|
274
|
+
```bash
|
|
275
|
+
# Dangerous - may run forever
|
|
276
|
+
--loop
|
|
277
|
+
|
|
278
|
+
# Safe
|
|
279
|
+
--loop --max-runs 100
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
3. **Don't do destructive operations**
|
|
283
|
+
```bash
|
|
284
|
+
# Dangerous!
|
|
285
|
+
"delete old files" --loop
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## 🐛 Troubleshooting
|
|
291
|
+
|
|
292
|
+
### Q: Loop runs too fast
|
|
293
|
+
**A:** Increase interval
|
|
294
|
+
```bash
|
|
295
|
+
--loop 120 # instead of --loop 30
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Q: Loop never stops
|
|
299
|
+
**A:** Add max-runs safety limit
|
|
300
|
+
```bash
|
|
301
|
+
--loop 60 --max-runs 50
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Q: Want detailed output
|
|
305
|
+
**A:** Add verbose flag
|
|
306
|
+
```bash
|
|
307
|
+
--loop 60 --verbose
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Q: Task keeps failing
|
|
311
|
+
**A:** Check error message, could be:
|
|
312
|
+
- API rate limit → Increase interval
|
|
313
|
+
- Permission issues → Fix permissions
|
|
314
|
+
- Task itself has problems → Test without loop first
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## 🚀 Advanced Patterns
|
|
319
|
+
|
|
320
|
+
### Pattern 1: Time-boxed Work
|
|
321
|
+
```bash
|
|
322
|
+
# Work for exactly 1 hour (60 iterations × 60s)
|
|
323
|
+
bun dev:flow "work on feature X" --loop 60 --max-runs 60
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Pattern 2: Progressive Task
|
|
327
|
+
```bash
|
|
328
|
+
# Iterate through large task
|
|
329
|
+
bun dev:flow "continue migrating to new API" --loop 180 --max-runs 20
|
|
330
|
+
# Each iteration makes progress, LLM remembers where it left off
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Pattern 3: Monitoring & Auto-fix
|
|
334
|
+
```bash
|
|
335
|
+
# Check health and auto-fix issues
|
|
336
|
+
bun dev:flow "check system health and fix issues if found" --loop 300
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Pattern 4: Staged Execution
|
|
340
|
+
```bash
|
|
341
|
+
# Stage 1: Quick pass (10 mins)
|
|
342
|
+
bun dev:flow "quick fixes" --loop 30 --max-runs 20
|
|
343
|
+
|
|
344
|
+
# Stage 2: Deep work (1 hour)
|
|
345
|
+
bun dev:flow "continue deep refactoring" --loop 300 --max-runs 12
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## 💡 Pro Tips
|
|
351
|
+
|
|
352
|
+
### Tip 1: Task Phrasing
|
|
353
|
+
```bash
|
|
354
|
+
# Good: Progressive phrasing
|
|
355
|
+
"continue working on X, pick up where you left off"
|
|
356
|
+
|
|
357
|
+
# Better: Context-aware
|
|
358
|
+
"check status of X, continue if not done, report if complete"
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Tip 2: Interval Selection
|
|
362
|
+
```bash
|
|
363
|
+
# Quick iteration (testing, monitoring)
|
|
364
|
+
--loop 30
|
|
365
|
+
|
|
366
|
+
# Standard work (most tasks)
|
|
367
|
+
--loop 60-120
|
|
368
|
+
|
|
369
|
+
# Heavy tasks (reviews, analysis)
|
|
370
|
+
--loop 300-600
|
|
371
|
+
|
|
372
|
+
# Periodic checks (CI/CD, health)
|
|
373
|
+
--loop 1800-3600
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Tip 3: Safety Nets
|
|
377
|
+
```bash
|
|
378
|
+
# Always set max-runs for important tasks
|
|
379
|
+
bun dev:flow "deploy changes" --loop 60 --max-runs 3
|
|
380
|
+
|
|
381
|
+
# Use longer intervals for destructive operations
|
|
382
|
+
bun dev:flow "cleanup old data" --loop 3600 --max-runs 5
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Tip 4: File Input Support
|
|
386
|
+
```bash
|
|
387
|
+
# Load prompt from file for longer instructions
|
|
388
|
+
bun dev:flow "@long-task.txt" --loop 300 --max-runs 10
|
|
389
|
+
|
|
390
|
+
# Use absolute path
|
|
391
|
+
bun dev:flow "@/path/to/prompt.txt" --loop 60
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## 📊 Performance
|
|
397
|
+
|
|
398
|
+
**Memory:** ~50-100MB per iteration (cleaned up after)
|
|
399
|
+
**CPU:** Depends on task complexity
|
|
400
|
+
**API:** Respects rate limits automatically
|
|
401
|
+
**Network:** Each iteration makes API calls
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## 🔧 Technical Details
|
|
406
|
+
|
|
407
|
+
### Context Management
|
|
408
|
+
```typescript
|
|
409
|
+
// Implementation
|
|
410
|
+
Iteration 1: options.continue = false // Fresh
|
|
411
|
+
Iteration 2+: options.continue = true // Build on previous
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### State Tracking
|
|
415
|
+
```typescript
|
|
416
|
+
{
|
|
417
|
+
iteration: number; // Current iteration
|
|
418
|
+
startTime: Date; // When loop started
|
|
419
|
+
successCount: number; // Successful runs
|
|
420
|
+
errorCount: number; // Failed runs
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Exit Conditions
|
|
425
|
+
1. User interrupt (Ctrl+C) - Highest priority
|
|
426
|
+
2. Max-runs reached
|
|
427
|
+
3. Fatal error (rare)
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## 📝 Changelog
|
|
432
|
+
|
|
433
|
+
### v1.0.0 (Simplified)
|
|
434
|
+
- Core loop functionality
|
|
435
|
+
- Auto-continue from 2nd iteration
|
|
436
|
+
- Graceful shutdown
|
|
437
|
+
- Progress tracking
|
|
438
|
+
- Error resilience
|
|
439
|
+
- File input support for prompts
|
|
440
|
+
|
|
441
|
+
**Removed complexity:**
|
|
442
|
+
- ~~until-success~~
|
|
443
|
+
- ~~until-stable~~
|
|
444
|
+
- ~~on-error strategies~~
|
|
445
|
+
|
|
446
|
+
**Why:** Keep it simple - just "keep working until I stop you"
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Create the main CLI application with enhanced Commander.js configuration
|
|
4
|
+
*/
|
|
5
|
+
declare function createCLI(): Command;
|
|
6
|
+
/**
|
|
7
|
+
* Run the CLI application with enhanced error handling and process management
|
|
8
|
+
*/
|
|
9
|
+
declare function runCLI(): Promise<void>;
|
|
10
|
+
export { runCLI, createCLI };
|