attestari 2.9.1 → 2.9.3

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/dist/hook.js +11 -7
  2. package/package.json +1 -1
package/dist/hook.js CHANGED
@@ -1434,10 +1434,14 @@ function scopes(home2, cwd) {
1434
1434
  function quoted(path) {
1435
1435
  return /[\s"]/.test(path) ? `"${path.replace(/"/g, '\\"')}"` : path;
1436
1436
  }
1437
- function hookCommands(node, hook2) {
1437
+ function powershellQuoted(path) {
1438
+ return `'${path.replace(/'/g, "''")}'`;
1439
+ }
1440
+ function hookCommands(node, hook2, platform2 = process.platform) {
1441
+ const program = platform2 === "win32" ? `& ${powershellQuoted(node)} ${powershellQuoted(hook2)}` : `${quoted(node)} ${quoted(hook2)}`;
1438
1442
  return {
1439
- preToolUse: `${quoted(node)} ${quoted(hook2)} codex pre-tool-use`,
1440
- sessionStart: `${quoted(node)} ${quoted(hook2)} codex session-start`
1443
+ preToolUse: `${program} codex pre-tool-use`,
1444
+ sessionStart: `${program} codex session-start`
1441
1445
  };
1442
1446
  }
1443
1447
  var MINE = /attestari.*\bcodex (pre-tool-use|session-start)\b/;
@@ -1453,11 +1457,11 @@ function withHandler(groups, matcher, handler) {
1453
1457
  cleaned[at] = { ...group, hooks: [...group.hooks, handler] };
1454
1458
  return cleaned;
1455
1459
  }
1456
- function install(home2, hookFile = __filename, node = process.execPath) {
1460
+ function install(home2, hookFile = __filename, node = process.execPath, platform2 = process.platform) {
1457
1461
  const copy = (0, import_node_path7.join)(home2, COPY);
1458
1462
  (0, import_node_fs6.mkdirSync)((0, import_node_path7.join)(home2, ".attestari"), { recursive: true });
1459
1463
  (0, import_node_fs6.copyFileSync)(hookFile, copy);
1460
- const commands = hookCommands(node, copy);
1464
+ const commands = hookCommands(node, copy, platform2);
1461
1465
  const file = (0, import_node_path7.join)(home2, ".codex", "hooks.json");
1462
1466
  const read = bytesOf(file);
1463
1467
  const text = read === null ? null : read.toString("utf8");
@@ -1874,7 +1878,7 @@ var import_node_http = require("node:http");
1874
1878
  var import_node_https = require("node:https");
1875
1879
 
1876
1880
  // src/version.ts
1877
- var HOOK_VERSION = "2.9.1";
1881
+ var HOOK_VERSION = "2.9.3";
1878
1882
 
1879
1883
  // src/api.ts
1880
1884
  var timeoutMs = 1e4;
@@ -2355,7 +2359,7 @@ function notBuilt(name) {
2355
2359
  return 2;
2356
2360
  }
2357
2361
  function stdin() {
2358
- return (0, import_node_fs11.readFileSync)(0, "utf8");
2362
+ return (0, import_node_fs11.readFileSync)(0, "utf8").replace(/^/, "");
2359
2363
  }
2360
2364
  var COMMANDS = {
2361
2365
  status: () => status(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attestari",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "description": "The Attestari Protect hook: one file, no dependency, run by each agent itself.",
5
5
  "license": "MIT",
6
6
  "bin": {