pantheon-opencode 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/AGENTS.global.md +7 -7
  2. package/AGENTS.md +1 -1
  3. package/CHANGELOG.md +77 -0
  4. package/README.md +10 -0
  5. package/package.json +7 -4
  6. package/plugin.json +1 -1
  7. package/pyproject.toml +1 -1
  8. package/scripts/build-plugin.mjs +35 -9
  9. package/scripts/build-roster.mjs +139 -0
  10. package/scripts/doctor.mjs +111 -2
  11. package/scripts/install/opencode.mjs +16 -0
  12. package/scripts/sync-tui.mjs +2 -0
  13. package/scripts/test-slice.mjs +352 -0
  14. package/skills-lock.json +1 -1
  15. package/src/agents/aphrodite.md +8 -6
  16. package/src/agents/apollo.md +9 -7
  17. package/src/agents/athena.md +21 -18
  18. package/src/agents/demeter.md +7 -5
  19. package/src/agents/gaia.md +7 -8
  20. package/src/agents/hephaestus.md +7 -5
  21. package/src/agents/hermes.md +20 -16
  22. package/src/agents/iris.md +10 -8
  23. package/src/agents/mnemosyne.md +17 -19
  24. package/src/agents/nyx.md +7 -5
  25. package/src/agents/prometheus.md +7 -5
  26. package/src/agents/talos.md +11 -5
  27. package/src/agents/themis.md +11 -4
  28. package/src/agents/zeus.md +23 -2
  29. package/src/instructions/agent-return-format.instructions.md +1 -1
  30. package/src/instructions/test-economy.instructions.md +6 -6
  31. package/src/mcp/pantheon_vision.py +24 -0
  32. package/src/pantheon/auto-permissions.ts +328 -0
  33. package/src/pantheon/deepwork/deepwork-tool.ts +14 -0
  34. package/src/pantheon/delegation-enforce.ts +43 -12
  35. package/src/pantheon/native-vision.ts +54 -2
  36. package/src/pantheon/tools.ts +102 -3
  37. package/src/plugin/index.js +342 -16
  38. package/src/plugin.ts +7 -0
  39. package/src/plugins/tui/dist/tui.js +5 -5
  40. package/src/plugins/tui/package-lock.json +2 -2
  41. package/src/plugins/tui/package.json +1 -1
  42. package/src/skills/test-slicing/SKILL.md +44 -15
@@ -3,20 +3,51 @@ name: test-slicing
3
3
  description: "Targeted test execution — map changed files directly to their narrow test slice instead of running full suites."
4
4
  ---
5
5
 
6
- # Test Slicing
6
+ # Test Slicing (Observable & Enforceable)
7
7
 
8
- > **Never run the entire repository test suite for an isolated micro-edit. Map modified files directly to their narrow test slice to save time, tokens, and context window.**
8
+ > **Never run unconstrained repository-wide test suites for isolated edits. Map modified files directly to their narrow, sub-10s test slice to eliminate test fatigue, conserve tokens, and maintain high developer velocity.**
9
9
 
10
10
  ---
11
11
 
12
- ## When to Use
12
+ ## Core Rules & Protocol (Issue #437)
13
13
 
14
- - Verifying bug fixes, refactors, or feature additions touching <= 3 files.
15
- - Running focused checks during TDD (RED → GREEN → REFACTOR).
16
- - CI-like broad suites (`npm test`, `pytest`) are reserved exclusively for:
17
- - User explicitly asks to run full test suite.
18
- - Final pre-release or pre-PR validation.
19
- - Changes affecting core cross-cutting infrastructure, migrations, or auth.
14
+ ### 1. Repository-First Selector Discovery
15
+ Always prefer the repository's own focused selector or diff-aware command over guessing paths:
16
+ 1. Inspect `package.json` / `pyproject.toml` / `Makefile` for focused slice runners:
17
+ - Node/TypeScript: `npm run test:quick`, `npm run test:slice`, `npm run test:fast`, `node scripts/test-slice.mjs`
18
+ - Python: `pytest -k <selector>`, `pytest tests/test_<slice>.py`
19
+ 2. If a project-defined focused selector exists, execute it directly.
20
+ 3. If absent, map the modified file directly to its corresponding test file.
21
+
22
+ ### 2. Scope Escalation & Mapping Gap Protocol
23
+ - **No Silent Escalation:** NEVER silently broaden a test run from a modified file to an entire package or global suite.
24
+ - **Explicit Justification:** If an expansion beyond the narrow slice is genuinely warranted (e.g. cross-cutting auth change, schema migration affecting multiple handlers), state visibly before running:
25
+ `[Test Scope Expansion] Scope: <files> | Selected: <tests> | Reason: <concrete risk/integration rationale>`
26
+ - **Mapping Gap Handling:** If a modified file has no direct test counterpart:
27
+ 1. Report the mapping gap explicitly: `[Test Mapping Gap] No direct test file for <file>.`
28
+ 2. Execute a bounded risk-appropriate fallback (static lint/typecheck gate e.g. `npx biome check <file>` or `ruff check <file>` plus the closest integration slice).
29
+ 3. DO NOT escalate to running the entire repository test suite.
30
+
31
+ ### 3. Failure/Fix Loop (Rerun Only Failed Tests)
32
+ - After an initial edit, run only the selected slice.
33
+ - When an assertion or test fails:
34
+ 1. Diagnose and apply the fix to the target file.
35
+ 2. **Rerun ONLY the failed test** (e.g. `pytest tests/test_foo.py -k <failing_func>` or `node --test tests/foo.test.mjs --test-name-pattern="<failing_test>"`).
36
+ 3. **DO NOT rerun checks that already passed** when their covered code did not change.
37
+ 4. Once the targeted test passes, rerun the single slice file once to confirm no regressions within the file.
38
+
39
+ ### 4. Observable Task Receipt Summary
40
+ Every implementation specialist MUST include the detailed test receipt in the `subtask_summary`:
41
+ ```markdown
42
+ **tests:** [PASS | WARN | FAIL] `<command>` (targets: N, duration: <X>s, selection: <reason or repo selector>)
43
+ **test_scope_justification:** <required ONLY if broader than a focused slice>
44
+ ```
45
+ *Example:*
46
+ `**tests:** [PASS] npx tsx tests/pantheon/auto-permissions.test.ts (targets: 10, duration: 0.12s, selection: direct file slice for auto-permissions.ts)`
47
+
48
+ ### 5. Preserving CI and Release Gates
49
+ - Full-suite checks (`npm test`, unconstrained `pytest`, full CI pipelines) remain required and intact for release gates and PR validations.
50
+ - Developer loops run narrow slices exclusively.
20
51
 
21
52
  ---
22
53
 
@@ -25,6 +56,7 @@ description: "Targeted test execution — map changed files directly to their na
25
56
  | Runtime / Framework | Changed Source File | Sliced Test Command |
26
57
  |---|---|---|
27
58
  | **Node.js (Built-in test runner)** | `src/foo.ts` / `src/foo.js` | `node --test tests/foo.test.mjs` (or `npm test -- tests/foo.test.mjs`) |
59
+ | **Pantheon Engine** | `src/pantheon/<module>.ts` | `npx tsx tests/pantheon/<module>.test.ts` or `npm run test:quick` |
28
60
  | **Vitest** | `src/components/Button.tsx` | `npx vitest run src/components/Button.test.tsx` |
29
61
  | **Jest** | `src/utils/calc.ts` | `npx jest src/utils/calc.test.ts` |
30
62
  | **Pytest** | `src/service/auth.py` | `pytest tests/test_auth.py -k <test_func>` |
@@ -34,21 +66,18 @@ description: "Targeted test execution — map changed files directly to their na
34
66
 
35
67
  ## Lint-First Fast Gate (< 50ms)
36
68
 
37
- Before launching the test runner (which requires 1–5s of process bootstrapping and environment initialization), run a static syntax/linter check on the modified file:
69
+ Before launching the test runner, run a static syntax/linter check on the modified file:
38
70
  - **Python:** `ruff check <file>` (~20ms)
39
71
  - **TypeScript / JavaScript:** `npx biome check <file>` (~30ms) or `tsc --noEmit`
40
72
 
41
- Catching syntax errors, missing imports, and broken brackets at the lint gate saves up to 80% of test loop latency and avoids test runner crashes.
73
+ Catching syntax errors, missing imports, and broken brackets at the lint gate saves test loop latency and avoids test runner crashes.
42
74
 
43
75
  ---
44
76
 
45
77
  ## Execution Guardrails
46
78
 
47
79
  1. **Timeout Budget:** A sliced check must complete in < 10 seconds. If a test hangs or takes > 30s, abort immediately and check background task/locks.
48
- 2. **Failure Isolation:** When a test fails in the slice:
49
- - Read the exact assertion failure and stack trace.
50
- - Do NOT run unrelated test suites hoping for clues.
51
- - Fix the targeted failure and re-run only the failing slice.
80
+ 2. **Failure Isolation:** Read the exact assertion failure and stack trace. Do NOT run unrelated test suites hoping for clues.
52
81
  3. **No Flaky Re-runs:** Do not blindly re-run the same failing test in a loop without inspecting code or diffs.
53
82
  4. **Token Economy:** Pass flags that suppress noise:
54
83
  - Node: `node --test tests/foo.test.mjs` (clean output).