Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.workspace

Backend-neutral workspaces, DB-pinned to session_state 1:1.

The user's real cwd is trunk — Vis never mutates it, and Vis no longer requires it to be a git repo. A session works in trunk by default; /draft new opts into an isolated workspace supplied by a registered backend. Backends declare concrete capabilities such as isolated fork, rollback, merge-back, retained revisions, and parallel safety. Core never assumes which implementation provides them.

'What changed since the fork' is computed git-free: clonefile preserves source mtimes, so files the agent touches in the clone get a fresh mtime greater than the fork timestamp we capture at clone time. apply! lands exactly those files back into cwd, uncommitted, and leaves the user to commit with their own tools — Vis owns no git/branch/commit/merge lifecycle whatsoever.

Vis never mutates JVM user.dir. Channels rebind workspace-root per turn from the active workspace; tools resolve paths via (workspace/cwd). There is NO process-cwd fallback in production - the env carries :workspace/root from create-environment onward.

Backend-neutral workspaces, DB-pinned to session_state 1:1.

The user's real cwd is *trunk* — Vis never mutates it, and Vis no
longer requires it to be a git repo. A session works in trunk by
default; `/draft new` opts into an isolated workspace supplied by a
registered backend. Backends declare concrete capabilities such as
isolated fork, rollback, merge-back, retained revisions, and parallel
safety. Core never assumes which implementation provides them.

'What changed since the fork' is computed git-free: `clonefile`
preserves source mtimes, so files the agent touches in the clone get
a fresh mtime greater than the fork timestamp we capture at clone
time. `apply!` lands exactly those files back into cwd, uncommitted,
and leaves the user to commit with their own tools — Vis owns no
git/branch/commit/merge lifecycle whatsoever.

Vis never mutates JVM user.dir. Channels rebind *workspace-root* per
turn from the active workspace; tools resolve paths via
(workspace/cwd). There is NO process-cwd fallback in production -
the env carries `:workspace/root` from `create-environment` onward.
raw docstring

*drafts-home*clj

Parent dir for every trunk's draft store. nil (production default) resolves to the vis.drafts.dir system property, else ~/.vis/drafts. Tests point it at a throwaway dir (the :test alias sets -Dvis.drafts.dir=target/vis-drafts-test) so the suite never litters the real ~/.vis.

Parent dir for every trunk's draft store. `nil` (production default)
resolves to the `vis.drafts.dir` system property, else
`~/.vis/drafts`. Tests point it at a throwaway dir (the `:test` alias
sets `-Dvis.drafts.dir=target/vis-drafts-test`) so the suite never
litters the real ~/.vis.
sourceraw docstring

*filesystem-roots*clj

Extra filesystem roots the current tool call may ALSO operate under, beyond the primary *workspace-root*, as [{:trunk :clone}] canonical pairs: :trunk is the REAL directory the user added (what the model addresses), :clone is the backend working copy edits land in (== :trunk when live). Bound per-turn by the channel layer from the session's persisted filesystem roots. Empty in the common single-root case. The editing layer confines to the clones and transparently remaps trunk↔clone (see filesystem-root-mappings).

Extra filesystem roots the current tool call may ALSO operate under, beyond the
primary `*workspace-root*`, as `[{:trunk :clone}]` canonical pairs: `:trunk`
is the REAL directory the user added (what the model addresses), `:clone` is
the backend working copy edits land in (== `:trunk` when live). Bound
per-turn by the channel layer from the session's persisted filesystem roots.
Empty in the common single-root case. The editing layer confines to the
clones and transparently remaps trunk↔clone (see `filesystem-root-mappings`).
sourceraw docstring

*workspace-root*clj

Canonical workspace root for the current tool call. Bound per-turn by the channel layer; never nil in normal operation.

Canonical workspace root for the current tool call. Bound per-turn
by the channel layer; never `nil` in normal operation.
sourceraw docstring

abandon!clj

(abandon! db-info {:keys [workspace-id reason]})

Transition the row to :discarded and release backend-owned roots. The DB transition is synchronous (the caller returns to trunk at once); physical clone reclamation runs on a background thread and is exposed as :discard-future for callers/tests that need to await it. A :live backend (trunk) owns no clone, so its shared root is never deleted.

Transition the row to :discarded and release backend-owned roots. The DB
transition is synchronous (the caller returns to trunk at once); physical
clone reclamation runs on a background thread and is exposed as
`:discard-future` for callers/tests that need to await it. A `:live` backend
(trunk) owns no clone, so its shared root is never deleted.
sourceraw docstring

abandon-lineage!clj

(abandon-lineage! db-info {:keys [workspace-id reason]})

Discard workspace-id and each draft ancestor up to (but never including) trunk. Used when an operator applies or abandons the session draft. A plain draft's parent is its trunk, so this normally abandons the single draft.

Discard `workspace-id` and each draft ancestor up to (but never including)
trunk. Used when an operator applies or abandons the session draft. A plain
draft's parent is its trunk, so this normally abandons the single draft.
sourceraw docstring

add-filesystem-root!clj

(add-filesystem-root! db-info workspace-id path)

Add path to the workspace's extra filesystem roots. Drafts require the same isolation capabilities for every added root; live workspaces add it live.

Add `path` to the workspace's extra filesystem roots. Drafts require the same
isolation capabilities for every added root; live workspaces add it live.
sourceraw docstring

allowed-rootsclj

(allowed-roots)

Canonical absolute CLONE/working-copy paths the current tool call may operate under: the primary cwd FIRST, then each bound filesystem root's :clone. Deduped; the primary is always present. The confinement set the editing layer's safe-path checks the (possibly remapped) target against.

Canonical absolute CLONE/working-copy paths the current tool call may
operate under: the primary cwd FIRST, then each bound filesystem root's
`:clone`. Deduped; the primary is always present. The confinement set the
editing layer's `safe-path` checks the (possibly remapped) target against.
sourceraw docstring

apply!clj

(apply! db-info {:keys [workspace-id]})

Land the draft's since-fork edits into the user's real dirs (trunk), leaving them uncommitted for the user to review/commit. A draft is about the WHOLE workspace: this lands the primary clone AND every auto-cloned filesystem root (each into its own trunk). Vis owns no git lifecycle. Adds/modifications come from the mtime diff; deletions are files that existed at the fork but the agent removed in the draft. Returns {:status :ok :changed [{:status :path :root}] :landed n :workspace ws}.

Land the draft's since-fork edits into the user's real dirs (trunk),
leaving them uncommitted for the user to review/commit. A draft is about
the WHOLE workspace: this lands the primary clone AND every auto-cloned
filesystem root (each into its own trunk). Vis owns no git lifecycle.
Adds/modifications come from the mtime diff; deletions are files that
existed at the fork but the agent removed in the draft. Returns
`{:status :ok :changed [{:status :path :root}] :landed n :workspace ws}`.
sourceraw docstring

capability-matrixclj

(capability-matrix source-root)
(capability-matrix source-root store-root)

Describe every registered backend for source-root, including availability and declared capabilities. This is the public feature-discovery surface. It never loads extensions: extension discovery owns backend registration.

Describe every registered backend for `source-root`, including availability
and declared capabilities. This is the public feature-discovery surface.
It never loads extensions: extension discovery owns backend registration.
sourceraw docstring

change-root!clj

(change-root! db-info session-state-id path)

Repoint session-state-id's PRIMARY filesystem root to path — the session now works in a different project directory: shell cwd, relative path resolution, file tools (cat/patch/write), and search (grep) all follow from the next turn, because they resolve through the session's pinned workspace. Additional filesystem roots CARRY OVER (they are session-scoped permissions, not root-relative); an entry equal to the new root is dropped as redundant. Refuses while the session is in a draft — a draft is a fork of the OLD root, so apply/abandon it first. Returns the newly pinned trunk workspace (or the current one when path already IS the root).

Repoint `session-state-id`'s PRIMARY filesystem root to `path` — the
session now works in a different project directory: shell cwd, relative
path resolution, file tools (cat/patch/write), and search (grep)
all follow from the next turn, because they resolve through the session's
pinned workspace. Additional filesystem roots CARRY OVER (they are
session-scoped permissions, not root-relative); an entry equal to the new
root is dropped as redundant. Refuses while the session is in a draft —
a draft is a fork of the OLD root, so apply/abandon it first. Returns the
newly pinned trunk workspace (or the current one when `path` already IS
the root).
sourceraw docstring

changed-pathsclj

(changed-paths clone fork-ms)

Repo-relative paths of files under clone whose mtime is newer than fork-ms — i.e. exactly what the agent touched since the fork (clonefile preserves source mtimes, so untouched files stay older). Prunes VCS/build/cache dirs (prune-dir?) — landing .git/ would corrupt trunk's repo, and tool caches would flood the result. Returns a vec of strings.

Repo-relative paths of files under `clone` whose mtime is newer than
`fork-ms` — i.e. exactly what the agent touched since the fork
(`clonefile` preserves source mtimes, so untouched files stay older).
Prunes VCS/build/cache dirs (`prune-dir?`) — landing `.git/` would corrupt
trunk's repo, and tool caches would flood the result. Returns a vec
of strings.
sourceraw docstring

create!clj

(create! db-info
         {:keys [session-state-id label from required-capabilities blank?]})

Create an isolated DRAFT using the strongest available backend and pin it to :session-state-id. The backend must provide the full draft capability set; core never silently falls back to a shared root.

The fork PARENT is chosen so apply! lands back where it forked from: pass :from <parent-workspace> to clone that workspace's :root and inherit its :repo-root (apply target); otherwise the parent is the user's real cwd (trunk).

:fresh? true forks from an EMPTY seed instead: the draft starts with NONE of the files currently in trunk (HEAD). Its baseline :fork-ms is 0, so every file created inside the draft counts as a since-fork edit and lands on apply!, while deleted-paths (trunk files OLDER than the baseline yet absent from the clone) can never match — a fresh draft only ever ADDS/OVERWRITES into trunk, it cannot infer deletions of files it never saw. The ZERO baseline is HEREDITARY: a draft forked :from a fresh-lineage workspace (a sub-loop child, a revision) keeps baseline 0 too — its clone still lacks the trunk files the lineage never saw, so applying it with a real fork timestamp would mass-report trunk's files as deletions and wipe the repo.

Create an isolated DRAFT using the strongest available backend and pin it
to `:session-state-id`. The backend must provide the full draft capability
set; core never silently falls back to a shared root.

The fork PARENT is chosen so `apply!` lands back where it forked from:
pass `:from <parent-workspace>` to clone that workspace's `:root` and
inherit its `:repo-root` (apply target); otherwise the parent is the
user's real cwd (trunk).

`:fresh? true` forks from an EMPTY seed instead: the draft starts with
NONE of the files currently in trunk (HEAD). Its baseline `:fork-ms` is 0,
so every file created inside the draft counts as a since-fork edit and
lands on `apply!`, while `deleted-paths` (trunk files OLDER than the
baseline yet absent from the clone) can never match — a fresh draft only
ever ADDS/OVERWRITES into trunk, it cannot infer deletions of files it
never saw. The ZERO baseline is HEREDITARY: a draft forked `:from` a
fresh-lineage workspace (a sub-loop child, a revision) keeps baseline 0
too — its clone still lacks the trunk files the lineage never saw, so
applying it with a real fork timestamp would mass-report trunk's files
as deletions and wipe the repo.
sourceraw docstring

create-dir!clj

(create-dir! parent name)

Create a single child directory name under existing directory parent. Returns the canonical path of the (possibly already-existing) child. Throws when parent is not a directory or name is not a single safe path segment. name may not contain a separator, be blank, or be ./...

Create a single child directory `name` under existing directory `parent`.
Returns the canonical path of the (possibly already-existing) child. Throws
when `parent` is not a directory or `name` is not a single safe path segment.
`name` may not contain a separator, be blank, or be `.`/`..`.
sourceraw docstring

create-trunk-at!clj

(create-trunk-at! db-info root)

Mint a TRUNK workspace rooted at root (an arbitrary directory), not pinned to any session. Lets a channel open a session under a directory OTHER than the one vis was launched from — a tab in another project. Returns the workspace row (with :id) to pass as :workspace-id when creating the session.

Mint a TRUNK workspace rooted at `root` (an arbitrary directory), not
pinned to any session. Lets a channel open a session under a directory
OTHER than the one vis was launched from — a tab in another project.
Returns the workspace row (with `:id`) to pass as `:workspace-id` when
creating the session.
sourceraw docstring

cwdclj

(cwd)

Resolve the current workspace cwd. In production the channel wrapper binds *workspace-root* per turn, so the process-cwd fallback only fires from REPL / test / one-off CLI paths that have no session context.

Resolve the current workspace cwd. In production the channel
wrapper binds `*workspace-root*` per turn, so the process-cwd
fallback only fires from REPL / test / one-off CLI paths that have
no session context.
sourceraw docstring

deleted-pathsclj

(deleted-paths clone trunk fork-ms)

Repo-relative paths the agent DELETED in the draft: present under trunk (pruning VCS/build/cache dirs via prune-dir?) with an mtime older than fork-ms — so they existed at the fork and are not user post-fork additions — yet absent from clone. The mtime guard means apply! never reverts a file the user added to cwd after forking, and the prune keeps cache churn (e.g. .clj-kondo/.cache rewritten in the clone) from being reported as spurious deletions.

A non-positive fork-ms is the FRESH-lineage baseline: the clone never saw trunk's files, so a deletion is semantically impossible — return [] unconditionally, whatever the trees contain. The hard exit (rather than relying on the < comparison alone) also keeps pathological trunk mtimes (epoch/pre-epoch, e.g. unpacked from a tarball) from ever comparing below the baseline into a real .delete of the user's files.

Repo-relative paths the agent DELETED in the draft: present under
`trunk` (pruning VCS/build/cache dirs via `prune-dir?`) with an mtime
older than `fork-ms` — so they existed at the fork and are not user
post-fork additions — yet absent from `clone`. The mtime guard means
`apply!` never reverts a file the user added to cwd after forking, and
the prune keeps cache churn (e.g. `.clj-kondo/.cache` rewritten in the
clone) from being reported as spurious deletions.

A non-positive `fork-ms` is the FRESH-lineage baseline: the clone never
saw trunk's files, so a deletion is semantically impossible — return []
unconditionally, whatever the trees contain. The hard exit (rather than
relying on the `<` comparison alone) also keeps pathological trunk
mtimes (epoch/pre-epoch, e.g. unpacked from a tarball) from ever
comparing below the baseline into a real `.delete` of the user's files.
sourceraw docstring

deregister-backend!clj

(deregister-backend! backend-id)
source

discard-session-clones!clj

(discard-session-clones! db-info session-soul-id)

On session DELETE, walk the complete revision lineage, gather every backend-owned clone, then release them off the request thread through the shared discard executor — the SAME path abandon! uses, so no gateway thread ever blocks on file deletion. Row resolution is synchronous, so the returned root list is fully materialized before the caller deletes the DB tree. Live (trunk) roots are never touched. Returns a Future callers can await — the CLI derefs it before process exit; the long-lived gateway fires and forgets.

On session DELETE, walk the complete revision lineage, gather every
backend-owned clone, then release them off the request thread through the
shared discard executor — the SAME path `abandon!` uses, so no gateway thread
ever blocks on file deletion. Row resolution is synchronous, so the returned
root list is fully materialized before the caller deletes the DB tree. Live
(trunk) roots are never touched. Returns a Future callers can await — the CLI
derefs it before process exit; the long-lived gateway fires and forgets.
sourceraw docstring

display-labelclj

(display-label workspace)
(display-label db-info workspace session)

Human-facing label for workspace. Order: explicit :label → pinned session title → clone name (:branch) → id prefix.

Human-facing label for `workspace`. Order: explicit `:label` →
pinned session title → clone name (`:branch`) → id prefix.
sourceraw docstring

draft?clj

(draft? ws)

True when a workspace carries an apply baseline and therefore represents isolated filesystem state rather than a logical-only graph revision.

True when a workspace carries an apply baseline and therefore represents
isolated filesystem state rather than a logical-only graph revision.
sourceraw docstring

drafts-store-pathclj

(drafts-store-path)

Canonical path of the drafts-store parent (~/.vis/drafts by default, or the vis.drafts.dir override / *drafts-home* test binding). The DEFAULT search sweep prunes the raw ~/.vis grant tree but KEEPS real draft clones, which live under this dir — so /fs add roots auto-cloned into a draft stay searchable. nil when unresolvable.

Canonical path of the drafts-store parent (`~/.vis/drafts` by default, or the
`vis.drafts.dir` override / `*drafts-home*` test binding). The DEFAULT search
sweep prunes the raw `~/.vis` grant tree but KEEPS real draft clones, which
live under this dir — so `/fs add` roots auto-cloned into a draft stay
searchable. nil when unresolvable.
sourceraw docstring

ensure-workspace!clj

(ensure-workspace! db-info {:keys [session-state-id]})

Find-or-create the session's workspace. The DEFAULT is TRUNK — the user's real cwd (no clone); the agent works directly in the repo until /draft new. Resume returns whatever the session was pinned to (trunk, or an open draft). Idempotent per session-state.

Find-or-create the session's workspace. The DEFAULT is TRUNK — the
user's real cwd (no clone); the agent works directly in the repo
until `/draft new`. Resume returns whatever the session was pinned to
(trunk, or an open draft). Idempotent per session-state.
sourceraw docstring

env-filesystem-rootsclj

(env-filesystem-roots env-or-roots)

Canonical [{:trunk :clone}] pairs available to the current tool call. Includes the workspace's live extra roots plus immutable read/write roots from the environment security snapshot. Configured roots map to themselves (no draft clone); the process jail and GraalPy consume the same resolved paths.

Canonical `[{:trunk :clone}]` pairs available to the current tool call.
Includes the workspace's live extra roots plus immutable read/write roots from
the environment security snapshot. Configured roots map to themselves (no
draft clone); the process jail and GraalPy consume the same resolved paths.
sourceraw docstring

exit-to-trunk!clj

(exit-to-trunk! db-info session-state-id)
(exit-to-trunk! db-info session-state-id root)

Repoint session-state-id back to a TRUNK workspace (the real cwd), leaving any draft. Returns the trunk workspace now pinned. The three-argument arity preserves an explicit repo root when the session was opened away from the process launch directory.

Repoint `session-state-id` back to a TRUNK workspace (the real cwd),
leaving any draft. Returns the trunk workspace now pinned. The three-argument
arity preserves an explicit repo root when the session was opened away from
the process launch directory.
sourceraw docstring

filesystem-root-mappingsclj

(filesystem-root-mappings)

The bound filesystem roots as canonical [{:trunk :clone}] pairs — the trunk↔clone remap table the editing layer uses so the model can address a context file by its REAL (trunk) path while edits land in the :clone. Empty in the single-root case. Does NOT include the primary (relative paths resolve under cwd directly).

The bound filesystem roots as canonical `[{:trunk :clone}]` pairs — the
trunk↔clone remap table the editing layer uses so the model can address a
context file by its REAL (trunk) path while edits land in the `:clone`.
Empty in the single-root case. Does NOT include the primary (relative paths
resolve under cwd directly).
sourceraw docstring

filesystem-rootsclj

(filesystem-roots ws)

Extra filesystem roots configured for ws, normalized to [{:trunk :clone :fork-ms :backend}].

Extra filesystem roots configured for `ws`, normalized to
`[{:trunk :clone :fork-ms :backend}]`.
sourceraw docstring

focus!clj

(focus! db-info workspace-id)

Stamp last_focused_at_ms and upsert the per-repo repo_focus pointer. Returns the updated workspace record.

Stamp `last_focused_at_ms` and upsert the per-repo `repo_focus`
pointer. Returns the updated workspace record.
sourceraw docstring

for-sessionclj

(for-session db-info session-state-id)

Workspace pinned to session-state-id, or nil.

Workspace pinned to `session-state-id`, or nil.
sourceraw docstring

getclj

(get db-info workspace-id)

Return the workspace with workspace-id, or nil.

Return the workspace with `workspace-id`, or nil.
sourceraw docstring

isolated-workspaces-supported?clj

(isolated-workspaces-supported?)
(isolated-workspaces-supported? root)

True when the current root can create full draft workspaces.

True when the current root can create full draft workspaces.
sourceraw docstring

last-focusedclj

(last-focused db-info repo-id)

Workspace id from repo_focus for repo-id, or nil.

Workspace id from `repo_focus` for `repo-id`, or nil.
sourceraw docstring

list-activeclj

(list-active db-info repo-id)

Active workspaces for repo-id, newest first.

Active workspaces for `repo-id`, newest first.
sourceraw docstring

list-active-with-sessionsclj

(list-active-with-sessions db-info repo-id)

Like list-active but each entry is the {:workspace :session-state} pair, sorted by last_focused_at_ms DESC NULLS LAST, then created_at DESC.

Like `list-active` but each entry is the `{:workspace :session-state}`
pair, sorted by `last_focused_at_ms` DESC NULLS LAST, then
`created_at` DESC.
sourceraw docstring

list-draftsclj

(list-drafts db-info repo-id)

Active DRAFTS for repo-id, newest first — the parked/stashable drafts a session can resume!. Trunk workspaces are filtered out. A draft that a session leaves via stash! stays :active and keeps appearing here until it is applied or abandoned.

Active DRAFTS for `repo-id`, newest first — the parked/stashable drafts a
session can `resume!`. Trunk workspaces are filtered out. A draft that a
session leaves via `stash!` stays `:active` and keeps appearing here until it
is applied or abandoned.
sourceraw docstring

list-finishedclj

(list-finished db-info repo-id)

Discarded workspaces for repo-id, newest first.

Discarded workspaces for `repo-id`, newest first.
sourceraw docstring

no-search-rootsclj

(no-search-roots)

Canonical CLONE paths of bound filesystem roots flagged search: false in the workspace catalog. resolve-search-roots prunes these from the DEFAULT grep sweep; explicit paths still reach them.

Canonical CLONE paths of bound filesystem roots flagged `search: false` in
the workspace catalog. `resolve-search-roots` prunes these from the DEFAULT
grep sweep; explicit paths still reach them.
sourceraw docstring

normalize-rootclj

(normalize-root root)

Canonicalize a workspace root string/File. Blank/nil → nil.

Canonicalize a workspace root string/File. Blank/nil → nil.
sourceraw docstring

public-filesystem-rootclj

(public-filesystem-root {:keys [trunk clone]} expose-draft?)

PUBLIC wire shape for ONE filesystem root — the single element interface EVERY surface reads (channels AND the model ctx), so no consumer reaches for a producer-private key again. :dir is the REAL directory the session operates on (its stable identity — was the internal :trunk); :isolated is true when edits land in a hidden draft copy instead of :dir directly. With expose-draft? the map also carries :draft-dir — the working-copy path git/status must point at (channels need it; the model ctx OMITS it: the model must always address the real :dir, never the hidden clone). Takes an internal root-entry {:trunk :clone …} (see filesystem-roots).

PUBLIC wire shape for ONE filesystem root — the single element interface
EVERY surface reads (channels AND the model ctx), so no consumer reaches for
a producer-private key again. `:dir` is the REAL directory the session
operates on (its stable identity — was the internal `:trunk`); `:isolated`
is true when edits land in a hidden draft copy instead of `:dir` directly.
With `expose-draft?` the map also carries `:draft-dir` — the working-copy
path git/status must point at (channels need it; the model ctx OMITS it: the
model must always address the real `:dir`, never the hidden clone). Takes an
internal root-entry `{:trunk :clone …}` (see `filesystem-roots`).
sourceraw docstring

register-backend!clj

(register-backend! backend)

Register a workspace backend. Idempotent by backend id.

Register a workspace backend. Idempotent by backend id.
sourceraw docstring

register-hook!clj

(register-hook! hook-id hook-fn)

Register hook-fn for hook-id ∈ {:on-spawn :on-apply :on-discard}. Synchronous; exceptions swallowed.

Register `hook-fn` for `hook-id` ∈ {:on-spawn :on-apply :on-discard}.
Synchronous; exceptions swallowed.
sourceraw docstring

registered-backendsclj

(registered-backends)

Registered workspace backends ordered by descending priority.

Registered workspace backends ordered by descending priority.
sourceraw docstring

remove-filesystem-root!clj

(remove-filesystem-root! db-info workspace-id path)

Remove path from the workspace's extra filesystem roots and release any backend-owned isolated root.

Remove `path` from the workspace's extra filesystem roots and release any
backend-owned isolated root.
sourceraw docstring

resume!clj

(resume! db-info {:keys [session-state-id workspace-id]})

Re-enter a previously stashed DRAFT: pin session-state-id to workspace-id, which MUST be an :active draft from the session's current repo and not currently pinned to another session. The session must already have left any draft (be on trunk) — a stash/apply/abandon precedes a resume. Returns the draft workspace now pinned. Throws ex-info with a :type on any precondition failure.

Re-enter a previously stashed DRAFT: pin `session-state-id` to `workspace-id`,
which MUST be an `:active` draft from the session's current repo and not
currently pinned to another session. The session must already have left any
draft (be on trunk) — a stash/apply/abandon precedes a resume. Returns the
draft workspace now pinned. Throws `ex-info` with a `:type` on any precondition
failure.
sourceraw docstring

select-backendclj

(select-backend source-root store-root required)

Select the highest-priority available backend covering required. Returns nil when no backend can provide the requested semantics.

Select the highest-priority available backend covering `required`.
Returns nil when no backend can provide the requested semantics.
sourceraw docstring

set-label!clj

(set-label! db-info {:keys [workspace-id label]})

Set the workspace's human-friendly :label. Empty/nil clears it.

Set the workspace's human-friendly `:label`. Empty/nil clears it.
sourceraw docstring

stash!clj

(stash! db-info session-state-id)

Park the session's current draft: repoint session-state-id back to trunk while LEAVING the draft row :active and its clone on disk intact, so it can be resumed later. This is the non-destructive twin of abandon! — nothing is discarded. Returns {:draft <stashed-draft-or-nil> :trunk <trunk-ws>}; on trunk :draft is nil and this just ensures a trunk pin. The draft's own :repo-root is preserved for sessions opened away from the launch directory.

Park the session's current draft: repoint `session-state-id` back to trunk
while LEAVING the draft row `:active` and its clone on disk intact, so it can
be resumed later. This is the non-destructive twin of `abandon!` — nothing is
discarded. Returns `{:draft <stashed-draft-or-nil> :trunk <trunk-ws>}`; on
trunk `:draft` is nil and this just ensures a trunk pin. The draft's own
`:repo-root` is preserved for sessions opened away from the launch directory.
sourceraw docstring

statusclj

(status db-info workspace-id)

Enrich a workspace record with live status. Stamps :workspace/root, :workspace/sandbox?, :workspace/exists?, :workspace/changed (count of since-fork edits) and :workspace/dirty?. No git.

Enrich a workspace record with live status. Stamps
`:workspace/root`, `:workspace/sandbox?`, `:workspace/exists?`, `:workspace/changed`
(count of since-fork edits) and `:workspace/dirty?`. No git.
sourceraw docstring

subdirsclj

(subdirs path)

Child directory names (non-hidden) of path, case-insensitively sorted. Empty vec when path is blank, not a directory, or unreadable.

Child directory names (non-hidden) of `path`, case-insensitively sorted.
Empty vec when `path` is blank, not a directory, or unreadable.
sourceraw docstring

supports?clj

(supports? source-root required)
(supports? source-root store-root required)

True when some backend can provide required for the given roots.

True when some backend can provide `required` for the given roots.
sourceraw docstring

trunk-infoclj

(trunk-info)
(trunk-info root)

The user's real cwd (trunk). No git read; just the launch dir.

The user's real cwd (trunk). No git read; just the launch dir.
sourceraw docstring

trunk-rootclj

(trunk-root)

The user's real working directory — where they launched vis. Canonical absolute path. This is trunk: never mutated, never required to be a git repo. (bin/vis preserves the invocation cwd as JVM user.dir even though it cd's to the repo for deps.)

The user's real working directory — where they launched `vis`.
Canonical absolute path. This is *trunk*: never mutated, never
required to be a git repo. (`bin/vis` preserves the invocation cwd
as JVM user.dir even though it cd's to the repo for deps.)
sourceraw docstring

workspace-backendclj

(workspace-backend backend)

Validate and return a workspace backend descriptor.

Required keys: :workspace.backend/id keyword :workspace.backend/capabilities capability set :workspace.backend/available-fn ({:source-root :store-root} -> bool or {:available? bool :reason keyword :details map}) :workspace.backend/fork-fn ({:source-root :store-root :name} -> path) :workspace.backend/discard-fn ({:root} -> nil)

Validate and return a workspace backend descriptor.

Required keys:
  :workspace.backend/id            keyword
  :workspace.backend/capabilities  capability set
  :workspace.backend/available-fn  ({:source-root :store-root} -> bool or
                                   {:available? bool :reason keyword :details map})
  :workspace.backend/fork-fn       ({:source-root :store-root :name} -> path)
  :workspace.backend/discard-fn    ({:root} -> nil)
sourceraw docstring

workspace-capabilitiesclj

Closed capability vocabulary for workspace backends.

Closed capability vocabulary for workspace backends.
sourceraw docstring

workspace-capability-matrixclj

(workspace-capability-matrix workspace-or-root)

Capability matrix for a workspace (or root path), using the real derived workspace storage location rather than assuming source and destination are on the same filesystem.

Capability matrix for a workspace (or root path), using the real derived
workspace storage location rather than assuming source and destination are
on the same filesystem.
sourceraw docstring

workspace-rootclj

(workspace-root env-or-root)

Extract a canonical :workspace/root from an env map or raw root value.

Extract a canonical :workspace/root from an env map or raw root value.
sourceraw docstring

workspace-with-sessionclj

(workspace-with-session db-info workspace-id)

Hydrate workspace-id with its pinned session_state. Returns {:workspace <ws> :session-state <ss>}.

Hydrate `workspace-id` with its pinned `session_state`. Returns
`{:workspace <ws> :session-state <ss>}`.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close