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.
Files changed (2) hide show
  1. package/install.mjs +10 -1
  2. 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 = "${command}"\ntimeout = 8\n`;
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skalpel",
3
- "version": "4.0.19",
3
+ "version": "4.0.20",
4
4
  "description": "Behavioral graph for AI-assisted coding — learns how you work and steers Claude Code + Codex in real time.",
5
5
  "type": "module",
6
6
  "bin": {