cli

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 58 Imported by: 0

Documentation

Overview

internal/cli/dashboard_context.go

Package cli contains the crankfire CLI orchestration: flag parsing, dependency wiring, and the per-protocol requester factory. It is invoked by cmd/crankfire and reused in-process by internal/tui.

Index

Constants

View Source
const (
	ExitOK              = 0
	ExitUsage           = 1
	ExitThresholdFailed = 2
	ExitRunnerError     = 3
)

Exit codes.

Variables

This section is empty.

Functions

func BuildDashboardContext added in v0.6.2

func BuildDashboardContext(targetURL string, cfg config.Config) runview.RequestContext

func BuildRunner

func BuildRunner(ctx context.Context, cfg config.Config) (*runner.Runner, *metrics.Collector, func(), error)

BuildRunner constructs the full runner dependency graph for an in-process run, mirroring the wiring used by the CLI Run() entrypoint. The returned cleanup func releases auth/data feeder/tracing resources and is safe to call once.

The provided ctx is used to initialize the tracing provider (matching the CLI behavior).

func GetBearerToken

func GetBearerToken(ctx context.Context, provider auth.Provider) (string, error)

GetBearerToken retrieves a token from the provider and formats it as a Bearer string.

func NewRequesterFromConfig

func NewRequesterFromConfig(cfg *config.Config, collector *metrics.Collector, provider auth.Provider, feeder feederAdapter) (runner.Requester, error)

NewRequesterFromConfig creates a runner.Requester based on the configuration protocol. This function is exported for use in integration tests.

func NewRequesterFromConfigWithTracing

func NewRequesterFromConfigWithTracing(cfg *config.Config, collector *metrics.Collector, provider auth.Provider, feeder feederAdapter, tp *tracing.Provider) (runner.Requester, error)

NewRequesterFromConfigWithTracing creates a runner.Requester with optional tracing support.

func NewSetBuilder

func NewSetBuilder() setrunner.Builder

NewSetBuilder returns the production Builder used by the CLI set runner. Other packages (e.g. the TUI) can use this to avoid duplicating wiring.

func Run

func Run(args []string) error

Run executes the crankfire CLI with the given argument slice (typically os.Args[1:]). It returns nil on success and an error otherwise.

func RunDaemon

func RunDaemon(ctx context.Context, st store.Store, dataDir string, args []string, stdout, stderr io.Writer) int

RunDaemon is the entry point for `crankfire daemon`. Blocks until ctx is cancelled (typically by SIGINT/SIGTERM via signal handler installed here, or by parent caller in tests).

func RunSession

func RunSession(ctx context.Context, st store.Store, args []string, stdout, stderr io.Writer) int

RunSession is the entry point for `crankfire session ...`.

func RunSet

func RunSet(ctx context.Context, st store.Store, args []string, stdout, stderr io.Writer) int

RunSet is the entry point invoked from cmd/crankfire/main.go for `set ...`. stdout / stderr are injected so tests can capture them.

Types

This section is empty.

Directories

Path Synopsis
Package livedash is the CLI-facing driver that hosts a runview.Model in a bubbletea Program, polls the metrics collector on a fixed interval, and forwards user keystrokes (q/esc/ctrl+c) to a shutdown callback.
Package livedash is the CLI-facing driver that hosts a runview.Model in a bubbletea Program, polls the metrics collector on a fixed interval, and forwards user keystrokes (q/esc/ctrl+c) to a shutdown callback.

Jump to

Keyboard shortcuts

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