cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 28 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 by report URL."`
	Pin      PinCmd      `cmd:"" name:"pin" help:"Show a pin by report URL."`
	Pins     PinsCmd     `cmd:"" name:"pins" help:"Fetch pins by report URL."`
	Search   SearchCmd   `cmd:"" name:"search" help:"Search Disbug data."`
	Watch    WatchCmd    `cmd:"" name:"watch" help:"Stream new sessions as events."`
	Inspect  InspectCmd  `cmd:"" name:"inspect" help:"Inspect a downloaded local report JSON file."`

	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."`
	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 InspectCmd

type InspectCmd struct {
	Path     string `arg:"" name:"path" help:"Path to a downloaded Disbug local report JSON file."`
	Pin      int    `help:"Inspect one pin by number instead of returning the session summary."`
	Fields   string `help:"Comma-separated fields for --pin: screenshot,console,network,events,replay,voice_note,video,all."`
	CacheDir string `name:"cache-dir" help:"Directory for decoded local artifacts. Defaults to the user cache directory."`
}

InspectCmd reads a downloaded local Disbug report JSON file.

func (*InspectCmd) Run

func (c *InspectCmd) Run(_ context.Context, b bindings) error

Run prints compact local report data, decoding heavy artifacts only when requested.

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 PinCmd

type PinCmd struct {
	Ref    string `arg:"" name:"url" help:"Disbug report URL with ?pin=<number>."`
	Pin    int64  `help:"Pin number when the report URL does not include ?pin=."`
	Fields string `help:"Comma-separated fields: screenshot,console,network,events,replay,voice_note,video,all" default:"all"`
}

PinCmd shows a single pin by report URL 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:"urls" help:"One or more Disbug report URLs with ?pin=<number>."`
	Fields string   `help:"Default fields when a URL omits the fields query parameter." default:"all"`
}

PinsCmd fetches multiple pins by report URL 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:"url" help:"Disbug report URL (e.g. https://app.disbug.io/team/projects/1/sessions/2/)"`
}

SessionCmd shows a single session by report URL.

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"`
	Since   string `help:"Only include sessions newer than this duration, e.g. 30s, 15m, or 2h."`
}

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 VersionCmd

type VersionCmd struct{}

VersionCmd prints the CLI version.

func (VersionCmd) Run

func (VersionCmd) Run(b bindings) error

Run writes the version string.

type WatchCmd

type WatchCmd struct {
	CloudOnly    bool   `name:"cloud-only" help:"Watch cloud sessions only."`
	Since        string `help:"Backfill sessions newer than this duration before watching, e.g. 30s, 15m, or 2h."`
	Status       string `help:"Filter by status." enum:"open,resolved,dismissed," default:""`
	Project      string `help:"Filter by project slug."`
	Exec         string `help:"Run this shell command once per non-backfill event."`
	Format       string `help:"Output format." enum:"jsonl,text" default:"jsonl"`
	PollInterval string `help:"Polling interval." default:"30s"`
}

WatchCmd streams new Disbug sessions as JSONL events.

func (*WatchCmd) Run

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

Run streams session.new events until the context is cancelled.

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