cmd

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 31 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 AttachmentCmd added in v0.3.0

type AttachmentCmd struct {
	Download AttachmentDownloadCmd `cmd:"" help:"Download an attachment by ID."`
}

AttachmentCmd groups attachment operations.

type AttachmentDownloadCmd added in v0.3.0

type AttachmentDownloadCmd struct {
	Ref    string `arg:"" name:"url" help:"Disbug report URL with ?pin=<number>."`
	ID     int64  `arg:"" name:"attachment-id" help:"Attachment ID shown in session or pin output."`
	Output string `short:"o" help:"Destination file or directory; defaults to the attachment filename."`
	Stdout bool   `help:"Write the raw attachment bytes to stdout instead of a file."`
	Force  bool   `help:"Overwrite an existing destination file."`
}

AttachmentDownloadCmd downloads one pin attachment.

func (*AttachmentDownloadCmd) Run added in v0.3.0

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

Run downloads the attachment and writes either its bytes or saved-file metadata.

type CLI

type CLI struct {
	RootFlags

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

	Sessions   SessionsCmd   `cmd:"" name:"sessions" help:"List cloud sessions, optionally filtered by status or time."`
	Session    SessionCmd    `cmd:"" name:"session" help:"Show a cloud session summary from its report URL."`
	Pin        PinCmd        `cmd:"" name:"pin" help:"Fetch selected evidence for one pin from a report URL."`
	Pins       PinsCmd       `cmd:"" name:"pins" help:"Fetch evidence for pins from multiple report URLs."`
	Attachment AttachmentCmd `cmd:"" name:"attachment" help:"Download a file attached to a cloud pin."`
	Search     SearchCmd     `cmd:"" name:"search" help:"Search cloud sessions or pins."`
	Watch      WatchCmd      `cmd:"" name:"watch" help:"Stream newly saved cloud sessions as events."`
	Inspect    InspectCmd    `cmd:"" name:"inspect" help:"Inspect a downloaded local report JSON file."`

	Login     LoginCmd     `cmd:"" name:"login" help:"Authenticate and save a Disbug token profile."`
	Logout    LogoutCmd    `cmd:"" name:"logout" help:"Remove a saved Disbug token profile."`
	Whoami    WhoamiCmd    `cmd:"" name:"whoami" help:"Show the authenticated agent and team."`
	Configure ConfigureCmd `cmd:"" name:"configure" help:"Connect Disbug MCP and its workflow skill to AI coding agents."`
	Doctor    DoctorCmd    `cmd:"" name:"doctor" help:"Check login, backend compatibility, and agent integrations."`

	MCP        MCPCmd        `cmd:"" name:"mcp" help:"Run the Disbug MCP server over stdio."`
	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 ConfigureCmd added in v0.2.0

type ConfigureCmd struct {
	Agents    []string `name:"agent" help:"Agent to configure; repeat for more than one (codex, claude-code, cursor)."`
	Yes       bool     `short:"y" help:"Apply the displayed plan without prompting."`
	DryRun    bool     `name:"dry-run" help:"Show changes without applying them."`
	SkipMCP   bool     `name:"skip-mcp" help:"Do not configure the Disbug MCP server."`
	SkipSkill bool     `name:"skip-skill" help:"Do not install the using-disbug skill."`
	Force     bool     `help:"Replace an existing using-disbug skill not managed by Disbug."`
}

ConfigureCmd connects Disbug to supported AI coding agents.

func (*ConfigureCmd) Run added in v0.2.0

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

Run detects agents, previews exact changes, and applies them after confirmation.

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 {
	Get    PinGetCmd    `cmd:"" default:"withargs" help:"Fetch selected evidence for one pin."`
	Status PinStatusCmd `cmd:"" help:"Update a cloud pin status."`
}

PinCmd groups pin read and status commands while preserving `disbug pin <ref>`.

type PinGetCmd added in v0.3.0

type PinGetCmd 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"`
}

PinGetCmd shows a single pin by report URL and pin number.

func (*PinGetCmd) Run added in v0.3.0

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

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

type PinStatusCmd added in v0.3.0

type PinStatusCmd struct {
	Ref    string `arg:"" name:"ref" help:"Disbug report URL with ?pin=<number>."`
	Status string `arg:"" name:"status" enum:"open,resolved,dismissed" help:"New pin status."`
	Note   string `help:"Optional activity-log note."`
}

PinStatusCmd updates a pin status with an optional agent-authored note.

func (*PinStatusCmd) Run added in v0.3.0

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

Run updates the pin and writes the updated detail 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 {
	Get    SessionGetCmd    `cmd:"" default:"withargs" help:"Show a cloud session summary."`
	Status SessionStatusCmd `cmd:"" help:"Update a cloud session status."`
}

SessionCmd groups session read and status commands while preserving `disbug session <ref>`.

type SessionGetCmd added in v0.3.0

type SessionGetCmd struct {
	Ref string `arg:"" name:"url" help:"Disbug report URL (e.g. https://app.disbug.io/team/projects/1/sessions/2/)"`
}

SessionGetCmd shows a single session by report URL.

func (*SessionGetCmd) Run added in v0.3.0

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

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

type SessionStatusCmd added in v0.3.0

type SessionStatusCmd struct {
	Ref    string `arg:"" name:"ref" help:"Disbug session report URL."`
	Status string `arg:"" name:"status" enum:"open,resolved,dismissed" help:"New session status."`
	Note   string `help:"Optional activity-log note."`
}

SessionStatusCmd updates a session status with an optional agent-authored note.

func (*SessionStatusCmd) Run added in v0.3.0

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

Run updates the session and writes the updated detail 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