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 +47 -12
- package/package.json +1 -1
- package/sticky-server/.wrangler/state/v3/observability/miniflare-wobs-trace-store/a590acd76969f996ec6e4b599c3c09f58c283a76f2d61392b5d3046caf557602.sqlite +0 -0
- package/sticky-server/.wrangler/state/v3/observability/miniflare-wobs-trace-store/a590acd76969f996ec6e4b599c3c09f58c283a76f2d61392b5d3046caf557602.sqlite-shm +0 -0
- package/sticky-server/.wrangler/state/v3/observability/miniflare-wobs-trace-store/a590acd76969f996ec6e4b599c3c09f58c283a76f2d61392b5d3046caf557602.sqlite-wal +0 -0
- package/templates/gitignore-additions.txt +1 -0
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
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
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: " +
|
|
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
|
Binary file
|
|
Binary file
|
|
Binary file
|