skalpel 4.0.19 → 4.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install.mjs +10 -1
- package/package.json +1 -1
package/install.mjs
CHANGED
|
@@ -238,8 +238,17 @@ function tomlMark(event, marker) {
|
|
|
238
238
|
return `${TOML_MARK} ${event} ${marker}`;
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
// Serialize a value into a TOML basic string. The wired command is `node "<path>"` — it ALWAYS
|
|
242
|
+
// contains double quotes, and on Windows the path is `C:\Users\First Last\...` full of backslashes.
|
|
243
|
+
// A raw `command = "${command}"` embeds those quotes unescaped (the string closes early) AND leaves
|
|
244
|
+
// backslashes as TOML escape sequences (`\U`, `\F`, `\.` are invalid) — either way the WHOLE
|
|
245
|
+
// config.toml fails to parse, so Codex drops all of the user's hooks. Escape `\` first, then `"`.
|
|
246
|
+
function tomlString(value) {
|
|
247
|
+
return `"${String(value).replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
248
|
+
}
|
|
249
|
+
|
|
241
250
|
function tomlBlock(event, marker, command) {
|
|
242
|
-
return `\n${tomlMark(event, marker)}\n[[hooks.${event}]]\n[[hooks.${event}.hooks]]\ntype = "command"\ncommand =
|
|
251
|
+
return `\n${tomlMark(event, marker)}\n[[hooks.${event}]]\n[[hooks.${event}.hooks]]\ntype = "command"\ncommand = ${tomlString(command)}\ntimeout = 8\n`;
|
|
243
252
|
}
|
|
244
253
|
|
|
245
254
|
function stripManagedTomlBlocks(txt) {
|