Documentation
¶
Index ¶
- Constants
- func NormalizePath(path string) string
- func NormalizeRuntime(runtime string) string
- type Project
- type Registry
- type ScriptsConfig
- type TabInfo
- type Workspace
- type WorkspaceID
- type WorkspaceStore
- func (s *WorkspaceStore) Delete(id WorkspaceID) error
- func (s *WorkspaceStore) HasLegacyWorkspaces(repoPath string) (bool, error)
- func (s *WorkspaceStore) List() ([]WorkspaceID, error)
- func (s *WorkspaceStore) ListByRepo(repoPath string) ([]*Workspace, error)
- func (s *WorkspaceStore) ListByRepoIncludingArchived(repoPath string) ([]*Workspace, error)
- func (s *WorkspaceStore) Load(id WorkspaceID) (*Workspace, error)
- func (s *WorkspaceStore) LoadMetadataFor(ws *Workspace) (bool, error)
- func (s *WorkspaceStore) Save(ws *Workspace) error
- func (s *WorkspaceStore) UpsertFromDiscovery(discovered *Workspace) error
- func (s *WorkspaceStore) UpsertFromDiscoveryPreserveArchived(discovered *Workspace) error
Constants ¶
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
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
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 ¶
NewProject creates a new Project from a repository path
func (*Project) AddWorkspace ¶ added in v0.0.5
AddWorkspace adds a workspace to the project
func (*Project) FindWorkspace ¶ added in v0.0.5
FindWorkspace finds a workspace by its root path
func (*Project) FindWorkspaceByName ¶ added in v0.0.5
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 ¶
NewRegistry creates a new registry at the specified path
func (*Registry) AddProject ¶
AddProject adds a project path to the registry
func (*Registry) RemoveProject ¶
RemoveProject removes a project path from the registry
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 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
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
IsMainBranch returns true if this workspace is on main or master branch
func (Workspace) IsPrimaryCheckout ¶ added in v0.0.5
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.