sticky-note-cli 3.1.5 → 3.1.6

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
@@ -2952,25 +2952,43 @@ function provisionCloudBackend() {
2952
2952
  return { error: "sticky-server/worker.js not found. Make sure you have the full sticky-note package." };
2953
2953
  }
2954
2954
 
2955
- // Step 1: KV namespace
2955
+ // Step 1: KV namespace — create or reuse existing
2956
2956
  print(" Step 1: Creating KV namespace...");
2957
- let kvResult;
2957
+ let namespaceId = null;
2958
2958
  try {
2959
- kvResult = execSync("wrangler kv:namespace create STICKY_KV", {
2959
+ const kvResult = execSync("wrangler kv namespace create STICKY_KV", {
2960
2960
  cwd: serverDir,
2961
2961
  encoding: "utf-8",
2962
2962
  stdio: ["pipe", "pipe", "pipe"],
2963
2963
  });
2964
+ const idMatch = kvResult.match(/id\s*=\s*"([^"]+)"/);
2965
+ if (idMatch) namespaceId = idMatch[1];
2964
2966
  print(" [OK] KV namespace created");
2965
2967
  } catch (err) {
2966
- return { error: "Failed to create KV namespace: " + (err.message || err) + "\n Make sure you're logged in: wrangler login" };
2968
+ if (err.message && err.message.includes("already exists")) {
2969
+ // Reuse the existing namespace
2970
+ print(" [OK] KV namespace already exists — retrieving ID...");
2971
+ try {
2972
+ const listResult = execSync("wrangler kv namespace list", {
2973
+ cwd: serverDir,
2974
+ encoding: "utf-8",
2975
+ stdio: ["pipe", "pipe", "pipe"],
2976
+ });
2977
+ const namespaces = JSON.parse(listResult);
2978
+ const existing = namespaces.find(ns => ns.title === "STICKY_KV");
2979
+ if (existing) namespaceId = existing.id;
2980
+ } catch (listErr) {
2981
+ return { error: "KV namespace exists but could not retrieve ID: " + (listErr.message || listErr) };
2982
+ }
2983
+ } else {
2984
+ return { error: "Failed to create KV namespace: " + (err.message || err) + "\n Make sure you're logged in: wrangler login" };
2985
+ }
2967
2986
  }
2968
2987
 
2969
- const idMatch = kvResult.match(/id\s*=\s*"([^"]+)"/);
2970
- if (idMatch) {
2988
+ if (namespaceId) {
2971
2989
  const tomlPath = path.join(serverDir, "wrangler.toml");
2972
2990
  let toml = fs.readFileSync(tomlPath, "utf-8");
2973
- toml = toml.replace("PLACEHOLDER_KV_NAMESPACE_ID", idMatch[1]);
2991
+ toml = toml.replace("PLACEHOLDER_KV_NAMESPACE_ID", namespaceId);
2974
2992
  fs.writeFileSync(tomlPath, toml);
2975
2993
  print(" [OK] wrangler.toml updated with namespace ID");
2976
2994
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sticky-note-cli",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
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": {
@@ -34,6 +34,6 @@
34
34
  "test": "node test/smoke.test.js"
35
35
  },
36
36
  "devDependencies": {
37
- "sticky-note-cli": "^3.1.3"
37
+ "sticky-note-cli": "^3.1.5"
38
38
  }
39
39
  }
@@ -3,6 +3,7 @@
3
3
 
4
4
  # Sticky Note - local overrides
5
5
  .claude/settings.local.json
6
+ .env.sticky
6
7
 
7
8
  # Sticky Note - transient session/resume signals
8
9
  .sticky-note/.sticky-session