Expand description
Session persistence for devshell.
- Workspace session (preferred):
ENV_DEVSHELL_WORKSPACE_ROOT— metadata at$DEVSHELL_WORKSPACE_ROOT/.cargo-devshell/session.json(seedocs/requirements.md§1.1). On Unix,crate::devshell::vm::export_devshell_workspace_root_envsets this before REPL. - Mode S: legacy
.dev_shell.binviacrate::devshell::serializationwhen applicable. - Mode P (guest-primary): no legacy bin on exit; JSON holds
logical_cwdonly. - Fallback (no
DEVSHELL_WORKSPACE_ROOT):./.cargo-devshell/session.jsonunderstd::env::current_dirwhen it succeeds (local dev / tests). - Legacy (migration only):
{stem}.session.jsonbeside the bin path (e.g..dev_shell.bin→.dev_shell.session.json); still read on load, no longer preferred for new saves. - Load order: workspace env path → cwd workspace path → legacy beside
bin_path.
Structs§
- Guest
Primary Session V1 - Serialize / deserialize guest-primary session file under
ENV_DEVSHELL_WORKSPACE_ROOT.
Constants§
- ENV_
DEVSHELL_ WORKSPACE_ ROOT - Environment variable: host directory aligned with guest workspace (Lima γ).
- FORMAT_
DEVSHELL_ SESSION_ V1 - JSON
formatfield forGuestPrimarySessionV1.
Functions§
- apply_
guest_ primary_ startup - On guest-primary startup: if a v1 session file exists, reset VFS to empty and restore
logical_cwd(creating directories as needed socrate::devshell::vfs::Vfs::set_cwdsucceeds). - cwd_
session_ metadata_ path - Same layout as
workspace_session_metadata_path, but rooted atstd::env::current_dir. - load_
guest_ primary - Load guest-primary metadata: workspace env path, then cwd
.cargo-devshell/session.json, then legacy besidebin_path. - save_
guest_ primary - Save guest-primary session metadata (JSON). Does not write
.dev_shell.bin. - session_
metadata_ path - Resolved path to write guest-primary session JSON: workspace env → cwd
.cargo-devshell/→ legacy besidebin_path. - session_
path_ for_ bin - Companion path for guest-primary metadata next to a legacy
.binsnapshot path. - workspace_
session_ metadata_ path - Session file under
$DEVSHELL_WORKSPACE_ROOT/.cargo-devshell/session.jsonwhen the env var is set.