Files
planning-with-files/tests/test_pi_extension_packaging.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

49 lines
1.4 KiB
Python

"""Tests for Pi full-adaptation package wiring.
TDD RED phase: these tests define the minimum package-level contract:
- The Pi package must ship both skill and extension resources.
- The extension entrypoint must exist inside the package.
"""
from __future__ import annotations
import json
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
PACKAGE_JSON = REPO_ROOT / ".pi" / "skills" / "planning-with-files" / "package.json"
EXT_INDEX = (
REPO_ROOT
/ ".pi"
/ "skills"
/ "planning-with-files"
/ "extensions"
/ "planning-with-files"
/ "index.ts"
)
class PiExtensionPackagingTests(unittest.TestCase):
def setUp(self) -> None:
self.pkg = json.loads(PACKAGE_JSON.read_text(encoding="utf-8"))
def test_manifest_declares_pi_extension_entry(self) -> None:
pi_block = self.pkg.get("pi", {})
self.assertIn("extensions", pi_block)
self.assertIn(
"extensions/planning-with-files/index.ts",
pi_block.get("extensions", []),
)
def test_manifest_files_include_extensions_dir(self) -> None:
files = self.pkg.get("files", [])
self.assertIn("extensions/", files)
def test_extension_entrypoint_exists(self) -> None:
self.assertTrue(EXT_INDEX.exists(), f"missing extension entrypoint: {EXT_INDEX}")
if __name__ == "__main__":
unittest.main()