docs(config): quote bracket config paths (#83058)

This commit is contained in:
吴杨帆
2026-05-23 03:20:10 +08:00
committed by GitHub
parent 14b2b8ac48
commit 88f50e8cd1
4 changed files with 47 additions and 7 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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([]);
});
});