Documentation
¶
Overview ¶
Package cli implements the command-line interface for speedgrapher using Cobra.
Index ¶
- Constants
- func ExecuteInstall(opts InstallOptions, stdout, stderr io.Writer) error
- func ExecuteUninstall(opts UninstallOptions, stdout, stderr io.Writer) error
- func ExtractVersion(text string, re *regexp.Regexp) string
- func FormatStatusTable(statuses []ToolStatus) string
- func NewRootCmd(version string, stdin io.Reader, stdout, stderr io.Writer) *cobra.Command
- func PrintHelp(w io.Writer, version string)
- func Run(ctx context.Context, version string, args []string, stdin io.Reader, ...) error
- func Satisfies(installed Version, constraint string) bool
- type CheckRunner
- type Checker
- type GlobalOptions
- type InstallOptions
- type Status
- type ToolDef
- type ToolSpec
- type ToolStatus
- type UninstallOptions
- type Version
Constants ¶
const AppName = "speedgrapher"
AppName is the root command executable name.
const DefaultJSONConfig = `` /* 232-byte string literal not displayed */
DefaultJSONConfig is the JSON configuration template.
const DefaultYAMLConfig = `` /* 1118-byte string literal not displayed */
DefaultYAMLConfig is the master configuration template.
const MinimalJSONConfig = `{
"tools": {
"fog": true,
"slop": true,
"seo": true,
"vale": true
}
}
`
MinimalJSONConfig is the minimal JSON configuration template.
const MinimalYAMLConfig = `` /* 405-byte string literal not displayed */
MinimalYAMLConfig is the minimal configuration template.
Variables ¶
This section is empty.
Functions ¶
func ExecuteInstall ¶
func ExecuteInstall(opts InstallOptions, stdout, stderr io.Writer) error
ExecuteInstall performs the installation according to the given options.
func ExecuteUninstall ¶
func ExecuteUninstall(opts UninstallOptions, stdout, stderr io.Writer) error
ExecuteUninstall performs the uninstallation according to the given options.
func ExtractVersion ¶ added in v0.10.0
ExtractVersion searches text using regex and returns the first capture group.
func FormatStatusTable ¶ added in v0.10.0
func FormatStatusTable(statuses []ToolStatus) string
FormatStatusTable renders a formatted table suitable for terminal display.
func NewRootCmd ¶ added in v0.10.0
NewRootCmd constructs the main Cobra command tree following GoDoctor's CLI design.
Types ¶
type CheckRunner ¶ added in v0.10.0
type CheckRunner interface {
LookPath(file string) (string, error)
RunCommand(ctx context.Context, name string, args ...string) ([]byte, error)
}
CheckRunner abstracts command execution and path lookups for testability.
type Checker ¶ added in v0.10.0
type Checker struct {
// contains filtered or unexported fields
}
Checker coordinates inspecting external dependencies.
func NewChecker ¶ added in v0.10.0
func NewChecker(runner CheckRunner) *Checker
NewChecker creates a Checker instance with the given runner (or stdCheckRunner if nil).
type GlobalOptions ¶ added in v0.10.0
GlobalOptions holds global CLI flags.
type InstallOptions ¶
type InstallOptions struct {
InstallAll bool
InstallMCP bool
InstallSkills bool
Workspace bool
Global bool
Force bool
Quiet bool
ConfigPath string
SkillsDir string
}
InstallOptions holds parsed options for the install command.
type Status ¶ added in v0.10.0
type Status string
Status represents the health status of an external dependency.
const ( // StatusOk indicates the tool is installed and meets or exceeds recommended version. StatusOk Status = "OK" // StatusOutdated indicates the installed version is older than recommended. StatusOutdated Status = "OUTDATED" // StatusMissing indicates the tool was not found in $PATH. StatusMissing Status = "MISSING" // StatusUnknown indicates the tool is present but its version could not be parsed. StatusUnknown Status = "UNKNOWN" )
type ToolDef ¶
type ToolDef struct {
Name string
Aliases []string
Description string
Usage string
Invoke func(ctx context.Context, rawArgs []string, stdin io.Reader) (*mcp.CallToolResult, error)
}
ToolDef represents metadata and invoker for a tool.
type ToolSpec ¶ added in v0.10.0
type ToolSpec struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Binaries []string `json:"binaries"`
VersionArgs [][]string `json:"version_args"`
OutputRegex *regexp.Regexp `json:"-"`
DefaultRecommended string `json:"default_recommended"`
Category string `json:"category"`
Required bool `json:"required"`
InstallGuide string `json:"install_guide"`
UpgradeCommand string `json:"upgrade_command"`
Timeout time.Duration `json:"timeout,omitempty"`
}
ToolSpec defines inspection metadata and upgrade guidance for an external utility.
func DefaultCheckRegistry ¶ added in v0.10.0
func DefaultCheckRegistry() []ToolSpec
DefaultCheckRegistry returns the catalog of external dependencies checked by Speedgrapher.
type ToolStatus ¶ added in v0.10.0
type ToolStatus struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Status Status `json:"status"` // OK, OUTDATED, MISSING, UNKNOWN
BinaryPath string `json:"binary_path,omitempty"`
InstalledVersion string `json:"installed_version,omitempty"`
RecommendedVersion string `json:"recommended_version"`
Satisfies bool `json:"satisfies"`
UpgradeCommand string `json:"upgrade_command,omitempty"`
Category string `json:"category,omitempty"`
Required bool `json:"required"`
}
ToolStatus represents the evaluation result of an external utility.
type UninstallOptions ¶
type UninstallOptions struct {
UninstallAll bool
UninstallMCP bool
UninstallSkills bool
Workspace bool
Global bool
Quiet bool
ConfigPath string
SkillsDir string
}
UninstallOptions holds parsed options for the uninstall command.
type Version ¶ added in v0.10.0
Version models a parsed semantic version string.
func ParseVersion ¶ added in v0.10.0
ParseVersion converts raw version strings into a structured Version.