cli

package
v0.1.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 43 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

@facet: authoring/guardrails/adr-status-proposal @facet-role: related

@facet: registry/layout/project-conventions @facet-role: primary

@facet: delivery/distribution/core-pin @facet-role: primary

@facet: navigation/documentation/guided-documentation @facet-role: related

@facet: navigation/interfaces/mcp-server @facet-role: related

@facet: registry/layout/source-views @facet-role: related

@facet: authoring/session/hook-dispatch @facet-role: primary @facet: authoring/session/read-context @facet-role: related @facet: authoring/guardrails/write-validation @facet-role: related

@facet: authoring/guardrails/commit-gate @facet-role: related

@facet: authoring/guardrails/large-record-read @facet-role: primary

@facet: navigation/interfaces/language-server @facet-role: primary

Plugin tools, offered to any MCP client through the host's own MCP server, `facet mcp`.

@facet: registry/layout/source-views @facet-role: related

@facet: navigation/interfaces/product-services @facet-role: primary

@facet: navigation/interfaces/product-services @facet-role: primary

@facet: delivery/distribution/product-runtime @facet-role: primary

@facet: navigation/interfaces/product-services @facet-role: primary

@facet: navigation/interfaces/product-services @facet-role: primary

@facet: registry/layout/multi-registry @facet-role: related

Package cli builds the FACET command surface and links no application of its own. An application that embeds this command tree selects optional commands, reader assets and the version.

@facet: registry/integrity/record-validation @facet-role: primary

@facet: delivery/distribution/setup-status @facet-role: related

@facet: registry/integrity/runner-test-discovery @facet-role: related

@facet: delivery/distribution/build-identity @facet-role: primary

Index

Constants

View Source
const (
	SetupOK            = string(stateOK)
	SetupRed           = string(stateRed)
	SetupUnmeasured    = string(stateUnmeasured)
	SetupNotApplicable = string(stateNotApplicable)
)

The four states a setup row can be in.

Variables

This section is empty.

Functions

func AllRegistriesForCommand

func AllRegistriesForCommand(cmd *cobra.Command) ([]facet.Registry, error)

AllRegistriesForCommand is every registry of this invocation's configuration, for a command a build adds to the tree.

func ConfigForCommand

func ConfigForCommand(cmd *cobra.Command) (*facet.Config, error)

ConfigForCommand shares the invocation source view with application commands.

func MCPToolNames

func MCPToolNames(ctx context.Context, set facet.RegistrySet, pluginsDir, version string) ([]string, error)

MCPToolNames asks the server `facet mcp` serves which tools it advertises, over a real in-memory MCP session, and returns their names in sorted order.

@facet: navigation/interfaces/mcp-server @facet-role: related

func NewCommand

func NewCommand(opts Options) *cobra.Command

NewCommand builds the Core CLI, with optional application commands and reader assets.

func PluginsDir

func PluginsDir() string

PluginsDir resolves shared plugin storage for every host command (CLI and MCP). An explicit override takes precedence over XDG_DATA_HOME and the user's .local/share directory. Storage is not resolved relative to the inspected repository: plugin manifests and grants belong to the host's user data. Configured paths are accepted unchanged. An unavailable home yields no plugin directory rather than a guessed location.

func ProductToolName

func ProductToolName(id, tool string) string

ProductToolName is the MCP name a product's tool is served under: the product namespace, unless the product's binding keeps the name for compatibility.

func RegisterMCPTools

func RegisterMCPTools(set MCPToolset)

RegisterMCPTools adds a product's tools to every MCP server this build starts. Builds register from init, so the tools are in place before the command tree is built. It panics on a toolset without Add.

func RegisterProduct

func RegisterProduct(binding ProductBinding)

RegisterProduct adds a binding. Builds register from init, so bindings are in place before the command tree is built. It panics on an empty or repeated id: two bindings for one product would make its placeholder and its opt-in answer twice.

func RegisterSetupCheck

func RegisterSetupCheck(check SetupCheck)

RegisterSetupCheck adds a product's row. Builds register from init. It panics on an empty id, a missing check or a repeated id.

func RegistrySetForCommand

func RegistrySetForCommand(cmd *cobra.Command) facet.RegistrySet

RegistrySetForCommand returns the same frozen source selection as Core commands.

func ResolveRoot

func ResolveRoot(cmd *cobra.Command) string

ResolveRoot finds the repository root the same way the shell tooling does.

func Run

func Run(root *cobra.Command) int

Run executes a command tree and preserves the CLI error and exit-code contract.

Types

type MCPToolset

type MCPToolset struct {
	// Add registers the tools on a server for the given registries.
	Add func(server *mcp.Server, set facet.RegistrySet)
	// Help is a paragraph appended to 'facet mcp --help'. Empty means none.
	Help string
}

MCPToolset is the set of MCP tools a linked product adds to 'facet mcp'.

type Options

type Options struct {
	// Version is the complete Core build stamp. Empty derives a development identity;
	// release stamps retain their SemVer prerelease and build metadata.
	Version string
	// Identity overrides Version when an application supplies build metadata.
	Identity *release.Identity
	// ReaderAssets selects the application's embedded reader. Nil produces
	// the headless Core setup report without linking a reader or its assets.
	ReaderAssets fs.FS
	// Commands are fresh application-owned command instances, such as a
	// product command `ui`. A command becomes part of this tree and must not
	// be reused elsewhere.
	Commands []*cobra.Command
}

Options selects the version and the optional additions an embedding application makes to a command tree. Nil ReaderAssets and no extra Commands produce the independent Core CLI.

type ProductBinding

type ProductBinding struct {
	// ID is the manifest id of the product the binding describes.
	ID string
	// Command is the top-level command the product contributes. While the
	// product is not installed the command stays visible and says how to
	// install it, instead of being an unknown command. Empty means none.
	Command string
	// CompatibilityTools are tool names the product serves over MCP that keep
	// their unprefixed name instead of '<id>__<name>'.
	CompatibilityTools []string
	// DriftHelp is a paragraph appended to 'facet drift --help'.
	DriftHelp string
	// Requested reports whether the project explicitly asked for the named
	// service from this product. config loads the project configuration once,
	// on demand; an error from it is reported as a configuration failure.
	Requested func(service string, config func() (*facet.Config, error)) (bool, error)
	// Missing is the error when Requested is true and no installed product
	// with this id provides the service.
	Missing string
}

ProductBinding is what a build knows about one optional product before, or without, its installation. Core holds no product names of its own beyond the bindings registered into it: a build that links a product's binding keeps that product's placeholder command, opt-in check and compatibility names; a build that does not link it has none of them, and an installed package of that product still works through its manifest alone.

type SetupCheck

type SetupCheck struct {
	ID    string
	Check func(reg facet.Registry) SetupResult
}

SetupCheck is a row a product adds to the setup report. Check answers for one registry; with several registries the worst state wins, as for Core's own registry rows.

type SetupResult

type SetupResult struct {
	// State is SetupOK, SetupRed, SetupUnmeasured or SetupNotApplicable.
	State    string
	Finding  string
	Evidence string
}

SetupResult is one registry's answer to a product's setup question.

Directories

Path Synopsis
Package scaffold writes FACET into a project that does not have it: the record layout, the JSON schemas, the specification, the lint suite with its pinned dispatcher, an empty scan filter and the CI workflow.
Package scaffold writes FACET into a project that does not have it: the record layout, the JSON schemas, the specification, the lint suite with its pinned dispatcher, an empty scan filter and the CI workflow.

Jump to

Keyboard shortcuts

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