@warmhub/cli 0.70.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.
- package/README.md +12 -24
- package/dist/wh.js +349 -92
- 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
|
|
27
|
-
Legislator/g000583@
|
|
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
|
-
|
|
30
|
-
{"
|
|
31
|
-
|
|
32
|
-
{"
|
|
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
|
|
36
|
-
--repo warmhub-data/congress
|
|
37
|
-
Assertions about
|
|
38
|
-
|
|
39
|
-
about: Pair/
|
|
40
|
-
{"
|
|
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
|
@@ -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 = [
|
|
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
|
-
|
|
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
|
|
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.
|
|
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",
|
|
@@ -32621,6 +32648,7 @@ function makeChars(env = process.env) {
|
|
|
32621
32648
|
function makeColors(opts) {
|
|
32622
32649
|
const enabled = !opts.noColor && opts.isTTY;
|
|
32623
32650
|
const on = (code) => enabled ? code : "";
|
|
32651
|
+
const truecolor = enabled && /^(truecolor|24bit)$/i.test((opts.colorterm ?? "").trim());
|
|
32624
32652
|
return {
|
|
32625
32653
|
reset: on("\x1B[0m"),
|
|
32626
32654
|
bold: on("\x1B[1m"),
|
|
@@ -32631,7 +32659,8 @@ function makeColors(opts) {
|
|
|
32631
32659
|
blue: on("\x1B[34m"),
|
|
32632
32660
|
cyan: on("\x1B[36m"),
|
|
32633
32661
|
magenta: on("\x1B[35m"),
|
|
32634
|
-
gray: on("\x1B[90m")
|
|
32662
|
+
gray: on("\x1B[90m"),
|
|
32663
|
+
truecolor
|
|
32635
32664
|
};
|
|
32636
32665
|
}
|
|
32637
32666
|
function formatTime(ts, now) {
|
|
@@ -32646,10 +32675,11 @@ function formatTime(ts, now) {
|
|
|
32646
32675
|
return d.toISOString().slice(0, 16).replace("T", " ");
|
|
32647
32676
|
}
|
|
32648
32677
|
function pinnedWref(c, wref, version) {
|
|
32649
|
-
if (version == null)
|
|
32650
|
-
return `${c.cyan}${wref}${c.reset}`;
|
|
32678
|
+
if (version == null) {
|
|
32679
|
+
return `${c.cyan}${escapeTerminalTextForDisplay(wref)}${c.reset}`;
|
|
32680
|
+
}
|
|
32651
32681
|
const base = wref.replace(/@v\d+$/, "");
|
|
32652
|
-
return `${c.cyan}${base}@v${version}${c.reset}`;
|
|
32682
|
+
return `${c.cyan}${escapeTerminalTextForDisplay(base)}@v${version}${c.reset}`;
|
|
32653
32683
|
}
|
|
32654
32684
|
function kindLabel(c, kind) {
|
|
32655
32685
|
return `${c.dim}${kind}${c.reset}`;
|
|
@@ -32684,7 +32714,7 @@ function effectiveKind(kind, shapeName) {
|
|
|
32684
32714
|
}
|
|
32685
32715
|
function displayName(c, name) {
|
|
32686
32716
|
if (name)
|
|
32687
|
-
return `${c.cyan}${name}${c.reset}`;
|
|
32717
|
+
return `${c.cyan}${escapeTerminalTextForDisplay(name)}${c.reset}`;
|
|
32688
32718
|
return `${c.dim}(unnamed)${c.reset}`;
|
|
32689
32719
|
}
|
|
32690
32720
|
function extractShapeName(name) {
|
|
@@ -33072,6 +33102,13 @@ var CANONICAL_WREF_PATTERN_RE = new RegExp(String.raw`^wh:${WREF_SEGMENT}/${WREF
|
|
|
33072
33102
|
function looksLikeDurableId(wref) {
|
|
33073
33103
|
return DURABLE_ID_PATTERN_RE.test(wref);
|
|
33074
33104
|
}
|
|
33105
|
+
function parseGraphRepoScope(ctx, wref) {
|
|
33106
|
+
const explicitRepoRef = getRepoRef(ctx);
|
|
33107
|
+
if (looksLikeDurableId(wref) && explicitRepoRef === undefined) {
|
|
33108
|
+
return {};
|
|
33109
|
+
}
|
|
33110
|
+
return parseOrgRepo(explicitRepoRef, ctx.config);
|
|
33111
|
+
}
|
|
33075
33112
|
function looksLikeCanonicalWref(wref) {
|
|
33076
33113
|
return CANONICAL_WREF_PATTERN_RE.test(wref);
|
|
33077
33114
|
}
|
|
@@ -33264,6 +33301,180 @@ var handleCreate2 = async (ctx, { flags, args }) => {
|
|
|
33264
33301
|
}));
|
|
33265
33302
|
};
|
|
33266
33303
|
|
|
33304
|
+
// ../../packages/rules/src/crockford-base32.ts
|
|
33305
|
+
var ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
33306
|
+
var DECODE_TABLE = new Uint8Array(256).fill(255);
|
|
33307
|
+
for (let i = 0;i < ALPHABET.length; i++) {
|
|
33308
|
+
const ch = ALPHABET.charCodeAt(i);
|
|
33309
|
+
DECODE_TABLE[ch] = i;
|
|
33310
|
+
if (ch >= 65)
|
|
33311
|
+
DECODE_TABLE[ch + 32] = i;
|
|
33312
|
+
}
|
|
33313
|
+
function encodeBytes(data) {
|
|
33314
|
+
const bitLen = data.length * 8;
|
|
33315
|
+
const charCount = Math.ceil(bitLen / 5);
|
|
33316
|
+
let out = "";
|
|
33317
|
+
for (let i = 0;i < charCount; i++) {
|
|
33318
|
+
const bitPos = i * 5;
|
|
33319
|
+
const byteIdx = bitPos >> 3;
|
|
33320
|
+
const bitOff = bitPos & 7;
|
|
33321
|
+
const b1 = data[byteIdx] ?? 0;
|
|
33322
|
+
let val;
|
|
33323
|
+
if (bitOff <= 3) {
|
|
33324
|
+
val = b1 >> 3 - bitOff & 31;
|
|
33325
|
+
} else {
|
|
33326
|
+
const b2 = data[byteIdx + 1] ?? 0;
|
|
33327
|
+
val = (b1 << bitOff - 3 | b2 >> 11 - bitOff) & 31;
|
|
33328
|
+
}
|
|
33329
|
+
out += ALPHABET[val];
|
|
33330
|
+
}
|
|
33331
|
+
return out;
|
|
33332
|
+
}
|
|
33333
|
+
function decodeBytes(encoded) {
|
|
33334
|
+
const byteLen = Math.floor(encoded.length * 5 / 8);
|
|
33335
|
+
const bytes = new Uint8Array(byteLen);
|
|
33336
|
+
let bitBuf = 0;
|
|
33337
|
+
let bitsInBuf = 0;
|
|
33338
|
+
let bytePos = 0;
|
|
33339
|
+
for (let i = 0;i < encoded.length; i++) {
|
|
33340
|
+
const ch = encoded.charCodeAt(i);
|
|
33341
|
+
const val = DECODE_TABLE[ch];
|
|
33342
|
+
if (val === undefined || val === 255)
|
|
33343
|
+
return null;
|
|
33344
|
+
bitBuf = bitBuf << 5 | val;
|
|
33345
|
+
bitsInBuf += 5;
|
|
33346
|
+
if (bitsInBuf >= 8) {
|
|
33347
|
+
bitsInBuf -= 8;
|
|
33348
|
+
if (bytePos < byteLen) {
|
|
33349
|
+
bytes[bytePos++] = bitBuf >> bitsInBuf & 255;
|
|
33350
|
+
}
|
|
33351
|
+
}
|
|
33352
|
+
}
|
|
33353
|
+
return bytes;
|
|
33354
|
+
}
|
|
33355
|
+
|
|
33356
|
+
// ../../packages/rules/src/durable-id.ts
|
|
33357
|
+
var THING_SCHEME = 1;
|
|
33358
|
+
var REPO_SCHEME = 2;
|
|
33359
|
+
var UUID_BYTES = 16;
|
|
33360
|
+
var CRC_BYTES = 4;
|
|
33361
|
+
function encodedLengthFor(payloadLen) {
|
|
33362
|
+
return Math.ceil((1 + payloadLen + CRC_BYTES) * 8 / 5);
|
|
33363
|
+
}
|
|
33364
|
+
var CRC32C_TABLE = (() => {
|
|
33365
|
+
const POLY = 2197175160;
|
|
33366
|
+
const table = new Uint32Array(256);
|
|
33367
|
+
for (let i = 0;i < 256; i++) {
|
|
33368
|
+
let crc = i;
|
|
33369
|
+
for (let j = 0;j < 8; j++) {
|
|
33370
|
+
crc = crc & 1 ? crc >>> 1 ^ POLY : crc >>> 1;
|
|
33371
|
+
}
|
|
33372
|
+
table[i] = crc >>> 0;
|
|
33373
|
+
}
|
|
33374
|
+
return table;
|
|
33375
|
+
})();
|
|
33376
|
+
function crc32c(data) {
|
|
33377
|
+
let crc = 4294967295;
|
|
33378
|
+
for (const byte of data) {
|
|
33379
|
+
crc = (crc >>> 8 ^ (CRC32C_TABLE[(crc ^ byte) & 255] ?? 0)) >>> 0;
|
|
33380
|
+
}
|
|
33381
|
+
return (crc ^ 4294967295) >>> 0;
|
|
33382
|
+
}
|
|
33383
|
+
function bytesToUuid(bytes, offset = 0) {
|
|
33384
|
+
const hex = Array.from(bytes.slice(offset, offset + 16)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
33385
|
+
return [
|
|
33386
|
+
hex.slice(0, 8),
|
|
33387
|
+
hex.slice(8, 12),
|
|
33388
|
+
hex.slice(12, 16),
|
|
33389
|
+
hex.slice(16, 20),
|
|
33390
|
+
hex.slice(20, 32)
|
|
33391
|
+
].join("-");
|
|
33392
|
+
}
|
|
33393
|
+
function unpackToken(scheme, token, payloadLen) {
|
|
33394
|
+
const stripped = token.startsWith("wh:") ? token.slice(3) : token;
|
|
33395
|
+
if (stripped.length !== encodedLengthFor(payloadLen))
|
|
33396
|
+
return null;
|
|
33397
|
+
const raw = decodeBytes(stripped);
|
|
33398
|
+
if (!raw || raw.length !== 1 + payloadLen + CRC_BYTES)
|
|
33399
|
+
return null;
|
|
33400
|
+
if (raw[0] !== scheme)
|
|
33401
|
+
return null;
|
|
33402
|
+
const crcOffset = 1 + payloadLen;
|
|
33403
|
+
const storedCrc = (raw[crcOffset] ?? 0) << 24 | (raw[crcOffset + 1] ?? 0) << 16 | (raw[crcOffset + 2] ?? 0) << 8 | (raw[crcOffset + 3] ?? 0);
|
|
33404
|
+
const computedCrc = crc32c(raw.slice(0, crcOffset));
|
|
33405
|
+
if (storedCrc >>> 0 !== computedCrc >>> 0)
|
|
33406
|
+
return null;
|
|
33407
|
+
if (encodeBytes(raw) !== stripped.toUpperCase())
|
|
33408
|
+
return null;
|
|
33409
|
+
return raw.slice(1, 1 + payloadLen);
|
|
33410
|
+
}
|
|
33411
|
+
function decodeDurableId(token) {
|
|
33412
|
+
const payload = unpackToken(THING_SCHEME, token, UUID_BYTES * 2);
|
|
33413
|
+
if (!payload)
|
|
33414
|
+
return null;
|
|
33415
|
+
return {
|
|
33416
|
+
repoId: bytesToUuid(payload, 0),
|
|
33417
|
+
thingId: bytesToUuid(payload, UUID_BYTES)
|
|
33418
|
+
};
|
|
33419
|
+
}
|
|
33420
|
+
function decodeRepoDurableId(token) {
|
|
33421
|
+
const payload = unpackToken(REPO_SCHEME, token, UUID_BYTES);
|
|
33422
|
+
if (!payload)
|
|
33423
|
+
return null;
|
|
33424
|
+
return { repoId: bytesToUuid(payload, 0) };
|
|
33425
|
+
}
|
|
33426
|
+
|
|
33427
|
+
// ../../packages/warmhub-cli/src/durable-id-style.ts
|
|
33428
|
+
var THING_TOKEN_LEN = 60;
|
|
33429
|
+
var REPO_TOKEN_LEN = 34;
|
|
33430
|
+
var HUE_REPO = "8A7C6A";
|
|
33431
|
+
var HUE_TIMESTAMP = "7E9BAC";
|
|
33432
|
+
var HUE_ENTROPY = "E8C378";
|
|
33433
|
+
var HUE_CRC = "74846B";
|
|
33434
|
+
var THING_BANDS = [
|
|
33435
|
+
{ start: 0, end: 28, weight: "faint", hex: HUE_REPO },
|
|
33436
|
+
{ start: 28, end: 37, weight: "normal", hex: HUE_TIMESTAMP },
|
|
33437
|
+
{ start: 37, end: 53, weight: "bold", hex: HUE_ENTROPY },
|
|
33438
|
+
{ start: 53, end: 60, weight: "faint", hex: HUE_CRC }
|
|
33439
|
+
];
|
|
33440
|
+
var REPO_BANDS = [
|
|
33441
|
+
{ start: 0, end: 28, weight: "faint", hex: HUE_REPO },
|
|
33442
|
+
{ start: 28, end: 34, weight: "faint", hex: HUE_CRC }
|
|
33443
|
+
];
|
|
33444
|
+
function fg(hex) {
|
|
33445
|
+
const r = Number.parseInt(hex.slice(0, 2), 16);
|
|
33446
|
+
const g = Number.parseInt(hex.slice(2, 4), 16);
|
|
33447
|
+
const b = Number.parseInt(hex.slice(4, 6), 16);
|
|
33448
|
+
return `\x1B[38;2;${r};${g};${b}m`;
|
|
33449
|
+
}
|
|
33450
|
+
function bandsFor(token) {
|
|
33451
|
+
if (token.length === THING_TOKEN_LEN && decodeDurableId(token)) {
|
|
33452
|
+
return THING_BANDS;
|
|
33453
|
+
}
|
|
33454
|
+
if (token.length === REPO_TOKEN_LEN && decodeRepoDurableId(token)) {
|
|
33455
|
+
return REPO_BANDS;
|
|
33456
|
+
}
|
|
33457
|
+
return null;
|
|
33458
|
+
}
|
|
33459
|
+
function styleBand(text, band, c) {
|
|
33460
|
+
const weight = band.weight === "bold" ? c.bold : band.weight === "faint" ? c.dim : "";
|
|
33461
|
+
const hue = c.truecolor ? fg(band.hex) : "";
|
|
33462
|
+
const prefix = `${weight}${hue}`;
|
|
33463
|
+
return prefix === "" ? text : `${prefix}${text}${c.reset}`;
|
|
33464
|
+
}
|
|
33465
|
+
function styleDurableId(token, c) {
|
|
33466
|
+
if (c.reset === "")
|
|
33467
|
+
return token;
|
|
33468
|
+
const bands = bandsFor(token);
|
|
33469
|
+
if (!bands)
|
|
33470
|
+
return token;
|
|
33471
|
+
let out = "";
|
|
33472
|
+
for (const band of bands) {
|
|
33473
|
+
out += styleBand(token.slice(band.start, band.end), band, c);
|
|
33474
|
+
}
|
|
33475
|
+
return out;
|
|
33476
|
+
}
|
|
33477
|
+
|
|
33267
33478
|
// ../../packages/warmhub-cli/src/domains/thing/render.ts
|
|
33268
33479
|
function renderHead(out, c, chars, result, org, repo, shape, kind) {
|
|
33269
33480
|
const items = result.items ?? [];
|
|
@@ -33285,15 +33496,15 @@ function renderHead(out, c, chars, result, org, repo, shape, kind) {
|
|
|
33285
33496
|
const fields = shapeName && (item.kind === "thing" || item.kind === "collection") && item.data ? collectionFields(shapeName, item.data) : null;
|
|
33286
33497
|
if (fields) {
|
|
33287
33498
|
const allWrefs = fields.flatMap((f) => f.wrefs);
|
|
33288
|
-
out(` ${allWrefs.map((w) => pinnedWref(c,
|
|
33499
|
+
out(` ${allWrefs.map((w) => pinnedWref(c, w)).join(`${c.dim},${c.reset} `)}`);
|
|
33289
33500
|
} else if (item.data && typeof item.data === "object") {
|
|
33290
33501
|
const preview = JSON.stringify(item.data);
|
|
33291
33502
|
const truncated = preview.length > 80 ? `${preview.slice(0, 77)}...` : preview;
|
|
33292
|
-
out(` ${c.dim}${truncated}${c.reset}`);
|
|
33503
|
+
out(` ${c.dim}${escapeTerminalTextForDisplay(truncated)}${c.reset}`);
|
|
33293
33504
|
}
|
|
33294
33505
|
const itemMeta = item.metadata;
|
|
33295
33506
|
if (itemMeta?.durableId) {
|
|
33296
|
-
out(` ${c.dim}durableId:${c.reset} ${itemMeta.durableId}`);
|
|
33507
|
+
out(` ${c.dim}durableId:${c.reset} ${styleDurableId(escapeTerminalTextForDisplay(itemMeta.durableId), c)}`);
|
|
33297
33508
|
}
|
|
33298
33509
|
}
|
|
33299
33510
|
out(`${c.dim}${items.length} item(s)${c.reset}`);
|
|
@@ -33304,7 +33515,7 @@ function renderThing(out, c, result) {
|
|
|
33304
33515
|
const displayKind = effectiveKind(result.kind ?? "thing", shapeName);
|
|
33305
33516
|
const retractedTag = result.active === false ? ` ${c.red}[RETRACTED]${c.reset}` : "";
|
|
33306
33517
|
out(`${pinnedWref(c, wref, result.version)} ${kindLabel(c, displayKind)}${retractedTag}`);
|
|
33307
|
-
out(` ${c.dim}wref:${c.reset} ${wref}`);
|
|
33518
|
+
out(` ${c.dim}wref:${c.reset} ${escapeTerminalTextForDisplay(wref)}`);
|
|
33308
33519
|
out(` ${c.dim}version:${c.reset} ${result.version ?? "-"}`);
|
|
33309
33520
|
out(` ${c.dim}active:${c.reset} ${String(result.active)}`);
|
|
33310
33521
|
if (result.committerWref) {
|
|
@@ -33312,13 +33523,13 @@ function renderThing(out, c, result) {
|
|
|
33312
33523
|
}
|
|
33313
33524
|
const aboutWref = result.aboutWref ?? result.about;
|
|
33314
33525
|
if (aboutWref) {
|
|
33315
|
-
out(` ${c.dim}about:${c.reset} ${String(aboutWref)}`);
|
|
33526
|
+
out(` ${c.dim}about:${c.reset} ${escapeTerminalTextForDisplay(String(aboutWref))}`);
|
|
33316
33527
|
}
|
|
33317
33528
|
const meta = result.metadata;
|
|
33318
33529
|
if (meta?.durableId || meta?.createdOn || meta?.revisedOn) {
|
|
33319
33530
|
const now = Date.now();
|
|
33320
33531
|
if (meta.durableId) {
|
|
33321
|
-
out(` ${c.dim}durableId:${c.reset} ${meta.durableId}`);
|
|
33532
|
+
out(` ${c.dim}durableId:${c.reset} ${styleDurableId(escapeTerminalTextForDisplay(meta.durableId), c)}`);
|
|
33322
33533
|
}
|
|
33323
33534
|
if (meta.createdOn) {
|
|
33324
33535
|
out(` ${c.dim}createdOn:${c.reset} ${formatTime(meta.createdOn, now)}`);
|
|
@@ -33335,11 +33546,11 @@ function renderThing(out, c, result) {
|
|
|
33335
33546
|
for (const field of fields) {
|
|
33336
33547
|
if (field.wrefs.length === 1) {
|
|
33337
33548
|
const pad = " ".repeat(Math.max(1, 9 - field.name.length));
|
|
33338
|
-
out(` ${c.dim}${field.name}:${c.reset}${pad}${pinnedWref(c,
|
|
33549
|
+
out(` ${c.dim}${escapeTerminalTextForDisplay(field.name)}:${c.reset}${pad}${pinnedWref(c, field.wrefs[0])}`);
|
|
33339
33550
|
} else {
|
|
33340
|
-
out(` ${c.dim}${field.name}:${c.reset}`);
|
|
33551
|
+
out(` ${c.dim}${escapeTerminalTextForDisplay(field.name)}:${c.reset}`);
|
|
33341
33552
|
for (const w of field.wrefs) {
|
|
33342
|
-
out(` ${pinnedWref(c,
|
|
33553
|
+
out(` ${pinnedWref(c, w)}`);
|
|
33343
33554
|
}
|
|
33344
33555
|
}
|
|
33345
33556
|
}
|
|
@@ -33348,7 +33559,7 @@ function renderThing(out, c, result) {
|
|
|
33348
33559
|
const lines = JSON.stringify(result.data, null, 2).split(`
|
|
33349
33560
|
`);
|
|
33350
33561
|
for (const line of lines) {
|
|
33351
|
-
out(` ${line}`);
|
|
33562
|
+
out(` ${escapeTerminalTextForDisplay(line)}`);
|
|
33352
33563
|
}
|
|
33353
33564
|
}
|
|
33354
33565
|
}
|
|
@@ -33364,14 +33575,14 @@ function renderCollectionSummary(out, c, collection) {
|
|
|
33364
33575
|
return;
|
|
33365
33576
|
out(` ${c.dim}preview:${c.reset}`);
|
|
33366
33577
|
for (const wref of preview) {
|
|
33367
|
-
out(` ${pinnedWref(c,
|
|
33578
|
+
out(` ${pinnedWref(c, wref)}`);
|
|
33368
33579
|
}
|
|
33369
33580
|
}
|
|
33370
33581
|
function renderDataBlock(out, data, indent) {
|
|
33371
33582
|
const lines = JSON.stringify(data, null, 2).split(`
|
|
33372
33583
|
`);
|
|
33373
33584
|
for (const line of lines) {
|
|
33374
|
-
out(`${indent}${line}`);
|
|
33585
|
+
out(`${indent}${escapeTerminalTextForDisplay(line)}`);
|
|
33375
33586
|
}
|
|
33376
33587
|
}
|
|
33377
33588
|
function renderGraphValue(out, c, value, indent) {
|
|
@@ -33411,7 +33622,7 @@ function renderGraphNode(out, c, result, indent = "") {
|
|
|
33411
33622
|
if (resolvedEntries.length > 0) {
|
|
33412
33623
|
out(`${indent} ${c.dim}resolved:${c.reset}`);
|
|
33413
33624
|
for (const [fieldPath, value] of resolvedEntries) {
|
|
33414
|
-
out(`${indent} ${c.dim}${fieldPath}:${c.reset}`);
|
|
33625
|
+
out(`${indent} ${c.dim}${escapeTerminalTextForDisplay(fieldPath)}:${c.reset}`);
|
|
33415
33626
|
renderGraphValue(out, c, value, `${indent} `);
|
|
33416
33627
|
}
|
|
33417
33628
|
}
|
|
@@ -33437,7 +33648,7 @@ function renderHistory(out, c, result) {
|
|
|
33437
33648
|
}
|
|
33438
33649
|
const firstMeta = result.versions?.[0]?.metadata;
|
|
33439
33650
|
if (firstMeta?.durableId) {
|
|
33440
|
-
out(` ${c.dim}durableId:${c.reset} ${firstMeta.durableId}`);
|
|
33651
|
+
out(` ${c.dim}durableId:${c.reset} ${styleDurableId(escapeTerminalTextForDisplay(firstMeta.durableId), c)}`);
|
|
33441
33652
|
}
|
|
33442
33653
|
const versions = result.versions ?? [];
|
|
33443
33654
|
const now = Date.now();
|
|
@@ -33446,7 +33657,7 @@ function renderHistory(out, c, result) {
|
|
|
33446
33657
|
if (ver.operation === "add") {
|
|
33447
33658
|
op = `${c.green}add${c.reset}`;
|
|
33448
33659
|
} else if (ver.operation === "retract") {
|
|
33449
|
-
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}` : "";
|
|
33450
33661
|
op = `${c.red}retract${c.reset}${reason}`;
|
|
33451
33662
|
} else {
|
|
33452
33663
|
op = `${c.yellow}revise${c.reset}`;
|
|
@@ -33467,12 +33678,12 @@ function renderRefs(out, c, result, wref, direction) {
|
|
|
33467
33678
|
return;
|
|
33468
33679
|
}
|
|
33469
33680
|
const label = direction === "inbound" ? "References to" : "Referenced by";
|
|
33470
|
-
out(`${c.bold}${label}${c.reset} ${c.cyan}${wref}${c.reset}`);
|
|
33681
|
+
out(`${c.bold}${label}${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(wref)}${c.reset}`);
|
|
33471
33682
|
out(`${c.dim}${"─".repeat(60)}${c.reset}`);
|
|
33472
33683
|
for (const item of items) {
|
|
33473
33684
|
const refWref = pinnedWref(c, item.wref, item.version);
|
|
33474
33685
|
const kl = kindLabel(c, effectiveKind(item.kind ?? "thing", item.shapeName));
|
|
33475
|
-
const field = `${c.dim}via ${c.reset}${item.fieldPath}`;
|
|
33686
|
+
const field = `${c.dim}via ${c.reset}${escapeTerminalTextForDisplay(item.fieldPath ?? "(unknown)")}`;
|
|
33476
33687
|
out(` ${refWref} ${kl} ${field}`);
|
|
33477
33688
|
}
|
|
33478
33689
|
out(`${c.dim}${items.length} ref(s)${c.reset}`);
|
|
@@ -33502,7 +33713,7 @@ function renderBatchView(out, c, result, wrefs, flagsVersion) {
|
|
|
33502
33713
|
if (event.kind === "miss")
|
|
33503
33714
|
continue;
|
|
33504
33715
|
if (event.kind === "desync") {
|
|
33505
|
-
out(` ${event.requested} ${c.red}[no result]${c.reset}`);
|
|
33716
|
+
out(` ${escapeTerminalTextForDisplay(event.requested)} ${c.red}[no result]${c.reset}`);
|
|
33506
33717
|
continue;
|
|
33507
33718
|
}
|
|
33508
33719
|
const { requested, item } = event;
|
|
@@ -33511,12 +33722,12 @@ function renderBatchView(out, c, result, wrefs, flagsVersion) {
|
|
|
33511
33722
|
const base = requestedBase.length > 0 ? requestedBase : fallback.replace(/@v\d+$/, "");
|
|
33512
33723
|
const kl = kindLabel(c, effectiveKind(item.kind ?? "thing", item.shapeName));
|
|
33513
33724
|
const retractedTag = item.active === false ? ` ${c.red}[RETRACTED]${c.reset}` : "";
|
|
33514
|
-
out(` ${base}@v${item.version} ${kl}${retractedTag}`);
|
|
33725
|
+
out(` ${escapeTerminalTextForDisplay(base)}@v${item.version} ${kl}${retractedTag}`);
|
|
33515
33726
|
}
|
|
33516
33727
|
if (result.missing.length > 0) {
|
|
33517
33728
|
out("Missing:");
|
|
33518
33729
|
for (const wref of result.missing) {
|
|
33519
|
-
out(` ${wref}`);
|
|
33730
|
+
out(` ${escapeTerminalTextForDisplay(wref)}`);
|
|
33520
33731
|
}
|
|
33521
33732
|
}
|
|
33522
33733
|
}
|
|
@@ -33537,7 +33748,7 @@ var handleThingGraph = async (ctx, { flags, args }) => {
|
|
|
33537
33748
|
if (depth !== undefined && (depth < 1 || depth > 5)) {
|
|
33538
33749
|
usageError("Usage: wh thing graph <wref> --depth <1-5>", "wh thing graph Game/base --depth 2");
|
|
33539
33750
|
}
|
|
33540
|
-
const { org, repo } =
|
|
33751
|
+
const { org, repo } = parseGraphRepoScope(ctx, wref);
|
|
33541
33752
|
const result = await ctx.client.thing.graph(org, repo, wref, {
|
|
33542
33753
|
depth,
|
|
33543
33754
|
version: flags.version
|
|
@@ -34276,7 +34487,7 @@ var handleResolve = async (ctx, { args }) => {
|
|
|
34276
34487
|
writeOutput(ctx, result, () => {
|
|
34277
34488
|
const wref2 = result.wref ?? result.name ?? "(unknown)";
|
|
34278
34489
|
ctx.out(`${pinnedWref(c, wref2, result.version)} ${kindLabel(c, result.kind ?? "thing")}`);
|
|
34279
|
-
ctx.out(` ${c.dim}wref:${c.reset} ${wref2}`);
|
|
34490
|
+
ctx.out(` ${c.dim}wref:${c.reset} ${escapeTerminalTextForDisplay(wref2)}`);
|
|
34280
34491
|
ctx.out(` ${c.dim}version:${c.reset} ${result.version ?? "-"}`);
|
|
34281
34492
|
ctx.out(` ${c.dim}active:${c.reset} ${String(result.active)}`);
|
|
34282
34493
|
});
|
|
@@ -34607,7 +34818,7 @@ async function collectWrefs(opts) {
|
|
|
34607
34818
|
async function runSingleView(ctx, wref, flags) {
|
|
34608
34819
|
const version = flags.version;
|
|
34609
34820
|
const depth = flags.depth;
|
|
34610
|
-
const { org, repo } = looksLikeDurableId(wref) ? parseOrgRepoOptional(getRepoRef(ctx), ctx.config) : parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
34821
|
+
const { org, repo } = depth === undefined ? looksLikeDurableId(wref) ? parseOrgRepoOptional(getRepoRef(ctx), ctx.config) : parseOrgRepo(getRepoRef(ctx), ctx.config) : parseGraphRepoScope(ctx, wref);
|
|
34611
34822
|
const includeRetracted = flags["include-retracted"] || version !== undefined;
|
|
34612
34823
|
const dataMode = validateDataMode(flags["data-mode"]);
|
|
34613
34824
|
if (depth !== undefined && (depth < 1 || depth > 5)) {
|
|
@@ -34891,7 +35102,7 @@ var handleView2 = async (ctx, { flags, args }) => {
|
|
|
34891
35102
|
}
|
|
34892
35103
|
const version = flags.version;
|
|
34893
35104
|
const depth = flags.depth;
|
|
34894
|
-
const { org, repo } = looksLikeDurableId(wref) ? parseOrgRepoOptional(getRepoRef(ctx), ctx.config) : parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
35105
|
+
const { org, repo } = depth === undefined ? looksLikeDurableId(wref) ? parseOrgRepoOptional(getRepoRef(ctx), ctx.config) : parseOrgRepo(getRepoRef(ctx), ctx.config) : parseGraphRepoScope(ctx, wref);
|
|
34895
35106
|
const includeRetracted = flags["include-retracted"] || version !== undefined;
|
|
34896
35107
|
if (depth !== undefined && (depth < 1 || depth > 5)) {
|
|
34897
35108
|
usageError("Usage: wh assertion view <wref> --depth <1-5>", "wh assertion view Belief/cave-safe --depth 2");
|
|
@@ -35982,7 +36193,7 @@ function renderTokenInfo(ctx, info, profileName, apiUrl, identityWref) {
|
|
|
35982
36193
|
ctx.status(`${c.dim}Check the value of your WH_TOKEN environment variable.${c.reset}`);
|
|
35983
36194
|
} else if (info.source === "device") {
|
|
35984
36195
|
if (info.canRefresh) {
|
|
35985
|
-
ctx.status(`${prefix}${c.bold}${info.email ?? "unknown"}${c.reset} via ${via} ${c.dim}(token expired at ${expiry} —
|
|
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}`);
|
|
35986
36197
|
} else {
|
|
35987
36198
|
ctx.status(`${prefix}${c.red}Session expired${c.reset}${email} via ${via} ${c.dim}(expired at ${expiry})${c.reset}${endpoint}`);
|
|
35988
36199
|
ctx.status(`${c.dim}Run: wh auth login${profileName && profileName !== "default" ? ` --profile ${profileName}` : ""}${c.reset}`);
|
|
@@ -36029,6 +36240,26 @@ var loginFlags = {
|
|
|
36029
36240
|
}),
|
|
36030
36241
|
...profileFlag
|
|
36031
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
|
+
}
|
|
36032
36263
|
var handleLogin = async (ctx, { flags }) => {
|
|
36033
36264
|
const profile = flags.profile ?? ctx.config.profile ?? "default";
|
|
36034
36265
|
if (flags["with-token"]) {
|
|
@@ -36123,7 +36354,7 @@ var handleStatus = async (ctx, { flags }) => {
|
|
|
36123
36354
|
if (selectedProfile) {
|
|
36124
36355
|
const prof = getProfile(selectedProfile);
|
|
36125
36356
|
if (!prof) {
|
|
36126
|
-
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}`));
|
|
36127
36358
|
return;
|
|
36128
36359
|
}
|
|
36129
36360
|
const tokens = prof.tokens;
|
|
@@ -36137,17 +36368,26 @@ var handleStatus = async (ctx, { flags }) => {
|
|
|
36137
36368
|
canRefresh: source === "device" && !!tokens.refreshToken
|
|
36138
36369
|
};
|
|
36139
36370
|
const identityWref = info.expired ? null : await fetchIdentityWref(ctx);
|
|
36140
|
-
|
|
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));
|
|
36141
36378
|
return;
|
|
36142
36379
|
}
|
|
36143
36380
|
const envToken = process.env.WH_TOKEN;
|
|
36381
|
+
const activeProfile = ctx.config.profile ?? "default";
|
|
36382
|
+
const entries = [];
|
|
36383
|
+
const prettyEntries = [];
|
|
36144
36384
|
if (envToken) {
|
|
36145
36385
|
const envInfo = getTokenInfo();
|
|
36146
36386
|
if (envInfo) {
|
|
36147
|
-
|
|
36387
|
+
entries.push(authStatusEntry(envInfo, { active: true }));
|
|
36388
|
+
prettyEntries.push(() => renderTokenInfo(ctx, envInfo));
|
|
36148
36389
|
}
|
|
36149
36390
|
}
|
|
36150
|
-
const activeProfile = ctx.config.profile ?? "default";
|
|
36151
36391
|
const profiles = listProfiles();
|
|
36152
36392
|
for (const name of profiles) {
|
|
36153
36393
|
const prof = getProfile(name);
|
|
@@ -36163,12 +36403,22 @@ var handleStatus = async (ctx, { flags }) => {
|
|
|
36163
36403
|
canRefresh: source === "device" && !!tokens.refreshToken
|
|
36164
36404
|
};
|
|
36165
36405
|
const identityWref = !info.expired && name === activeProfile ? await fetchIdentityWref(ctx) : null;
|
|
36166
|
-
|
|
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));
|
|
36167
36413
|
}
|
|
36168
36414
|
}
|
|
36169
|
-
|
|
36170
|
-
|
|
36171
|
-
|
|
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
|
+
});
|
|
36172
36422
|
};
|
|
36173
36423
|
var statusVerb = {
|
|
36174
36424
|
prime: true,
|
|
@@ -37616,6 +37866,10 @@ function buildAddOperations(input) {
|
|
|
37616
37866
|
const rawAbout = pick(abouts, i, { allowBroadcast: true });
|
|
37617
37867
|
const about = rawAbout ? parseCollectionAboutFlag(rawAbout) : rawAbout;
|
|
37618
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
|
+
}
|
|
37619
37873
|
const localName = shape ? `${shape}/${addName}` : addName;
|
|
37620
37874
|
const kind = kindFlag ?? (about ? "assertion" : "thing");
|
|
37621
37875
|
return { operation: "add", kind, name: localName, data, about };
|
|
@@ -39425,15 +39679,15 @@ function renderValidationResult(ctx, result) {
|
|
|
39425
39679
|
if (result.errors.length > 0) {
|
|
39426
39680
|
ctx.out(`${c.red}Validation failed${c.reset}`);
|
|
39427
39681
|
for (const err of result.errors) {
|
|
39428
|
-
ctx.out(` ${c.red}error${c.reset}: ${err}`);
|
|
39682
|
+
ctx.out(` ${c.red}error${c.reset}: ${escapeTerminalTextForDisplay(err)}`);
|
|
39429
39683
|
}
|
|
39430
39684
|
}
|
|
39431
39685
|
for (const finding of result.findings) {
|
|
39432
39686
|
const color = finding.level === "error" ? c.red : finding.level === "warning" ? c.yellow : c.dim;
|
|
39433
|
-
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)}`);
|
|
39434
39688
|
}
|
|
39435
39689
|
for (const warn of result.warnings) {
|
|
39436
|
-
ctx.out(` ${c.yellow}warning${c.reset}: ${warn}`);
|
|
39690
|
+
ctx.out(` ${c.yellow}warning${c.reset}: ${escapeTerminalTextForDisplay(warn)}`);
|
|
39437
39691
|
}
|
|
39438
39692
|
if (result.valid && result.errors.length === 0) {
|
|
39439
39693
|
ctx.out(`${c.green}Valid component package${c.reset}`);
|
|
@@ -39443,29 +39697,29 @@ function renderValidationResult(ctx, result) {
|
|
|
39443
39697
|
function renderDoctorResult(ctx, result) {
|
|
39444
39698
|
const c = ctx.colors;
|
|
39445
39699
|
const stateColor = stateToColor(c, result.state);
|
|
39446
|
-
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}`);
|
|
39447
39701
|
ctx.out("");
|
|
39448
39702
|
for (const finding of result.findings) {
|
|
39449
39703
|
const color = finding.status === "ok" ? c.green : finding.status === "missing" || finding.status === "error" ? c.red : finding.status === "inactive" ? c.yellow : c.dim;
|
|
39450
|
-
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}`);
|
|
39451
39705
|
}
|
|
39452
39706
|
}
|
|
39453
39707
|
function renderTeardownResult(ctx, result) {
|
|
39454
39708
|
const c = ctx.colors;
|
|
39455
39709
|
const stateColor = stateToColor(c, result.state);
|
|
39456
|
-
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}`);
|
|
39457
39711
|
if (result.pausedSubscriptions.length > 0) {
|
|
39458
|
-
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(", ")}`);
|
|
39459
39713
|
}
|
|
39460
39714
|
if (result.releasedShapes.length > 0) {
|
|
39461
|
-
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(", ")}`);
|
|
39462
39716
|
}
|
|
39463
39717
|
if (result.tokensRevoked > 0) {
|
|
39464
39718
|
ctx.out(` ${c.green}revoked${c.reset} ${result.tokensRevoked} token(s)`);
|
|
39465
39719
|
}
|
|
39466
39720
|
ctx.out(` uninstall callback: ${result.uninstallDispatched ? `${c.green}dispatched${c.reset}` : `${c.dim}not dispatched${c.reset}`}`);
|
|
39467
39721
|
for (const warning of result.warnings) {
|
|
39468
|
-
ctx.out(` ${c.yellow}warning${c.reset}: ${warning}`);
|
|
39722
|
+
ctx.out(` ${c.yellow}warning${c.reset}: ${escapeTerminalTextForDisplay(warning)}`);
|
|
39469
39723
|
}
|
|
39470
39724
|
}
|
|
39471
39725
|
function redactRegistryEntryLifecycleUrls(entry, showSecrets) {
|
|
@@ -39485,26 +39739,26 @@ function redactRegistryEntryListLifecycleUrls(entries, showSecrets) {
|
|
|
39485
39739
|
function renderRegistryList(ctx, orgName, result) {
|
|
39486
39740
|
const c = ctx.colors;
|
|
39487
39741
|
if (!result.items.length) {
|
|
39488
|
-
ctx.status(`${c.dim}No registered components in ${orgName}${c.reset}`);
|
|
39742
|
+
ctx.status(`${c.dim}No registered components in ${escapeTerminalTextForDisplay(orgName)}${c.reset}`);
|
|
39489
39743
|
return;
|
|
39490
39744
|
}
|
|
39491
|
-
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}`);
|
|
39492
39746
|
ctx.out("");
|
|
39493
39747
|
for (const item of result.items) {
|
|
39494
39748
|
const visibility = item.isPrivate ? `${c.yellow}private${c.reset}` : `${c.green}public${c.reset}`;
|
|
39495
|
-
const description = item.description ? ` ${c.dim}${item.description}${c.reset}` : "";
|
|
39496
|
-
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}`);
|
|
39497
39751
|
}
|
|
39498
39752
|
}
|
|
39499
39753
|
function renderRegistryEntry(ctx, entry) {
|
|
39500
39754
|
const c = ctx.colors;
|
|
39501
|
-
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}`}`);
|
|
39502
39756
|
if (entry.description) {
|
|
39503
|
-
ctx.out(` ${entry.description}`);
|
|
39757
|
+
ctx.out(` ${escapeTerminalTextForDisplay(entry.description)}`);
|
|
39504
39758
|
}
|
|
39505
39759
|
if (entry.sourceUrl) {
|
|
39506
|
-
const suffix = entry.sourceDefaultRef ? ` @ ${entry.sourceDefaultRef}` : "";
|
|
39507
|
-
ctx.out(` Source: ${entry.sourceUrl}${suffix}`);
|
|
39760
|
+
const suffix = entry.sourceDefaultRef ? ` @ ${escapeTerminalTextForDisplay(entry.sourceDefaultRef)}` : "";
|
|
39761
|
+
ctx.out(` Source: ${escapeTerminalTextForDisplay(entry.sourceUrl)}${suffix}`);
|
|
39508
39762
|
} else {
|
|
39509
39763
|
ctx.out(` Source: ${c.dim}(not installable — no source URL)${c.reset}`);
|
|
39510
39764
|
}
|
|
@@ -39515,10 +39769,10 @@ function renderRegistryEntry(ctx, entry) {
|
|
|
39515
39769
|
ctx.out(` Uninstall: ${formatLifecycleUrl(entry.uninstallUrl, c)}`);
|
|
39516
39770
|
}
|
|
39517
39771
|
if (entry.credentialSetName || entry.credentialSetId) {
|
|
39518
|
-
ctx.out(` Credential set: ${entry.credentialSetName ?? entry.credentialSetId}`);
|
|
39772
|
+
ctx.out(` Credential set: ${escapeTerminalTextForDisplay(entry.credentialSetName ?? entry.credentialSetId ?? "")}`);
|
|
39519
39773
|
}
|
|
39520
39774
|
if (entry.allowedCallbackDomains.length > 0) {
|
|
39521
|
-
ctx.out(` Allowed callback domains: ${entry.allowedCallbackDomains.join(", ")}`);
|
|
39775
|
+
ctx.out(` Allowed callback domains: ${entry.allowedCallbackDomains.map(escapeTerminalTextForDisplay).join(", ")}`);
|
|
39522
39776
|
}
|
|
39523
39777
|
ctx.out(` ${c.dim}Updated: ${new Date(entry.updatedAt).toISOString().slice(0, 16)}${c.reset}`);
|
|
39524
39778
|
}
|
|
@@ -39554,13 +39808,13 @@ function redactSecretBearingUrl(rawUrl) {
|
|
|
39554
39808
|
}
|
|
39555
39809
|
function formatLifecycleUrl(url, colors) {
|
|
39556
39810
|
if (url === REDACTED_LIFECYCLE_URL) {
|
|
39557
|
-
return `${colors.dim}${url}${colors.reset}`;
|
|
39811
|
+
return `${colors.dim}${escapeTerminalTextForDisplay(url)}${colors.reset}`;
|
|
39558
39812
|
}
|
|
39559
39813
|
if (url.endsWith(REDACTED_LIFECYCLE_PATH_SUFFIX)) {
|
|
39560
39814
|
const visiblePrefix = url.slice(0, -REDACTED_LIFECYCLE_PATH_SUFFIX.length);
|
|
39561
|
-
return `${visiblePrefix}${colors.dim}${REDACTED_LIFECYCLE_PATH_SUFFIX}${colors.reset}`;
|
|
39815
|
+
return `${escapeTerminalTextForDisplay(visiblePrefix)}${colors.dim}${REDACTED_LIFECYCLE_PATH_SUFFIX}${colors.reset}`;
|
|
39562
39816
|
}
|
|
39563
|
-
return url;
|
|
39817
|
+
return escapeTerminalTextForDisplay(url);
|
|
39564
39818
|
}
|
|
39565
39819
|
|
|
39566
39820
|
// ../../packages/warmhub-cli/src/domains/component-utils.ts
|
|
@@ -40113,12 +40367,13 @@ var handleList2 = async (ctx, { flags }) => {
|
|
|
40113
40367
|
ctx.out(`${c.bold}Installed Components${c.reset} ${c.cyan}${org}/${repo}${c.reset}`);
|
|
40114
40368
|
ctx.out("");
|
|
40115
40369
|
for (const item of items) {
|
|
40116
|
-
const version = item.version ?? "unknown";
|
|
40117
|
-
const
|
|
40118
|
-
const
|
|
40119
|
-
const
|
|
40120
|
-
const
|
|
40121
|
-
|
|
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}`);
|
|
40122
40377
|
}
|
|
40123
40378
|
});
|
|
40124
40379
|
};
|
|
@@ -42010,12 +42265,12 @@ var handleView5 = async (ctx, { args }) => {
|
|
|
42010
42265
|
const c = ctx.colors;
|
|
42011
42266
|
const result = await ctx.client.org.get(name);
|
|
42012
42267
|
writeOutput(ctx, result, () => {
|
|
42013
|
-
ctx.out(`${c.bold}${result.name}${c.reset}`);
|
|
42268
|
+
ctx.out(`${c.bold}${escapeTerminalTextForDisplay(result.name)}${c.reset}`);
|
|
42014
42269
|
if (result.displayName) {
|
|
42015
|
-
ctx.out(` ${result.displayName}`);
|
|
42270
|
+
ctx.out(` ${escapeTerminalTextForDisplay(result.displayName)}`);
|
|
42016
42271
|
}
|
|
42017
42272
|
if (result.description) {
|
|
42018
|
-
ctx.out(` ${c.dim}${result.description}${c.reset}`);
|
|
42273
|
+
ctx.out(` ${c.dim}${escapeTerminalTextForDisplay(result.description)}${c.reset}`);
|
|
42019
42274
|
}
|
|
42020
42275
|
if (result.tier !== "free") {
|
|
42021
42276
|
ctx.out(` ${c.cyan}Tier: ${result.tier}${c.reset}`);
|
|
@@ -42043,10 +42298,10 @@ var handleList4 = async (ctx, { flags }) => {
|
|
|
42043
42298
|
}
|
|
42044
42299
|
ctx.out(`${c.bold}Organizations:${c.reset}`);
|
|
42045
42300
|
for (const org of result.items) {
|
|
42046
|
-
const display = org.displayName ? ` ${c.dim}${org.displayName}${c.reset}` : "";
|
|
42047
|
-
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}` : "";
|
|
42048
42303
|
const archived = org.archivedAt ? ` ${c.yellow}[archived]${c.reset}` : "";
|
|
42049
|
-
ctx.out(` ${c.cyan}${org.name}${c.reset}${display}${desc}${archived}`);
|
|
42304
|
+
ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(org.name)}${c.reset}${display}${desc}${archived}`);
|
|
42050
42305
|
}
|
|
42051
42306
|
});
|
|
42052
42307
|
};
|
|
@@ -42696,10 +42951,10 @@ var handleList5 = async (ctx, { flags, args }) => {
|
|
|
42696
42951
|
}
|
|
42697
42952
|
ctx.out(`${c.bold}Repos in ${orgName}:${c.reset}`);
|
|
42698
42953
|
for (const r of items) {
|
|
42699
|
-
const display = r.displayName && r.displayName !== r.name ? ` ${c.dim}${r.displayName}${c.reset}` : "";
|
|
42700
|
-
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}` : "";
|
|
42701
42956
|
const archived = r.archivedAt ? ` ${c.yellow}[archived]${c.reset}` : "";
|
|
42702
|
-
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}`);
|
|
42703
42958
|
}
|
|
42704
42959
|
});
|
|
42705
42960
|
};
|
|
@@ -42832,7 +43087,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
|
|
|
42832
43087
|
writeOutput(ctx, payload, () => {
|
|
42833
43088
|
ctx.out(`${c.bold}${org}/${repo}${c.reset}`);
|
|
42834
43089
|
if (repoInfo.description) {
|
|
42835
|
-
ctx.out(` ${repoInfo.description}`);
|
|
43090
|
+
ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.description)}`);
|
|
42836
43091
|
}
|
|
42837
43092
|
ctx.out("");
|
|
42838
43093
|
ctx.out(`${c.bold}Counts${c.reset} ${stats.byKind.shape} shapes, ${stats.byKind.thing} things, ${stats.byKind.assertion} assertions (${stats.total} total)`);
|
|
@@ -42840,7 +43095,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
|
|
|
42840
43095
|
if (shapeCountEntries.length > 0) {
|
|
42841
43096
|
const maxName = shapeCountEntries.reduce((max, [name]) => Math.max(max, name.length), 0);
|
|
42842
43097
|
for (const [shapeName, count] of shapeCountEntries) {
|
|
42843
|
-
ctx.out(` ${c.cyan}${shapeName.padEnd(maxName)}${c.reset} ${count}`);
|
|
43098
|
+
ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(shapeName.padEnd(maxName))}${c.reset} ${count}`);
|
|
42844
43099
|
}
|
|
42845
43100
|
}
|
|
42846
43101
|
ctx.out("");
|
|
@@ -42907,9 +43162,9 @@ var handleDescribe = async (ctx, { args, flags }) => {
|
|
|
42907
43162
|
const maxField = allEntries.reduce((m, e) => Math.max(m, e.fieldPath.length), 0);
|
|
42908
43163
|
const maxState = allEntries.reduce((m, e) => Math.max(m, e.state.length), 0);
|
|
42909
43164
|
for (const entry of allEntries) {
|
|
42910
|
-
const shapeLabel = entry.shapeName.padEnd(maxShape);
|
|
42911
|
-
const fieldLabel = entry.fieldPath.padEnd(maxField);
|
|
42912
|
-
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));
|
|
42913
43168
|
const sc = stateColor(entry.state);
|
|
42914
43169
|
let line = ` ${c.cyan}${shapeLabel}${c.reset} ${c.dim}${fieldLabel}${c.reset} ${sc}${stateLabel}${c.reset}`;
|
|
42915
43170
|
if (entry.state === "building" && entry.backfillTotal != null && entry.backfillTotal > 0) {
|
|
@@ -42918,7 +43173,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
|
|
|
42918
43173
|
} else if (entry.state === "building") {
|
|
42919
43174
|
line += ` ${c.dim}${entry.backfillDone} rows${c.reset}`;
|
|
42920
43175
|
} else if (entry.state === "failed" && entry.failureReason) {
|
|
42921
|
-
line += ` ${c.dim}${entry.failureReason}${c.reset}`;
|
|
43176
|
+
line += ` ${c.dim}${escapeTerminalTextForDisplay(entry.failureReason)}${c.reset}`;
|
|
42922
43177
|
}
|
|
42923
43178
|
ctx.out(line);
|
|
42924
43179
|
}
|
|
@@ -42972,10 +43227,11 @@ var handleView6 = async (ctx, { args }) => {
|
|
|
42972
43227
|
writeOutput(ctx, { ...repoInfo, stats, configureStats }, () => {
|
|
42973
43228
|
ctx.out(`${c.bold}${org}/${repo}${c.reset}`);
|
|
42974
43229
|
if (repoInfo.displayName && repoInfo.displayName !== repoInfo.name) {
|
|
42975
|
-
ctx.out(` ${repoInfo.displayName}`);
|
|
43230
|
+
ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.displayName)}`);
|
|
43231
|
+
}
|
|
43232
|
+
if (repoInfo.description) {
|
|
43233
|
+
ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.description)}`);
|
|
42976
43234
|
}
|
|
42977
|
-
if (repoInfo.description)
|
|
42978
|
-
ctx.out(` ${repoInfo.description}`);
|
|
42979
43235
|
if (repoInfo.archivedAt) {
|
|
42980
43236
|
ctx.out(`${c.yellow}ARCHIVED${c.reset} ${c.dim}${new Date(repoInfo.archivedAt).toISOString().slice(0, 16)}${c.reset}`);
|
|
42981
43237
|
}
|
|
@@ -46104,7 +46360,8 @@ async function runCli(argv, opts) {
|
|
|
46104
46360
|
});
|
|
46105
46361
|
const colors = makeColors({
|
|
46106
46362
|
noColor: !!process.env.NO_COLOR,
|
|
46107
|
-
isTTY: !!process.stdout.isTTY
|
|
46363
|
+
isTTY: !!process.stdout.isTTY,
|
|
46364
|
+
colorterm: process.env.COLORTERM
|
|
46108
46365
|
});
|
|
46109
46366
|
const chars = makeChars();
|
|
46110
46367
|
const ac = new AbortController;
|
|
@@ -46237,7 +46494,7 @@ function resolveLogLevel(flags, env) {
|
|
|
46237
46494
|
// package.json
|
|
46238
46495
|
var package_default3 = {
|
|
46239
46496
|
name: "@warmhub/cli",
|
|
46240
|
-
version: "0.
|
|
46497
|
+
version: "0.72.0",
|
|
46241
46498
|
private: false,
|
|
46242
46499
|
type: "module",
|
|
46243
46500
|
description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
|
|
@@ -46892,4 +47149,4 @@ if (!updateCheckSuppressedByArgv && shouldRunUpdateCheck(updateEligibility)) {
|
|
|
46892
47149
|
var interceptedExitCode = await maybeHandleComponentShellBoundary(dispatchArgv);
|
|
46893
47150
|
process.exitCode = interceptedExitCode === undefined ? await runCli(dispatchArgv, { version: package_default3.version }) : interceptedExitCode;
|
|
46894
47151
|
|
|
46895
|
-
//# debugId=
|
|
47152
|
+
//# debugId=32195DBCBD952F6364756E2164756E21
|
package/package.json
CHANGED