feat(config,mcps,policy,compose): komodo alerts with hold, vibegram and ha python_tools, vault rw home zones

This commit is contained in:
hh
2026-08-30 18:16:15 +02:00
parent 6f8711c1a8
commit b1f3fc93ed
11 changed files with 1186 additions and 47 deletions
+62
View File
@@ -115,3 +115,65 @@ def test_firefly_requires_open_skill(vault):
assert gate(call(vault, "mcp__firefly__list_account", state=state)) is None
tracker(call(vault, "Skill", state=state, skill="vault:firefly"))
assert gate(store) is None
@pytest.fixture
def home(vault: Path) -> Zones:
"""Зоны диспетчера с 2026-08-30: vault - дом, удаление - только своё."""
(vault / ".obsidian").mkdir()
(vault / "мета/шаблоны").mkdir()
return Zones(
vault=vault,
write=(vault / "мета/бобер",),
create=(vault / "💬 чаты",),
edit=(vault,),
protected=(vault / ".obsidian", vault / "мета"),
)
def test_home_zones_allow_notes_but_protect_obsidian_and_meta(vault, home):
rule = vault_zones(home)
assert rule(call(vault, "Write", file_path=str(vault / "👤 люди/новый.md"))) is None
assert (
rule(call(vault, "Edit", file_path=str(vault / "📅 дни/2026-08-29.md"))) is None
)
assert rule(call(vault, "Write", file_path=str(vault / "мета/бобер/x.md"))) is None
assert (
rule(call(vault, "Edit", file_path=str(vault / "💬 чаты/старый.md")))
is not None
)
deny = rule(call(vault, "Write", file_path=str(vault / ".obsidian/app.json")))
assert isinstance(deny, Deny) and "Бобра" in deny.reason
assert (
rule(call(vault, "Edit", file_path=str(vault / "мета/шаблоны/x.md")))
is not None
)
@pytest.mark.parametrize(
"command",
[
"mv '👤 люди/x.md' '👤 люди/архив/x.md'",
"echo hi >> '📅 дни/2026-08-29.md'",
"sed -i 's/a/b/' '👤 люди/x.md'",
"rm мета/бобер/дни/old.md",
"mkdir '💻 проекты/новый'",
],
)
def test_home_bash_edits_allowed(vault, home, command):
assert bash_zones(home)(call(vault, "Bash", command=command)) is None, command
@pytest.mark.parametrize(
"command",
[
"rm '📅 дни/2026-08-29.md'",
"rm -rf 👤\\ люди",
"truncate -s 0 '👤 люди/x.md'",
"echo x > .obsidian/app.json",
"mv '👤 люди/x.md' мета/шаблоны/x.md",
],
)
def test_home_bash_deletes_and_protected_denied(vault, home, command):
deny = bash_zones(home)(call(vault, "Bash", command=command))
assert isinstance(deny, Deny), command