sticky-note-cli 3.1.37 → 3.1.38
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 +36 -48
- package/package.json +1 -1
- package/sticky-server/.claude/settings.json +0 -3
package/bin/cli.js
CHANGED
|
@@ -260,6 +260,21 @@ function readJsonSafe(filePath, fallback) {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
function readEnvSticky(cwd) {
|
|
264
|
+
try {
|
|
265
|
+
const raw = fs.readFileSync(path.join(cwd, ".env.sticky"), "utf-8");
|
|
266
|
+
let url = "", key = "";
|
|
267
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
268
|
+
const t = line.trim();
|
|
269
|
+
if (t.startsWith("STICKY_URL=")) url = t.slice("STICKY_URL=".length).trim();
|
|
270
|
+
else if (t.startsWith("STICKY_API_KEY=")) key = t.slice("STICKY_API_KEY=".length).trim();
|
|
271
|
+
}
|
|
272
|
+
return { url, key };
|
|
273
|
+
} catch (_) {
|
|
274
|
+
return { url: "", key: "" };
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
263
278
|
function parseIntOr(str, fallback) {
|
|
264
279
|
const n = parseInt(str, 10);
|
|
265
280
|
return Number.isNaN(n) ? fallback : n;
|
|
@@ -615,19 +630,9 @@ async function cmdInit() {
|
|
|
615
630
|
// Read existing sticky-note-config.json for teammate flow (cloud URL pre-set via git)
|
|
616
631
|
const existingConfigPath = path.join(process.cwd(), ".sticky-note", "sticky-note-config.json");
|
|
617
632
|
const existingConfig = readJsonSafe(existingConfigPath, {});
|
|
618
|
-
//
|
|
619
|
-
//
|
|
620
|
-
|
|
621
|
-
try {
|
|
622
|
-
const envStickyRaw = fs.readFileSync(path.join(process.cwd(), ".env.sticky"), "utf-8");
|
|
623
|
-
for (const line of envStickyRaw.split(/\r?\n/)) {
|
|
624
|
-
if (line.trim().startsWith("STICKY_URL=")) {
|
|
625
|
-
envStickyUrlFallback = line.trim().slice("STICKY_URL=".length).trim();
|
|
626
|
-
break;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
} catch (_) { /* no .env.sticky yet */ }
|
|
630
|
-
const configStickyUrl = existingConfig.sticky_url || envStickyUrlFallback || "";
|
|
633
|
+
// Fall back to .env.sticky when sticky_url isn't committed yet — lets the URL
|
|
634
|
+
// get written into config on next init so teammates see the teammate flow on pull.
|
|
635
|
+
const configStickyUrl = existingConfig.sticky_url || readEnvSticky(process.cwd()).url;
|
|
631
636
|
|
|
632
637
|
// Auto-detect MCP servers and skills
|
|
633
638
|
print(" Scanning for existing configuration...");
|
|
@@ -996,7 +1001,8 @@ async function cmdInit() {
|
|
|
996
1001
|
existing.inject_token_budget = injectTokenBudgetResolved;
|
|
997
1002
|
existing.hook_version = VERSION;
|
|
998
1003
|
existing.min_version = bumpMinVersion(existing.min_version, VERSION);
|
|
999
|
-
if (cloudProvisionedUrl
|
|
1004
|
+
if (cloudProvisionedUrl) existing.sticky_url = cloudProvisionedUrl;
|
|
1005
|
+
else if (configStickyUrl && !existing.sticky_url) existing.sticky_url = configStickyUrl;
|
|
1000
1006
|
// Enable auto_push when cloud is configured (if not already explicitly set)
|
|
1001
1007
|
if ((cloudProvisionedUrl || configStickyUrl) && existing.auto_push === false) {
|
|
1002
1008
|
existing.auto_push = true;
|
|
@@ -1741,17 +1747,9 @@ function cmdStatus() {
|
|
|
1741
1747
|
// V3: Cloud backend health
|
|
1742
1748
|
const envStickyPath = path.join(process.cwd(), ".env.sticky");
|
|
1743
1749
|
print("\n Cloud Backend (V3):");
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
let stickyUrl = "";
|
|
1748
|
-
for (const line of envRaw.split(/\r?\n/)) {
|
|
1749
|
-
const trimmed = line.trim();
|
|
1750
|
-
if (trimmed.startsWith("STICKY_URL=")) {
|
|
1751
|
-
stickyUrl = trimmed.slice("STICKY_URL=".length).trim();
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
if (stickyUrl) {
|
|
1750
|
+
{
|
|
1751
|
+
const { url: stickyUrl } = readEnvSticky(process.cwd());
|
|
1752
|
+
if (stickyUrl) {
|
|
1755
1753
|
print(` [OK] .env.sticky found (${stickyUrl})`);
|
|
1756
1754
|
try {
|
|
1757
1755
|
const http = require(stickyUrl.startsWith("https") ? "https" : "http");
|
|
@@ -1798,14 +1796,12 @@ function cmdStatus() {
|
|
|
1798
1796
|
} catch (_) {
|
|
1799
1797
|
print(` [ERR] Backend health check failed`);
|
|
1800
1798
|
}
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1799
|
+
} else {
|
|
1800
|
+
const exists = fs.existsSync(envStickyPath);
|
|
1801
|
+
print(exists
|
|
1802
|
+
? " [--] .env.sticky found but STICKY_URL not set"
|
|
1803
|
+
: " [--] No .env.sticky (local-only mode, V2.5 compatible)");
|
|
1806
1804
|
}
|
|
1807
|
-
} else {
|
|
1808
|
-
print(" [--] No .env.sticky (local-only mode, V2.5 compatible)");
|
|
1809
1805
|
}
|
|
1810
1806
|
|
|
1811
1807
|
// V2.5: Attribution engine health
|
|
@@ -3567,14 +3563,10 @@ async function cmdMigrateToCloud() {
|
|
|
3567
3563
|
// Try .env.sticky
|
|
3568
3564
|
let envUrl = stickyUrl;
|
|
3569
3565
|
let envKey = stickyApiKey;
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
const trimmed = line.trim();
|
|
3575
|
-
if (trimmed.startsWith("STICKY_URL=")) envUrl = trimmed.slice("STICKY_URL=".length);
|
|
3576
|
-
if (trimmed.startsWith("STICKY_API_KEY=")) envKey = trimmed.slice("STICKY_API_KEY=".length);
|
|
3577
|
-
}
|
|
3566
|
+
if (!envUrl) {
|
|
3567
|
+
const env = readEnvSticky(process.cwd());
|
|
3568
|
+
envUrl = env.url;
|
|
3569
|
+
envKey = envKey || env.key;
|
|
3578
3570
|
}
|
|
3579
3571
|
|
|
3580
3572
|
if (!envUrl) {
|
|
@@ -3713,14 +3705,10 @@ async function _cmdMcpServerInline() {
|
|
|
3713
3705
|
// Try .env.sticky
|
|
3714
3706
|
let envUrl = stickyUrl;
|
|
3715
3707
|
let envKey = stickyApiKey;
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
const trimmed = line.trim();
|
|
3721
|
-
if (trimmed.startsWith("STICKY_URL=")) envUrl = trimmed.slice("STICKY_URL=".length);
|
|
3722
|
-
if (trimmed.startsWith("STICKY_API_KEY=")) envKey = trimmed.slice("STICKY_API_KEY=".length);
|
|
3723
|
-
}
|
|
3708
|
+
if (!envUrl) {
|
|
3709
|
+
const env = readEnvSticky(process.cwd());
|
|
3710
|
+
envUrl = env.url;
|
|
3711
|
+
envKey = envKey || env.key;
|
|
3724
3712
|
}
|
|
3725
3713
|
|
|
3726
3714
|
// Detect project
|
package/package.json
CHANGED