cli

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MPL-2.0 Imports: 63 Imported by: 0

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
	// InstallMethod is the build origin stamped via ldflag: "source"
	// (Makefile / unstamped dev builds) or "release" (the GitHub release
	// build). The update package refines it at runtime — see
	// chassis/cli/update. Empty is treated as "source".
	InstallMethod string
	// Chassis is the embedded open-core pin for a distribution that wraps
	// the chassis as a dependency (e.g. the txco-saas overlay stamps the
	// core pseudo-version here, while Version/CommitId describe the overlay
	// build itself). Empty for the open-core binary, where Version/CommitId
	// already are the chassis build.
	Chassis 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 cloud implements `txco login` — cloud identity for the thanks-computer cloud, via OAuth (Authorization Code + PKCE).
Package cloud implements `txco login` — cloud identity for the thanks-computer cloud, via OAuth (Authorization Code + PKCE).
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 lockfile reads and writes txco.packages.lock.yaml — the repo-root, committed record of which packages produced the workspace's materialized files (workspace PROVENANCE).
Package lockfile reads and writes txco.packages.lock.yaml — the repo-root, committed record of which packages produced the workspace's materialized files (workspace PROVENANCE).
Package manifest models txco.package.yaml — a TxCo package's identity, compatibility, op-resolution contract, and advisory metadata — and validates a package tree against it.
Package manifest models txco.package.yaml — a TxCo package's identity, compatibility, op-resolution contract, and advisory metadata — and validates a package tree against it.
op
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`).
javybin
Package javybin resolves a `javy` CLI binary matching the Javy version the vendored QuickJS plugin was emitted from (chassis/compute/javyplugin).
Package javybin resolves a `javy` CLI binary matching the Javy version the vendored QuickJS plugin was emitted from (chassis/compute/javyplugin).
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 sign implements txco's native ed25519 package-signature format: a small OCI artifact, discovered by the cosign tag convention (sha256:<hex> → sha256-<hex>.sig), whose single layer is the exact signed payload bytes and whose annotations carry the ed25519 signature, key id, and public key.
Package sign implements txco's native ed25519 package-signature format: a small OCI artifact, discovered by the cosign tag convention (sha256:<hex> → sha256-<hex>.sig), whose single layer is the exact signed payload bytes and whose annotations carry the ed25519 signature, key id, and public key.
Package signer is the CLI-side RFC 9421 signing surface.
Package signer is the CLI-side RFC 9421 signing surface.
Package source fetches a tree from a remote or local origin and copies it into a destination directory.
Package source fetches a tree from a remote or local origin and copies it into a destination directory.
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 update implements `txco update check` and `txco upgrade`: it discovers the latest release from GitHub, compares versions, detects how the running binary was installed, and (for self-managed installs) downloads + verifies + atomically replaces the binary.
Package update implements `txco update check` and `txco upgrade`: it discovers the latest release from GitHub, compares versions, detects how the running binary was installed, and (for self-managed installs) downloads + verifies + atomically replaces the binary.

Jump to

Keyboard shortcuts

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