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
- func Delete(layout config.Layout, name string) error
- func EnsureDefault(layout config.Layout) error
- func Exists(layout config.Layout, name string) bool
- func List(layout config.Layout) ([]string, error)
- func ResolvePath(layout config.Layout, name string) (string, error)
- func SaveMeta(layout config.Layout, name string, meta Meta) error
- type CreateOptions
- type Meta
- type Workspace
Constants ¶
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 ¶
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 ¶
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 ResolvePath ¶
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.
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 ¶
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.