agnes-the-ai-analyst/tests/test_setup_hooks_template.py
ZdenekSrotyr 8233c3e3f9 chore(docs): replace stale da verbs and vendor-specific install paths
Sweep operator runbooks (docs/QUICKSTART, docs/HEADLESS_USAGE,
docs/architecture, docs/sample-data, docs/agent-workspace-prompt,
docs/metrics/metrics.yml, dev_docs/server, dev_docs/disaster-recovery),
the corporate-memory service README, the jira connector README + backfill
scripts, the deploy skill, and test docstrings. Replaces `da sync` →
`agnes pull`, `da analyst setup` → `agnes init`, `da metrics ...` →
`agnes catalog --metrics` / `agnes admin metrics ...`, `da fetch` →
`agnes snapshot create`, plus the matching docker-compose admin
invocations.

Vendor-specific `/opt/data-analyst/` install paths in jira backfill /
consistency scripts and operator docs are replaced with the
placeholder `<install-dir>` and a new `AGNES_ENV_FILE` env-var override
that lets a deployment inject its actual install path without a code
change. Aligns with the OSS vendor-agnostic policy in CLAUDE.md.

CHANGELOG `### Internal` entry summarizes the audit and reaffirms the
intentional stale-marker tuples (`_LEGACY_STRINGS`, `_OUR_COMMAND_MARKERS`)
that must keep referencing `da sync` / `da fetch` / etc. for hook upgrade
and override-detection logic.
2026-05-04 21:22:19 +02:00

33 lines
1.3 KiB
Python

"""The shipped Claude settings template must point hooks at `agnes pull` / `agnes push`, not the deleted server/scripts."""
import json
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
TEMPLATE = REPO_ROOT / "docs" / "setup" / "claude_settings.json"
def test_template_has_session_start_agnes_pull():
cfg = json.loads(TEMPLATE.read_text())
starts = cfg.get("hooks", {}).get("SessionStart", [])
assert starts, "SessionStart hook missing"
cmds = [h["command"] for entry in starts for h in entry.get("hooks", [])]
assert any("agnes pull" in c for c in cmds), (
f"Expected `agnes pull` in SessionStart, got {cmds}"
)
def test_template_has_session_end_upload():
cfg = json.loads(TEMPLATE.read_text())
ends = cfg.get("hooks", {}).get("SessionEnd", [])
cmds = [h["command"] for entry in ends for h in entry.get("hooks", [])]
assert any("agnes push" in c for c in cmds), (
f"Expected `agnes push` in SessionEnd, got {cmds}"
)
def test_template_drops_dead_server_scripts_reference():
raw = TEMPLATE.read_text()
assert "server/scripts/collect_session.py" not in raw, (
"Template still references the deleted server/scripts/collect_session.py — "
"the SessionEnd hook would silently fail."
)