openspec/initiatives/context-store-and-initiatives/work-items/04-add-collection-foundation/evidence.md
Subagent and local review converged on the same direction:
validateMount, parseCollectionPath, createCollectionRegistry,
and mountCollections inside the collection module.validateContextStoreCollectionRelativePath.storeRoot; persisted backend
state can continue to use local_path.Use a two-step pattern:
const store = await registerContextStore({
id: "acme-context",
backend: gitLocalBackend({
localPath: "/Users/me/repos/acme-context",
remote: "[email protected]:acme/context.git",
branch: "main",
}),
});
const collections = createCollectionRegistry([
{ id: "initiatives", mount: "initiatives" },
]);
const mounted = mountCollections({
storeRoot: store.storeRoot,
collections,
});
For Item 4 itself, mountCollections({ storeRoot, collections }) is the
canonical API. One-call setup facades, store lifecycle objects, builder DSLs,
and initiative-specific setup presets are deferred.
src/core/collections/runtime.ts defines runtime collection
definitions, registries, mounted collection contexts, logical path parsing,
and mount/path resolution.src/core/collections/index.ts exports the collection module, and
src/core/index.ts re-exports it for core consumers.test/core/collections/runtime.test.ts covers mount and id validation,
logical path parsing, duplicate id/mount rejection, Windows-style roots,
createHandle(context), no filesystem creation, and generic initiatives/
mounting.pnpm exec vitest run test/core/collections/runtime.test.tspnpm run buildpnpm exec vitest run test/core/collections/runtime.test.ts test/core/context-store/foundation.test.ts test/core/planning-home.test.tspnpm exec vitest run test/utils/file-system.test.tspnpm run lintgit diff --check