@sellable/install 0.1.37 → 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.
@@ -11,10 +11,34 @@ import {
11
11
  import { homedir } from "node:os";
12
12
  import { dirname, join, relative } from "node:path";
13
13
  import { stdout as output } from "node:process";
14
+ import { fileURLToPath } from "node:url";
14
15
 
15
16
  const DEFAULT_API_URL = "https://app.sellable.dev";
16
17
  const DEFAULT_SERVER_PACKAGE =
17
18
  process.env.SELLABLE_MCP_PACKAGE || "@sellable/mcp@latest";
19
+
20
+ function getInstallVersion() {
21
+ try {
22
+ const here = dirname(fileURLToPath(import.meta.url));
23
+ const pkg = JSON.parse(
24
+ readFileSync(join(here, "..", "package.json"), "utf8")
25
+ );
26
+ return pkg.version || "unknown";
27
+ } catch {
28
+ return "unknown";
29
+ }
30
+ }
31
+
32
+ function getMcpVersion() {
33
+ try {
34
+ const r = spawnSync("npm", ["view", "@sellable/mcp", "version"], {
35
+ encoding: "utf8",
36
+ timeout: 5000,
37
+ });
38
+ if (r.status === 0 && r.stdout) return r.stdout.trim();
39
+ } catch {}
40
+ return "latest";
41
+ }
18
42
  const CODEX_PLUGIN_VERSION = "0.1.27";
19
43
  const CODEX_PLUGIN_COMPAT_VERSIONS = [
20
44
  "0.1.8",
@@ -1422,10 +1446,58 @@ function printNextSteps(installedHosts) {
1422
1446
  ` LinkedIn: ${C.cyan}https://www.linkedin.com/in/csreyes92/${C.reset} ${C.grey}(DM Christian directly)${C.reset}`
1423
1447
  );
1424
1448
  console.log("");
1449
+ const installV = getInstallVersion();
1450
+ const mcpV = getMcpVersion();
1451
+ console.log(
1452
+ ` ${C.grey}@sellable/install v${installV} · @sellable/mcp v${mcpV} · Codex plugin v${CODEX_PLUGIN_VERSION}${C.reset}`
1453
+ );
1454
+ console.log("");
1425
1455
  }
1426
1456
 
1427
1457
  async function main() {
1428
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
+ }
1429
1501
  const opts = parseArgs(process.argv.slice(2));
1430
1502
  if (opts.help) {
1431
1503
  console.log(usage());
@@ -1482,9 +1554,7 @@ async function main() {
1482
1554
  }
1483
1555
 
1484
1556
  if (installedHosts.length > 0) {
1485
- logMilestone(
1486
- `MCP servers registered (${installedHosts.join(" + ")})`
1487
- );
1557
+ logMilestone(`MCP servers registered (${installedHosts.join(" + ")})`);
1488
1558
  if (installedHosts.includes("Codex")) {
1489
1559
  logMilestone("Codex Desktop plugin installed");
1490
1560
  logMilestone("Skills installed");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/install",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "type": "module",
5
5
  "description": "One-command installer for Sellable MCP in Claude Code and Codex",
6
6
  "bin": {