sticky-note-cli 2.8.1 → 2.8.2

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/bin/cli.js +30 -2
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -83,6 +83,28 @@ function readTemplate(name) {
83
83
  return fs.readFileSync(path.join(TEMPLATES_DIR, name), "utf-8");
84
84
  }
85
85
 
86
+ // Replace $(git rev-parse --show-toplevel) with absolute root path
87
+ // so hook commands work from any CWD without shell expansion.
88
+ function resolveHookPaths(obj, rootDir) {
89
+ const root = rootDir.replace(/\\/g, "/");
90
+ const resolve = (s) =>
91
+ s.replace(/"\$\(git rev-parse --show-toplevel\)\//g, `"${root}/`);
92
+ const hooks = obj.hooks || {};
93
+ for (const entries of Object.values(hooks)) {
94
+ for (const entry of Array.isArray(entries) ? entries : []) {
95
+ if (entry.hooks) {
96
+ for (const h of entry.hooks) {
97
+ if (h.command) h.command = resolve(h.command);
98
+ }
99
+ }
100
+ if (entry.bash) entry.bash = resolve(entry.bash);
101
+ if (entry.powershell) entry.powershell = resolve(entry.powershell);
102
+ if (entry.command) entry.command = resolve(entry.command);
103
+ }
104
+ }
105
+ return obj;
106
+ }
107
+
86
108
  function makeExecutable(filePath) {
87
109
  try {
88
110
  fs.chmodSync(filePath, 0o755);
@@ -551,12 +573,14 @@ async function cmdInit() {
551
573
 
552
574
  // Create settings.json (Claude Code)
553
575
  const settingsTemplate = JSON.parse(readTemplate("settings.json"));
576
+ resolveHookPaths(settingsTemplate, process.cwd());
554
577
  const settingsDest = path.join(process.cwd(), ".claude", "settings.json");
555
578
  fs.writeFileSync(settingsDest, JSON.stringify(settingsTemplate, null, 2) + "\n");
556
579
  print(" [OK] .claude/settings.json");
557
580
 
558
581
  // Create hooks.json (Copilot CLI)
559
582
  const hooksTemplate = JSON.parse(readTemplate("hooks.json"));
583
+ resolveHookPaths(hooksTemplate, process.cwd());
560
584
  const hooksDest = path.join(githubHooksDir, "hooks.json");
561
585
  fs.writeFileSync(hooksDest, JSON.stringify(hooksTemplate, null, 2) + "\n");
562
586
  print(" [OK] .github/hooks/hooks.json");
@@ -693,10 +717,11 @@ async function cmdInit() {
693
717
  copyFile(mergeDriverSrc, mergeDriverDest);
694
718
  print(" [OK] .sticky-note/merge-driver.js installed");
695
719
  try {
720
+ const mergeRoot = process.cwd().replace(/\\/g, "/");
696
721
  execFileSync("git", ["config", "merge.sticky-note.name", "Sticky Note thread merge"], {
697
722
  cwd: process.cwd(), stdio: ["pipe", "pipe", "pipe"],
698
723
  });
699
- execFileSync("git", ["config", "merge.sticky-note.driver", "node \"$(git rev-parse --show-toplevel)/.sticky-note/merge-driver.js\" %O %A %B"], {
724
+ execFileSync("git", ["config", "merge.sticky-note.driver", `node "${mergeRoot}/.sticky-note/merge-driver.js" %O %A %B`], {
700
725
  cwd: process.cwd(), stdio: ["pipe", "pipe", "pipe"],
701
726
  });
702
727
  print(" [OK] git merge driver configured (merge.sticky-note)");
@@ -872,6 +897,7 @@ function cmdUpdate() {
872
897
  const settingsPath = path.join(process.cwd(), ".claude", "settings.json");
873
898
  if (fs.existsSync(settingsPath)) {
874
899
  const settingsTemplate = JSON.parse(readTemplate("settings.json"));
900
+ resolveHookPaths(settingsTemplate, process.cwd());
875
901
  const existing = JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
876
902
  existing.hooks = settingsTemplate.hooks;
877
903
  fs.writeFileSync(settingsPath, JSON.stringify(existing, null, 2) + "\n");
@@ -882,6 +908,7 @@ function cmdUpdate() {
882
908
  const hooksPath = path.join(process.cwd(), ".github", "hooks", "hooks.json");
883
909
  if (fs.existsSync(hooksPath)) {
884
910
  const hooksTemplate = JSON.parse(readTemplate("hooks.json"));
911
+ resolveHookPaths(hooksTemplate, process.cwd());
885
912
  fs.writeFileSync(hooksPath, JSON.stringify(hooksTemplate, null, 2) + "\n");
886
913
  print(" [OK] .github/hooks/hooks.json (updated)");
887
914
  }
@@ -964,10 +991,11 @@ function cmdUpdate() {
964
991
 
965
992
  // Ensure git merge driver config is set
966
993
  try {
994
+ const mergeRoot = process.cwd().replace(/\\/g, "/");
967
995
  execFileSync("git", ["config", "merge.sticky-note.name", "Sticky Note thread merge"], {
968
996
  cwd: process.cwd(), stdio: ["pipe", "pipe", "pipe"],
969
997
  });
970
- execFileSync("git", ["config", "merge.sticky-note.driver", "node \"$(git rev-parse --show-toplevel)/.sticky-note/merge-driver.js\" %O %A %B"], {
998
+ execFileSync("git", ["config", "merge.sticky-note.driver", `node "${mergeRoot}/.sticky-note/merge-driver.js" %O %A %B`], {
971
999
  cwd: process.cwd(), stdio: ["pipe", "pipe", "pipe"],
972
1000
  });
973
1001
  print(" [OK] git merge driver configured (merge.sticky-note)");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sticky-note-cli",
3
- "version": "2.8.1",
3
+ "version": "2.8.2",
4
4
  "description": "Human-to-human handoff for AI coding assistants. Git-backed shared memory for Claude Code and Copilot CLI.",
5
5
  "license": "MIT",
6
6
  "bin": {