cli

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version     string = "dev"
	LicenseText string
)

Functions

func NewArchiveCmd added in v0.4.0

func NewArchiveCmd(deps *Deps) *cobra.Command

func NewArchiveExportCmd added in v0.4.0

func NewArchiveExportCmd(deps *Deps) *cobra.Command

func NewArchiveImportCmd added in v0.4.0

func NewArchiveImportCmd(deps *Deps) *cobra.Command

func NewAuthCmd added in v0.20.0

func NewAuthCmd(deps *Deps) *cobra.Command

NewAuthCmd builds the `auth` parent. Parent with no RunE would show "unknown command" noise; returning cmd.Help() is what every other two-level command tree in this repo does (see cmd_repo.go / cmd_config.go).

func NewBacklinksCmd

func NewBacklinksCmd(deps *Deps) *cobra.Command

func NewBootstrapCmd added in v0.23.0

func NewBootstrapCmd(deps *Deps) *cobra.Command

NewBootstrapCmd returns the `tap bootstrap` cobra command.

Usage examples:

tap bootstrap                                  # interactive on a TTY
tap bootstrap --kind local                     # local filesystem hub only
tap bootstrap --kind cloud                     # atlas.foldwise.ai
tap bootstrap --kind enterprise --endpoint https://keg.acme.com

func NewCatCmd

func NewCatCmd(deps *Deps) *cobra.Command

NewCatCmd returns the `cat` cobra command.

Usage examples:

tap cat 0
tap cat 0 1 2
tap cat --query "fire and not archived"
tap cat 0 --keg myalias

func NewConfigCmd

func NewConfigCmd(deps *Deps) *cobra.Command

NewConfigCmd returns the `config` cobra command.

Usage examples:

tap config
tap config --project
tap config --user
tap config --explain defaultKeg
tap config --show-sources
tap config template user
tap config template project
tap config edit
tap config edit --project

func NewConfigEditCmd added in v0.4.0

func NewConfigEditCmd(deps *Deps) *cobra.Command

NewConfigEditCmd returns the `config edit` cobra subcommand.

Usage examples:

tap config edit
tap config edit --user

func NewConfigTemplateCmd added in v0.23.0

func NewConfigTemplateCmd(deps *Deps) *cobra.Command

NewConfigTemplateCmd returns the `config template` cobra subcommand.

func NewCreateCmd

func NewCreateCmd(deps *Deps) *cobra.Command

NewCreateCmd constructs the `create` subcommand.

Usage examples:

Tap create --title "My note" --lead "one-line summary"
Tap create --title "Note" --tags tag1 --tags tag2 --attrs foo=bar --attrs x=1

func NewDocsCmd added in v0.5.0

func NewDocsCmd(deps *Deps) *cobra.Command

func NewDoctorCmd added in v0.5.0

func NewDoctorCmd(deps *Deps) *cobra.Command

func NewEditCmd

func NewEditCmd(deps *Deps) *cobra.Command

NewEditCmd returns the `edit` cobra command.

func NewFileCmd added in v0.2.0

func NewFileCmd(deps *Deps) *cobra.Command

func NewFlightCmd added in v0.23.0

func NewFlightCmd(deps *Deps) *cobra.Command

NewFlightCmd returns the `flight` cobra command group. A flight carries MCP cover caps, capabilities, and agent instructions.

tap flight list
tap flight show <name>
tap flight create @ns/+slug --cover @ns/keg=viewer

func NewGraphCmd added in v0.4.0

func NewGraphCmd(deps *Deps) *cobra.Command

NewGraphCmd returns the `graph` cobra command.

Usage examples:

tap graph
tap graph --keg pub --output graph.html

func NewGrepCmd

func NewGrepCmd(deps *Deps) *cobra.Command

func NewHookCmd added in v0.30.0

func NewHookCmd(deps *Deps) *cobra.Command

NewHookCmd builds the hidden protocol used by the native Codex and Claude plugins. It is intentionally host-facing rather than a public user workflow.

func NewHubCmd added in v0.23.0

func NewHubCmd(deps *Deps) *cobra.Command

NewHubCmd returns the `hub` command group: manage hub *connections* (the user-config `hubs:` map) and inspect a hub. Listing the kegs on a hub lives under `tap keg list`.

tap hub list
tap hub status
tap hub add work --url https://hub.example
tap hub remove work
tap hub set-default atlas

func NewImageCmd added in v0.2.0

func NewImageCmd(deps *Deps) *cobra.Command

func NewImportCmd added in v0.4.0

func NewImportCmd(deps *Deps) *cobra.Command

func NewIndexCmd

func NewIndexCmd(deps *Deps) *cobra.Command

NewIndexCmd returns the `index` cobra command group.

Usage examples:

tap index list
tap index get changes.md
tap index get -k work nodes.tsv
tap index rebuild

func NewInfoCmd

func NewInfoCmd(deps *Deps) *cobra.Command

NewInfoCmd returns the `info` cobra command.

Usage examples:

tap info
tap info --keg myalias

func NewIntegrateCmd added in v0.19.0

func NewIntegrateCmd(deps *Deps) *cobra.Command

NewIntegrateCmd builds the `tap integrate` command. It installs the embedded native marketplace and installs through the requested host CLI.

func NewKegCmd added in v0.23.0

func NewKegCmd(deps *Deps) *cobra.Command

NewKegCmd returns the `keg` command group: hub-side keg administration (listing, creating, ACL grants, visibility) plus the keg's own settings.

tap keg list
tap keg create @ns/blog
tap keg grant @ns/blog @alice editor
tap keg grants @ns/blog
tap keg revoke @ns/blog @alice
tap keg visibility @ns/blog public
tap keg rename @ns/blog docs
tap keg settings

func NewLinksCmd added in v0.5.0

func NewLinksCmd(deps *Deps) *cobra.Command

func NewListCmd

func NewListCmd(deps *Deps) *cobra.Command

func NewLockCmd added in v0.11.0

func NewLockCmd(deps *Deps) *cobra.Command

func NewMcpCmd added in v0.5.0

func NewMcpCmd(deps *Deps) *cobra.Command

func NewMetaCmd

func NewMetaCmd(deps *Deps) *cobra.Command

func NewMoveCmd

func NewMoveCmd(deps *Deps) *cobra.Command

func NewNamespaceCmd added in v0.23.0

func NewNamespaceCmd(deps *Deps) *cobra.Command

NewNamespaceCmd returns the `namespace` command group: namespace discovery, membership/role management, and org-namespace creation.

tap namespace list
tap namespace members @acme
tap namespace add-member @acme @alice admin
tap namespace set-role @acme @alice member
tap namespace remove-member @acme @alice
tap namespace create acme

func NewOrientCmd added in v0.19.0

func NewOrientCmd(deps *Deps) *cobra.Command

NewOrientCmd builds the `tap orient` command. It is the CLI mirror of the MCP orient tool: the same payload bytes reach a shell user as reach an MCP-speaking agent, because both surfaces call Tap.Orient.

func NewRemoveCmd

func NewRemoveCmd(deps *Deps) *cobra.Command

func NewRootCmd

func NewRootCmd(deps *Deps) *cobra.Command

func NewSchemaCmd added in v0.25.0

func NewSchemaCmd(deps *Deps) *cobra.Command

func NewSnapshotCmd added in v0.4.0

func NewSnapshotCmd(deps *Deps) *cobra.Command

func NewSnapshotCreateCmd added in v0.4.0

func NewSnapshotCreateCmd(deps *Deps) *cobra.Command

func NewSnapshotHistoryCmd added in v0.4.0

func NewSnapshotHistoryCmd(deps *Deps) *cobra.Command

func NewSnapshotRestoreCmd added in v0.4.0

func NewSnapshotRestoreCmd(deps *Deps) *cobra.Command

func NewSnapshotViewCmd added in v0.23.0

func NewSnapshotViewCmd(deps *Deps) *cobra.Command

func NewStatsCmd

func NewStatsCmd(deps *Deps) *cobra.Command

NewStatsCmd returns the `stats` cobra command.

func NewTagsCmd

func NewTagsCmd(deps *Deps) *cobra.Command

func NewUseCmd added in v0.23.0

func NewUseCmd(deps *Deps) *cobra.Command

NewUseCmd returns the `use` command: record which keg (and flight) a project resolves, or a user-wide fallback keg.

Usage examples:

tap use @work/dev                  # project keg (defaultKeg)
tap use +plan                      # project flight
tap use @work/dev --flight @work/+plan
tap use @me/notes --user           # user-wide fallback (fallbackKeg)
tap use --flight @work/+plan       # set/replace just the project flight
tap use --clear                    # unset the scope's slot(s)
tap use                            # show the resolved keg + flight + fallback

func NewValidateCmd added in v0.25.0

func NewValidateCmd(deps *Deps) *cobra.Command

func NewVersionCmd added in v0.9.0

func NewVersionCmd(deps *Deps) *cobra.Command

func NewWatchCmd added in v0.23.0

func NewWatchCmd(deps *Deps) *cobra.Command

NewWatchCmd returns the `watch` cobra command.

func Run

func Run(ctx context.Context, rt *toolkit.Runtime, args []string) (int, error)

func RunCompletion added in v0.4.0

func RunCompletion(ctx context.Context, rt *toolkit.Runtime, args []string) (int, error)

func RunCompletionWithProfile added in v0.4.0

func RunCompletionWithProfile(ctx context.Context, rt *toolkit.Runtime, args []string, profile Profile) (int, error)

func RunWithProfile

func RunWithProfile(ctx context.Context, rt *toolkit.Runtime, args []string, profile Profile) (int, error)

func WithTestDepsHook added in v0.20.0

func WithTestDepsHook(ctx context.Context, hook func(*Deps)) context.Context

WithTestDepsHook returns a context carrying a per-invocation hook that Run will apply to the freshly-constructed Deps. Parallel tests attach their own hook to their own ctx, so there is no shared state for the race detector to flag.

Exported so tests in this package (and sibling test packages in pkg/cli_test) can drive the seam without reaching into unexported state. Production callers must not use it — wiring AuthLoginDeviceFn into Deps directly is the intended seam for non-test callers.

Types

type AuthPrompter added in v0.23.0

type AuthPrompter interface {
	// SelectHub presents choices and returns the selected one.
	SelectHub(choices []hubChoice) (hubChoice, error)
	// SelectMethod asks browser-vs-token.
	SelectMethod() (loginMethod, error)
	// PromptEndpointURL collects a hub base URL for the "Other endpoint" path.
	PromptEndpointURL() (string, error)
	// PromptToken collects a pasted API token with masked echo.
	PromptToken() (string, error)
	// ConfirmOpenBrowser gates the device-flow browser open. It returns true
	// to open the browser (the default — pressing Enter), false when the user
	// would rather copy the URL themselves. It takes a context so the device
	// flow can tear the prompt down once the token arrives (the user approved
	// before answering): a cancelled ctx ends the prompt without an answer.
	ConfirmOpenBrowser(ctx context.Context, host string) (bool, error)
}

AuthPrompter is the interactive surface of `tap auth login`. It is an interface so tests inject a scripted fake and never touch a TTY; the production implementation renders huh menus on the controlling terminal.

type BootstrapPrompter added in v0.23.0

type BootstrapPrompter interface {
	// SelectBootstrapKind chooses the cloud, local, or enterprise bootstrap path.
	SelectBootstrapKind() (string, error)
	// PromptBootstrapEndpoint collects the enterprise hub endpoint URL.
	PromptBootstrapEndpoint() (string, error)
	// ConfirmBootstrapLogin reports whether the user wants to log in to host.
	ConfirmBootstrapLogin(host string) (bool, error)
	// SelectDefaultKeg chooses an available keg or a create, manual, or skip action.
	SelectDefaultKeg(available []string) (bootstrapDefaultKegSelection, error)
	// SelectFlight chooses an available MCP flight, preserving current as the
	// default selection when possible.
	SelectFlight(available []string, current string) (string, error)
	// PromptManualDefaultKeg collects a keg reference not present in the picker.
	PromptManualDefaultKeg() (string, error)
	// PromptNewKegName collects and validates the alias for a new keg.
	PromptNewKegName() (string, error)
}

BootstrapPrompter is the interactive surface of `tap bootstrap`.

type Deps

type Deps struct {
	Root     string
	Shutdown func()
	Runtime  *toolkit.Runtime
	Profile  Profile

	KegTargetOptions tapper.KegTargetOptions

	ConfigPath string
	LogFile    string
	LogLevel   string
	LogJSON    bool
	Strict     bool

	Tap *tapper.Tap
	Err error

	// AuthLoginDeviceFn is the seam through which `tap auth login` drives the
	// RFC 8628 device authorization grant — the single browser-based login
	// flow. Tests set their own function before NewRootCmd runs (via Run's
	// testDepsHook or by constructing Deps directly) so the real browser
	// opener and hub polling are never invoked. A nil value is lazy-defaulted
	// to tapper.AuthLoginDevice in NewRootCmd so production callers need not
	// populate it.
	AuthLoginDeviceFn func(ctx context.Context, rt *toolkit.Runtime, opts tapper.AuthLoginDeviceOptions) (*tapper.AuthEntry, error)

	// AuthValidateTokenFn backs the "paste an authentication token" login
	// path: it checks a pasted bearer token against the hub's whoami probe
	// before the token is written to the AuthStore. Nil is lazy-defaulted to
	// tapper.ValidateToken; tests inject a stub to avoid the network call.
	AuthValidateTokenFn func(ctx context.Context, rt *toolkit.Runtime, hubURL, token string) (*tapper.WhoAmI, error)

	// AuthPrompter renders the interactive hub / method / URL / token prompts
	// for `tap auth login`. Nil is lazy-defaulted to the huh-backed prompter;
	// tests inject a scripted fake so the command logic runs without a TTY.
	AuthPrompter AuthPrompter

	// BootstrapPrompter renders the interactive setup prompts for
	// `tap bootstrap`. It shares the huh-backed production implementation with
	// AuthPrompter but stays separate so tests can assert each flow's prompts.
	BootstrapPrompter BootstrapPrompter

	InvocationReporter tapper.InvocationReporter
	// contains filtered or unexported fields
}

type Profile

type Profile struct {
	// Use is the root command name shown in help.
	Use string

	// ForceProjectResolution makes node operations resolve only against
	// project-local kegs.
	ForceProjectResolution bool

	// AllowKegAliasFlags enables alias-based selection flags such as --keg.
	AllowKegAliasFlags bool

	// IncludeConfigCommand enables the config command tree.
	IncludeConfigCommand bool

	// IncludeRepoCommand enables the repo command tree.
	IncludeRepoCommand bool

	// IncludeIntegrations enables host plugin installation and the hidden
	// host-facing hook protocol. These commands belong only to the full tap
	// binary because installed plugins invoke tap directly.
	IncludeIntegrations bool
}

Profile configures CLI behavior for a specific binary.

func KegProfile added in v0.8.0

func KegProfile() Profile

func TapProfile

func TapProfile() Profile

type UserMessager added in v0.13.0

type UserMessager interface {
	// UserMessage returns the message appropriate for the caller's debug mode.
	UserMessage(debug bool) string
}

UserMessager is implemented by error types that can produce a user-facing message tailored to the current CLI context (e.g. log level). New error types should implement this interface instead of adding branches to renderUserError.

Jump to

Keyboard shortcuts

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