# API
`kcode-rust-library-repository` stores validated library source as immutable generations selected by `HEAD`.
Public API: `create`, `open`, `docs`, and the `Repository::{source, replace}` methods. A `Repository` handle privately carries its path, package name, and opened generation identity. `replace` atomically commits a complete `kcode_rust_source::Source` only while that identity is still current; otherwise it returns `stale_snapshot`.
Filesystem locks are held only for individual calls. Source traversal accepts only regular UTF-8 files and directories, rejects symlinks and special entries, and excludes ephemeral `Cargo.lock`. Existing generation-layout repositories remain compatible. Flat legacy and partial layouts fail closed and are never migrated or mutated.