Skip to content

feat(upgrade): prompt to update editor plugins after CLI upgrade#334

Merged
rhuanbarreto merged 9 commits into
mainfrom
feat/upgrade-plugin-prompt
May 23, 2026
Merged

feat(upgrade): prompt to update editor plugins after CLI upgrade#334
rhuanbarreto merged 9 commits into
mainfrom
feat/upgrade-plugin-prompt

Conversation

@rhuanbarreto

@rhuanbarreto rhuanbarreto commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Plugin update prompt after upgrade:

  • After a successful archgate upgrade, the CLI now offers to update editor plugins
  • TTY mode: Prompts "Would you like to update your editor plugins too?" then lets the user pick which editors to update
  • Non-TTY (agent context): Auto-updates all detected editors (requires credentials)
  • --plugins flag: Skips the prompt and auto-updates all detected editors
  • Plugin update failures are reported but do not change the exit code (the CLI upgrade already succeeded)
  • Gracefully handles: no credentials (login hint), no editors detected (manual install hint)

opencode default agent configuration:

  • During archgate init --editor opencode and archgate plugin install --editor opencode, writes opencode.json to ~/.config/opencode/ with default_agent: "archgate-developer"
  • Additive merge: only sets default_agent if absent (never overwrites user's choice), preserves all existing config

Test plan

  • bun run validate passes (lint, typecheck, format, 1141 tests, 27/27 ADR checks, knip, build)
  • 5 new tests for maybeUpdatePlugins covering: no credentials, no editors, --plugins flag, non-TTY auto-update, install failure reporting
  • 9 new tests for opencode settings: merge logic, path resolution, config file creation, existing config preservation
  • Manual: archgate upgrade when already up-to-date does NOT prompt for plugins
  • Manual: archgate upgrade --plugins with credentials auto-updates detected editors
  • Manual: archgate init --editor opencode creates opencode.json with default_agent

After a successful CLI upgrade, offer to update editor plugins:
- TTY: confirm prompt, then editor selection
- Non-TTY (agent): auto-update all detected editors
- --plugins flag: skip prompt, auto-update all detected

Gracefully handles missing credentials (login hint), no editors
detected (manual hint), and install failures (non-fatal report).

Reuses installForEditor/printManualInstructions from plugin/install
by exporting them for cross-command sharing.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 23, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 97f15ed
Status: ✅  Deploy successful!
Preview URL: https://626d5b83.archgate-cli.pages.dev
Branch Preview URL: https://feat-upgrade-plugin-prompt.archgate-cli.pages.dev

View logs

Write `~/.config/opencode/opencode.json` with `default_agent` set to
`archgate-developer` during `archgate init --editor opencode` and
`archgate plugin install --editor opencode`.

Follows the same additive merge pattern as claude-settings.ts:
- Sets `default_agent` only if absent (never overwrites user's choice)
- Preserves all existing user config keys
- Creates parent directories if missing

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Consolidate the opencode.json config write into the single install
function so it runs from every entry point (init, plugin install,
upgrade --plugins) without duplicate calls. The function is already
idempotent — it only sets default_agent if absent.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Move all imports used only by maybeUpdatePlugins to dynamic import()
calls inside the function body. This avoids parsing credential-store,
editor-detect, init-project, plugin/install, and prompt modules on
code paths that never reach the plugin update flow (--help, --version,
already up-to-date, upgrade failure).

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
…ution

Replace the fragile dirname(opencodeAgentsDir()) derivation with an
explicit opencodeConfigDir() in paths.ts. Both opencodeAgentsDir()
and opencodeConfigPath() now derive from the same base, removing
the coupling between the agents subdirectory and the config path.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Re-add the Cursor Team Marketplace and opencode CLI guard comments
that were accidentally stripped from installForEditor during the
export refactor.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
The "loop over editors, collect failures, report with manual
instructions" block was duplicated between plugin install and
upgrade --plugins. Extract it into runPluginInstalls(editors, token,
verb) in plugin/install.ts so both callers share the same logic.
The verb parameter ("install" vs "update") customizes the error
message.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto rhuanbarreto merged commit a330b5c into main May 23, 2026
10 checks passed
@rhuanbarreto rhuanbarreto deleted the feat/upgrade-plugin-prompt branch May 23, 2026 23:08
@archgatebot archgatebot Bot mentioned this pull request May 23, 2026
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.

1 participant