mirror of
https://github.com/NeuralNomadsAI/CodeNomad.git
synced 2026-10-21 05:06:37 +00:00
## Summary Retire the prerelease private OpenCode installation completely as an executable source. Automatic selection now uses PATH and the conventional shared user npm installation. Existing private files are neither migrated nor deleted. - Remove the private installer, receipt reader and fallback introduced/retained by #756. - Ignore saved private selections and reject validation/launch from `~/.local/share/codenomad/opencode`, including private PATH entries. Prevent installation into that retired prefix. - Remove private-copy descriptions from all ten locales and update the runtime policy documentation. - Keep supported custom installations, native shared-service ownership/authentication and explicit restart behavior. ## Reproduction and scope The initial genuinely empty-profile test passed, but it did not match the affected machine: that machine had no Git and retained a private prerelease OpenCode copy. On the exact installed `v0.20.0-dev-20260923-baf674fc` Tauri artifact, seeding a valid private copy plus its `selected` receipt and `current` marker makes setup report `state: ready`, `installationSource: legacy`, and suppresses the missing-installation screen. The new desktop regression fails against that release with `ready !== missing`. With rebuilt server/UI resources in an isolated copy of the same Tauri host, the identical private-copy scenario reports missing, offers installation, installs the shared npm package, authenticates OpenCode 2.0.15 and resumes the requested folder without Git. This demonstrates the missing-setup cause; it does not claim to explain every initially reported startup slowdown. ## Validation - 59 targeted server tests passed: discovery/install/update, retired paths, binary selection, Windows/WSL spawn and binary validation routes. - 13 real-component setup browser tests passed. - 23 focused retirement/launch tests passed after the final network-path preflight adjustment. - UI TypeScript check passed; production server/UI/automation/pruning build passed. - Installed-release private-copy reproduction failed as expected; corrected isolated Tauri acceptance passed. - `git diff --check` passed. Desktop qualification uses isolated profiles, services and databases. The sole simulated installation side effect is HKCU PATH registration, captured by a fixture preload; bundled npm installation, package verification, native-parent service start and authenticated API checks are real. The shared user daemon and installed application were not replaced by the fix. Remote CI is pending. ## Maintenance notes Existing oversized files touched: `packages/server/src/api-types.ts` (~583 lines) and `packages/ui/src/lib/i18n/messages/*/settings.ts` (~625–639 lines). No size-only refactor is included.
25 lines
1.2 KiB
JavaScript
25 lines
1.2 KiB
JavaScript
// Isolate the sole HKCU side effect of the packaged installer. Every other
|
|
// process (bundled npm, CLI, native service start) executes normally.
|
|
const cp = require("node:child_process")
|
|
const fs = require("node:fs")
|
|
const path = require("node:path")
|
|
const { syncBuiltinESMExports } = require("node:module")
|
|
const original = cp.execFile
|
|
cp.execFile = function (file, args, options, callback) {
|
|
const index = args?.indexOf("-EncodedCommand") ?? -1
|
|
if (/powershell\.exe$/i.test(file) && index >= 0) {
|
|
const script = Buffer.from(args[index + 1], "base64").toString("utf16le")
|
|
if (script.includes("CodeNomad.EnvironmentBroadcast") && script.includes("CurrentUser.CreateSubKey('Environment')")) {
|
|
const home = process.env.OPENCODE_TEST_HOME
|
|
const prefix = path.join(process.env.APPDATA, "npm")
|
|
if (!home || !prefix.startsWith(home + path.sep) || !script.includes(`$bin = '${prefix.replaceAll("'", "''")}'`)) {
|
|
throw new Error("Refusing non-fixture PATH registration")
|
|
}
|
|
fs.writeFileSync(path.join(home, "path-registration.json"), JSON.stringify({ prefix }))
|
|
queueMicrotask(() => callback(null, "", ""))
|
|
return
|
|
}
|
|
}
|
|
return original.apply(this, arguments)
|
|
}
|
|
syncBuiltinESMExports()
|