Files
openclaw/scripts/e2e/lib/onboard/write-config.mjs
Shakker b8f5aa8ec8 fix: keep skip-ui onboarding on guided flow (#118737)
Keep `openclaw onboard --skip-ui` and `openclaw setup --skip-ui` on guided onboarding while suppressing browser and terminal handoffs.

Refs #118388 and #118038.
Prepared head SHA: 4e284c4523
Co-authored-by: Shakker <165377636+shakkernerd@users.noreply.github.com>
Reviewed-by: @shakkernerd
2026-08-03 18:03:01 +01:00

41 lines
1.4 KiB
JavaScript

// Config writer helper for onboard E2E scenarios.
import fs from "node:fs";
import { applyMockOpenAiModelConfig } from "../fixtures/mock-openai-config.mjs";
const [scenario, configPath, ...scenarioArgs] = process.argv.slice(2);
if (!scenario || !configPath) {
throw new Error("usage: write-config.mjs <reset|skills|guided-skip-ui> <config-path> [...args]");
}
let config;
if (scenario === "guided-skip-ui") {
const [workspace, mockPort] = scenarioArgs;
if (!workspace || !mockPort) {
throw new Error("guided-skip-ui requires workspace and mock OpenAI port arguments");
}
config = {
gateway: { mode: "local", bind: "loopback", controlUi: { enabled: false } },
agents: { defaults: { workspace } },
wizard: {
securityAcknowledgedAt: "2026-01-01T00:00:00.000Z",
accessMode: "full",
appRecommendations: false,
},
};
applyMockOpenAiModelConfig(config, { mockPort });
} else {
config = {
reset: {
meta: {},
agents: { defaults: { workspace: "/root/old" } },
gateway: { mode: "remote", remote: { url: "ws://old.example:18789", token: "old-token" } },
},
skills: { meta: {}, skills: { allowBundled: ["__none__"], install: { nodeManager: "bun" } } },
}[scenario];
}
if (!config) {
throw new Error(`unknown config scenario: ${scenario}`);
}
fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`);