diff --git a/docs/cli/config.md b/docs/cli/config.md index 7b93fd6a80b6..6fd3832d93cf 100644 --- a/docs/cli/config.md +++ b/docs/cli/config.md @@ -31,7 +31,7 @@ openclaw config get browser.executablePath openclaw config set browser.executablePath "/usr/bin/google-chrome" openclaw config set browser.profiles.work.executablePath "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" openclaw config set agents.defaults.heartbeat.every "2h" -openclaw config set agents.list[0].tools.exec.node "node-id-or-name" +openclaw config set 'agents.list[0].tools.exec.node' "node-id-or-name" openclaw config set agents.defaults.models '{"openai/gpt-5.4":{}}' --strict-json --merge openclaw config set channels.discord.token --ref-provider default --ref-source env --ref-id DISCORD_BOT_TOKEN openclaw config set secrets.providers.vaultfile --provider-source file --provider-path /etc/openclaw/secrets.json --provider-mode json @@ -73,18 +73,18 @@ openclaw config schema > openclaw.schema.json ### Paths -Paths use dot or bracket notation: +Paths use dot or bracket notation. Quote bracket-notation paths in shell examples so shells such as zsh do not expand `[0]` as a glob before OpenClaw receives the path: ```bash openclaw config get agents.defaults.workspace -openclaw config get agents.list[0].id +openclaw config get 'agents.list[0].id' ``` Use the agent list index to target a specific agent: ```bash openclaw config get agents.list -openclaw config set agents.list[1].tools.exec.node "node-id-or-name" +openclaw config set 'agents.list[1].tools.exec.node' "node-id-or-name" ``` ## Values diff --git a/docs/nodes/index.md b/docs/nodes/index.md index 7f2460502a8f..2d90a8940b7e 100644 --- a/docs/nodes/index.md +++ b/docs/nodes/index.md @@ -396,14 +396,14 @@ Per-agent override: ```bash openclaw config get agents.list -openclaw config set agents.list[0].tools.exec.node "node-id-or-name" +openclaw config set 'agents.list[0].tools.exec.node' "node-id-or-name" ``` Unset to allow any node: ```bash openclaw config unset tools.exec.node -openclaw config unset agents.list[0].tools.exec.node +openclaw config unset 'agents.list[0].tools.exec.node' ``` ## Permissions map diff --git a/docs/tools/exec.md b/docs/tools/exec.md index 39db0b6888cd..73bfba9f4850 100644 --- a/docs/tools/exec.md +++ b/docs/tools/exec.md @@ -145,7 +145,7 @@ Per-agent node binding (use the agent list index in config): ```bash openclaw config get agents.list -openclaw config set agents.list[0].tools.exec.node "node-id-or-name" +openclaw config set 'agents.list[0].tools.exec.node' "node-id-or-name" ``` Control UI: the Nodes tab includes a small "Exec node binding" panel for the same settings. diff --git a/src/docs/config-path-docs.test.ts b/src/docs/config-path-docs.test.ts new file mode 100644 index 000000000000..bc8ac4707789 --- /dev/null +++ b/src/docs/config-path-docs.test.ts @@ -0,0 +1,40 @@ +import fs from "node:fs/promises"; +import path from "node:path"; +import { describe, expect, it } from "vitest"; + +const DOCS_WITH_CONFIG_PATH_EXAMPLES = [ + "docs/cli/config.md", + "docs/tools/exec.md", + "docs/nodes/index.md", +]; + +function findUnquotedBracketPathExamples(markdown: string, docPath: string): string[] { + const failures: string[] = []; + + for (const [index, line] of markdown.split(/\r?\n/).entries()) { + const match = line.match(/\bopenclaw\s+config\s+(?:get|set|unset)\s+(\S+)/); + if (!match) { + continue; + } + + const pathArg = match[1]; + if (pathArg.includes("[") && !pathArg.startsWith("'") && !pathArg.startsWith('"')) { + failures.push(`${docPath}:${index + 1}: ${pathArg}`); + } + } + + return failures; +} + +describe("config path docs", () => { + it("quotes bracket-notation config paths in shell examples", async () => { + const failures: string[] = []; + + for (const docPath of DOCS_WITH_CONFIG_PATH_EXAMPLES) { + const markdown = await fs.readFile(path.join(process.cwd(), docPath), "utf8"); + failures.push(...findUnquotedBracketPathExamples(markdown, docPath)); + } + + expect(failures).toEqual([]); + }); +});