fix(plugin-sdk): keep CLI quoting helper private · openclaw/openclaw@23b4f33
steipete
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,13 +10,6 @@ const UPDATE_COMMAND_RE =
|
10 | 10 | /^(?:pnpm|npm|bunx|npx)\s+openclaw\b.*(?:^|\s)update(?:\s|$)|^openclaw\b.*(?:^|\s)update(?:\s|$)/; |
11 | 11 | const CONTAINER_HINT_RE = /^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/; |
12 | 12 | |
13 | | -export function quoteCliArg(value: string): string { |
14 | | -if (/^[A-Za-z0-9_/:=.,@%+-]+$/.test(value)) { |
15 | | -return value; |
16 | | -} |
17 | | -return `'${value.replaceAll("'", "'\\''")}'`; |
18 | | -} |
19 | | - |
20 | 13 | /** Add active root options to a displayed command without duplicating explicit flags. */ |
21 | 14 | export function formatCliCommand( |
22 | 15 | command: string, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -38,9 +38,10 @@ import {
|
38 | 38 | type DevicePairingAccessSummary, |
39 | 39 | type PendingDeviceApprovalKind, |
40 | 40 | } from "../shared/device-pairing-access.js"; |
41 | | -import { formatCliCommand, quoteCliArg } from "./command-format.js"; |
| 41 | +import { formatCliCommand } from "./command-format.js"; |
42 | 42 | import { parseTimeoutMsWithFallback } from "./parse-timeout.js"; |
43 | 43 | import { withProgress } from "./progress.js"; |
| 44 | +import { quoteCliArg } from "./quote-cli-arg.js"; |
44 | 45 | |
45 | 46 | type DevicesRpcOpts = { |
46 | 47 | url?: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,8 +11,9 @@ import { formatErrorMessage } from "../../infra/errors.js";
|
11 | 11 | import { formatTimeAgo } from "../../infra/format-time/format-relative.ts"; |
12 | 12 | import { defaultRuntime } from "../../runtime.js"; |
13 | 13 | import { shortenHomeInString } from "../../utils.js"; |
14 | | -import { formatCliCommand, quoteCliArg } from "../command-format.js"; |
| 14 | +import { formatCliCommand } from "../command-format.js"; |
15 | 15 | import { parseDurationMs } from "../parse-duration.js"; |
| 16 | +import { quoteCliArg } from "../quote-cli-arg.js"; |
16 | 17 | import { getNodesTheme, runNodesCommand } from "./cli-utils.js"; |
17 | 18 | import { formatPermissions, parseNodeList, parsePairingList } from "./format.js"; |
18 | 19 | import { renderPendingPairingRequestsTable } from "./pairing-render.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +export function quoteCliArg(value: string): string { |
| 2 | +if (/^[A-Za-z0-9_/:=.,@%+-]+$/.test(value)) { |
| 3 | +return value; |
| 4 | +} |
| 5 | +return `'${value.replaceAll("'", "'\\''")}'`; |
| 6 | +} |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,8 @@ import path from "node:path";
|
3 | 3 | import { normalizeUniqueSingleOrTrimmedStringList } from "@openclaw/normalization-core/string-normalization"; |
4 | 4 | import { note } from "../../packages/terminal-core/src/note.js"; |
5 | 5 | import { sanitizeTerminalText } from "../../packages/terminal-core/src/safe-text.js"; |
6 | | -import { formatCliCommand, quoteCliArg } from "../cli/command-format.js"; |
| 6 | +import { formatCliCommand } from "../cli/command-format.js"; |
| 7 | +import { quoteCliArg } from "../cli/quote-cli-arg.js"; |
7 | 8 | import { resolveStateDir } from "../config/paths.js"; |
8 | 9 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
9 | 10 | import { callGateway } from "../gateway/call.js"; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。