@warmhub/cli 0.71.0 → 0.72.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/wh.js +160 -87
  2. package/package.json +1 -1
package/dist/wh.js CHANGED
@@ -18478,7 +18478,13 @@ var import_awaitAsyncGenerator = __toESM(require_awaitAsyncGenerator(), 1);
18478
18478
  var import_wrapAsyncGenerator = __toESM(require_wrapAsyncGenerator(), 1);
18479
18479
  var import_objectSpread29 = __toESM(require_objectSpread2(), 1);
18480
18480
  // ../../packages/rules/src/builtin-shapes.ts
18481
- var BUILTIN_SHAPE_NAMES = ["Pair", "Set", "List"];
18481
+ var BUILTIN_SHAPE_NAMES = [
18482
+ "Arc",
18483
+ "Bond",
18484
+ "Pair",
18485
+ "Set",
18486
+ "List"
18487
+ ];
18482
18488
  var RETIRED_COLLECTION_SHAPE_NAMES = ["Triple"];
18483
18489
  var RESERVED_COLLECTION_SHAPE_NAMES = [
18484
18490
  ...BUILTIN_SHAPE_NAMES,
@@ -18503,6 +18509,25 @@ function isBuiltinShape(name) {
18503
18509
  return BUILTIN_SHAPE_NAMES.includes(name) || BUILTIN_CONTENT_SHAPE_NAMES.includes(name);
18504
18510
  }
18505
18511
  var BUILTIN_SHAPE_DEFS = {
18512
+ Arc: {
18513
+ fields: {
18514
+ from: {
18515
+ type: "wref",
18516
+ description: "Origin of the directed relationship"
18517
+ },
18518
+ to: {
18519
+ type: "wref",
18520
+ description: "Destination of the directed relationship"
18521
+ }
18522
+ },
18523
+ description: "A directed relationship between two things"
18524
+ },
18525
+ Bond: {
18526
+ fields: {
18527
+ ends: [{ type: "wref", description: "Endpoints of the relationship" }]
18528
+ },
18529
+ description: "A symmetric relationship between two things"
18530
+ },
18506
18531
  Pair: {
18507
18532
  fields: {
18508
18533
  first: { type: "wref", description: "First member of the pair" },
@@ -19735,7 +19760,9 @@ function preflightOpDiagnostics(op, operationIndex) {
19735
19760
  function builtinShapeGuard(op, operationIndex) {
19736
19761
  const errors = [];
19737
19762
  const name = op.name;
19738
- if (name && isRetiredCollectionShape(name)) {
19763
+ const isShapeRename = op.operation === "rename" && (op.kind === "shape" || op.name !== undefined && !splitLocalPath(op.name));
19764
+ const reservedSourcePassThrough = isShapeRename && name !== undefined && isReservedCollectionShape(name) && op.newName !== undefined && !isReservedCollectionShape(op.newName) && !isBuiltinShape(op.newName);
19765
+ if (name && isRetiredCollectionShape(name) && !reservedSourcePassThrough) {
19739
19766
  errors.push({
19740
19767
  code: "RESERVED_NAME",
19741
19768
  operationIndex,
@@ -19749,8 +19776,7 @@ function builtinShapeGuard(op, operationIndex) {
19749
19776
  message: `Shape "${op.newName}" is a retired collection shape and cannot be written manually`
19750
19777
  });
19751
19778
  } else {
19752
- const isShapeRename = op.operation === "rename" && (op.kind === "shape" || op.name !== undefined && !splitLocalPath(op.name));
19753
- const builtinShapeName = name && isBuiltinShape(name) ? name : isShapeRename && op.newName && isBuiltinShape(op.newName) ? op.newName : undefined;
19779
+ const builtinShapeName = name && isBuiltinShape(name) && !reservedSourcePassThrough ? name : isShapeRename && op.newName && isBuiltinShape(op.newName) ? op.newName : undefined;
19754
19780
  if (builtinShapeName && (isShapeRename || op.operation !== "retract" && op.kind === "shape")) {
19755
19781
  const action = op.operation === "add" ? "created" : op.operation === "rename" ? "renamed" : "revised";
19756
19782
  errors.push({
@@ -27136,7 +27162,7 @@ function findSystemComponent(componentId) {
27136
27162
  // ../../packages/sdk-ts/package.json
27137
27163
  var package_default = {
27138
27164
  name: "@warmhub/sdk-ts",
27139
- version: "0.69.1",
27165
+ version: "0.70.0",
27140
27166
  private: false,
27141
27167
  type: "module",
27142
27168
  description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -30179,6 +30205,7 @@ var TOP_LEVEL_USER_INPUT_CODES = new Set([
30179
30205
  ]);
30180
30206
  var CONFLICT_SHAPED_CODES = new Set([
30181
30207
  "CONFLICT",
30208
+ "BUILTIN_SHAPE_CONFLICT",
30182
30209
  "ARCHIVED",
30183
30210
  "HAS_INBOUND_REFS",
30184
30211
  "REPO_PENDING_DELETE",
@@ -32648,10 +32675,11 @@ function formatTime(ts, now) {
32648
32675
  return d.toISOString().slice(0, 16).replace("T", " ");
32649
32676
  }
32650
32677
  function pinnedWref(c, wref, version) {
32651
- if (version == null)
32652
- return `${c.cyan}${wref}${c.reset}`;
32678
+ if (version == null) {
32679
+ return `${c.cyan}${escapeTerminalTextForDisplay(wref)}${c.reset}`;
32680
+ }
32653
32681
  const base = wref.replace(/@v\d+$/, "");
32654
- return `${c.cyan}${base}@v${version}${c.reset}`;
32682
+ return `${c.cyan}${escapeTerminalTextForDisplay(base)}@v${version}${c.reset}`;
32655
32683
  }
32656
32684
  function kindLabel(c, kind) {
32657
32685
  return `${c.dim}${kind}${c.reset}`;
@@ -32686,7 +32714,7 @@ function effectiveKind(kind, shapeName) {
32686
32714
  }
32687
32715
  function displayName(c, name) {
32688
32716
  if (name)
32689
- return `${c.cyan}${name}${c.reset}`;
32717
+ return `${c.cyan}${escapeTerminalTextForDisplay(name)}${c.reset}`;
32690
32718
  return `${c.dim}(unnamed)${c.reset}`;
32691
32719
  }
32692
32720
  function extractShapeName(name) {
@@ -33468,15 +33496,15 @@ function renderHead(out, c, chars, result, org, repo, shape, kind) {
33468
33496
  const fields = shapeName && (item.kind === "thing" || item.kind === "collection") && item.data ? collectionFields(shapeName, item.data) : null;
33469
33497
  if (fields) {
33470
33498
  const allWrefs = fields.flatMap((f) => f.wrefs);
33471
- out(` ${allWrefs.map((w) => pinnedWref(c, escapeTerminalTextForDisplay(w))).join(`${c.dim},${c.reset} `)}`);
33499
+ out(` ${allWrefs.map((w) => pinnedWref(c, w)).join(`${c.dim},${c.reset} `)}`);
33472
33500
  } else if (item.data && typeof item.data === "object") {
33473
33501
  const preview = JSON.stringify(item.data);
33474
33502
  const truncated = preview.length > 80 ? `${preview.slice(0, 77)}...` : preview;
33475
- out(` ${c.dim}${truncated}${c.reset}`);
33503
+ out(` ${c.dim}${escapeTerminalTextForDisplay(truncated)}${c.reset}`);
33476
33504
  }
33477
33505
  const itemMeta = item.metadata;
33478
33506
  if (itemMeta?.durableId) {
33479
- out(` ${c.dim}durableId:${c.reset} ${styleDurableId(itemMeta.durableId, c)}`);
33507
+ out(` ${c.dim}durableId:${c.reset} ${styleDurableId(escapeTerminalTextForDisplay(itemMeta.durableId), c)}`);
33480
33508
  }
33481
33509
  }
33482
33510
  out(`${c.dim}${items.length} item(s)${c.reset}`);
@@ -33487,7 +33515,7 @@ function renderThing(out, c, result) {
33487
33515
  const displayKind = effectiveKind(result.kind ?? "thing", shapeName);
33488
33516
  const retractedTag = result.active === false ? ` ${c.red}[RETRACTED]${c.reset}` : "";
33489
33517
  out(`${pinnedWref(c, wref, result.version)} ${kindLabel(c, displayKind)}${retractedTag}`);
33490
- out(` ${c.dim}wref:${c.reset} ${wref}`);
33518
+ out(` ${c.dim}wref:${c.reset} ${escapeTerminalTextForDisplay(wref)}`);
33491
33519
  out(` ${c.dim}version:${c.reset} ${result.version ?? "-"}`);
33492
33520
  out(` ${c.dim}active:${c.reset} ${String(result.active)}`);
33493
33521
  if (result.committerWref) {
@@ -33495,13 +33523,13 @@ function renderThing(out, c, result) {
33495
33523
  }
33496
33524
  const aboutWref = result.aboutWref ?? result.about;
33497
33525
  if (aboutWref) {
33498
- out(` ${c.dim}about:${c.reset} ${String(aboutWref)}`);
33526
+ out(` ${c.dim}about:${c.reset} ${escapeTerminalTextForDisplay(String(aboutWref))}`);
33499
33527
  }
33500
33528
  const meta = result.metadata;
33501
33529
  if (meta?.durableId || meta?.createdOn || meta?.revisedOn) {
33502
33530
  const now = Date.now();
33503
33531
  if (meta.durableId) {
33504
- out(` ${c.dim}durableId:${c.reset} ${styleDurableId(meta.durableId, c)}`);
33532
+ out(` ${c.dim}durableId:${c.reset} ${styleDurableId(escapeTerminalTextForDisplay(meta.durableId), c)}`);
33505
33533
  }
33506
33534
  if (meta.createdOn) {
33507
33535
  out(` ${c.dim}createdOn:${c.reset} ${formatTime(meta.createdOn, now)}`);
@@ -33518,11 +33546,11 @@ function renderThing(out, c, result) {
33518
33546
  for (const field of fields) {
33519
33547
  if (field.wrefs.length === 1) {
33520
33548
  const pad = " ".repeat(Math.max(1, 9 - field.name.length));
33521
- out(` ${c.dim}${field.name}:${c.reset}${pad}${pinnedWref(c, escapeTerminalTextForDisplay(field.wrefs[0]))}`);
33549
+ out(` ${c.dim}${escapeTerminalTextForDisplay(field.name)}:${c.reset}${pad}${pinnedWref(c, field.wrefs[0])}`);
33522
33550
  } else {
33523
- out(` ${c.dim}${field.name}:${c.reset}`);
33551
+ out(` ${c.dim}${escapeTerminalTextForDisplay(field.name)}:${c.reset}`);
33524
33552
  for (const w of field.wrefs) {
33525
- out(` ${pinnedWref(c, escapeTerminalTextForDisplay(w))}`);
33553
+ out(` ${pinnedWref(c, w)}`);
33526
33554
  }
33527
33555
  }
33528
33556
  }
@@ -33531,7 +33559,7 @@ function renderThing(out, c, result) {
33531
33559
  const lines = JSON.stringify(result.data, null, 2).split(`
33532
33560
  `);
33533
33561
  for (const line of lines) {
33534
- out(` ${line}`);
33562
+ out(` ${escapeTerminalTextForDisplay(line)}`);
33535
33563
  }
33536
33564
  }
33537
33565
  }
@@ -33547,14 +33575,14 @@ function renderCollectionSummary(out, c, collection) {
33547
33575
  return;
33548
33576
  out(` ${c.dim}preview:${c.reset}`);
33549
33577
  for (const wref of preview) {
33550
- out(` ${pinnedWref(c, escapeTerminalTextForDisplay(wref))}`);
33578
+ out(` ${pinnedWref(c, wref)}`);
33551
33579
  }
33552
33580
  }
33553
33581
  function renderDataBlock(out, data, indent) {
33554
33582
  const lines = JSON.stringify(data, null, 2).split(`
33555
33583
  `);
33556
33584
  for (const line of lines) {
33557
- out(`${indent}${line}`);
33585
+ out(`${indent}${escapeTerminalTextForDisplay(line)}`);
33558
33586
  }
33559
33587
  }
33560
33588
  function renderGraphValue(out, c, value, indent) {
@@ -33594,7 +33622,7 @@ function renderGraphNode(out, c, result, indent = "") {
33594
33622
  if (resolvedEntries.length > 0) {
33595
33623
  out(`${indent} ${c.dim}resolved:${c.reset}`);
33596
33624
  for (const [fieldPath, value] of resolvedEntries) {
33597
- out(`${indent} ${c.dim}${fieldPath}:${c.reset}`);
33625
+ out(`${indent} ${c.dim}${escapeTerminalTextForDisplay(fieldPath)}:${c.reset}`);
33598
33626
  renderGraphValue(out, c, value, `${indent} `);
33599
33627
  }
33600
33628
  }
@@ -33620,7 +33648,7 @@ function renderHistory(out, c, result) {
33620
33648
  }
33621
33649
  const firstMeta = result.versions?.[0]?.metadata;
33622
33650
  if (firstMeta?.durableId) {
33623
- out(` ${c.dim}durableId:${c.reset} ${styleDurableId(firstMeta.durableId, c)}`);
33651
+ out(` ${c.dim}durableId:${c.reset} ${styleDurableId(escapeTerminalTextForDisplay(firstMeta.durableId), c)}`);
33624
33652
  }
33625
33653
  const versions = result.versions ?? [];
33626
33654
  const now = Date.now();
@@ -33629,7 +33657,7 @@ function renderHistory(out, c, result) {
33629
33657
  if (ver.operation === "add") {
33630
33658
  op = `${c.green}add${c.reset}`;
33631
33659
  } else if (ver.operation === "retract") {
33632
- const reason = ver.retractReason ? ` ${c.dim}'${ver.retractReason.length > 80 ? `${ver.retractReason.slice(0, 77)}...` : ver.retractReason}'${c.reset}` : "";
33660
+ const reason = ver.retractReason ? ` ${c.dim}'${escapeTerminalTextForDisplay(ver.retractReason.length > 80 ? `${ver.retractReason.slice(0, 77)}...` : ver.retractReason)}'${c.reset}` : "";
33633
33661
  op = `${c.red}retract${c.reset}${reason}`;
33634
33662
  } else {
33635
33663
  op = `${c.yellow}revise${c.reset}`;
@@ -33650,12 +33678,12 @@ function renderRefs(out, c, result, wref, direction) {
33650
33678
  return;
33651
33679
  }
33652
33680
  const label = direction === "inbound" ? "References to" : "Referenced by";
33653
- out(`${c.bold}${label}${c.reset} ${c.cyan}${wref}${c.reset}`);
33681
+ out(`${c.bold}${label}${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(wref)}${c.reset}`);
33654
33682
  out(`${c.dim}${"─".repeat(60)}${c.reset}`);
33655
33683
  for (const item of items) {
33656
33684
  const refWref = pinnedWref(c, item.wref, item.version);
33657
33685
  const kl = kindLabel(c, effectiveKind(item.kind ?? "thing", item.shapeName));
33658
- const field = `${c.dim}via ${c.reset}${item.fieldPath}`;
33686
+ const field = `${c.dim}via ${c.reset}${escapeTerminalTextForDisplay(item.fieldPath ?? "(unknown)")}`;
33659
33687
  out(` ${refWref} ${kl} ${field}`);
33660
33688
  }
33661
33689
  out(`${c.dim}${items.length} ref(s)${c.reset}`);
@@ -33685,7 +33713,7 @@ function renderBatchView(out, c, result, wrefs, flagsVersion) {
33685
33713
  if (event.kind === "miss")
33686
33714
  continue;
33687
33715
  if (event.kind === "desync") {
33688
- out(` ${event.requested} ${c.red}[no result]${c.reset}`);
33716
+ out(` ${escapeTerminalTextForDisplay(event.requested)} ${c.red}[no result]${c.reset}`);
33689
33717
  continue;
33690
33718
  }
33691
33719
  const { requested, item } = event;
@@ -33694,12 +33722,12 @@ function renderBatchView(out, c, result, wrefs, flagsVersion) {
33694
33722
  const base = requestedBase.length > 0 ? requestedBase : fallback.replace(/@v\d+$/, "");
33695
33723
  const kl = kindLabel(c, effectiveKind(item.kind ?? "thing", item.shapeName));
33696
33724
  const retractedTag = item.active === false ? ` ${c.red}[RETRACTED]${c.reset}` : "";
33697
- out(` ${base}@v${item.version} ${kl}${retractedTag}`);
33725
+ out(` ${escapeTerminalTextForDisplay(base)}@v${item.version} ${kl}${retractedTag}`);
33698
33726
  }
33699
33727
  if (result.missing.length > 0) {
33700
33728
  out("Missing:");
33701
33729
  for (const wref of result.missing) {
33702
- out(` ${wref}`);
33730
+ out(` ${escapeTerminalTextForDisplay(wref)}`);
33703
33731
  }
33704
33732
  }
33705
33733
  }
@@ -34459,7 +34487,7 @@ var handleResolve = async (ctx, { args }) => {
34459
34487
  writeOutput(ctx, result, () => {
34460
34488
  const wref2 = result.wref ?? result.name ?? "(unknown)";
34461
34489
  ctx.out(`${pinnedWref(c, wref2, result.version)} ${kindLabel(c, result.kind ?? "thing")}`);
34462
- ctx.out(` ${c.dim}wref:${c.reset} ${wref2}`);
34490
+ ctx.out(` ${c.dim}wref:${c.reset} ${escapeTerminalTextForDisplay(wref2)}`);
34463
34491
  ctx.out(` ${c.dim}version:${c.reset} ${result.version ?? "-"}`);
34464
34492
  ctx.out(` ${c.dim}active:${c.reset} ${String(result.active)}`);
34465
34493
  });
@@ -36165,7 +36193,7 @@ function renderTokenInfo(ctx, info, profileName, apiUrl, identityWref) {
36165
36193
  ctx.status(`${c.dim}Check the value of your WH_TOKEN environment variable.${c.reset}`);
36166
36194
  } else if (info.source === "device") {
36167
36195
  if (info.canRefresh) {
36168
- ctx.status(`${prefix}${c.bold}${info.email ?? "unknown"}${c.reset} via ${via} ${c.dim}(token expired at ${expiry} — will auto-refresh)${c.reset}${endpoint}`);
36196
+ ctx.status(`${prefix}${c.bold}${info.email ?? "unknown"}${c.reset} via ${via} ${c.dim}(token expired at ${expiry} — refresh token available)${c.reset}${endpoint}`);
36169
36197
  } else {
36170
36198
  ctx.status(`${prefix}${c.red}Session expired${c.reset}${email} via ${via} ${c.dim}(expired at ${expiry})${c.reset}${endpoint}`);
36171
36199
  ctx.status(`${c.dim}Run: wh auth login${profileName && profileName !== "default" ? ` --profile ${profileName}` : ""}${c.reset}`);
@@ -36212,6 +36240,26 @@ var loginFlags = {
36212
36240
  }),
36213
36241
  ...profileFlag
36214
36242
  };
36243
+ function authStatusEntry(info, options) {
36244
+ return {
36245
+ active: options.active,
36246
+ apiUrl: options.apiUrl ?? null,
36247
+ authenticated: !info.expired,
36248
+ canRefresh: info.canRefresh,
36249
+ email: info.email ?? null,
36250
+ expiresAt: info.expiresAt ?? null,
36251
+ identityWref: options.identityWref ?? null,
36252
+ profile: options.profile ?? null,
36253
+ source: info.source
36254
+ };
36255
+ }
36256
+ function authStatusOutput(activeProfile, entries) {
36257
+ return {
36258
+ activeProfile,
36259
+ authenticated: entries.some((entry) => entry.active && entry.authenticated),
36260
+ entries
36261
+ };
36262
+ }
36215
36263
  var handleLogin = async (ctx, { flags }) => {
36216
36264
  const profile = flags.profile ?? ctx.config.profile ?? "default";
36217
36265
  if (flags["with-token"]) {
@@ -36306,7 +36354,7 @@ var handleStatus = async (ctx, { flags }) => {
36306
36354
  if (selectedProfile) {
36307
36355
  const prof = getProfile(selectedProfile);
36308
36356
  if (!prof) {
36309
- ctx.status(`Not logged in for profile ${c.bold}${selectedProfile}${c.reset}. Run: wh auth login --profile ${selectedProfile}`);
36357
+ writeOutput(ctx, authStatusOutput(selectedProfile, []), () => ctx.status(`Not logged in for profile ${c.bold}${selectedProfile}${c.reset}. Run: wh auth login --profile ${selectedProfile}`));
36310
36358
  return;
36311
36359
  }
36312
36360
  const tokens = prof.tokens;
@@ -36320,17 +36368,26 @@ var handleStatus = async (ctx, { flags }) => {
36320
36368
  canRefresh: source === "device" && !!tokens.refreshToken
36321
36369
  };
36322
36370
  const identityWref = info.expired ? null : await fetchIdentityWref(ctx);
36323
- renderTokenInfo(ctx, info, selectedProfile, prof.apiUrl, identityWref);
36371
+ const entry = authStatusEntry(info, {
36372
+ active: true,
36373
+ apiUrl: prof.apiUrl,
36374
+ identityWref,
36375
+ profile: selectedProfile
36376
+ });
36377
+ writeOutput(ctx, authStatusOutput(selectedProfile, [entry]), () => renderTokenInfo(ctx, info, selectedProfile, prof.apiUrl, identityWref));
36324
36378
  return;
36325
36379
  }
36326
36380
  const envToken = process.env.WH_TOKEN;
36381
+ const activeProfile = ctx.config.profile ?? "default";
36382
+ const entries = [];
36383
+ const prettyEntries = [];
36327
36384
  if (envToken) {
36328
36385
  const envInfo = getTokenInfo();
36329
36386
  if (envInfo) {
36330
- renderTokenInfo(ctx, envInfo);
36387
+ entries.push(authStatusEntry(envInfo, { active: true }));
36388
+ prettyEntries.push(() => renderTokenInfo(ctx, envInfo));
36331
36389
  }
36332
36390
  }
36333
- const activeProfile = ctx.config.profile ?? "default";
36334
36391
  const profiles = listProfiles();
36335
36392
  for (const name of profiles) {
36336
36393
  const prof = getProfile(name);
@@ -36346,12 +36403,22 @@ var handleStatus = async (ctx, { flags }) => {
36346
36403
  canRefresh: source === "device" && !!tokens.refreshToken
36347
36404
  };
36348
36405
  const identityWref = !info.expired && name === activeProfile ? await fetchIdentityWref(ctx) : null;
36349
- renderTokenInfo(ctx, info, name, prof.apiUrl, identityWref);
36406
+ entries.push(authStatusEntry(info, {
36407
+ active: !envToken && name === activeProfile,
36408
+ apiUrl: prof.apiUrl,
36409
+ identityWref,
36410
+ profile: name
36411
+ }));
36412
+ prettyEntries.push(() => renderTokenInfo(ctx, info, name, prof.apiUrl, identityWref));
36350
36413
  }
36351
36414
  }
36352
- if (!envToken && profiles.length === 0) {
36353
- ctx.status("Not logged in. Run: wh auth login");
36354
- }
36415
+ writeOutput(ctx, authStatusOutput(envToken ? null : activeProfile, entries), () => {
36416
+ for (const render of prettyEntries)
36417
+ render();
36418
+ if (!envToken && profiles.length === 0) {
36419
+ ctx.status("Not logged in. Run: wh auth login");
36420
+ }
36421
+ });
36355
36422
  };
36356
36423
  var statusVerb = {
36357
36424
  prime: true,
@@ -37799,6 +37866,10 @@ function buildAddOperations(input) {
37799
37866
  const rawAbout = pick(abouts, i, { allowBroadcast: true });
37800
37867
  const about = rawAbout ? parseCollectionAboutFlag(rawAbout) : rawAbout;
37801
37868
  const kindFlag = pick(kinds, i, { allowBroadcast: true });
37869
+ const addNameParts = addName.split("/");
37870
+ if (shape && addNameParts.length === 2 && addNameParts[0] === shape) {
37871
+ throw new CliError(2 /* UserInput */, "USER_INPUT", `--add value "${addName}" already includes the --shape prefix "${shape}/".`, undefined, "Pass a bare name with --shape (for example: wh commit submit --add item --shape Shape), or omit --shape and pass the full wref.");
37872
+ }
37802
37873
  const localName = shape ? `${shape}/${addName}` : addName;
37803
37874
  const kind = kindFlag ?? (about ? "assertion" : "thing");
37804
37875
  return { operation: "add", kind, name: localName, data, about };
@@ -39608,15 +39679,15 @@ function renderValidationResult(ctx, result) {
39608
39679
  if (result.errors.length > 0) {
39609
39680
  ctx.out(`${c.red}Validation failed${c.reset}`);
39610
39681
  for (const err of result.errors) {
39611
- ctx.out(` ${c.red}error${c.reset}: ${err}`);
39682
+ ctx.out(` ${c.red}error${c.reset}: ${escapeTerminalTextForDisplay(err)}`);
39612
39683
  }
39613
39684
  }
39614
39685
  for (const finding of result.findings) {
39615
39686
  const color = finding.level === "error" ? c.red : finding.level === "warning" ? c.yellow : c.dim;
39616
- ctx.out(` ${color}${finding.level}${c.reset} [${finding.code}]: ${finding.message}`);
39687
+ ctx.out(` ${color}${finding.level}${c.reset} [${escapeTerminalTextForDisplay(finding.code)}]: ${escapeTerminalTextForDisplay(finding.message)}`);
39617
39688
  }
39618
39689
  for (const warn of result.warnings) {
39619
- ctx.out(` ${c.yellow}warning${c.reset}: ${warn}`);
39690
+ ctx.out(` ${c.yellow}warning${c.reset}: ${escapeTerminalTextForDisplay(warn)}`);
39620
39691
  }
39621
39692
  if (result.valid && result.errors.length === 0) {
39622
39693
  ctx.out(`${c.green}Valid component package${c.reset}`);
@@ -39626,29 +39697,29 @@ function renderValidationResult(ctx, result) {
39626
39697
  function renderDoctorResult(ctx, result) {
39627
39698
  const c = ctx.colors;
39628
39699
  const stateColor = stateToColor(c, result.state);
39629
- ctx.out(`${c.bold}Doctor:${c.reset} ${c.cyan}${result.componentName}${c.reset} ${stateColor}${result.state}${c.reset}`);
39700
+ ctx.out(`${c.bold}Doctor:${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(result.componentName)}${c.reset} ${stateColor}${escapeTerminalTextForDisplay(result.state)}${c.reset}`);
39630
39701
  ctx.out("");
39631
39702
  for (const finding of result.findings) {
39632
39703
  const color = finding.status === "ok" ? c.green : finding.status === "missing" || finding.status === "error" ? c.red : finding.status === "inactive" ? c.yellow : c.dim;
39633
- ctx.out(` ${color}${finding.status}${c.reset} ${finding.resource} ${c.dim}${finding.message}${c.reset}`);
39704
+ ctx.out(` ${color}${escapeTerminalTextForDisplay(finding.status)}${c.reset} ${escapeTerminalTextForDisplay(finding.resource)} ${c.dim}${escapeTerminalTextForDisplay(finding.message)}${c.reset}`);
39634
39705
  }
39635
39706
  }
39636
39707
  function renderTeardownResult(ctx, result) {
39637
39708
  const c = ctx.colors;
39638
39709
  const stateColor = stateToColor(c, result.state);
39639
- ctx.out(`${c.bold}Teardown:${c.reset} ${c.cyan}${result.componentName}${c.reset} ${stateColor}${result.state}${c.reset}`);
39710
+ ctx.out(`${c.bold}Teardown:${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(result.componentName)}${c.reset} ${stateColor}${escapeTerminalTextForDisplay(result.state)}${c.reset}`);
39640
39711
  if (result.pausedSubscriptions.length > 0) {
39641
- ctx.out(` ${c.green}paused${c.reset} ${result.pausedSubscriptions.length} subscription(s): ${result.pausedSubscriptions.join(", ")}`);
39712
+ ctx.out(` ${c.green}paused${c.reset} ${result.pausedSubscriptions.length} subscription(s): ${result.pausedSubscriptions.map(escapeTerminalTextForDisplay).join(", ")}`);
39642
39713
  }
39643
39714
  if (result.releasedShapes.length > 0) {
39644
- ctx.out(` ${c.green}released${c.reset} ${result.releasedShapes.length} shape(s): ${result.releasedShapes.join(", ")}`);
39715
+ ctx.out(` ${c.green}released${c.reset} ${result.releasedShapes.length} shape(s): ${result.releasedShapes.map(escapeTerminalTextForDisplay).join(", ")}`);
39645
39716
  }
39646
39717
  if (result.tokensRevoked > 0) {
39647
39718
  ctx.out(` ${c.green}revoked${c.reset} ${result.tokensRevoked} token(s)`);
39648
39719
  }
39649
39720
  ctx.out(` uninstall callback: ${result.uninstallDispatched ? `${c.green}dispatched${c.reset}` : `${c.dim}not dispatched${c.reset}`}`);
39650
39721
  for (const warning of result.warnings) {
39651
- ctx.out(` ${c.yellow}warning${c.reset}: ${warning}`);
39722
+ ctx.out(` ${c.yellow}warning${c.reset}: ${escapeTerminalTextForDisplay(warning)}`);
39652
39723
  }
39653
39724
  }
39654
39725
  function redactRegistryEntryLifecycleUrls(entry, showSecrets) {
@@ -39668,26 +39739,26 @@ function redactRegistryEntryListLifecycleUrls(entries, showSecrets) {
39668
39739
  function renderRegistryList(ctx, orgName, result) {
39669
39740
  const c = ctx.colors;
39670
39741
  if (!result.items.length) {
39671
- ctx.status(`${c.dim}No registered components in ${orgName}${c.reset}`);
39742
+ ctx.status(`${c.dim}No registered components in ${escapeTerminalTextForDisplay(orgName)}${c.reset}`);
39672
39743
  return;
39673
39744
  }
39674
- ctx.out(`${c.bold}Registered Components${c.reset} ${c.cyan}${orgName}${c.reset}`);
39745
+ ctx.out(`${c.bold}Registered Components${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(orgName)}${c.reset}`);
39675
39746
  ctx.out("");
39676
39747
  for (const item of result.items) {
39677
39748
  const visibility = item.isPrivate ? `${c.yellow}private${c.reset}` : `${c.green}public${c.reset}`;
39678
- const description = item.description ? ` ${c.dim}${item.description}${c.reset}` : "";
39679
- ctx.out(` ${c.cyan}${orgName}/${item.componentName}${c.reset} ${visibility}${description}`);
39749
+ const description = item.description ? ` ${c.dim}${escapeTerminalTextForDisplay(item.description)}${c.reset}` : "";
39750
+ ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(orgName)}/${escapeTerminalTextForDisplay(item.componentName)}${c.reset} ${visibility}${description}`);
39680
39751
  }
39681
39752
  }
39682
39753
  function renderRegistryEntry(ctx, entry) {
39683
39754
  const c = ctx.colors;
39684
- ctx.out(`${c.bold}${entry.ownerOrgName}/${entry.componentName}${c.reset} ${entry.isPrivate ? `${c.yellow}[private]${c.reset}` : `${c.green}[public]${c.reset}`}`);
39755
+ ctx.out(`${c.bold}${escapeTerminalTextForDisplay(entry.ownerOrgName)}/${escapeTerminalTextForDisplay(entry.componentName)}${c.reset} ${entry.isPrivate ? `${c.yellow}[private]${c.reset}` : `${c.green}[public]${c.reset}`}`);
39685
39756
  if (entry.description) {
39686
- ctx.out(` ${entry.description}`);
39757
+ ctx.out(` ${escapeTerminalTextForDisplay(entry.description)}`);
39687
39758
  }
39688
39759
  if (entry.sourceUrl) {
39689
- const suffix = entry.sourceDefaultRef ? ` @ ${entry.sourceDefaultRef}` : "";
39690
- ctx.out(` Source: ${entry.sourceUrl}${suffix}`);
39760
+ const suffix = entry.sourceDefaultRef ? ` @ ${escapeTerminalTextForDisplay(entry.sourceDefaultRef)}` : "";
39761
+ ctx.out(` Source: ${escapeTerminalTextForDisplay(entry.sourceUrl)}${suffix}`);
39691
39762
  } else {
39692
39763
  ctx.out(` Source: ${c.dim}(not installable — no source URL)${c.reset}`);
39693
39764
  }
@@ -39698,10 +39769,10 @@ function renderRegistryEntry(ctx, entry) {
39698
39769
  ctx.out(` Uninstall: ${formatLifecycleUrl(entry.uninstallUrl, c)}`);
39699
39770
  }
39700
39771
  if (entry.credentialSetName || entry.credentialSetId) {
39701
- ctx.out(` Credential set: ${entry.credentialSetName ?? entry.credentialSetId}`);
39772
+ ctx.out(` Credential set: ${escapeTerminalTextForDisplay(entry.credentialSetName ?? entry.credentialSetId ?? "")}`);
39702
39773
  }
39703
39774
  if (entry.allowedCallbackDomains.length > 0) {
39704
- ctx.out(` Allowed callback domains: ${entry.allowedCallbackDomains.join(", ")}`);
39775
+ ctx.out(` Allowed callback domains: ${entry.allowedCallbackDomains.map(escapeTerminalTextForDisplay).join(", ")}`);
39705
39776
  }
39706
39777
  ctx.out(` ${c.dim}Updated: ${new Date(entry.updatedAt).toISOString().slice(0, 16)}${c.reset}`);
39707
39778
  }
@@ -39737,13 +39808,13 @@ function redactSecretBearingUrl(rawUrl) {
39737
39808
  }
39738
39809
  function formatLifecycleUrl(url, colors) {
39739
39810
  if (url === REDACTED_LIFECYCLE_URL) {
39740
- return `${colors.dim}${url}${colors.reset}`;
39811
+ return `${colors.dim}${escapeTerminalTextForDisplay(url)}${colors.reset}`;
39741
39812
  }
39742
39813
  if (url.endsWith(REDACTED_LIFECYCLE_PATH_SUFFIX)) {
39743
39814
  const visiblePrefix = url.slice(0, -REDACTED_LIFECYCLE_PATH_SUFFIX.length);
39744
- return `${visiblePrefix}${colors.dim}${REDACTED_LIFECYCLE_PATH_SUFFIX}${colors.reset}`;
39815
+ return `${escapeTerminalTextForDisplay(visiblePrefix)}${colors.dim}${REDACTED_LIFECYCLE_PATH_SUFFIX}${colors.reset}`;
39745
39816
  }
39746
- return url;
39817
+ return escapeTerminalTextForDisplay(url);
39747
39818
  }
39748
39819
 
39749
39820
  // ../../packages/warmhub-cli/src/domains/component-utils.ts
@@ -40296,12 +40367,13 @@ var handleList2 = async (ctx, { flags }) => {
40296
40367
  ctx.out(`${c.bold}Installed Components${c.reset} ${c.cyan}${org}/${repo}${c.reset}`);
40297
40368
  ctx.out("");
40298
40369
  for (const item of items) {
40299
- const version = item.version ?? "unknown";
40300
- const state = item.state ?? "unknown";
40301
- const source = item.source ?? "-";
40302
- const stateColor = stateToColor2(c, state);
40303
- const update = item.updateAvailable && item.latestVersion ? ` ${c.yellow}(${item.latestVersion} available)${c.reset}` : "";
40304
- ctx.out(` ${c.cyan}${item.ref ?? item.componentName}${c.reset} ${stateColor}${state}${c.reset} ${c.dim}v${version}${c.reset}${update} ${source}`);
40370
+ const version = escapeTerminalTextForDisplay(item.version ?? "unknown");
40371
+ const rawState = item.state ?? "unknown";
40372
+ const state = escapeTerminalTextForDisplay(rawState);
40373
+ const source = escapeTerminalTextForDisplay(item.source ?? "-");
40374
+ const stateColor = stateToColor2(c, rawState);
40375
+ const update = item.updateAvailable && item.latestVersion ? ` ${c.yellow}(${escapeTerminalTextForDisplay(item.latestVersion)} available)${c.reset}` : "";
40376
+ ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(item.ref ?? item.componentName)}${c.reset} ${stateColor}${state}${c.reset} ${c.dim}v${version}${c.reset}${update} ${source}`);
40305
40377
  }
40306
40378
  });
40307
40379
  };
@@ -42193,12 +42265,12 @@ var handleView5 = async (ctx, { args }) => {
42193
42265
  const c = ctx.colors;
42194
42266
  const result = await ctx.client.org.get(name);
42195
42267
  writeOutput(ctx, result, () => {
42196
- ctx.out(`${c.bold}${result.name}${c.reset}`);
42268
+ ctx.out(`${c.bold}${escapeTerminalTextForDisplay(result.name)}${c.reset}`);
42197
42269
  if (result.displayName) {
42198
- ctx.out(` ${result.displayName}`);
42270
+ ctx.out(` ${escapeTerminalTextForDisplay(result.displayName)}`);
42199
42271
  }
42200
42272
  if (result.description) {
42201
- ctx.out(` ${c.dim}${result.description}${c.reset}`);
42273
+ ctx.out(` ${c.dim}${escapeTerminalTextForDisplay(result.description)}${c.reset}`);
42202
42274
  }
42203
42275
  if (result.tier !== "free") {
42204
42276
  ctx.out(` ${c.cyan}Tier: ${result.tier}${c.reset}`);
@@ -42226,10 +42298,10 @@ var handleList4 = async (ctx, { flags }) => {
42226
42298
  }
42227
42299
  ctx.out(`${c.bold}Organizations:${c.reset}`);
42228
42300
  for (const org of result.items) {
42229
- const display = org.displayName ? ` ${c.dim}${org.displayName}${c.reset}` : "";
42230
- const desc = org.description ? ` ${c.dim}${org.description}${c.reset}` : "";
42301
+ const display = org.displayName ? ` ${c.dim}${escapeTerminalTextForDisplay(org.displayName)}${c.reset}` : "";
42302
+ const desc = org.description ? ` ${c.dim}${escapeTerminalTextForDisplay(org.description)}${c.reset}` : "";
42231
42303
  const archived = org.archivedAt ? ` ${c.yellow}[archived]${c.reset}` : "";
42232
- ctx.out(` ${c.cyan}${org.name}${c.reset}${display}${desc}${archived}`);
42304
+ ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(org.name)}${c.reset}${display}${desc}${archived}`);
42233
42305
  }
42234
42306
  });
42235
42307
  };
@@ -42879,10 +42951,10 @@ var handleList5 = async (ctx, { flags, args }) => {
42879
42951
  }
42880
42952
  ctx.out(`${c.bold}Repos in ${orgName}:${c.reset}`);
42881
42953
  for (const r of items) {
42882
- const display = r.displayName && r.displayName !== r.name ? ` ${c.dim}${r.displayName}${c.reset}` : "";
42883
- const desc = r.description ? ` ${c.dim}${r.description}${c.reset}` : "";
42954
+ const display = r.displayName && r.displayName !== r.name ? ` ${c.dim}${escapeTerminalTextForDisplay(r.displayName)}${c.reset}` : "";
42955
+ const desc = r.description ? ` ${c.dim}${escapeTerminalTextForDisplay(r.description)}${c.reset}` : "";
42884
42956
  const archived = r.archivedAt ? ` ${c.yellow}[archived]${c.reset}` : "";
42885
- ctx.out(` ${c.cyan}${orgName}/${r.name}${c.reset}${display}${desc}${archived}`);
42957
+ ctx.out(` ${c.cyan}${orgName}/${escapeTerminalTextForDisplay(r.name)}${c.reset}${display}${desc}${archived}`);
42886
42958
  }
42887
42959
  });
42888
42960
  };
@@ -43015,7 +43087,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
43015
43087
  writeOutput(ctx, payload, () => {
43016
43088
  ctx.out(`${c.bold}${org}/${repo}${c.reset}`);
43017
43089
  if (repoInfo.description) {
43018
- ctx.out(` ${repoInfo.description}`);
43090
+ ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.description)}`);
43019
43091
  }
43020
43092
  ctx.out("");
43021
43093
  ctx.out(`${c.bold}Counts${c.reset} ${stats.byKind.shape} shapes, ${stats.byKind.thing} things, ${stats.byKind.assertion} assertions (${stats.total} total)`);
@@ -43023,7 +43095,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
43023
43095
  if (shapeCountEntries.length > 0) {
43024
43096
  const maxName = shapeCountEntries.reduce((max, [name]) => Math.max(max, name.length), 0);
43025
43097
  for (const [shapeName, count] of shapeCountEntries) {
43026
- ctx.out(` ${c.cyan}${shapeName.padEnd(maxName)}${c.reset} ${count}`);
43098
+ ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(shapeName.padEnd(maxName))}${c.reset} ${count}`);
43027
43099
  }
43028
43100
  }
43029
43101
  ctx.out("");
@@ -43090,9 +43162,9 @@ var handleDescribe = async (ctx, { args, flags }) => {
43090
43162
  const maxField = allEntries.reduce((m, e) => Math.max(m, e.fieldPath.length), 0);
43091
43163
  const maxState = allEntries.reduce((m, e) => Math.max(m, e.state.length), 0);
43092
43164
  for (const entry of allEntries) {
43093
- const shapeLabel = entry.shapeName.padEnd(maxShape);
43094
- const fieldLabel = entry.fieldPath.padEnd(maxField);
43095
- const stateLabel = entry.state.padEnd(maxState);
43165
+ const shapeLabel = escapeTerminalTextForDisplay(entry.shapeName.padEnd(maxShape));
43166
+ const fieldLabel = escapeTerminalTextForDisplay(entry.fieldPath.padEnd(maxField));
43167
+ const stateLabel = escapeTerminalTextForDisplay(entry.state.padEnd(maxState));
43096
43168
  const sc = stateColor(entry.state);
43097
43169
  let line = ` ${c.cyan}${shapeLabel}${c.reset} ${c.dim}${fieldLabel}${c.reset} ${sc}${stateLabel}${c.reset}`;
43098
43170
  if (entry.state === "building" && entry.backfillTotal != null && entry.backfillTotal > 0) {
@@ -43101,7 +43173,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
43101
43173
  } else if (entry.state === "building") {
43102
43174
  line += ` ${c.dim}${entry.backfillDone} rows${c.reset}`;
43103
43175
  } else if (entry.state === "failed" && entry.failureReason) {
43104
- line += ` ${c.dim}${entry.failureReason}${c.reset}`;
43176
+ line += ` ${c.dim}${escapeTerminalTextForDisplay(entry.failureReason)}${c.reset}`;
43105
43177
  }
43106
43178
  ctx.out(line);
43107
43179
  }
@@ -43155,10 +43227,11 @@ var handleView6 = async (ctx, { args }) => {
43155
43227
  writeOutput(ctx, { ...repoInfo, stats, configureStats }, () => {
43156
43228
  ctx.out(`${c.bold}${org}/${repo}${c.reset}`);
43157
43229
  if (repoInfo.displayName && repoInfo.displayName !== repoInfo.name) {
43158
- ctx.out(` ${repoInfo.displayName}`);
43230
+ ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.displayName)}`);
43231
+ }
43232
+ if (repoInfo.description) {
43233
+ ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.description)}`);
43159
43234
  }
43160
- if (repoInfo.description)
43161
- ctx.out(` ${repoInfo.description}`);
43162
43235
  if (repoInfo.archivedAt) {
43163
43236
  ctx.out(`${c.yellow}ARCHIVED${c.reset} ${c.dim}${new Date(repoInfo.archivedAt).toISOString().slice(0, 16)}${c.reset}`);
43164
43237
  }
@@ -46421,7 +46494,7 @@ function resolveLogLevel(flags, env) {
46421
46494
  // package.json
46422
46495
  var package_default3 = {
46423
46496
  name: "@warmhub/cli",
46424
- version: "0.71.0",
46497
+ version: "0.72.0",
46425
46498
  private: false,
46426
46499
  type: "module",
46427
46500
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -47076,4 +47149,4 @@ if (!updateCheckSuppressedByArgv && shouldRunUpdateCheck(updateEligibility)) {
47076
47149
  var interceptedExitCode = await maybeHandleComponentShellBoundary(dispatchArgv);
47077
47150
  process.exitCode = interceptedExitCode === undefined ? await runCli(dispatchArgv, { version: package_default3.version }) : interceptedExitCode;
47078
47151
 
47079
- //# debugId=94B2C7EE252C64A264756E2164756E21
47152
+ //# debugId=32195DBCBD952F6364756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmhub/cli",
3
- "version": "0.71.0",
3
+ "version": "0.72.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",