{"modulePath":"github.com/facet-framework/core","version":"v0.1.0-rc.5","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package cli\n\n@facet: authoring/guardrails/adr-status-proposal @facet-role: related\n\n@facet: registry/layout/project-conventions @facet-role: primary\n\n@facet: delivery/distribution/core-pin @facet-role: primary\n\n@facet: navigation/documentation/guided-documentation @facet-role: related\n\n@facet: navigation/interfaces/mcp-server @facet-role: related\n\n@facet: registry/layout/source-views @facet-role: related\n\n@facet: authoring/session/hook-dispatch @facet-role: primary @facet: authoring/session/read-context @facet-role: related @facet: authoring/guardrails/write-validation @facet-role: related\n\n@facet: authoring/guardrails/commit-gate @facet-role: related\n\n@facet: authoring/guardrails/large-record-read @facet-role: primary\n\n@facet: navigation/interfaces/language-server @facet-role: primary\n\nPlugin tools, offered to any MCP client through the host's own MCP server, \\`facet mcp\\`.\n\n@facet: registry/layout/source-views @facet-role: related\n\n@facet: navigation/interfaces/product-services @facet-role: primary\n\n@facet: navigation/interfaces/product-services @facet-role: primary\n\n@facet: delivery/distribution/product-runtime @facet-role: primary\n\n@facet: navigation/interfaces/product-services @facet-role: primary\n\n@facet: navigation/interfaces/product-services @facet-role: primary\n\n@facet: registry/layout/multi-registry @facet-role: related\n\nPackage 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.\n\n@facet: registry/integrity/record-validation @facet-role: primary\n\n@facet: delivery/distribution/setup-status @facet-role: related\n\n@facet: delivery/distribution/build-identity @facet-role: primary\n\n## Constants\n\n```go\nconst (\n\tSetupOK            = string(stateOK)\n\tSetupRed           = string(stateRed)\n\tSetupUnmeasured    = string(stateUnmeasured)\n\tSetupNotApplicable = string(stateNotApplicable)\n)\n```\nThe four states a setup row can be in.\n\n## Functions\n\n```go\nfunc AllRegistriesForCommand(cmd *cobra.Command) ([]facet.Registry, error)\n```\nAllRegistriesForCommand is every registry of this invocation's configuration, for a command a build adds to the tree.\n\n```go\nfunc ConfigForCommand(cmd *cobra.Command) (*facet.Config, error)\n```\nConfigForCommand shares the invocation source view with application commands.\n\n```go\nfunc MCPToolNames(ctx context.Context, set facet.RegistrySet, pluginsDir, version string) ([]string, error)\n```\nMCPToolNames asks the server \\`facet mcp\\` serves which tools it advertises, over a real in-memory MCP session, and returns their names in sorted order.\n\n@facet: navigation/interfaces/mcp-server @facet-role: related\n\n```go\nfunc NewCommand(opts Options) *cobra.Command\n```\nNewCommand builds the Core CLI, with optional application commands and reader assets.\n\n```go\nfunc PluginsDir() string\n```\nPluginsDir 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.\n\n```go\nfunc ProductToolName(id, tool string) string\n```\nProductToolName is the MCP name a product's tool is served under: the product namespace, unless the product's binding keeps the name for compatibility.\n\n```go\nfunc RegisterMCPTools(set MCPToolset)\n```\nRegisterMCPTools 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.\n\n```go\nfunc RegisterProduct(binding ProductBinding)\n```\nRegisterProduct 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.\n\n```go\nfunc RegisterSetupCheck(check SetupCheck)\n```\nRegisterSetupCheck adds a product's row. Builds register from init. It panics on an empty id, a missing check or a repeated id.\n\n```go\nfunc RegistrySetForCommand(cmd *cobra.Command) facet.RegistrySet\n```\nRegistrySetForCommand returns the same frozen source selection as Core commands.\n\n```go\nfunc ResolveRoot(cmd *cobra.Command) string\n```\nResolveRoot finds the repository root the same way the shell tooling does.\n\n```go\nfunc Run(root *cobra.Command) int\n```\nRun executes a command tree and preserves the CLI error and exit-code contract.\n\n## Types\n\n```go\ntype MCPToolset struct {\n\t// Add registers the tools on a server for the given registries.\n\tAdd func(server *mcp.Server, set facet.RegistrySet)\n\t// Help is a paragraph appended to 'facet mcp --help'. Empty means none.\n\tHelp string\n}\n```\nMCPToolset is the set of MCP tools a linked product adds to 'facet mcp'.\n\n```go\ntype Options struct {\n\t// Version is the complete Core build stamp. Empty derives a development identity;\n\t// release stamps retain their SemVer prerelease and build metadata.\n\tVersion string\n\t// Identity overrides Version when an application supplies build metadata.\n\tIdentity *release.Identity\n\t// ReaderAssets selects the application's embedded reader. Nil produces\n\t// the Atlas cache status in the setup report.\n\tReaderAssets fs.FS\n\t// Commands are fresh application-owned command instances, such as a\n\t// product command `ui`. A command becomes part of this tree and must not\n\t// be reused elsewhere.\n\tCommands []*cobra.Command\n}\n```\nOptions 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.\n\n```go\ntype ProductBinding struct {\n\t// ID is the manifest id of the product the binding describes.\n\tID string\n\t// Command is the top-level command the product contributes. While the\n\t// product is not installed the command stays visible and says how to\n\t// install it, instead of being an unknown command. Empty means none.\n\tCommand string\n\t// CompatibilityTools are tool names the product serves over MCP that keep\n\t// their unprefixed name instead of '\u003cid\u003e__\u003cname\u003e'.\n\tCompatibilityTools []string\n\t// DriftHelp is a paragraph appended to 'facet drift --help'.\n\tDriftHelp string\n\t// Requested reports whether the project explicitly asked for the named\n\t// service from this product. config loads the project configuration once,\n\t// on demand; an error from it is reported as a configuration failure.\n\tRequested func(service string, config func() (*facet.Config, error)) (bool, error)\n\t// Missing is the error when Requested is true and no installed product\n\t// with this id provides the service.\n\tMissing string\n}\n```\nProductBinding 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.\n\n```go\ntype SetupCheck struct {\n\tID    string\n\tCheck func(reg facet.Registry) SetupResult\n}\n```\nSetupCheck 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.\n\n```go\ntype SetupResult struct {\n\t// State is SetupOK, SetupRed, SetupUnmeasured or SetupNotApplicable.\n\tState    string\n\tFinding  string\n\tEvidence string\n}\n```\nSetupResult is one registry's answer to a product's setup question.\n\n","path":"github.com/facet-framework/core/cli","name":"cli","synopsis":"@facet: authoring/guardrails/adr-status-proposal @facet-role: related","isRedistributable":true}
