@rip-lang/swarm 1.2.6 → 1.2.8
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/README.md +16 -0
- package/package.json +1 -1
- package/swarm.rip +29 -13
package/README.md
CHANGED
|
@@ -214,3 +214,19 @@ swarm { setup, perform }
|
|
|
214
214
|
rip download-tests.rip tests.txt -w 40
|
|
215
215
|
# 15,000 tests across 40 workers — finishes in minutes
|
|
216
216
|
```
|
|
217
|
+
|
|
218
|
+
## Troubleshooting
|
|
219
|
+
|
|
220
|
+
### Progress bar text appears black in VS Code / Cursor
|
|
221
|
+
|
|
222
|
+
VS Code's terminal has a "minimum contrast ratio" feature that overrides
|
|
223
|
+
foreground colors. This can turn white progress text black. To fix it,
|
|
224
|
+
add this to your VS Code or Cursor settings:
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
"terminal.integrated.minimumContrastRatio": 1
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
This disables the contrast adjustment and lets ANSI colors render as
|
|
231
|
+
intended. The progress display works correctly in standard terminals
|
|
232
|
+
(iTerm2, Terminal.app, etc.) without any changes.
|
package/package.json
CHANGED
package/swarm.rip
CHANGED
|
@@ -89,7 +89,7 @@ hex = (str) ->
|
|
|
89
89
|
|
|
90
90
|
fg = (rgb) -> if rgb then "\x1b[38;2;#{hex(rgb)}m" else "\x1b[39m"
|
|
91
91
|
bg = (rgb) -> if rgb then "\x1b[48;2;#{hex(rgb)}m" else "\x1b[49m"
|
|
92
|
-
fgw =!
|
|
92
|
+
fgw =! fg("fff")
|
|
93
93
|
|
|
94
94
|
# ==============================================================================
|
|
95
95
|
# Progress display
|
|
@@ -167,17 +167,17 @@ export swarm = (opts = {}) ->
|
|
|
167
167
|
|
|
168
168
|
if workers < 1
|
|
169
169
|
console.error 'error: workers must be at least 1'
|
|
170
|
-
|
|
170
|
+
exit(1)
|
|
171
171
|
|
|
172
172
|
if doreset
|
|
173
173
|
rmSync(_dir, { recursive: true, force: true })
|
|
174
174
|
console.log 'removed .swarm directory'
|
|
175
|
-
|
|
175
|
+
exit(0)
|
|
176
176
|
|
|
177
177
|
# run setup
|
|
178
178
|
unless typeof opts.perform is 'function'
|
|
179
179
|
console.error 'error: perform() function is required'
|
|
180
|
-
|
|
180
|
+
exit(1)
|
|
181
181
|
|
|
182
182
|
context = {}
|
|
183
183
|
if typeof opts.setup is 'function'
|
|
@@ -188,13 +188,13 @@ export swarm = (opts = {}) ->
|
|
|
188
188
|
# read task list
|
|
189
189
|
unless existsSync(_todo)
|
|
190
190
|
console.error 'error: no .swarm/todo directory found (did setup run?)'
|
|
191
|
-
|
|
191
|
+
exit(1)
|
|
192
192
|
|
|
193
193
|
tasks = readdirSync(_todo).sort().map (f) -> join(_todo, f)
|
|
194
194
|
|
|
195
195
|
if tasks.length is 0
|
|
196
196
|
console.log 'no tasks to process'
|
|
197
|
-
|
|
197
|
+
exit(0)
|
|
198
198
|
|
|
199
199
|
jobs = tasks.length
|
|
200
200
|
|
|
@@ -215,11 +215,12 @@ export swarm = (opts = {}) ->
|
|
|
215
215
|
null
|
|
216
216
|
|
|
217
217
|
# state
|
|
218
|
-
live
|
|
219
|
-
done
|
|
220
|
-
died
|
|
221
|
-
info
|
|
222
|
-
taskIdx
|
|
218
|
+
live = 0
|
|
219
|
+
done = 0
|
|
220
|
+
died = 0
|
|
221
|
+
info = {}
|
|
222
|
+
taskIdx = 0
|
|
223
|
+
fatal = false
|
|
223
224
|
inflight = {} # slot → taskPath (track in-flight tasks for crash recovery)
|
|
224
225
|
lastTask = {} # slot → last completed task name (for display)
|
|
225
226
|
|
|
@@ -227,7 +228,7 @@ export swarm = (opts = {}) ->
|
|
|
227
228
|
process.on 'SIGINT', ->
|
|
228
229
|
cursor(true) unless quiet
|
|
229
230
|
write go(workers + 5, 1) + "\n" unless quiet
|
|
230
|
-
|
|
231
|
+
exit(1)
|
|
231
232
|
unless quiet
|
|
232
233
|
process.on 'SIGWINCH', ->
|
|
233
234
|
drawFrame(workers)
|
|
@@ -277,8 +278,14 @@ export swarm = (opts = {}) ->
|
|
|
277
278
|
w.on 'message', (msg) ->
|
|
278
279
|
switch msg.type
|
|
279
280
|
when 'error'
|
|
280
|
-
console.error "\nswarm: worker #{slot} failed to start: #{msg.error}"
|
|
281
281
|
writeFileSync('.swarm/errors.log', "worker #{slot} startup: #{msg.error}\n", { flag: 'a' }) if existsSync(_dir)
|
|
282
|
+
unless fatal
|
|
283
|
+
fatal = true
|
|
284
|
+
cursor(true) unless quiet
|
|
285
|
+
write go(workers + 5, 1) unless quiet
|
|
286
|
+
console.error "\nswarm: #{msg.error}"
|
|
287
|
+
console.error "hint: run 'bun add @rip-lang/all' in your project directory" if msg.error.includes('Cannot find module')
|
|
288
|
+
exit 1
|
|
282
289
|
when 'ready'
|
|
283
290
|
dispatchNext(w, slot)
|
|
284
291
|
when 'done'
|
|
@@ -306,6 +313,15 @@ export swarm = (opts = {}) ->
|
|
|
306
313
|
|
|
307
314
|
w.on 'exit', (code) ->
|
|
308
315
|
writeFileSync('.swarm/errors.log', "worker #{slot} exited with code #{code}, inflight: #{inflight[slot]}\n", { flag: 'a' }) if existsSync(_dir)
|
|
316
|
+
# startup failure — worker never became ready
|
|
317
|
+
if code isnt 0 and not info[slot]? and not fatal
|
|
318
|
+
fatal = true
|
|
319
|
+
cursor(true) unless quiet
|
|
320
|
+
write go(workers + 5, 1) unless quiet
|
|
321
|
+
console.error "\nswarm: worker #{slot} failed to start (exit code #{code})"
|
|
322
|
+
console.error "hint: run 'bun add @rip-lang/all' in your project directory"
|
|
323
|
+
console.error " check .swarm/errors.log for details"
|
|
324
|
+
exit 1
|
|
309
325
|
# if worker crashed mid-task, count the in-flight task as died
|
|
310
326
|
if inflight[slot]
|
|
311
327
|
move(inflight[slot], _died)
|