@yemi33/minions 0.1.1958 → 0.1.1959

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.
@@ -380,6 +380,54 @@ function buildKeepProcessesHint(opts) {
380
380
  '',
381
381
  'If you do NOT write the file, the engine will kill ALL of your descendant processes when you exit (today\'s default). Do not write the file unless you are intentionally leaving a process behind for the human or follow-up work.',
382
382
  '',
383
+ '### How to spawn long-running processes (CRITICAL on Windows)',
384
+ '',
385
+ 'On Windows, child processes spawned with stdio inherited or piped from your agent process die SECONDS after you exit, because the next time they write to stdout the pipe is closed and they get EPIPE. Vite, bun run dev, file watchers, and HMR all log on every event, so they crash within seconds.',
386
+ '',
387
+ 'Use this PowerShell pattern -- it gives the child its own log file descriptor (not a pipe) so it survives your exit:',
388
+ '',
389
+ '```powershell',
390
+ '# Adjust $log, $cmd, $args, $cwd for your target.',
391
+ '$log = "D:\\logs\\<service-name>.log"',
392
+ 'New-Item -Path (Split-Path $log) -ItemType Directory -Force | Out-Null',
393
+ '$proc = Start-Process -FilePath "bun" -ArgumentList "run","dev" `',
394
+ ' -WorkingDirectory "<absolute-cwd>" `',
395
+ ' -RedirectStandardOutput $log -RedirectStandardError $log `',
396
+ ' -WindowStyle Hidden -PassThru',
397
+ 'Write-Host "spawned PID $($proc.Id) -> $log"',
398
+ '```',
399
+ '',
400
+ 'For Node.js / bun spawn() callers, use:',
401
+ '',
402
+ '```js',
403
+ 'const fs = require(\'fs\');',
404
+ 'const { spawn } = require(\'child_process\');',
405
+ 'const logFd = fs.openSync(\'D:/logs/<service-name>.log\', \'a\');',
406
+ 'const proc = spawn(\'bun\', [\'run\', \'dev\'], {',
407
+ ' cwd: \'<absolute-cwd>\',',
408
+ ' detached: true,',
409
+ ' stdio: [\'ignore\', logFd, logFd], // file fds, NOT pipes',
410
+ ' windowsHide: true,',
411
+ '});',
412
+ 'proc.unref();',
413
+ 'console.log(\'spawned PID\', proc.pid);',
414
+ '```',
415
+ '',
416
+ 'Key requirements (DO NOT skip any):',
417
+ '1. **stdio MUST be a file descriptor** (`-RedirectStandardOutput` in PowerShell, or `fs.openSync` + numeric fd in Node). NEVER `inherit`, `pipe`, or omit.',
418
+ '2. **`-WindowStyle Hidden`** in PowerShell, **`windowsHide: true`** in Node -- keeps the child off your desktop.',
419
+ '3. **`detached: true` + `proc.unref()`** in Node so the parent can exit without taking the child down.',
420
+ '4. **Capture the spawned PID immediately** -- that\'s what goes into `keep-pids.json`.',
421
+ '5. **Verify it actually bound the port before you exit.** Run `Get-NetTCPConnection -LocalPort <port> -State Listen` (PowerShell) or `netstat -an | findstr :<port>` and confirm the port is listening. If not, read the log file (`Get-Content $log -Tail 100`) to diagnose. Don\'t exit claiming success if the port isn\'t listening.',
422
+ '',
423
+ 'What NOT to do:',
424
+ '- `Start-Process bun run dev` (no `-RedirectStandardOutput` -> child inherits your console handle -> dies on exit).',
425
+ '- `bun run dev &` (PowerShell `&` is the call operator, not background -- runs synchronously).',
426
+ '- `Start-Job { bun run dev }` (PS jobs die when the host exits, which is you).',
427
+ '- `child_process.spawn(...)` with default stdio (`pipe`) -- same EPIPE problem.',
428
+ '',
429
+ 'If you hit a problem the recipe doesn\'t cover (e.g. Vite needs `VITE_HOST=127.0.0.1` because it\'s defaulting to `::1` and not binding), fix the env in the spawn call (`-Environment` in PowerShell or `env:` in Node spawn opts), don\'t hack around the spawn pattern itself.',
430
+ '',
383
431
  'After you write the file, the engine\'s sweep removes it automatically when its TTL fires (it kills the kept PIDs at that point) or when all declared PIDs are already dead. Humans can also kill any kept PID early from the dashboard.',
384
432
  '',
385
433
  '## Verify before exit (REQUIRED)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.1958",
3
+ "version": "0.1.1959",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"