fix: detect opencode Desktop app installs, not just the CLI#439
Conversation
isOpencodeCliAvailable() only checked PATH for the `opencode` binary, so the Electron-based opencode Desktop app (which ships no CLI at all) was invisible to editor detection and the plugin-install gate — even though it reads/writes the same user-scope config directory as the CLI. Add isOpencodeAvailable(), which OR's the existing CLI check with a check for opencodeConfigDir() already existing on disk, and switch all three opencode call sites (editor-detect, init-project, plugin/install) to use it. Rename the "cli-not-found" sentinel to "not-found" to match the broader check, and update the associated user-facing messages. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
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. Comment |
Deploying archgate-cli with
|
| Latest commit: |
d4299ea
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ec9548f2.archgate-cli.pages.dev |
| Branch Preview URL: | https://fix-opencode-desktop-detecti.archgate-cli.pages.dev |
There was a problem hiding this comment.
Not approving: the Cursor Bugbot check passed, but the expected Cursor[bot] review comment (<!-- BUGBOT_REVIEW -->) was not found on this PR. Human review is needed once that signal is available; no additional reviewers were assigned because the author is the sole CODEOWNER and contributor.
Sent by Cursor Approval Agent: Archgate CLI Approver
Code Coverage
Full HTML report available in workflow artifacts. Per-directory breakdown
|
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
## Summary - Fixes the `hooks.WorktreeCreate` command in `.claude/settings.json`, which only ran `bun install`. Once a `WorktreeCreate` hook is configured, the Claude Code harness defers the **entire** worktree creation to it and expects only the resulting absolute path on stdout — the old hook did neither, so `EnterWorktree` failed with errors like `path contains control characters` or an `ENOENT` chdir into stray `bun install` output. (21 stale empty directories under `.claude/worktrees/` plus orphaned `claude/*` branches were leftover evidence of this having been broken for a while.) - The fixed hook parses the requested worktree name from the stdin JSON payload, runs `git worktree add`, installs deps silently, and echoes only the resulting path. Verified end-to-end via `EnterWorktree`/`ExitWorktree` — worktree created with full content + `node_modules`, session cwd matched, clean removal. - Documents the hook contract in `CLAUDE.md` so it doesn't regress back to a bare `bun install`. - Adds `APPROVAL_POLICY.md`, read by this repo's "Archgate CLI Approver" Cursor Automation (confirmed via its own PR comments — it's custom logic in that automation's prompt, not a documented Cursor platform feature). Per [Cursor's Bugbot docs](https://cursor.com/docs/bugbot), a `success` check conclusion already means "no issues found, and no unresolved comments" — Bugbot does not always leave a review comment. The automation's prior fallback logic treated a clean pass with no comment as an unverified signal and withheld approval (see [PR #439](#439)). The policy clarifies that the check's own conclusion is sufficient on its own, while still requiring human review when the check is missing/pending/failed or Bugbot left unresolved comments. - Session findings captured in agent memory (`.claude/agent-memory/archgate-developer/`) for future reference. ## Test plan - [x] `bun run src/cli.ts check` — 39/39 ADR rules pass - [x] `bun run validate` — full pipeline (lint, typecheck, format, 1310 tests, ADR check, knip, build check) passes - [x] `oxfmt --check .` — clean - [x] `@reviewer` skill — APPROVED, 0 violations/warnings across General/Process, Distribution, and General domains - [x] Live end-to-end verification of the fixed `WorktreeCreate` hook via `EnterWorktree`/`ExitWorktree` - [ ] Watch this PR's own "Archgate CLI Approver" comment to confirm it now picks up `APPROVAL_POLICY.md` (unverified — the automation's policy-file lookup is self-reported, not independently confirmed) --------- Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
# archgate ## [0.46.0](v0.45.7...v0.46.0) (2026-07-02) ### ⚠ BREAKING CHANGES * **session-context:** per-editor list/show subcommands; remove --skip and its false premise (#446) ### Features * **session-context:** per-editor list/show subcommands; remove --skip and its false premise ([#446](#446)) ([dd96230](dd96230)) ### Bug Fixes * **ci:** read POSTHOG_PROJECT_ID from secrets, not vars, in release annotation ([#443](#443)) ([a53b305](a53b305)) * detect opencode Desktop app installs, not just the CLI ([#439](#439)) ([ed92b2b](ed92b2b)) * **hooks:** force bash shell for WorktreeCreate hook on Windows ([#442](#442)) ([9da86cf](9da86cf)) * **release:** cap breaking-change bumps to minor while pre-1.0 ([#447](#447)) ([3df6c91](3df6c91)), closes [#446](#446) [#440](#440) [#440](#440) [#440](#440) * repair broken WorktreeCreate hook and add PR approval policy ([#441](#441)) ([de5e97d](de5e97d)) * **session-context:** select top-level opencode sessions, add --root flag ([#445](#445)) ([29b13f4](29b13f4)) --- This PR was generated with [simple-release](https://github.com/TrigenSoftware/simple-release). <details> <summary>📄 Cheatsheet</summary> <br> You can configure the bot's behavior through a pull request comment using the `!simple-release/set-options` command. ### Command Format ````md !simple-release/set-options ```json { "bump": {}, "publish": {} } ``` ```` ### Useful Parameters #### Bump | Parameter | Type | Description | |-----------|------|-------------| | `version` | `string` | Force set specific version | | `as` | `'major' \| 'minor' \| 'patch' \| 'prerelease'` | Release type | | `prerelease` | `string` | Pre-release identifier (e.g., "alpha", "beta") | | `firstRelease` | `boolean` | Whether this is the first release | | `skip` | `boolean` | Skip version bump | | `byProject` | `Record<string, object>` | Per-project bump options for monorepos | #### Publish | Parameter | Type | Description | |-----------|------|-------------| | `skip` | `boolean` | Skip publishing | | `access` | `'public' \| 'restricted'` | Package access level | | `tag` | `string` | Tag for npm publication | ### Usage Examples #### Force specific version ````md !simple-release/set-options ```json { "bump": { "version": "2.0.0" } } ``` ```` #### Force major bump ````md !simple-release/set-options ```json { "bump": { "as": "major" } } ``` ```` #### Create alpha pre-release ````md !simple-release/set-options ```json { "bump": { "prerelease": "alpha" } } ``` ```` #### Publish with specific access and tag ````md !simple-release/set-options ```json { "bump": { "prerelease": "beta" }, "publish": { "access": "public", "tag": "beta" } } ``` ```` ### Access Restrictions The command can only be used by users with permissions: - repository owner - organization member - collaborator ### Notes - The last comment with `!simple-release/set-options` command takes priority - JSON must be valid, otherwise the command will be ignored - Parameters apply only to the current release execution - The command can be updated by editing the comment or adding a new one </details> <!-- Please do not edit this comment. simple-release-pull-request: true simple-release-branch-from: release simple-release-branch-to: main --> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>


Summary
isOpencodeCliAvailable()only checked whether theopencodebinary was onPATH, so the Electron-based opencode Desktop app — which ships no CLI binary at all — was never detected as an installed editor, even though it reads/writes the same user-scope config directory (~/.config/opencode/) as the CLI.isOpencodeAvailable()insrc/helpers/plugin-install.ts, which returns true if either the CLI is onPATHoropencodeConfigDir()already exists on disk (a reliable signal shared by both distributions).src/helpers/editor-detect.ts(thearchgate initeditor-selection prompt),src/helpers/init-project.ts(tryInstallPlugin), andsrc/commands/plugin/install.ts(archgate plugin install --editor opencode)."cli-not-found"sentinel (passed betweeninit-project.tsandcommands/init.ts) to"not-found"since it's no longer CLI-specific, and updated the associated warning message text in both files.isOpencodeAvailableunit-test suite intests/helpers/plugin-install.test.tscovering the CLI-present, Desktop-only (config dir present, no CLI), and neither-present cases.CLAUDE.md's "Adding a New Editor Target" section for future editor integrations that may ship a GUI-only distribution.Why
A user with only the opencode Desktop app installed (no CLI) found that
archgate initnever marked opencode as detected, andarchgate plugin install --editor opencodeskipped the install with a "CLI not found" message — even though the Desktop app was fully installed and configured.Test plan
bun run validatepasses (lint, typecheck, format, 1313 tests, ADR check 39/39, knip, build check)isOpencodeCliAvailable()→false,isOpencodeAvailable()→true