adopt

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package adopt detects unmanaged skills in tool-facing directories and imports them into the canonical Scribe store (~/.scribe/skills/).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindCandidates

func FindCandidates(st *state.State, cfg config.AdoptionConfig) ([]Candidate, []Conflict, error)

FindCandidates walks configured adoption paths (via cfg.AdoptionPaths()) and returns candidates and conflicts. Never mutates state.

Types

type AdoptCompleteMsg

type AdoptCompleteMsg struct {
	Adopted int
	Skipped int
	Failed  int
}

AdoptCompleteMsg is emitted after all candidates in Apply have been processed.

type AdoptErrorMsg

type AdoptErrorMsg struct {
	Name string
	Err  error
}

AdoptErrorMsg is emitted when adoption fails for a single candidate.

type AdoptedMsg

type AdoptedMsg struct {
	Name  string
	Tools []string
}

AdoptedMsg is emitted when a candidate is successfully adopted.

type Adopter

type Adopter struct {
	State *state.State
	Tools []tools.Tool // tools to consider (typically tools.DefaultTools())
	Emit  func(any)    // optional; nil is safe
}

Adopter performs adoption.

func (*Adopter) Apply

func (a *Adopter) Apply(candidates []Candidate) Result

Apply adopts each candidate into the canonical Scribe store. Per-candidate failures are non-fatal. Returns an aggregate Result.

type Candidate

type Candidate struct {
	Name      string   // skill name (dir base)
	LocalPath string   // source dir on disk
	Targets   []string // tool names where this skill was discovered (e.g. ["claude"])
	Hash      string   // content hash (blob SHA of SKILL.md)
	// contains filtered or unexported fields
}

Candidate is an unmanaged skill that adoption can import.

func Resolve

func Resolve(p Plan, decisions map[string]Decision) []Candidate

Resolve folds user decisions into the plan, producing the final set of candidates to adopt. Unresolved conflicts are filtered out.

type Conflict

type Conflict struct {
	Name      string
	Managed   state.InstalledSkill
	Unmanaged Candidate
}

Conflict describes a name collision between an unmanaged skill and a managed one.

type Decision

type Decision int

Decision is the user's choice for a single conflict.

const (
	// DecisionSkip drops the conflict — nothing is adopted.
	DecisionSkip Decision = iota
	// DecisionOverwriteManaged imports the unmanaged skill into the store,
	// bumping the managed revision.
	DecisionOverwriteManaged
	// DecisionReplaceUnmanaged re-links the unmanaged path to the managed
	// store entry (refreshes symlink, does not overwrite canonical content).
	DecisionReplaceUnmanaged
)

type Plan

type Plan struct {
	Adopt     []Candidate // ready to adopt
	Conflicts []Conflict  // unresolved; must pass through Resolve to adopt
}

Plan describes what Apply will do when invoked. Pure data — no I/O.

type Result

type Result struct {
	Adopted []string
	Skipped []string
	Failed  map[string]error
}

Result summarizes what Apply did.

Jump to

Keyboard shortcuts

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