@rip-lang/swarm 1.2.6 → 1.2.7
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 +33 -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
|
|
|
@@ -214,12 +214,28 @@ export swarm = (opts = {}) ->
|
|
|
214
214
|
catch
|
|
215
215
|
null
|
|
216
216
|
|
|
217
|
+
# pre-flight: check workers can resolve modules from script directory
|
|
218
|
+
dir = dirname(scriptPath)
|
|
219
|
+
found = false
|
|
220
|
+
loop
|
|
221
|
+
if existsSync(join(dir, 'node_modules', '@rip-lang', 'swarm'))
|
|
222
|
+
found = true
|
|
223
|
+
break
|
|
224
|
+
parent = dirname(dir)
|
|
225
|
+
break if parent is dir
|
|
226
|
+
dir = parent
|
|
227
|
+
unless found
|
|
228
|
+
console.error "swarm: no node_modules found — workers won't be able to load modules"
|
|
229
|
+
console.error "hint: run 'bun add @rip-lang/all' in your project directory"
|
|
230
|
+
exit 1
|
|
231
|
+
|
|
217
232
|
# state
|
|
218
|
-
live
|
|
219
|
-
done
|
|
220
|
-
died
|
|
221
|
-
info
|
|
222
|
-
taskIdx
|
|
233
|
+
live = 0
|
|
234
|
+
done = 0
|
|
235
|
+
died = 0
|
|
236
|
+
info = {}
|
|
237
|
+
taskIdx = 0
|
|
238
|
+
fatal = false
|
|
223
239
|
inflight = {} # slot → taskPath (track in-flight tasks for crash recovery)
|
|
224
240
|
lastTask = {} # slot → last completed task name (for display)
|
|
225
241
|
|
|
@@ -227,7 +243,7 @@ export swarm = (opts = {}) ->
|
|
|
227
243
|
process.on 'SIGINT', ->
|
|
228
244
|
cursor(true) unless quiet
|
|
229
245
|
write go(workers + 5, 1) + "\n" unless quiet
|
|
230
|
-
|
|
246
|
+
exit(1)
|
|
231
247
|
unless quiet
|
|
232
248
|
process.on 'SIGWINCH', ->
|
|
233
249
|
drawFrame(workers)
|
|
@@ -277,7 +293,11 @@ export swarm = (opts = {}) ->
|
|
|
277
293
|
w.on 'message', (msg) ->
|
|
278
294
|
switch msg.type
|
|
279
295
|
when 'error'
|
|
280
|
-
|
|
296
|
+
unless fatal
|
|
297
|
+
fatal = true
|
|
298
|
+
cursor(true) unless quiet
|
|
299
|
+
console.error "\nswarm: #{msg.error}"
|
|
300
|
+
console.error "hint: run 'bun add @rip-lang/all' in your project directory" if msg.error.includes('Cannot find module')
|
|
281
301
|
writeFileSync('.swarm/errors.log', "worker #{slot} startup: #{msg.error}\n", { flag: 'a' }) if existsSync(_dir)
|
|
282
302
|
when 'ready'
|
|
283
303
|
dispatchNext(w, slot)
|