commands

package
v1.0.50 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProductionAuthURL is the production SpecLedger authentication URL
	ProductionAuthURL = "https://app.specledger.io/cli/auth"
	// DevAuthURL is the development authentication URL
	DevAuthURL = "http://localhost:3000/cli/auth"
	// AuthTimeout is the maximum time to wait for browser authentication
	AuthTimeout = 5 * time.Minute
)

Variables

View Source
var VarAddCmd = &cobra.Command{
	Use:   "add <repo-url> [branch] --alias <name> [--artifact-path <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.

The --alias flag is required and will be used as the reference path when accessing artifacts from this dependency.

For SpecLedger repositories, the artifact_path will be auto-detected from the dependency's specledger.yaml. For non-SpecLedger repositories, use --artifact-path to manually specify where artifacts are located.`,
	Example: `  sl deps add git@github.com:org/api-spec --alias api
  sl deps add git@github.com:org/api-spec develop --alias api
  sl deps add https://github.com/org/api-docs --alias docs --artifact-path docs/openapi/`,
	Args: cobra.MinimumNArgs(1),
	RunE: runAddDependency,
}

VarAddCmd represents the add command

View Source
var VarAuthCmd = &cobra.Command{
	Use:   "auth",
	Short: "Manage authentication",
	Long: `Manage authentication for SpecLedger CLI.

Authentication is required for accessing protected features like
private specifications and remote synchronization.

Examples:
  sl auth login   # Sign in via browser
  sl auth logout  # Sign out and clear tokens
  sl auth status  # Check authentication status`,
}

VarAuthCmd represents the auth command group

View Source
var VarAuthHookCmd = &cobra.Command{
	Use:   "hook",
	Short: "Manage Claude Code session capture hook",
	Long: `Check, install, or remove the session capture hook in Claude Code settings.

The hook is automatically installed during 'sl auth login', but you can
use this command to manually manage it.

Examples:
  sl auth hook           # Check if hook is installed
  sl auth hook --install # Install the hook
  sl auth hook --remove  # Remove the hook`,
	RunE: runHook,
}

VarAuthHookCmd represents the hook command

View Source
var VarAuthLoginCmd = &cobra.Command{
	Use:   "login",
	Short: "Sign in via browser",
	Long: `Open your browser to sign in to SpecLedger.

This command will:
1. Start a temporary local server to receive authentication
2. Open your default browser to the SpecLedger sign-in page
3. Wait for you to complete authentication
4. Store your credentials securely

If the browser doesn't open automatically, you can manually navigate
to the URL shown in the terminal.`,
	RunE: runLogin,
}

VarAuthLoginCmd represents the login command

View Source
var VarAuthLogoutCmd = &cobra.Command{
	Use:   "logout",
	Short: "Sign out and clear tokens",
	Long:  `Sign out of SpecLedger and remove stored credentials.`,
	RunE:  runLogout,
}

VarAuthLogoutCmd represents the logout command

View Source
var VarAuthRefreshCmd = &cobra.Command{
	Use:   "refresh",
	Short: "Refresh access token",
	Long:  `Manually refresh the access token using the stored refresh token.`,
	RunE:  runRefresh,
}

VarAuthRefreshCmd represents the refresh command

View Source
var VarAuthStatusCmd = &cobra.Command{
	Use:   "status",
	Short: "Check authentication status",
	Long:  `Display the current authentication status and user information.`,
	RunE:  runStatus,
}

VarAuthStatusCmd represents the status command

View Source
var VarAuthSupabaseCmd = &cobra.Command{
	Use:   "supabase",
	Short: "Show Supabase configuration",
	Long:  `Display Supabase URL and anon key for API access.`,
	RunE:  runSupabase,
}

VarAuthSupabaseCmd represents the supabase config command

View Source
var VarAuthTokenCmd = &cobra.Command{
	Use:   "token",
	Short: "Print access token (for scripts)",
	Long: `Print the current access token to stdout.

This command is designed for use in scripts and automation.
It outputs only the token with no other text, making it easy
to capture in a variable:

  ACCESS_TOKEN=$(sl auth token)

The token is automatically refreshed if expired.`,
	RunE: runToken,
}

VarAuthTokenCmd represents the token command (for scripts)

View Source
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
- Built-in issue tracking via sl issue commands
- 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

View Source
var VarCheckCmd = &cobra.Command{
	Use:   "check",
	Short: "Check for conflicts in the dependency graph",
	RunE:  runCheckConflicts,
}

VarCheckCmd represents the check command

View Source
var VarCleanCmd = &cobra.Command{
	Use:   "clean",
	Short: "Remove vendored dependencies",
	RunE:  runVendorClean,
}

VarCleanCmd represents the clean command

View Source
var VarCommentCmd = &cobra.Command{
	Use:   "comment",
	Short: "Manage review comments",
	Long: `Manage review comments from Supabase.

Subcommands:
  list     List review comments (compact or JSON format)
  show     Show full comment details with thread replies
  reply    Reply to a comment thread
  resolve  Mark comments as resolved (--reason required)`,
	Args:         cobra.NoArgs,
	RunE:         func(cmd *cobra.Command, args []string) error { return cmd.Help() },
	SilenceUsage: true,
}
View Source
var VarConfigCmd = &cobra.Command{
	Use:   "config",
	Short: "Manage CLI configuration",
	Long: `Manage SpecLedger CLI configuration.

Configuration is stored in a three-tier hierarchy:
  - Global: ~/.specledger/config.yaml (user-wide defaults)
  - Team-local: specledger/specledger.yaml (project-level, git-tracked)
  - Personal-local: specledger/specledger.local.yaml (project-level, gitignored)

Precedence: personal-local > team-local > global > default

Commands:
  sl config set <key> <value>   Set a configuration value
  sl config get <key>           Get a configuration value
  sl config show                Show all configuration values
  sl config unset <key>         Remove a configuration value

Examples:
  sl config set agent.base-url https://api.example.com
  sl config set --global agent.model sonnet
  sl config set --personal agent.auth-token sk-xxx
  sl config show
  sl config unset agent.base-url`,
}
View Source
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

View Source
var VarContextCmd = &cobra.Command{
	Use:   "context",
	Short: "Manage agent context files",
	Long: `Manage AI agent context files with plan metadata.

Commands:
  update  Update agent files with Technical Context from plan.md

Examples:
  sl context update claude      # Update CLAUDE.md
  sl context update gemini      # Update GEMINI.md
  sl context update copilot     # Update .github/agents/copilot-instructions.md
  sl context update claude --json  # Output as JSON`,
}
View Source
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

View Source
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

View Source
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

View Source
var VarDetectCmd = &cobra.Command{
	Use:   "detect",
	Short: "Detect potential conflicts",
	RunE:  runDetectConflicts,
}

VarDetectCmd represents the detect command

View Source
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) are installed and accessible
- CLI version is up to date (prompts to update if not)
- Project templates match the CLI version (prompts to apply if not)

Use --update to update the CLI binary without prompting.
Use --template to apply embedded templates without prompting.
Use --json flag for machine-readable output suitable for CI/CD pipelines.`,
	Example: `  sl doctor              # Full check, prompt to update CLI and templates if needed
  sl doctor --update     # Update CLI to latest version (non-interactive)
  sl doctor --template   # Apply embedded templates (non-interactive)
  sl doctor --json       # JSON output for CI/CD`,
	RunE:          runDoctor,
	SilenceUsage:  true,
	SilenceErrors: true,
}

VarDoctorCmd represents the doctor command

View Source
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

View Source
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

View Source
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
- Built-in issue tracking via sl issue commands
- 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

View Source
var VarIssueCmd = &cobra.Command{
	Use:   "issue",
	Short: "Manage issues for the current spec",
	Long: `Manage issues for tracking work within a spec.

Issues are stored in JSONL format at specledger/<spec>/issues.jsonl.
Each issue has a globally unique ID (SL-xxxxxx format).

Commands:
  sl issue create    Create a new issue
  sl issue list      List issues
  sl issue show      Show issue details
  sl issue update    Update an issue
  sl issue close     Close an issue
  sl issue link      Link issues with dependencies
  sl issue unlink    Remove dependency links
  sl issue migrate   Migrate from Beads format
  sl issue repair    Repair corrupted issues.jsonl

Examples:
  sl issue create --title "Add validation" --type task
  sl issue list --status open
  sl issue show SL-a3f5d8
  sl issue update SL-a3f5d8 --status in_progress
  sl issue close SL-a3f5d8`,
}

VarIssueCmd is the issue command group

View Source
var VarLinkCmd = &cobra.Command{
	Use:   "link",
	Short: "Create symlinks from cached dependencies to project artifacts directory",
	Long: `Create symlinks from cached dependencies to the project's artifacts directory, making them available for Claude Code and other tools.

This command creates symlinks from ~/.specledger/cache/<alias>/ to <project.artifact_path>/deps/<alias>/, allowing reference paths like "alias:artifact.md" to resolve to actual files.

Example:  sl deps link`,
	RunE: runLinkDependencies,
}

VarLinkCmd represents the link command

View Source
var VarListCmd = &cobra.Command{
	Use:   "list [--spec-path <path>]",
	Short: "List all external references",
	RunE:  runListReferences,
}

VarListCmd represents the list command

View Source
var VarMockupCmd = &cobra.Command{
	Use:   "mockup [prompt...]",
	Short: "Generate UI mockups from feature specifications",
	Long: `Generate UI mockups from feature specifications.

Auto-detects spec from current branch. Pass instructions for the AI agent.

Examples:
  sl mockup                                    # Interactive flow
  sl mockup help me gen mockup ui for spec     # With custom instructions
  sl mockup focus on the login form            # With custom instructions
  sl mockup -y                                 # Auto-confirm all prompts
  sl mockup --format jsx                       # Generate JSX mockup`,
	Args:         cobra.ArbitraryArgs,
	RunE:         runMockup,
	SilenceUsage: true,
}

VarMockupCmd is the sl mockup command.

View Source
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

View Source
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

View Source
var VarRefsCmd = &cobra.Command{
	Use:   "refs",
	Short: "Validate external specification references",
}

VarRefsCmd represents the refs command

View Source
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

View Source
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

View Source
var VarReviseCmd = &cobra.Command{
	Use:   "revise [branch-name]",
	Short: "Fetch and address review comments for a spec",
	Long: `Fetch unresolved review comments from Supabase and guide you through
addressing them with an AI coding agent.

Flow:
  1. Detect or select the target branch
  2. Fetch unresolved comments from Supabase
  3. Select artifacts to work on (multi-select)
  4. Process each comment (provide guidance or skip)
  5. Generate a combined revision prompt
  6. Open the prompt in your editor for refinement
  7. Launch the configured AI coding agent
  8. Offer to commit/push changes and resolve comments

Examples:
  sl revise                          # Interactive: detect branch, fetch comments
  sl revise 136-revise-comments      # Use the specified branch directly
  sl revise --summary                # Print compact comment listing and exit
  sl revise --auto fixture.json      # Non-interactive: fixture-driven prompt generation
  sl revise --dry-run                # Interactive flow but write prompt to file instead of launching agent`,
	Args:         cobra.MaximumNArgs(1),
	RunE:         runRevise,
	SilenceUsage: true,
}

VarReviseCmd is the sl revise command.

View Source
var VarSessionCaptureCmd = &cobra.Command{
	Use:   "capture",
	Short: "Capture session from hook input",
	Long: `Capture an AI session from Claude Code hook input.

This command is designed to be called by Claude Code hooks, not manually.
It reads hook JSON from stdin, detects git commits, and captures the
conversation delta since the last commit.

Test mode (for manual testing):
  sl session capture --test-mode

Exit codes:
  0 - Success (session captured/queued) or no-op (not a commit)
  1 - Fatal error (logged to stderr)`,
	RunE:         runSessionCapture,
	SilenceUsage: true,
}

VarSessionCaptureCmd represents the capture command (called by hooks)

View Source
var VarSessionCmd = &cobra.Command{
	Use:   "session",
	Short: "Manage AI session captures",
	Long: `Manage AI session captures for checkpoints and tasks.

Sessions are automatically captured when you commit changes while working
with Claude Code. They provide a record of the AI conversation that led
to each commit.

Commands:
  list     List sessions for a branch
  get      Retrieve session content by ID, commit hash, or task ID
  sync     Upload queued sessions (for offline captures)
  capture  (Internal) Called by Claude Code hooks

Examples:
  sl session list                    # List sessions for current branch
  sl session list --feature main     # List sessions for main branch
  sl session get abc123              # Get session by partial commit hash
  sl session get SL-42               # Get session by task ID
  sl session sync                    # Upload any queued sessions
  sl session sync --status           # Check queue status without uploading`,
}

VarSessionCmd represents the session command group

View Source
var VarSessionGetCmd = &cobra.Command{
	Use:   "get <session-id|commit-hash|task-id>",
	Short: "Retrieve a session's content",
	Long: `Retrieve and display a session's conversation content.

You can look up a session by:
  - Session ID (UUID)
  - Commit hash (full or partial, e.g., "abc1234" or full 40-char hash)
  - Task ID (e.g., SL-42)

Examples:
  sl session get abc1234               # Get by partial commit hash
  sl session get SL-42                 # Get by task ID
  sl session get 550e8400-e29b...      # Get by full UUID
  sl session get abc1234 --json        # Output as JSON (for AI processing)
  sl session get abc1234 --raw         # Output raw gzip stream`,
	Args: cobra.ExactArgs(1),
	RunE: runSessionGet,
}

VarSessionGetCmd represents the get command

View Source
var VarSessionListCmd = &cobra.Command{
	Use:   "list",
	Short: "List sessions for a feature",
	Long: `List sessions for a feature branch.

By default, lists sessions for the current git branch.
Use --feature to specify a different branch.

Examples:
  sl session list                        # Sessions for current branch
  sl session list --feature main         # Sessions for main branch
  sl session list --commit abc123        # Filter by partial commit hash
  sl session list --task SL-42           # Filter by task ID
  sl session list --limit 10             # Show only last 10 sessions
  sl session list --json                 # Output as JSON (for scripts/AI)`,
	RunE: runSessionList,
}

VarSessionListCmd represents the list command

View Source
var VarSessionSyncCmd = &cobra.Command{
	Use:   "sync",
	Short: "Upload queued sessions",
	Long: `Upload sessions that were queued due to network failures.

When session capture fails (e.g., network down), sessions are stored
locally in ~/.specledger/session-queue/ and can be uploaded later.

Examples:
  sl session sync            # Upload all queued sessions
  sl session sync --status   # Check queue status without uploading
  sl session sync --json     # Output results as JSON`,
	RunE: runSessionSync,
}

VarSessionSyncCmd represents the sync command

View Source
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

View Source
var VarSpecCmd = &cobra.Command{
	Use:   "spec",
	Short: "Manage feature specifications",
	Long: `Manage feature specifications and feature context.

Commands:
  info        Get feature paths and prerequisite validation
  create      Create a new feature branch and spec directory
  setup-plan  Copy plan template to feature directory

Examples:
  sl spec info --json                    # Get feature info as JSON
  sl spec create --number 600 --short-name "test-feature"  # Create new feature
  sl spec setup-plan                     # Setup plan.md from template`,
}
View Source
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

View Source
var VarUnlinkCmd = &cobra.Command{
	Use:   "unlink [alias]",
	Short: "Remove symlinks for dependencies",
	Long: `Remove symlinks for dependencies from the project's artifacts directory.

If no alias is specified, removes all dependency symlinks. If an alias is specified, only removes that dependency's symlink.

Example:  sl deps unlink      # Unlink all
  sl deps unlink api    # Unlink specific dependency`,
	Args: cobra.MaximumNArgs(1),
	RunE: runUnlinkDependencies,
}

VarUnlinkCmd represents the unlink command

View Source
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

View Source
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

View Source
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

View Source
var VarVendorCmd = &cobra.Command{
	Use:   "vendor",
	Short: "Vendor dependencies for offline use",
}

VarVendorCmd represents the vendor command

View Source
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

func ExitWithCode(code int, err error)

ExitWithCode prints error message and exits with specific code

func ExitWithError

func ExitWithError(err error)

ExitWithError prints error message and exits

func IsConstitutionPopulated added in v1.0.17

func IsConstitutionPopulated(path string) bool

IsConstitutionPopulated checks if the constitution file exists and is populated (no placeholder tokens remaining). Returns false if the file is missing, empty, or still contains [PLACEHOLDER] style tokens.

func ListVendorSpecs

func ListVendorSpecs(vendorPath string) ([]string, error)

ListVendorSpecs lists all vendored specs

func NewContextCmd added in v1.0.41

func NewContextCmd() *cobra.Command

func NewContextUpdateCmd added in v1.0.41

func NewContextUpdateCmd() *cobra.Command

func NewSpecCmd added in v1.0.41

func NewSpecCmd() *cobra.Command

func NewSpecCreateCmd added in v1.0.41

func NewSpecCreateCmd() *cobra.Command

func NewSpecInfoCmd added in v1.0.41

func NewSpecInfoCmd() *cobra.Command

func NewSpecSetupPlanCmd added in v1.0.41

func NewSpecSetupPlanCmd() *cobra.Command

func PrintSuccess

func PrintSuccess(title string, details ...string)

PrintSuccess prints success message

func ReadAgentPreference added in v1.0.17

func ReadAgentPreference(path string) (string, error)

ReadAgentPreference extracts the preferred agent from a populated constitution file. Returns empty string and nil error if the file exists but has no agent preference.

func WriteDefaultConstitution added in v1.0.17

func WriteDefaultConstitution(path string, principles []ConstitutionPrinciple, agentPref string) error

WriteDefaultConstitution writes a populated constitution file with the given principles and agent preference, replacing template placeholders.

Types

type CLIError

type CLIError struct {
	Title       string
	Description string
	Suggestions []string
	ExitCode    int
}

CLIError represents a CLI error with actionable suggestions

func ErrCIRequired

func ErrCIRequired() *CLIError

ErrCIRequired indicates TUI is required in non-interactive environment

func ErrCommandNotFound

func ErrCommandNotFound(command string) *CLIError

ErrCommandNotFound indicates an invalid command

func ErrInvalidInput

func ErrInvalidInput(message string) *CLIError

ErrInvalidInput indicates invalid input

func ErrMissingDependency

func ErrMissingDependency(name string, installCmd string) *CLIError

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

func ErrPermissionDenied(path string) *CLIError

ErrPermissionDenied indicates permission error

func ErrProjectExists

func ErrProjectExists(projectName string) *CLIError

ErrProjectExists indicates the project directory already exists

func NewCLIError

func NewCLIError(title, description string, suggestions []string, exitCode int) *CLIError

NewCLIError creates a new CLI error with suggestions

func (*CLIError) Error

func (e *CLIError) Error() string

Error returns the error message

type ConstitutionPrinciple added in v1.0.17

type ConstitutionPrinciple struct {
	Name        string
	Description string
	Selected    bool
}

ConstitutionPrinciple represents a selectable guiding principle for the project constitution.

func DefaultPrinciples added in v1.0.17

func DefaultPrinciples() []ConstitutionPrinciple

DefaultPrinciples returns the default set of constitution principles presented during sl new.

type ContextUpdateOutput added in v1.0.41

type ContextUpdateOutput struct {
	UpdatedFiles []string `json:"UPDATED_FILES"`
}

type DoctorOutput

type DoctorOutput struct {
	Status              string             `json:"status"`
	Tools               []DoctorToolStatus `json:"tools"`
	Missing             []string           `json:"missing,omitempty"`
	InstallInstructions string             `json:"install_instructions,omitempty"`

	// CLI version info
	CLIVersion            string `json:"cli_version"`
	CLILatestVersion      string `json:"cli_latest_version,omitempty"`
	CLIUpdateAvailable    bool   `json:"cli_update_available"`
	CLIUpdateInstructions string `json:"cli_update_instructions,omitempty"`
	CLICheckError         string `json:"cli_check_error,omitempty"`

	// Template version info
	TemplateVersion         string   `json:"template_version,omitempty"`
	TemplateUpdateAvailable bool     `json:"template_update_available"`
	TemplateCustomizedFiles []string `json:"template_customized_files,omitempty"`
}

DoctorOutput represents the JSON output structure for doctor command

type DoctorToolStatus

type DoctorToolStatus struct {
	Name      string `json:"name"`
	Installed bool   `json:"installed"`
	Version   string `json:"version,omitempty"`
	Path      string `json:"path,omitempty"`
	Category  string `json:"category"`
}

DoctorToolStatus represents a tool's status in JSON output

type GitRemoteInfo added in v1.0.30

type GitRemoteInfo struct {
	Owner string
	Name  string
}

GitRemoteInfo contains parsed git remote information

type SpecCreateOutput added in v1.0.41

type SpecCreateOutput struct {
	BranchName string `json:"BRANCH_NAME"`
	FeatureDir string `json:"FEATURE_DIR"`
	SpecFile   string `json:"SPEC_FILE"`
	FeatureNum string `json:"FEATURE_NUM"`
}

type SpecInfoOutput added in v1.0.41

type SpecInfoOutput struct {
	FeatureDir    string   `json:"FEATURE_DIR"`
	Branch        string   `json:"BRANCH"`
	FeatureSpec   string   `json:"FEATURE_SPEC"`
	AvailableDocs []string `json:"AVAILABLE_DOCS,omitempty"`
}

type SpecSetupPlanOutput added in v1.0.41

type SpecSetupPlanOutput struct {
	PlanFile string `json:"PLAN_FILE"`
}

Jump to

Keyboard shortcuts

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