fix(tui): enforce supported platform boundaries

This commit is contained in:
Xubin Ren
2026-08-17 20:56:10 +08:00
parent 406509aeb8
commit 14c5607e5e
5 changed files with 26 additions and 2 deletions
+8 -1
View File
@@ -3,8 +3,15 @@ import { basename, join } from "node:path"
const target = process.argv[2] || `${process.platform}-${process.arch}`
const [platform, arch] = target.split("-")
const supportedTargets = new Set([
"darwin-arm64",
"darwin-x64",
"linux-arm64",
"linux-x64",
"win32-x64",
])
if (!platform || !arch || !["darwin", "linux", "win32"].includes(platform)) {
if (!platform || !arch || !supportedTargets.has(target)) {
throw new Error(`unsupported target: ${target}`)
}
+1
View File
@@ -637,6 +637,7 @@ if (process.platform !== "win32") {
NANOBOT_TUI_WORKSPACE: "/tmp/nanobot-test",
NANOBOT_TUI_VERSION: "test",
NANOBOT_TUI_ACCESS: "workspace access",
NANOBOT_TUI_THEME: "dark",
},
stdout: "pipe",
stderr: "pipe",