Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .claude/docs/V1.2.1_STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -711,3 +711,9 @@ Then pushed `v1.2.1` to `origin` at the maintainer's request. **No merge and no
**Why**: Adrián asked for the Code-XR logo instead of Electron's default icon.

**What changed**: the IDE reuses the extension's own logo rather than a copy. `src/main/appIcon.ts` finds the extension package (`installRoot()`, now also used by `coreRuntime.ts`) and its `resources/icon.png`, which becomes the window and taskbar icon (Windows, Linux), the dock icon (macOS, `app.dock.setIcon`) and the About dialog's icon. The welcome view shows `resources/icon.svg`, imported with Vite's `?url` and drawn as a CSS mask in the text colour, so the black logo stays visible on the dark theme. Packaging (#20) must ship `resources/icon.png` in the app's resources folder, and the installers' own icons (`.ico`/`.icns`) are generated there.

### IDE epic #11 — story #20: installers for Windows, macOS and Linux, and an opt-in update check [Linux AppImage and .deb confirmed by building and running the packaged app under Playwright; Windows and macOS installers pending their first CI run] (2026-11-26, branch `claude/project-thread-zeculq`)

**What changed**: `apps/ide/electron-builder.config.cjs` and `npm run dist --workspace=code-xr-ide` build the installers (NSIS `.exe`, `.dmg` signed ad hoc, AppImage and `.deb`), shipping the extension's Python backend copy, templates, examples, scene icons and vendored scene libraries as resources (`process.resourcesPath` is the core's install root when packaged); node-pty and the TypeScript language server are unpacked from the asar. The packages the build bundles moved to devDependencies (asar 118 MB to 17 MB). `.github/workflows/ide-release.yml` builds the three on their runners: artifacts on a pull request or a manual run, a draft GitHub release on a tag `ide-vX.Y.Z`. Help > Check for Updates… and the setting `update.checkOnStartup` (off by default) read the public GitHub releases and only open the release page (`src/main/updates/`, unit-tested). Not signed or notarised: the README's "Installers" section says what each OS shows.

**Verified**: the packaged Linux app renders a scene with the vendored libraries, shows the metrics lens and the Outline (LSP) and runs a terminal; the user-data folder stays `code-xr-ide`. **Open**: the Windows and macOS installers have not been built or opened yet; the CI run of the PR is their first test.
120 changes: 120 additions & 0 deletions .github/workflows/ide-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: IDE installers

# Builds the Code-XR IDE installers (#20) on the three operating systems:
# Linux AppImage and .deb
# Windows NSIS installer (.exe)
# macOS .dmg (Apple silicon; the runner's architecture)
#
# A tag `ide-vX.Y.Z` (matching apps/ide/package.json's version) builds them
# and attaches them to a DRAFT GitHub release, which the maintainer reviews
# and publishes by hand: nothing reaches users from here on its own. A pull
# request that touches the packaging, or a manual run, only builds them and
# keeps them as workflow artifacts, to try an installer before tagging.
#
# The installers are not signed or notarised (thesis prototype): the README's
# "Installers" section says what each OS shows because of it. No secrets are
# used, and like ci.yml no third-party action: the release is made with the
# GitHub CLI the runners already have.

on:
push:
tags:
- 'ide-v[0-9]*'
pull_request:
branches:
- master
- 'v[0-9]*'
paths:
- '.github/workflows/ide-release.yml'
- 'apps/ide/electron-builder.config.cjs'
- 'apps/ide/package.json'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ide-release-${{ github.ref }}
cancel-in-progress: false

env:
DO_NOT_TRACK: '1'
npm_config_audit: 'false'
npm_config_fund: 'false'
npm_config_update_notifier: 'false'
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
# electron-builder downloads the Electron release it packages itself.
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
# No signing identity is looked up on macOS (mac.identity in the config).
CSC_IDENTITY_AUTO_DISCOVERY: 'false'

jobs:
installers:
name: installers (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- name: Install
run: npm ci

- name: The tag matches the IDE's version
if: startsWith(github.ref, 'refs/tags/ide-v')
shell: bash
run: |
version=$(node -p "require('./apps/ide/package.json').version")
if [ "ide-v$version" != "$GITHUB_REF_NAME" ]; then
echo "Tag $GITHUB_REF_NAME does not match apps/ide/package.json version $version" >&2
exit 1
fi

# Builds the extension's Python backend copy (dist/code_analysis), the
# IDE (out/), then the installers into apps/ide/release/.
- name: Build the installers
run: npm run dist --workspace=code-xr-ide

- name: Keep the installers
uses: actions/upload-artifact@v4
with:
name: code-xr-ide-${{ runner.os }}
if-no-files-found: error
path: |
apps/ide/release/*.AppImage
apps/ide/release/*.deb
apps/ide/release/*.exe
apps/ide/release/*.dmg

draft-release:
name: draft release
needs: installers
if: startsWith(github.ref, 'refs/tags/ide-v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Fetch the installers
uses: actions/download-artifact@v4
with:
path: installers
merge-multiple: true

- name: Create the draft release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" installers/* \
--repo "$GITHUB_REPOSITORY" \
--draft \
--title "Code-XR IDE ${GITHUB_REF_NAME#ide-v}" \
--notes "Installers for the Code-XR IDE. They are not signed: see the IDE README, section Installers, for what each system asks the first time."
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ media/v1.2.0/xr_experiences/ar-development.png

# Git worktrees created by Claude Code agent sessions
.claude/worktrees/

# #20: IDE installers built by electron-builder
apps/ide/release/
18 changes: 18 additions & 0 deletions apps/ide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Run them from the repository root after `npm ci`:
| `npm run ide:start` | Build, then run the built IDE (no dev server). |
| `npm run ide:smoke` | Build, launch the IDE hidden with `--codexr-smoke`, probe the security baseline from inside the real renderer, open a terminal with the default profile and read back the output of `echo codexr-smoke`, exit 0 or 1. On Linux without a display use `xvfb-run -a npm run ide:smoke`. |
| `npm run ide:test` | Typecheck (Node and web targets separately), lint with zero warnings, unit tests. Part of the root `npm test`. |
| `npm run dist --workspace=code-xr-ide` | Build the installers for the OS it runs on into `apps/ide/release/` (#20): AppImage and `.deb` on Linux, an NSIS `.exe` on Windows, a `.dmg` on macOS. See [Installers](#installers-20). |

## Layout

Expand Down Expand Up @@ -134,6 +135,22 @@ The scene's header has an **XR** row with three buttons. They act on the window'

The core fix that makes this work: a scene opened at the same moment as its server (the IDE's scene view, VS Code's side panel) used to ask for its room before the launch had written the session mapping. It joined `codexr-session:port-<port>`, while every later client joined `codexr-session:<server id>`. `CollaborationSessionApi` now falls back to the active-server registry, which is filled before the page opens.

## Installers (#20)

`npm run dist --workspace=code-xr-ide` builds the extension's Python backend copy, the IDE, then packages it with electron-builder (`electron-builder.config.cjs`) for the OS it runs on. Each installer carries the IDE and, as resources, what the extension's core reads from its install folder: the Python backend (`dist/code_analysis`), `templates/`, `examples/`, the icons the scenes use and the vendored A-Frame/BabiaXR libraries, so a scene renders offline exactly as in development (`process.resourcesPath` is the core's install root when packaged). The TypeScript language server (#21) and `node-pty` (#137) are unpacked from the asar, because a child process and a native module cannot run from inside it. Python itself is not bundled: the IDE finds the system's and sets up its environment on request, as in development (#15).

| OS | File | First run |
|---|---|---|
| Windows | `Code-XR-IDE-Setup-<version>.exe` (NSIS; asks where to install) | The installer is not signed, so SmartScreen shows "Windows protected your PC": **More info > Run anyway**. |
| macOS (Apple silicon) | `Code-XR-IDE-<version>-arm64.dmg` | Signed ad hoc, not notarised, so Gatekeeper refuses a downloaded copy the first time: right-click the app > **Open**, or run `xattr -dr com.apple.quarantine "/Applications/Code-XR IDE.app"`. |
| Linux | `Code-XR-IDE-<version>-x86_64.AppImage`, `code-xr-ide_<version>_amd64.deb` | AppImage: `chmod +x` it, then run it. `.deb`: `sudo apt install ./code-xr-ide_<version>_amd64.deb`. |

The installers are not signed because the project has no signing certificate (a thesis prototype); nothing in the build needs a secret, so adding one later is a configuration change (`CSC_LINK` / `APPLE_ID`), not a code change. Settings and recent folders stay in the same user-data folder as in development (`code-xr-ide`).

**Releases.** `.github/workflows/ide-release.yml` builds the three installers on Windows, Linux and macOS runners. A pull request that touches the packaging, or a manual run, keeps them as workflow artifacts to try one before tagging. Pushing a tag `ide-vX.Y.Z` that matches `apps/ide/package.json`'s version attaches them to a **draft** GitHub release, which the maintainer reviews and publishes by hand.

**Updates.** The IDE does not update itself. Help > **Check for Updates…** reads the repository's public releases, picks the newest published `ide-vX.Y.Z` above the running version (drafts and pre-releases skipped) and offers to open its page; nothing is downloaded or installed. The setting **Check For Updates On Start-up** (`update.checkOnStartup`, off by default) runs the same check quietly when the IDE starts and speaks only when there is a newer release.

## Security baseline

Following Electron's [security checklist](https://www.electronjs.org/docs/latest/tutorial/security). Each rule lives in one place and is enforced by a test, a startup assertion or the smoke run:
Expand All @@ -152,6 +169,7 @@ Following Electron's [security checklist](https://www.electronjs.org/docs/latest
| The renderer cannot start a process: a terminal starts only from a detected or user-saved profile, named by id, and only the window that created it can write to it or read it | `src/main/terminal/` (`ProfileRegistry.resolve`, `TerminalService`) | Unit tests (unknown ids, foreign windows, bad sizes and input); smoke opens a terminal and reads its output. |
| Git runs without a shell, on paths checked inside the open folder; discard asks natively and trashes untracked files | `src/main/git/` (`runGit`, `resolveGitPath`, `gitIpc.ts`) | Unit tests (`..`, absolute paths, symlinks out, globs, option-like branch names); smoke refuses `git.headContent('../package.json')`. |
| The renderer cannot start or address a language server: it names documents by `codexr-file:` URI inside the open folder and sends only allow-listed requests with rebuilt parameters | `src/main/lsp/` (`lspUri.ts`, `lspProtocol.ts`), `LSP_REQUEST_METHODS` in `src/shared/lsp.ts` | Unit tests (`test/lsp.test.ts`: `..`, encoded separators, other schemes, refused methods, forged completion data). |
| No network request unless the person asks: the update check runs from Help > Check for Updates…, or at start-up only if `update.checkOnStartup` is turned on (off by default); it reads the public GitHub releases list, downloads nothing and only opens the release page in the browser | `src/main/updates/` (`updateRelease.ts` pure, `updateCheck.ts`) | Unit tests (`test/updateCheck.test.ts`: tags, drafts, pre-releases, versions); never run in the smoke run. |
| The dev server URL is ignored in a packaged build | `src/main/index.ts` (`app.isPackaged`) | Code review. |

Running as root (containers, some CI images) requires `--no-sandbox`, which the scripts add only in that case. It turns off Chromium's OS-level sandbox and `app.enableSandbox()`; the per-window `sandbox: true` preference and its assertion stay.
Expand Down
72 changes: 72 additions & 0 deletions apps/ide/electron-builder.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Installers for the Code-XR IDE (#20), built by electron-builder.
//
// npm run dist --workspace=code-xr-ide the current OS's installers
//
// The app itself is apps/ide/out (main, preloads, renderer: every npm
// dependency is bundled by Vite except node-pty), plus the three runtime
// packages that run as files: node-pty (native), and typescript-language-
// server with TypeScript, which run as a separate process (#21). Those three
// are unpacked from the asar archive so they can be loaded and spawned.
//
// The extension's core expects its own package beside it (installRoot in
// src/main/appIcon.ts is process.resourcesPath once packaged): the Python
// backend, the scene templates, the examples, the icons and avatars, and the
// vendored scene libraries, copied as extra resources. The Python venv itself
// is still created on first run, after consent (#15).
//
// Unsigned: see the "Installers" section of the README for what that means
// on each OS.
const EXTENSION = '../vscode-extension';
// The installed Electron (package.json holds a range; the binaries are per release).
const { version: electronVersion } = require(require.resolve('electron/package.json'));

module.exports = {
appId: 'org.codexr.ide',
productName: 'Code-XR IDE',
executableName: 'code-xr-ide',
electronVersion,
// node-pty ships N-API prebuilds for every OS and loads them in Electron
// as in Node (#137): nothing to compile, so no toolchain on the CI runners.
npmRebuild: false,
nodeGypRebuild: false,
copyright: 'Copyright (C) Adrián Montes Linares',
directories: { output: 'release', buildResources: 'build-resources' },
// No space in a file name (productName has one): easier to download and script.
artifactName: 'Code-XR-IDE-${version}-${arch}.${ext}',
files: ['out/**/*', 'package.json', 'THIRD_PARTY_NOTICES.md', '!**/*.map'],
asarUnpack: [
'**/node_modules/node-pty/**',
'**/node_modules/typescript-language-server/**',
'**/node_modules/typescript/**',
],
extraResources: [
{ from: `${EXTENSION}/dist/code_analysis`, to: 'dist/code_analysis' },
{ from: `${EXTENSION}/templates`, to: 'templates' },
{ from: `${EXTENSION}/examples`, to: 'examples' },
{ from: `${EXTENSION}/resources`, to: 'resources', filter: ['icon.png', 'icon.svg', 'avatars/**/*', 'languages_icons/color/**/*'] },
{ from: `${EXTENSION}/test/vendor/scene-libraries`, to: 'test/vendor/scene-libraries' },
{ from: `${EXTENSION}/LICENSE`, to: 'LICENSE' },
{ from: `${EXTENSION}/THIRD_PARTY_NOTICES.md`, to: 'THIRD_PARTY_NOTICES-extension.md' },
],
linux: {
target: ['AppImage', 'deb'],
category: 'Development',
icon: `${EXTENSION}/resources/icon.png`,
maintainer: 'Code-XR Project',
},
deb: { packageName: 'code-xr-ide', artifactName: '${name}_${version}_${arch}.${ext}' },
win: { target: ['nsis'], icon: `${EXTENSION}/resources/icon.png` },
nsis: { artifactName: 'Code-XR-IDE-Setup-${version}.${ext}', oneClick: false, allowToChangeInstallationDirectory: true, perMachine: false },
mac: {
target: ['dmg'],
category: 'public.app-category.developer-tools',
icon: `${EXTENSION}/resources/icon.png`,
// Not signed with a developer certificate nor notarised (thesis
// prototype). '-' signs ad hoc, which Apple silicon requires for any
// app to start at all; Gatekeeper still asks on first open (README).
identity: '-',
},
// No auto-update feed: an update check is a network call and needs consent
// (project principle); the IDE's opt-in check reads GitHub releases itself.
publish: null,
};
21 changes: 13 additions & 8 deletions apps/ide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"build": "node scripts/build.mjs",
"start": "node scripts/build.mjs && node scripts/start.mjs",
"smoke": "node scripts/build.mjs && node scripts/smoke.mjs",
"dist": "npm run compile --workspace=code-xr && node scripts/build.mjs && node ../../node_modules/electron-builder/cli.js --config electron-builder.config.cjs --publish never",
"typecheck": "node scripts/coreTypes.mjs && node ../../node_modules/typescript/bin/tsc -p tsconfig.node.json && node ../../node_modules/typescript/bin/tsc -p tsconfig.web.json",
"lint": "node ../../node_modules/eslint/bin/eslint.js src test scripts eslint.config.mjs --max-warnings 0",
"test:unit": "node --import ./scripts/testCoreAlias.mjs --test --experimental-strip-types \"test/**/*.test.ts\"",
Expand All @@ -21,17 +22,21 @@
},
"devDependencies": {
"@types/node": "^22.20.7",
"electron": "^45.5.0",
"material-icon-theme": "^5.40.0",
"vite": "^8.3.8"
},
"dependencies": {
"@xterm/addon-fit": "0.11.0",
"@xterm/xterm": "6.0.0",
"electron": "^45.5.0",
"electron-builder": "26.18.1",
"material-icon-theme": "^5.40.0",
"monaco-editor": "0.57.0",
"node-pty": "1.2.0-beta.18",
"typescript-language-server": "6.1.0",
"vite": "^8.3.8",
"vscode-jsonrpc": "9.0.3",
"vscode-languageserver-types": "3.18.4"
}
},
"dependencies": {
"node-pty": "1.2.0-beta.18",
"typescript": "5.8.3",
"typescript-language-server": "6.1.0"
},
"author": "Adrián Montes Linares",
"homepage": "https://github.com/Code-XR-Project/Code-XR"
}
5 changes: 5 additions & 0 deletions apps/ide/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { OutputService } from './outputPanel/outputService.ts';
import { COLOR_THEME_SETTING } from '../shared/settings.ts';
import { startCore, type CoreServices } from './core/coreRuntime.ts';
import { installApplicationMenu, setAboutDependencies } from './menu.ts';
import { checkForUpdates } from './updates/updateCheck.ts';
import { canRepair, describeDependencies, formatDependencies } from './dependencies/dependencyReport.ts';
import { createMainWindow } from './window.ts';
import { runSmoke, SMOKE_FLAG, SMOKE_RESULT_PREFIX } from './smoke.ts';
Expand Down Expand Up @@ -115,6 +116,10 @@ async function start(): Promise<void> {

const win = await openMainWindow();
log.info(`Window loaded from ${win.webContents.getURL()}${isDevelopment ? ' (dev server)' : ''}.`);
// #20: an update check is a network call, so it runs unasked only once the person turned it on.
if (!isSmoke && (await settings.snapshot(null)).effective['update.checkOnStartup'] === true) {
void checkForUpdates(win, { manual: false });
}

const startup = chooseStartupFolder(folderArgument(process.argv), recentFolderList(), isSmoke);
if (startup.kind !== 'none') {
Expand Down
Loading
Loading