@bigbrainforge/setup 3.20.0 → 3.21.0

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.
Files changed (2) hide show
  1. package/dist/setup.cjs +54 -2
  2. package/package.json +2 -2
package/dist/setup.cjs CHANGED
@@ -8,6 +8,28 @@ var __commonJS = (cb, mod) => function __require() {
8
8
  }
9
9
  };
10
10
 
11
+ // ../forge-plugin/lib/paste-command.js
12
+ var require_paste_command = __commonJS({
13
+ "../forge-plugin/lib/paste-command.js"(exports2, module2) {
14
+ function pasteCommand(alias, subcommand = "set") {
15
+ if (process.env.FORGE_DIST_BIN === "1") {
16
+ return `npx forge secrets ${subcommand} ${alias}`;
17
+ }
18
+ const path2 = require("node:path");
19
+ const scriptAbs = path2.resolve(__dirname, "..", "scripts", "secrets.js");
20
+ return `node "${scriptAbs}" ${subcommand} ${alias}`;
21
+ }
22
+ function pasteCommandIfAvailable(alias, subcommand = "set") {
23
+ if (process.env.FORGE_DIST_BIN === "1") return pasteCommand(alias, subcommand);
24
+ const fs = require("node:fs");
25
+ const path2 = require("node:path");
26
+ const scriptAbs = path2.resolve(__dirname, "..", "scripts", "secrets.js");
27
+ return fs.existsSync(scriptAbs) ? pasteCommand(alias, subcommand) : null;
28
+ }
29
+ module2.exports = { pasteCommand, pasteCommandIfAvailable };
30
+ }
31
+ });
32
+
11
33
  // ../forge-plugin/lib/rename-with-retry.js
12
34
  var require_rename_with_retry = __commonJS({
13
35
  "../forge-plugin/lib/rename-with-retry.js"(exports2, module2) {
@@ -86,6 +108,7 @@ var require_license = __commonJS({
86
108
  var fs = require("node:fs");
87
109
  var os2 = require("node:os");
88
110
  var path2 = require("node:path");
111
+ var { pasteCommandIfAvailable } = require_paste_command();
89
112
  var { renameWithRetry } = require_rename_with_retry();
90
113
  var LICENSE_RE2 = /^forge_lic_[0-9A-Za-z]{43}$/;
91
114
  function licensePath(io = {}) {
@@ -106,7 +129,8 @@ var require_license = __commonJS({
106
129
  return raw !== null && LICENSE_RE2.test(raw);
107
130
  }
108
131
  function missingHint() {
109
- return "no Forge license on this machine \u2014 run /forge:setup license, or paste it in your own terminal with: node <plugin-root>/scripts/secrets.js set license";
132
+ const paste = pasteCommandIfAvailable("license");
133
+ return "no Forge license on this machine \u2014 run /forge:setup license" + (paste ? `, or paste it in your own terminal with: ${paste}` : "");
110
134
  }
111
135
  function resolveLicense(io = {}) {
112
136
  const env = io.env ?? process.env;
@@ -449,6 +473,27 @@ var require_npmrc_license = __commonJS({
449
473
  const status = foreignScope ? "declined" : changed ? "seeded" : "already";
450
474
  return { content: body, changed, replacedLegacy, foreignScope, foreignScopeTarget, status };
451
475
  }
476
+ function inspectNpmrcLicense(content) {
477
+ const src = String(content ?? "");
478
+ let scopeActive = false;
479
+ let authActive = false;
480
+ let foreignScopeTarget = null;
481
+ for (const raw of src.split("\n")) {
482
+ const trimmed = raw.trim();
483
+ if (trimmed.length === 0 || isCommentLine(trimmed)) continue;
484
+ if (trimmed === SCOPE_LINE) {
485
+ scopeActive = true;
486
+ continue;
487
+ }
488
+ if (trimmed.startsWith(`${DIST_AUTH_KEY}:_authToken=`)) {
489
+ if (trimmed.length > `${DIST_AUTH_KEY}:_authToken=`.length) authActive = true;
490
+ continue;
491
+ }
492
+ const foreignTarget = foreignScopeTargetOf(trimmed);
493
+ if (foreignTarget !== null && !ownsLine(trimmed)) foreignScopeTarget = foreignTarget;
494
+ }
495
+ return { seeded: scopeActive && authActive, foreignScopeTarget };
496
+ }
452
497
  function writeNpmrcLicense2(license, io) {
453
498
  const target = path2.join(io.homedir, ".npmrc");
454
499
  let existing = "";
@@ -466,7 +511,14 @@ var require_npmrc_license = __commonJS({
466
511
  }
467
512
  return { ...result, path: target };
468
513
  }
469
- module2.exports = { applyNpmrcLicense, writeNpmrcLicense: writeNpmrcLicense2, SCOPE_LINE, authLine, DIST_HOST };
514
+ module2.exports = {
515
+ applyNpmrcLicense,
516
+ inspectNpmrcLicense,
517
+ writeNpmrcLicense: writeNpmrcLicense2,
518
+ SCOPE_LINE,
519
+ authLine,
520
+ DIST_HOST
521
+ };
470
522
  }
471
523
  });
472
524
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbrainforge/setup",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "Forge workstation setup — paste one license, get a working Forge install.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/bigbrainforge/forge",
@@ -12,5 +12,5 @@
12
12
  },
13
13
  "engines": { "node": ">=24.18.1", "pnpm": ">=11.0.0" },
14
14
  "publishConfig": { "registry": "https://registry.npmjs.org", "access": "public" },
15
- "devDependencies": { "esbuild": "0.28.1" }
15
+ "devDependencies": { "esbuild": "0.28.2" }
16
16
  }