@kaged/task-runner
Task state machine with concurrency limits, backend resolution, and DSL tasks block schema for PTY/tmux-backed project terminal workflows
6
source files
3
test files
982
lines
✓ 65 pass
tests
pass
typecheck
clean
lint
Test results 65
resolveBackend > tmux on PATH + config tmux → backend tmux
[0.480ms]
resolveBackend > tmux on PATH + config auto → backend tmux (auto-detected)
[0.060ms]
resolveBackend > tmux on PATH + config pty → backend pty
[0.040ms]
resolveBackend > no tmux + config tmux → BackendResolutionError
[0.130ms]
resolveBackend > no tmux + config tmux → error message mentions tmux
[0.070ms]
resolveBackend > no tmux + config auto → backend pty (tmux not found)
[0.040ms]
resolveBackend > no tmux + config pty → backend pty
[0.030ms]
resolveBackend: tmux version checks > tmux 3.2 is sufficient
[0.040ms]
resolveBackend: tmux version checks > tmux 3.0 is insufficient for explicit tmux config
[0.050ms]
resolveBackend: tmux version checks > tmux 3.1 is insufficient
[0.060ms]
resolveBackend: tmux version checks > tmux 4.0 is sufficient
[0.030ms]
resolveBackend: tmux version checks > auto + old tmux falls back to pty
[0.030ms]
resolveBackend: tmux version checks > auto + sufficient tmux selects tmux
[0.020ms]
resolveBackend: tmux version checks > tmux without version string still works for explicit config
[0.020ms]
resolveBackend: tmux version checks > auto without version string still selects tmux when on PATH
[0.020ms]
BackendResolutionError > has correct name
[0.030ms]
DEFAULT_TASK_LIMITS > matches spec defaults
[0.030ms]
checkTaskLimitsPerProject > allows when below limit
[0.060ms]
checkTaskLimitsPerProject > allows at one below limit
[0.030ms]
checkTaskLimitsPerProject > throws at limit
[0.080ms]
checkTaskLimitsPerProject > throws above limit
[0.040ms]
checkTaskLimitsPerProject > error includes resource, limit, and current
[0.060ms]
checkTaskLimitsPerProject > respects custom limits
[0.050ms]
checkTaskLimitsPerOperator > allows when below limit
[0.050ms]
checkTaskLimitsPerOperator > allows at one below limit
[0.020ms]
checkTaskLimitsPerOperator > throws at limit
[0.030ms]
checkTaskLimitsPerOperator > error resource is tasks_per_operator
[0.040ms]
validateAdHocCommand > allows valid command
[0.050ms]
validateAdHocCommand > allows command at max length
[0.040ms]
validateAdHocCommand > rejects empty command
[0.040ms]
validateAdHocCommand > rejects command over max length
[0.040ms]
validateAdHocCommand > over-length error includes correct counts
[0.070ms]
TaskLimitExceededError message format > includes resource and counts
[0.030ms]
createTask > creates instance in starting state
[0.150ms]
createTask > sets all fields from input
[0.100ms]
createTask > ad-hoc task has null taskName
[0.030ms]
createTask > pty backend emits persist_instance, emit_task_launched, allocate_pty
[0.040ms]
createTask > tmux backend emits create_tmux_window with correct names
[0.060ms]
createTask > tmux backend ad-hoc task uses id for window name
[0.030ms]
createTask > pty backend leaves tmux fields null
[0.030ms]
task transitions: starting → running (spawned) > starting + spawned → running
[0.090ms]
task transitions: starting → running (spawned) > emits stream_output, emit_task_state
[0.030ms]
task transitions: starting → running (spawned) > running + spawned → TaskTransitionError
[0.080ms]
task transitions: starting → running (spawned) > done + spawned → TaskTransitionError
[0.040ms]
task transitions: running → done/failed (exited) > running + exited(0) → done
[0.060ms]
task transitions: running → done/failed (exited) > running + exited(1) → failed
[0.020ms]
task transitions: running → done/failed (exited) > running + exited(127) → failed (command not found)
[0.020ms]
task transitions: running → done/failed (exited) > exit emits persist_exit, persist_transcript, destroy_pty, emit_task_exited, emit_task_state
[0.030ms]
task transitions: running → done/failed (exited) > starting + exited → TaskTransitionError
[0.030ms]
task transitions: running → done/failed (exited) > done + exited → TaskTransitionError
[0.030ms]
task transitions: running → done/failed (exited) > stopped + exited → TaskTransitionError
[0.040ms]
task transitions: starting → failed (spawn_failed) > starting + spawn_failed → failed
[0.050ms]
task transitions: starting → failed (spawn_failed) > emits persist_failure, destroy_pty, emit_task_state
[0.030ms]
task transitions: starting → failed (spawn_failed) > running + spawn_failed → TaskTransitionError
[0.030ms]
task transitions: running → stopped (stop) > running + stop → stopped
[0.060ms]
task transitions: running → stopped (stop) > emits send_sigterm, persist_stop, persist_transcript, destroy_pty, emit_task_stopped, emit_task_state
[0.040ms]
task transitions: running → stopped (stop) > starting + stop → TaskTransitionError with helpful message
[0.080ms]
task transitions: running → stopped (stop) > done + stop → TaskTransitionError
[0.030ms]
task transitions: running → stopped (stop) > failed + stop → TaskTransitionError
[0.030ms]
task transitions: running → stopped (stop) > stopped + stop → TaskTransitionError
[0.030ms]
task state machine: multi-step sequences > full lifecycle: create → spawn → exit(0) → done
[0.060ms]
task state machine: multi-step sequences > failed command: create → spawn → exit(1) → failed
[0.040ms]
task state machine: multi-step sequences > stopped by operator: create → spawn → stop → stopped
[0.040ms]
task state machine: multi-step sequences > spawn failure: create → spawn_failed → failed
[0.040ms]
TaskTransitionError properties > includes from state and event type
[0.060ms]