Skip to main content

Module config

Module config 

Source
Expand description

Workspace-shape .memstead/config.json for filesystem mems.

Distinct from the archive-shape config in super::super::validator::config: the workspace shape adds a deps list (cross-mem dependencies on registry-published mems) and pins format to a different version namespace so a workspace file accidentally fed to the archive validator (or vice versa) surfaces as a typed mismatch rather than a generic serde error.

§Shape (as written to disk)

{
  "format": 1,
  "schema": "default@1.0.0",
  "deps": ["anthropic/core"]
}
  • format: workspace-config format integer. Bumped on breaking shape changes; current = FILESYSTEM_WORKSPACE_FORMAT.
  • name: mem slug — path-derived, not persisted. Identity of record is the mounts roster (state/mounts.json); on read an absent name is filled from the workspace-root basename. The schema validator tombstones a stray name in config.json.
  • schema: mem schema pin in exact <name>@<version> form (e.g. "default@1.0.0") — bare-name pins are rejected at parse.
  • deps: cross-mem dependencies, each in scope/name form. The list ordering is preserved on round-trip; duplicates are rejected at parse time.
  • version, description, authors: optional fields used by memstead publish to populate the archive shape. Carried through so the workspace remains the source of truth for publish metadata.

§Publish projection

[Self::to_published] converts the workspace shape to a strict PublishedMemConfig for memstead publish, dropping deps and enforcing the archive’s stricter requirements (versioned schema, present version field). Errors surface via PublishConversionError from memstead-schema.

Structs§

DepRef
Cross-mem dependency entry. Mirrors the Tier 3 wiki-link addressing scheme [[scope/name:slug]] and the memstead link <scope>/<name> CLI shorthand.
WorkspaceConfig
Workspace-shape .memstead/config.json for a filesystem mem. Distinct from PublishedMemConfig (the archive shape).

Enums§

WorkspaceConfigError
Errors surfaced by WorkspaceConfig load + parse.

Constants§

FILESYSTEM_WORKSPACE_FORMAT
Format integer for the filesystem workspace .memstead/config.json. Bumped on breaking shape changes; current consumers (memstead init, memstead link, memstead publish, the filesystem engine) all check this before parsing the rest. Distinct from memstead_schema::PUBLISHED_MEM_FORMAT so a misfiled archive config inside a workspace surfaces as WorkspaceConfigError::UnsupportedFormat.

Functions§

config_path
Conventional path of the workspace config inside a workspace root.
init_filesystem_mem
Initialise a brand-new filesystem (folder-backed) mem at root — the engine-owned counterpart of memstead init for a single collapsed mem. Writes the canonical .memstead/config.json, the cache/ + memstead-io/ subdirs, the workspace.toml adapter marker, and the state/mounts.json one-folder-mount roster, so the result roots directly through crate::Engine::from_workspace_root. The mem root is the workspace root (collapsed single-mem form).
parse_workspace_config
Parse workspace config bytes, enforcing the format pin, the name shape, and the deps-uniqueness invariant.
read_workspace_config
Read + parse the workspace config at <workspace_root>/.memstead/config.json.
validate_mem_name
Validate a mem name against the slug shape. Since the name is now path-derived (no longer persisted in config.json), callers that accept a mem name as input — e.g. memstead init --name — validate it here at the boundary instead of relying on a config round-trip to reject a bad value.
write_workspace_config
Write the workspace config to <workspace_root>/.memstead/config.json atomically (write-to-temp + rename). Creates the .memstead/ parent directory if absent. Pretty-printed with 2-space indent for human inspection (the file is the operator’s primary debugging surface).