cobracmd

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cobracmd exposes optional Cobra wiring for skillsync. It owns command input, target selection, aggregation, and host error mapping; the core package remains command-framework free.

Index

Constants

This section is empty.

Variables

View Source
var DefaultHarnesses = []Harness{
	{ID: "claude", Aliases: []string{"claude-code"}, ConfigRel: ".claude", ConfigEnv: "CLAUDE_CONFIG_DIR"},
	{ID: "cursor", ConfigRel: ".cursor"},
	{ID: "codex", ConfigRel: ".codex", ConfigEnv: "CODEX_HOME"},
}

DefaultHarnesses preserves WB's Claude, Cursor, and Codex conventions.

Functions

func New

New builds a convenience `skills` parent containing NewSync.

func NewSync

func NewSync(cfg skillsync.Config, opts CommandOptions) *cobra.Command

NewSync builds only the reusable sync leaf, allowing a host such as WB to retain its existing `skills` parent and sibling hook command.

Types

type AggregateError

type AggregateError struct{ Results []TargetResult }

AggregateError exposes every target error through errors.Is/As.

func (*AggregateError) Error

func (e *AggregateError) Error() string

func (*AggregateError) Unwrap

func (e *AggregateError) Unwrap() []error

type CommandOptions

type CommandOptions struct {
	Use, Short string
	Harnesses  []Harness
	Home       func() (string, error)
	Getenv     func(string) string
	Errors     ErrorMapper
	Resolver   skillsync.Resolver
	Renderer   Renderer
	// Legacy enables a host's one-time verified marker import for every
	// selected target (for example WB's .wb-skills-sync.json marker).
	Legacy      skillsync.LegacyImport
	LockTimeout time.Duration
}

type ConflictError

type ConflictError struct{ Report skillsync.Report }

ConflictError is returned even with no ErrorMapper, so conflicts do not accidentally become a successful command.

func (*ConflictError) Error

func (e *ConflictError) Error() string

type ErrorMapper

type ErrorMapper interface {
	Failure(error) error
	Conflict(skillsync.Report) error
}

ErrorMapper lets a host retain its own exit-code and error convention.

type Harness

type Harness struct {
	ID        string
	Aliases   []string
	ConfigRel string
	ConfigEnv string
}

Harness describes one Agent Skills configuration root.

func (Harness) Present

func (h Harness) Present(home string, getenv func(string) string) bool

func (Harness) SkillsDir

func (h Harness) SkillsDir(home string, getenv func(string) string) string

type Renderer

type Renderer func(io.Writer, []TargetResult, string) error

Renderer receives all completed target outcomes after attempts finish.

type TargetResult

type TargetResult struct {
	Harness string
	Dir     string
	Report  skillsync.Report
	Err     error
}

TargetResult retains both an attempted target's complete core report and its error. A host renderer can preserve a legacy JSON contract without reimplementing selection or synchronization.

type UsageError

type UsageError struct{ Err error }

UsageError identifies invalid Cobra input before source preparation or any target write. It preserves its cause for hosts using errors.Is/As.

func (*UsageError) Error

func (e *UsageError) Error() string

func (*UsageError) Unwrap

func (e *UsageError) Unwrap() error

Jump to

Keyboard shortcuts

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