feat: native OpenCode integration + Cursor/OpenCode docs polish#307
Closed
danielmeppiel wants to merge 12 commits intomainfrom
Closed
feat: native OpenCode integration + Cursor/OpenCode docs polish#307danielmeppiel wants to merge 12 commits intomainfrom
danielmeppiel wants to merge 12 commits intomainfrom
Conversation
Add .cursor/ to directory tree example, file deployment description, editor pickup list, commit guidance, and sync tip. Remove Cursor from the compile-only note since it now has full native install support. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update 8 doc pages that still described Cursor as compile-only or omitted .cursor/ from path lists: - first-package.md: Cursor no longer needs apm compile - why-apm.md: Cursor moved from 'bridges other tools' to native - ci-cd.md: drift checks include .cursor/, compile comments updated - github-rulesets.md: Cursor removed from compile-only category - security.md: .cursor/ added to deploy path allowlists and FAQ - compilation.md: .cursor/ in folder tree, Cursor in native list - pack-distribute.md: cursor target option, .cursor/ in bundle tree - cli-commands.md: Cursor integration detection, uninstall table Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add OpenCode as a new opt-in integration target. When .opencode/ directory exists, apm install deploys: - Agents → .opencode/agents/<name>.md - Commands → .opencode/commands/<name>.md (from .prompt.md) - Skills → .opencode/skills/<name>/SKILL.md - MCP → opencode.json (new OpenCodeClientAdapter) OpenCode reads AGENTS.md natively, so apm compile already works. Implementation: - Add opencode TargetProfile to KNOWN_TARGETS (targets.py) - Wire agent, command, skill integrators for .opencode/ (opt-in) - Create OpenCodeClientAdapter for opencode.json MCP format - Add opencode to pack/compile target options - Wire install/uninstall for all OpenCode primitives - Add 20 unit tests (1778 total passing) - Update 13 Starlight doc pages - Credit @timvw in CHANGELOG (PR #257 research) Closes #257 Co-authored-by: Tim Van Wassenhove <timvw@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add .opencode/skills/ prefix to manifest-based skill removal - Add .opencode/skills/ to legacy orphan cleanup loop - Remove '# only if .cursor/ already exists' comments from quick-start.md Co-authored-by: Tim Van Wassenhove <timvw@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use .is_dir() instead of .exists() for target marker checks - Return False (not True) from configure_mcp_server when .opencode/ absent - Thread 'enabled' param through to _to_opencode_format - Add commands_opencode to partition_managed_files docstring - Fix OpenCode MCP format description in ide-tool-integration docs Co-authored-by: Tim Van Wassenhove <timvw@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
OpenCode reads AGENTS.md (not per-file instructions), so apm compile is required for instructions — unlike Copilot/Claude/Cursor which read .github/instructions/ and .cursor/rules/ natively. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add .opencode/hooks/ to partition_managed_files filter (defensive) - Add comment explaining OpenCode has no hooks support - Fix quick-start.md and making-the-case.md missing OpenCode in tool lists Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix 'three' → 'four' AI coding tools count in teams.md - Clarify OpenCode needs apm compile for instructions in first-package.md - Fix should_integrate_opencode docstring: include 'commands' - Add PR #306 reference to CHANGELOG entry Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class OpenCode support across APM’s integration/pack/compile surface area so that, when .opencode/ is present, apm install can deploy OpenCode-native primitives and MCP config, and the docs consistently describe Cursor/OpenCode behavior.
Changes:
- Introduces OpenCode as a known target/profile and wires agent/command/skill + MCP behaviors (
.opencode/*+opencode.json). - Extends install/uninstall/pack/compile and managed-file partitioning to recognize OpenCode paths.
- Updates docs (and README/CHANGELOG) to describe OpenCode support and directory-based opt-in behavior.
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/integration/test_command_integrator.py | Adds unit coverage for .prompt.md → .opencode/commands/*.md and OpenCode sync cleanup. |
| tests/unit/integration/test_agent_integrator.py | Adds unit coverage for .agent.md → .opencode/agents/*.md and OpenCode sync cleanup. |
| tests/unit/core/test_target_detection.py | Adds tests for opencode target description, should_integrate_opencode, and .opencode/ auto-detection. |
| src/apm_cli/integration/targets.py | Adds opencode TargetProfile (agents/commands/skills). |
| src/apm_cli/integration/skill_integrator.py | Extends skill copy/promotion + sync cleanup to include .opencode/skills/. |
| src/apm_cli/integration/mcp_integrator.py | Adds opencode runtime support + stale cleanup in opencode.json. |
| src/apm_cli/integration/command_integrator.py | Adds OpenCode-specific command integration + sync removal. |
| src/apm_cli/integration/base_integrator.py | Extends managed-file partitioning to bucket OpenCode agents/commands and recognize .opencode/* prefixes. |
| src/apm_cli/integration/agent_integrator.py | Adds OpenCode-specific agent integration + sync removal. |
| src/apm_cli/factory.py | Registers OpenCodeClientAdapter in ClientFactory. |
| src/apm_cli/core/target_detection.py | Adds opencode to target types, detection logic, integration predicate, and descriptions. |
| src/apm_cli/commands/uninstall.py | Adds uninstall-time sync cleanup for .opencode/agents, .opencode/commands, .opencode/skills. |
| src/apm_cli/commands/pack.py | Adds opencode to apm pack --target choices. |
| src/apm_cli/commands/install.py | Threads integrate_opencode through integration orchestration and records deployed OpenCode paths. |
| src/apm_cli/commands/compile.py | Adds opencode to compile --target choices and help text. |
| src/apm_cli/bundle/packer.py | Adds .opencode/ filtering for apm pack --target opencode. |
| src/apm_cli/adapters/client/opencode.py | New MCP adapter translating Copilot schema → OpenCode opencode.json (mcp key). |
| docs/src/content/docs/reference/cli-commands.md | Documents OpenCode auto-detection + install/uninstall/pack behavior updates. |
| docs/src/content/docs/introduction/why-apm.md | Mentions .opencode/ as an additional opt-in native integration directory. |
| docs/src/content/docs/introduction/what-is-apm.md | Adds OpenCode to supported tools table and narrative. |
| docs/src/content/docs/introduction/how-it-works.md | Adds OpenCode native integration description and MCP mention. |
| docs/src/content/docs/integrations/ide-tool-integration.md | Adds OpenCode integration section + compile note for instructions. |
| docs/src/content/docs/integrations/ci-cd.md | Updates drift-check paths and “commit deployed files” guidance to include .opencode/. |
| docs/src/content/docs/guides/skills.md | Adds .opencode/skills/ as an opt-in compatibility target. |
| docs/src/content/docs/guides/pack-distribute.md | Updates pack target docs and example bundle tree to include .opencode/. |
| docs/src/content/docs/guides/compilation.md | Updates compilation guidance to clarify OpenCode’s instruction source (AGENTS.md). |
| docs/src/content/docs/getting-started/quick-start.md | Updates quick start examples and narrative to include OpenCode outputs. |
| docs/src/content/docs/getting-started/first-package.md | Updates first-package guide to mention OpenCode in the tool set and compile expectations. |
| docs/src/content/docs/enterprise/teams.md | Updates enterprise narrative to include OpenCode as a 4th tool. |
| docs/src/content/docs/enterprise/security.md | Updates security posture wording for .opencode/ allowlisted deploy prefixes. |
| docs/src/content/docs/enterprise/making-the-case.md | Updates positioning text to include OpenCode. |
| README.md | Adds OpenCode mention in headline and compile standards list. |
| CHANGELOG.md | Adds Unreleased entries for native OpenCode integration and OpenCode MCP adapter. |
| .gitignore | Adds scout-pipeline-result.png ignore entry. |
Comments suppressed due to low confidence (2)
docs/src/content/docs/getting-started/quick-start.md:101
- Step 2 states that “Instructions … were deployed to …
.opencode/”, but OpenCode instructions are described elsewhere as coming fromAGENTS.mdviaapm compile(and OpenCode doesn’t use an.opencode/instructions directory). Consider rewording this line to avoid implying thatapm installdeploys instructions into.opencode/.
1. The package was downloaded into `apm_modules/` (like `node_modules/`).
2. Instructions, agents, and skills were deployed to `.github/`, `.claude/`, `.cursor/`, and `.opencode/` (when present) -- the native directories that GitHub Copilot, Claude, Cursor, and OpenCode read from.
3. A lockfile (`apm.lock.yaml`) was created, pinning the exact commit so every team member gets identical configuration.
docs/src/content/docs/getting-started/quick-start.md:115
- This paragraph says OpenCode “pick[s] up the new context immediately … no compile step”, but the OpenCode flow in this PR relies on
apm compileto generateAGENTS.mdfor instructions. Consider qualifying this statement (e.g., immediate for agents/commands/skills/MCP; compile needed when you want instruction updates reflected inAGENTS.md).
## That's it
Open your editor. GitHub Copilot, Claude, Cursor, and OpenCode pick up the new context immediately -- no extra configuration, no compile step, no restart. The agent now knows your project's design standards, can run your prompt templates, and follows the conventions defined in the package.
Comment on lines
82
to
+94
| commands/ | ||
| apm-sample-package/ | ||
| ... | ||
| .cursor/ # only if .cursor/ already exists | ||
| .cursor/ | ||
| rules/ | ||
| design-standards.mdc | ||
| agents/ | ||
| design-reviewer.md | ||
| .opencode/ | ||
| agents/ | ||
| design-reviewer.md | ||
| commands/ | ||
| design-review.md |
Comment on lines
946
to
952
| detect_target, | ||
| should_integrate_vscode, | ||
| should_integrate_claude, | ||
| should_integrate_opencode, | ||
| get_target_description, | ||
| ) | ||
|
|
Comment on lines
250
to
+255
| @click.option( | ||
| "--target", | ||
| "-t", | ||
| type=click.Choice(["vscode", "agents", "claude", "all"]), | ||
| type=click.Choice(["vscode", "agents", "claude", "opencode", "all"]), | ||
| default=None, | ||
| help="Target platform: vscode/agents (AGENTS.md), claude (CLAUDE.md), or all. Auto-detects if not specified.", | ||
| help="Target platform: vscode/agents (AGENTS.md), claude (CLAUDE.md), opencode (AGENTS.md), or all. Auto-detects if not specified.", |
Comment on lines
+936
to
+940
| opencode_skills_dir = project_root / ".opencode" / "skills" | ||
| if opencode_skills_dir.exists(): | ||
| result = self._clean_orphaned_skills(opencode_skills_dir, installed_skill_names) | ||
| stats['files_removed'] += result['files_removed'] | ||
| stats['errors'] += result['errors'] |
Comment on lines
+136
to
+153
| # OpenCode does not support hooks — instructions are via AGENTS.md (apm compile). | ||
| "opencode": TargetProfile( | ||
| name="opencode", | ||
| root_dir=".opencode", | ||
| primitives={ | ||
| "agents": PrimitiveMapping( | ||
| "agents", ".md", "opencode_agent" | ||
| ), | ||
| "commands": PrimitiveMapping( | ||
| "commands", ".md", "opencode_command" | ||
| ), | ||
| "skills": PrimitiveMapping( | ||
| "skills", "/SKILL.md", "skill_standard" | ||
| ), | ||
| }, | ||
| auto_create=False, | ||
| detect_by_dir=True, | ||
| ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Native OpenCode IDE integration —
apm installdeploys primitives to.opencode/when the directory exists, plus documentation consistency fixes across all docs for Cursor and OpenCode.OpenCode primitive mapping
.opencode/agents/<name>.md.opencode/commands/<name>.md.opencode/skills/<name>/SKILL.mdopencode.json→mcpkeyAGENTS.md(viaapm compile)What's included
Code:
OpenCodeClientAdapterfor MCP server management inopencode.json.opencode/skills/cleanup in both manifest-based and legacy paths.opencode/hooks/defensive routing in partition filterTargetProfileentry for OpenCode (agents, commands, skills — no hooks)should_integrate_opencode()target detection.is_dir()guards (not.exists()) for.opencode/detectionDocs:
README.mdheadline: adds OpenCodequick-start.md,first-package.md,compilation.md,ide-tool-integration.md,how-it-works.md,what-is-apm.md,why-apm.md,teams.md,making-the-case.md,cli-commands.mdapm compilefor instructions (readsAGENTS.md)Tests: 1778 unit tests passing. E2E verified: install (5 agents + 5 skills to
.opencode/) and uninstall (full cleanup).Credits
Inspired by @timvw's work in #257. Closes #305.