Skip to content

Guides Automation

github-actions[bot] edited this page Aug 17, 2026 · 2 revisions

Automating Quinjet

Quinjet treats its command line as an API. A script or coding agent can discover the installed surface, request structured results, distinguish usage mistakes from missing data, and run every repository operation without opening the terminal interface.

Discover before invoking

Start with the installed binary rather than a cached command list:

quinjet capabilities --json > quinjet-capabilities.json
jq -r '.commands[].path' quinjet-capabilities.json

The document includes a schema version, the binary version, command paths, arguments, help, required state, value names, enum values, and child commands. It is generated from clap, so it cannot drift independently of parsing.

Human-readable discovery remains available through all common clap forms:

quinjet --help
quinjet help pr
quinjet help pr checks
quinjet pr checks --help

Keep stdout parseable

Pass --json before or after a verb. A one-shot invocation emits exactly one pretty JSON document on stdout and no progress output. A runtime failure emits no partial document. Errors and remediation hints go to stderr.

if result=$(quinjet status --json 2>quinjet-error.txt); then
  jq '.branch.head, (.changes | length)' <<<"$result"
else
  code=$?
  printf 'quinjet exited %s\n' "$code" >&2
  sed -n '1,4p' quinjet-error.txt >&2
fi

--watch --json is the deliberate streaming exception. It emits compact JSON Lines, one complete snapshot per refresh. A consumer should parse one line at a time rather than wait for end of file.

quinjet pr checks 42 --watch --json | jq --unbuffered '.checks[] | [.name, .status]'

Use exit codes before text

Exit status is the first branch in an automation flow:

Code Meaning Typical response
0 Success, including a safe preview that changed nothing Parse stdout.
1 The operation or requested verdict failed Read stderr or the completed watched result.
2 Invalid command syntax Regenerate from capabilities or inspect --help.
3 A named branch, revision, stash, path, or check was not found Use the suggested listing command.
4 A known check exists but its log is unavailable Retry later or inspect pr checks.

Do not classify a failure by matching English error text. Codes 3 and 4 are stable categories, and code 2 always comes from clap before repository work.

Destructive work is explicit

Commands that can discard history or content preview by default. The same argv can be inspected first and confirmed second:

quinjet discard generated/
quinjet discard generated/ --yes

quinjet cherry-pick a1b2c3d
quinjet cherry-pick a1b2c3d --yes

Quinjet never treats redirected stdin, CI, or an agent caller as consent. It does not prompt, open an editor, or wait for credentials. Required values must be present in argv, and Git and GitHub subprocesses run non-interactively.

Progress stays out of protocols

A person running a one-shot command with interactive stderr may see an animated status line while Git, GitHub, or the updater is working. The indicator is cleared before the result appears. It is disabled when stderr is redirected, under --json, and during watches. TTY detection changes presentation only, never the selected operation or returned data.

Install completions for people

The same argument metadata drives shell completion for bash, zsh, fish, elvish, and PowerShell. Paths are identified separately from revisions, branch names, stash references, check names, and numeric values.

quinjet completions --install
quinjet completions zsh --install

Release scripts install them and the q shortcut immediately. Cargo, cargo-binstall, package-manager, and copied-binary installations do it on first invocation, and the marker in each generated script causes a later binary to refresh it. Installed-once state ensures that removing a script or marked profile block opts out of automatic restoration. Raw generation to stdout remains available for a packager's custom destination. quinjet completion is a visible alias for users familiar with tools that use the singular spelling.

Design references

The command behavior follows established guidance rather than a private agent protocol:

Where to go next

CLI reference

Repository
Changes
Remotes
Branch
Stash
Pull Request
Generated
Graft
Mcp
Project
Remote
Stack
Worktree

Guides

Optimization

Git Internals
Diff
Github
Rendering

Rust practices

Studies
Patterns

Clone this wiki locally