data

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	Name                 string            `json:"name"`
	Branch               string            `json:"branch"`
	Repo                 string            `json:"repo"`
	Base                 string            `json:"base"`
	Created              string            `json:"created"`
	Assistant            string            `json:"assistant"` // "claude", "codex", "gemini"
	Scripts              ScriptsConfig     `json:"scripts"`
	ScriptMode           string            `json:"script_mode"` // "concurrent" or "nonconcurrent"
	Env                  map[string]string `json:"env"`
	PortBase             *int              `json:"port_base"`
	LastActiveBufferName string            `json:"last_active_buffer_name"`
	OpenTabs             []TabInfo         `json:"open_tabs,omitempty"` // Persisted tabs
	ActiveTabIndex       int               `json:"active_tab_index"`
}

Metadata stores per-worktree configuration

type MetadataStore

type MetadataStore struct {
	// contains filtered or unexported fields
}

MetadataStore manages per-worktree metadata persistence

func NewMetadataStore

func NewMetadataStore(metadataRoot string) *MetadataStore

NewMetadataStore creates a new metadata store

func (*MetadataStore) Delete

func (s *MetadataStore) Delete(wt *Worktree) error

Delete removes metadata for a worktree

func (*MetadataStore) Load

func (s *MetadataStore) Load(wt *Worktree) (*Metadata, error)

Load loads metadata for a worktree

func (*MetadataStore) Save

func (s *MetadataStore) Save(wt *Worktree, meta *Metadata) error

Save saves metadata for a worktree

type Project

type Project struct {
	Name      string     `json:"name"`
	Path      string     `json:"path"` // Absolute path to repository
	Worktrees []Worktree `json:"-"`    // Discovered dynamically via git
}

Project represents a registered git repository with its worktrees

func NewProject

func NewProject(path string) *Project

NewProject creates a new Project from a repository path

func (*Project) AddWorktree

func (p *Project) AddWorktree(wt Worktree)

AddWorktree adds a worktree to the project

func (*Project) FindWorktree

func (p *Project) FindWorktree(root string) *Worktree

FindWorktree finds a worktree by its root path

func (*Project) FindWorktreeByName

func (p *Project) FindWorktreeByName(name string) *Worktree

FindWorktreeByName finds a worktree by its name

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages the projects.json file for persistent project tracking

func NewRegistry

func NewRegistry(path string) *Registry

NewRegistry creates a new registry at the specified path

func (*Registry) AddProject

func (r *Registry) AddProject(path string) error

AddProject adds a project path to the registry

func (*Registry) Load

func (r *Registry) Load() ([]string, error)

Load reads the project paths from the registry file

func (*Registry) Projects

func (r *Registry) Projects() ([]string, error)

Projects returns a copy of all registered project paths

func (*Registry) RemoveProject

func (r *Registry) RemoveProject(path string) error

RemoveProject removes a project path from the registry

func (*Registry) Save

func (r *Registry) Save(paths []string) error

Save writes the project paths to the registry file

type ScriptsConfig

type ScriptsConfig struct {
	Setup   string `json:"setup"`
	Run     string `json:"run"`
	Archive string `json:"archive"`
}

ScriptsConfig holds the setup/run/archive script commands

type TabInfo

type TabInfo struct {
	Assistant string `json:"assistant"`
	Name      string `json:"name"`
}

TabInfo stores information about an open tab

type Worktree

type Worktree struct {
	Name    string    `json:"name"`
	Branch  string    `json:"branch"`
	Base    string    `json:"base"` // Base ref (e.g., origin/main)
	Repo    string    `json:"repo"` // Primary checkout path
	Root    string    `json:"root"` // Worktree path
	Created time.Time `json:"created"`
}

Worktree represents a git worktree entry with its associated metadata

func NewWorktree

func NewWorktree(name, branch, base, repo, root string) *Worktree

NewWorktree creates a new Worktree with the current timestamp

func (Worktree) ID

func (w Worktree) ID() WorktreeID

ID returns a unique identifier for the worktree based on its repo and root paths

func (Worktree) IsMainBranch

func (w Worktree) IsMainBranch() bool

IsMainBranch returns true if this worktree is on main or master branch

func (Worktree) IsPrimaryCheckout

func (w Worktree) IsPrimaryCheckout() bool

IsPrimaryCheckout returns true if this is the main checkout (not a worktree)

type WorktreeID

type WorktreeID string

WorktreeID is a unique identifier based on repo+root hash

Jump to

Keyboard shortcuts

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