From a359ffa6d5e6478d395283b0811d90fba9413832 Mon Sep 17 00:00:00 2001 From: Leonid Bugaev Date: Sun, 15 Feb 2026 16:15:57 +0000 Subject: [PATCH] fix: remove normalizeNodeEval that breaks multiline node -e scripts The normalizeNodeEval function replaced real newlines with literal \n in node -e script arguments. This broke multiline scripts loaded from YAML exec blocks (e.g. slack-send-dm workflow) because Node.js received the entire script as a single line with literal \n sequences instead of actual newlines, causing SyntaxError: Invalid or unexpected token. Commands are executed via child_process.exec() which passes them through /bin/sh -c, so multiline content inside quoted arguments is preserved correctly by the shell. The normalization was unnecessary and harmful. Co-Authored-By: Claude Opus 4.6 --- src/providers/command-check-provider.ts | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/providers/command-check-provider.ts b/src/providers/command-check-provider.ts index 2db9d22bf..507930e27 100644 --- a/src/providers/command-check-provider.ts +++ b/src/providers/command-check-provider.ts @@ -283,27 +283,10 @@ export class CommandCheckProvider extends CheckProvider { // Get timeout from config (in milliseconds) or use default (60 seconds = 60000ms) const timeoutMs = (config.timeout as number) || 60000; - // Normalize only the eval payload for `node -e|--eval` invocations that may contain - // literal newlines due to YAML processing ("\n" -> newline). We re-escape newlines - // inside the quoted eval argument to keep JS string literals valid, without touching - // the rest of the command. - const normalizeNodeEval = (cmd: string): string => { - const re = - /^(?\s*(?:\/usr\/bin\/env\s+)?node(?:\.exe)?\s+(?:-e|--eval)\s+)(['"])([\s\S]*?)\2(?\s|$)/; - const m = cmd.match(re) as - | (RegExpMatchArray & { groups?: { prefix: string; suffix?: string } }) - | null; - if (!m || !m.groups) return cmd; - const prefix = m.groups.prefix; - const quote = m[2]; - const code = m[3]; - const suffix = m.groups.suffix || ''; - if (!code.includes('\n')) return cmd; - const escaped = code.replace(/\n/g, '\\n'); - return cmd.replace(re, `${prefix}${quote}${escaped}${quote}${suffix}`); - }; - - const safeCommand = normalizeNodeEval(renderedCommand); + // Commands are executed via child_process.exec() which passes them through + // /bin/sh -c, so multiline scripts (e.g. node -e '...') work correctly as-is. + // The shell preserves newlines inside quoted arguments. + const safeCommand = renderedCommand; // Determine working directory - use workspace if enabled, otherwise default const parentContext = (context as any)?._parentContext;