sticky-note-cli 3.1.36 → 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 +35 -35
- package/package.json +1 -1
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,7 +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
|
-
|
|
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;
|
|
619
636
|
|
|
620
637
|
// Auto-detect MCP servers and skills
|
|
621
638
|
print(" Scanning for existing configuration...");
|
|
@@ -985,6 +1002,7 @@ async function cmdInit() {
|
|
|
985
1002
|
existing.hook_version = VERSION;
|
|
986
1003
|
existing.min_version = bumpMinVersion(existing.min_version, VERSION);
|
|
987
1004
|
if (cloudProvisionedUrl) existing.sticky_url = cloudProvisionedUrl;
|
|
1005
|
+
else if (configStickyUrl && !existing.sticky_url) existing.sticky_url = configStickyUrl;
|
|
988
1006
|
// Enable auto_push when cloud is configured (if not already explicitly set)
|
|
989
1007
|
if ((cloudProvisionedUrl || configStickyUrl) && existing.auto_push === false) {
|
|
990
1008
|
existing.auto_push = true;
|
|
@@ -1729,17 +1747,9 @@ function cmdStatus() {
|
|
|
1729
1747
|
// V3: Cloud backend health
|
|
1730
1748
|
const envStickyPath = path.join(process.cwd(), ".env.sticky");
|
|
1731
1749
|
print("\n Cloud Backend (V3):");
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
let stickyUrl = "";
|
|
1736
|
-
for (const line of envRaw.split(/\r?\n/)) {
|
|
1737
|
-
const trimmed = line.trim();
|
|
1738
|
-
if (trimmed.startsWith("STICKY_URL=")) {
|
|
1739
|
-
stickyUrl = trimmed.slice("STICKY_URL=".length).trim();
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
if (stickyUrl) {
|
|
1750
|
+
{
|
|
1751
|
+
const { url: stickyUrl } = readEnvSticky(process.cwd());
|
|
1752
|
+
if (stickyUrl) {
|
|
1743
1753
|
print(` [OK] .env.sticky found (${stickyUrl})`);
|
|
1744
1754
|
try {
|
|
1745
1755
|
const http = require(stickyUrl.startsWith("https") ? "https" : "http");
|
|
@@ -1786,14 +1796,12 @@ function cmdStatus() {
|
|
|
1786
1796
|
} catch (_) {
|
|
1787
1797
|
print(` [ERR] Backend health check failed`);
|
|
1788
1798
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
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)");
|
|
1794
1804
|
}
|
|
1795
|
-
} else {
|
|
1796
|
-
print(" [--] No .env.sticky (local-only mode, V2.5 compatible)");
|
|
1797
1805
|
}
|
|
1798
1806
|
|
|
1799
1807
|
// V2.5: Attribution engine health
|
|
@@ -3555,14 +3563,10 @@ async function cmdMigrateToCloud() {
|
|
|
3555
3563
|
// Try .env.sticky
|
|
3556
3564
|
let envUrl = stickyUrl;
|
|
3557
3565
|
let envKey = stickyApiKey;
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
const trimmed = line.trim();
|
|
3563
|
-
if (trimmed.startsWith("STICKY_URL=")) envUrl = trimmed.slice("STICKY_URL=".length);
|
|
3564
|
-
if (trimmed.startsWith("STICKY_API_KEY=")) envKey = trimmed.slice("STICKY_API_KEY=".length);
|
|
3565
|
-
}
|
|
3566
|
+
if (!envUrl) {
|
|
3567
|
+
const env = readEnvSticky(process.cwd());
|
|
3568
|
+
envUrl = env.url;
|
|
3569
|
+
envKey = envKey || env.key;
|
|
3566
3570
|
}
|
|
3567
3571
|
|
|
3568
3572
|
if (!envUrl) {
|
|
@@ -3701,14 +3705,10 @@ async function _cmdMcpServerInline() {
|
|
|
3701
3705
|
// Try .env.sticky
|
|
3702
3706
|
let envUrl = stickyUrl;
|
|
3703
3707
|
let envKey = stickyApiKey;
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
const trimmed = line.trim();
|
|
3709
|
-
if (trimmed.startsWith("STICKY_URL=")) envUrl = trimmed.slice("STICKY_URL=".length);
|
|
3710
|
-
if (trimmed.startsWith("STICKY_API_KEY=")) envKey = trimmed.slice("STICKY_API_KEY=".length);
|
|
3711
|
-
}
|
|
3708
|
+
if (!envUrl) {
|
|
3709
|
+
const env = readEnvSticky(process.cwd());
|
|
3710
|
+
envUrl = env.url;
|
|
3711
|
+
envKey = envKey || env.key;
|
|
3712
3712
|
}
|
|
3713
3713
|
|
|
3714
3714
|
// Detect project
|