mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-10 02:24:35 +08:00
feat: 优化 CLI 工具配置管理,动态加载工具并简化配置路径
This commit is contained in:
@@ -10,8 +10,12 @@ const WINDOWS_METACHARS = /[&|<>()%!"]/g;
|
||||
export function escapeWindowsArg(arg: string): string {
|
||||
if (arg === '') return '""';
|
||||
|
||||
// Normalize newlines to spaces to prevent cmd.exe from
|
||||
// misinterpreting multiline arguments (breaks argument parsing)
|
||||
let sanitizedArg = arg.replace(/\r?\n/g, ' ');
|
||||
|
||||
// Escape caret first to avoid double-escaping when prefixing other metachars.
|
||||
let escaped = arg.replace(/\^/g, '^^');
|
||||
let escaped = sanitizedArg.replace(/\^/g, '^^');
|
||||
|
||||
// Escape cmd.exe metacharacters with caret.
|
||||
escaped = escaped.replace(WINDOWS_METACHARS, '^$&');
|
||||
|
||||
Reference in New Issue
Block a user