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
- func BuildDashboardContext(targetURL string, cfg config.Config) runview.RequestContext
- func BuildRunner(ctx context.Context, cfg config.Config) (*runner.Runner, *metrics.Collector, func(), error)
- func GetBearerToken(ctx context.Context, provider auth.Provider) (string, error)
- func NewRequesterFromConfig(cfg *config.Config, collector *metrics.Collector, provider auth.Provider, ...) (runner.Requester, error)
- func NewRequesterFromConfigWithTracing(cfg *config.Config, collector *metrics.Collector, provider auth.Provider, ...) (runner.Requester, error)
- func NewSetBuilder() setrunner.Builder
- func Run(args []string) error
- func RunDaemon(ctx context.Context, st store.Store, dataDir string, args []string, ...) int
- func RunSession(ctx context.Context, st store.Store, args []string, stdout, stderr io.Writer) int
- func RunSet(ctx context.Context, st store.Store, args []string, stdout, stderr io.Writer) int
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
RunSession is the entry point for `crankfire session ...`.
Types ¶
This section is empty.
Source Files
¶
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. |