Skip to content

feat: add pi coding agent as supported platform#1854

Merged
bmadcode merged 2 commits intobmad-code-org:mainfrom
ganimp84:feature/pi-agent-integration
Mar 8, 2026
Merged

feat: add pi coding agent as supported platform#1854
bmadcode merged 2 commits intobmad-code-org:mainfrom
ganimp84:feature/pi-agent-integration

Conversation

@ganimp84
Copy link
Copy Markdown
Contributor

@ganimp84 ganimp84 commented Mar 8, 2026

What

Add pi (provider-agnostic terminal-native AI coding agent) as a supported platform in the BMAD installer.

Why

Pi follows the open Agent Skills specification and uses the same subdirectory/SKILL.md structure that BMAD already generates for other platforms. Terminal-first developers using pi currently have no native BMAD support and must manually convert command files.

Fixes #1853

How

  • Added pi entry to platform-codes.yaml with target_dir: .pi/skills, template_type: default, and skill_format: true
  • Added Test Suite 28 in test-installation-components.js with 16 assertions covering:
    • Platform config validation (target_dir, skill_format, template_type)
    • IDE selectability (getAvailableIdes() includes pi)
    • Detection lifecycle (detectInstalledIdes() before and after install)
    • Frontmatter parsing (extracted between --- markers, not regex on full file)
    • Frontmatter contract (only name + description keys, both valid)
    • Body content validation (non-empty, contains expected activation instructions)
    • Reinstall/upgrade resilience (rerun setup() over existing output)
    • Temp directory cleanup in finally block

Testing

  • All 197 installation component tests pass (16 new Pi assertions)
  • npm test passes clean: schemas, refs, install, lint, markdown lint, prettier
  • End-to-end verified: ran bmad-cli install --modules bmm --tools pi --yes, confirmed pi discovers and loads all 44 generated skills with no warnings

Add pi (provider-agnostic terminal-native AI coding agent) to
platform-codes.yaml with native skills format output to .pi/skills/.

Pi follows the open Agent Skills specification and uses the same
subdirectory/SKILL.md structure that BMAD already generates for
other platforms.

Fixes bmad-code-org#1853
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 8, 2026

📝 Walkthrough

Walkthrough

Added support for the "pi" platform, a provider-agnostic terminal-native AI coding agent. Changes include configuration metadata in the platform registry and test suite to validate Pi native skill installation, ensuring proper directory structure and frontmatter validation.

Changes

Cohort / File(s) Summary
Pi Platform Configuration
tools/cli/installers/lib/ide/platform-codes.yaml
Added new platform entry "pi" with installer configuration specifying target directory .pi/skills, default template type, and skill format support.
Pi Installation Tests
test/test-installation-components.js
Added test suite (Suite 28) validating Pi native skill installation against temporary projects; verifies target directory, skill format, SKILL.md presence, and frontmatter consistency. Note: test suite appears duplicated in diff with identical implementation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #1483: Also modifies tools/cli/installers/lib/ide/platform-codes.yaml to add a different platform entry ("codebuddy") to the installer registry.

Suggested reviewers

  • bmadcode
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add pi coding agent as supported platform' clearly summarizes the main change—adding pi as a new supported platform in the BMAD installer.
Linked Issues check ✅ Passed The PR implements all coding objectives from #1853: adds pi to platform-codes.yaml with correct configuration (target_dir, template_type, skill_format), includes comprehensive tests verifying installation behavior, and enables the Agent Skills format output required for pi support.
Out of Scope Changes check ✅ Passed All changes are directly aligned with #1853 requirements: adding pi platform configuration, implementing the Agent Skills directory structure (subdirectory/SKILL.md), and providing comprehensive test coverage for the new platform.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The pull request description clearly explains the purpose (adding pi as a supported platform), provides rationale (pi follows Agent Skills spec), details the implementation approach (platform-codes.yaml and test suite), and includes comprehensive testing coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (2)
test/test-installation-components.js (2)

1508-1539: These temp directories still leak on the first failed assertion.

Both remove() calls live on the success path. Once any assertion after mkdtemp() fails, the catch records the failure but leaves the temp project and fixture behind. Put cleanup in a finally.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/test-installation-components.js` around lines 1508 - 1539, The temp
directories created with fs.mkdtemp() (tempProjectDir28) and
createTestBmadFixture() (installedBmadDir28) are only removed on the success
path; move their cleanup into a finally block so they are removed regardless of
assertion failures. Specifically, after creating tempProjectDir28 and
installedBmadDir28 in the try, declare them in the outer scope and in a finally
await fs.remove(tempProjectDir28) and await fs.remove(installedBmadDir28)
(guarding existence and swallowing/remove errors safely) so cleanup always runs;
keep the existing assertions and the try/catch around the test logic
(clearCache, loadPlatformCodes, IdeManager/ensureInitialized, ideManager.setup,
SKILL.md checks) but ensure removal happens in finally.

1519-1534: skill_format detection is completely untested.

For skill-format platforms, detection follows a different code path than installation. This suite should assert Pi is not detected before install and is detected after .pi/skills/bmad-* exists, otherwise a regression in detect() will slip through while setup() still passes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/test-installation-components.js` around lines 1519 - 1534, Before
asserting install results, call IdeManager.detect on the temp project to assert
Pi is NOT detected, then after running IdeManager.setup assert that
IdeManager.detect now reports Pi detected; specifically use the
IdeManager.detect method (or the project-detection entry on the IdeManager
instance used for the test) to check detection state before setup and again
after setup when .pi/skills/bmad-* has been created, so the test verifies the
separate skill_format detection path in addition to setup() success.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/test-installation-components.js`:
- Around line 1519-1526: The test currently only writes YAML and calls
IdeManager.setup('pi', ...), but does not verify that the platform is actually
selectable; call IdeManager.getAvailableIdes() (on the same IdeManager instance,
e.g., ideManager28.getAvailableIdes()) after ensureInitialized() and assert that
the returned list includes 'pi' before calling setup(), so the test proves 'pi'
is exposed as a supported platform; keep the existing setup/assert for success
afterwards.
- Around line 1531-1534: The test currently uses
skillContent28.match(/^name:\s*(.+)$/m) which can match a name: line anywhere;
instead extract the YAML frontmatter between the opening and closing '---'
markers from skillContent28 (e.g., capture the block between the first and
second '---'), then parse or inspect that block to find the name key and compare
it to 'bmad-master' (or use a YAML parser like js-yaml to load the frontmatter
and then assert that frontmatter.name === 'bmad-master'); update the variables
skillContent28/nameMatch28 assertions to operate on the frontmatter content
rather than the whole file body and keep reference to skillFile28 for locating
the file.
- Around line 1531-1534: Add assertions to verify the description frontmatter
and ensure no extra frontmatter keys were leaked: after reading skillFile28 into
skillContent28 (the same block using nameMatch28), extract a description with a
regex like /^description:\s*(.+)$/m and assert it exists and the trimmed value
is non-empty; additionally scan frontmatter lines (e.g., all matches of
/^([A-Za-z0-9_-]+):/m) and assert the set equals exactly ['name','description']
to confirm transformToSkillFormat() normalized the header to only those fields.
- Around line 1510-1514: The test must assert the platform's template_type is
explicitly the default skill template so future changes don't silently pass;
update the assertions around loadPlatformCodes / platformCodes28 / piInstaller
to check piInstaller?.template_type === DEFAULT_SKILL_TEMPLATE (import or
reference the constant that defines the default skill template in your codebase,
or call the function getDefaultSkillTemplate() if present) and if that constant
is not available, assert the concrete expected default value used elsewhere in
the codebase; keep the existing target_dir and skill_format assertions.
- Around line 1528-1534: The test currently only checks SKILL.md exists and that
the frontmatter name matches; enhance the validation by asserting the main skill
payload (the body after the frontmatter) is preserved and non-empty: using the
existing variables skillFile28, skillContent28 and nameMatch28, split
skillContent28 into frontmatter and body (e.g., by locating the frontmatter
match end or the first blank line) and add assertions that the body length is >
0 and that it contains the expected command/content snippet (or exact expected
text loaded from the source fixture) so the test fails if the file has only a
header or truncated content.

---

Nitpick comments:
In `@test/test-installation-components.js`:
- Around line 1508-1539: The temp directories created with fs.mkdtemp()
(tempProjectDir28) and createTestBmadFixture() (installedBmadDir28) are only
removed on the success path; move their cleanup into a finally block so they are
removed regardless of assertion failures. Specifically, after creating
tempProjectDir28 and installedBmadDir28 in the try, declare them in the outer
scope and in a finally await fs.remove(tempProjectDir28) and await
fs.remove(installedBmadDir28) (guarding existence and swallowing/remove errors
safely) so cleanup always runs; keep the existing assertions and the try/catch
around the test logic (clearCache, loadPlatformCodes,
IdeManager/ensureInitialized, ideManager.setup, SKILL.md checks) but ensure
removal happens in finally.
- Around line 1519-1534: Before asserting install results, call
IdeManager.detect on the temp project to assert Pi is NOT detected, then after
running IdeManager.setup assert that IdeManager.detect now reports Pi detected;
specifically use the IdeManager.detect method (or the project-detection entry on
the IdeManager instance used for the test) to check detection state before setup
and again after setup when .pi/skills/bmad-* has been created, so the test
verifies the separate skill_format detection path in addition to setup()
success.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d61a2305-5882-42dd-a4ea-eb4c0e96bff0

📥 Commits

Reviewing files that changed from the base of the PR and between 44ba15f and 610d311.

📒 Files selected for processing (2)
  • test/test-installation-components.js
  • tools/cli/installers/lib/ide/platform-codes.yaml

- Assert template_type === 'default' to pin config contract
- Verify Pi appears in getAvailableIdes() list
- Test detect() returns false before install, true after
- Parse frontmatter between --- delimiters instead of regex on full file
- Assert description is present and non-empty
- Assert frontmatter contains only name and description keys
- Validate body content is non-empty with expected activation instructions
- Add reinstall/upgrade coverage (rerun setup over existing output)
- Move temp directory cleanup to finally block
Copy link
Copy Markdown
Collaborator

@alexeyv alexeyv left a comment

Choose a reason for hiding this comment

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

Now that it's all skills, adding platforms that support them is actually easy. All I'm wondering is how many can we take before the installer UX it's overwhelmed by too many choices. :)

Before long this will probably become "Claude, Cursor, Codex or type where you want them" affair, with a link to a documentation page that's like "correct answers for 5000 different Agentic platforms" :)

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 Request: Official pi coding agent integration (Agent Skills standard)

3 participants