Skip to main content

Module workspace

Module workspace 

Source
Expand description

Workspace mode — two variants.

Github mode (Workspace::open, the default when --workspace DIR is set): the agent activates a GitHub repo via repo_management('org/repo'), the binary clones it into the workspace, and the active repo becomes the bound source root for read_source / grep / list_source. Idle repos auto-sweep after --stale-after-days. Layout: workspace/ repos/// — cloned source inventory.json — per-repo access tracking

Local mode (Workspace::open_local, the manifest-driven workspace: { kind: local, root: ... } variant): the active source root is a fixed local directory, not a clone target. repo_management reports the active root and triggers rebuilds; an set_root_dir tool can swap the root at runtime. Closes the code_review_mcp_server use case from the kglite wishlist.

Both modes fire the same PostActivateHook so downstream binaries (kglite-mcp-server) layer their build step on top with one registration point, and both honour the same last_built_sha gating to skip pointless rebuilds.

Re-exports§

pub use crate::server::manifest::WorkspaceKind;

Structs§

Workspace
Workspace runtime state. Shared across MCP request clones via Arc.

Enums§

RevsRequest
A revisions request carried by the activation tools. Count(n) resolves to the newest n stable release tags of the repo’s dominant tag family (plus HEAD); List(revs) is an explicit set of git revspecs used verbatim. The untagged deserialization maps a JSON integer to Count and a JSON array of strings to List, so the tool arg accepts int | [str]. Resolution happens at activate time — see Workspace::resolve_revs.

Type Aliases§

ActivationSummaryHook
Optional hook that returns a short agent-facing summary appended to the activation result message — the “graph ready” mini-map / opening steer (e.g. "Graph ready: 9,999 Functions · 656 Classes · 31k CALLS. Open with graph_overview() → cypher_query; grep = literal text only.").
PostActivateHook
Hook fired after a successful clone or update. Receives the absolute path to the cloned repo and the org/repo name. Errors are logged but don’t abort the activation — the repo is still registered as active.
PostActivateRevsHook
Hook fired after a successful clone/update when revisions were requested on the activation call (repo_management(revs=…) / set_root_dir(revs=…)). Receives the repo path, the org/repo (or synthetic local) name, and the resolved revspecs in oldest→newest order — for a Count(n) request the final entry is always HEAD, so a downstream multi-rev builder can merge oldest→newest with HEAD’s signature winning. Set via Workspace::with_post_activate_revs.