kcode-k1-web-code-document 0.3.0

Represent versionless authored K1 Web source trees
Documentation
# K1 Web code document

`kcode-k1-web-code-document` owns versionless authored WebCode source trees.

## Public contract

```rust
pub enum Language { JavaScript, Html, Css }

impl Language {
    pub const fn as_str(self) -> &'static str;
    pub const fn template_path(self) -> &'static str;
}

pub struct DocumentError;
pub struct CodeDocument;
```

`CodeDocument::new` accepts an arbitrary complete byte tree beneath one `WebFamily`. Paths use the Web-package safe slash-relative policy, are sorted and unique, and may not collide with a file ancestor. Construction deliberately permits temporarily invalid drafts, including trees with no manifest or an invalid manifest.

`create_text` and `replace_text` create UTF-8 bytes. Replacement requires an existing UTF-8 file; attempting to replace a non-UTF-8 file returns exactly `this file is a non-text object and cannot be modified`. Rename and delete accept arbitrary text or binary files, preserve retained bytes exactly, and never overwrite a destination.

Templates author exactly `Documentation.md` plus `index.js`, `index.html`, or `index.css` for JavaScript, HTML, or CSS. No template authors a `Code.*` file or `k1-web.json`.

`to_source_package` creates the immutable check/publication projection and performs complete `SourcePackage` validation. If the authored tree contains `k1-web.json`, projection changes only its top-level version string token and preserves every other source byte. Without a manifest, projection requires exactly one supported root template path and synthesizes a deterministic manifest. HTML and CSS projections additionally synthesize deterministic `k1-entry.js` and `k1-tests.js` adapters that reference `index.html` or `index.css`; generated files never enter the authored document. `from_source_package` retains the complete published tree without stripping generated files.

This crate owns no persistence, authority decisions, checking, publication, deployment, or source chunking.