Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(auto-review): 数组命令确认按 argv 引用显示参数边界
Dash9acd02f28814
diff --git a/packages/maker-shared/src/__tests__/interaction.test.ts b/packages/maker-shared/src/__tests__/interaction.test.tsindex 61ad3d09af..4ab9faedf1 100644--- a/packages/maker-shared/src/__tests__/interaction.test.ts+++ b/packages/maker-shared/src/__tests__/interaction.test.ts@@ -308,6 +308,9 @@ describe('interaction shared model', () => {expect(describePermissionAction('mcp:cindy_browser:call_tool', {name: 'browser', args: { action: 'recipe', recipeId: 'post-reply', site: 'x.com', text: 'hello' },}).preview).toBe('recipe {"recipeId":"post-reply","site":"x.com","text":"hello"}');+ // argv arrays keep argument boundaries.+ expect(describePermissionAction('shell', { command: ['printf', '%s', 'a b', "it's", ''] }).preview)+ .toBe("printf %s 'a b' 'it'\\''s' ''");expect(describePermissionAction('exec', { command: 'rm -rf build', cwd: '/repo/app' }).preview).toBe('rm -rf build\n# cwd: /repo/app');expect(describePermissionAction('Grep', { pattern: 'AKIA', path: '/Users/me' }).preview).toBe('AKIA \u2192 /Users/me');diff --git a/packages/maker-shared/src/interaction.ts b/packages/maker-shared/src/interaction.tsindex 313aa8de3d..4a62e32fa9 100644--- a/packages/maker-shared/src/interaction.ts+++ b/packages/maker-shared/src/interaction.ts@@ -914,10 +914,17 @@ function argsPreview(args: Record<string, unknown>): string {return text.length > 500 ? `${text.slice(0, 500)}...` : text;}+function shellQuote(arg: string): string {+ return /^[A-Za-z0-9_\/.:=@%+,-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'\\''`)}'`;+}+function commandText(input: Record<string, unknown>): string | null {const command = input.command ?? input.cmd;if (typeof command === 'string' && command.trim()) return command;- if (Array.isArray(command) && command.every((part) => typeof part === 'string')) return command.join(' ');+ // argv arrays: quote each element so "one value with a space" and "two values" stay distinguishable.+ if (Array.isArray(command) && command.length > 0 && command.every((part) => typeof part === 'string')) {+ return command.map(shellQuote).join(' ');+ }return null;}