cmd

package
v0.0.0-...-53658a8 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (err error)

Execute parses args and dispatches to the selected command.

func ExitCode

func ExitCode(err error) int

ExitCode returns the exit code for the given error.

func VersionString

func VersionString() string

VersionString returns the human-readable version string.

Types

type CLI

type CLI struct {
	RootFlags

	Version kong.VersionFlag `name:"version" help:"Show version."`

	Sessions SessionsCmd `cmd:"" name:"sessions" help:"List sessions."`
	Session  SessionCmd  `cmd:"" name:"session" help:"Show a session."`
	Pin      PinCmd      `cmd:"" name:"pin" help:"Show a pin."`
	Pins     PinsCmd     `cmd:"" name:"pins" help:"List pins."`
	Search   SearchCmd   `cmd:"" name:"search" help:"Search Disbug data."`

	Login  LoginCmd  `cmd:"" name:"login" help:"Log in to Disbug."`
	Logout LogoutCmd `cmd:"" name:"logout" help:"Log out of Disbug."`
	Whoami WhoamiCmd `cmd:"" name:"whoami" help:"Show the current user."`
	Doctor DoctorCmd `cmd:"" name:"doctor" help:"Check CLI configuration."`

	MCP           MCPCmd           `cmd:"" name:"mcp" help:"Run MCP integration commands."`
	NativeHost    NativeHostCmd    `cmd:"" name:"native-host" help:"Run the browser native messaging host."`
	SetupLocal    SetupLocalCmd    `cmd:"" name:"setup-local" help:"Install local AI handoff support."`
	LocalSessions LocalSessionsCmd `cmd:"" name:"local-sessions" help:"Manage local sessions."`
	Completion    CompletionCmd    `cmd:"" name:"completion" help:"Generate shell completion scripts."`
	VersionCmd    VersionCmd       `cmd:"" name:"version" help:"Print the disbug version."`
}

CLI is the root Kong command graph.

type CompletionCmd

type CompletionCmd struct {
	Shell string `arg:"" enum:"bash,zsh,fish,powershell" help:"Shell to generate completions for."`
}

CompletionCmd prints shell completion scripts.

func (CompletionCmd) Run

func (c CompletionCmd) Run(b bindings) error

Run writes the placeholder shell completion script.

type DoctorCmd

type DoctorCmd struct{}

DoctorCmd checks local CLI configuration and backend compatibility.

func (*DoctorCmd) Run

func (c *DoctorCmd) Run(ctx context.Context, b bindings) error

Run prints a simple human-readable health report.

type LocalSessionsCmd

type LocalSessionsCmd struct {
	List   LocalSessionsListCmd   `cmd:"" name:"list" help:"List local sessions."`
	Show   LocalSessionsShowCmd   `cmd:"" name:"show" help:"Show local session metadata."`
	Delete LocalSessionsDeleteCmd `cmd:"" name:"delete" help:"Delete a local session."`
	Prune  LocalSessionsPruneCmd  `cmd:"" name:"prune" help:"Delete old local sessions."`
	Path   LocalSessionsPathCmd   `cmd:"" name:"path" help:"Print the local session store path."`
}

LocalSessionsCmd manages local reports written by native-host.

type LocalSessionsDeleteCmd

type LocalSessionsDeleteCmd struct {
	ID string `arg:"" name:"local-id" help:"Local session id."`
}

LocalSessionsDeleteCmd deletes one local session.

func (*LocalSessionsDeleteCmd) Run

func (c *LocalSessionsDeleteCmd) Run(ctx context.Context, b bindings) error

Run deletes a local session and writes a confirmation as JSON.

type LocalSessionsListCmd

type LocalSessionsListCmd struct {
	Limit int `default:"50" help:"Maximum sessions to return."`
}

LocalSessionsListCmd lists committed local sessions.

func (*LocalSessionsListCmd) Run

func (c *LocalSessionsListCmd) Run(ctx context.Context, b bindings) error

Run lists local sessions and writes the response as JSON.

type LocalSessionsPathCmd

type LocalSessionsPathCmd struct{}

LocalSessionsPathCmd prints the local session store path.

func (*LocalSessionsPathCmd) Run

func (c *LocalSessionsPathCmd) Run(ctx context.Context, b bindings) error

Run prints the local session store path.

type LocalSessionsPruneCmd

type LocalSessionsPruneCmd struct {
	OlderThan string `name:"older-than" required:"" help:"Delete sessions older than duration, e.g. 30d or 12h."`
}

LocalSessionsPruneCmd deletes local sessions older than the requested age.

func (*LocalSessionsPruneCmd) Run

func (c *LocalSessionsPruneCmd) Run(ctx context.Context, b bindings) error

Run prunes local sessions older than the requested duration.

type LocalSessionsShowCmd

type LocalSessionsShowCmd struct {
	ID string `arg:"" name:"local-id" help:"Local session id."`
}

LocalSessionsShowCmd shows one local session.

func (*LocalSessionsShowCmd) Run

func (c *LocalSessionsShowCmd) Run(ctx context.Context, b bindings) error

Run shows local session metadata as JSON.

type LoginCmd

type LoginCmd struct {
	Name           string  `help:"Agent name to pre-fill. Defaults to hostname."`
	APIURL         string  `name:"api-url" env:"DISBUG_API_URL" default:"https://disbug.io" help:"Disbug API URL."`
	ListenAddr     string  `name:"listen-addr" help:"Local listener host:port override."`
	Manual         bool    `help:"Print auth URL and paste redirect URL back instead of listening."`
	NoBrowser      bool    `name:"no-browser" help:"Print auth URL instead of opening the browser."`
	Force          bool    `help:"Overwrite an existing token profile."`
	Token          *string `help:"Set token directly."`
	TokenFromStdin bool    `name:"token-from-stdin" help:"Read token from the first stdin line."`
	TokenFromEnv   bool    `name:"token-from-env" help:"Read token from DISBUG_LOGIN_TOKEN."`
}

LoginCmd logs in to Disbug and persists a token profile.

func (*LoginCmd) Run

func (c *LoginCmd) Run(ctx context.Context, b bindings) error

Run executes the login flow.

type LogoutCmd

type LogoutCmd struct {
	LocalOnly bool `name:"local-only" help:"Skip server revoke; just delete local profile."`
}

LogoutCmd logs out by revoking the current token and removing the local profile.

func (*LogoutCmd) Run

func (c *LogoutCmd) Run(ctx context.Context, b bindings) error

Run executes logout.

type MCPCmd

type MCPCmd struct{}

MCPCmd runs the MCP stdio server.

func (*MCPCmd) Run

func (c *MCPCmd) Run(ctx context.Context, b bindings) error

Run starts the MCP stdio server using the selected profile.

type NativeHostCmd

type NativeHostCmd struct{}

NativeHostCmd runs the Chrome native messaging host.

func (*NativeHostCmd) Run

func (c *NativeHostCmd) Run(ctx context.Context, b bindings) error

Run serves native messaging over stdin/stdout.

type PinCmd

type PinCmd struct {
	Ref    string `arg:"" name:"pin" help:"Pin reference (e.g. 7392.2)"`
	Fields string `help:"Comma-separated fields: screenshot,console,network,events,replay,voice_note,video,all" default:"all"`
}

PinCmd shows a single pin by session and pin number.

func (*PinCmd) Run

func (c *PinCmd) Run(ctx context.Context, b bindings) error

Run fetches a pin detail response and writes it as JSON.

type PinsCmd

type PinsCmd struct {
	Refs   []string `arg:"" name:"refs" help:"One or more pin refs (e.g. 7392.2 or 7392.2:console,network)"`
	Fields string   `help:"Default fields when ref omits :<fields>" default:"all"`
}

PinsCmd fetches multiple pins by session and pin number.

func (*PinsCmd) Run

func (c *PinsCmd) Run(ctx context.Context, b bindings) error

Run fetches pins in bulk and writes the aggregate result as JSON.

type RootFlags

type RootFlags struct {
	Pretty  bool   `help:"Indent JSON output with 2 spaces."`
	Profile string `default:"default" env:"DISBUG_PROFILE" help:"Configuration profile to use."`
	Verbose bool   `short:"v" help:"Enable verbose logging."`
}

RootFlags are global flags accepted by every command.

type SearchCmd

type SearchCmd struct {
	Query string `arg:"" name:"query" help:"Search query"`
	Scope string `help:"Search scope" enum:"sessions,pins" default:"sessions"`
	Limit int    `help:"Max results (1-50)" default:"20"`
}

SearchCmd searches sessions or pins.

func (*SearchCmd) Run

func (c *SearchCmd) Run(ctx context.Context, b bindings) error

Run searches Disbug data and writes the response as JSON.

type SessionCmd

type SessionCmd struct {
	Ref string `arg:"" name:"session" help:"Session id (e.g. 7392)"`
}

SessionCmd shows a single session.

func (*SessionCmd) Run

func (c *SessionCmd) Run(ctx context.Context, b bindings) error

Run fetches a session detail response and writes it as JSON.

type SessionsCmd

type SessionsCmd struct {
	Status  string `help:"Filter by status" enum:"open,resolved,dismissed," default:""`
	Project string `help:"Filter by project slug"`
	Limit   int    `help:"Max results (1-100)" default:"50"`
	Cursor  string `help:"Pagination cursor"`
}

SessionsCmd lists sessions.

func (*SessionsCmd) Run

func (c *SessionsCmd) Run(ctx context.Context, b bindings) error

Run lists sessions and writes the paginated response as JSON.

type SetupLocalCmd

type SetupLocalCmd struct {
	ExtensionIDs []string `name:"extension-id" help:"Chrome extension id to allow. Repeat for production and dev ids."`
	SkipMCP      bool     `name:"skip-mcp" help:"Install browser native-host manifests without editing MCP configs."`
}

SetupLocalCmd installs local native-host and MCP configuration.

func (*SetupLocalCmd) Run

func (c *SetupLocalCmd) Run(ctx context.Context, b bindings) error

Run installs local AI handoff support.

type VersionCmd

type VersionCmd struct{}

VersionCmd prints the CLI version.

func (VersionCmd) Run

func (VersionCmd) Run(b bindings) error

Run writes the version string.

type WhoamiCmd

type WhoamiCmd struct{}

WhoamiCmd shows the current token identity.

func (*WhoamiCmd) Run

func (c *WhoamiCmd) Run(ctx context.Context, b bindings) error

Run fetches the current identity and writes it as JSON.

Jump to

Keyboard shortcuts

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