sticky-note-cli 2.8.0 → 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.
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.0",
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": {
@@ -186,6 +186,18 @@ after. A raw `git checkout` or `git switch` will fail if sticky-note
186
186
  files have uncommitted changes. The alias `git sw <branch>` also works
187
187
  if set up by `npx sticky-note init`.
188
188
 
189
+ ### Pulling changes
190
+
191
+ **IMPORTANT:** Before pulling remote changes, always use:
192
+ ```bash
193
+ npx sticky-note pull
194
+ ```
195
+ This auto-commits `.sticky-note/` tracking data before pulling, preventing
196
+ "local changes would be overwritten" errors. The alias `git spull` also
197
+ works if set up by `npx sticky-note init`. The PreToolUse hook handles
198
+ this automatically for AI tool calls, but prefer `git spull` when running
199
+ git commands directly.
200
+
189
201
  ### ⚠️ Overlap warnings
190
202
 
191
203
  Sticky-note detects when your files overlap with other teammates'
@@ -189,6 +189,18 @@ after. A raw `git checkout` or `git switch` will fail if sticky-note
189
189
  files have uncommitted changes. The alias `git sw <branch>` also works
190
190
  if set up by `npx sticky-note init`.
191
191
 
192
+ ### Pulling changes
193
+
194
+ **IMPORTANT:** Before pulling remote changes, always use:
195
+ ```bash
196
+ npx sticky-note pull
197
+ ```
198
+ This auto-commits `.sticky-note/` tracking data before pulling, preventing
199
+ "local changes would be overwritten" errors. The alias `git spull` also
200
+ works if set up by `npx sticky-note init`. The PreToolUse hook handles
201
+ this automatically for AI tool calls, but prefer `git spull` when running
202
+ git commands directly.
203
+
192
204
  ### ⚠️ Overlap warnings
193
205
 
194
206
  Sticky-note detects when your files overlap with other teammates'