workspace

package
v0.11.13 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package workspace manages on-disk workspace entries at `<BaseDir>/workspaces/<name>/` (managed) or any user-supplied absolute path (custom).

A workspace is a plain folder used as the cwd for agent subprocesses. It is intentionally git-agnostic — wick does not clone, init, or branch. Whatever the agent (or user) puts in the folder is the workspace's contents. Multiple sessions may share the same workspace and run in parallel; coordination is the caller's concern.

See agents-design.md §0.2 for the refactor that introduced this package (replacing the project-centric model).

Index

Constants

View Source
const DefaultName = "default"

DefaultName is the name of the built-in workspace that ships with every fresh install. It is created by EnsureDefault at boot and cannot be deleted.

Variables

This section is empty.

Functions

func Delete

func Delete(layout config.Layout, name string) error

Delete removes the workspace metadata folder. For managed workspaces this also removes `workspaces/<name>/files/`. For custom workspaces the user-supplied path is left untouched — wick never owned it, so wick must not delete it. The built-in "default" workspace cannot be deleted.

func EnsureDefault

func EnsureDefault(layout config.Layout) error

EnsureDefault creates the "default" workspace if it does not yet exist. Mirrors preset.EnsureDefault — called from Bootstrap so fresh installs have a usable workspace without any manual setup.

func Exists

func Exists(layout config.Layout, name string) bool

Exists reports whether a workspace with the given name has been created.

func List

func List(layout config.Layout) ([]string, error)

List returns every workspace name, sorted.

func ResolvePath

func ResolvePath(layout config.Layout, name string) (string, error)

ResolvePath returns the cwd for agent subprocesses bound to the named workspace. Custom paths win over the managed default.

The returned path is guaranteed to be absolute. It is NOT created here — callers (the pool) must MkdirAll managed paths before passing them to exec.Cmd.Dir. Custom paths are validated at Create time and assumed to still exist; if the user deleted them out from under wick, spawn will surface a clean error.

func SaveMeta

func SaveMeta(layout config.Layout, name string, meta Meta) error

SaveMeta atomically rewrites workspaces/<name>/meta.json.

Types

type CreateOptions

type CreateOptions struct {
	Name            string
	CustomPath      string
	DefaultPreset   string
	DefaultProvider string
	Description     string
	Tags            []string
}

CreateOptions describes a new workspace.

CustomPath, when non-empty, must be an absolute path to an existing directory. The directory is not modified; wick only records a pointer to it. Leave empty to use the managed location.

type Meta

type Meta struct {
	CustomPath      string    `json:"custom_path,omitempty"`
	DefaultPreset   string    `json:"default_preset"`
	DefaultProvider string    `json:"default_provider,omitempty"`
	Description     string    `json:"description,omitempty"`
	Tags            []string  `json:"tags,omitempty"`
	CreatedAt       time.Time `json:"created_at"`
}

Meta is the persisted-on-disk shape of a workspace.

CustomPath is the absolute path supplied by the user when they wanted to point at an existing folder on disk. Empty means managed (resolved via Layout.WorkspaceManagedPath).

type Workspace

type Workspace struct {
	Name string `json:"name"`
	Meta Meta   `json:"meta"`
}

Workspace is the in-memory view returned by the registry: name (= folder under workspaces/) + persisted meta.

func Create

func Create(layout config.Layout, opt CreateOptions) (Workspace, error)

Create materializes the on-disk workspace entry: the metadata folder under `workspaces/<name>/` and, if managed, the empty content folder under `workspaces/<name>/files/`.

Custom paths are not auto-created — the user is expected to point at a folder that already exists. Refusing missing custom paths surfaces typos at create time rather than at first spawn.

func Load

func Load(layout config.Layout, name string) (Workspace, error)

Load reads workspaces/<name>/meta.json.

Jump to

Keyboard shortcuts

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