Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package cli provides a composable CLI for visionspec.

Organizations can import this package to build custom CLI tools that include visionspec commands alongside their own:

package main

import (
	"github.com/spf13/cobra"
	"github.com/ProductBuildersHQ/visionspec/pkg/cli"
)

func main() {
	root := &cobra.Command{Use: "org-spec"}
	cfg := cli.DefaultConfig()
	cli.AddCommandsTo(root, cfg)
	root.AddCommand(customCmd)
	root.Execute()
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommandsTo

func AddCommandsTo(root *cobra.Command, cfg *Config)

AddCommandsTo adds all visionspec commands to a root command.

func WithConfig

func WithConfig(ctx context.Context, cfg *Config) context.Context

WithConfig returns a context with the config attached.

Types

type CommandSet

type CommandSet struct {
	Init       *cobra.Command
	Create     *cobra.Command
	Lint       *cobra.Command
	Status     *cobra.Command
	Eval       *cobra.Command
	Synthesize *cobra.Command
	Reconcile  *cobra.Command
	Approve    *cobra.Command
	Export     *cobra.Command
	Targets    *cobra.Command
	Graph      *cobra.Command
	Docs       *cobra.Command
	Serve      *cobra.Command
	Profiles   *cobra.Command
	Context    *cobra.Command
}

CommandSet contains all visionspec commands.

func Commands

func Commands(cfg *Config) *CommandSet

Commands returns all visionspec commands. Use this for selective command inclusion.

type Config

type Config struct {
	// TemplateLoader loads spec templates.
	// If nil, uses embedded templates.
	TemplateLoader templates.Loader

	// RubricLoader loads evaluation rubrics.
	// If nil, uses embedded rubrics.
	RubricLoader rubrics.Loader

	// SpecConfig defines which specs are required and their settings.
	// If nil, uses default visionspec requirements.
	SpecConfig *types.SpecConfig

	// ProfileLoader loads configuration profiles.
	// If nil, uses default profiles.
	ProfileLoader profiles.Loader

	// DefaultProfile is the profile to use when none is specified.
	// If empty, uses no profile (default visionspec behavior).
	DefaultProfile string

	// Version is the CLI version string.
	Version string
}

Config allows customization of CLI behavior.

func ConfigFromContext

func ConfigFromContext(ctx context.Context) *Config

ConfigFromContext returns the Config from a context.

func ConfigFromProfile

func ConfigFromProfile(profile *profiles.Profile) *Config

ConfigFromProfile creates a Config from a profile.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration.

func (*Config) GetSpecConfig

func (c *Config) GetSpecConfig() *types.SpecConfig

GetSpecConfig returns the SpecConfig, falling back to defaults if nil.

Jump to

Keyboard shortcuts

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