cli

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: MIT

README

chronos

The command-line interface for Chronos. Create and run schedules, start one-off jobs, see what ran and what failed, and monitor cron jobs and scripts that run outside Chronos. Every subcommand of schedules, jobs, executions, monitors and auth prints JSON with --json, and every command exits with a code listed in chronos help exit-codes, so scripts and coding agents can drive it as well as people. The exception is chronos monitors exec, which wraps a cron job or script. Only the command it runs writes to stdout, and chronos exits with that command's code.

Install

On macOS or Linux, install with Homebrew:

brew install halffive/tap/chronos-cli

Homebrew builds chronos from source, so it installs Go as a build dependency. It also installs the bash, zsh and fish completions.

To install without Homebrew, run the install script:

curl -fsSL https://chronos.sh/install.sh | sh

The script installs the latest release to ~/.local/bin. To install somewhere else, set CHRONOS_INSTALL_DIR on the sh side of the pipe:

curl -fsSL https://chronos.sh/install.sh | CHRONOS_INSTALL_DIR=~/bin sh

To install a specific version, pass it as an argument:

curl -fsSL https://chronos.sh/install.sh | sh -s -- v0.1.0

The script verifies the download's sha256 against the release's checksums.txt, and installs nothing if the check fails or cannot run. It never edits your shell profile. If the directory is not on your PATH, it prints the export PATH line to add.

To install with Go 1.26 or later:

go install chronos.sh/cli/cmd/chronos@latest

Archives for macOS, Linux and Windows are on the releases page, with a checksums.txt to verify them. Each archive has the chronos binary and completion scripts in completions/.

Check the install:

chronos version

Upgrade

Upgrade the same way you installed. chronos does not check for updates, so watch the releases page for new versions.

  • Homebrew: run brew upgrade chronos-cli.
  • Install script: run curl -fsSL https://chronos.sh/install.sh | sh again. If you set CHRONOS_INSTALL_DIR, set it to the same directory.
  • Go: run go install chronos.sh/cli/cmd/chronos@latest.
  • Release archive: download the new archive from the releases page. Replace the old binary with the one inside.

Your saved login and config stay in place.

Uninstall

  1. Log out. This revokes a browser login and removes the saved login from the OS keychain and the config file:

    chronos auth logout
    
  2. Remove the binary. For a Homebrew install, run brew uninstall chronos-cli. Otherwise, delete it:

    rm "$(command -v chronos)"
    
  3. Remove the config directory, ~/.config/chronos by default:

    rm -rf ~/.config/chronos
    

    If you set CHRONOS_CONFIG_DIR, remove that directory instead. If you set XDG_CONFIG_HOME, remove $XDG_CONFIG_HOME/chronos. On Windows, the default is %AppData%\chronos.

Build from source

You need Go 1.26 or later.

go build -o chronos ./cmd/chronos
./chronos --help

Development

make check runs every check CI runs. Run it before opening a pull request. It downloads the pinned shellcheck into dist/tools. GoReleaser needs Go 1.27.3, which Go fetches for you unless you set GOTOOLCHAIN=local.

License

MIT

Directories

Path Synopsis
cmd
chronos command
Command chronos manages Chronos schedules, jobs, executions and monitors.
Command chronos manages Chronos schedules, jobs, executions and monitors.
internal
app
Package app holds what commands share that does not depend on the command-line parser: the SDK client, output mode, dry runs, prompts and waiting for jobs.
Package app holds what commands share that does not depend on the command-line parser: the SDK client, output mode, dry runs, prompts and waiting for jobs.
build
Package build reports which build of the CLI is running.
Package build reports which build of the CLI is running.
clitest
Package clitest runs chronos commands against a fake API in tests.
Package clitest runs chronos commands against a fake API in tests.
cmd/root
Package root assembles the chronos command tree and owns the process's exit code.
Package root assembles the chronos command tree and owns the process's exit code.
cmdutil
Package cmdutil builds cobra commands on top of app: leaf commands that print a view and report errors the same way, command groups, and argument checks.
Package cmdutil builds cobra commands on top of app: leaf commands that print a view and report errors the same way, command groups, and argument checks.
config
Package config saves a login (an API key or an OAuth token) in the keychain or the config file, and decides which credential and base URL a command uses.
Package config saves a login (an API key or an OAuth token) in the keychain or the config file, and decides which credential and base URL a command uses.
exit
Package exit maps failures to the CLI's documented exit codes and to the error object printed with --json.
Package exit maps failures to the CLI's documented exit codes and to the error object printed with --json.
input
Package input parses flag values into API request values.
Package input parses flag values into API request values.
oauth
Package oauth runs the browser login against the Chronos API: the authorization code flow with PKCE, a loopback listener for the redirect, the token exchange and revocation.
Package oauth runs the browser login against the Chronos API: the authorization code flow with PKCE, a loopback listener for the redirect, the token exchange and revocation.
output
Package output prints command results: JSON with --json, otherwise tables and key-value lines for a terminal, or tab-separated values when piped.
Package output prints command results: JSON with --json, otherwise tables and key-value lines for a terminal, or tab-separated values when piped.
ping
Package ping sends pings to a heartbeat monitor through the Ping API, a POST to the monitor's ping URL or to /start, /fail or /<exit-code> after it.
Package ping sends pings to a heartbeat monitor through the Ping API, a POST to the monitor's ping URL or to /start, /fail or /<exit-code> after it.
subprocess
Package subprocess runs a command for the user.
Package subprocess runs a command for the user.
transport
Package transport sits between the SDK and the network.
Package transport sits between the SDK and the network.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL