Skip to content

feat(targets): add Pi coding agent target - #2907

Open
Abhishek Sharma (abhishekbiyala) wants to merge 1 commit into
microsoft:mainfrom
abhishekbiyala:feat/pi-target
Open

feat(targets): add Pi coding agent target#2907
Abhishek Sharma (abhishekbiyala) wants to merge 1 commit into
microsoft:mainfrom
abhishekbiyala:feat/pi-target

Conversation

@abhishekbiyala

@abhishekbiyala Abhishek Sharma (abhishekbiyala) commented Sep 8, 2026

Copy link
Copy Markdown

Fixes #2908

Description

Adds pi as a first-class APM target for the Pi coding agent (@earendil-works/pi-coding-agent), following the exact opencode/kiro/codex pattern — one TARGET_CAPABILITIES entry plus one KNOWN_TARGETS profile, no new classes.

Pi is an actively-used harness that currently has no APM target, so its users have no manifest/lockfile/upgrade story for agent context. This closes that gap.

What was added

  • Capability + profile for pi: project root .pi/, user scope ~/.pi/agent/, compile_family="agents" (Pi reads AGENTS.md), in_all=True, auto-detected on a .pi/ directory.
  • Primitives supported (verified against Pi's shipped dist/core/resource-loader.js and dist/config.js, not inferred):
    • skills → converge on the cross-tool .agents/skills/<name>/SKILL.md (skill_standard, verbatim), matching codex/opencode/gemini. Pi natively reads both .pi/skills/ and .agents/skills/. User scope resolves to ~/.pi/agent/skills/.
    • commands → Pi prompt templates (/name slash commands) deploy to .pi/prompts/<name>.md via the existing shared claude_command transformer, justified because Pi's description/argument-hint frontmatter and $1/$@/$ARGUMENTS substitution are identical to Claude commands.
    • instructions → compile-only (Pi reads AGENTS.md); not an installed primitive.
  • Deliberately no agents primitive: Pi has no native agent-definition directory. Sub-agents are an extension capability, not markdown files — dist has no .pi/agents loader. Because no agent files are deployed, no frontmatter transform is required (unlike OpenCode).
  • No hooks (extensions cover that). MCP wiring deferred to a follow-up (needs a Pi MCPClientAdapter for .pi/settings.json).

Type of change

  • New feature
  • Documentation

Testing

  • Tested locally
  • All existing tests pass — uv run --frozen pytest tests/unit tests/test_console.py22303 passed, 43 skipped, 21 xfailed
  • Added tests for new functionality — new tests/unit/integration/test_pi_target.py (7 tests); characterization goldens updated in test_scope.py, test_target_catalog.py, test_data_driven_dispatch.py; fixed a latent "pi""copilot" substring collision in a parametrized leak assertion in test_dep_target_intersection.py
  • Integration: uv run --frozen pytest tests/integration/test_target_resolution_e2e.py tests/integration/test_primitive_target_covering_array.py → 35 passed, 11 precondition-skipped
  • Lint: ruff check + ruff format --check on src/ and tests/ → clean
  • Manual: apm targets in a .pi/ dir reports Pi active (deploy dir .pi/); apm install --target pi deploys a skill to .agents/skills/

Files changed

  • src/apm_cli/core/target_catalog.pypi capability
  • src/apm_cli/integration/targets.pypi TargetProfile
  • src/apm_cli/core/target_detection.py.pi/ detection signal + display/deploy/signal dicts
  • tests/unit/integration/test_pi_target.py — new
  • tests/unit/core/test_scope.py, tests/unit/core/test_target_catalog.py, tests/unit/integration/test_data_driven_dispatch.py, tests/unit/integration/test_dep_target_intersection.py — goldens/assertions updated
  • docs/.../reference/targets-matrix.md, docs/.../concepts/primitives-and-targets.md, CHANGELOG.md

Spec conformance (OpenAPM v0.1)

  • N/A — this PR adds a new deployment target and does not change OpenAPM-observable behaviour.

@abhishekbiyala

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new pi target profile is missing pack_prefixes for its dual-root layout and the changelog entry is missing the PR number.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new first-class pi target to the APM CLI, modeling Pi coding agent deployment/detection and documenting its supported primitives and conventions.

Changes:

  • Added pi to the target capability catalog and native target profiles, including .pi/ auto-detection and the agents compile family.
  • Implemented Pi’s target profile mappings: skills converge to .agents/skills/ (project) and commands deploy to .pi/prompts/.
  • Added/updated unit tests, documentation pages, and an Unreleased changelog entry to reflect the new target.
File summaries
File Description
src/apm_cli/core/target_catalog.py Registers the pi target capability in the catalog.
src/apm_cli/integration/targets.py Adds the pi TargetProfile (primitive mappings, scope behavior, detection settings).
src/apm_cli/core/target_detection.py Adds .pi/ as a detection signal and updates target display/deploy metadata.
tests/unit/integration/test_pi_target.py New acceptance-style unit tests covering Pi profile layout and primitive deployment behavior.
tests/unit/integration/test_dep_target_intersection.py Fixes a substring-based leak assertion that became problematic with short target names like pi.
tests/unit/integration/test_data_driven_dispatch.py Updates bucket/partition characterization to include commands_pi.
tests/unit/core/test_target_catalog.py Updates characterized target sets and adds Pi native profile expectations.
tests/unit/core/test_scope.py Updates known-target assertions to include pi.
docs/src/content/docs/reference/targets-matrix.md Documents Pi in the targets matrix, including detection, deploy roots, and primitive support.
docs/src/content/docs/concepts/primitives-and-targets.md Updates conceptual docs and matrices to include Pi as a target.
CHANGELOG.md Adds an Unreleased entry describing the new Pi target.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +705 to +708
"pi": TargetProfile(
capability=TARGET_CAPABILITIES["pi"],
root_dir=".pi",
primitives={
Comment thread CHANGELOG.md Outdated

### Added

- Added `pi` as a first-class target for the Pi coding agent (`@earendil-works/pi-coding-agent`). Skills converge on the cross-tool `.agents/skills/` directory and prompt templates deploy to `.pi/prompts/` as `/name` slash commands (reusing the Claude command transform). Pi auto-detects on a `.pi/` directory, is included in `--target all`, and compiles to the `AGENTS.md` family. Instructions are compile-only and Pi exposes no native agents or hooks primitives.


def _make_command_package(project_root: Path, prompts: dict[str, str]) -> MagicMock:
"""Create a package on disk with ``.apm/prompts/*.md`` command sources."""
Add `pi` as a first-class APM target for the Pi coding agent
(@earendil-works/pi-coding-agent), following the opencode/kiro/codex
pattern: one TARGET_CAPABILITIES entry plus one KNOWN_TARGETS profile.

Pi's loadable project resources (verified against the shipped dist
core/resource-loader.js) are skills, prompt templates, themes, and
extensions -- there is no native agent-definition directory. Accordingly
the profile exposes only:

- skills: converge on the cross-tool .agents/skills/<name>/SKILL.md
  (Pi natively reads both .pi/skills/ and .agents/skills/); user scope
  resolves to ~/.pi/agent/skills/.
- commands: Pi prompt templates (/name slash commands) deploy to
  .pi/prompts/ reusing the shared claude_command transformer, since Pi's
  description/argument-hint frontmatter and $1/$@/$ARGUMENTS substitution
  match Claude commands exactly.

Instructions are compile-only (Pi reads AGENTS.md -> compile_family
"agents"); Pi has no hooks concept. MCP wiring is deferred to a follow-up.
Pi auto-detects on a .pi/ directory and is included in --target all.

Also fix a latent substring-collision in the copilot per-file routing
test: "pi" is a substring of "copilot", so the leak assertion is tightened
to match the delimited source marker (pkg-<target>-) instead.

Adds tests/unit/integration/test_pi_target.py and updates the target
characterization goldens, the targets matrix, and the primitives-and-
targets concept doc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add Pi coding agent as an APM target

2 participants