@bridge-ds/cli 0.15.0 → 0.16.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/index.js +37 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -373,6 +373,7 @@ function productProblems(raw) {
373
373
  if (bad) problems.push(`${at}.path" must be a folder relative to the repository root, without a leading "/" or "..", such as "apps/admin"`);
374
374
  }
375
375
  if (o.preview !== void 0 && (typeof o.preview !== "string" || !/^https?:\/\//.test(o.preview))) problems.push(`${at}.preview" must be an http(s) URL template, such as "https://app-git-{branch}.vercel.app"`);
376
+ if (o.production !== void 0 && (typeof o.production !== "string" || !/^https?:\/\/[^{}\s]+$/.test(o.production))) problems.push(`${at}.production" must be the product's production URL, without placeholders, such as "https://shop.example.com"`);
376
377
  if (o.framework !== void 0 && (typeof o.framework !== "string" || !o.framework.trim())) problems.push(`${at}.framework" must be a name such as "react", "vue" or "other"`);
377
378
  if (o.default !== void 0 && typeof o.default !== "boolean") problems.push(`${at}.default" must be true or false`);
378
379
  if (o.default === true) defaults++;
@@ -390,7 +391,7 @@ var init_products = __esm({
390
391
  ];
391
392
  KEY = /^[a-z0-9][a-z0-9-]*$/;
392
393
  REPO = /^[\w.-]+\/[\w.-]+$/;
393
- FIELDS = ["key", "name", "repo", "path", "preview", "framework", "default"];
394
+ FIELDS = ["key", "name", "repo", "path", "preview", "production", "framework", "default"];
394
395
  }
395
396
  });
396
397
 
@@ -15396,6 +15397,8 @@ Usage:
15396
15397
  neither exists). --product: the key in the design system's bridge.config.json
15397
15398
  "products"; by default the product whose "repo" is this repository's origin.
15398
15399
  Run it again any time: only what differs changes, your own content is kept.
15400
+ In a React product it also prints the one line that mounts the Bridge toolbar
15401
+ (@bridge-ds/toolbar: Before and After of a change, from Studio's Try it in the product).
15399
15402
 
15400
15403
  Then, from this repository: bridge explore list | continue <#n> | start <name> | done <#n>, bridge pieces <#n>,
15401
15404
  and Claude Code with the Bridge tools (restart it here once).`;
@@ -15465,6 +15468,22 @@ function instructionsFile(root) {
15465
15468
  if (existsSync7(join8(root, "AGENTS.md"))) return "AGENTS.md";
15466
15469
  return "CLAUDE.md";
15467
15470
  }
15471
+ var TOOLBAR_PACKAGE = "@bridge-ds/toolbar";
15472
+ var toolbarMount = (designSystem, product) => `<BridgeToolbar ds="${designSystem}" product="${product}" />`;
15473
+ function toolbarSetup(pkgText, x) {
15474
+ let deps = {};
15475
+ try {
15476
+ const pkg = pkgText ? JSON.parse(pkgText) : {};
15477
+ deps = { ...pkg.devDependencies ?? {}, ...pkg.dependencies ?? {} };
15478
+ } catch {
15479
+ deps = {};
15480
+ }
15481
+ const react = (x.framework ?? "").toLowerCase() === "react" || "react" in deps;
15482
+ if (!react) return { state: "none", lines: [] };
15483
+ const mount = [`import { BridgeToolbar } from '${TOOLBAR_PACKAGE}';`, toolbarMount(x.designSystem, x.product)];
15484
+ if (TOOLBAR_PACKAGE in deps) return { state: "installed", lines: mount };
15485
+ return { state: "suggested", lines: [`npm i ${TOOLBAR_PACKAGE}`, ...mount] };
15486
+ }
15468
15487
  async function connect(root, a) {
15469
15488
  const warnings = [];
15470
15489
  const pointerPath = join8(root, PRODUCT_POINTER);
@@ -15477,10 +15496,11 @@ async function connect(root, a) {
15477
15496
  }
15478
15497
  const wanted = a.product ?? (previous && previous.designSystem.toLowerCase() === a.designSystem.toLowerCase() ? previous.product : void 0);
15479
15498
  let product;
15499
+ let found;
15480
15500
  if (a.products) {
15481
15501
  const byKey = wanted ? a.products.find((p) => p.key === wanted || p.name.toLowerCase() === wanted.toLowerCase()) : void 0;
15482
15502
  const byRepo = a.origin ? a.products.find((p) => productRepoOf(p, a.designSystem)?.toLowerCase() === a.origin.toLowerCase()) : void 0;
15483
- const found = wanted ? byKey : byRepo;
15503
+ found = wanted ? byKey : byRepo;
15484
15504
  if (!found) {
15485
15505
  const list3 = a.products.map((p) => `${p.key} (${p.name})`).join(", ");
15486
15506
  throw new RequestUsageError(
@@ -15523,11 +15543,16 @@ async function connect(root, a) {
15523
15543
  }
15524
15544
  }
15525
15545
  const changed = files2.filter((f) => f.change === "created" || f.change === "updated").map((f) => f.path);
15546
+ const toolbar = toolbarSetup(await readOrNull(join8(root, "package.json")), { designSystem: a.designSystem, product: product.key, framework: found?.framework });
15547
+ if (toolbar.state !== "none" && found && !found.production && !found.path) {
15548
+ warnings.push(`${found.name} has no "production" URL in the design system's bridge.config.json, so the Bridge toolbar cannot show Live product for a change made here. An admin can add "production": "https://..." to that product.`);
15549
+ }
15526
15550
  return {
15527
15551
  status: a.dryRun ? "dry-run" : "connected",
15528
15552
  designSystem: a.designSystem,
15529
15553
  product,
15530
15554
  files: files2.map(({ path, change }) => ({ path, change })),
15555
+ toolbar,
15531
15556
  warnings,
15532
15557
  next: changed.length ? `Commit ${changed.join(", ")} so everyone working here gets it. Restart Claude Code in this folder to load the Bridge tools. Then: bridge explore list, or "Continue Bridge exploration #<n>" in Claude.` : "Already connected, nothing changed. bridge explore list shows this product's explorations."
15533
15558
  };
@@ -15555,6 +15580,15 @@ ${CONNECT_HELP}`);
15555
15580
  if (has8(a, "json")) return io.print(JSON.stringify(r, null, 2)), 0;
15556
15581
  io.print(`${r.status === "dry-run" ? "Dry run, nothing written. " : ""}${r.status === "dry-run" ? "Would connect" : "Connected"} ${r.product.name} (${r.product.key}) to the design system ${r.designSystem}.`);
15557
15582
  for (const f of r.files) io.print(` ${VERB[f.change]} ${f.path}${f.change === "unchanged" || f.change === "kept" ? "" : `: ${WHAT[f.path] ?? "a short Bridge section for Claude"}`}`);
15583
+ if (r.toolbar.state === "suggested") {
15584
+ io.print(`
15585
+ Before and after in ${r.product.name} (Studio's Try it in the product): add the Bridge toolbar, then mount it once at the root of the app, inside ThemeProvider. Bridge does not edit your code.`);
15586
+ for (const l of r.toolbar.lines) io.print(` ${l}`);
15587
+ } else if (r.toolbar.state === "installed") {
15588
+ io.print(`
15589
+ The Bridge toolbar is installed: mount it once at the root of the app, if it is not yet.`);
15590
+ for (const l of r.toolbar.lines) io.print(` ${l}`);
15591
+ }
15558
15592
  for (const w of r.warnings) io.error(`Warning: ${w}`);
15559
15593
  io.print(`
15560
15594
  ${r.next}`);
@@ -16894,7 +16928,7 @@ async function rolesReport(opts) {
16894
16928
 
16895
16929
  // src/index.ts
16896
16930
  import { brand, BridgeContext as BridgeContext5, CONFIG_FILE as CONFIG_FILE2, core, detectConfig, GitRefSource, history as hist, LocalSource, ops, optionsFromArgv, serveStdio, toConfigJson } from "@bridge-ds/mcp";
16897
- var VERSION = true ? "0.15.0" : "dev";
16931
+ var VERSION = true ? "0.16.0" : "dev";
16898
16932
  var MCP_PACKAGE2 = "@bridge-ds/mcp";
16899
16933
  var HELP = `bridge ${VERSION}: design system as code, for you and your Claude
16900
16934
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridge-ds/cli",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
5
  "description": "bridge CLI: set up Bridge in a design system repo, check tokens in CI, search and diff tokens, propose changes, start the MCP server.",
6
6
  "license": "FSL-1.1-MIT",
@@ -43,8 +43,8 @@
43
43
  "build:package": "node ../../scripts/build-packages.mjs cli"
44
44
  },
45
45
  "dependencies": {
46
- "@bridge-ds/mcp": "^0.11.0",
47
- "@bridge-ds/visual": "^0.3.15",
46
+ "@bridge-ds/mcp": "^0.11.1",
47
+ "@bridge-ds/visual": "^0.3.16",
48
48
  "typescript": "5.9.3"
49
49
  },
50
50
  "devDependencies": {