Documentation
¶
Overview ¶
Workspace path helpers match util/workspace-path: resolve relative paths against roots, abbreviate home as ~, and derive display titles from final segments.
Package workspace implements the workspace registry (S14), matching core/workspace. Records contain ID, root, session group, and resume-on-open session. storage.Domain persists them under workspace IDs with CAS writes. SHA-256 of the normalized root produces deterministic IDs, so repeated creation for the same root is idempotent. ResumeOnOpen selects the session opened by default next time.
Index ¶
- func AbbreviateHome(path, home string) string
- func ResolvePath(root, path string) string
- func TitleOf(path string) string
- type Registry
- func (r *Registry) ClearResumeOnOpen(ctx context.Context, id brand.WorkspaceID) (uint64, error)
- func (r *Registry) Create(ctx context.Context, root string) (brand.WorkspaceID, uint64, error)
- func (r *Registry) Get(ctx context.Context, id brand.WorkspaceID) (Workspace, uint64, error)
- func (r *Registry) List(ctx context.Context) ([]Workspace, error)
- func (r *Registry) SetResumeOnOpen(ctx context.Context, id brand.WorkspaceID, sid brand.SessionID) (uint64, error)
- func (r *Registry) SetSessionGroup(ctx context.Context, id brand.WorkspaceID, group string) (uint64, error)
- type Workspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbbreviateHome ¶
AbbreviateHome replaces home prefixes with ~; paths outside home are unchanged.
func ResolvePath ¶
ResolvePath joins relative paths to root; absolute paths and paths with an empty root are unchanged. POSIX, Windows drive, and UNC absolute forms are recognized.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry uses storage.Domain; its backend provides concurrency safety.
func (*Registry) ClearResumeOnOpen ¶
ClearResumeOnOpen clears the default resumed session.
func (*Registry) Create ¶
Create registers or reuses a workspace, returning the same ID for the same root along with its CAS version and whether it was newly created.
func (*Registry) SetResumeOnOpen ¶
func (r *Registry) SetResumeOnOpen(ctx context.Context, id brand.WorkspaceID, sid brand.SessionID) (uint64, error)
SetResumeOnOpen records the session opened by default for this workspace.
func (*Registry) SetSessionGroup ¶
func (r *Registry) SetSessionGroup(ctx context.Context, id brand.WorkspaceID, group string) (uint64, error)
SetSessionGroup replaces the current session group.
type Workspace ¶
type Workspace struct {
ID brand.WorkspaceID `json:"id"`
Root string `json:"root"` // Normalized absolute path.
SessionGroup string `json:"sessionGroup,omitempty"` // Optional session-group identifier.
ResumeOnOpen *brand.SessionID `json:"resumeOnOpen,omitempty"` // Session to open by default next time; nil disables resumption.
}
Workspace records workspace information.