Documentation
¶
Overview ¶
Package cli implements the gojira command-line interface (subcommand wiring, flag definitions, the config cascade glue, the run orchestrator, signal handling, and exit-code mapping). It is the internal home for everything cmd/gojira used to carry as package main; the binary is now a thin entrypoint that calls Run.
The CLI is never imported by third parties, hence the placement under internal/. The package's urfave/cli/v3 import is aliased to `urfave` to avoid colliding with the package name.
guard.go — the require-config pre-flight guard.
Every Jira-touching subcommand (crawl, serve, create, update, comment, transitions, transition) calls [requireConfig] BEFORE its existing argument validation and config-cascade work. The guard answers a single question: does the caller have ANY plausible configuration source? If yes, the existing LoadConfig cascade runs unchanged and remains the sole authority on config validity. If no, the command fails fast with an actionable message that points at `gojira init`.
init, help, and --version are NOT guarded.
init.go — the `gojira init` subcommand.
init scaffolds a schema-valid config.yaml at the XDG global path ($XDG_CONFIG_HOME/gojira/config.yaml or ~/.config/gojira/config.yaml) with 0o600 permissions. Required values come from flags, env, or interactive prompts; the token is read without echo on real terminals (via golang.org/x/term) and falls back to a warned echo read when stdin is not a terminal (tests, pipes).
init is intentionally NOT guarded by [requireConfig]: it is the way out of a no-config state and must always be runnable.
mcp.go — the `gojira mcp` subcommand.
runMCP is intentionally thin: apply the Phase-A require-config guard, load the Config cascade shared with runServe, and hand the validated Config to internal/mcp.Serve, which owns mode enforcement, backend construction, the MCP server build, the stdio transport, and clean shutdown.
STDOUT PURITY INVARIANT — this file MUST NOT write a single byte to stdout. stdout is reserved for the MCP JSON-RPC stream owned by the SDK's StdioTransport. The invariant is now enforced inside internal/mcp.Serve (every diagnostic goes to os.Stderr), but it remains a property of the cmd wiring too: requireConfig and loadServeConfig only write to the cli ErrWriter, and the only post-Serve cmd output is the *exitErr mapping below.
Write subcommands for the gojira CLI.
This file implements the five facade-write commands — create, update, comment, transitions, transition — and the small `loadWriteConfig` helper they share. They all reuse the same file<env<flag configuration cascade as crawl and serve, so a single GOJIRA_* environment / YAML file works across every subcommand of the binary.
No new capability is added here that the library does not already expose: each Action is a thin shell over the gojira facade (CreateIssue / UpdateIssue / AddComment / ListTransitions / TransitionIssue / TransitionIssueByStatus), plus the dry-run body builders (BuildCreateIssueBody / BuildUpdateIssueBody).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvMap ¶
EnvMap is the exported wrapper around envMap. It reads all GOJIRA_* environment variables once at process start and returns them as a map[string]string so the binary can hand them to Run.
Types ¶
This section is empty.