gabriel / muse public
feat main #21 / 100

feat: semantic TOML and Markdown adapters for the code domain plugin

Add two fully-typed, tree-sitter-backed language adapters to the code domain plugin, extending Muse's semantic version control to documentation and configuration files.

### TOML adapter (tomllib-based) - Tables and array-of-table entries emitted as `section` symbols with dotted qualified names (e.g. `pyproject.toml::tool.mypy`). - Scalar key-value pairs emitted as `variable` symbols. - Semantic `content_id` / `body_hash` via `json.dumps(sort_keys=True)` so comment-only edits and key-reordering produce no diff. - PEP 695 recursive type aliases (`_TomlScalar`, `_TomlValue`) keep the implementation Any-free despite `tomllib.loads()` returning `dict[str, Any]`. - 53-test suite in `tests/test_toml_adapter.py`.

### Markdown adapter (complete rewrite) - **Fixes critical content_id bug**: previously hashed only the heading text; now hashes the full section node (heading + all content beneath it) so body changes are correctly detected. - **Hierarchical qualified names**: `## Installation` under `# API Reference` becomes `API Reference.Installation`, preventing address collisions between identically-named headings in different contexts. - **Fenced code blocks** emitted as `variable` symbols — `code[python]@L15` — scoped to their containing section; language tag in `signature_id`. - **GFM pipe tables** emitted as `section` symbols — `table@L22` — with column-header schema in `signature_id` and data rows in `body_hash` so header renames and row additions are independently visible. - **Inline markup stripping** (`_plain_heading` + `_MD_INLINE_RE`) makes addresses stable across formatting changes (bold/italic/code/link markers stripped; bounded quantifiers prevent backtracking). - Deduplication: identical sibling headings get `@L{lineno}` suffix. - Depth limit (`_MAX_DEPTH = 8`) prevents unbounded recursion. - 95-test suite in `tests/test_markdown_adapter.py`.

### Docs & housekeeping - `docs/reference/code-domain.md`: Language Support table updated to include TOML, Markdown, HTML, and CSS/SCSS. - `pyproject.toml`: `license = {text = "MIT"}` field added. - `LICENSE`: MIT license file added to repository root. - `tests/test_code_plugin.py`: two stale `h1:` / `h2:` address-format assertions updated to match the new hierarchical scheme.

Verification: mypy 0 errors · typing_audit --max-any 0 passes · 3406 tests green.

G Gabriel Cardona <gabriel@tellurstori.com> · 1d ago Mar 22, 2026 · 9d49af7a · parent 45033f17
7
files changed
414
files in snapshot

0 comments

No comments yet. Be the first to start the discussion.