Skills: prefer active OpenClaw paths

This commit is contained in:
Shakker
2026-03-30 15:50:44 +01:00
committed by Shakker
parent 08d365f481
commit a3de1f5f55
12 changed files with 144 additions and 27 deletions

View File

@@ -153,7 +153,11 @@ export function registerDnsCli(program: Command) {
}).trimEnd(),
);
defaultRuntime.log("");
defaultRuntime.log(theme.heading("Recommended ~/.openclaw/openclaw.json:"));
defaultRuntime.log(
theme.heading(
"Recommended config ($OPENCLAW_CONFIG_PATH, default ~/.openclaw/openclaw.json):",
),
);
defaultRuntime.writeJson({
gateway: { bind: "auto" },
discovery: { wideArea: { enabled: true, domain: wideAreaDomain } },
@@ -248,7 +252,7 @@ export function registerDnsCli(program: Command) {
defaultRuntime.log("");
defaultRuntime.log(
theme.muted(
"Note: enable discovery.wideArea.enabled in ~/.openclaw/openclaw.json on the gateway and restart the gateway so it writes the DNS-SD zone.",
"Note: enable discovery.wideArea.enabled in the active OpenClaw config ($OPENCLAW_CONFIG_PATH, default ~/.openclaw/openclaw.json) on the gateway and restart the gateway so it writes the DNS-SD zone.",
),
);
}

View File

@@ -10,7 +10,7 @@ import { hasExplicitOptions } from "../command-options.js";
export function registerSetupCommand(program: Command) {
program
.command("setup")
.description("Initialize ~/.openclaw/openclaw.json and the agent workspace")
.description("Initialize the active OpenClaw config and agent workspace")
.addHelpText(
"after",
() =>

View File

@@ -282,7 +282,7 @@ export function formatSkillInfo(
` Save via CLI: ${formatCliCommand(`openclaw config set skills.entries.${safeSkillKey}.apiKey YOUR_KEY`)}`,
);
lines.push(
` Stored in: ${theme.muted("~/.openclaw/openclaw.json")} ${theme.muted(`(skills.entries.${safeSkillKey}.apiKey)`)}`,
` Stored in: ${theme.muted("$OPENCLAW_CONFIG_PATH")} ${theme.muted("(default: ~/.openclaw/openclaw.json)")}`,
);
}

View File

@@ -149,6 +149,36 @@ describe("skills-cli", () => {
expect(output).toContain("API_KEY");
});
it("shows API key storage guidance for the active config path", () => {
const report = createMockReport([
createMockSkill({
name: "env-aware-skill",
skillKey: "env-aware-skill",
primaryEnv: "API_KEY",
eligible: false,
requirements: {
bins: [],
anyBins: [],
env: ["API_KEY"],
config: [],
os: [],
},
missing: {
bins: [],
anyBins: [],
env: ["API_KEY"],
config: [],
os: [],
},
}),
]);
const output = formatSkillInfo(report, "env-aware-skill", {});
expect(output).toContain("OPENCLAW_CONFIG_PATH");
expect(output).toContain("default: ~/.openclaw/openclaw.json");
expect(output).toContain("skills.entries.env-aware-skill.apiKey");
});
it("normalizes text-presentation emoji selectors in info output", () => {
const report = createMockReport([
createMockSkill({