Headless mode
You can run Junie CLI in headless mode without interactive UI in CI/CD environments and build pipelines. Such integration will automatically trigger AI code reviews or other prompts as part of your CI or build pipeline.
Installation
Authentication token
Junie CLI requires an authentication token to run. To generate the token, go to junie.jetbrains.com/cli.
Usage
Authenticate Junie CLI using the --auth option and run the junie command with your prompt as a positional argument:
To make the task's prompt text, token count, and cost available to scripts after the run, add --log-prompt-usage. Junie appends a structured line to <Junie Home>/logs/log-prompt-<date>-pid-<pid>.log; the option can also be enabled with JUNIE_LOG_PROMPT_USAGE=true.
To list all available command options, run:
For the full list of available options and environment variables, see reference.
Project trust
Both interactive and non-interactive launches (one-shot prompts, piped-input tasks, ACP, Gateway, and child repository roots) enforce project trust before loading <project>/.junie inputs (configuration, MCP servers, extensions, agents, commands, skills, and guidelines).
If the workspace has a valid stored trust marker under <Junie Home>/trust (or is a verified linked Git worktree of a trusted repository), Junie loads its .junie configuration automatically. Otherwise, Junie isolates <project>/.junie in a temporary directory and prints a notice to stderr.
In trusted CI/CD pipelines or automation where interactive trust prompts cannot run, opt in for the current process with --trust-project or JUNIE_TRUST_PROJECT=true:
--trust-project (JUNIE_TRUST_PROJECT=true) applies only to the current process without writing persistent markers under <Junie Home>/trust, and still refuses to trust the user home directory. Ambient CI=true is intentionally not auto-trusted because fork pull request workflows also set CI=true on untrusted checkouts.
To persist trust on a developer machine, start junie interactively and select Trust this project or Trust all projects in <parent>. Delete the corresponding marker under <Junie Home>/trust to revoke exact or inherited parent trust for the next launch.