openclaw/src/commands/onboard-non-interactive/local/skills-config.ts

30 lines
807 B
TypeScript

import type { ClawdbotConfig } from "../../../config/config.js";
import type { RuntimeEnv } from "../../../runtime.js";
import type { OnboardOptions } from "../../onboard-types.js";
export function applyNonInteractiveSkillsConfig(params: {
nextConfig: ClawdbotConfig;
opts: OnboardOptions;
runtime: RuntimeEnv;
}) {
const { nextConfig, opts, runtime } = params;
if (opts.skipSkills) return nextConfig;
const nodeManager = opts.nodeManager ?? "npm";
if (!["npm", "pnpm", "bun"].includes(nodeManager)) {
runtime.error("Invalid --node-manager (use npm, pnpm, or bun)");
runtime.exit(1);
return nextConfig;
}
return {
...nextConfig,
skills: {
...nextConfig.skills,
install: {
...nextConfig.skills?.install,
nodeManager,
},
},
};
}