sticky-note-cli 3.1.8 → 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.
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.
@@ -3014,7 +3031,6 @@ function provisionCloudBackend() {
3014
3031
  print(" [OK] KV namespace created");
3015
3032
  } catch (err) {
3016
3033
  if (err.message && err.message.includes("already exists")) {
3017
- // Reuse the existing namespace
3018
3034
  print(" [OK] KV namespace already exists — retrieving ID...");
3019
3035
  try {
3020
3036
  const listResult = execSync("wrangler kv namespace list", {
@@ -3041,11 +3057,12 @@ function provisionCloudBackend() {
3041
3057
  print(" [OK] wrangler.toml updated with namespace ID");
3042
3058
  }
3043
3059
 
3044
- // Step 2: Deploy Worker
3045
- 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}"...`);
3046
3063
  let deployResult;
3047
3064
  try {
3048
- deployResult = execSync("wrangler deploy", {
3065
+ deployResult = execSync(`wrangler deploy --name ${workerName}`, {
3049
3066
  cwd: serverDir,
3050
3067
  encoding: "utf-8",
3051
3068
  stdio: ["pipe", "pipe", "pipe"],
@@ -3068,7 +3085,7 @@ function provisionCloudBackend() {
3068
3085
  print(" Step 3: Setting API key on Worker...");
3069
3086
  let secretSet = false;
3070
3087
  try {
3071
- execSync("wrangler secret put STICKY_API_KEY", {
3088
+ execSync(`wrangler secret put STICKY_API_KEY --name ${workerName}`, {
3072
3089
  cwd: serverDir,
3073
3090
  input: apiKey,
3074
3091
  encoding: "utf-8",
@@ -3078,7 +3095,7 @@ function provisionCloudBackend() {
3078
3095
  secretSet = true;
3079
3096
  } catch (err) {
3080
3097
  print(" [WARN] Could not set STICKY_API_KEY automatically: " + (err.message || err));
3081
- 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}`);
3082
3099
  }
3083
3100
 
3084
3101
  // Write .env.sticky
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sticky-note-cli",
3
- "version": "3.1.8",
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": {
@@ -68,6 +68,8 @@ const {
68
68
  clearInjectedSet,
69
69
  normalizeSep,
70
70
  useCloud,
71
+ getCloudConfig,
72
+ getProjectName,
71
73
  cloudReadThreads,
72
74
  cloudWriteThread,
73
75
  cloudDeletePresence,
@@ -1055,6 +1057,35 @@ async function main() {
1055
1057
  );
1056
1058
  if (transcriptCaptured) existing.transcript_captured = true;
1057
1059
 
1060
+ // Push transcript to cloud if configured
1061
+ if (transcriptCaptured && useCloud()) {
1062
+ try {
1063
+ const transcriptFile = getTranscriptPath(existing.id);
1064
+ if (fs.existsSync(transcriptFile)) {
1065
+ const lines = fs.readFileSync(transcriptFile, "utf-8")
1066
+ .split(/\r?\n/).filter(l => l.trim());
1067
+ const entry = lines
1068
+ .map(l => { try { return JSON.parse(l); } catch (_) { return null; } })
1069
+ .filter(Boolean)
1070
+ .find(e => e.session_id === sessionId);
1071
+ if (entry) {
1072
+ const { url: stickyUrl, apiKey: stickyApiKey } = getCloudConfig();
1073
+ const projectName = getProjectName();
1074
+ const headers = {
1075
+ "Content-Type": "application/json",
1076
+ "X-Sticky-Project": projectName,
1077
+ };
1078
+ if (stickyApiKey) headers["X-Sticky-API-Key"] = stickyApiKey;
1079
+ fetch(`${stickyUrl}/transcripts/${existing.id}`, {
1080
+ method: "POST",
1081
+ headers,
1082
+ body: JSON.stringify(entry),
1083
+ }).catch(() => {}); // non-fatal
1084
+ }
1085
+ }
1086
+ } catch (_) {} // transcript cloud sync is non-fatal
1087
+ }
1088
+
1058
1089
  // V2.5: Capture commit SHAs for attribution engine
1059
1090
  const commitShas = getSessionCommitShas();
1060
1091