@warmhub/cli 0.70.0 → 0.71.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 (3) hide show
  1. package/README.md +12 -24
  2. package/dist/wh.js +195 -11
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -23,33 +23,21 @@ $ wh auth login
23
23
  Opening browser to authenticate...
24
24
  ✓ Logged in as alice@example.com
25
25
 
26
- $ wh thing search "Josh Gottheimer" --repo warmhub-data/congress-members --limit 3
27
- Legislator/g000583@v1 thing
26
+ $ wh thing search "Josh Gottheimer" --repo warmhub-data/us.congress --limit 3
27
+ Legislator/g000583@v2 thing
28
28
  {"gender":"M","full_name":"Josh Gottheimer","in_office":true,"last_name":"Got...
29
- MembershipTerm/g000583/119@v1 assertion
30
- {"party":"Democratic","state":"NJ","chamber":"house","district":5,"end_date":...
31
- Legislator/r000622@v1 thing
32
- {"gender":"M","full_name":"Josh Riley","in_office":true,"last_name":"Riley","...
29
+ CommitteeAssignment/g000583--hsba10@v1 assertion
30
+ {"rank":"2","role":"member","party":"minority","bioguide_id":"G000583",...
31
+ CommitteeAssignment/g000583--hsba16@v1 assertion
32
+ {"rank":"5","role":"member","party":"minority","bioguide_id":"G000583",...
33
33
  3 result(s)
34
34
 
35
- $ wh thing about wh:warmhub-data/congress-members/Legislator/g000583 \
36
- --repo warmhub-data/congress-trading --resolve-collections --limit 5
37
- Assertions about wh:warmhub-data/congress-members/Legislator/g000583 (5+)
38
- StockTrade/2023/20024097/32@v1
39
- about: Pair/Legislator+Security/g000583v1+tmov1@v1
40
- {"owner":"joint","amount":"$1,001 - $15,000","ticker":"TMO","tx_type":"sale",...
41
- StockTrade/2023/20024097/31@v1
42
- about: Pair/Legislator+Security/g000583v1+nowv1@v1
43
- {"owner":"joint","amount":"$1,001 - $15,000","ticker":"NOW","tx_type":"purcha...
44
- StockTrade/2023/20024097/30@v1
45
- about: Pair/Legislator+Security/g000583v1+nowv1@v1
46
- {"owner":"joint","amount":"$1,001 - $15,000","ticker":"NOW","tx_type":"purcha...
47
- StockTrade/2023/20024097/29@v1
48
- about: Pair/Legislator+Security/g000583v1+nowv1@v1
49
- {"owner":"joint","amount":"$1,001 - $15,000","ticker":"NOW","tx_type":"purcha...
50
- StockTrade/2023/20024097/28@v1
51
- about: Pair/Legislator+Security/g000583v1+crmv1@v1
52
- {"owner":"joint","amount":"$1,001 - $15,000","ticker":"CRM","tx_type":"sale_p...
35
+ $ wh thing about CongressTrade/20034954/bd598743649e738e-2 \
36
+ --repo warmhub-data/us.congress.trades --resolve-collections --limit 5
37
+ Assertions about CongressTrade/20034954/bd598743649e738e-2 (1)
38
+ CongressTradeSecurity/20034954/bd598743649e738e-2--0000858877@v1
39
+ about: Pair/congress-trade-20034954-bd598743649e738e-2-security-listing-0000858877@v1
40
+ {"cik10":"0000858877","ticker_raw":"CSCO","trade_date":"2026-06-12",...
53
41
  ```
54
42
 
55
43
  ## Reference
package/dist/wh.js CHANGED
@@ -27136,7 +27136,7 @@ function findSystemComponent(componentId) {
27136
27136
  // ../../packages/sdk-ts/package.json
27137
27137
  var package_default = {
27138
27138
  name: "@warmhub/sdk-ts",
27139
- version: "0.69.0",
27139
+ version: "0.69.1",
27140
27140
  private: false,
27141
27141
  type: "module",
27142
27142
  description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -32621,6 +32621,7 @@ function makeChars(env = process.env) {
32621
32621
  function makeColors(opts) {
32622
32622
  const enabled = !opts.noColor && opts.isTTY;
32623
32623
  const on = (code) => enabled ? code : "";
32624
+ const truecolor = enabled && /^(truecolor|24bit)$/i.test((opts.colorterm ?? "").trim());
32624
32625
  return {
32625
32626
  reset: on("\x1B[0m"),
32626
32627
  bold: on("\x1B[1m"),
@@ -32631,7 +32632,8 @@ function makeColors(opts) {
32631
32632
  blue: on("\x1B[34m"),
32632
32633
  cyan: on("\x1B[36m"),
32633
32634
  magenta: on("\x1B[35m"),
32634
- gray: on("\x1B[90m")
32635
+ gray: on("\x1B[90m"),
32636
+ truecolor
32635
32637
  };
32636
32638
  }
32637
32639
  function formatTime(ts, now) {
@@ -33072,6 +33074,13 @@ var CANONICAL_WREF_PATTERN_RE = new RegExp(String.raw`^wh:${WREF_SEGMENT}/${WREF
33072
33074
  function looksLikeDurableId(wref) {
33073
33075
  return DURABLE_ID_PATTERN_RE.test(wref);
33074
33076
  }
33077
+ function parseGraphRepoScope(ctx, wref) {
33078
+ const explicitRepoRef = getRepoRef(ctx);
33079
+ if (looksLikeDurableId(wref) && explicitRepoRef === undefined) {
33080
+ return {};
33081
+ }
33082
+ return parseOrgRepo(explicitRepoRef, ctx.config);
33083
+ }
33075
33084
  function looksLikeCanonicalWref(wref) {
33076
33085
  return CANONICAL_WREF_PATTERN_RE.test(wref);
33077
33086
  }
@@ -33264,6 +33273,180 @@ var handleCreate2 = async (ctx, { flags, args }) => {
33264
33273
  }));
33265
33274
  };
33266
33275
 
33276
+ // ../../packages/rules/src/crockford-base32.ts
33277
+ var ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
33278
+ var DECODE_TABLE = new Uint8Array(256).fill(255);
33279
+ for (let i = 0;i < ALPHABET.length; i++) {
33280
+ const ch = ALPHABET.charCodeAt(i);
33281
+ DECODE_TABLE[ch] = i;
33282
+ if (ch >= 65)
33283
+ DECODE_TABLE[ch + 32] = i;
33284
+ }
33285
+ function encodeBytes(data) {
33286
+ const bitLen = data.length * 8;
33287
+ const charCount = Math.ceil(bitLen / 5);
33288
+ let out = "";
33289
+ for (let i = 0;i < charCount; i++) {
33290
+ const bitPos = i * 5;
33291
+ const byteIdx = bitPos >> 3;
33292
+ const bitOff = bitPos & 7;
33293
+ const b1 = data[byteIdx] ?? 0;
33294
+ let val;
33295
+ if (bitOff <= 3) {
33296
+ val = b1 >> 3 - bitOff & 31;
33297
+ } else {
33298
+ const b2 = data[byteIdx + 1] ?? 0;
33299
+ val = (b1 << bitOff - 3 | b2 >> 11 - bitOff) & 31;
33300
+ }
33301
+ out += ALPHABET[val];
33302
+ }
33303
+ return out;
33304
+ }
33305
+ function decodeBytes(encoded) {
33306
+ const byteLen = Math.floor(encoded.length * 5 / 8);
33307
+ const bytes = new Uint8Array(byteLen);
33308
+ let bitBuf = 0;
33309
+ let bitsInBuf = 0;
33310
+ let bytePos = 0;
33311
+ for (let i = 0;i < encoded.length; i++) {
33312
+ const ch = encoded.charCodeAt(i);
33313
+ const val = DECODE_TABLE[ch];
33314
+ if (val === undefined || val === 255)
33315
+ return null;
33316
+ bitBuf = bitBuf << 5 | val;
33317
+ bitsInBuf += 5;
33318
+ if (bitsInBuf >= 8) {
33319
+ bitsInBuf -= 8;
33320
+ if (bytePos < byteLen) {
33321
+ bytes[bytePos++] = bitBuf >> bitsInBuf & 255;
33322
+ }
33323
+ }
33324
+ }
33325
+ return bytes;
33326
+ }
33327
+
33328
+ // ../../packages/rules/src/durable-id.ts
33329
+ var THING_SCHEME = 1;
33330
+ var REPO_SCHEME = 2;
33331
+ var UUID_BYTES = 16;
33332
+ var CRC_BYTES = 4;
33333
+ function encodedLengthFor(payloadLen) {
33334
+ return Math.ceil((1 + payloadLen + CRC_BYTES) * 8 / 5);
33335
+ }
33336
+ var CRC32C_TABLE = (() => {
33337
+ const POLY = 2197175160;
33338
+ const table = new Uint32Array(256);
33339
+ for (let i = 0;i < 256; i++) {
33340
+ let crc = i;
33341
+ for (let j = 0;j < 8; j++) {
33342
+ crc = crc & 1 ? crc >>> 1 ^ POLY : crc >>> 1;
33343
+ }
33344
+ table[i] = crc >>> 0;
33345
+ }
33346
+ return table;
33347
+ })();
33348
+ function crc32c(data) {
33349
+ let crc = 4294967295;
33350
+ for (const byte of data) {
33351
+ crc = (crc >>> 8 ^ (CRC32C_TABLE[(crc ^ byte) & 255] ?? 0)) >>> 0;
33352
+ }
33353
+ return (crc ^ 4294967295) >>> 0;
33354
+ }
33355
+ function bytesToUuid(bytes, offset = 0) {
33356
+ const hex = Array.from(bytes.slice(offset, offset + 16)).map((b) => b.toString(16).padStart(2, "0")).join("");
33357
+ return [
33358
+ hex.slice(0, 8),
33359
+ hex.slice(8, 12),
33360
+ hex.slice(12, 16),
33361
+ hex.slice(16, 20),
33362
+ hex.slice(20, 32)
33363
+ ].join("-");
33364
+ }
33365
+ function unpackToken(scheme, token, payloadLen) {
33366
+ const stripped = token.startsWith("wh:") ? token.slice(3) : token;
33367
+ if (stripped.length !== encodedLengthFor(payloadLen))
33368
+ return null;
33369
+ const raw = decodeBytes(stripped);
33370
+ if (!raw || raw.length !== 1 + payloadLen + CRC_BYTES)
33371
+ return null;
33372
+ if (raw[0] !== scheme)
33373
+ return null;
33374
+ const crcOffset = 1 + payloadLen;
33375
+ const storedCrc = (raw[crcOffset] ?? 0) << 24 | (raw[crcOffset + 1] ?? 0) << 16 | (raw[crcOffset + 2] ?? 0) << 8 | (raw[crcOffset + 3] ?? 0);
33376
+ const computedCrc = crc32c(raw.slice(0, crcOffset));
33377
+ if (storedCrc >>> 0 !== computedCrc >>> 0)
33378
+ return null;
33379
+ if (encodeBytes(raw) !== stripped.toUpperCase())
33380
+ return null;
33381
+ return raw.slice(1, 1 + payloadLen);
33382
+ }
33383
+ function decodeDurableId(token) {
33384
+ const payload = unpackToken(THING_SCHEME, token, UUID_BYTES * 2);
33385
+ if (!payload)
33386
+ return null;
33387
+ return {
33388
+ repoId: bytesToUuid(payload, 0),
33389
+ thingId: bytesToUuid(payload, UUID_BYTES)
33390
+ };
33391
+ }
33392
+ function decodeRepoDurableId(token) {
33393
+ const payload = unpackToken(REPO_SCHEME, token, UUID_BYTES);
33394
+ if (!payload)
33395
+ return null;
33396
+ return { repoId: bytesToUuid(payload, 0) };
33397
+ }
33398
+
33399
+ // ../../packages/warmhub-cli/src/durable-id-style.ts
33400
+ var THING_TOKEN_LEN = 60;
33401
+ var REPO_TOKEN_LEN = 34;
33402
+ var HUE_REPO = "8A7C6A";
33403
+ var HUE_TIMESTAMP = "7E9BAC";
33404
+ var HUE_ENTROPY = "E8C378";
33405
+ var HUE_CRC = "74846B";
33406
+ var THING_BANDS = [
33407
+ { start: 0, end: 28, weight: "faint", hex: HUE_REPO },
33408
+ { start: 28, end: 37, weight: "normal", hex: HUE_TIMESTAMP },
33409
+ { start: 37, end: 53, weight: "bold", hex: HUE_ENTROPY },
33410
+ { start: 53, end: 60, weight: "faint", hex: HUE_CRC }
33411
+ ];
33412
+ var REPO_BANDS = [
33413
+ { start: 0, end: 28, weight: "faint", hex: HUE_REPO },
33414
+ { start: 28, end: 34, weight: "faint", hex: HUE_CRC }
33415
+ ];
33416
+ function fg(hex) {
33417
+ const r = Number.parseInt(hex.slice(0, 2), 16);
33418
+ const g = Number.parseInt(hex.slice(2, 4), 16);
33419
+ const b = Number.parseInt(hex.slice(4, 6), 16);
33420
+ return `\x1B[38;2;${r};${g};${b}m`;
33421
+ }
33422
+ function bandsFor(token) {
33423
+ if (token.length === THING_TOKEN_LEN && decodeDurableId(token)) {
33424
+ return THING_BANDS;
33425
+ }
33426
+ if (token.length === REPO_TOKEN_LEN && decodeRepoDurableId(token)) {
33427
+ return REPO_BANDS;
33428
+ }
33429
+ return null;
33430
+ }
33431
+ function styleBand(text, band, c) {
33432
+ const weight = band.weight === "bold" ? c.bold : band.weight === "faint" ? c.dim : "";
33433
+ const hue = c.truecolor ? fg(band.hex) : "";
33434
+ const prefix = `${weight}${hue}`;
33435
+ return prefix === "" ? text : `${prefix}${text}${c.reset}`;
33436
+ }
33437
+ function styleDurableId(token, c) {
33438
+ if (c.reset === "")
33439
+ return token;
33440
+ const bands = bandsFor(token);
33441
+ if (!bands)
33442
+ return token;
33443
+ let out = "";
33444
+ for (const band of bands) {
33445
+ out += styleBand(token.slice(band.start, band.end), band, c);
33446
+ }
33447
+ return out;
33448
+ }
33449
+
33267
33450
  // ../../packages/warmhub-cli/src/domains/thing/render.ts
33268
33451
  function renderHead(out, c, chars, result, org, repo, shape, kind) {
33269
33452
  const items = result.items ?? [];
@@ -33293,7 +33476,7 @@ function renderHead(out, c, chars, result, org, repo, shape, kind) {
33293
33476
  }
33294
33477
  const itemMeta = item.metadata;
33295
33478
  if (itemMeta?.durableId) {
33296
- out(` ${c.dim}durableId:${c.reset} ${itemMeta.durableId}`);
33479
+ out(` ${c.dim}durableId:${c.reset} ${styleDurableId(itemMeta.durableId, c)}`);
33297
33480
  }
33298
33481
  }
33299
33482
  out(`${c.dim}${items.length} item(s)${c.reset}`);
@@ -33318,7 +33501,7 @@ function renderThing(out, c, result) {
33318
33501
  if (meta?.durableId || meta?.createdOn || meta?.revisedOn) {
33319
33502
  const now = Date.now();
33320
33503
  if (meta.durableId) {
33321
- out(` ${c.dim}durableId:${c.reset} ${meta.durableId}`);
33504
+ out(` ${c.dim}durableId:${c.reset} ${styleDurableId(meta.durableId, c)}`);
33322
33505
  }
33323
33506
  if (meta.createdOn) {
33324
33507
  out(` ${c.dim}createdOn:${c.reset} ${formatTime(meta.createdOn, now)}`);
@@ -33437,7 +33620,7 @@ function renderHistory(out, c, result) {
33437
33620
  }
33438
33621
  const firstMeta = result.versions?.[0]?.metadata;
33439
33622
  if (firstMeta?.durableId) {
33440
- out(` ${c.dim}durableId:${c.reset} ${firstMeta.durableId}`);
33623
+ out(` ${c.dim}durableId:${c.reset} ${styleDurableId(firstMeta.durableId, c)}`);
33441
33624
  }
33442
33625
  const versions = result.versions ?? [];
33443
33626
  const now = Date.now();
@@ -33537,7 +33720,7 @@ var handleThingGraph = async (ctx, { flags, args }) => {
33537
33720
  if (depth !== undefined && (depth < 1 || depth > 5)) {
33538
33721
  usageError("Usage: wh thing graph <wref> --depth <1-5>", "wh thing graph Game/base --depth 2");
33539
33722
  }
33540
- const { org, repo } = looksLikeDurableId(wref) ? parseOrgRepoOptional(getRepoRef(ctx), ctx.config) : parseOrgRepo(getRepoRef(ctx), ctx.config);
33723
+ const { org, repo } = parseGraphRepoScope(ctx, wref);
33541
33724
  const result = await ctx.client.thing.graph(org, repo, wref, {
33542
33725
  depth,
33543
33726
  version: flags.version
@@ -34607,7 +34790,7 @@ async function collectWrefs(opts) {
34607
34790
  async function runSingleView(ctx, wref, flags) {
34608
34791
  const version = flags.version;
34609
34792
  const depth = flags.depth;
34610
- const { org, repo } = looksLikeDurableId(wref) ? parseOrgRepoOptional(getRepoRef(ctx), ctx.config) : parseOrgRepo(getRepoRef(ctx), ctx.config);
34793
+ const { org, repo } = depth === undefined ? looksLikeDurableId(wref) ? parseOrgRepoOptional(getRepoRef(ctx), ctx.config) : parseOrgRepo(getRepoRef(ctx), ctx.config) : parseGraphRepoScope(ctx, wref);
34611
34794
  const includeRetracted = flags["include-retracted"] || version !== undefined;
34612
34795
  const dataMode = validateDataMode(flags["data-mode"]);
34613
34796
  if (depth !== undefined && (depth < 1 || depth > 5)) {
@@ -34891,7 +35074,7 @@ var handleView2 = async (ctx, { flags, args }) => {
34891
35074
  }
34892
35075
  const version = flags.version;
34893
35076
  const depth = flags.depth;
34894
- const { org, repo } = looksLikeDurableId(wref) ? parseOrgRepoOptional(getRepoRef(ctx), ctx.config) : parseOrgRepo(getRepoRef(ctx), ctx.config);
35077
+ const { org, repo } = depth === undefined ? looksLikeDurableId(wref) ? parseOrgRepoOptional(getRepoRef(ctx), ctx.config) : parseOrgRepo(getRepoRef(ctx), ctx.config) : parseGraphRepoScope(ctx, wref);
34895
35078
  const includeRetracted = flags["include-retracted"] || version !== undefined;
34896
35079
  if (depth !== undefined && (depth < 1 || depth > 5)) {
34897
35080
  usageError("Usage: wh assertion view <wref> --depth <1-5>", "wh assertion view Belief/cave-safe --depth 2");
@@ -46104,7 +46287,8 @@ async function runCli(argv, opts) {
46104
46287
  });
46105
46288
  const colors = makeColors({
46106
46289
  noColor: !!process.env.NO_COLOR,
46107
- isTTY: !!process.stdout.isTTY
46290
+ isTTY: !!process.stdout.isTTY,
46291
+ colorterm: process.env.COLORTERM
46108
46292
  });
46109
46293
  const chars = makeChars();
46110
46294
  const ac = new AbortController;
@@ -46237,7 +46421,7 @@ function resolveLogLevel(flags, env) {
46237
46421
  // package.json
46238
46422
  var package_default3 = {
46239
46423
  name: "@warmhub/cli",
46240
- version: "0.70.0",
46424
+ version: "0.71.0",
46241
46425
  private: false,
46242
46426
  type: "module",
46243
46427
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -46892,4 +47076,4 @@ if (!updateCheckSuppressedByArgv && shouldRunUpdateCheck(updateEligibility)) {
46892
47076
  var interceptedExitCode = await maybeHandleComponentShellBoundary(dispatchArgv);
46893
47077
  process.exitCode = interceptedExitCode === undefined ? await runCli(dispatchArgv, { version: package_default3.version }) : interceptedExitCode;
46894
47078
 
46895
- //# debugId=14D7F2CE92253D6D64756E2164756E21
47079
+ //# debugId=94B2C7EE252C64A264756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmhub/cli",
3
- "version": "0.70.0",
3
+ "version": "0.71.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.",