projectmigrate

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BudgetForProjectChange

func BudgetForProjectChange(change ProjectChange, links []GlobalSymlink) (map[string]budget.Result, error)

func DefaultFilesystemToolNames

func DefaultFilesystemToolNames() []string

DefaultFilesystemToolNames are tools with predictable ~/.<tool>/skills directories. Gemini is intentionally absent because its CLI owns storage.

func LatestSnapshotPath

func LatestSnapshotPath() (string, error)

func WriteSnapshot

func WriteSnapshot(snapshot Snapshot) (string, error)

Types

type Discovery

type Discovery struct {
	GlobalSymlinks []GlobalSymlink    `json:"global_symlinks"`
	Projects       []ProjectCandidate `json:"projects"`
	Skills         []string           `json:"skills"`
}

Discovery is the pure discovery result used by both interactive and JSON modes.

func Discover

func Discover(opts DiscoveryOptions) (Discovery, error)

Discover finds legacy global symlinks and candidate project directories.

type DiscoveryOptions

type DiscoveryOptions struct {
	HomeDir     string
	StoreDir    string
	ToolNames   []string
	SearchRoots []string
	State       *state.State
}

DiscoveryOptions configures project migration discovery.

type GlobalSymlink struct {
	Tool          string `json:"tool"`
	Skill         string `json:"skill"`
	Path          string `json:"path"`
	CanonicalPath string `json:"canonical_path"`
}

GlobalSymlink is a Scribe-managed skill link in a tool's legacy global skills directory.

func DiscoverGlobalSymlinks(homeDir, storeDir string, toolNames []string) ([]GlobalSymlink, error)

DiscoverGlobalSymlinks scans ~/.<tool>/skills for symlinks pointing into the canonical Scribe skill store.

type MigrationPlan

type MigrationPlan struct {
	DryRun        bool            `json:"dry_run"`
	GlobalLinks   []GlobalSymlink `json:"global_links"`
	ProjectFiles  []ProjectChange `json:"project_files"`
	RemovedLinks  []GlobalSymlink `json:"removed_links"`
	SkippedLinks  []GlobalSymlink `json:"skipped_links,omitempty"`
	SelectedPaths []string        `json:"selected_paths"`
}

MigrationPlan is the complete set of writes/removals for the migration.

func BuildPlan

func BuildPlan(discovery Discovery, selectedProjects []string, dryRun bool, force ...bool) (MigrationPlan, error)

BuildPlan creates an idempotent migration plan for selected projects.

type MigrationResult

type MigrationResult struct {
	DryRun                    bool               `json:"dry_run"`
	FoundGlobalLinks          int                `json:"found_global_links"`
	FoundSkills               int                `json:"found_skills"`
	SelectedProjects          int                `json:"selected_projects"`
	PlannedProjectFileWrites  int                `json:"planned_project_file_writes"`
	PlannedGlobalLinkRemovals int                `json:"planned_global_link_removals"`
	WroteProjectFiles         int                `json:"wrote_project_files"`
	RemovedGlobalLinks        int                `json:"removed_global_links"`
	SkippedGlobalLinks        int                `json:"skipped_global_links"`
	ProjectFiles              []ProjectChange    `json:"project_files"`
	RemovedLinks              []GlobalSymlink    `json:"removed_links"`
	SkippedLinks              []GlobalSymlink    `json:"skipped_links,omitempty"`
	CandidateProjects         []ProjectCandidate `json:"candidate_projects"`
}

MigrationResult summarizes applied work.

func Apply

func Apply(plan MigrationPlan, candidates []ProjectCandidate) (MigrationResult, error)

Apply executes a migration plan. Dry-run plans return the same summary without mutating the filesystem.

type ProjectCandidate

type ProjectCandidate struct {
	Path   string `json:"path"`
	Source string `json:"source"`
}

ProjectCandidate is a directory that can receive a project-local .scribe.yaml.

func DiscoverCandidateProjects

func DiscoverCandidateProjects(searchRoots []string, st *state.State) ([]ProjectCandidate, error)

DiscoverCandidateProjects combines known state projection projects with search roots containing .scribe.yaml. If a search root has no nested project file, the root itself is still a candidate.

type ProjectChange

type ProjectChange struct {
	Project            string                   `json:"project"`
	File               string                   `json:"file"`
	AddedSkills        []string                 `json:"added_skills"`
	Skills             []string                 `json:"skills"`
	Changed            bool                     `json:"changed"`
	SkippedWriteReason string                   `json:"skipped_write_reason,omitempty"`
	BudgetPerAgent     map[string]budget.Result `json:"budget_per_agent,omitempty"`
}

ProjectChange describes the .scribe.yaml update for one selected project.

type Snapshot

type Snapshot struct {
	Version              int                                `json:"version"`
	Timestamp            time.Time                          `json:"timestamp"`
	Discovery            Discovery                          `json:"discovery"`
	Plan                 MigrationPlan                      `json:"plan"`
	PreviousProjectFiles map[string][]byte                  `json:"previous_project_files"`
	PreviousProjections  map[string][]state.ProjectionEntry `json:"previous_projections"`
	StateHash            string                             `json:"state_hash,omitempty"`
}

func LoadSnapshot

func LoadSnapshot(path string) (*Snapshot, error)

type UndoResult

type UndoResult struct {
	RestoredLinks        int    `json:"restored_links"`
	RestoredProjectFiles int    `json:"restored_project_files"`
	DeletedProjectFiles  int    `json:"deleted_project_files"`
	Snapshot             string `json:"snapshot"`
}

func Undo

func Undo(snapshot *Snapshot, snapshotPath string) (UndoResult, error)

Jump to

Keyboard shortcuts

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