Skip to content

feat(extension): auto-deploy mode cards on activate (#533) - #546

Merged
jeonghun-jj-lee merged 1 commit into
mainfrom
533-auto-deploy-mode-cards
Aug 24, 2026
Merged

feat(extension): auto-deploy mode cards on activate (#533)#546
jeonghun-jj-lee merged 1 commit into
mainfrom
533-auto-deploy-mode-cards

Conversation

@jeonghun-jj-lee

@jeonghun-jj-lee jeonghun-jj-lee commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Closes #533

Stages autodev.md and autoresearch.md from the extension bundle into ~/.config/opencode/agents/ on every activation — the global config directory opencode always globs for agent markdown.

Why: Mode cards existed in the repo (PR #522) but were never deployed to a location opencode's agent discovery could find. Users who installed Amicode never saw the autodev/autoresearch modes in the agent picker unless they ran deploy-agents.mjs manually.

How: Same always-copy pattern as Pasqal connector staging (pasqal_assets.ts): extension-owned, mkdir -p + copyFileSync on activate, never blocks activation on failure.

Testing: 6 tests in mode_cards_staging.test.ts (mirrors pasqal_assets.test.ts): happy path, dir creation, stale overwrite, idempotency, missing-source throw, tripwire that the extension ships the cards.

Summary by CodeRabbit

  • New Features

    • Added automatic setup of Autodev and Autoresearch mode cards when the extension activates.
    • Mode cards are copied to the global OpenCode agents directory and updated when newer versions are available.
    • The destination directory is created automatically when needed.
  • Bug Fixes

    • Activation continues safely if mode-card setup encounters an error.

… on activate (#533)

Stage autodev.md and autoresearch.md from the extension bundle into the
global opencode agents directory on every activation. Same always-copy
semantics as Pasqal connector staging: extension-owned, overwrite-on-
activate, never blocks activation.

This closes the gap where mode cards existed in the repo but were never
deployed to a location opencode's agent discovery could find — users had
to run deploy-agents.mjs manually or never saw the modes in the picker.

Includes 6 tests mirroring pasqal_assets.test.ts (happy path, dir
creation, overwrite, idempotency, missing-source throw, tripwire).
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ef2ff25c-35e8-4452-8925-832fc46a4746

📥 Commits

Reviewing files that changed from the base of the PR and between 4122be7 and 999c73c.

📒 Files selected for processing (3)
  • packages/extension/src/extension.ts
  • packages/extension/src/mode_cards.ts
  • packages/extension/test/mode_cards_staging.test.ts

📝 Walkthrough

Walkthrough

The extension now copies bundled autodev.md and autoresearch.md cards to the global OpenCode agents directory during activation. It creates the directory, overwrites existing cards, logs results, and continues activation after staging failures.

Changes

Mode-card staging

Layer / File(s) Summary
Mode-card staging implementation
packages/extension/src/mode_cards.ts, packages/extension/test/mode_cards_staging.test.ts
Adds global directory resolution, recursive creation, source validation, always-copy behavior, and tests for copying, overwriting, idempotency, errors, and bundled files.
Activation-time provisioning
packages/extension/src/extension.ts
Calls stageModCards during activation, logs staged files, and handles errors without blocking activation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ExtensionActivation
  participant stageModCards
  participant GlobalOpenCodeAgentsDirectory
  ExtensionActivation->>stageModCards: stage bundled mode cards
  stageModCards->>GlobalOpenCodeAgentsDirectory: create directory and copy cards
  stageModCards-->>ExtensionActivation: return result or error
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 533-auto-deploy-mode-cards

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

@jeonghun-jj-lee
jeonghun-jj-lee merged commit 1e205d9 into main Aug 24, 2026
4 of 8 checks passed
@jeonghun-jj-lee
jeonghun-jj-lee deleted the 533-auto-deploy-mode-cards branch August 24, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: auto-deploy mode cards (autodev/autoresearch) to ~/.config/opencode/agents/ on activate

1 participant