cli

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MPL-2.0 Imports: 46 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cli holds the txco subcommand surface — the developer-facing rule-authoring loop. Subcommands live in their own files (init.go, apply.go, diff.go); this file is just the dispatcher.

The dispatcher is invoked from chassis/main.go before the server-mode config loader, so subcommands can declare their own flag namespaces without colliding with the server's --web-addr et al.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(args []string, stdout, stderr io.Writer) (status int, ok bool)

Dispatch routes a `txco <subcommand> ...` invocation to the right command. Returns ok=true if a subcommand was dispatched (caller should exit with the returned status code) and ok=false if the args don't name a known subcommand (caller should fall through to server-mode boot).

args is typically os.Args; args[0] is the program name, args[1] is the subcommand. `serve` is recognized but treated as a no-op so the server-mode boot can run.

Bare `txco` prints help (Stripe/gcloud-style) — starting the server now requires the explicit `txco serve`. Server-mode flags (e.g. `txco --web-addr=:8080`) still fall through for back-compat.

Types

type BuildInfo added in v0.2.1

type BuildInfo struct {
	Version        string
	CommitId       string
	BuildTimestamp string
}

BuildInfo carries the ldflag-injected build identity (set in cmd/txco/main.go, stamped at build time by chassis/Makefile or .github/workflows/release.yml). app.Run assigns Build before calling Dispatch so the help screen + the `version` subcommand can read it without threading it through every signature.

var Build BuildInfo

Build is the process-wide build identity. Zero values are tolerated — the help line is suppressed and the version JSON simply contains empty strings; for real binaries app.Run sets it before any CLI dispatch.

type ResolvedTarget

type ResolvedTarget struct {
	Name    string
	Chassis string
	// ChassisExplicit is true when Chassis came from real config
	// (txco.yaml target / legacy addr), false when it's the
	// synthesized http://localhost:8081 fallback. Lets resolveTarget
	// prefer the signing profile's bound chassis_url over a blind
	// localhost default, without overriding an explicit config.
	ChassisExplicit bool
	User            string
	Pass            string
	Mock            string // "allow" | "deny"
	Operations      map[string]operationConfig
}

ResolvedTarget is what apply / diff / dev consume. It's flat by design: no operation merging or auth lookup happens past this point.

func (ResolvedTarget) AsClientTarget

func (t ResolvedTarget) AsClientTarget() client.Target

AsClientTarget reduces a ResolvedTarget to the subset the admin HTTP client needs (URL + basic auth). Kept separate so the dev/apply code paths can keep all the operation map / mock policy bits without leaking them into the client package.

Directories

Path Synopsis
Package auth implements the `txco auth …` CLI surface — keygen, dev enrollment, signed whoami, key rotation, and revocation.
Package auth implements the `txco auth …` CLI surface — keygen, dev enrollment, signed whoami, key rotation, and revocation.
Package banner holds the txco logo + small TTY helpers used by every subcommand's help/usage screen.
Package banner holds the txco logo + small TTY helpers used by every subcommand's help/usage screen.
Package bundle walks an on-disk OPS/ tree and produces a flat list of (stack, scope, name, txcl, mock_req, mock_res) records suitable for POSTing to the admin /v1/ops/import endpoint.
Package bundle walks an on-disk OPS/ tree and produces a flat list of (stack, scope, name, txcl, mock_req, mock_res) records suitable for POSTing to the admin /v1/ops/import endpoint.
Package client is the small HTTP client the txco CLI uses to talk to a running chassis admin server.
Package client is the small HTTP client the txco CLI uses to talk to a running chassis admin server.
Package dev contains the process-spawning, health-checking, and file-watching helpers used by `txco dev`.
Package dev contains the process-spawning, health-checking, and file-watching helpers used by `txco dev`.
Package compute implements the authoring CLI for sandboxed op:// computes (wired as `txco op`).
Package compute implements the authoring CLI for sandboxed op:// computes (wired as `txco op`).
Package oprefs resolves `op://NAME` symbolic references in txcl rule bodies to concrete URLs based on a workspace's operations registry.
Package oprefs resolves `op://NAME` symbolic references in txcl rule bodies to concrete URLs based on a workspace's operations registry.
Package signer is the CLI-side RFC 9421 signing surface.
Package signer is the CLI-side RFC 9421 signing surface.
Package state owns the .txco/<stack>.state.json file the txco CLI writes after a `pull` and reads on `push`.
Package state owns the .txco/<stack>.state.json file the txco CLI writes after a `pull` and reads on `push`.
Package template fetches a starter tree from a remote source and copies it into a local directory.
Package template fetches a starter tree from a remote source and copies it into a local directory.

Jump to

Keyboard shortcuts

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