Skip to content

refactor(desktop): identify as ai.codev.desktop, not ai.opencode.desktop - #224

Merged
quickbeard merged 1 commit into
mainfrom
desktop-appid-rename
Aug 13, 2026
Merged

quickbeard merged 1 commit into
mainfrom
desktop-appid-rename

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

The appId is the whole desktop identity, not just a string in the installer config. app.setPath("userData", join(app.getPath("appData"), appId)) makes it the data directory name, and it also drives the macOS bundle id, the Windows AppUserModelId and NSIS registry keys, the Linux .desktop filename, executableName, StartupWMClass, and the AppStream metainfo id. The fork's app was announcing itself to the OS as upstream.

What changed

Was Now
ai.opencode.desktop{,.beta,.dev} ai.codev.desktop{,.beta,.dev}
opencode:// codev://
rpm/deb opencode, opencode-beta, opencode-dev codev, codev-beta, codev-dev

The appId is duplicated in src/main/index.ts and electron-builder.config.ts (plus an unpackaged fallback) — all three moved. The scheme lives in three places that must agree: protocols.schemes, app.setAsDefaultProtocolClient, and the renderer's parseUrl. There is a fourth, easy to miss: the argv.filter(arg => arg.startsWith(...)) in the second-instance handler, which is how deep links arrive on Windows and Linux when the app is already running.

The hidden opencode-desktop.desktop launcher and its deb/rpm fpm wiring are deleted. It existed to rescue GNOME/KDE pins from a superseded packaging id, and its Exec=/opt/OpenCode/... no longer matched any install layout this repo produces.

A clean break, deliberately

Confirmed before starting: no installed base, no migration wanted.

So profiles under appData/ai.opencode.desktop* are orphaned, not moved — settings, session history, server list, sandboxes and the downloaded guest image. On the dev machine used to verify this that is 4.2 GB sitting under ~/.config/ai.opencode.desktop.dev, left untouched for manual deletion. Any existing opencode:// link stops working, and a packaged build will not update across the rename: it installs beside the old app rather than replacing it.

If that stops being acceptable later, the migration is a rename() of one directory — nothing inside stores absolute paths (sandbox dirs derive from userData at runtime, socket dirs are hashed per start, image.json holds URLs).

The trap worth knowing about

src/main/migrate.ts has its own TAURI_APP_IDS with the same three strings. Those name the Tauri app's directories, not ours, so they keep the old values and now carry a comment saying why. A find-and-replace across the repo would silently point Tauri migration at a directory that never existed.

Verification

electron-builder.config.test.ts now asserts, per channel, the appId, desktop name, executable name, StartupWMClass, rpm.packageName, and that protocols.schemes is ["codev"]. The removed legacy-launcher test is replaced by that scheme coverage.

Clean across every affected package: desktop 78 tests + typecheck, app 657 unit / 57 browser + typecheck, codev-sandbox 98, codev-brand 7.

Follow-up, not in this PR

packages/codev-brand still passes opencode:// through unchanged when rebranding upstream doc text. That was a deliberate preserve rule; with the scheme renamed it now produces stale docs rather than protected identifiers. Left alone because doc sync is a separate workflow with its own repo — flagged in the test with a comment.

Persisted store filenames (opencode.settings, opencode.global.dat) are also untouched — they are independent of the appId and renaming them is a separate, file-level migration.

🤖 Generated with Claude Code

The appId is the whole desktop identity. app.setPath("userData",
join(appData, appId)) makes it the data directory name, and it also drives
the macOS bundle id, the Windows AppUserModelId and NSIS keys, the Linux
.desktop filename, executableName and StartupWMClass, and the AppStream
metainfo id. The fork's app was announcing itself to the OS as upstream.

Rename it to ai.codev.desktop{,.beta,.dev}, the deep-link scheme to codev://,
and the Linux packages to codev/codev-beta/codev-dev. The scheme lives in
three places that have to agree — protocols.schemes, setAsDefaultProtocolClient
and the renderer's parseUrl — plus the argv filter the second-instance handler
uses, which is easy to miss.

A clean cut: no data migration and no back-compat shim, since there is no
installed base. Profiles under appData/ai.opencode.desktop* are orphaned
rather than moved, and an installed build will not update across the rename.
The hidden opencode-desktop.desktop launcher goes too — it existed to rescue
pins from a superseded packaging id and its Exec no longer matched any
install layout.

migrate.ts keeps the old ids on purpose: they name the Tauri app's
directories, not ours.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@quickbeard
quickbeard merged commit dd01178 into main Aug 13, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the desktop-appid-rename branch August 13, 2026 09:39
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