From c9cfbcfa10374dfd6056caaa1cfa8d3f2177cc78 Mon Sep 17 00:00:00 2001 From: imccyu <276526105+imccyu@users.noreply.github.com> Date: Fri, 13 Nov 2026 15:24:41 +0800 Subject: [PATCH] feat(ptc): limit String.raw and write file contents as quoted line arrays Add two sentences to the Node run_code output instructions shared by every execution mode: use the raw form of a template literal only for short text whose backslashes must stay as written, write other text as ordinary strings, and write file contents as an array of quoted line strings joined with newlines. --- packages/ptc-runtime/ptc-runtime-node/src/execution.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/ptc-runtime/ptc-runtime-node/src/execution.ts b/packages/ptc-runtime/ptc-runtime-node/src/execution.ts index 2d64356269..2362247ed2 100644 --- a/packages/ptc-runtime/ptc-runtime-node/src/execution.ts +++ b/packages/ptc-runtime/ptc-runtime-node/src/execution.ts @@ -147,6 +147,9 @@ function scopedReplMode(outputInstructions: string): ExecutionMode { function resolveMode(config: ResolvedConfig): ExecutionMode { const outputInstructions = 'Use inspect(...values) to display output. Do not use console.' + + ' Use the raw form of a template literal only for short text whose backslashes must stay exactly as written, such as a regular expression;' + + ' write other text, in particular file contents and commands, as ordinary strings.' + + ' Write file contents as an array of quoted strings, one line each, joined with newlines; never as one template literal.' switch (config.executionMode) { case 'per-call': return { format: 'function-body',