data

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuntimeLocalWorktree = "local-worktree"
	RuntimeLocalCheckout = "local-checkout"
	RuntimeLocalDocker   = "local-docker"
	RuntimeCloudSandbox  = "cloud-sandbox"
)

Runtime constants for workspace execution backends

Variables

This section is empty.

Functions

func NormalizePath added in v0.0.8

func NormalizePath(path string) string

NormalizePath returns a cleaned path with symlinks resolved when possible. It avoids forcing absolute paths to preserve legacy IDs that may be relative.

func NormalizeRuntime added in v0.0.5

func NormalizeRuntime(runtime string) string

NormalizeRuntime returns a normalized runtime string

Types

type Project

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

Project represents a registered git repository with its workspaces

func NewProject

func NewProject(path string) *Project

NewProject creates a new Project from a repository path

func (*Project) AddWorkspace added in v0.0.5

func (p *Project) AddWorkspace(ws Workspace)

AddWorkspace adds a workspace to the project

func (*Project) FindWorkspace added in v0.0.5

func (p *Project) FindWorkspace(root string) *Workspace

FindWorkspace finds a workspace by its root path

func (*Project) FindWorkspaceByName added in v0.0.5

func (p *Project) FindWorkspaceByName(name string) *Workspace

FindWorkspaceByName finds a workspace 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 Workspace added in v0.0.5

type Workspace struct {
	// Identity
	Name    string    `json:"name"`
	Created time.Time `json:"created"`

	// Git info
	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"` // Workspace path

	// Execution
	Runtime string `json:"runtime"` // local-worktree, local-checkout, cloud-sandbox

	// Agent config
	Assistant string `json:"assistant"` // claude, codex, gemini

	// Scripts
	Scripts    ScriptsConfig `json:"scripts"`
	ScriptMode string        `json:"script_mode"`

	// Environment
	Env map[string]string `json:"env"`

	// UI state
	OpenTabs       []TabInfo `json:"open_tabs,omitempty"`
	ActiveTabIndex int       `json:"active_tab_index"`

	// Lifecycle
	Archived   bool      `json:"archived"`
	ArchivedAt time.Time `json:"archived_at,omitempty"`
	// contains filtered or unexported fields
}

Workspace represents a workspace with its associated metadata

func NewWorkspace added in v0.0.5

func NewWorkspace(name, branch, base, repo, root string) *Workspace

NewWorkspace creates a new Workspace with the current timestamp and defaults

func (Workspace) ID added in v0.0.5

func (w Workspace) ID() WorkspaceID

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

func (Workspace) IsMainBranch added in v0.0.5

func (w Workspace) IsMainBranch() bool

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

func (Workspace) IsPrimaryCheckout added in v0.0.5

func (w Workspace) IsPrimaryCheckout() bool

IsPrimaryCheckout returns true if this is the primary checkout

type WorkspaceID added in v0.0.5

type WorkspaceID string

WorkspaceID is a unique identifier based on repo+root hash

type WorkspaceStore added in v0.0.8

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

WorkspaceStore manages workspace persistence

func NewWorkspaceStore added in v0.0.8

func NewWorkspaceStore(root string) *WorkspaceStore

NewWorkspaceStore creates a new workspace store

func (*WorkspaceStore) Delete added in v0.0.8

func (s *WorkspaceStore) Delete(id WorkspaceID) error

Delete removes a workspace from the store

func (*WorkspaceStore) HasLegacyWorkspaces added in v0.0.8

func (s *WorkspaceStore) HasLegacyWorkspaces(repoPath string) (bool, error)

HasLegacyWorkspaces reports whether the store has legacy metadata entries (missing Root) for the given repo path.

func (*WorkspaceStore) List added in v0.0.8

func (s *WorkspaceStore) List() ([]WorkspaceID, error)

List returns all workspace IDs stored in the store

func (*WorkspaceStore) ListByRepo added in v0.0.8

func (s *WorkspaceStore) ListByRepo(repoPath string) ([]*Workspace, error)

ListByRepo returns all workspaces for a given repository path

func (*WorkspaceStore) ListByRepoIncludingArchived added in v0.0.8

func (s *WorkspaceStore) ListByRepoIncludingArchived(repoPath string) ([]*Workspace, error)

func (*WorkspaceStore) Load added in v0.0.8

func (s *WorkspaceStore) Load(id WorkspaceID) (*Workspace, error)

Load loads a workspace by its ID

func (*WorkspaceStore) LoadMetadataFor added in v0.0.8

func (s *WorkspaceStore) LoadMetadataFor(ws *Workspace) (bool, error)

LoadMetadataFor loads stored metadata for a workspace and merges it into the provided workspace. This handles legacy metadata files that don't have Root/Repo fields by using the workspace's computed ID (based on Repo+Root from git discovery), with normalization to avoid duplicates. Returns (true, nil) if metadata was found and merged. Returns (false, nil) if no metadata file exists (safe to apply defaults). Returns (false, err) if metadata exists but couldn't be read (don't overwrite).

func (*WorkspaceStore) Save added in v0.0.8

func (s *WorkspaceStore) Save(ws *Workspace) error

Save saves a workspace to the store using atomic write

func (*WorkspaceStore) UpsertFromDiscovery added in v0.0.8

func (s *WorkspaceStore) UpsertFromDiscovery(discovered *Workspace) error

UpsertFromDiscovery merges a discovered workspace into the store. Store metadata wins; discovery updates Repo/Root/Branch (and Name if empty). Archived state is cleared on discovery.

func (*WorkspaceStore) UpsertFromDiscoveryPreserveArchived added in v0.0.8

func (s *WorkspaceStore) UpsertFromDiscoveryPreserveArchived(discovered *Workspace) error

UpsertFromDiscoveryPreserveArchived merges a discovered workspace into the store, but preserves archived state if it was set in stored metadata.

Jump to

Keyboard shortcuts

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