From 7527cc4091f53ae75a93ad253c9b828f97ac9e3c Mon Sep 17 00:00:00 2001 From: Rune Olsen Date: Fri, 14 Aug 2026 11:06:05 +0200 Subject: [PATCH] Collapse the CLI Access shell snippet's curl call onto one line The multi-line backslash-continued curl command was fragile to copy/paste: a trailing space after \ or a dropped backslash (both common when pasting a multi-line snippet out of a chat UI or browser) silently breaks the continuation, so each following line gets parsed as its own bogus command instead of a curl flag - exactly what Rune hit ("command not found: -H", "-d", "no such file or directory: http://localhost/") after pasting the previous version. A long single line has no continuation character left to mangle. --- oAI/Views/Screens/SettingsView.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/oAI/Views/Screens/SettingsView.swift b/oAI/Views/Screens/SettingsView.swift index 9ce5b10..29381c7 100644 --- a/oAI/Views/Screens/SettingsView.swift +++ b/oAI/Views/Screens/SettingsView.swift @@ -1242,12 +1242,13 @@ It's better to admit "I need more information" or "I cannot do that" than to fak // function call. Quoting the prompt is still the fully robust habit for other shell metacharacters // (`;`, `|`, backticks, `$()`), but this covers the specific class of crash users are most likely // to hit by accident (an unquoted question ending in "?"). + // Deliberately one line, no backslash continuations: a `\` line-continuation is silently + // broken by a trailing space or a dropped backslash from copy/pasting out of a chat UI or + // browser — each following line then gets parsed as its own bogus command ("command not + // found: -H", etc.). A long single line has no continuation character to mangle. private static let cliShellFunctionSnippet = """ _ai_impl() { - curl -s --unix-socket "$HOME/Library/Application Support/oAI/cli.sock" \\ - -H "Content-Type: application/json" \\ - -d "$(jq -n --arg p "$*" '{prompt: $p}')" \\ - http://localhost/ | jq -r 'if .error then "Error: " + .error else .response end' + curl -s --unix-socket "$HOME/Library/Application Support/oAI/cli.sock" -H "Content-Type: application/json" -d "$(jq -n --arg p "$*" '{prompt: $p}')" http://localhost/ | jq -r 'if .error then "Error: " + .error else .response end' } alias ai='noglob _ai_impl' """