sticky-note-cli 3.1.15 → 3.1.17

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
@@ -3078,20 +3078,47 @@ function provisionCloudBackend() {
3078
3078
  return { error: "sticky-server/worker.js not found. Make sure you have the full sticky-note package." };
3079
3079
  }
3080
3080
 
3081
+ // Helper: run wrangler login interactively. Returns true on success.
3082
+ function wranglerLogin() {
3083
+ print("\n Authenticating with Cloudflare (this will open your browser)...\n");
3084
+ try {
3085
+ execSync("wrangler login", {
3086
+ stdio: ["pipe", "inherit", "inherit"],
3087
+ input: "y\n",
3088
+ encoding: "utf-8",
3089
+ });
3090
+ print("\n [OK] Logged in to Cloudflare");
3091
+ return true;
3092
+ } catch (loginErr) {
3093
+ print(" [ERR] wrangler login failed: " + (loginErr.message || loginErr));
3094
+ print(" Run `wrangler login` manually, then `npx sticky-note deploy-backend`.\n");
3095
+ return false;
3096
+ }
3097
+ }
3098
+
3081
3099
  // Step 1: KV namespace — create or reuse existing
3082
3100
  print(" Step 1: Creating KV namespace...");
3083
3101
  let namespaceId = null;
3084
- try {
3085
- const kvResult = execSync("wrangler kv namespace create STICKY_KV", {
3086
- cwd: serverDir,
3087
- encoding: "utf-8",
3088
- stdio: ["pipe", "pipe", "pipe"],
3089
- });
3090
- const idMatch = kvResult.match(/id\s*=\s*"([^"]+)"/);
3091
- if (idMatch) namespaceId = idMatch[1];
3092
- print(" [OK] KV namespace created");
3093
- } catch (err) {
3094
- if (err.message && err.message.includes("already exists")) {
3102
+ function tryCreateKv() {
3103
+ try {
3104
+ const kvResult = execSync("wrangler kv namespace create STICKY_KV", {
3105
+ cwd: serverDir,
3106
+ encoding: "utf-8",
3107
+ stdio: ["pipe", "pipe", "pipe"],
3108
+ });
3109
+ const idMatch = kvResult.match(/id\s*=\s*"([^"]+)"/);
3110
+ if (idMatch) namespaceId = idMatch[1];
3111
+ print(" [OK] KV namespace created");
3112
+ return null; // success
3113
+ } catch (err) {
3114
+ return err;
3115
+ }
3116
+ }
3117
+
3118
+ let kvErr = tryCreateKv();
3119
+ if (kvErr) {
3120
+ const msg = kvErr.message || "";
3121
+ if (msg.includes("already exists")) {
3095
3122
  print(" [OK] KV namespace already exists — retrieving ID...");
3096
3123
  try {
3097
3124
  const listResult = execSync("wrangler kv namespace list", {
@@ -3105,8 +3132,16 @@ function provisionCloudBackend() {
3105
3132
  } catch (listErr) {
3106
3133
  return { error: "KV namespace exists but could not retrieve ID: " + (listErr.message || listErr) };
3107
3134
  }
3135
+ } else if (msg.includes("Authentication error") || msg.includes("code: 10000") || msg.includes("unauthenticated")) {
3136
+ // Wrangler is installed but not logged in — run login and retry once
3137
+ print(" [WARN] Not logged in to Cloudflare.");
3138
+ if (!wranglerLogin()) return { error: "Cloudflare authentication failed" };
3139
+ kvErr = tryCreateKv();
3140
+ if (kvErr) {
3141
+ return { error: "Failed to create KV namespace after login: " + (kvErr.message || kvErr) };
3142
+ }
3108
3143
  } else {
3109
- return { error: "Failed to create KV namespace: " + (err.message || err) + "\n Make sure you're logged in: wrangler login" };
3144
+ return { error: "Failed to create KV namespace: " + msg + "\n Make sure you're logged in: wrangler login" };
3110
3145
  }
3111
3146
  }
3112
3147
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sticky-note-cli",
3
- "version": "3.1.15",
3
+ "version": "3.1.17",
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": {
@@ -1,5 +1,6 @@
1
1
  # Sticky Note - local overrides (never commit these)
2
2
  .claude/settings.local.json
3
+ .claude/worktrees/
3
4
  .env.sticky
4
5
 
5
6
  # Sticky Note - transient session/resume signals