Documentation
¶
Index ¶
- Variables
- func ExitWithCode(code int, err error)
- func ExitWithError(err error)
- func ListVendorSpecs(vendorPath string) ([]string, error)
- func PrintSuccess(title string, details ...string)
- type CLIError
- func ErrCIRequired() *CLIError
- func ErrCommandNotFound(command string) *CLIError
- func ErrInvalidInput(message string) *CLIError
- func ErrMissingDependency(name string, installCmd string) *CLIError
- func ErrNotAProject() *CLIError
- func ErrPermissionDenied(path string) *CLIError
- func ErrProjectExists(projectName string) *CLIError
- func NewCLIError(title, description string, suggestions []string, exitCode int) *CLIError
- type DoctorOutput
- type DoctorToolStatus
Constants ¶
This section is empty.
Variables ¶
var VarAddCmd = &cobra.Command{ Use: "add <repo-url> [branch] [spec-path]", Short: "Add a dependency", Long: `Add an external specification dependency to your project. The dependency will be tracked in specledger.yaml and cached locally for offline use.`, Example: ` sl deps add git@github.com:org/api-spec sl deps add git@github.com:org/api-spec v1.0 github.com/specledger/specledger/api.md sl deps add git@github.com:org/api-spec main spec.md --alias api`, Args: cobra.MinimumNArgs(1), RunE: runAddDependency, }
VarAddCmd represents the add command
var VarBootstrapCmd = &cobra.Command{ Use: "new", Short: "Create a new SpecLedger project", Long: `Create a new SpecLedger project with all necessary infrastructure: Interactive mode: sl new Non-interactive mode (for CI/CD): sl new --ci --project-name <name> --short-code <code> --project-dir <path> The bootstrap creates: - .claude/ directory with skills and commands - .beads/ directory for issue tracking - github.com/specledger/specledger/ directory for specifications - github.com/specledger/specledger/specledger.yaml file for project metadata`, RunE: func(cmd *cobra.Command, args []string) error { cfg, err := config.Load() if err != nil { return fmt.Errorf("failed to load config: %w", err) } l := logger.New(logger.Debug) modeDetector := tui.NewModeDetector() if modeDetector.IsNonInteractive() || ciFlag { return runBootstrapNonInteractive(cmd, l, cfg) } return runBootstrapInteractive(l, cfg) }, }
VarBootstrapCmd is the bootstrap command
var VarCheckCmd = &cobra.Command{
Use: "check",
Short: "Check for conflicts in the dependency graph",
RunE: runCheckConflicts,
}
VarCheckCmd represents the check command
var VarCleanCmd = &cobra.Command{
Use: "clean",
Short: "Remove vendored dependencies",
RunE: runVendorClean,
}
VarCleanCmd represents the clean command
var VarConflictCmd = &cobra.Command{
Use: "conflict",
Short: "Check for dependency conflicts",
Long: `Check the dependency graph for potential conflicts and circular dependencies.`,
}
VarConflictCmd represents the conflict command
var VarDepsCmd = &cobra.Command{
Use: "deps",
Short: "Manage specification dependencies",
Long: `Manage external specification dependencies for your project.
Dependencies are stored in github.com/specledger/specledger/specledger.yaml and cached locally for offline use.
Examples:
sl deps list # List all dependencies
sl deps add git@github.com:org/spec # Add a dependency
sl deps remove git@github.com:org/spec # Remove a dependency`,
}
VarDepsCmd represents the deps command
var VarDepsListCmd = &cobra.Command{
Use: "list",
Short: "List all dependencies",
Long: `List all declared dependencies from specledger.yaml, showing their repository, version, and resolved status.`,
Example: ` sl deps list`,
RunE: runListDependencies,
}
VarDepsListCmd represents the list command
var VarDepsUpdateCmd = &cobra.Command{
Use: "update [repo-url]",
Short: "Update dependencies to latest versions",
Long: `Update dependencies to their latest versions. If no URL is given, updates all dependencies.`,
Example: ` sl deps update # Update all
sl deps update git@github.com:org/spec # Update one`,
RunE: runUpdateDependencies,
}
VarDepsUpdateCmd represents the update command
var VarDetectCmd = &cobra.Command{
Use: "detect",
Short: "Detect potential conflicts",
RunE: runDetectConflicts,
}
VarDetectCmd represents the detect command
var VarDoctorCmd = &cobra.Command{ Use: "doctor", Short: "Check installation status of required and optional tools", Long: `Check the installation status of all tools required by SpecLedger. This command verifies that: - Core tools (mise, bd, perles) are installed and accessible - Framework tools (specify, openspec) are installed (optional) Use --json flag for machine-readable output suitable for CI/CD pipelines.`, Example: ` sl doctor # Human-readable output sl doctor --json # JSON output for CI/CD`, RunE: runDoctor, SilenceUsage: true, SilenceErrors: true, }
VarDoctorCmd represents the doctor command
var VarExportCmd = &cobra.Command{
Use: "export --format <format> --output <file>",
Short: "Export graph to file (coming soon)",
Long: `Export the dependency graph to a file for visualization.
Supported formats will include: JSON, SVG, DOT (Graphviz)`,
Example: " sl graph export --format svg --output deps.svg",
RunE: runExportGraph,
}
VarExportCmd represents the export command
var VarGraphCmd = &cobra.Command{
Use: "graph",
Short: "Display dependency graphs",
Long: `Visualize dependencies and their relationships.
NOTE: This feature is coming soon. For now, use 'sl deps list' to see dependencies.`,
}
VarGraphCmd represents the graph command
var VarInitCmd = &cobra.Command{ Use: "init", Short: "Initialize SpecLedger in an existing repository", Long: `Initialize SpecLedger in the current repository directory. This adds SpecLedger to an existing project without creating a new directory. Usage: sl init sl init --short-code abc sl init --playbook specledger The init creates: - .claude/ directory with skills - .beads/ directory for issue tracking - github.com/specledger/specledger/ directory for specifications - github.com/specledger/specledger/specledger.yaml file for project metadata`, RunE: func(cmd *cobra.Command, args []string) error { l := logger.New(logger.Debug) return runInit(l) }, }
VarInitCmd is the init command
var VarListCmd = &cobra.Command{
Use: "list [--spec-path <path>]",
Short: "List all external references",
RunE: runListReferences,
}
VarListCmd represents the list command
var VarPlaybookCmd = &cobra.Command{
Use: "playbook",
Short: "Manage SDD playbooks",
Long: `Manage embedded SDD playbooks for SpecLedger.
Playbooks contain Claude Code commands, skills, scripts, and templates
for SpecLedger projects.
Examples:
sl playbook list List all available playbooks
sl playbook list --json List playbooks in JSON format`,
}
VarPlaybookCmd represents the playbook command
var VarPlaybookListCmd = &cobra.Command{
Use: "list",
Short: "List available SDD playbooks",
Long: `List all available embedded SDD playbooks with their names, descriptions, frameworks, and versions.`,
Example: ` sl playbook list`,
RunE: runListPlaybooks,
}
VarPlaybookListCmd represents the list command
var VarRefsCmd = &cobra.Command{
Use: "refs",
Short: "Validate external specification references",
}
VarRefsCmd represents the refs command
var VarRemoveCmd = &cobra.Command{ Use: "remove <repo-url>", Short: "Remove a dependency", Long: `Remove a dependency from specledger.yaml. The local cache will be kept for future use.`, Example: ` sl deps remove git@github.com:org/api-spec`, Args: cobra.ExactArgs(1), RunE: runRemoveDependency, }
VarRemoveCmd represents the remove command
var VarResolveCmd = &cobra.Command{
Use: "resolve",
Short: "Download and cache dependencies",
Long: `Download all dependencies from specledger.yaml and cache them locally at ~/.github.com/specledger/specledger/cache/.`,
Example: ` sl deps resolve`,
RunE: runResolveDependencies,
}
VarResolveCmd represents the resolve command
var VarShowCmd = &cobra.Command{
Use: "show",
Short: "Show dependency graph (coming soon)",
Long: `Display the complete dependency graph with all nodes and edges.
This will show how specifications depend on each other.`,
Example: " sl graph show",
RunE: runShowGraph,
}
VarShowCmd represents the show command
var VarTransitiveCmd = &cobra.Command{
Use: "transitive",
Short: "Show transitive dependencies (coming soon)",
Long: `Show all transitive dependencies up to a specified depth.
This helps understand the full dependency tree.`,
Example: " sl graph transitive --depth 3",
RunE: runTransitiveDependencies,
}
VarTransitiveCmd represents the transitive command
var VarUpdateCmd = &cobra.Command{
Use: "update",
Short: "Update the SpecLedger CLI to the latest version",
Long: `Check for updates and upgrade the SpecLedger CLI to the latest version.`,
RunE: runUpdateSelf,
}
VarUpdateCmd represents the update command TODO: Implement self-update functionality
var VarValidateCmd = &cobra.Command{ Use: "validate [--strict] [--spec-path <path>]", Short: "Validate all external references in a specification", Long: `Validate all external references in spec.md files against resolved dependencies.`, Args: cobra.MaximumNArgs(1), RunE: runValidateReferences, }
VarValidateCmd represents the validate command
var VarVendorAllCmd = &cobra.Command{ Use: "vendor --output <path>", Short: "Copy all dependencies to vendor directory", Long: `Copy all external dependencies to the local vendor directory for offline use.`, Args: cobra.MaximumNArgs(1), RunE: runVendorAll, }
VarVendorAllCmd represents the vendor all command
var VarVendorCmd = &cobra.Command{
Use: "vendor",
Short: "Vendor dependencies for offline use",
}
VarVendorCmd represents the vendor command
var VarVendorUpdateCmd = &cobra.Command{
Use: "update [--vendor-path <path>] [--force]",
Short: "Update vendored dependencies",
RunE: runVendorUpdate,
}
VarVendorUpdateCmd represents the vendor update command
Functions ¶
func ExitWithCode ¶
ExitWithCode prints error message and exits with specific code
func ListVendorSpecs ¶
ListVendorSpecs lists all vendored specs
func PrintSuccess ¶
PrintSuccess prints success message
Types ¶
type CLIError ¶
CLIError represents a CLI error with actionable suggestions
func ErrCIRequired ¶
func ErrCIRequired() *CLIError
ErrCIRequired indicates TUI is required in non-interactive environment
func ErrCommandNotFound ¶
ErrCommandNotFound indicates an invalid command
func ErrInvalidInput ¶
ErrInvalidInput indicates invalid input
func ErrMissingDependency ¶
ErrMissingDependency indicates a required dependency is not installed
func ErrNotAProject ¶
func ErrNotAProject() *CLIError
ErrNotAProject indicates the current directory is not a SpecLedger project
func ErrPermissionDenied ¶
ErrPermissionDenied indicates permission error
func ErrProjectExists ¶
ErrProjectExists indicates the project directory already exists
func NewCLIError ¶
NewCLIError creates a new CLI error with suggestions
type DoctorOutput ¶
type DoctorOutput struct {
Status string `json:"status"`
Tools []DoctorToolStatus `json:"tools"`
Missing []string `json:"missing,omitempty"`
InstallInstructions string `json:"install_instructions,omitempty"`
}
DoctorOutput represents the JSON output structure for doctor command