Files
planning-with-files/tests/test_pi_docs_hook_support.py
T
OthmanAdi 27ef36cd3b release: v2.39.0 (Pi full hook parity extension + Codex hooks flag fix)
Adds a bundled TypeScript extension under .pi/skills/planning-with-files/extensions/planning-with-files/
that maps Pi lifecycle events onto the same behavior the skill provides on Claude Code (PR #157 by
@TomXPRIME). Event surface: session_start, before_agent_start, tool_call, tool_result, agent_end,
session_before_compact, session_shutdown, input. Four modes: auto (DeepSeek-aware), parity,
cache-safe, notify. Attestation gate shares the v2.37 .attestation file. Four slash commands
registered (/plan-status, /plan-attest, /plan-goal, /plan-loop). 12 new contract tests.

Fixes docs/codex.md to use the canonical [features] hooks = true key (Issue #154 by @DLI1996),
with a deprecated-alias note so users on older configs keep working.

Version bumped to 2.39.0 across 14 SKILL.md variants, plugin.json, marketplace.json, CITATION.cff
via scripts/bump-version.py. .pi npm scheme bumped 1.0.1 -> 1.1.0 for the extension surface.
.continue, .gemini, .kiro lag intentionally.

Tests: 110 pass, 2 pre-existing Windows exec-bit failures unrelated to this release.
2026-05-21 21:33:16 +02:00

38 lines
1.2 KiB
Python

"""Documentation contract for Pi hook adaptation.
After full adaptation, Pi docs must no longer state that hooks are unsupported.
"""
from __future__ import annotations
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
PI_DOC = REPO_ROOT / "docs" / "pi-agent.md"
PI_SKILL_README = REPO_ROOT / ".pi" / "skills" / "planning-with-files" / "README.md"
UNSUPPORTED_SENTENCE = (
"Hooks (PreToolUse, PostToolUse, Stop) are **Claude Code specific** and are not currently supported in Pi Agent."
)
class PiDocsHookSupportTests(unittest.TestCase):
def test_docs_pi_agent_no_longer_claims_hooks_unsupported(self) -> None:
text = PI_DOC.read_text(encoding="utf-8")
self.assertNotIn(UNSUPPORTED_SENTENCE, text)
def test_pi_skill_readme_no_longer_claims_hooks_unsupported(self) -> None:
text = PI_SKILL_README.read_text(encoding="utf-8")
self.assertNotIn(UNSUPPORTED_SENTENCE, text)
def test_docs_describe_mode_based_behavior(self) -> None:
text = PI_DOC.read_text(encoding="utf-8")
self.assertIn("cache-safe", text)
self.assertIn("parity", text)
if __name__ == "__main__":
unittest.main()