cli

package
v0.22.1 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: 25 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 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 --tag "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 --keg myalias
tap config edit
tap config edit --keg myalias

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 --keg myalias

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 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 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 NewInitCmd

func NewInitCmd(deps *Deps) *cobra.Command

NewInitCmd returns the `tap init` cobra command.

Usage examples:

tap init --keg blog
tap init --project
tap init --keg blog --cwd
tap init --keg blog --hub knut --namespace me
tap init --keg blog --path ./kegs/blog --title "Blog" --creator "me"

func NewIntegrateCmd added in v0.19.0

func NewIntegrateCmd(deps *Deps) *cobra.Command

NewIntegrateCmd builds the `tap integrate` command. It installs the embedded rendered tree for the requested host into that host's standard filesystem location. --dry-run lets callers inspect the target paths without touching the filesystem.

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 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 NewRepoCmd

func NewRepoCmd(deps *Deps) *cobra.Command

func NewRepoConfigCmd

func NewRepoConfigCmd(deps *Deps) *cobra.Command

NewRepoConfigCmd returns the `repo config` cobra command.

Usage examples:

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

func NewRepoConfigEditCmd

func NewRepoConfigEditCmd(deps *Deps) *cobra.Command

NewRepoConfigEditCmd returns the `repo config edit` cobra subcommand.

Usage examples:

tap repo config edit
tap repo config edit --project

func NewRepoConfigTemplateCmd added in v0.4.0

func NewRepoConfigTemplateCmd(deps *Deps) *cobra.Command

NewRepoConfigTemplateCmd returns the `repo config template` cobra subcommand.

func NewRepoKegListCmd

func NewRepoKegListCmd(deps *Deps) *cobra.Command

func NewRepoRmCmd added in v0.4.0

func NewRepoRmCmd(deps *Deps) *cobra.Command

func NewRootCmd

func NewRootCmd(deps *Deps) *cobra.Command

func NewSiteCmd added in v0.11.0

func NewSiteCmd(deps *Deps) *cobra.Command

NewSiteCmd returns the `site` parent cobra command with `build` and `serve` subcommands.

Usage examples:

tap site build
tap site build --output ./public
tap site build --keg dev --title "Dev KEG" --base-url https://keg.example.com
tap site build --no-search
tap site serve
tap site serve --port 8080
tap site serve --keg dev --host 0.0.0.0

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 NewStatsCmd

func NewStatsCmd(deps *Deps) *cobra.Command

NewStatsCmd returns the `stats` cobra command.

func NewTagsCmd

func NewTagsCmd(deps *Deps) *cobra.Command

func NewVersionCmd added in v0.9.0

func NewVersionCmd(deps *Deps) *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 AuthLoginFn into Deps directly is the intended seam for non-test callers.

Types

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

	// AuthLoginFn is the seam through which `tap auth login` drives the
	// browser-based PKCE handshake. Tests set their own function before
	// NewRootCmd runs (via Run's testDepsHook or by constructing Deps
	// directly) so the real listener + browser opener are never invoked.
	// A nil value is lazy-defaulted to tapper.AuthLogin in NewRootCmd so
	// production callers need not populate it.
	AuthLoginFn func(ctx context.Context, rt *toolkit.Runtime, opts tapper.AuthLoginOptions) (*tapper.AuthEntry, error)

	// AuthLoginDeviceFn is the analogous seam for the RFC 8628 device
	// authorization grant, used when the user passes --device to
	// `tap auth login`. Same lazy-default discipline as AuthLoginFn.
	AuthLoginDeviceFn func(ctx context.Context, rt *toolkit.Runtime, opts tapper.AuthLoginDeviceOptions) (*tapper.AuthEntry, error)
	// 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
}

Profile configures CLI behavior for a specific binary.

func KegProfile added in v0.8.0

func KegProfile() Profile

func KegV2Profile deprecated

func KegV2Profile() Profile

KegV2Profile is an alias for KegProfile, kept for backward compatibility.

Deprecated: Use KegProfile instead.

func TapProfile

func TapProfile() Profile

type UserMessager added in v0.13.0

type UserMessager interface {
	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