@sellable/install 0.1.38 → 0.1.39
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/sellable-install.mjs +46 -4
- package/package.json +1 -1
package/bin/sellable-install.mjs
CHANGED
|
@@ -20,7 +20,9 @@ const DEFAULT_SERVER_PACKAGE =
|
|
|
20
20
|
function getInstallVersion() {
|
|
21
21
|
try {
|
|
22
22
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
23
|
-
const pkg = JSON.parse(
|
|
23
|
+
const pkg = JSON.parse(
|
|
24
|
+
readFileSync(join(here, "..", "package.json"), "utf8")
|
|
25
|
+
);
|
|
24
26
|
return pkg.version || "unknown";
|
|
25
27
|
} catch {
|
|
26
28
|
return "unknown";
|
|
@@ -1454,6 +1456,48 @@ function printNextSteps(installedHosts) {
|
|
|
1454
1456
|
|
|
1455
1457
|
async function main() {
|
|
1456
1458
|
try {
|
|
1459
|
+
// Phase 116: auth set <token> subcommand — manual-paste fallback when CLI poll fails.
|
|
1460
|
+
// MUST be parsed BEFORE parseArgs() since parseArgs throws on non-flag args like "auth".
|
|
1461
|
+
const rawArgs = process.argv.slice(2);
|
|
1462
|
+
if (rawArgs[0] === "auth") {
|
|
1463
|
+
if (rawArgs[1] !== "set") {
|
|
1464
|
+
console.error(
|
|
1465
|
+
`Unknown auth subcommand: ${rawArgs[1] ?? "(none)"}\nKnown: set <token>`
|
|
1466
|
+
);
|
|
1467
|
+
process.exit(2);
|
|
1468
|
+
}
|
|
1469
|
+
const token = rawArgs[2];
|
|
1470
|
+
if (!token) {
|
|
1471
|
+
console.error(
|
|
1472
|
+
"Usage: sellable auth set <token>\n" +
|
|
1473
|
+
"Get the token from the Sellable browser confirm page (after clicking the magic link)."
|
|
1474
|
+
);
|
|
1475
|
+
process.exit(2);
|
|
1476
|
+
}
|
|
1477
|
+
// Verification iter 1 broadening: accept skt_(live|test|dev)_ prefixes so
|
|
1478
|
+
// non-prod tokens (existing in some environments) are not rejected.
|
|
1479
|
+
if (!/^skt_(live|test|dev)_[A-Za-z0-9_-]{20,}$/.test(token)) {
|
|
1480
|
+
console.error(
|
|
1481
|
+
`That doesn't look like a Sellable token (expected skt_live_, skt_test_, or skt_dev_ prefix). Got: ${token.slice(0, 16)}…`
|
|
1482
|
+
);
|
|
1483
|
+
process.exit(2);
|
|
1484
|
+
}
|
|
1485
|
+
// Bypass writeAuth() — its workspaceId guard early-returns on missing
|
|
1486
|
+
// workspaceId, but on the auth-set path we don't have one yet (next MCP
|
|
1487
|
+
// call hydrates it). Write the same shape directly.
|
|
1488
|
+
// Skip installSelfShim() — by definition the user has the shim already
|
|
1489
|
+
// (they invoked `sellable auth set` from it).
|
|
1490
|
+
const apiUrl = process.env.SELLABLE_API_URL || DEFAULT_API_URL;
|
|
1491
|
+
writeJson(
|
|
1492
|
+
authPath(),
|
|
1493
|
+
{ token, activeWorkspaceId: null, apiUrl },
|
|
1494
|
+
{ dryRun: false }
|
|
1495
|
+
);
|
|
1496
|
+
console.log(`✓ Token saved to ${authPath()}`);
|
|
1497
|
+
console.log(` apiUrl: ${apiUrl}`);
|
|
1498
|
+
console.log(` Run /sellable:create-campaign in your agent to continue.`);
|
|
1499
|
+
process.exit(0);
|
|
1500
|
+
}
|
|
1457
1501
|
const opts = parseArgs(process.argv.slice(2));
|
|
1458
1502
|
if (opts.help) {
|
|
1459
1503
|
console.log(usage());
|
|
@@ -1510,9 +1554,7 @@ async function main() {
|
|
|
1510
1554
|
}
|
|
1511
1555
|
|
|
1512
1556
|
if (installedHosts.length > 0) {
|
|
1513
|
-
logMilestone(
|
|
1514
|
-
`MCP servers registered (${installedHosts.join(" + ")})`
|
|
1515
|
-
);
|
|
1557
|
+
logMilestone(`MCP servers registered (${installedHosts.join(" + ")})`);
|
|
1516
1558
|
if (installedHosts.includes("Codex")) {
|
|
1517
1559
|
logMilestone("Codex Desktop plugin installed");
|
|
1518
1560
|
logMilestone("Skills installed");
|