Metadata-Version: 2.4
Name: azrideus-vault
Version: 0.1.3
Summary: Obsidian vault helpers: markdown documents with YAML frontmatter, and git sync.
License-Expression: MIT
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2.7
Requires-Dist: pyyaml>=6
Provides-Extra: dev
Requires-Dist: ruff; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: types-PyYAML; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"

# azrideus-vault

Small helpers for an Obsidian vault.

- `VaultDocument(path=...)`: one markdown file. `read_frontmatter()` returns the YAML frontmatter (integer strings become ints), `read_frontmatter_value(key, default)` returns one key of it, `write_frontmatter({...})` merges keys into it (`None` deletes a key) and keeps the body, `read_tags()` collects `#tags` from the body and the `tags` frontmatter key, `read_public_and_secret_body()` splits the body into (public, secret) around the first `---` line.
- `VaultGit(root, token="", identity="azrideus-vault")`: async `pull()` (merge only; aborts on conflict), `commit()`, `push()` and `is_dirty()`. A GitHub token is passed through a credential helper and never shows up in URLs or output.
- `Vault(root=...)`: worlds are folders under `worlds/` with a `WORLD_SETTINGS.md`; `scan(world_dir)` sorts `#player`/`#npc`/`#monster`/`#unit`/`#item` documents into a `VaultScan` (shared monsters come from `0.0 - Documents/`).
- `VaultSync.pull_and_reload(git, worlds, vault)`: pull, then reload every world, reporting broken ones instead of stopping.
- `VaultEntity`: pydantic mixin with a `doc: VaultDocument` field; `read_safe(attr)` returns the attribute, or `None` (logged) when the document is missing or broken.
- `VaultError`: every error raised; `.message` is safe to show to a user.

```python
from pathlib import Path
from azrideus_vault import VaultDocument

doc = VaultDocument(path=Path("vault/Notes/Bob.md"))
doc.write_frontmatter({"hp": 12})
print(doc.read_frontmatter()["hp"], doc.read_tags())
```

Tests: `python -m unittest discover -s tests -t . -v`
