sticky-note-cli 3.1.26 → 3.1.28

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
@@ -369,6 +369,30 @@ function ensureMcpInCopilotCliConfig(serverName, serverConfig) {
369
369
  }
370
370
  }
371
371
 
372
+ // ──────────────────────────────────────────────
373
+ // Sticky dir resolution (mirrors mcp-server.js stickyDir())
374
+ // ──────────────────────────────────────────────
375
+
376
+ // Returns the active sticky-note data directory for the current project.
377
+ // Mirrors the same logic as stickyDir() in mcp-server.js: prefers the
378
+ // data-branch worktree at <git-dir>/sticky-note/ if it has sticky-note.json,
379
+ // falls back to the in-tree .sticky-note/ directory.
380
+ function getActiveStickyDir(cwd) {
381
+ const root = cwd || process.cwd();
382
+ try {
383
+ const gitDir = execFileSync("git", ["rev-parse", "--absolute-git-dir"], {
384
+ encoding: "utf-8", timeout: 3000, stdio: ["pipe", "pipe", "pipe"], cwd: root,
385
+ }).trim();
386
+ const dataBranchDir = path.join(gitDir, "sticky-note");
387
+ if (fs.existsSync(path.join(dataBranchDir, "sticky-note.json"))) {
388
+ return dataBranchDir;
389
+ }
390
+ } catch (_) {
391
+ // not a git repo or git unavailable — fall through
392
+ }
393
+ return path.join(root, ".sticky-note");
394
+ }
395
+
372
396
  // ──────────────────────────────────────────────
373
397
  // Auto-detection
374
398
  // ──────────────────────────────────────────────
@@ -1088,8 +1112,9 @@ async function cmdInit() {
1088
1112
  print(" [OK] Skipping git pre/post-commit hooks (data branch sync handles this now)");
1089
1113
  print(" Run `npx sticky-note migrate` to migrate existing .sticky-note/ data.");
1090
1114
 
1091
- // Create environment directory structure
1092
- const envDir = path.join(stickyNoteDir, "environment");
1115
+ // Create environment directory structure.
1116
+ // Uses getActiveStickyDir() so re-runs on repos with a data branch write to the right place.
1117
+ const envDir = path.join(getActiveStickyDir(), "environment");
1093
1118
  const envManifestDest = path.join(envDir, "manifest.json");
1094
1119
  mkdirSafe(path.join(envDir, "skills"));
1095
1120
  mkdirSafe(path.join(envDir, "agents"));
@@ -1132,7 +1157,7 @@ async function cmdInit() {
1132
1157
  print(` [OK] Copied ${skills.length} detected skill(s) to environment/skills/`);
1133
1158
  }
1134
1159
  }
1135
- print(" [OK] Created environment directory (.sticky-note/environment/)");
1160
+ print(` [OK] Created environment directory (${envDir})`);
1136
1161
 
1137
1162
  // Force-add .claude/hooks/ and .claude/settings.json so git tracks them
1138
1163
  // (needed if .claude/ was previously in .gitignore)
@@ -1426,8 +1451,10 @@ function cmdUpdate() {
1426
1451
  }
1427
1452
  } catch (_) { /* non-fatal */ }
1428
1453
 
1429
- // Create environment directory if missing (idempotent — skips if manifest already exists)
1430
- const envDir = path.join(stickyDir, "environment");
1454
+ // Create environment directory if missing (idempotent — skips if manifest already exists).
1455
+ // Uses getActiveStickyDir() to resolve the data-branch worktree path when applicable,
1456
+ // so it matches the same path the MCP server's stickyDir() resolves.
1457
+ const envDir = path.join(getActiveStickyDir(), "environment");
1431
1458
  const envManifestDest = path.join(envDir, "manifest.json");
1432
1459
  mkdirSafe(path.join(envDir, "skills"));
1433
1460
  mkdirSafe(path.join(envDir, "agents"));
@@ -1463,7 +1490,7 @@ function cmdUpdate() {
1463
1490
  }
1464
1491
  }
1465
1492
  fs.writeFileSync(envManifestDest, JSON.stringify(manifestData, null, 2) + "\n");
1466
- print(` [OK] Created .sticky-note/environment/ (${detectedServers.length} MCP server(s) detected)`);
1493
+ print(` [OK] Created environment/ in ${envDir} (${detectedServers.length} MCP server(s) detected)`);
1467
1494
  }
1468
1495
 
1469
1496
  print(`\n ✨ Scripts updated to v${VERSION}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sticky-note-cli",
3
- "version": "3.1.26",
3
+ "version": "3.1.28",
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": {