Skip to content

CLI conventions

jf is the jjforge command. It builds on jj, so every jj command works, and it adds the forge commands: auth, org, repo, clone, push, and browse. It talks to the forge only through the public API. See ADR 0009.

The conventions follow clig.dev.

  • Data goes to stdout, and messages go to stderr.
  • --json prints exactly the schema that openapi.yaml defines for the same data, so a script reads one shape everywhere (#53).
  • Color appears only when stdout is a terminal, and NO_COLOR turns it off.
  • Without a terminal, jf never prompts. A command that needs an answer fails and names the missing input (#56).
  • A setting comes from a flag first, then the environment, then the configuration file. JJFORGE_ENDPOINT names the forge to talk to.

Each kind of failure has its own exit code, so a script never parses text (#54). The problem codes come from the application/problem+json answers of the API.

Exit code Meaning Problem codes
0 Success None
1 Other error Every code not listed below
2 Bad usage None, clap’s default for a usage error
3 Ambiguous revision rev_ambiguous
4 Not found not_found, rev_not_found, path_not_found
5 Not authorized unauthenticated, forbidden
6 Conflict name_taken, precondition_failed