cmd

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachCmd

type AttachCmd struct {
	AllowDangerouslySkipPermissions bool   `help:"Skip permission prompts in Claude (DANGEROUS - use with caution)"`
	Branch                          string `help:"Override branch name (default: auto-detect from git)"`
	Repo                            string `help:"Override repository path (default: auto-detect)"`
	SessionName                     string `help:"Override session name (default: auto-detect from branch/directory)"`
	TmuxStatusPosition              string `help:"Tmux status bar position (top or bottom)" default:"bottom" enum:"top,bottom"`
	Worktree                        string `help:"Override worktree path (default: current directory)"`
}

AttachCmd attaches to a tmux session, creating it if needed

func (*AttachCmd) Run

func (a *AttachCmd) Run(cli *CLI) error

Run executes the attach command

type CLI

type CLI struct {
	Version     kong.VersionFlag `help:"Show version information"`
	Debug       bool             `help:"Enable debug logging to file" short:"d"`
	DebugFile   string           `help:"Custom path for debug log file (disables automatic cleanup)"`
	MaxLogFiles int              `help:"Maximum number of log files to keep (0 = unlimited)" default:"1000"`

	Run         RunCmd         `cmd:"" help:"Start the rocha TUI (default)" default:"1"`
	Setup       SetupCmd       `cmd:"setup" help:"Configure tmux status bar integration automatically"`
	Stats       StatsCmd       `cmd:"stats" help:"Show token usage statistics"`
	Hooks       HooksCmd       `cmd:"hooks" help:"View Claude Code hook events"`
	Status      StatusCmd      `cmd:"status" help:"Show session state counts for tmux status bar" hidden:""`
	Attach      AttachCmd      `cmd:"attach" help:"Attach to tmux session (creates if needed)"`
	StartClaude StartClaudeCmd `cmd:"start-claude" help:"Start Claude Code with hooks configured" hidden:""`
	PlaySound   PlaySoundCmd   `cmd:"play-sound" help:"Play notification sound (cross-platform)" hidden:""`
	Notify      NotifyCmd      `cmd:"notify" help:"Handle notification event from Claude hooks" hidden:""`
	Sessions    SessionsCmd    `cmd:"sessions" help:"Manage sessions (list, view, add, del)"`
	Settings    SettingsCmd    `cmd:"settings" help:"Manage settings (meta)"`

	// Internal fields (not flags)
	Container *Container `kong:"-"`
	// contains filtered or unexported fields
}

CLI represents the command-line interface structure

func (*CLI) AfterApply

func (c *CLI) AfterApply() error

AfterApply initializes logging after CLI parsing and applies settings

func (*CLI) Close

func (c *CLI) Close() error

Close closes all resources held by the CLI

func (*CLI) SetSettings

func (c *CLI) SetSettings(settings *config.Settings)

SetSettings sets the settings on the CLI struct

type ClaudeDirResolverAdapter

type ClaudeDirResolverAdapter struct {
	// contains filtered or unexported fields
}

ClaudeDirResolverAdapter implements application.ClaudeDirResolver

func NewClaudeDirResolverAdapter

func NewClaudeDirResolverAdapter(sessionReader ports.SessionReader) *ClaudeDirResolverAdapter

NewClaudeDirResolverAdapter creates a new ClaudeDirResolverAdapter

func (*ClaudeDirResolverAdapter) Resolve

func (r *ClaudeDirResolverAdapter) Resolve(repoInfo, userOverride string) string

Resolve determines ClaudeDir with precedence: 1. User override (if provided and non-empty) 2. Existing sessions' ClaudeDir (if repo has sessions with ClaudeDir set) 3. Default ~/.claude

type Container

type Container struct {
	// Services
	GitService          *services.GitService
	HookStatsService    *services.HookStatsService
	MigrationService    *services.MigrationService
	NotificationService *services.NotificationService
	SessionService      *services.SessionService
	SettingsService     *services.SettingsService
	ShellService        *services.ShellService
	TokenStatsService   *services.TokenStatsService
	// contains filtered or unexported fields
}

Container holds all dependencies for the application

func NewContainer

func NewContainer() (*Container, error)

NewContainer creates a new Container with all dependencies wired

func (*Container) Close

func (c *Container) Close() error

Close closes all resources held by the container

type HooksCmd

type HooksCmd struct {
	Event       string `help:"Filter by hook event type" short:"e"`
	Format      string `help:"Output format (table or json)" default:"table" enum:"table,json" short:"f"`
	From        string `help:"Start time (RFC3339 or relative)"`
	Limit       int    `help:"Maximum number of results" default:"100" short:"l"`
	SessionName string `arg:"" optional:"" help:"Rocha session name"`
	To          string `help:"End time (RFC3339 or relative)"`
}

HooksCmd shows Claude Code hook events

func (*HooksCmd) Run

func (h *HooksCmd) Run(cli *CLI) error

Run executes the hooks command

type NotifyCmd

type NotifyCmd struct {
	Handle   NotifyHandleCmd   `cmd:"handle" help:"Handle notification event from Claude hooks" default:"withargs"`
	ShowLogs NotifyShowLogsCmd `cmd:"show-logs" help:"Display hook execution logs"`
}

NotifyCmd is the container for notification subcommands

type NotifyHandleCmd

type NotifyHandleCmd struct {
	SessionName string `arg:"" help:"Name of the session triggering the notification"`
	EventType   string `` /* 191-byte string literal not displayed */
	ExecutionID string `help:"Execution ID from parent rocha TUI" optional:""`
}

NotifyHandleCmd handles notification events from Claude hooks NOTE: Field order matters for Kong positional args - SessionName must come before EventType

func (*NotifyHandleCmd) Run

func (n *NotifyHandleCmd) Run(cli *CLI) error

Run executes the notification handler

type NotifyShowLogsCmd

type NotifyShowLogsCmd struct {
	Session string `arg:"" optional:"" help:"Filter by session name"`
	Since   string `help:"Show logs since duration (e.g., '1h', '30m')" default:"1h"`
	Format  string `help:"Output format (table or json)" default:"table" enum:"table,json"`
}

NotifyShowLogsCmd displays hook execution logs

func (*NotifyShowLogsCmd) Run

func (s *NotifyShowLogsCmd) Run(cli *CLI) error

Run executes the show-logs command

type PlaySoundCmd

type PlaySoundCmd struct{}

PlaySoundCmd plays a notification sound

func (*PlaySoundCmd) Run

func (p *PlaySoundCmd) Run(cli *CLI) error

Run executes the sound playing logic

type RunCmd

type RunCmd struct {
	Dev                        bool   `help:"Enable development mode (shows version info in dialogs)"`
	Editor                     string `help:"Editor to open sessions in (overrides $ROCHA_EDITOR, $VISUAL, $EDITOR)" default:"code"`
	ErrorClearDelay            int    `help:"Seconds before error messages auto-clear" default:"10"`
	ShowPRNumber               bool   `help:"Show PR number in git stats (fetched on detach)" default:"true"`
	ShowTimestamps             bool   `help:"Show relative timestamps for last state changes" default:"false"`
	ShowTokenChart             bool   `help:"Show token usage chart by default" default:"false"`
	StatusColors               string `help:"Comma-separated ANSI color codes for statuses (e.g., '141,33,214,226,46')" default:"141,33,214,226,46"`
	StatusIcons                string `help:"Comma-separated status icons (optional, colors are used for display)" default:""`
	Statuses                   string `help:"Comma-separated status names (e.g., 'spec,plan,implement,review,done')" default:"spec,plan,implement,review,done"`
	TimestampRecentColor       string `help:"ANSI color code for recent timestamps" default:"241"`
	TimestampRecentMinutes     int    `help:"Minutes threshold for recent timestamps (gray color)" default:"5"`
	TimestampStaleColor        string `help:"ANSI color code for stale timestamps (matches waiting state ◐)" default:"1"`
	TimestampWarningColor      string `help:"ANSI color code for warning timestamps (matches idle state ○)" default:"3"`
	TimestampWarningMinutes    int    `help:"Minutes threshold for warning timestamps (yellow color)" default:"20"`
	TipsDisplayDurationSeconds int    `help:"Seconds to display each tip" default:"90"`
	TipsEnabled                bool   `help:"Enable rotating tips display" default:"true"`
	TipsShowIntervalSeconds    int    `help:"Seconds between tips" default:"2"`
	TmuxStatusPosition         string `help:"Tmux status bar position (top or bottom)" default:"bottom" enum:"top,bottom"`
}

RunCmd starts the TUI application

func (*RunCmd) Run

func (r *RunCmd) Run(cli *CLI) error

Run executes the TUI

type SessionSetCmd

type SessionSetCmd struct {
	All      bool   `help:"Apply to all sessions" short:"a"`
	KillTmux bool   `help:"Kill tmux sessions to apply changes immediately" short:"k"`
	Name     string `arg:"" optional:"" help:"Name of the session (omit when using --all)"`
	Value    string `help:"Value to set (empty string to clear)" required:""`
	Variable string `help:"Variable to set" short:"v" enum:"claudedir,allow-dangerously-skip-permissions" required:""`
}

SessionSetCmd sets configuration for a session

func (*SessionSetCmd) AfterApply

func (s *SessionSetCmd) AfterApply() error

AfterApply validates that either Name or All is provided, but not both

func (*SessionSetCmd) Run

func (s *SessionSetCmd) Run(cli *CLI) error

Run executes the set command

type SessionsAddCmd

type SessionsAddCmd struct {
	AllowDangerouslySkipPermissions bool   `help:"Skip permission prompts in Claude (DANGEROUS)"`
	BranchName                      string `help:"Branch name" default:""`
	DisplayName                     string `help:"Display name for the session" default:""`
	InitialPrompt                   string `help:"Initial prompt to send to Claude on session start" name:"prompt" short:"p" default:""`
	Name                            string `arg:"" help:"Name of the session to add"`
	RepoInfo                        string `help:"Repository info" default:""`
	RepoPath                        string `help:"Repository path" default:""`
	RepoSource                      string `help:"Repository source URL (creates worktree)" default:""`
	StartClaude                     bool   `help:"Create tmux session and start Claude" name:"start-claude"`
	State                           string `help:"Initial state" enum:"idle,working,waiting,exited" default:"idle"`
	WorktreePath                    string `help:"Worktree path" default:""`
}

SessionsAddCmd adds a new session

func (*SessionsAddCmd) Run

func (s *SessionsAddCmd) Run(cli *CLI) error

Run executes the add command

type SessionsArchiveCmd

type SessionsArchiveCmd struct {
	Force              bool   `help:"Skip confirmation prompt" short:"f"`
	Name               string `arg:"" help:"Name of the session to archive/unarchive"`
	RemoveWorktree     bool   `help:"Remove associated git worktree" short:"w"`
	SkipWorktreePrompt bool   `help:"Don't prompt about worktree removal" short:"s"`
}

SessionsArchiveCmd archives or unarchives a session

func (*SessionsArchiveCmd) Run

func (s *SessionsArchiveCmd) Run(cli *CLI) error

Run executes the archive command

type SessionsCaptureCmd

type SessionsCaptureCmd struct {
	Lines int    `help:"Number of lines to capture" default:"50" short:"n"`
	Name  string `arg:"" help:"Session name"`
}

SessionsCaptureCmd captures the content of a session's tmux pane

func (*SessionsCaptureCmd) Run

func (s *SessionsCaptureCmd) Run(cli *CLI) error

Run executes the capture command

type SessionsCmd

type SessionsCmd struct {
	Add               SessionsAddCmd               `cmd:"add" help:"Add a new session"`
	Archive           SessionsArchiveCmd           `cmd:"archive" help:"Archive or unarchive a session"`
	Capture           SessionsCaptureCmd           `cmd:"capture" help:"Capture session pane content"`
	Comment           SessionsCommentCmd           `cmd:"comment" help:"Add, edit, or clear session comment"`
	Del               SessionsDelCmd               `cmd:"del" help:"Delete a session"`
	Duplicate         SessionsDuplicateCmd         `cmd:"duplicate" help:"Create session from existing repository"`
	Flag              SessionsFlagCmd              `cmd:"flag" help:"Toggle session flag"`
	List              SessionsListCmd              `cmd:"list" help:"List all sessions" default:"1"`
	Move              SessionsMoveCmd              `cmd:"move" aliases:"mv" help:"Move sessions between ROCHA_HOME directories"`
	OpenPR            SessionsOpenPRCmd            `cmd:"open-pr" help:"Open PR in browser for a session"`
	Rename            SessionsRenameCmd            `cmd:"rename" help:"Update session display name"`
	Set               SessionSetCmd                `cmd:"set" help:"Set session configuration"`
	Status            SessionsStatusCmd            `cmd:"status" help:"Set or clear implementation status"`
	View              SessionsViewCmd              `cmd:"view" help:"View a specific session"`
	ViewAgentSettings SessionsViewAgentSettingsCmd `cmd:"view-agent-settings" help:"Inspect agent settings from running process"`
}

SessionsCmd manages sessions

type SessionsCommentCmd

type SessionsCommentCmd struct {
	Comment string `help:"Comment text (empty clears)" required:""`
	Name    string `arg:"" help:"Session name"`
}

SessionsCommentCmd adds, edits, or clears a session comment

func (*SessionsCommentCmd) Run

func (s *SessionsCommentCmd) Run(cli *CLI) error

Run executes the comment command

type SessionsDelCmd

type SessionsDelCmd struct {
	Force              bool   `help:"Force deletion without confirmation" short:"f"`
	Name               string `arg:"" help:"Name of the session to delete"`
	SkipKillTmux       bool   `help:"Skip killing tmux session" short:"k"`
	SkipRemoveWorktree bool   `help:"Skip removing associated git worktree" short:"w"`
}

SessionsDelCmd deletes a session

func (*SessionsDelCmd) Run

func (s *SessionsDelCmd) Run(cli *CLI) error

Run executes the del command

type SessionsDuplicateCmd

type SessionsDuplicateCmd struct {
	Branch  string `help:"Branch for new session"`
	Name    string `arg:"" help:"Source session name"`
	NewName string `help:"New session name" required:"" name:"new-name"`
}

SessionsDuplicateCmd creates a new session from an existing repository

func (*SessionsDuplicateCmd) Run

func (s *SessionsDuplicateCmd) Run(cli *CLI) error

Run executes the duplicate command

type SessionsFlagCmd

type SessionsFlagCmd struct {
	Name string `arg:"" help:"Session name"`
}

SessionsFlagCmd toggles the flag state of a session

func (*SessionsFlagCmd) Run

func (s *SessionsFlagCmd) Run(cli *CLI) error

Run executes the flag command

type SessionsListCmd

type SessionsListCmd struct {
	Format       string `help:"Output format: table or json" enum:"table,json" default:"table"`
	ShowArchived bool   `help:"Show archived sessions" short:"a"`
}

SessionsListCmd lists all sessions

func (*SessionsListCmd) Run

func (s *SessionsListCmd) Run(cli *CLI) error

Run executes the list command

type SessionsMoveCmd

type SessionsMoveCmd struct {
	Force bool   `help:"Skip confirmation prompt" short:"f"`
	From  string `help:"Source ROCHA_HOME path" required:"true"`
	Repo  string `help:"Repository identifier (owner/repo format)" short:"r" required:"true"`
	To    string `help:"Destination ROCHA_HOME path" required:"true"`
}

SessionsMoveCmd moves sessions between ROCHA_HOME directories

func (*SessionsMoveCmd) Run

func (s *SessionsMoveCmd) Run(cli *CLI) error

Run executes the move command

type SessionsOpenPRCmd added in v0.0.3

type SessionsOpenPRCmd struct {
	Name string `arg:"" help:"Session name"`
}

func (*SessionsOpenPRCmd) Run added in v0.0.3

func (s *SessionsOpenPRCmd) Run(cli *CLI) error

type SessionsRenameCmd

type SessionsRenameCmd struct {
	DisplayName string `help:"New display name" required:"" name:"display-name"`
	Name        string `arg:"" help:"Session name"`
}

SessionsRenameCmd updates the display name of a session

func (*SessionsRenameCmd) Run

func (s *SessionsRenameCmd) Run(cli *CLI) error

Run executes the rename command

type SessionsStatusCmd

type SessionsStatusCmd struct {
	List   bool   `help:"List available statuses" short:"l" xor:"action"`
	Name   string `arg:"" optional:"" help:"Session name"`
	Status string `help:"Status (empty or 'clear' clears)" xor:"action"`
}

SessionsStatusCmd sets or clears the implementation status of a session

func (*SessionsStatusCmd) AfterApply

func (s *SessionsStatusCmd) AfterApply() error

AfterApply validates that Name is provided when not listing

func (*SessionsStatusCmd) Run

func (s *SessionsStatusCmd) Run(cli *CLI) error

Run executes the status command

type SessionsViewAgentSettingsCmd

type SessionsViewAgentSettingsCmd struct {
	Name string `arg:"" help:"Name of the session"`
}

SessionsViewAgentSettingsCmd displays actual agent settings from running process

func (*SessionsViewAgentSettingsCmd) Run

func (s *SessionsViewAgentSettingsCmd) Run(cli *CLI) error

Run executes the view-agent-settings command

type SessionsViewCmd

type SessionsViewCmd struct {
	Format string `help:"Output format: table or json" enum:"table,json" default:"table"`
	Name   string `arg:"" help:"Name of the session to view"`
}

SessionsViewCmd views a specific session

func (*SessionsViewCmd) Run

func (s *SessionsViewCmd) Run(cli *CLI) error

Run executes the view command

type SettingsCmd

type SettingsCmd struct {
	Keys SettingsKeysCmd `cmd:"keys" help:"Manage keyboard shortcuts"`
	Meta SettingsMetaCmd `cmd:"meta" help:"Show settings file location and available options" default:"1"`
}

SettingsCmd manages settings

type SettingsKeysCmd

type SettingsKeysCmd struct {
	List SettingsKeysListCmd `cmd:"list" help:"List all key bindings (defaults and custom)" default:"1"`
	Set  SettingsKeysSetCmd  `cmd:"set" help:"Set a key binding"`
}

SettingsKeysCmd manages keyboard shortcuts

type SettingsKeysListCmd

type SettingsKeysListCmd struct {
	Format string `help:"Output format: table or json" enum:"table,json" default:"table"`
}

SettingsKeysListCmd lists all key bindings

func (*SettingsKeysListCmd) Run

func (s *SettingsKeysListCmd) Run(cli *CLI) error

Run executes the list command

type SettingsKeysSetCmd

type SettingsKeysSetCmd struct {
	Key   string `arg:"" help:"Key name (e.g., archive, help, quit)"`
	Value string `arg:"" help:"Key binding (e.g., a, ctrl+s, or comma-separated for multiple: up,k)"`
}

SettingsKeysSetCmd sets a key binding

func (*SettingsKeysSetCmd) Run

func (s *SettingsKeysSetCmd) Run(cli *CLI) error

Run executes the set command

type SettingsMetaCmd

type SettingsMetaCmd struct {
	Format string `help:"Output format: table or json" enum:"table,json" default:"table"`
}

SettingsMetaCmd displays settings metadata

func (*SettingsMetaCmd) Run

func (s *SettingsMetaCmd) Run(cli *CLI) error

Run executes the meta command

type SetupCmd

type SetupCmd struct {
}

SetupCmd configures tmux automatically

func (*SetupCmd) Run

func (s *SetupCmd) Run(cli *CLI) error

Run executes the setup command

type StartClaudeCmd

type StartClaudeCmd struct {
	Args []string `arg:"" optional:"" help:"Additional arguments to pass to claude"`
}

StartClaudeCmd starts Claude Code with hooks configured

func (*StartClaudeCmd) Run

func (s *StartClaudeCmd) Run(cli *CLI) error

Run executes Claude with hooks configuration

type StatsCmd

type StatsCmd struct {
	Format string `help:"Output format (table or chart)" default:"table" enum:"table,chart"`
}

StatsCmd shows token usage statistics

func (*StatsCmd) Run

func (s *StatsCmd) Run(cli *CLI) error

Run executes the stats command

type StatusCmd

type StatusCmd struct{}

StatusCmd displays session state counts for tmux status bar

func (*StatusCmd) Run

func (s *StatusCmd) Run(cli *CLI) error

Run executes the status command

Jump to

Keyboard shortcuts

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