Documentation
¶
Overview ¶
Package cmd provides command-line interface implementations. This file implements the accept command which converts tasks.md to tasks.json for machine-readable task tracking.
Package cmd provides command-line interface implementations. This file contains shell completion predictors for the spectr CLI. Predictors provide context-aware suggestions for tab completion in supported shells (bash, zsh, fish).
Package cmd provides command-line interface implementations for Spectr. This file contains the list command for displaying changes and specs.
Package cmd provides command-line interface implementations.
Package cmd provides command-line interface implementations for Spectr. This file contains the version command for displaying build information.
Package cmd provides command-line interface implementations for Spectr. This file contains the view command for displaying the project dashboard.
Index ¶
- func PredictChangeIDs() complete.Predictor
- func PredictItemTypes() complete.Predictor
- func PredictItems() complete.Predictor
- func PredictSpecIDs() complete.Predictor
- type AcceptCmd
- type CLI
- type InitCmd
- type ListCmd
- type PRArchiveCmd
- type PRCmd
- type PRProposalCmd
- type PRRemoveCmd
- type ValidateCmd
- type VersionCmd
- type ViewCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PredictChangeIDs ¶
PredictChangeIDs returns a predictor that suggests active change IDs. It scans the spectr/changes/ directory for active changes, excluding the archive directory. Returns nil on error.
func PredictItemTypes ¶
PredictItemTypes returns a predictor that suggests item types. Valid types are "change" and "spec".
func PredictItems ¶
PredictItems returns a predictor that suggests both change and spec IDs. This is useful for commands that accept either type of item. Combines results from both changes and specs directories.
func PredictSpecIDs ¶
PredictSpecIDs returns a predictor that suggests spec IDs. It scans the spectr/specs/ directory for specification directories. Returns nil on error.
Types ¶
type AcceptCmd ¶ added in v0.0.7
type AcceptCmd struct {
// ChangeID is the optional change identifier to process
ChangeID string `arg:"" optional:"" predictor:"changeID" help:"Change"`
// DryRun enables preview mode without writing files
DryRun bool `name:"dry-run" help:"Preview without writing"`
// NoInteractive disables interactive prompts
NoInteractive bool `name:"no-interactive" help:"Disable prompts"`
}
AcceptCmd represents the accept command for converting tasks.md to tasks.json. This command parses the human-readable tasks.md file and produces a machine-readable tasks.json file with structured task data.
type CLI ¶
type CLI struct {
Init InitCmd `cmd:"" help:"Initialize Spectr"`
List ListCmd `cmd:"" aliases:"ls" help:"List items"`
Validate ValidateCmd `cmd:"" help:"Validate items"`
Accept AcceptCmd `cmd:"" help:"Accept tasks.md"`
Archive archive.ArchiveCmd `cmd:"" help:"Archive a change"`
PR PRCmd `cmd:"" help:"Create pull requests"`
View ViewCmd `cmd:"" help:"Display dashboard"`
Version VersionCmd `cmd:"" help:"Show version info"`
Completion kongcompletion.Completion `cmd:"" help:"Generate completions"`
}
CLI represents the root command structure for Kong
type InitCmd ¶
type InitCmd struct {
initialize.InitCmd
}
InitCmd wraps the initialize package's InitCmd type to add Run method
type ListCmd ¶
type ListCmd struct {
// Specs determines whether to list specifications instead of changes
Specs bool `name:"specs" help:"List specifications instead of changes"`
// All determines whether to list both changes and specs in unified mode
All bool `name:"all" help:"List both changes and specs in unified mode"`
// Long enables detailed output with titles and counts
Long bool `name:"long" help:"Show detailed output with titles and counts"`
// JSON enables JSON output format
JSON bool `name:"json" help:"Output as JSON"`
// Interactive enables interactive table mode with clipboard
Interactive bool `short:"I" name:"interactive" help:"Interactive mode"`
}
ListCmd represents the list command which displays changes or specs. It supports multiple output formats: text, long (detailed), JSON, and interactive table mode with clipboard support.
type PRArchiveCmd ¶
type PRArchiveCmd struct {
ChangeID string `arg:"" optional:"" predictor:"changeID" help:"Change ID"`
Base string `name:"base" short:"b" help:"Target branch for PR"`
Draft bool `name:"draft" short:"d" help:"Create as draft PR"`
Force bool `name:"force" short:"f" help:"Delete existing branch"`
DryRun bool `name:"dry-run" help:"Preview without executing"`
SkipSpecs bool `name:"skip-specs" help:"Skip spec merging"`
}
PRArchiveCmd represents the pr archive subcommand.
type PRCmd ¶
type PRCmd struct {
Archive PRArchiveCmd `cmd:"" aliases:"a" help:"Archive and create PR"`
Proposal PRProposalCmd `cmd:"" aliases:"p" help:"Create proposal PR"`
Remove PRRemoveCmd `cmd:"" name:"rm" aliases:"r,remove" help:"Remove via PR"`
}
PRCmd represents the pr command with subcommands.
type PRProposalCmd ¶
type PRProposalCmd struct {
ChangeID string `arg:"" optional:"" predictor:"changeID" help:"Change ID"`
Base string `name:"base" short:"b" help:"Target branch for PR"`
Draft bool `name:"draft" short:"d" help:"Create as draft PR"`
Force bool `name:"force" short:"f" help:"Delete existing branch"`
DryRun bool `name:"dry-run" help:"Preview without executing"`
}
PRProposalCmd represents the pr proposal subcommand.
func (*PRProposalCmd) Run ¶
func (c *PRProposalCmd) Run() error
Run executes the pr proposal command.
type PRRemoveCmd ¶
type PRRemoveCmd struct {
ChangeID string `arg:"" optional:"" predictor:"changeID" help:"Change ID"`
Base string `name:"base" short:"b" help:"Target branch for PR"`
Draft bool `name:"draft" short:"d" help:"Create as draft PR"`
Force bool `name:"force" short:"f" help:"Delete existing branch"`
DryRun bool `name:"dry-run" help:"Preview without executing"`
}
PRRemoveCmd represents the pr remove subcommand.
type ValidateCmd ¶
type ValidateCmd struct {
ItemName *string `arg:"" optional:"" predictor:"item"`
Strict bool `name:"strict" help:"Treat warnings as errors"`
JSON bool `name:"json" help:"Output as JSON"`
All bool `name:"all" help:"Validate all"`
Changes bool `name:"changes" help:"Validate changes"`
Specs bool `name:"specs" help:"Validate specs"`
Type *string `name:"type" enum:"change,spec" predictor:"itemType"`
NoInteractive bool `name:"no-interactive" help:"No prompts"`
}
ValidateCmd represents the validate command
type VersionCmd ¶
type VersionCmd struct {
// JSON enables JSON output format for scripting and automation.
// When enabled, outputs structured data with version, commit, date.
JSON bool `kong:"help='Output in JSON format for scripting'"`
// Short enables minimal output showing only the version number.
// Useful for scripts that need to parse or compare version numbers.
Short bool `kong:"help='Output version number only'"`
}
VersionCmd represents the version command which displays build information including version number, git commit hash, and build date.
Output formats:
- Default: Multi-line formatted output with version, commit, and date
- --short: Version number only (e.g., "v0.1.0")
- --json: Machine-readable JSON for automation and scripting
Examples:
spectr version # Full build information spectr version --short # Version number only spectr version --json # JSON format
func (*VersionCmd) Run ¶
func (c *VersionCmd) Run() error
Run executes the version command. It retrieves build information and formats the output based on the flags: JSON flag takes precedence over Short flag if both are set. Returns an error if JSON marshaling fails, nil otherwise.
type ViewCmd ¶
type ViewCmd struct {
// JSON enables JSON output format for scripting and automation.
// When enabled, outputs structured data matching the schema defined
// in the view command design specification.
JSON bool `kong:"help='Output in JSON format for scripting'"`
}
ViewCmd represents the view command which displays a comprehensive project dashboard including summary metrics, active changes, completed changes, and specifications.
The dashboard provides an at-a-glance overview of the entire project state:
- Summary metrics: total specs, requirements, changes, and task progress
- Active changes: changes in progress with visual progress bars
- Completed changes: changes with all tasks complete
- Specifications: all specs with requirement counts
Output formats:
- Default: Colored terminal output with Unicode box-drawing characters
- --json: Machine-readable JSON for automation and scripting
The terminal output uses lipgloss for styling and requires a terminal with Unicode support for optimal display. All modern terminal emulators (iTerm2, GNOME Terminal, Windows Terminal, Terminal.app) are supported.