pitchfork daemons add
- Usage:
pitchfork daemons add [FLAGS] <ID> [ARGS]… - Aliases:
a - Effect: modifies state
Add a new daemon to pitchfork.toml
Creates a new daemon configuration section in the pitchfork.toml file. The daemon will be added to the nearest pitchfork.toml found in the filesystem hierarchy starting from the current directory.
Examples:
pitchfork daemons add api bun run server
Add daemon using positional args
pitchfork daemons add api --run 'npm start'
Add daemon with explicit run command
pitchfork daemons add api -- bun run server
Add daemon with explicit args after --
pitchfork daemons add api --run 'npm start' --retry 3
Add with retry policy
pitchfork daemons add api --run 'npm start' --watch 'src/**/*.ts'
Add with file watching
pitchfork daemons add api --run 'npm start' --autostart --autostop
Add with auto start/stop hooks
pitchfork daemons add worker --run './worker' --depends api
Add with daemon dependency
pitchfork daemons add api --run 'npm start' --local
Add to pitchfork.local.toml instead
pitchfork daemons add api --run 'npm start' --global
Add to ~/.config/pitchfork/config.toml instead
pitchfork daemons add worker --run './worker' --cron-schedule '0 */5 * * * *' --cron-immediate
Schedule every five minutes, including a just-missed trigger
Arguments
<ID>— ID of the daemon to add (e.g., "api" or "namespace/api")[ARGS]…— Arguments to pass to the daemon (alternative to --run)
Flags
--run <RUN>— Command to run (can also use positional args)--retry <RETRY>— Number of retry attempts on failure (use "true" for infinite)--watch <WATCH>— Glob patterns to watch for changes (can be specified multiple times)--dir <DIR>— Working directory for the daemon--env <ENV>— Environment variables in KEY=value format (can be specified multiple times)--ready-delay <READY_DELAY>— Delay in seconds before considering daemon ready--ready-output <READY_OUTPUT>— Regex pattern to match in output for readiness--ready-http <READY_HTTP>— HTTP endpoint URL to poll for readiness--ready-port <READY_PORT>— TCP port to check for readiness (a number or Tera template)--ready-cmd <READY_CMD>— Shell command to poll for readiness--health-cmd <HEALTH_CMD>— Shell command to poll for health (exit code 0 = healthy)--health-http <HEALTH_HTTP>— HTTP endpoint URL to poll for health--health-port <HEALTH_PORT>— TCP port to probe for health (connection success = healthy)--expected-port <EXPECTED_PORT>— Ports the daemon is expected to bind to (can be specified multiple times or comma-separated)--bump [BUMP]— Automatically find an available port if the expected port is in use--depends <DEPENDS>— Daemon dependencies that must start first (can be specified multiple times)--boot-start— Start this daemon automatically on system boot--autostart— Autostart the daemon when entering the directory--autostop— Autostop the daemon when leaving the directory--on-ready <ON_READY>— Command to run when daemon becomes ready--on-fail <ON_FAIL>— Command to run when daemon fails--on-retry <ON_RETRY>— Command to run before each retry attempt--on-stop <ON_STOP>— Command to run when the daemon is explicitly stopped by pitchfork--on-exit <ON_EXIT>— Command to run on any daemon termination (clean exit, crash, or stop)--cron-schedule <CRON_SCHEDULE>— Cron schedule expression (6 fields: second minute hour day month weekday)--cron-retrigger <CRON_RETRIGGER>— Cron retrigger behavior: finish, always, success, fail--cron-immediate— On the first cron check, include scheduled times from the previous 10 seconds--local— Write to pitchfork.local.toml instead of pitchfork.toml--project— Write to pitchfork.toml explicitly (default if no flag specified)--global— Write to the user-level global config (~/.config/pitchfork/config.toml)-h --help— Print help
