cli

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package cli is the cobra command tree for the dockyard CLI (RFC §9).

The CLI is one statically-linked, CGo-free binary — no npx, no Node, no package fan-out (RFC §9.1, brief 04 §3). It is a multi-verb tool built on spf13/cobra, the stack settled in RFC §9.3 (brief 06 §2.5): subcommands, generated help, shell completions, and gh/kubectl-familiar ergonomics.

Phase 17 shipped the command tree and `dockyard new`, the no-template project scaffold (RFC §9.1, §10); Phase 18 adds `generate` and `validate` (RFC §6, §9.4). The remaining verbs land in later Wave 7 phases and each registers itself onto the same root:

  • `generate`, `validate` — Phase 18 (RFC §6, §9.4) — landed
  • `dev` — Phase 19 (RFC §9.2)
  • `build`, `run`, `install` — Phase 20 (RFC §14)
  • `test` — Phase 21 (RFC §9.1, §9.4)
  • `inspect` — the inspector phase (RFC §12)

The extension contract is deliberately simple: a later phase adds one file holding a `func newXxxCmd() *cobra.Command` constructor and one line in NewRootCmd that calls `root.AddCommand(newXxxCmd())`. No phase restructures the tree; each verb is self-contained.

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.0.0-dev"

Version is the dockyard CLI version. It is overridden at build time via -ldflags by the release pipeline (Phase 30, RFC §14); the in-tree default is a dev placeholder.

Functions

func Execute

func Execute(ctx context.Context) int

Execute builds the root command and runs it against os.Args, returning the process exit code. main is a thin wrapper around it.

A command failure is logged through a log/slog text handler — the dev-mode handler mandated by CLAUDE.md §5 — and mapped to exit code 1. Execute never panics: a misuse surfaces as a typed error and a clean non-zero exit.

func NewRootCmd

func NewRootCmd(stdout, stderr io.Writer) *cobra.Command

NewRootCmd builds the root `dockyard` cobra command with every subcommand that has landed registered onto it. It is the single composition point: a later Wave 7 phase adds its verb with one root.AddCommand line here and one command-constructor file, never a tree restructure.

stdout/stderr are injected so the command tree is testable without touching the process streams; pass os.Stdout / os.Stderr in main.

Types

This section is empty.

Jump to

Keyboard shortcuts

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