cmd

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package cmd assembles the tai core CLI's urfave/cli command tree.

The root command carries --version, --help, the `tai config` subtree, and the OnUsageError/Action hooks that route any unrecognised input through the foundation's UnknownSubcommand error contract. Subsequent top-level verbs (tai sync, tai repo init, tai workflow, tai standards, tai install-commands, tai plugins) graft onto this same root as their OpenSpec proposals land — see openspec/changes/pivot-to-ai-as-code/ for the phase-by-phase plan.

NewRoot is the single seam every test and the production binary use to build the command — there is no package-level state, and the function is cheap to call repeatedly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRoot

func NewRoot() *cli.Command

NewRoot returns a freshly-assembled tai core root command.

Writer / ErrWriter / Reader default to os.Stdout/Stderr/Stdin on the returned value; tests swap them for buffers via the pkg/cliexec.Run wrapper.

Three hooks make stderr single-source and route unknown subcommands through the foundation's error contract:

  • Action: a root-level fallback that fires when no subcommand matched. If positional arguments are present (i.e. `tai bogus`), returns UnknownSubcommand. If none are present (`tai`), shows help.
  • OnUsageError: converts urfave/cli's parser/usage failures into *errcode.Error{Code: UnknownSubcommand} so the printer in pkg/cliout owns the rendered template.
  • ExitErrHandler: a no-op. urfave/cli's default HandleExitCoder prints the error to its package-level ErrWriter and calls os.Exit; we want neither. Setting a no-op handler lets the error flow back to cliexec.Run, where core/cmd/tai/main.go takes over.

Types

This section is empty.

Jump to

Keyboard shortcuts

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