sticky-note-cli 3.1.9 → 3.1.10

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.
Files changed (2) hide show
  1. package/bin/cli.js +23 -5
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -2983,6 +2983,23 @@ function cmdGc() {
2983
2983
  // DEPLOY-BACKEND command (V3)
2984
2984
  // ──────────────────────────────────────────────
2985
2985
 
2986
+ // Derive a safe Worker name from the git remote or cwd.
2987
+ // e.g. "BandaruDheeraj/sticky-note" → "sticky-dheeraj-sticky-note"
2988
+ function deriveWorkerName() {
2989
+ try {
2990
+ const remote = execSync("git remote get-url origin", { encoding: "utf-8", stdio: "pipe" }).trim();
2991
+ const match = remote.match(/[:/]([^/]+)\/([^/]+?)(?:\.git)?$/);
2992
+ if (match) {
2993
+ const [, owner, repo] = match;
2994
+ const slug = `${owner}-${repo}`.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").slice(0, 50);
2995
+ return `sticky-${slug}`;
2996
+ }
2997
+ } catch (_) {}
2998
+ // Fallback to cwd folder name
2999
+ const folder = path.basename(process.cwd()).toLowerCase().replace(/[^a-z0-9-]/g, "-").slice(0, 40);
3000
+ return `sticky-${folder}`;
3001
+ }
3002
+
2986
3003
  // Shared provisioning logic used by both cmdInit and cmdDeployBackend.
2987
3004
  // Returns null if wrangler is missing.
2988
3005
  // Returns { workerUrl, apiKey, secretSet } on success.
@@ -3040,11 +3057,12 @@ function provisionCloudBackend() {
3040
3057
  print(" [OK] wrangler.toml updated with namespace ID");
3041
3058
  }
3042
3059
 
3043
- // Step 2: Deploy Worker
3044
- print(" Step 2: Deploying Worker...");
3060
+ // Step 2: Deploy Worker (name derived from git repo for unique URL)
3061
+ const workerName = deriveWorkerName();
3062
+ print(` Step 2: Deploying Worker as "${workerName}"...`);
3045
3063
  let deployResult;
3046
3064
  try {
3047
- deployResult = execSync("wrangler deploy", {
3065
+ deployResult = execSync(`wrangler deploy --name ${workerName}`, {
3048
3066
  cwd: serverDir,
3049
3067
  encoding: "utf-8",
3050
3068
  stdio: ["pipe", "pipe", "pipe"],
@@ -3067,7 +3085,7 @@ function provisionCloudBackend() {
3067
3085
  print(" Step 3: Setting API key on Worker...");
3068
3086
  let secretSet = false;
3069
3087
  try {
3070
- execSync("wrangler secret put STICKY_API_KEY", {
3088
+ execSync(`wrangler secret put STICKY_API_KEY --name ${workerName}`, {
3071
3089
  cwd: serverDir,
3072
3090
  input: apiKey,
3073
3091
  encoding: "utf-8",
@@ -3077,7 +3095,7 @@ function provisionCloudBackend() {
3077
3095
  secretSet = true;
3078
3096
  } catch (err) {
3079
3097
  print(" [WARN] Could not set STICKY_API_KEY automatically: " + (err.message || err));
3080
- if (workerUrl) print(` Set it manually: echo '${apiKey}' | wrangler secret put STICKY_API_KEY`);
3098
+ if (workerUrl) print(` Set it manually: echo '${apiKey}' | wrangler secret put STICKY_API_KEY --name ${workerName}`);
3081
3099
  }
3082
3100
 
3083
3101
  // Write .env.sticky
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sticky-note-cli",
3
- "version": "3.1.9",
3
+ "version": "3.1.10",
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": {