Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

build(desktop): name the environment in each packaging script

leepokaicf69b1fd2697
diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml
index 01b37817..51fb7b70 100644
--- a/.github/workflows/release-desktop.yml
+++ b/.github/workflows/release-desktop.yml
@@ -68,7 +68,7 @@ jobs:
- name: Native pieces
run: |
mkdir -p apps/desktop/build/native
- # The host is built by `npm run dist:mac` (tools/native-host.mjs) for the same environment.
+ # The host is built by `npm run dist:mac:main` (tools/native-host.mjs) for the same environment.
# On-device speech for calls.
swift build -c release --arch arm64 --arch x86_64 --package-path apps/desktop/native/speech-macos
cp "$(swift build -c release --arch arm64 --arch x86_64 --package-path apps/desktop/native/speech-macos --show-bin-path)/codync-speech" \
@@ -85,7 +85,6 @@ jobs:
- name: Build, sign and notarize
working-directory: apps/desktop
env:
- CODYNC_ENV: main
CSC_IDENTITY_AUTO_DISCOVERY: "true"
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_DEVELOPMENT_TEAM }}
@@ -93,7 +92,7 @@ jobs:
run: |
npm ci
npm run icons
- npm run dist:mac -- --publish never
+ npm run dist:mac:main -- --publish never
codesign -d --entitlements - dist/mac-universal/Codync.app | grep -q com.apple.security.device.audio-input ||
{ echo "audio-input entitlement missing"; exit 1; }
spctl --assess --type execute -v dist/mac-universal/Codync.app
@@ -171,11 +170,9 @@ jobs:
- run: sudo apt-get update && sudo apt-get install -y rpm
- name: Build
working-directory: apps/desktop
- env:
- CODYNC_ENV: main
run: |
npm ci
- npm run dist:linux -- --${{ matrix.arch }} --publish never
+ npm run dist:linux:main -- --${{ matrix.arch }} --publish never
# The website links releases/latest/download/codync-<os>-<arch>.tar.gz.
cd dist
for f in codync-linux-${{ matrix.arch }}.*; do mv "$f" "${f/linux-${{ matrix.arch }}/${{ matrix.name }}}"; done
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index 984380a6..00bf333e 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -8,13 +8,15 @@
"private": true,
"main": "out/main/index.js",
"scripts": {
- "dev": "electron-vite dev",
+ "dev": "node tools/account-config.mjs dev && electron-vite dev",
"build": "electron-vite build",
"typecheck": "tsc --noEmit -p tsconfig.json",
"test": "node --test --experimental-strip-types src/shared/*.test.ts src/renderer/views/thread/*.test.ts",
"icons": "swift tools/export-symbols.swift",
- "dist:mac": "node tools/account-config.mjs && node tools/native-host.mjs && electron-vite build && electron-builder --mac",
- "dist:linux": "node tools/account-config.mjs && electron-vite build && electron-builder --linux"
+ "dist:mac:dev": "node tools/account-config.mjs dev && node tools/native-host.mjs dev && electron-vite build && electron-builder --mac",
+ "dist:mac:main": "node tools/account-config.mjs main && node tools/native-host.mjs main && electron-vite build && electron-builder --mac",
+ "dist:linux:dev": "node tools/account-config.mjs dev && electron-vite build && electron-builder --linux",
+ "dist:linux:main": "node tools/account-config.mjs main && electron-vite build && electron-builder --linux"
},
"devDependencies": {
"@types/node": "^24.0.0",
diff --git a/apps/desktop/tools/account-config.mjs b/apps/desktop/tools/account-config.mjs
index 4fb8ffc3..97aa0628 100644
--- a/apps/desktop/tools/account-config.mjs
+++ b/apps/desktop/tools/account-config.mjs
@@ -1,11 +1,11 @@
// Writes resources/account-config.json from apps/shared/Config/<env>.plist: the Clerk publishable
-// key and the cloud URL the build talks to. The environment is the argument, else CODYNC_ENV,
-// else dev. Usage: node tools/account-config.mjs [dev|main]
+// key and the cloud URL the build talks to. Usage: node tools/account-config.mjs dev|main
+// (the `npm run dev` / `dist:*:<env>` scripts run it).
import { readFileSync, writeFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
-const env = process.argv[2] ?? process.env.CODYNC_ENV ?? 'dev'
+const env = process.argv[2]
if (!['dev', 'main'].includes(env)) throw new Error(`unknown environment ${env}`)
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
const plist = readFileSync(join(root, '../shared/Config', `${env}.plist`), 'utf8')
diff --git a/apps/desktop/tools/native-host.mjs b/apps/desktop/tools/native-host.mjs
index 84cb51cc..7b3b8012 100644
--- a/apps/desktop/tools/native-host.mjs
+++ b/apps/desktop/tools/native-host.mjs
@@ -1,5 +1,5 @@
// Builds the host the Mac app bundles (build/native/codync-host, universal) for the same
-// environment as the app: CODYNC_ENV (dev | main, default dev) is compiled into the host's cloud.
+// environment as the app: node tools/native-host.mjs dev|main compiles it in as CODYNC_ENV.
// Built on every package so a host made for another environment is never shipped. Linux apps
// use the installed host, so there's nothing to do there.
import { execFileSync } from 'node:child_process'
@@ -8,7 +8,7 @@ import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
if (process.platform !== 'darwin') process.exit(0)
-const env = process.env.CODYNC_ENV ?? 'dev'
+const env = process.argv[2]
if (!['dev', 'main'].includes(env)) throw new Error(`unknown environment ${env}`)
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
const host = join(root, '../../host')
diff --git a/docs/architecture/desktop-app.md b/docs/architecture/desktop-app.md
index 0763b053..9d6263f8 100644
--- a/docs/architecture/desktop-app.md
+++ b/docs/architecture/desktop-app.md
@@ -51,9 +51,8 @@ HTTP to the host leaves from the main process (the loopback API has no CORS).
```sh
cd apps/desktop
npm ci
-node tools/account-config.mjs dev # Clerk key + cloud URL for this build
npm run icons # macOS: SF Symbol masks
-npm run dev # against the installed host on 19222
+npm run dev # dev config, against the installed host on 19222
CODYNC_PORT=19333 CODYNC_HOME=/path/to/home npm run dev # against a manually run host
npm run typecheck && npm test
```
@@ -61,16 +60,18 @@ npm run typecheck && npm test
UI checks: `CODYNC_SHOW_INACTIVE=1` opens the window without taking focus,
`CODYNC_DEBUG_OPEN=compose|group|plugins|computers|<bot name>` opens a screen, and
`CODYNC_REMOTE_DEBUG=<port>` lets a script drive the renderer over the DevTools protocol.
-Packaging picks its environment with `CODYNC_ENV` (`dev` when unset):
+Each packaging script names its environment:
```sh
-npm run dist:mac # dev: dev cloud, Clerk development
-CODYNC_ENV=main npm run dist:mac # main: what the release workflow ships
+npm run dist:mac:dev # dev cloud, Clerk development
+npm run dist:mac:main # main: what the release workflow ships
+npm run dist:linux:dev # / dist:linux:main
```
-`dist:mac` / `dist:linux` write `resources/account-config.json` for that environment and
-`dist:mac` builds the bundled host (`tools/native-host.mjs`, universal, through rustup's pinned
-toolchain) with the same `CODYNC_ENV`, so app and host always match. The other native pieces at
+They write `resources/account-config.json` for that environment, and the Mac ones build the
+bundled host (`tools/native-host.mjs`, universal, through rustup's pinned toolchain) for the same
+one, so app and host always match. Extra electron-builder flags go after `--`
+(`npm run dist:mac:dev -- --dir --arm64`). The other native pieces at
the top of `electron-builder.yml` (speech and screen helpers) don't depend on the environment;
place them first (the release workflow, `.github/workflows/release-desktop.yml`, shows how).
Only one environment's host runs on a computer at a time (one `~/.codync`, port and service):
diff --git a/docs/architecture/overview.md b/docs/architecture/overview.md
index 200eef1f..a2d0fc3e 100644
--- a/docs/architecture/overview.md
+++ b/docs/architecture/overview.md
@@ -64,4 +64,4 @@ Remote screen uses the channel for signaling and WebRTC for media/input. Cloudfl
Application/host major versions must match. The channel wire version (`v=1`), pairing URL version (`v=3`) and the cloud health endpoint's service version are separate values.
-Debug iOS builds use `apps/shared/Config/dev.plist`; Release uses `main.plist`. The desktop app takes the same values through `apps/desktop/tools/account-config.mjs`. The host compiles in its cloud from `CODYNC_ENV` (`main`, else dev), set by the same packaging command. Production fields are currently incomplete in checked-in configuration, so a successful Debug install is not production readiness. See [environments](../guides/environments-and-deployment.md).
+Debug iOS builds use `apps/shared/Config/dev.plist`; Release uses `main.plist`. The desktop app takes the same values through `apps/desktop/tools/account-config.mjs`. The host compiles in its cloud from `CODYNC_ENV` (`main`, else dev), set by the same packaging script (`dist:mac:dev` / `dist:mac:main`). Production fields are currently incomplete in checked-in configuration, so a successful Debug install is not production readiness. See [environments](../guides/environments-and-deployment.md).
diff --git a/docs/guides/accounts-and-ssh.md b/docs/guides/accounts-and-ssh.md
index b8235524..f72c106d 100644
--- a/docs/guides/accounts-and-ssh.md
+++ b/docs/guides/accounts-and-ssh.md
@@ -6,7 +6,7 @@ a device token kept encrypted with Electron `safeStorage`, OAuth in the system b
## Configuration
-The iOS app uses `apps/ios/App/AccountSession.swift`. Public keys and cloud URLs come from `apps/shared/Config/<env>.plist`, copied into the bundle as `AccountConfig.plist` by `project.yml`; Debug selects dev and Release selects main. The desktop app reads the same plist through `node apps/desktop/tools/account-config.mjs [env]` (default `CODYNC_ENV`, else dev; `npm run dist:*` runs it), which writes `resources/account-config.json` (`CODYNC_CLERK_PUBLISHABLE_KEY` / `CODYNC_CLOUD_URL` override it). See [environments](environments-and-deployment.md).
+The iOS app uses `apps/ios/App/AccountSession.swift`. Public keys and cloud URLs come from `apps/shared/Config/<env>.plist`, copied into the bundle as `AccountConfig.plist` by `project.yml`; Debug selects dev and Release selects main. The desktop app reads the same plist through `node apps/desktop/tools/account-config.mjs <env>` (run by `npm run dev` and `npm run dist:*:<env>`), which writes `resources/account-config.json` (`CODYNC_CLERK_PUBLISHABLE_KEY` / `CODYNC_CLOUD_URL` override it). See [environments](environments-and-deployment.md).
Confirm Apple and Google sign-in, Native API and the native app registrations in the intended Clerk instance. The desktop app uses `com.pokai.Codync`, iOS uses `com.pokai.Codync.ios`, with their matching `://callback` URLs. Dashboard configuration and actual OAuth consent must be verified independently of the checked-in plist. Do not bundle Clerk secret keys.
@@ -138,7 +138,7 @@ computer approves each device after comparing a 6-digit code
## Verification
- Build the iOS scheme after `xcodegen generate --spec apps/project.yml`, and run the
- desktop app with `npm run dev` after `node tools/account-config.mjs dev` in `apps/desktop/`.
+ desktop app with `npm run dev` in `apps/desktop/`.
- Open the account menu from either sidebar layout; test arrows, Return, Escape
and clicking outside the panel.
- Sign in with Apple and Google test users, verify the avatar/email, restart the app and
diff --git a/docs/guides/development.md b/docs/guides/development.md
index d50bba4b..58f835a2 100644
--- a/docs/guides/development.md
+++ b/docs/guides/development.md
@@ -11,7 +11,6 @@ The macOS and Linux app is the Electron app in `apps/desktop/`; setup, UI-check
```sh
cd apps/desktop
npm ci
-node tools/account-config.mjs dev
npm run icons # macOS only
npm run dev
```
diff --git a/docs/guides/environments-and-deployment.md b/docs/guides/environments-and-deployment.md
index 7b384009..c9190a14 100644
--- a/docs/guides/environments-and-deployment.md
+++ b/docs/guides/environments-and-deployment.md
@@ -12,7 +12,7 @@ Reviewed against repository configuration on 2026-09-26. Checked-in configuratio
| Cloud Worker / D1 / DO | `cloud/wrangler.toml` | Root production, `dev`, or `local` environment |
| APNs Worker | `relay/wrangler.toml` | Separate deployment and secrets; see [relay README](../../relay/README.md) |
-The environment is chosen when building, never stored: the host compiles in its cloud from `CODYNC_ENV` (`main` → `https://api.codync.dev`, unset or anything else → `https://dev-api.codync.dev`, debug or release alike), and the only cloud setting a host saves is on/off (**Reach from anywhere**, `codync-host cloud --enable|--disable`). `CODYNC_CLOUD_URL` points a host at a cloud you're developing (https, or http to this computer). `npm run dist:mac` builds the bundled host with the app's `CODYNC_ENV`, so one variable picks the environment of a whole desktop build ([desktop app](../architecture/desktop-app.md#development)); the release workflows set `CODYNC_ENV=main`.
+The environment is chosen when building, never stored: the host compiles in its cloud from `CODYNC_ENV` (`main` → `https://api.codync.dev`, unset or anything else → `https://dev-api.codync.dev`, debug or release alike), and the only cloud setting a host saves is on/off (**Reach from anywhere**, `codync-host cloud --enable|--disable`). `CODYNC_CLOUD_URL` points a host at a cloud you're developing (https, or http to this computer). `npm run dist:mac:dev` / `dist:mac:main` build the bundled host for the app's environment, so the script name picks the environment of a whole desktop build ([desktop app](../architecture/desktop-app.md#development)); the release workflows set `CODYNC_ENV=main`.
## Checked-in readiness