| name | terminal-commands |
| description | Terminal command patterns for Volatio to avoid hanging, never pipe to head/tail, use quick scripts, show output, timeout handling. Use when commands hang, output buffering issues, or process management needed. |
terminal-commands
When to Use
- Commands appear to hang
- Need to run terminal commands without blocking
- Managing long-running processes
- Debugging command output issues
Golden Path: Avoid Hanging
Rule: If a command takes >10 seconds, you're probably stuck.
Use Quick Scripts
bun packages/jobs/src/test-calendar-flow.ts
bun packages/jobs/src/trigger-sync.ts full-sync
bun packages/jobs/src/run.ts
pnpm dev
Check Status Without Waiting
docker compose ps
lsof -i :3000
curl -s http://localhost:3001/health
CRITICAL: Watch Mode Flags
Many tools default to watch mode which blocks forever:
Vitest
pnpm test
pnpm vitest
pnpm test -- --run
pnpm vitest --run
Playwright
./scripts/e2e.sh
pnpm exec playwright test
./scripts/e2e.sh --reporter=list
pnpm exec playwright test --reporter=list
Next.js/Dev Servers
pnpm dev
pnpm --filter dashboard dev
pnpm build
CRITICAL: Never Pipe to head/tail
Piping to | head or | tail causes commands to hang indefinitely:
bun script.ts 2>&1 | head -100
bun script.ts 2>&1 | tail -50
ssh server 'docker logs container' | head -50
ssh server 'command' | grep something
bun script.ts 2>&1
ssh server 'docker logs container --tail 50'
Why: Piping creates a buffer waiting for EOF. The command may complete but the pipe doesn't close cleanly.
Always Show Output
bun test-calendar-flow.ts 2>&1
bun test > /dev/null 2>&1
bun test --silent
Background Process Handling
bun run.ts &
sleep 30
bun packages/jobs/src/run.ts &
JOB_PID=$!
sleep 10
kill $JOB_PID
Mandatory Rules
- NEVER run long-running servers without
isBackground=true
- NEVER run interactive commands (wait for input forever)
- NEVER use
sleep longer than 5 seconds in foreground
- NEVER pipe to
| head or | tail
- ALWAYS show command output immediately
- ALWAYS use
--run flag for Vitest
- ALWAYS use
--reporter=list for Playwright
SSH Commands
ssh server 'docker compose build' | tail -80
ssh server 'docker compose build'
ssh server 'nohup docker compose build > build.log 2>&1 &'
ssh server 'tail -f build.log'
Port Management
lsof -i :3001
lsof -ti:3001 | xargs kill -9
make kill-servers
Vitest Watch Mode
Vitest runs in watch mode by default:
pnpm test -- --run
pnpm test
vitest