Dianel555/DSkills / skills/agent-wiki
agent-wiki
UnverifiedIncremental LLM-friendly wiki generator for Obsidian note vaults. Use when: (1) Building wiki from notes, (2) Ingesting notes to wiki, (3) Obsidian LLM wiki, (4) Incremental knowledge base management. Triggers: 'build wiki from notes', 'ingest notes to wiki', 'Obsidian LLM wiki', 'incremental knowledge base'.
tests/test_cache.py
View on GitHubimport json
import pytest
from agent_wiki import boundary, cache
def test_load_missing_returns_empty_schema(tmp_path):
assert cache.load(tmp_path) == cache.empty_schema()
def test_load_corrupt_json_degrades_to_empty_schema(tmp_path, capsys):
wiki = tmp_path / "wiki"
wiki.mkdir()
(wiki / ".wiki-cache.json").write_text("not-json", encoding="utf-8")
assert cache.load(tmp_path) == cache.empty_schema()
assert json.loads(capsys.readouterr().err)["warning"] == "cache_parse_failed"
def test_save_is_atomic_and_round_trips(tmp_path):
data = cache.empty_schema()
cache.upsert(data, "笔记/a.md", "abc", 1500000000000000000, 12, ["topic.md"])
cache.save(tmp_path, data)
assert cache.load(tmp_path)["sources"]["笔记/a.md"]["sha256"] == "abc"
assert not (tmp_path / "wiki" / ".wiki-cache.json.tmp").exists()
def test_save_replace_failure_leaves_existing_cache(tmp_path, monkeypatch):
wiki = tmp_path / "wiki"
wiki.mkdir()
target = wiki / ".wiki-cache.json"
target.write_text('{"version": 1, "sources": {}}', encoding="utf-8")
def fail_replace(dir_fd, tmp_name, destination, fd):
raise PermissionError("locked")
monkeypatch.setattr(boundary, "_publish_tmp", fail_replace)
with pytest.raises(cache.CacheWriteError):
cache.save(tmp_path, {"version": 1, "sources": {"a.md": {}}})
assert target.read_text(encoding="utf-8") == '{"version": 1, "sources": {}}'
def test_sha256_file_streams_content(tmp_path):
boundary.bind(tmp_path)
path = tmp_path / "empty.md"
path.write_bytes(b"")
assert cache.sha256_file(path) == "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
def test_stat_signature_and_remove(tmp_path):
boundary.bind(tmp_path)
path = tmp_path / "note.md"
path.write_text("hello", encoding="utf-8")
mtime, size = cache.stat_signature(path)
data = cache.empty_schema()
cache.upsert(data, "note.md", "sha", mtime, size, [])
assert data["sources"]["note.md"]["size"] == 5
cache.remove(data, "note.md")
assert "note.md" not in data["sources"]
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |