cmd

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Review   ReviewCmd  `cmd:"" default:"withargs" help:"Review a Markdown file in TUI (default command: commd file.md)"`
	PR       PRCmd      `cmd:"" help:"Review Markdown files in a GitHub PR"`
	Cclocate LocateCmd  `cmd:"cclocate" hidden:"" help:"(Deprecated) Locate file path from Claude Code transcript"`
	Cchook   HookCmd    `cmd:"cchook" hidden:"" help:"(Deprecated) Run as Claude Code hook (PreToolUse ExitPlanMode or PostToolUse Write|Edit)"`
	Version  VersionCmd `cmd:"" help:"Show version"`
}

CLI is the top-level command structure for commd.

type ExitCodeError added in v0.11.0

type ExitCodeError struct {
	Code int
}

ExitCodeError carries a non-zero process exit code out of a command so that main can exit with it once Kong has returned, instead of the command calling os.Exit itself (which would skip deferred cleanup and bypass Kong's own error handling).

func (ExitCodeError) Error added in v0.11.0

func (e ExitCodeError) Error() string

type HookCmd

type HookCmd struct {
	Spawner string `enum:"wezterm,tmux,auto" default:"auto" help:"Force specific multiplexer (wezterm|tmux|auto)"`
	Theme   string `enum:"dark,light" default:"dark" help:"Color theme (dark|light)"`
}

HookCmd is the hook subcommand.

func (*HookCmd) Run

func (h *HookCmd) Run() error

Run executes the hook subcommand.

Deprecated as a subcommand, but unlike cclocate it prints no runtime notice: Claude Code forwards the hook's stderr to Claude (as the denial reason on exit 2), so a notice would pollute the review feedback.

type LocateCmd

type LocateCmd struct {
	Transcript string `help:"Path to transcript JSONL file" type:"existingfile"`
	CWD        string `help:"Working directory for resolving relative plansDirectory" default:"." type:"existingdir"`
	Stdin      bool   `help:"Read hook JSON input from stdin"`
	All        bool   `help:"Output all plan files found in transcript"`
}

LocateCmd is the locate subcommand.

func (*LocateCmd) Run

func (l *LocateCmd) Run() error

Run executes the locate subcommand.

func (*LocateCmd) Validate added in v0.8.0

func (l *LocateCmd) Validate() error

Validate requires exactly one of --transcript or --stdin; with --stdin the transcript path comes from the hook input, so a --transcript given alongside it would be silently ignored. The path resolved from stdin is checked in Run, not here.

type PRCmd added in v0.7.0

type PRCmd struct {
	URL   string `arg:"" help:"GitHub PR URL (e.g. https://github.com/owner/repo/pull/123)"`
	File  string `help:"Review a specific file instead of showing file picker"`
	Theme string `enum:"dark,light" default:"dark" help:"Color theme (dark|light)"`
	// contains filtered or unexported fields
}

PRCmd is the pr subcommand for reviewing Markdown files in a GitHub PR.

func (*PRCmd) Run added in v0.7.0

func (p *PRCmd) Run(client *ghclient.Client) error

Run executes the pr subcommand. The GitHub client is provided by Kong via BindToProvider; tests may call Run with a stub client directly. URL is guaranteed parseable here because Validate runs first.

func (*PRCmd) Validate added in v0.8.0

func (p *PRCmd) Validate() error

Validate ensures the PR URL is well-formed before Run is invoked.

type ReviewCmd

type ReviewCmd struct {
	Files       []string `arg:"" optional:"" name:"file" help:"Path to the Markdown file (with --diff: zero or more changed files)"`
	Output      string   `enum:"clipboard,stdout,file" default:"clipboard" help:"Output method (clipboard|stdout|file)"`
	OutputPath  string   `help:"File path for file output" type:"path"`
	Theme       string   `enum:"dark,light" default:"dark" help:"Color theme (dark|light)"`
	TrackViewed bool     `help:"Persist viewed state to sidecar file for change detection across sessions"`
	Diff        bool     `help:"Review local git changes in diff view; with no file, pick from changed .md files"`
	Base        string   `help:"Git ref to diff against (default: HEAD; requires --diff)"`
	Web         bool     `help:"Review in a web browser instead of the TUI (served on 127.0.0.1)"`
	Port        int      `help:"Port for --web (default: a free port)"`
	NoOpen      bool     `help:"With --web, print the URL instead of opening a browser"`
	// contains filtered or unexported fields
}

ReviewCmd is the review subcommand.

func (*ReviewCmd) Run

func (r *ReviewCmd) Run() error

Run executes the review subcommand.

func (*ReviewCmd) Validate added in v0.8.0

func (r *ReviewCmd) Validate() error

Validate requires --output-path when --output=file, exactly one <file> unless --diff is set, --web for --port and --no-open, and a port number in 0-65535 (0, the default, picks a free port), and rejects --base and --track-viewed combinations that only make sense in one of the two modes.

type VersionCmd

type VersionCmd struct{}

VersionCmd is the version subcommand. The version string comes from the kong.Vars bound in main, not from a flag.

func (*VersionCmd) Run

func (v *VersionCmd) Run(vars kong.Vars) error

Run executes the version subcommand.

Jump to

Keyboard shortcuts

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