@warmhub/cli 0.87.0 → 0.89.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 +4 -0
- package/dist/wh.js +881 -491
- package/package.json +1 -1
package/dist/wh.js
CHANGED
|
@@ -19389,6 +19389,19 @@ var ALL_BUILTIN_SHAPE_DEFS = {
|
|
|
19389
19389
|
...BUILTIN_VIEW_SHAPE_DEFS,
|
|
19390
19390
|
...BUILTIN_LICENSE_SHAPE_DEFS
|
|
19391
19391
|
};
|
|
19392
|
+
// ../../packages/rules/src/client-flags.ts
|
|
19393
|
+
var CLIENT_FLAGS_HEADER = "X-WarmHub-Client-Flags";
|
|
19394
|
+
var CLIENT_FLAG_COMPATIBILITY_OVERRIDE = "compatibility-override";
|
|
19395
|
+
var KNOWN_CLIENT_FLAGS = new Set([
|
|
19396
|
+
CLIENT_FLAG_COMPATIBILITY_OVERRIDE
|
|
19397
|
+
]);
|
|
19398
|
+
var CLIENT_FLAG_TOKEN_RE = /^[a-z0-9-]+$/;
|
|
19399
|
+
function isValidClientFlagToken(token) {
|
|
19400
|
+
return CLIENT_FLAG_TOKEN_RE.test(token);
|
|
19401
|
+
}
|
|
19402
|
+
function serializeClientFlags(flags) {
|
|
19403
|
+
return [...new Set(flags)].sort().join(",");
|
|
19404
|
+
}
|
|
19392
19405
|
// ../../packages/rules/src/client-header.ts
|
|
19393
19406
|
var CLIENT_HEADER = "X-WarmHub-Client";
|
|
19394
19407
|
var WARMHUB_SDK_CLIENT_NAME = "@warmhub/sdk-ts";
|
|
@@ -19930,16 +19943,21 @@ function validateComponentManifestCliContract(manifest) {
|
|
|
19930
19943
|
}
|
|
19931
19944
|
return findings;
|
|
19932
19945
|
}
|
|
19946
|
+
// ../../packages/rules/src/component-manifest-validate-types.ts
|
|
19947
|
+
function failureIfAny(errors, warnings) {
|
|
19948
|
+
const [first, ...rest] = errors;
|
|
19949
|
+
if (first === undefined)
|
|
19950
|
+
return;
|
|
19951
|
+
return { valid: false, errors: [first, ...rest], warnings };
|
|
19952
|
+
}
|
|
19953
|
+
|
|
19933
19954
|
// ../../packages/rules/src/component-version.ts
|
|
19934
19955
|
var SEMVER_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
19935
|
-
function
|
|
19936
|
-
return SEMVER_RE.test(version);
|
|
19956
|
+
function parseSemver(version) {
|
|
19957
|
+
return SEMVER_RE.test(version) ? version : null;
|
|
19937
19958
|
}
|
|
19938
|
-
function
|
|
19959
|
+
function decompose(version) {
|
|
19939
19960
|
const match = SEMVER_RE.exec(version);
|
|
19940
|
-
if (!match) {
|
|
19941
|
-
throw new Error(`Invalid semver: ${JSON.stringify(version)}`);
|
|
19942
|
-
}
|
|
19943
19961
|
return {
|
|
19944
19962
|
major: Number(match[1]),
|
|
19945
19963
|
minor: Number(match[2]),
|
|
@@ -19959,6 +19977,8 @@ function comparePrerelease(a, b) {
|
|
|
19959
19977
|
for (let i = 0;i < len; i++) {
|
|
19960
19978
|
const ai = a[i];
|
|
19961
19979
|
const bi = b[i];
|
|
19980
|
+
if (ai === undefined || bi === undefined)
|
|
19981
|
+
break;
|
|
19962
19982
|
if (ai === bi)
|
|
19963
19983
|
continue;
|
|
19964
19984
|
const aNum = NUMERIC_RE.test(ai);
|
|
@@ -19977,8 +19997,8 @@ function comparePrerelease(a, b) {
|
|
|
19977
19997
|
return a.length < b.length ? -1 : 1;
|
|
19978
19998
|
}
|
|
19979
19999
|
function compareSemver(a, b) {
|
|
19980
|
-
const pa =
|
|
19981
|
-
const pb =
|
|
20000
|
+
const pa = decompose(a);
|
|
20001
|
+
const pb = decompose(b);
|
|
19982
20002
|
if (pa.major !== pb.major)
|
|
19983
20003
|
return pa.major < pb.major ? -1 : 1;
|
|
19984
20004
|
if (pa.minor !== pb.minor)
|
|
@@ -19989,8 +20009,8 @@ function compareSemver(a, b) {
|
|
|
19989
20009
|
}
|
|
19990
20010
|
|
|
19991
20011
|
// ../../packages/rules/src/component-manifest-validate-json.ts
|
|
19992
|
-
function
|
|
19993
|
-
return { valid: false, errors, warnings };
|
|
20012
|
+
function failWith(message) {
|
|
20013
|
+
return { valid: false, errors: [message], warnings: [] };
|
|
19994
20014
|
}
|
|
19995
20015
|
function isObject2(v) {
|
|
19996
20016
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -20020,7 +20040,7 @@ function optionalStringArray(obj, field, path, errors) {
|
|
|
20020
20040
|
}
|
|
20021
20041
|
function validateComponentJson(data) {
|
|
20022
20042
|
if (!isObject2(data)) {
|
|
20023
|
-
return
|
|
20043
|
+
return failWith("component.json must be a JSON object");
|
|
20024
20044
|
}
|
|
20025
20045
|
const errors = [];
|
|
20026
20046
|
requireString(data, "id", "component", errors);
|
|
@@ -20029,11 +20049,8 @@ function validateComponentJson(data) {
|
|
|
20029
20049
|
optionalString(data, "description", "component", errors);
|
|
20030
20050
|
optionalString(data, "author", "component", errors);
|
|
20031
20051
|
optionalStringArray(data, "tags", "component", errors);
|
|
20032
|
-
|
|
20033
|
-
return fail(errors);
|
|
20034
|
-
return {
|
|
20052
|
+
return failureIfAny(errors, []) ?? {
|
|
20035
20053
|
valid: true,
|
|
20036
|
-
errors: [],
|
|
20037
20054
|
warnings: [],
|
|
20038
20055
|
value: data
|
|
20039
20056
|
};
|
|
@@ -20067,7 +20084,7 @@ function validateManifestComponent(data, errors) {
|
|
|
20067
20084
|
requireString(data, "name", "manifest.component", errors);
|
|
20068
20085
|
requireString(data, "version", "manifest.component", errors);
|
|
20069
20086
|
if (typeof data.version === "string" && data.version.length > 0) {
|
|
20070
|
-
if (
|
|
20087
|
+
if (parseSemver(data.version) === null) {
|
|
20071
20088
|
errors.push(`manifest.component.version "${data.version}" is not valid semver (e.g. 1.2.3, 1.2.3-rc.1)`);
|
|
20072
20089
|
}
|
|
20073
20090
|
}
|
|
@@ -20260,7 +20277,7 @@ function validateTeardown(teardown, path, errors) {
|
|
|
20260
20277
|
}
|
|
20261
20278
|
function validateManifestJson(data) {
|
|
20262
20279
|
if (!isObject2(data)) {
|
|
20263
|
-
return
|
|
20280
|
+
return failWith("manifest.json must be a JSON object");
|
|
20264
20281
|
}
|
|
20265
20282
|
const errors = [];
|
|
20266
20283
|
const warnings = [];
|
|
@@ -20313,11 +20330,8 @@ function validateManifestJson(data) {
|
|
|
20313
20330
|
if (data.cli !== undefined) {
|
|
20314
20331
|
errors.push(...validateComponentManifestCliShape(data.cli).map((finding) => finding.message));
|
|
20315
20332
|
}
|
|
20316
|
-
|
|
20317
|
-
return { valid: false, errors, warnings };
|
|
20318
|
-
return {
|
|
20333
|
+
return failureIfAny(errors, warnings) ?? {
|
|
20319
20334
|
valid: true,
|
|
20320
|
-
errors: [],
|
|
20321
20335
|
warnings,
|
|
20322
20336
|
value: data
|
|
20323
20337
|
};
|
|
@@ -20538,17 +20552,27 @@ function joinFieldIdentityPath(...segments) {
|
|
|
20538
20552
|
function joinFieldPathWithEscaper(escapeSegment, segments) {
|
|
20539
20553
|
return segments.map((segment) => typeof segment === "number" ? `[${segment}]` : escapeSegment(segment)).join(".").replace(/\.\[/g, "[");
|
|
20540
20554
|
}
|
|
20541
|
-
// ../../packages/rules/src/
|
|
20542
|
-
|
|
20543
|
-
|
|
20544
|
-
|
|
20545
|
-
|
|
20555
|
+
// ../../packages/rules/src/org-qualified-ref.ts
|
|
20556
|
+
function splitOrgQualified(ref) {
|
|
20557
|
+
const parts = ref.split("/");
|
|
20558
|
+
if (parts.length !== 2)
|
|
20559
|
+
return null;
|
|
20560
|
+
const [first, second] = parts;
|
|
20561
|
+
if (!first || !second)
|
|
20562
|
+
return null;
|
|
20563
|
+
return [first, second];
|
|
20564
|
+
}
|
|
20565
|
+
function parseRepoSlug(ref) {
|
|
20566
|
+
const parts = splitOrgQualified(ref);
|
|
20567
|
+
return parts === null ? null : { org: parts[0], repo: parts[1] };
|
|
20568
|
+
}
|
|
20569
|
+
function parseComponentRef(ref) {
|
|
20570
|
+
const parts = splitOrgQualified(ref);
|
|
20571
|
+
return parts === null ? null : { org: parts[0], name: parts[1] };
|
|
20546
20572
|
}
|
|
20547
|
-
|
|
20548
20573
|
// ../../packages/rules/src/preflight-commit.ts
|
|
20549
20574
|
function preflightCommitDiagnostics(operations, options) {
|
|
20550
20575
|
const errors = [];
|
|
20551
|
-
rejectCommitTokenSyntax(operations, errors, options);
|
|
20552
20576
|
illegalOpSequences(operations, errors, options?.checkAddAdd ?? true, options);
|
|
20553
20577
|
return errors;
|
|
20554
20578
|
}
|
|
@@ -20558,33 +20582,6 @@ function sourceOperationIndex(filteredIndex, options) {
|
|
|
20558
20582
|
function getOpName(op) {
|
|
20559
20583
|
return op.name;
|
|
20560
20584
|
}
|
|
20561
|
-
function tokenStringFields(op) {
|
|
20562
|
-
const fields = [getOpName(op), op.newName];
|
|
20563
|
-
if (typeof op.about === "string") {
|
|
20564
|
-
fields.push(op.about);
|
|
20565
|
-
}
|
|
20566
|
-
if (op.members) {
|
|
20567
|
-
fields.push(...op.members);
|
|
20568
|
-
}
|
|
20569
|
-
return fields;
|
|
20570
|
-
}
|
|
20571
|
-
function rejectCommitTokenSyntax(operations, errors, options) {
|
|
20572
|
-
for (let i = 0;i < operations.length; i++) {
|
|
20573
|
-
const op = operations[i];
|
|
20574
|
-
if (!op)
|
|
20575
|
-
continue;
|
|
20576
|
-
for (const field of tokenStringFields(op)) {
|
|
20577
|
-
if (field && hasAnyTokens(field)) {
|
|
20578
|
-
errors.push({
|
|
20579
|
-
code: "COMMIT_TOKEN_SYNTAX_REMOVED",
|
|
20580
|
-
operationIndex: sourceOperationIndex(i, options),
|
|
20581
|
-
message: COMMIT_TOKEN_SYNTAX_REMOVED_MESSAGE
|
|
20582
|
-
});
|
|
20583
|
-
break;
|
|
20584
|
-
}
|
|
20585
|
-
}
|
|
20586
|
-
}
|
|
20587
|
-
}
|
|
20588
20585
|
function illegalOpSequences(operations, errors, checkAddAdd, options) {
|
|
20589
20586
|
const opHistory = new Map;
|
|
20590
20587
|
for (let i = 0;i < operations.length; i++) {
|
|
@@ -20594,8 +20591,6 @@ function illegalOpSequences(operations, errors, checkAddAdd, options) {
|
|
|
20594
20591
|
const name = getOpName(op);
|
|
20595
20592
|
if (!name)
|
|
20596
20593
|
continue;
|
|
20597
|
-
if (hasAnyTokens(name))
|
|
20598
|
-
continue;
|
|
20599
20594
|
const kind = inferOperationKind({ ...op, name });
|
|
20600
20595
|
const qualName = kind === "shape" ? `shape:${name}` : `thing:${name}`;
|
|
20601
20596
|
const history = opHistory.get(qualName) ?? [];
|
|
@@ -20638,6 +20633,12 @@ var canonicalCollectionTypes = ["arc", "bond", "set", "list"];
|
|
|
20638
20633
|
var collectionOps = ["add", "revise"];
|
|
20639
20634
|
var COLLECTION_CREATE_REQUIRES_NAME_MESSAGE = "Collection create requires a name. Collections are ordinary named things (ADR 0004).";
|
|
20640
20635
|
var COLLECTION_ABOUT_REMOVED_MESSAGE = 'about accepts a wref. Create the collection as its own named operation, then point the assertion at it. Prefer deterministic relationship names, for example: [{"operation":"add","kind":"collection","type":"arc","name":"a-to-b","members":["A","B"]},{"operation":"add","kind":"assertion","about":"Arc/a-to-b","name":"Assertion/example","data":{}}]. For CLI usage, use wh commit submit --file with the two operations.';
|
|
20636
|
+
function parseCollectionType(value) {
|
|
20637
|
+
return collectionTypes.find((candidate) => candidate === value) ?? null;
|
|
20638
|
+
}
|
|
20639
|
+
function parseCollectionOp(value) {
|
|
20640
|
+
return collectionOps.find((candidate) => candidate === value) ?? null;
|
|
20641
|
+
}
|
|
20641
20642
|
function preflightOpDiagnostics(op, operationIndex) {
|
|
20642
20643
|
const errors = [];
|
|
20643
20644
|
errors.push(...builtinShapeGuard(op, operationIndex));
|
|
@@ -20770,7 +20771,7 @@ function validateCollectionOps(op, operationIndex) {
|
|
|
20770
20771
|
const errors = [];
|
|
20771
20772
|
if (op.kind !== "collection")
|
|
20772
20773
|
return errors;
|
|
20773
|
-
if (
|
|
20774
|
+
if (parseCollectionOp(op.operation) === null) {
|
|
20774
20775
|
return errors;
|
|
20775
20776
|
}
|
|
20776
20777
|
if (op.operation === "add" && !op.name) {
|
|
@@ -20780,7 +20781,8 @@ function validateCollectionOps(op, operationIndex) {
|
|
|
20780
20781
|
message: COLLECTION_CREATE_REQUIRES_NAME_MESSAGE
|
|
20781
20782
|
});
|
|
20782
20783
|
}
|
|
20783
|
-
|
|
20784
|
+
const collectionType = parseCollectionType(op.type);
|
|
20785
|
+
if (collectionType === null) {
|
|
20784
20786
|
errors.push({
|
|
20785
20787
|
code: "VALIDATION_ERROR",
|
|
20786
20788
|
operationIndex,
|
|
@@ -20804,8 +20806,8 @@ function validateCollectionOps(op, operationIndex) {
|
|
|
20804
20806
|
}
|
|
20805
20807
|
}
|
|
20806
20808
|
}
|
|
20807
|
-
if (
|
|
20808
|
-
const arityError = collectionArityError(
|
|
20809
|
+
if (collectionType !== null && op.members) {
|
|
20810
|
+
const arityError = collectionArityError(collectionType, op.members);
|
|
20809
20811
|
if (arityError) {
|
|
20810
20812
|
errors.push({
|
|
20811
20813
|
code: "VALIDATION_ERROR",
|
|
@@ -20827,6 +20829,10 @@ function collectionArityError(tag, members) {
|
|
|
20827
20829
|
case "set":
|
|
20828
20830
|
case "list":
|
|
20829
20831
|
return members.length < 1 ? `${tag === "set" ? "Set" : "List"} requires at least 1 member, got 0` : null;
|
|
20832
|
+
default: {
|
|
20833
|
+
const unhandled = tag;
|
|
20834
|
+
return unhandled;
|
|
20835
|
+
}
|
|
20830
20836
|
}
|
|
20831
20837
|
}
|
|
20832
20838
|
// ../../packages/rules/src/preflight.ts
|
|
@@ -20896,7 +20902,7 @@ __export(exports_external, {
|
|
|
20896
20902
|
pipe: () => pipe,
|
|
20897
20903
|
partialRecord: () => partialRecord,
|
|
20898
20904
|
parseAsync: () => parseAsync2,
|
|
20899
|
-
parse: () =>
|
|
20905
|
+
parse: () => parse3,
|
|
20900
20906
|
overwrite: () => _overwrite,
|
|
20901
20907
|
optional: () => optional,
|
|
20902
20908
|
object: () => object,
|
|
@@ -21098,7 +21104,7 @@ __export(exports_core2, {
|
|
|
21098
21104
|
process: () => process2,
|
|
21099
21105
|
prettifyError: () => prettifyError,
|
|
21100
21106
|
parseAsync: () => parseAsync,
|
|
21101
|
-
parse: () =>
|
|
21107
|
+
parse: () => parse,
|
|
21102
21108
|
meta: () => meta,
|
|
21103
21109
|
locales: () => exports_locales,
|
|
21104
21110
|
isValidJWT: () => isValidJWT,
|
|
@@ -22282,7 +22288,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
22282
22288
|
}
|
|
22283
22289
|
return result.value;
|
|
22284
22290
|
};
|
|
22285
|
-
var
|
|
22291
|
+
var parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
22286
22292
|
var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
22287
22293
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
22288
22294
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -25069,10 +25075,10 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
25069
25075
|
throw new Error("implement() must be called with a function");
|
|
25070
25076
|
}
|
|
25071
25077
|
return function(...args) {
|
|
25072
|
-
const parsedArgs = inst._def.input ?
|
|
25078
|
+
const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
|
|
25073
25079
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
25074
25080
|
if (inst._def.output) {
|
|
25075
|
-
return
|
|
25081
|
+
return parse(inst._def.output, result);
|
|
25076
25082
|
}
|
|
25077
25083
|
return result;
|
|
25078
25084
|
};
|
|
@@ -33294,7 +33300,7 @@ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
|
|
|
33294
33300
|
});
|
|
33295
33301
|
|
|
33296
33302
|
// ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/parse.js
|
|
33297
|
-
var
|
|
33303
|
+
var parse3 = /* @__PURE__ */ _parse(ZodRealError);
|
|
33298
33304
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
33299
33305
|
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
33300
33306
|
var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
@@ -33357,7 +33363,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
33357
33363
|
inst.def = def;
|
|
33358
33364
|
inst.type = def.type;
|
|
33359
33365
|
Object.defineProperty(inst, "_def", { value: def });
|
|
33360
|
-
inst.parse = (data, params) =>
|
|
33366
|
+
inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });
|
|
33361
33367
|
inst.safeParse = (data, params) => safeParse2(inst, data, params);
|
|
33362
33368
|
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
|
|
33363
33369
|
inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
|
|
@@ -35417,16 +35423,8 @@ var BASE_PRIMITIVE_TYPES = [
|
|
|
35417
35423
|
];
|
|
35418
35424
|
var BASE_PRIMITIVE_TYPE_SET = new Set(BASE_PRIMITIVE_TYPES);
|
|
35419
35425
|
var VALID_PRIMITIVE_TYPES = new Set([
|
|
35420
|
-
|
|
35421
|
-
|
|
35422
|
-
"boolean",
|
|
35423
|
-
"wref",
|
|
35424
|
-
"array",
|
|
35425
|
-
"number?",
|
|
35426
|
-
"string?",
|
|
35427
|
-
"boolean?",
|
|
35428
|
-
"wref?",
|
|
35429
|
-
"array?"
|
|
35426
|
+
...BASE_PRIMITIVE_TYPES,
|
|
35427
|
+
...BASE_PRIMITIVE_TYPES.map((type) => `${type}?`)
|
|
35430
35428
|
]);
|
|
35431
35429
|
function isPlainObject2(value) {
|
|
35432
35430
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -42601,6 +42599,54 @@ var SYSTEM_INFRA_SHAPE_NAMES = new Set(SYSTEM_COMPONENTS.filter((entry) => entry
|
|
|
42601
42599
|
function findSystemComponent(componentId) {
|
|
42602
42600
|
return SYSTEM_COMPONENTS.find((entry) => entry.componentId === componentId);
|
|
42603
42601
|
}
|
|
42602
|
+
// ../../packages/sdk-ts/src/grant-client.ts
|
|
42603
|
+
function createGrantClient(getTrpc, mapError) {
|
|
42604
|
+
return {
|
|
42605
|
+
create: async (orgName, repoName, input) => {
|
|
42606
|
+
try {
|
|
42607
|
+
return await getTrpc().grant.create.mutate({
|
|
42608
|
+
orgName,
|
|
42609
|
+
repoName,
|
|
42610
|
+
...input
|
|
42611
|
+
});
|
|
42612
|
+
} catch (error51) {
|
|
42613
|
+
throw mapError(error51);
|
|
42614
|
+
}
|
|
42615
|
+
},
|
|
42616
|
+
get: async (orgName, repoName, grantId) => {
|
|
42617
|
+
try {
|
|
42618
|
+
return await getTrpc().grant.get.query({ orgName, repoName, grantId });
|
|
42619
|
+
} catch (error51) {
|
|
42620
|
+
throw mapError(error51);
|
|
42621
|
+
}
|
|
42622
|
+
},
|
|
42623
|
+
list: async (orgName, repoName, opts) => {
|
|
42624
|
+
try {
|
|
42625
|
+
return await getTrpc().grant.list.query({
|
|
42626
|
+
orgName,
|
|
42627
|
+
repoName,
|
|
42628
|
+
limit: opts?.limit,
|
|
42629
|
+
cursor: opts?.cursor
|
|
42630
|
+
});
|
|
42631
|
+
} catch (error51) {
|
|
42632
|
+
throw mapError(error51);
|
|
42633
|
+
}
|
|
42634
|
+
},
|
|
42635
|
+
revoke: async (orgName, repoName, grantId, opts) => {
|
|
42636
|
+
try {
|
|
42637
|
+
return await getTrpc().grant.revoke.mutate({
|
|
42638
|
+
orgName,
|
|
42639
|
+
repoName,
|
|
42640
|
+
grantId,
|
|
42641
|
+
reason: opts?.reason
|
|
42642
|
+
});
|
|
42643
|
+
} catch (error51) {
|
|
42644
|
+
throw mapError(error51);
|
|
42645
|
+
}
|
|
42646
|
+
}
|
|
42647
|
+
};
|
|
42648
|
+
}
|
|
42649
|
+
|
|
42604
42650
|
// ../../packages/sdk-ts/src/repository-checkpoint-client.ts
|
|
42605
42651
|
function normalizeRepositoryCheckpointStatus(status) {
|
|
42606
42652
|
return {
|
|
@@ -43379,7 +43425,7 @@ function completedOperationsFrom(result) {
|
|
|
43379
43425
|
// ../../packages/sdk-ts/package.json
|
|
43380
43426
|
var package_default = {
|
|
43381
43427
|
name: "@warmhub/sdk-ts",
|
|
43382
|
-
version: "0.
|
|
43428
|
+
version: "0.87.0",
|
|
43383
43429
|
private: false,
|
|
43384
43430
|
type: "module",
|
|
43385
43431
|
description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
|
|
@@ -43514,21 +43560,23 @@ function clientCompatibilityFailure(capabilities, identity2) {
|
|
|
43514
43560
|
hint: "Upgrade the WarmHub backend before retrying this write."
|
|
43515
43561
|
};
|
|
43516
43562
|
}
|
|
43517
|
-
const
|
|
43518
|
-
|
|
43563
|
+
const advertised = capabilities.minSupportedClients[identity2.name];
|
|
43564
|
+
const minimum = typeof advertised === "string" ? parseSemver(advertised) : null;
|
|
43565
|
+
if (!minimum) {
|
|
43519
43566
|
return {
|
|
43520
43567
|
message: `The backend does not advertise a valid compatibility floor for ${identity2.name}.`,
|
|
43521
43568
|
hint: "Upgrade the WarmHub backend or register this first-party client family before writing."
|
|
43522
43569
|
};
|
|
43523
43570
|
}
|
|
43524
43571
|
if (!sdkVersionIsDevelopment(identity2.version)) {
|
|
43525
|
-
|
|
43572
|
+
const version2 = parseSemver(identity2.version);
|
|
43573
|
+
if (!version2) {
|
|
43526
43574
|
return {
|
|
43527
43575
|
message: `${identity2.name} reported malformed version "${identity2.version}".`,
|
|
43528
43576
|
hint: "Use a released WarmHub client with a SemVer package version."
|
|
43529
43577
|
};
|
|
43530
43578
|
}
|
|
43531
|
-
if (compareSemver(
|
|
43579
|
+
if (compareSemver(version2, minimum) < 0) {
|
|
43532
43580
|
return {
|
|
43533
43581
|
message: `${identity2.name} ${identity2.version} is older than the backend's minimum supported version ${minimum}.`,
|
|
43534
43582
|
hint: clientUpgradeHint(identity2.name)
|
|
@@ -43556,7 +43604,8 @@ var WARMHUB_CLIENT_OPTION_NAMES = [
|
|
|
43556
43604
|
"accessToken",
|
|
43557
43605
|
"auth",
|
|
43558
43606
|
"functionLogs",
|
|
43559
|
-
"client"
|
|
43607
|
+
"client",
|
|
43608
|
+
"clientFlags"
|
|
43560
43609
|
];
|
|
43561
43610
|
var WARMHUB_CLIENT_OPTION_NAME_SET = new Set(WARMHUB_CLIENT_OPTION_NAMES);
|
|
43562
43611
|
var ACCESS_TOKEN_OPTION_ALIASES = new Set(["token", "apiKey", "bearer"]);
|
|
@@ -43572,6 +43621,17 @@ function validateWarmHubClientOptions(options) {
|
|
|
43572
43621
|
throw new TypeError(`Unknown WarmHubClient option "${key}"${hint}`);
|
|
43573
43622
|
}
|
|
43574
43623
|
}
|
|
43624
|
+
function normalizeClientFlags(flags) {
|
|
43625
|
+
if (!flags || flags.length === 0) {
|
|
43626
|
+
return [];
|
|
43627
|
+
}
|
|
43628
|
+
for (const token of flags) {
|
|
43629
|
+
if (!isValidClientFlagToken(token)) {
|
|
43630
|
+
throw new TypeError(`Invalid client flag "${token}": expected lowercase tokens matching [a-z0-9-]+.`);
|
|
43631
|
+
}
|
|
43632
|
+
}
|
|
43633
|
+
return [...new Set(flags)].sort();
|
|
43634
|
+
}
|
|
43575
43635
|
var DEFAULT_API_URL = "https://api.warmhub.ai";
|
|
43576
43636
|
var UNBATCHED_TRPC_PATHS = new Set([
|
|
43577
43637
|
"repo.shapeInstanceCounts",
|
|
@@ -43891,9 +43951,11 @@ function connectionErrorMessage(url2) {
|
|
|
43891
43951
|
function sdkVersionIsBelowMinimum(version2, minimum) {
|
|
43892
43952
|
if (sdkVersionIsDevelopment(version2))
|
|
43893
43953
|
return false;
|
|
43894
|
-
|
|
43954
|
+
const parsed = parseSemver(version2);
|
|
43955
|
+
const floor = parseSemver(minimum);
|
|
43956
|
+
if (!parsed || !floor)
|
|
43895
43957
|
return false;
|
|
43896
|
-
return compareSemver(
|
|
43958
|
+
return compareSemver(parsed, floor) < 0;
|
|
43897
43959
|
}
|
|
43898
43960
|
function clientIncompatible(message, hint) {
|
|
43899
43961
|
return new WarmHubError("CLIENT_INCOMPATIBLE", message, 412, hint);
|
|
@@ -43910,10 +43972,22 @@ class WarmHubClient {
|
|
|
43910
43972
|
fetchImpl;
|
|
43911
43973
|
accessToken;
|
|
43912
43974
|
clientIdentity;
|
|
43975
|
+
clientFlags;
|
|
43913
43976
|
functionLogMode;
|
|
43914
43977
|
getToken;
|
|
43915
43978
|
compatibilityCheck;
|
|
43979
|
+
overrideNoticePrinted = false;
|
|
43980
|
+
noteCompatibilityOverride() {
|
|
43981
|
+
if (this.overrideNoticePrinted)
|
|
43982
|
+
return;
|
|
43983
|
+
this.overrideNoticePrinted = true;
|
|
43984
|
+
console.error(`warmhub: compatibility checks overridden by client flag ${CLIENT_FLAG_COMPATIBILITY_OVERRIDE}; the server remains authoritative.`);
|
|
43985
|
+
}
|
|
43916
43986
|
assertWriteCompatible() {
|
|
43987
|
+
if (this.clientFlags.includes(CLIENT_FLAG_COMPATIBILITY_OVERRIDE)) {
|
|
43988
|
+
this.noteCompatibilityOverride();
|
|
43989
|
+
return Promise.resolve();
|
|
43990
|
+
}
|
|
43917
43991
|
if (sdkVersionIsDevelopment(this.clientIdentity.version) && isProductionApiUrl(this.apiUrl, DEFAULT_API_URL)) {
|
|
43918
43992
|
return Promise.reject(clientIncompatible(`Development client ${this.clientIdentity.name}/${this.clientIdentity.version} cannot write to production.`, "Install a released WarmHub client artifact before writing to api.warmhub.ai."));
|
|
43919
43993
|
}
|
|
@@ -45224,6 +45298,32 @@ class WarmHubClient {
|
|
|
45224
45298
|
}
|
|
45225
45299
|
}
|
|
45226
45300
|
};
|
|
45301
|
+
view = {
|
|
45302
|
+
evaluate: async (orgName, repoName, wref, opts) => {
|
|
45303
|
+
try {
|
|
45304
|
+
return await this.trpc.view.evaluate.query({
|
|
45305
|
+
orgName,
|
|
45306
|
+
repoName,
|
|
45307
|
+
wref,
|
|
45308
|
+
limit: opts?.limit,
|
|
45309
|
+
cursor: opts?.cursor
|
|
45310
|
+
});
|
|
45311
|
+
} catch (error51) {
|
|
45312
|
+
throw toWarmHubError(error51);
|
|
45313
|
+
}
|
|
45314
|
+
},
|
|
45315
|
+
evaluateIter: (orgName, repoName, wref, opts) => {
|
|
45316
|
+
return paginate((cursor) => this.view.evaluate(orgName, repoName, wref, { ...opts, cursor }), (page) => page.items, opts?.cursor);
|
|
45317
|
+
},
|
|
45318
|
+
evaluateAll: async (orgName, repoName, wref, opts) => {
|
|
45319
|
+
const { max, ...pageOpts } = opts ?? {};
|
|
45320
|
+
return await collectPaginatedPages((cursor) => this.view.evaluate(orgName, repoName, wref, {
|
|
45321
|
+
...pageOpts,
|
|
45322
|
+
cursor
|
|
45323
|
+
}), (page) => page.items, max, pageOpts.cursor);
|
|
45324
|
+
}
|
|
45325
|
+
};
|
|
45326
|
+
grant = createGrantClient(() => this.trpc, toWarmHubError);
|
|
45227
45327
|
thing = {
|
|
45228
45328
|
head: async (orgName, repoName, opts) => {
|
|
45229
45329
|
try {
|
|
@@ -45803,6 +45903,7 @@ class WarmHubClient {
|
|
|
45803
45903
|
name: options?.client?.name ?? WARMHUB_SDK_CLIENT_NAME,
|
|
45804
45904
|
version: options?.client?.version ?? SDK_VERSION
|
|
45805
45905
|
};
|
|
45906
|
+
this.clientFlags = normalizeClientFlags(options?.clientFlags);
|
|
45806
45907
|
if (typeof this.accessToken === "function") {
|
|
45807
45908
|
const provider = this.accessToken;
|
|
45808
45909
|
this.getToken = async () => await provider();
|
|
@@ -45833,7 +45934,8 @@ class WarmHubClient {
|
|
|
45833
45934
|
apiUrl: this.apiUrl,
|
|
45834
45935
|
fetch: this.fetchImpl,
|
|
45835
45936
|
accessToken,
|
|
45836
|
-
client: this.clientIdentity
|
|
45937
|
+
client: this.clientIdentity,
|
|
45938
|
+
clientFlags: this.clientFlags
|
|
45837
45939
|
});
|
|
45838
45940
|
}
|
|
45839
45941
|
actions = this.action;
|
|
@@ -45906,6 +46008,9 @@ class WarmHubClient {
|
|
|
45906
46008
|
if (!headers.has(CLIENT_HEADER)) {
|
|
45907
46009
|
headers.set(CLIENT_HEADER, formatClientHeader(this.clientIdentity.name, this.clientIdentity.version));
|
|
45908
46010
|
}
|
|
46011
|
+
if (this.clientFlags.length > 0 && !headers.has(CLIENT_FLAGS_HEADER)) {
|
|
46012
|
+
headers.set(CLIENT_FLAGS_HEADER, serializeClientFlags(this.clientFlags));
|
|
46013
|
+
}
|
|
45909
46014
|
}
|
|
45910
46015
|
async fetchWithAuth(input, init) {
|
|
45911
46016
|
const fetchImpl = this.fetchImpl ?? globalThis.fetch;
|
|
@@ -46173,7 +46278,9 @@ var CONFLICT_SHAPED_CODES = new Set([
|
|
|
46173
46278
|
"REPO_PENDING_DELETE",
|
|
46174
46279
|
"ALREADY_RETRACTED",
|
|
46175
46280
|
"LEASE_UNAVAILABLE",
|
|
46176
|
-
"INCREMENTAL_READ_UNAVAILABLE"
|
|
46281
|
+
"INCREMENTAL_READ_UNAVAILABLE",
|
|
46282
|
+
"VIEW_EVALUATION_UNAVAILABLE",
|
|
46283
|
+
"IDEMPOTENCY_CONFLICT"
|
|
46177
46284
|
]);
|
|
46178
46285
|
|
|
46179
46286
|
// ../../packages/warmhub-cli/src/errors-types.ts
|
|
@@ -46652,11 +46759,13 @@ function cliErrorFromAllFailed(failures) {
|
|
|
46652
46759
|
return bestErr;
|
|
46653
46760
|
return new CliError(4 /* Backend */, "BACKEND", `All ${failures.length} operations failed`);
|
|
46654
46761
|
}
|
|
46655
|
-
function
|
|
46762
|
+
function requireSingleOpSuccess(result) {
|
|
46656
46763
|
const op = result.operations[0];
|
|
46657
|
-
if (!op
|
|
46658
|
-
|
|
46659
|
-
|
|
46764
|
+
if (!op)
|
|
46765
|
+
throw new Error("Commit returned no operation result");
|
|
46766
|
+
if (isFailedOpStatus(op.status))
|
|
46767
|
+
throw cliErrorFromOpFailure(op);
|
|
46768
|
+
return op;
|
|
46660
46769
|
}
|
|
46661
46770
|
|
|
46662
46771
|
// ../../packages/warmhub-cli/src/args.ts
|
|
@@ -48010,9 +48119,11 @@ async function modifyStore(mutator, path) {
|
|
|
48010
48119
|
return result;
|
|
48011
48120
|
});
|
|
48012
48121
|
}
|
|
48013
|
-
async function
|
|
48122
|
+
async function saveProfileWithFlagsLocked(name, profile, flags, path) {
|
|
48014
48123
|
await modifyStore((store) => {
|
|
48015
|
-
|
|
48124
|
+
const stored = hasProfile(store, name) ? store.profiles[name]?.flags : undefined;
|
|
48125
|
+
const resolved = flags ?? (Array.isArray(stored) ? stored : undefined);
|
|
48126
|
+
setProfile(store, name, resolved?.length ? { ...profile, flags: [...resolved] } : profile);
|
|
48016
48127
|
}, path);
|
|
48017
48128
|
}
|
|
48018
48129
|
async function deleteProfileLocked(name, path) {
|
|
@@ -48392,7 +48503,8 @@ function createClient(config2, opts = {}) {
|
|
|
48392
48503
|
},
|
|
48393
48504
|
fetch: createBenchmarkAwareFetch(benchmarkId, opts.signal),
|
|
48394
48505
|
functionLogs: opts.functionLogs,
|
|
48395
|
-
client: cliClientIdentity()
|
|
48506
|
+
client: cliClientIdentity(),
|
|
48507
|
+
clientFlags: opts.clientFlags
|
|
48396
48508
|
});
|
|
48397
48509
|
}
|
|
48398
48510
|
function createUnauthenticatedClient(config2, opts = {}) {
|
|
@@ -48401,7 +48513,8 @@ function createUnauthenticatedClient(config2, opts = {}) {
|
|
|
48401
48513
|
apiUrl: config2.apiUrl,
|
|
48402
48514
|
fetch: createBenchmarkAwareFetch(benchmarkId, opts.signal),
|
|
48403
48515
|
functionLogs: opts.functionLogs,
|
|
48404
|
-
client: cliClientIdentity()
|
|
48516
|
+
client: cliClientIdentity(),
|
|
48517
|
+
clientFlags: opts.clientFlags
|
|
48405
48518
|
});
|
|
48406
48519
|
}
|
|
48407
48520
|
function wantsStructuredLiveOutput(format) {
|
|
@@ -48434,7 +48547,8 @@ async function runLive(opts) {
|
|
|
48434
48547
|
auth,
|
|
48435
48548
|
fetch: createBenchmarkAwareFetch(benchmarkId, controller.signal),
|
|
48436
48549
|
functionLogs: opts.functionLogs,
|
|
48437
|
-
client: cliClientIdentity()
|
|
48550
|
+
client: cliClientIdentity(),
|
|
48551
|
+
clientFlags: opts.clientFlags
|
|
48438
48552
|
});
|
|
48439
48553
|
if (opts.signal) {
|
|
48440
48554
|
if (opts.signal.aborted)
|
|
@@ -48516,15 +48630,29 @@ function shouldGuardDomain(domainPath, canonicalVerb, args) {
|
|
|
48516
48630
|
}
|
|
48517
48631
|
return true;
|
|
48518
48632
|
}
|
|
48633
|
+
async function probeCapabilities(ctx) {
|
|
48634
|
+
try {
|
|
48635
|
+
return await ctx.client.diagnostics.capabilities();
|
|
48636
|
+
} catch {
|
|
48637
|
+
return;
|
|
48638
|
+
}
|
|
48639
|
+
}
|
|
48519
48640
|
async function checkCompatibility(ctx, domainPath, canonicalVerb, args) {
|
|
48520
48641
|
if (!shouldGuardDomain(domainPath, canonicalVerb, args))
|
|
48521
48642
|
return;
|
|
48643
|
+
const clientFlags = ctx.clientFlags ?? [];
|
|
48644
|
+
if (clientFlags.includes(CLIENT_FLAG_COMPATIBILITY_OVERRIDE)) {
|
|
48645
|
+
ctx.err(`compatibility checks overridden by client flag ${CLIENT_FLAG_COMPATIBILITY_OVERRIDE}`);
|
|
48646
|
+
}
|
|
48647
|
+
let capabilities;
|
|
48522
48648
|
try {
|
|
48523
48649
|
const diagnostics = ctx.client.diagnostics;
|
|
48524
48650
|
if (typeof diagnostics.assertCompatible === "function") {
|
|
48525
48651
|
await diagnostics.assertCompatible();
|
|
48652
|
+
if (clientFlags.length > 0)
|
|
48653
|
+
capabilities = await probeCapabilities(ctx);
|
|
48526
48654
|
} else {
|
|
48527
|
-
await diagnostics.capabilities();
|
|
48655
|
+
capabilities = await diagnostics.capabilities();
|
|
48528
48656
|
}
|
|
48529
48657
|
} catch (err) {
|
|
48530
48658
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -48533,6 +48661,17 @@ async function checkCompatibility(ctx, domainPath, canonicalVerb, args) {
|
|
|
48533
48661
|
} else {
|
|
48534
48662
|
ctx.err(`Could not verify compatibility: ${message}`);
|
|
48535
48663
|
}
|
|
48664
|
+
if (clientFlags.length > 0)
|
|
48665
|
+
capabilities = await probeCapabilities(ctx);
|
|
48666
|
+
}
|
|
48667
|
+
if (clientFlags.length === 0 || !capabilities)
|
|
48668
|
+
return;
|
|
48669
|
+
const echoed = capabilities.honoredClientFlags;
|
|
48670
|
+
const honored = new Set(Array.isArray(echoed) ? echoed : []);
|
|
48671
|
+
for (const flagName of clientFlags) {
|
|
48672
|
+
if (honored.has(flagName))
|
|
48673
|
+
continue;
|
|
48674
|
+
ctx.err(`client flag "${flagName}" is not honored by this backend`);
|
|
48536
48675
|
}
|
|
48537
48676
|
}
|
|
48538
48677
|
|
|
@@ -48603,15 +48742,9 @@ function getRepoRef(ctx) {
|
|
|
48603
48742
|
return r[r.length - 1];
|
|
48604
48743
|
return;
|
|
48605
48744
|
}
|
|
48606
|
-
function splitRepoSlug(ref) {
|
|
48607
|
-
const parts = ref.split("/");
|
|
48608
|
-
if (parts.length !== 2 || !parts[0] || !parts[1])
|
|
48609
|
-
return null;
|
|
48610
|
-
return { org: parts[0], repo: parts[1] };
|
|
48611
|
-
}
|
|
48612
48745
|
function parseOrgRepo(ref, config2) {
|
|
48613
48746
|
if (ref?.includes("/")) {
|
|
48614
|
-
const parsed =
|
|
48747
|
+
const parsed = parseRepoSlug(ref);
|
|
48615
48748
|
if (!parsed) {
|
|
48616
48749
|
throw new CliError(3 /* Config */, "CONFIG", `Invalid repo format "${ref}". Expected "org/repo".`);
|
|
48617
48750
|
}
|
|
@@ -48621,7 +48754,7 @@ function parseOrgRepo(ref, config2) {
|
|
|
48621
48754
|
return { org: config2.defaultOrg, repo: ref };
|
|
48622
48755
|
}
|
|
48623
48756
|
if (config2.defaultRepo) {
|
|
48624
|
-
const parsed =
|
|
48757
|
+
const parsed = parseRepoSlug(config2.defaultRepo);
|
|
48625
48758
|
if (!parsed) {
|
|
48626
48759
|
throw new CliError(3 /* Config */, "CONFIG", `Invalid repo format "${config2.defaultRepo}". Expected "org/repo".`);
|
|
48627
48760
|
}
|
|
@@ -49188,20 +49321,20 @@ function getCacheBaseDir() {
|
|
|
49188
49321
|
return override;
|
|
49189
49322
|
return join7(homedir3(), ".warmhub", "cache", "install-snapshots");
|
|
49190
49323
|
}
|
|
49191
|
-
function
|
|
49192
|
-
return segment
|
|
49324
|
+
function isPathSafeSegment(segment) {
|
|
49325
|
+
return segment !== "." && segment !== ".." && /^[a-zA-Z0-9._-]+$/.test(segment);
|
|
49193
49326
|
}
|
|
49194
|
-
function
|
|
49195
|
-
const
|
|
49196
|
-
if (
|
|
49327
|
+
function parseSnapshotCacheSlug(repoSlug) {
|
|
49328
|
+
const parsed = parseRepoSlug(repoSlug);
|
|
49329
|
+
if (!parsed)
|
|
49197
49330
|
return null;
|
|
49198
|
-
const
|
|
49199
|
-
if (!
|
|
49331
|
+
const { org, repo } = parsed;
|
|
49332
|
+
if (!isPathSafeSegment(org) || !isPathSafeSegment(repo))
|
|
49200
49333
|
return null;
|
|
49201
49334
|
return { org, repo, fileName: `${org}--${repo}.json` };
|
|
49202
49335
|
}
|
|
49203
49336
|
function getInstallSnapshotCachePath(repoSlug) {
|
|
49204
|
-
const parsed =
|
|
49337
|
+
const parsed = parseSnapshotCacheSlug(repoSlug);
|
|
49205
49338
|
if (!parsed)
|
|
49206
49339
|
return null;
|
|
49207
49340
|
return join7(getCacheBaseDir(), parsed.fileName);
|
|
@@ -49328,7 +49461,7 @@ async function loadOrPopulateInstallSnapshotCacheForComponent(repoSlug, client,
|
|
|
49328
49461
|
if (cached2 && isCacheFresh(cached2, opts))
|
|
49329
49462
|
return cached2;
|
|
49330
49463
|
try {
|
|
49331
|
-
const parsed =
|
|
49464
|
+
const parsed = parseSnapshotCacheSlug(repoSlug);
|
|
49332
49465
|
if (!parsed)
|
|
49333
49466
|
return null;
|
|
49334
49467
|
const activeItems = filterActiveItems(await fetchAllSummaries(client, parsed.org, parsed.repo));
|
|
@@ -49358,7 +49491,7 @@ async function ensureFreshInstallSnapshotCache(repoSlug, client, opts) {
|
|
|
49358
49491
|
}
|
|
49359
49492
|
}
|
|
49360
49493
|
async function refreshInstallSnapshotCache(repoSlug, client, opts) {
|
|
49361
|
-
const parsed =
|
|
49494
|
+
const parsed = parseSnapshotCacheSlug(repoSlug);
|
|
49362
49495
|
if (!parsed) {
|
|
49363
49496
|
throw new Error(`Invalid repo slug for install snapshot cache: '${repoSlug}'`);
|
|
49364
49497
|
}
|
|
@@ -49446,15 +49579,15 @@ function filterActiveItems(items) {
|
|
|
49446
49579
|
return items.filter((i) => i.active && i.state !== "uninstalled" && i.state !== "paused" && i.state !== "error");
|
|
49447
49580
|
}
|
|
49448
49581
|
function extractRegisteredRef(ref) {
|
|
49449
|
-
if (typeof ref !== "string"
|
|
49450
|
-
return null;
|
|
49451
|
-
const segments = ref.split("/");
|
|
49452
|
-
if (segments.length !== 2)
|
|
49582
|
+
if (typeof ref !== "string")
|
|
49453
49583
|
return null;
|
|
49454
|
-
const
|
|
49455
|
-
if (!
|
|
49584
|
+
const parsed = parseComponentRef(ref);
|
|
49585
|
+
if (!parsed)
|
|
49456
49586
|
return null;
|
|
49457
|
-
return {
|
|
49587
|
+
return {
|
|
49588
|
+
ownerOrgName: parsed.org,
|
|
49589
|
+
registeredComponentName: parsed.name
|
|
49590
|
+
};
|
|
49458
49591
|
}
|
|
49459
49592
|
|
|
49460
49593
|
// ../../packages/warmhub-cli/src/domain-help.ts
|
|
@@ -50047,7 +50180,7 @@ function parseAbout(raw) {
|
|
|
50047
50180
|
return raw;
|
|
50048
50181
|
}
|
|
50049
50182
|
const tag = raw.slice(0, colonIdx).toLowerCase();
|
|
50050
|
-
if (!COLLECTION_TAGS.
|
|
50183
|
+
if (!COLLECTION_TAGS.some((candidate) => candidate === tag)) {
|
|
50051
50184
|
return raw;
|
|
50052
50185
|
}
|
|
50053
50186
|
throw new CliError(2 /* UserInput */, "USER_INPUT", COLLECTION_ABOUT_REMOVED_MESSAGE, undefined, "Use wh commit submit --file with a named collection add followed by an assertion add.");
|
|
@@ -50192,10 +50325,7 @@ var handleRevise = async (ctx, { flags, args }) => {
|
|
|
50192
50325
|
data
|
|
50193
50326
|
}
|
|
50194
50327
|
], { committer: flags.committer });
|
|
50195
|
-
const result = commitResult
|
|
50196
|
-
if (!result)
|
|
50197
|
-
throw new Error("Commit returned no operation result");
|
|
50198
|
-
assertSingleOpSuccess(commitResult);
|
|
50328
|
+
const result = requireSingleOpSuccess(commitResult);
|
|
50199
50329
|
writeOutput(ctx, commitResult, () => renderSingleOpSuccess(ctx.out, c, ctx.chars, result, {
|
|
50200
50330
|
marker: "~",
|
|
50201
50331
|
color: c.yellow,
|
|
@@ -50220,14 +50350,10 @@ var handleRetract = async (ctx, { flags, args }) => {
|
|
|
50220
50350
|
], {
|
|
50221
50351
|
committer: flags.committer
|
|
50222
50352
|
});
|
|
50223
|
-
const result = commitResult
|
|
50224
|
-
if (!result)
|
|
50225
|
-
throw new Error("Commit returned no operation result");
|
|
50226
|
-
assertSingleOpSuccess(commitResult);
|
|
50353
|
+
const result = requireSingleOpSuccess(commitResult);
|
|
50227
50354
|
writeOutput(ctx, commitResult, () => {
|
|
50228
|
-
const op = result;
|
|
50229
50355
|
renderCommitterEcho(ctx.out, ctx.colors, flags.committer);
|
|
50230
|
-
ctx.out(`${ctx.colors.red}-${ctx.colors.reset} ${displayName(ctx.colors,
|
|
50356
|
+
ctx.out(`${ctx.colors.red}-${ctx.colors.reset} ${displayName(ctx.colors, result.name)}`);
|
|
50231
50357
|
});
|
|
50232
50358
|
};
|
|
50233
50359
|
var handleCreate = async (ctx, { flags, args }) => {
|
|
@@ -50254,10 +50380,7 @@ var handleCreate = async (ctx, { flags, args }) => {
|
|
|
50254
50380
|
}
|
|
50255
50381
|
];
|
|
50256
50382
|
const commitResult = await ctx.client.commit.apply(org, repo, message ?? `assert ${shape}`, operations, { committer });
|
|
50257
|
-
const result = commitResult
|
|
50258
|
-
if (!result)
|
|
50259
|
-
throw new Error("Commit returned no operation result");
|
|
50260
|
-
assertSingleOpSuccess(commitResult);
|
|
50383
|
+
const result = requireSingleOpSuccess(commitResult);
|
|
50261
50384
|
writeOutput(ctx, commitResult, () => renderSingleOpSuccess(ctx.out, c, ctx.chars, result, {
|
|
50262
50385
|
marker: "+",
|
|
50263
50386
|
color: c.green,
|
|
@@ -50420,6 +50543,7 @@ var handleAbout = async (ctx, { flags, args }) => {
|
|
|
50420
50543
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
50421
50544
|
functionLogs: ctx.functionLogMode,
|
|
50422
50545
|
profile: ctx.profile,
|
|
50546
|
+
clientFlags: ctx.clientFlags,
|
|
50423
50547
|
signal: ctx.signal
|
|
50424
50548
|
});
|
|
50425
50549
|
return;
|
|
@@ -50566,10 +50690,7 @@ var handleCreate2 = async (ctx, { flags, args }) => {
|
|
|
50566
50690
|
data
|
|
50567
50691
|
}
|
|
50568
50692
|
], { committer });
|
|
50569
|
-
const result = commitResult
|
|
50570
|
-
if (!result)
|
|
50571
|
-
throw new Error("Commit returned no operation result");
|
|
50572
|
-
assertSingleOpSuccess(commitResult);
|
|
50693
|
+
const result = requireSingleOpSuccess(commitResult);
|
|
50573
50694
|
writeOutput(ctx, commitResult, () => renderSingleOpSuccess(ctx.out, c, ctx.chars, result, {
|
|
50574
50695
|
marker: "+",
|
|
50575
50696
|
color: c.green,
|
|
@@ -51090,6 +51211,7 @@ var handleHistory = async (ctx, { flags, args }) => {
|
|
|
51090
51211
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
51091
51212
|
functionLogs: ctx.functionLogMode,
|
|
51092
51213
|
profile: ctx.profile,
|
|
51214
|
+
clientFlags: ctx.clientFlags,
|
|
51093
51215
|
signal: ctx.signal
|
|
51094
51216
|
});
|
|
51095
51217
|
return;
|
|
@@ -51192,8 +51314,9 @@ var VALID_KINDS = [
|
|
|
51192
51314
|
function validateKind(value, flagName = "--kind") {
|
|
51193
51315
|
if (value === undefined)
|
|
51194
51316
|
return;
|
|
51195
|
-
|
|
51196
|
-
|
|
51317
|
+
const parsed = VALID_KINDS.find((candidate) => candidate === value);
|
|
51318
|
+
if (parsed)
|
|
51319
|
+
return parsed;
|
|
51197
51320
|
const message = `Invalid ${flagName} "${value}". Supported kinds: ${VALID_KINDS.join(", ")}.`;
|
|
51198
51321
|
const hint = /^[A-Z]/.test(value) ? `Did you mean --shape ${value} --kind assertion?` : `Example: ${flagName} assertion`;
|
|
51199
51322
|
throw new CliError(2 /* UserInput */, "USER_INPUT", message, undefined, hint);
|
|
@@ -51396,6 +51519,7 @@ var handleHead = async (ctx, { flags, args }) => {
|
|
|
51396
51519
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
51397
51520
|
functionLogs: ctx.functionLogMode,
|
|
51398
51521
|
profile: ctx.profile,
|
|
51522
|
+
clientFlags: ctx.clientFlags,
|
|
51399
51523
|
signal: ctx.signal
|
|
51400
51524
|
});
|
|
51401
51525
|
return;
|
|
@@ -51585,6 +51709,7 @@ var handleQuery = async (ctx, { flags }) => {
|
|
|
51585
51709
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
51586
51710
|
functionLogs: ctx.functionLogMode,
|
|
51587
51711
|
profile: ctx.profile,
|
|
51712
|
+
clientFlags: ctx.clientFlags,
|
|
51588
51713
|
signal: ctx.signal
|
|
51589
51714
|
});
|
|
51590
51715
|
return;
|
|
@@ -51868,14 +51993,10 @@ var handleThingRetract = async (ctx, { flags, args }) => {
|
|
|
51868
51993
|
...leaseId ? { leaseId } : {}
|
|
51869
51994
|
}
|
|
51870
51995
|
], { committer });
|
|
51871
|
-
const result = commitResult
|
|
51872
|
-
if (!result)
|
|
51873
|
-
throw new Error("Commit returned no operation result");
|
|
51874
|
-
assertSingleOpSuccess(commitResult);
|
|
51996
|
+
const result = requireSingleOpSuccess(commitResult);
|
|
51875
51997
|
writeOutput(ctx, commitResult, () => {
|
|
51876
|
-
const op = result;
|
|
51877
51998
|
renderCommitterEcho(ctx.out, c, committer);
|
|
51878
|
-
ctx.out(`${c.red}-${c.reset} ${displayName(c,
|
|
51999
|
+
ctx.out(`${c.red}-${c.reset} ${displayName(c, result.name)}`);
|
|
51879
52000
|
});
|
|
51880
52001
|
};
|
|
51881
52002
|
|
|
@@ -51918,10 +52039,7 @@ var handleRevise2 = async (ctx, { flags, args }) => {
|
|
|
51918
52039
|
...leaseId ? { leaseId } : {}
|
|
51919
52040
|
}
|
|
51920
52041
|
], { committer });
|
|
51921
|
-
const result = commitResult
|
|
51922
|
-
if (!result)
|
|
51923
|
-
throw new Error("Commit returned no operation result");
|
|
51924
|
-
assertSingleOpSuccess(commitResult);
|
|
52042
|
+
const result = requireSingleOpSuccess(commitResult);
|
|
51925
52043
|
writeOutput(ctx, commitResult, () => renderSingleOpSuccess(ctx.out, c, ctx.chars, result, {
|
|
51926
52044
|
marker: "~",
|
|
51927
52045
|
color: c.yellow,
|
|
@@ -52292,6 +52410,7 @@ async function runSingleView(ctx, wref, flags) {
|
|
|
52292
52410
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
52293
52411
|
functionLogs: ctx.functionLogMode,
|
|
52294
52412
|
profile: ctx.profile,
|
|
52413
|
+
clientFlags: ctx.clientFlags,
|
|
52295
52414
|
signal: ctx.signal
|
|
52296
52415
|
});
|
|
52297
52416
|
return;
|
|
@@ -52362,7 +52481,7 @@ var handleView = async (ctx, { flags, args, terminator }) => {
|
|
|
52362
52481
|
}
|
|
52363
52482
|
if (isBatch)
|
|
52364
52483
|
return runBatchView(ctx, wrefs, flags);
|
|
52365
|
-
const singleWref = wrefs
|
|
52484
|
+
const [singleWref] = wrefs;
|
|
52366
52485
|
return runSingleView(ctx, singleWref, flags);
|
|
52367
52486
|
};
|
|
52368
52487
|
|
|
@@ -52576,6 +52695,7 @@ var handleView2 = async (ctx, { flags, args }) => {
|
|
|
52576
52695
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
52577
52696
|
functionLogs: ctx.functionLogMode,
|
|
52578
52697
|
profile: ctx.profile,
|
|
52698
|
+
clientFlags: ctx.clientFlags,
|
|
52579
52699
|
signal: ctx.signal
|
|
52580
52700
|
});
|
|
52581
52701
|
return;
|
|
@@ -52632,6 +52752,7 @@ var handleHistory2 = async (ctx, { flags, args }) => {
|
|
|
52632
52752
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
52633
52753
|
functionLogs: ctx.functionLogMode,
|
|
52634
52754
|
profile: ctx.profile,
|
|
52755
|
+
clientFlags: ctx.clientFlags,
|
|
52635
52756
|
signal: ctx.signal
|
|
52636
52757
|
});
|
|
52637
52758
|
return;
|
|
@@ -52756,6 +52877,7 @@ var handleList = async (ctx, { flags, args }) => {
|
|
|
52756
52877
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
52757
52878
|
functionLogs: ctx.functionLogMode,
|
|
52758
52879
|
profile: ctx.profile,
|
|
52880
|
+
clientFlags: ctx.clientFlags,
|
|
52759
52881
|
signal: ctx.signal
|
|
52760
52882
|
});
|
|
52761
52883
|
return;
|
|
@@ -52799,6 +52921,7 @@ var handleList = async (ctx, { flags, args }) => {
|
|
|
52799
52921
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
52800
52922
|
functionLogs: ctx.functionLogMode,
|
|
52801
52923
|
profile: ctx.profile,
|
|
52924
|
+
clientFlags: ctx.clientFlags,
|
|
52802
52925
|
signal: ctx.signal
|
|
52803
52926
|
});
|
|
52804
52927
|
return;
|
|
@@ -52903,8 +53026,99 @@ var ASSERTION_DOMAIN = defineDomain({
|
|
|
52903
53026
|
}
|
|
52904
53027
|
});
|
|
52905
53028
|
|
|
53029
|
+
// ../../packages/warmhub-cli/src/cli-context.ts
|
|
53030
|
+
function resolveClientFlags(profileFlags, env = process.env) {
|
|
53031
|
+
const candidates = [
|
|
53032
|
+
...Array.isArray(profileFlags) ? profileFlags : [],
|
|
53033
|
+
...(env.WH_CLIENT_FLAGS ?? "").split(",")
|
|
53034
|
+
];
|
|
53035
|
+
const flags = new Set;
|
|
53036
|
+
const dropped = [];
|
|
53037
|
+
for (const raw of candidates) {
|
|
53038
|
+
const token = typeof raw === "string" ? raw.trim() : "";
|
|
53039
|
+
if (!token)
|
|
53040
|
+
continue;
|
|
53041
|
+
if (isValidClientFlagToken(token))
|
|
53042
|
+
flags.add(token);
|
|
53043
|
+
else
|
|
53044
|
+
dropped.push(token);
|
|
53045
|
+
}
|
|
53046
|
+
return { flags: [...flags].sort(), dropped };
|
|
53047
|
+
}
|
|
53048
|
+
function resolveCliContext(args) {
|
|
53049
|
+
const { invocation, format } = args;
|
|
53050
|
+
const config2 = args.config ?? loadConfig();
|
|
53051
|
+
const apiUrlFlag = invocation.flags["api-url"];
|
|
53052
|
+
const explicitApiUrl = typeof apiUrlFlag === "string" ? apiUrlFlag : undefined;
|
|
53053
|
+
const profileFlag = invocation.flags.profile;
|
|
53054
|
+
const apiUrl = explicitApiUrl ?? process.env.WARMHUB_API_URL ?? config2.apiUrl;
|
|
53055
|
+
config2.apiUrl = apiUrl;
|
|
53056
|
+
const explicitProfile = (typeof profileFlag === "string" ? profileFlag : undefined) ?? config2.profile;
|
|
53057
|
+
const effectiveProfile = explicitProfile ?? "default";
|
|
53058
|
+
const overridesBypassProfile = !explicitProfile && !!process.env.WH_TOKEN && (!!process.env.WARMHUB_API_URL || !!explicitApiUrl);
|
|
53059
|
+
let profileData = null;
|
|
53060
|
+
if (!overridesBypassProfile) {
|
|
53061
|
+
try {
|
|
53062
|
+
profileData = getProfile(effectiveProfile);
|
|
53063
|
+
} catch (err) {
|
|
53064
|
+
if (explicitProfile)
|
|
53065
|
+
throw err;
|
|
53066
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
53067
|
+
if (format === "json" || format === "jsonl") {
|
|
53068
|
+
process.stderr.write(`${JSON.stringify({
|
|
53069
|
+
level: "warning",
|
|
53070
|
+
kind: "auth-file-unreadable",
|
|
53071
|
+
message: `could not read auth.json: ${reason}`
|
|
53072
|
+
})}
|
|
53073
|
+
`);
|
|
53074
|
+
} else {
|
|
53075
|
+
process.stderr.write(`warning: could not read auth.json (${reason})
|
|
53076
|
+
`);
|
|
53077
|
+
}
|
|
53078
|
+
}
|
|
53079
|
+
}
|
|
53080
|
+
if (profileData) {
|
|
53081
|
+
if (profileData.apiUrl && !explicitApiUrl) {
|
|
53082
|
+
config2.apiUrl = profileData.apiUrl;
|
|
53083
|
+
}
|
|
53084
|
+
} else if (explicitProfile) {
|
|
53085
|
+
const isAuthLogin = invocation.kind === "static" && invocation.commandPath[0] === "auth" && invocation.commandPath[1] === "login";
|
|
53086
|
+
if (!isAuthLogin) {
|
|
53087
|
+
const available = listProfiles();
|
|
53088
|
+
const availableHint = available.length > 0 ? `Available profiles: ${available.join(", ")}.` : "No profiles found.";
|
|
53089
|
+
throw new CliError(5 /* Auth */, "AUTH", `Auth profile "${explicitProfile}" does not exist.`, undefined, `${availableHint}
|
|
53090
|
+
Run \`wh auth login --profile ${explicitProfile}\` to create it.`);
|
|
53091
|
+
}
|
|
53092
|
+
}
|
|
53093
|
+
const { flags: clientFlags, dropped: droppedFlags } = resolveClientFlags(profileData?.flags);
|
|
53094
|
+
for (const token of droppedFlags) {
|
|
53095
|
+
process.stderr.write(`warning: ignoring malformed client flag "${token}"
|
|
53096
|
+
`);
|
|
53097
|
+
}
|
|
53098
|
+
const client = args.client ?? createClient(config2, {
|
|
53099
|
+
functionLogs: args.functionLogs,
|
|
53100
|
+
profile: effectiveProfile,
|
|
53101
|
+
signal: args.signal,
|
|
53102
|
+
clientFlags
|
|
53103
|
+
});
|
|
53104
|
+
return { config: config2, profile: effectiveProfile, client, clientFlags };
|
|
53105
|
+
}
|
|
53106
|
+
|
|
52906
53107
|
// ../../packages/warmhub-cli/src/domains/auth-shared.ts
|
|
52907
|
-
|
|
53108
|
+
function clientForStoredFlags(ctx, profile) {
|
|
53109
|
+
const { flags } = resolveClientFlags(getProfile(profile)?.flags);
|
|
53110
|
+
const active = ctx.clientFlags ?? [];
|
|
53111
|
+
if (flags.length === active.length && flags.every((token, i) => token === active[i])) {
|
|
53112
|
+
return ctx.client;
|
|
53113
|
+
}
|
|
53114
|
+
return createClient(ctx.config, {
|
|
53115
|
+
functionLogs: ctx.functionLogMode,
|
|
53116
|
+
profile,
|
|
53117
|
+
signal: ctx.signal,
|
|
53118
|
+
clientFlags: flags
|
|
53119
|
+
});
|
|
53120
|
+
}
|
|
53121
|
+
async function loginWithToken(ctx, profile, explicitFlags) {
|
|
52908
53122
|
const c = ctx.colors;
|
|
52909
53123
|
if (process.stdin.isTTY) {
|
|
52910
53124
|
throw new CliError(2 /* UserInput */, "USER_INPUT", "No token provided on stdin.", undefined, 'Pipe a JWT token via stdin: echo "$TOKEN" | wh auth login --with-token');
|
|
@@ -52932,7 +53146,7 @@ async function loginWithToken(ctx, profile) {
|
|
|
52932
53146
|
if (Date.now() >= new Date(expiresAt).getTime() - EXPIRY_BUFFER_MS) {
|
|
52933
53147
|
throw new CliError(5 /* Auth */, "AUTH", `Token is already expired (at ${new Date(expiresAt).toLocaleString()}).`, undefined, "Provide a valid, non-expired JWT.");
|
|
52934
53148
|
}
|
|
52935
|
-
await
|
|
53149
|
+
await saveProfileWithFlagsLocked(profile, {
|
|
52936
53150
|
tokens: {
|
|
52937
53151
|
accessToken: jwt2,
|
|
52938
53152
|
refreshToken: "",
|
|
@@ -52941,9 +53155,9 @@ async function loginWithToken(ctx, profile) {
|
|
|
52941
53155
|
source: "token"
|
|
52942
53156
|
},
|
|
52943
53157
|
apiUrl: ctx.config.apiUrl
|
|
52944
|
-
});
|
|
53158
|
+
}, explicitFlags);
|
|
52945
53159
|
try {
|
|
52946
|
-
await ctx.
|
|
53160
|
+
await clientForStoredFlags(ctx, profile).auth.sync();
|
|
52947
53161
|
} catch (err) {
|
|
52948
53162
|
ctx.err(`${c.yellow}Warning: could not sync user record: ${err instanceof Error ? err.message : String(err)}${c.reset}`);
|
|
52949
53163
|
}
|
|
@@ -53030,7 +53244,7 @@ async function pollForDeviceToken(params) {
|
|
|
53030
53244
|
poll().catch(reject);
|
|
53031
53245
|
});
|
|
53032
53246
|
}
|
|
53033
|
-
function renderTokenInfo(ctx, info, profileName, apiUrl, identityWref) {
|
|
53247
|
+
function renderTokenInfo(ctx, info, profileName, apiUrl, identityWref, flags) {
|
|
53034
53248
|
const c = ctx.colors;
|
|
53035
53249
|
const prefix = profileName ? `${c.bold}${profileName}${c.reset}: ` : "";
|
|
53036
53250
|
const sourceLabel = {
|
|
@@ -53065,6 +53279,9 @@ function renderTokenInfo(ctx, info, profileName, apiUrl, identityWref) {
|
|
|
53065
53279
|
ctx.status(` ${c.dim}Identity:${c.reset} ${identityWref}`);
|
|
53066
53280
|
}
|
|
53067
53281
|
}
|
|
53282
|
+
if (flags?.length) {
|
|
53283
|
+
ctx.status(` ${c.dim}Client flags:${c.reset} ${flags.join(", ")}`);
|
|
53284
|
+
}
|
|
53068
53285
|
}
|
|
53069
53286
|
async function fetchIdentityWref(ctx) {
|
|
53070
53287
|
if (process.env.WH_TOKEN)
|
|
@@ -53088,6 +53305,10 @@ function openBrowser(url2) {
|
|
|
53088
53305
|
var loginFlags = {
|
|
53089
53306
|
"with-token": flag.boolean({
|
|
53090
53307
|
description: "Read a JWT token from stdin instead of using the browser flow"
|
|
53308
|
+
}),
|
|
53309
|
+
flag: flag.string({
|
|
53310
|
+
multiple: true,
|
|
53311
|
+
description: "Client flag to store on this profile. Repeatable. Validated " + "server-side; the backend honors only configured flags."
|
|
53091
53312
|
})
|
|
53092
53313
|
};
|
|
53093
53314
|
function authStatusEntry(info, options) {
|
|
@@ -53098,6 +53319,7 @@ function authStatusEntry(info, options) {
|
|
|
53098
53319
|
canRefresh: info.canRefresh,
|
|
53099
53320
|
email: info.email ?? null,
|
|
53100
53321
|
expiresAt: info.expiresAt ?? null,
|
|
53322
|
+
flags: options.flags ?? [],
|
|
53101
53323
|
identityWref: options.identityWref ?? null,
|
|
53102
53324
|
profile: options.profile ?? null,
|
|
53103
53325
|
source: info.source
|
|
@@ -53110,10 +53332,23 @@ function authStatusOutput(activeProfile, entries) {
|
|
|
53110
53332
|
entries
|
|
53111
53333
|
};
|
|
53112
53334
|
}
|
|
53335
|
+
var GENERIC_CLIENT_FLAG_HINT = "Use lowercase tokens matching [a-z0-9-]+, e.g. `wh auth login --flag <name>`.";
|
|
53336
|
+
function invalidClientFlagMessage(token) {
|
|
53337
|
+
const base = `Invalid client flag "${token}": expected lowercase tokens matching [a-z0-9-]+`;
|
|
53338
|
+
const normalized = token.trim().toLowerCase();
|
|
53339
|
+
return isValidClientFlagToken(normalized) ? `${base} (did you mean "${normalized}"?)` : `${base}.`;
|
|
53340
|
+
}
|
|
53113
53341
|
var handleLogin = async (ctx, { flags }) => {
|
|
53114
53342
|
const profile = flags.profile ?? ctx.config.profile ?? "default";
|
|
53343
|
+
const requestedFlags = (flags.flag ?? []).map((t) => t.trim());
|
|
53344
|
+
for (const token of requestedFlags) {
|
|
53345
|
+
if (!isValidClientFlagToken(token)) {
|
|
53346
|
+
throw new CliError(2 /* UserInput */, "USER_INPUT", invalidClientFlagMessage(token), undefined, GENERIC_CLIENT_FLAG_HINT);
|
|
53347
|
+
}
|
|
53348
|
+
}
|
|
53349
|
+
const explicitFlags = requestedFlags.length > 0 ? [...new Set(requestedFlags)].sort() : undefined;
|
|
53115
53350
|
if (flags["with-token"]) {
|
|
53116
|
-
return loginWithToken(ctx, profile);
|
|
53351
|
+
return loginWithToken(ctx, profile, explicitFlags);
|
|
53117
53352
|
}
|
|
53118
53353
|
const c = ctx.colors;
|
|
53119
53354
|
let clientId;
|
|
@@ -53121,7 +53356,8 @@ var handleLogin = async (ctx, { flags }) => {
|
|
|
53121
53356
|
clientId = await ctx.client.auth.getClientId();
|
|
53122
53357
|
} catch {
|
|
53123
53358
|
clientId = await createUnauthenticatedClient(ctx.config, {
|
|
53124
|
-
functionLogs: ctx.functionLogMode
|
|
53359
|
+
functionLogs: ctx.functionLogMode,
|
|
53360
|
+
clientFlags: ctx.clientFlags
|
|
53125
53361
|
}).auth.getClientId();
|
|
53126
53362
|
}
|
|
53127
53363
|
if (!clientId) {
|
|
@@ -53185,7 +53421,7 @@ var handleLogin = async (ctx, { flags }) => {
|
|
|
53185
53421
|
} catch {
|
|
53186
53422
|
expiresAt = new Date(Date.now() + 5 * 60 * 1000).toISOString();
|
|
53187
53423
|
}
|
|
53188
|
-
await
|
|
53424
|
+
await saveProfileWithFlagsLocked(profile, {
|
|
53189
53425
|
tokens: {
|
|
53190
53426
|
accessToken: tokenResponse.access_token,
|
|
53191
53427
|
refreshToken: tokenResponse.refresh_token,
|
|
@@ -53196,9 +53432,9 @@ var handleLogin = async (ctx, { flags }) => {
|
|
|
53196
53432
|
source: "device"
|
|
53197
53433
|
},
|
|
53198
53434
|
apiUrl: ctx.config.apiUrl
|
|
53199
|
-
});
|
|
53435
|
+
}, explicitFlags);
|
|
53200
53436
|
try {
|
|
53201
|
-
await ctx.
|
|
53437
|
+
await clientForStoredFlags(ctx, profile).auth.sync();
|
|
53202
53438
|
} catch (err) {
|
|
53203
53439
|
ctx.err(`${c.yellow}Warning: could not sync user record: ${err instanceof Error ? err.message : String(err)}${c.reset}`);
|
|
53204
53440
|
}
|
|
@@ -53238,10 +53474,11 @@ var handleStatus = async (ctx, { flags }) => {
|
|
|
53238
53474
|
const entry = authStatusEntry(info, {
|
|
53239
53475
|
active: true,
|
|
53240
53476
|
apiUrl: prof.apiUrl,
|
|
53477
|
+
flags: Array.isArray(prof.flags) ? prof.flags : [],
|
|
53241
53478
|
identityWref,
|
|
53242
53479
|
profile: selectedProfile
|
|
53243
53480
|
});
|
|
53244
|
-
writeOutput(ctx, authStatusOutput(selectedProfile, [entry]), () => renderTokenInfo(ctx, info, selectedProfile, prof.apiUrl, identityWref));
|
|
53481
|
+
writeOutput(ctx, authStatusOutput(selectedProfile, [entry]), () => renderTokenInfo(ctx, info, selectedProfile, prof.apiUrl, identityWref, entry.flags));
|
|
53245
53482
|
return;
|
|
53246
53483
|
}
|
|
53247
53484
|
const envToken = process.env.WH_TOKEN;
|
|
@@ -53270,13 +53507,15 @@ var handleStatus = async (ctx, { flags }) => {
|
|
|
53270
53507
|
canRefresh: source === "device" && !!tokens.refreshToken
|
|
53271
53508
|
};
|
|
53272
53509
|
const identityWref = !info.expired && name === activeProfile ? await fetchIdentityWref(ctx) : null;
|
|
53510
|
+
const profileFlags = Array.isArray(prof.flags) ? prof.flags : [];
|
|
53273
53511
|
entries.push(authStatusEntry(info, {
|
|
53274
53512
|
active: !envToken && name === activeProfile,
|
|
53275
53513
|
apiUrl: prof.apiUrl,
|
|
53514
|
+
flags: profileFlags,
|
|
53276
53515
|
identityWref,
|
|
53277
53516
|
profile: name
|
|
53278
53517
|
}));
|
|
53279
|
-
prettyEntries.push(() => renderTokenInfo(ctx, info, name, prof.apiUrl, identityWref));
|
|
53518
|
+
prettyEntries.push(() => renderTokenInfo(ctx, info, name, prof.apiUrl, identityWref, profileFlags));
|
|
53280
53519
|
}
|
|
53281
53520
|
}
|
|
53282
53521
|
writeOutput(ctx, authStatusOutput(envToken ? null : activeProfile, entries), () => {
|
|
@@ -53781,9 +54020,8 @@ function requireMembers(members, example) {
|
|
|
53781
54020
|
}
|
|
53782
54021
|
}
|
|
53783
54022
|
function renderMutation(ctx, result) {
|
|
53784
|
-
|
|
53785
|
-
|
|
53786
|
-
if (!operation || !("version" in operation) || typeof operation.version !== "number") {
|
|
54023
|
+
const operation = requireSingleOpSuccess(result);
|
|
54024
|
+
if (!("version" in operation) || typeof operation.version !== "number") {
|
|
53787
54025
|
throw new Error("Collection mutation returned no version-bearing operation");
|
|
53788
54026
|
}
|
|
53789
54027
|
const isNoop = operation.operation === "noop";
|
|
@@ -54023,10 +54261,11 @@ var collectionStatsFlags = {
|
|
|
54023
54261
|
version: flag.number({ description: "Specific collection version number" })
|
|
54024
54262
|
};
|
|
54025
54263
|
function validateCollectionType(value) {
|
|
54026
|
-
|
|
54264
|
+
const parsed = SUPPORTED_COLLECTION_TYPES.find((candidate) => candidate === value);
|
|
54265
|
+
if (!parsed) {
|
|
54027
54266
|
usageError(`Usage: wh collection create --type ${CANONICAL_COLLECTION_TYPE_USAGE} --members <wref...>`, 'wh collection create --type set --name audited --members Location/a,Location/b -m "audit snapshot"');
|
|
54028
54267
|
}
|
|
54029
|
-
return
|
|
54268
|
+
return parsed;
|
|
54030
54269
|
}
|
|
54031
54270
|
function validateDiffMode(value) {
|
|
54032
54271
|
if (value === undefined)
|
|
@@ -54052,7 +54291,7 @@ function collectionQuerySourceFromFlags(flags) {
|
|
|
54052
54291
|
function parseSourceRepoFlag(value) {
|
|
54053
54292
|
if (!value)
|
|
54054
54293
|
return;
|
|
54055
|
-
const parsed =
|
|
54294
|
+
const parsed = parseRepoSlug(value);
|
|
54056
54295
|
if (!parsed) {
|
|
54057
54296
|
usageError("--source-repo must be an org/repo slug", "wh collection create --type set --name wake-voters --source-repo data/nc-voters --shape Voter --where county=Wake");
|
|
54058
54297
|
}
|
|
@@ -54089,7 +54328,7 @@ function isMissingCollectionMemberError(error51, type) {
|
|
|
54089
54328
|
function collectionTypeFromWref2(wref) {
|
|
54090
54329
|
const local = wref.replace(/^wh:[^/]+\/[^/]+\//, "").replace(/@(?:HEAD|ALL|v\d+)$/, "");
|
|
54091
54330
|
const shape = local.split("/")[0]?.toLowerCase();
|
|
54092
|
-
return SUPPORTED_COLLECTION_TYPES.
|
|
54331
|
+
return SUPPORTED_COLLECTION_TYPES.find((candidate) => candidate === shape);
|
|
54093
54332
|
}
|
|
54094
54333
|
function parseCollectionReadRepo(ctx, wrefs) {
|
|
54095
54334
|
const allDurable = wrefs.length > 0 && wrefs.every(looksLikeDurableId);
|
|
@@ -54685,6 +54924,7 @@ function assertNoNulBytes(data, locator) {
|
|
|
54685
54924
|
|
|
54686
54925
|
// ../../packages/warmhub-cli/src/domains/commit-submit-template.ts
|
|
54687
54926
|
import { writeFile } from "node:fs/promises";
|
|
54927
|
+
var WRITE_TEMPLATE_KINDS = ["thing", "assertion"];
|
|
54688
54928
|
function zeroValueForField(fieldSpec) {
|
|
54689
54929
|
if (Array.isArray(fieldSpec))
|
|
54690
54930
|
return [];
|
|
@@ -54773,20 +55013,21 @@ var handleTemplate = async (ctx, { flags, args }) => {
|
|
|
54773
55013
|
if (operationType !== "add" && operationType !== "revise" && operationType !== "retract") {
|
|
54774
55014
|
throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid --operation "${operationType}". Must be "add", "revise", or "retract".`);
|
|
54775
55015
|
}
|
|
54776
|
-
const
|
|
54777
|
-
|
|
55016
|
+
const requestedKind = flags.kind ?? "thing";
|
|
55017
|
+
const validKinds = operationType === "retract" ? COMMIT_OPERATION_KINDS : WRITE_TEMPLATE_KINDS;
|
|
55018
|
+
const templateKind = validKinds.find((candidate) => candidate === requestedKind);
|
|
55019
|
+
if (templateKind === undefined) {
|
|
54778
55020
|
throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid --kind "${flags.kind}". Must be one of: ${validKinds.join(", ")}.`);
|
|
54779
55021
|
}
|
|
54780
55022
|
const count = Math.max(1, flags.count ?? 1);
|
|
54781
55023
|
const operations = [];
|
|
54782
55024
|
for (const shapeName of shapeNames) {
|
|
54783
55025
|
if (operationType === "retract") {
|
|
54784
|
-
const kind2 = flags.kind ?? "thing";
|
|
54785
55026
|
for (let i = 0;i < count; i++) {
|
|
54786
55027
|
operations.push({
|
|
54787
55028
|
operation: "retract",
|
|
54788
|
-
kind:
|
|
54789
|
-
name:
|
|
55029
|
+
kind: templateKind,
|
|
55030
|
+
name: templateKind === "shape" ? shapeName : `${shapeName}/FILL_IN`
|
|
54790
55031
|
});
|
|
54791
55032
|
}
|
|
54792
55033
|
continue;
|
|
@@ -54795,9 +55036,8 @@ var handleTemplate = async (ctx, { flags, args }) => {
|
|
|
54795
55036
|
const shapeVersion = shape.version;
|
|
54796
55037
|
const shapeData = shapeVersion?.data;
|
|
54797
55038
|
const fields = shapeData?.fields ?? {};
|
|
54798
|
-
const kind = flags.kind ?? "thing";
|
|
54799
55039
|
let aboutPlaceholder;
|
|
54800
|
-
if (
|
|
55040
|
+
if (templateKind === "assertion") {
|
|
54801
55041
|
aboutPlaceholder = flags.about ? parseCollectionAboutFlag(flags.about) : "Shape/FILL_IN";
|
|
54802
55042
|
}
|
|
54803
55043
|
const data = buildTemplateData(fields);
|
|
@@ -54805,13 +55045,13 @@ var handleTemplate = async (ctx, { flags, args }) => {
|
|
|
54805
55045
|
for (let i = 0;i < count; i++) {
|
|
54806
55046
|
const op = operationType === "add" ? {
|
|
54807
55047
|
operation: "add",
|
|
54808
|
-
kind,
|
|
55048
|
+
kind: templateKind,
|
|
54809
55049
|
name: `${shapeName}/${nameSuffix(i)}`,
|
|
54810
55050
|
...aboutPlaceholder ? { about: aboutPlaceholder } : {},
|
|
54811
55051
|
data
|
|
54812
55052
|
} : {
|
|
54813
55053
|
operation: "revise",
|
|
54814
|
-
kind,
|
|
55054
|
+
kind: templateKind,
|
|
54815
55055
|
name: `${shapeName}/FILL_IN`,
|
|
54816
55056
|
data
|
|
54817
55057
|
};
|
|
@@ -55481,17 +55721,19 @@ var handleSubmit = async (ctx, { flags, args }) => {
|
|
|
55481
55721
|
"shape",
|
|
55482
55722
|
"collection"
|
|
55483
55723
|
];
|
|
55484
|
-
|
|
55485
|
-
|
|
55724
|
+
const operationKinds = kinds.map((k) => {
|
|
55725
|
+
const parsed = validKinds.find((candidate) => candidate === k);
|
|
55726
|
+
if (!parsed) {
|
|
55486
55727
|
throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid --kind "${k}". Must be one of: ${validKinds.join(", ")}`);
|
|
55487
55728
|
}
|
|
55488
|
-
|
|
55729
|
+
return parsed;
|
|
55730
|
+
});
|
|
55489
55731
|
const validCollectionTypes = ["arc", "bond", "set", "list", "pair"];
|
|
55490
55732
|
const canonicalCollectionTypes2 = ["arc", "bond", "set", "list"];
|
|
55491
|
-
|
|
55733
|
+
const collectionType = validCollectionTypes.find((candidate) => candidate === flags.type);
|
|
55734
|
+
if (flags.type !== undefined && collectionType === undefined) {
|
|
55492
55735
|
throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid --type "${flags.type}". Use one of: ${canonicalCollectionTypes2.join(", ")}`, undefined, "wh commit submit --type arc --name route --members Location/a,Location/b");
|
|
55493
55736
|
}
|
|
55494
|
-
const collectionType = flags.type;
|
|
55495
55737
|
const jsonlFile = opsFile?.endsWith(".jsonl") === true;
|
|
55496
55738
|
const operationSource = resolveCommitOperationSource({
|
|
55497
55739
|
stream: streamInput,
|
|
@@ -55510,7 +55752,7 @@ var handleSubmit = async (ctx, { flags, args }) => {
|
|
|
55510
55752
|
shape: shapes.length > 0,
|
|
55511
55753
|
about: abouts.length > 0,
|
|
55512
55754
|
reason: reasons.length > 0,
|
|
55513
|
-
kind:
|
|
55755
|
+
kind: operationKinds.length > 0,
|
|
55514
55756
|
name: flags.name !== undefined,
|
|
55515
55757
|
members: flags.members !== undefined
|
|
55516
55758
|
});
|
|
@@ -55586,12 +55828,12 @@ var handleSubmit = async (ctx, { flags, args }) => {
|
|
|
55586
55828
|
dataJsons,
|
|
55587
55829
|
shapes,
|
|
55588
55830
|
abouts,
|
|
55589
|
-
kinds
|
|
55831
|
+
kinds: operationKinds
|
|
55590
55832
|
});
|
|
55591
55833
|
} else if (operationSource === "--retract") {
|
|
55592
55834
|
operations = buildRetractOperations({
|
|
55593
55835
|
retractNames,
|
|
55594
|
-
kinds,
|
|
55836
|
+
kinds: operationKinds,
|
|
55595
55837
|
reasons,
|
|
55596
55838
|
expectedVersion,
|
|
55597
55839
|
leaseId: leaseIdFlag
|
|
@@ -55600,12 +55842,12 @@ var handleSubmit = async (ctx, { flags, args }) => {
|
|
|
55600
55842
|
if (dataJsons.length > 1) {
|
|
55601
55843
|
throw new CliError(2 /* UserInput */, "USER_INPUT", `--revise supports a single operation, but --data was repeated ${dataJsons.length} times.`, undefined, "Use --file <path.json> for multi-revision writes.");
|
|
55602
55844
|
}
|
|
55603
|
-
if (
|
|
55604
|
-
throw new CliError(2 /* UserInput */, "USER_INPUT", `--revise supports a single operation, but --kind was repeated ${
|
|
55845
|
+
if (operationKinds.length > 1) {
|
|
55846
|
+
throw new CliError(2 /* UserInput */, "USER_INPUT", `--revise supports a single operation, but --kind was repeated ${operationKinds.length} times.`, undefined, "Use --file <path.json> for multi-revision writes.");
|
|
55605
55847
|
}
|
|
55606
55848
|
const rawData = dataJsons[0];
|
|
55607
55849
|
const data = rawData !== undefined ? parseJsonObject(rawData, "--data") : undefined;
|
|
55608
|
-
const kindFlag =
|
|
55850
|
+
const kindFlag = operationKinds[0];
|
|
55609
55851
|
const kind = kindFlag ?? "thing";
|
|
55610
55852
|
operations = [
|
|
55611
55853
|
{
|
|
@@ -56018,8 +56260,7 @@ function bindComponentMethodArgs(invocation, method) {
|
|
|
56018
56260
|
}
|
|
56019
56261
|
const coerced = coerceArg(arg, raw);
|
|
56020
56262
|
if (!coerced.ok) {
|
|
56021
|
-
|
|
56022
|
-
addError(record2.index, coerced.error);
|
|
56263
|
+
addError(record2.index, coerced.error);
|
|
56023
56264
|
continue;
|
|
56024
56265
|
}
|
|
56025
56266
|
if (!Object.hasOwn(args, arg.name))
|
|
@@ -56037,7 +56278,7 @@ function bindComponentMethodArgs(invocation, method) {
|
|
|
56037
56278
|
const coerced = coerceArg(arg, arg.default);
|
|
56038
56279
|
if (coerced.ok) {
|
|
56039
56280
|
args[arg.name] = coerced.value;
|
|
56040
|
-
} else
|
|
56281
|
+
} else {
|
|
56041
56282
|
addError(Number.POSITIVE_INFINITY, coerced.error);
|
|
56042
56283
|
}
|
|
56043
56284
|
continue;
|
|
@@ -56397,63 +56638,62 @@ function formatReservedNameWarning(name) {
|
|
|
56397
56638
|
// ../../packages/warmhub-cli/src/manifest/parser.ts
|
|
56398
56639
|
import { existsSync as existsSync8, readFileSync as readFileSync9 } from "node:fs";
|
|
56399
56640
|
import { resolve } from "node:path";
|
|
56400
|
-
function
|
|
56401
|
-
const
|
|
56402
|
-
|
|
56403
|
-
|
|
56404
|
-
|
|
56405
|
-
|
|
56406
|
-
|
|
56407
|
-
|
|
56641
|
+
function loadDocument(rootDir, fileName, validate) {
|
|
56642
|
+
const path2 = resolve(rootDir, "warmhub", fileName);
|
|
56643
|
+
if (!existsSync8(path2)) {
|
|
56644
|
+
return {
|
|
56645
|
+
valid: false,
|
|
56646
|
+
errors: [`Missing warmhub/${fileName} at ${path2}`],
|
|
56647
|
+
warnings: []
|
|
56648
|
+
};
|
|
56408
56649
|
}
|
|
56409
|
-
let
|
|
56410
|
-
try {
|
|
56411
|
-
componentRaw = JSON.parse(readFileSync9(componentJsonPath, "utf-8"));
|
|
56412
|
-
} catch (err) {
|
|
56413
|
-
errors3.push(`Failed to parse warmhub/component.json: ${err instanceof Error ? err.message : String(err)}`);
|
|
56414
|
-
return { ok: false, errors: errors3, warnings };
|
|
56415
|
-
}
|
|
56416
|
-
const componentResult = validateComponentJson(componentRaw);
|
|
56417
|
-
errors3.push(...componentResult.errors);
|
|
56418
|
-
warnings.push(...componentResult.warnings);
|
|
56419
|
-
const manifestJsonPath = resolve(rootDir, "warmhub", "manifest.json");
|
|
56420
|
-
if (!existsSync8(manifestJsonPath)) {
|
|
56421
|
-
errors3.push(`Missing warmhub/manifest.json at ${manifestJsonPath}`);
|
|
56422
|
-
return { ok: false, errors: errors3, warnings };
|
|
56423
|
-
}
|
|
56424
|
-
let manifestRaw;
|
|
56650
|
+
let raw;
|
|
56425
56651
|
try {
|
|
56426
|
-
|
|
56652
|
+
raw = JSON.parse(readFileSync9(path2, "utf-8"));
|
|
56427
56653
|
} catch (err) {
|
|
56428
|
-
|
|
56429
|
-
|
|
56430
|
-
|
|
56431
|
-
|
|
56432
|
-
|
|
56433
|
-
|
|
56434
|
-
|
|
56435
|
-
return { ok: false, errors: errors3, warnings };
|
|
56654
|
+
return {
|
|
56655
|
+
valid: false,
|
|
56656
|
+
errors: [
|
|
56657
|
+
`Failed to parse warmhub/${fileName}: ${err instanceof Error ? err.message : String(err)}`
|
|
56658
|
+
],
|
|
56659
|
+
warnings: []
|
|
56660
|
+
};
|
|
56436
56661
|
}
|
|
56437
|
-
|
|
56662
|
+
return validate(raw);
|
|
56663
|
+
}
|
|
56664
|
+
function parseComponentPackage(dirPath) {
|
|
56665
|
+
const rootDir = resolve(dirPath);
|
|
56666
|
+
const component = loadDocument(rootDir, "component.json", validateComponentJson);
|
|
56667
|
+
const manifest = loadDocument(rootDir, "manifest.json", validateManifestJson);
|
|
56668
|
+
const warnings = [...component.warnings, ...manifest.warnings];
|
|
56669
|
+
if (!component.valid && !manifest.valid) {
|
|
56438
56670
|
return {
|
|
56439
56671
|
ok: false,
|
|
56440
|
-
errors: [
|
|
56672
|
+
errors: [...component.errors, ...manifest.errors],
|
|
56441
56673
|
warnings
|
|
56442
56674
|
};
|
|
56443
56675
|
}
|
|
56676
|
+
if (!component.valid) {
|
|
56677
|
+
return { ok: false, errors: component.errors, warnings };
|
|
56678
|
+
}
|
|
56679
|
+
if (!manifest.valid) {
|
|
56680
|
+
return { ok: false, errors: manifest.errors, warnings };
|
|
56681
|
+
}
|
|
56444
56682
|
return {
|
|
56445
56683
|
ok: true,
|
|
56446
|
-
errors: [],
|
|
56447
56684
|
warnings,
|
|
56448
56685
|
package: {
|
|
56449
|
-
meta:
|
|
56450
|
-
manifest:
|
|
56686
|
+
meta: component.value,
|
|
56687
|
+
manifest: manifest.value,
|
|
56451
56688
|
rootDir
|
|
56452
56689
|
}
|
|
56453
56690
|
};
|
|
56454
56691
|
}
|
|
56455
56692
|
|
|
56456
56693
|
// ../../packages/warmhub-cli/src/manifest/validate.ts
|
|
56694
|
+
function hasBlockingFindings(findings) {
|
|
56695
|
+
return findings.some((finding) => finding.level === "error");
|
|
56696
|
+
}
|
|
56457
56697
|
function crossValidate(pkg) {
|
|
56458
56698
|
const findings = [];
|
|
56459
56699
|
const { meta: meta3, manifest } = pkg;
|
|
@@ -56472,8 +56712,7 @@ function crossValidate(pkg) {
|
|
|
56472
56712
|
});
|
|
56473
56713
|
}
|
|
56474
56714
|
findings.push(...validateManifestSemantics(manifest));
|
|
56475
|
-
|
|
56476
|
-
return { valid: !hasErrors, findings };
|
|
56715
|
+
return { findings };
|
|
56477
56716
|
}
|
|
56478
56717
|
function validateComponentPackage(pkg) {
|
|
56479
56718
|
return crossValidate(pkg);
|
|
@@ -56632,14 +56871,11 @@ function resolveRegisteredComponentRef(ref, usage, example) {
|
|
|
56632
56871
|
if (!ref) {
|
|
56633
56872
|
usageError(usage, example);
|
|
56634
56873
|
}
|
|
56635
|
-
const
|
|
56636
|
-
if (
|
|
56874
|
+
const parsed = parseComponentRef(ref);
|
|
56875
|
+
if (!parsed) {
|
|
56637
56876
|
usageError(`Invalid component reference '${ref}'. Expected '<org>/<name>' with no extra slashes and no empty parts.`, example);
|
|
56638
56877
|
}
|
|
56639
|
-
return {
|
|
56640
|
-
orgName: parts[0],
|
|
56641
|
-
componentName: parts[1]
|
|
56642
|
-
};
|
|
56878
|
+
return { orgName: parsed.org, componentName: parsed.name };
|
|
56643
56879
|
}
|
|
56644
56880
|
function resolveRegistryVisibility(args) {
|
|
56645
56881
|
if (args.isPrivate && args.isPublic) {
|
|
@@ -56845,13 +57081,9 @@ var handleValidate = async (ctx, { args }) => {
|
|
|
56845
57081
|
writeOutput(ctx, result2, () => renderValidationResult(ctx, result2));
|
|
56846
57082
|
throw new CliError(2 /* UserInput */, "USER_INPUT", "Component package validation failed");
|
|
56847
57083
|
}
|
|
56848
|
-
const
|
|
56849
|
-
if (!parsedPackage) {
|
|
56850
|
-
throw new CliError(1 /* Runtime */, "UNKNOWN", "Component package validation returned no package");
|
|
56851
|
-
}
|
|
56852
|
-
const crossResult = validateComponentPackage(parsedPackage);
|
|
57084
|
+
const crossResult = validateComponentPackage(parseResult.package);
|
|
56853
57085
|
const result = {
|
|
56854
|
-
valid: crossResult.
|
|
57086
|
+
valid: !hasBlockingFindings(crossResult.findings),
|
|
56855
57087
|
errors: [],
|
|
56856
57088
|
warnings: parseResult.warnings,
|
|
56857
57089
|
findings: crossResult.findings
|
|
@@ -58305,7 +58537,7 @@ async function collectChecks(ctx) {
|
|
|
58305
58537
|
const repoFlag = getRepoRef(ctx);
|
|
58306
58538
|
const hasRepoFlag = repoFlag !== undefined;
|
|
58307
58539
|
const repo = repoFlag ?? ctx.config.defaultRepo;
|
|
58308
|
-
const repoParts = repo !== undefined ?
|
|
58540
|
+
const repoParts = repo !== undefined ? parseRepoSlug(repo) : null;
|
|
58309
58541
|
const repoForDisplay = repo !== undefined ? escapeTerminalTextForDisplay(repo) : undefined;
|
|
58310
58542
|
const repoSource = hasRepoFlag ? "flag" : ctx.config.configSource?.repo;
|
|
58311
58543
|
const repoProvenance = repoSource === "env" ? " (from WARMHUB_REPO)" : repoSource === "wh-file" ? " (from .wh file)" : repoSource === "flag" ? " (from --repo flag)" : "";
|
|
@@ -58638,7 +58870,7 @@ var handleDoctor2 = async (ctx, { flags }) => {
|
|
|
58638
58870
|
ctx.out(` ${c.dim}${line}${c.reset}`);
|
|
58639
58871
|
}
|
|
58640
58872
|
}
|
|
58641
|
-
if (check2.fix
|
|
58873
|
+
if (check2.fix) {
|
|
58642
58874
|
for (const line of check2.fix.split(`
|
|
58643
58875
|
`)) {
|
|
58644
58876
|
ctx.out(` ${c.dim}${line}${c.reset}`);
|
|
@@ -58684,6 +58916,120 @@ var DOCTOR_DOMAIN = defineDomain({
|
|
|
58684
58916
|
handler: handleDoctor2
|
|
58685
58917
|
});
|
|
58686
58918
|
|
|
58919
|
+
// ../../packages/warmhub-cli/src/domains/grant.ts
|
|
58920
|
+
var createFlags5 = {
|
|
58921
|
+
key: flag.string({ description: "issuer-scoped idempotency key" }),
|
|
58922
|
+
coverage: flag.string({
|
|
58923
|
+
description: "inline coverage JSON ({include, exclude?})"
|
|
58924
|
+
}),
|
|
58925
|
+
op: flag.string({
|
|
58926
|
+
description: "operation to grant (repeatable)",
|
|
58927
|
+
multiple: true
|
|
58928
|
+
})
|
|
58929
|
+
};
|
|
58930
|
+
var listFlags3 = {
|
|
58931
|
+
limit: flag.number({ description: "max records (default: 50, max: 100)" }),
|
|
58932
|
+
cursor: flag.string({ description: "grant keyset cursor" })
|
|
58933
|
+
};
|
|
58934
|
+
var revokeFlags2 = {
|
|
58935
|
+
reason: flag.string({ description: "revocation audit reason" })
|
|
58936
|
+
};
|
|
58937
|
+
function repo(ctx) {
|
|
58938
|
+
return parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
58939
|
+
}
|
|
58940
|
+
var handleCreate4 = async (ctx, { args, flags }) => {
|
|
58941
|
+
const [principalKind, principalId] = args;
|
|
58942
|
+
if (!principalKind || !principalId || !flags.key || !flags.op?.length) {
|
|
58943
|
+
usageError("Usage: wh grant create <member|pat|component> <principal-id> --key KEY --op OP [--op OP] --coverage JSON", `wh grant create component install-1:7 --key provision --op things:read --coverage '{"include":["Lesson/**"]}'`);
|
|
58944
|
+
}
|
|
58945
|
+
if (!flags.coverage) {
|
|
58946
|
+
usageError("Grant create requires --coverage.", `wh grant create component install-1:7 --key provision --op things:read --coverage '{"include":["Lesson/**"]}'`);
|
|
58947
|
+
}
|
|
58948
|
+
if (!["member", "pat", "component"].includes(principalKind)) {
|
|
58949
|
+
usageError("Grant grantee kind must be member, pat, or component.", `wh grant create component install-1:7 --key provision --op things:read --coverage '{"include":["Lesson/**"]}'`);
|
|
58950
|
+
}
|
|
58951
|
+
let coverage;
|
|
58952
|
+
try {
|
|
58953
|
+
coverage = JSON.parse(flags.coverage);
|
|
58954
|
+
} catch {
|
|
58955
|
+
usageError("--coverage must be valid JSON.", `wh grant create component install-1:7 --key provision --op things:read --coverage '{"include":["Lesson/**"]}'`);
|
|
58956
|
+
}
|
|
58957
|
+
const { org, repo: repoName } = repo(ctx);
|
|
58958
|
+
const result = await ctx.client.grant.create(org, repoName, {
|
|
58959
|
+
idempotencyKey: flags.key,
|
|
58960
|
+
grantee: {
|
|
58961
|
+
principalId,
|
|
58962
|
+
principalKind
|
|
58963
|
+
},
|
|
58964
|
+
coverage,
|
|
58965
|
+
ops: flags.op
|
|
58966
|
+
});
|
|
58967
|
+
writeOutput(ctx, result, () => ctx.out(JSON.stringify(result, null, 2)));
|
|
58968
|
+
};
|
|
58969
|
+
var handleGet = async (ctx, { args }) => {
|
|
58970
|
+
const grantId = args[0];
|
|
58971
|
+
if (!grantId) {
|
|
58972
|
+
usageError("Usage: wh grant get <grant-id>", "wh grant get 019b57b6-7a42-7000-8000-000000000000");
|
|
58973
|
+
}
|
|
58974
|
+
const { org, repo: repoName } = repo(ctx);
|
|
58975
|
+
const result = await ctx.client.grant.get(org, repoName, grantId);
|
|
58976
|
+
writeOutput(ctx, result, () => ctx.out(JSON.stringify(result, null, 2)));
|
|
58977
|
+
};
|
|
58978
|
+
var handleList4 = async (ctx, { flags }) => {
|
|
58979
|
+
const { org, repo: repoName } = repo(ctx);
|
|
58980
|
+
const limit = Math.min(flags.limit ?? 50, 100);
|
|
58981
|
+
const result = await ctx.client.grant.list(org, repoName, {
|
|
58982
|
+
limit,
|
|
58983
|
+
cursor: flags.cursor
|
|
58984
|
+
});
|
|
58985
|
+
writePageOutput(ctx, result.items, { limit, nextCursor: result.nextCursor ?? null }, () => ctx.out(JSON.stringify(result.items, null, 2)));
|
|
58986
|
+
};
|
|
58987
|
+
var handleRevoke2 = async (ctx, { args, flags }) => {
|
|
58988
|
+
const grantId = args[0];
|
|
58989
|
+
if (!grantId) {
|
|
58990
|
+
usageError("Usage: wh grant revoke <grant-id> [--reason TEXT]", "wh grant revoke 019b57b6-7a42-7000-8000-000000000000 --reason superseded");
|
|
58991
|
+
}
|
|
58992
|
+
const { org, repo: repoName } = repo(ctx);
|
|
58993
|
+
const result = await ctx.client.grant.revoke(org, repoName, grantId, {
|
|
58994
|
+
reason: flags.reason
|
|
58995
|
+
});
|
|
58996
|
+
writeOutput(ctx, result, () => ctx.out(JSON.stringify(result, null, 2)));
|
|
58997
|
+
};
|
|
58998
|
+
var GRANT_DOMAIN = defineDomain({
|
|
58999
|
+
name: "grant",
|
|
59000
|
+
summary: "Immutable repository Grant administration",
|
|
59001
|
+
group: "resource",
|
|
59002
|
+
verbs: {
|
|
59003
|
+
create: {
|
|
59004
|
+
prime: true,
|
|
59005
|
+
summary: "Create or replay an issuer-scoped Grant request",
|
|
59006
|
+
args: "<member|pat|component> <principal-id>",
|
|
59007
|
+
flags: createFlags5,
|
|
59008
|
+
handler: handleCreate4
|
|
59009
|
+
},
|
|
59010
|
+
get: {
|
|
59011
|
+
prime: true,
|
|
59012
|
+
summary: "Get one active or revoked Grant",
|
|
59013
|
+
args: "<grant-id>",
|
|
59014
|
+
handler: handleGet
|
|
59015
|
+
},
|
|
59016
|
+
list: {
|
|
59017
|
+
prime: true,
|
|
59018
|
+
summary: "List active and revoked Grants",
|
|
59019
|
+
args: "",
|
|
59020
|
+
flags: listFlags3,
|
|
59021
|
+
handler: handleList4
|
|
59022
|
+
},
|
|
59023
|
+
revoke: {
|
|
59024
|
+
prime: true,
|
|
59025
|
+
summary: "Revoke a Grant idempotently",
|
|
59026
|
+
args: "<grant-id>",
|
|
59027
|
+
flags: revokeFlags2,
|
|
59028
|
+
handler: handleRevoke2
|
|
59029
|
+
}
|
|
59030
|
+
}
|
|
59031
|
+
});
|
|
59032
|
+
|
|
58687
59033
|
// ../../packages/warmhub-cli/src/domains/init.ts
|
|
58688
59034
|
import { basename as basename4 } from "node:path";
|
|
58689
59035
|
|
|
@@ -58692,7 +59038,7 @@ async function onboardRepo(ctx, repoRef, description) {
|
|
|
58692
59038
|
if (!repoRef?.includes("/")) {
|
|
58693
59039
|
throw new CliError(2 /* UserInput */, "USER_INPUT", "Usage: wh init [org/repo] [--description <desc>]", undefined, "Example: wh init my-org/my-repo");
|
|
58694
59040
|
}
|
|
58695
|
-
const parsed =
|
|
59041
|
+
const parsed = parseRepoSlug(repoRef);
|
|
58696
59042
|
if (!parsed) {
|
|
58697
59043
|
throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid repo format "${repoRef}". Expected "org/repo".`, undefined, "Example: wh init my-org/my-repo");
|
|
58698
59044
|
}
|
|
@@ -58890,8 +59236,8 @@ function parseSince(raw, usage, example) {
|
|
|
58890
59236
|
var handleNotifications = async (ctx, { flags }) => {
|
|
58891
59237
|
const usage = "Usage: wh notifications [--repo org/repo] [--limit n] [--since <epoch-ms|iso>]";
|
|
58892
59238
|
const example = "wh notifications --repo myorg/myrepo --since 2026-03-30T12:00:00Z";
|
|
58893
|
-
const { org, repo } = resolveRepoContext(ctx);
|
|
58894
|
-
const result = await ctx.client.action.listNotifications(org,
|
|
59239
|
+
const { org, repo: repo2 } = resolveRepoContext(ctx);
|
|
59240
|
+
const result = await ctx.client.action.listNotifications(org, repo2, {
|
|
58895
59241
|
since: parseSince(flags.since, usage, example),
|
|
58896
59242
|
limit: flags.limit
|
|
58897
59243
|
});
|
|
@@ -59321,11 +59667,11 @@ var handleUpdate2 = async (ctx, { args, flags }) => {
|
|
|
59321
59667
|
};
|
|
59322
59668
|
|
|
59323
59669
|
// ../../packages/warmhub-cli/src/domains/org.ts
|
|
59324
|
-
var
|
|
59670
|
+
var createFlags6 = {
|
|
59325
59671
|
"display-name": flag.string({ description: "Display name for the org" }),
|
|
59326
59672
|
description: flag.string({ short: "d", description: "Org description" })
|
|
59327
59673
|
};
|
|
59328
|
-
var
|
|
59674
|
+
var handleCreate5 = async (ctx, { flags, args }) => {
|
|
59329
59675
|
const name = args[0];
|
|
59330
59676
|
if (!name) {
|
|
59331
59677
|
usageError('Usage: wh org create <name> [--display-name "..."] [--description "..."]', 'wh org create caryden --display-name "Carl Ryden" -d "A great org"');
|
|
@@ -59367,12 +59713,12 @@ var handleView5 = async (ctx, { args }) => {
|
|
|
59367
59713
|
ctx.out(`${c.dim}Created: ${new Date(result.createdAt).toISOString().slice(0, 16)}${c.reset}`);
|
|
59368
59714
|
});
|
|
59369
59715
|
};
|
|
59370
|
-
var
|
|
59716
|
+
var listFlags4 = {
|
|
59371
59717
|
"include-archived": flag.boolean({
|
|
59372
59718
|
description: "Include archived organizations"
|
|
59373
59719
|
})
|
|
59374
59720
|
};
|
|
59375
|
-
var
|
|
59721
|
+
var handleList5 = async (ctx, { flags }) => {
|
|
59376
59722
|
const c = ctx.colors;
|
|
59377
59723
|
const result = await ctx.client.org.list({
|
|
59378
59724
|
includeArchived: flags["include-archived"]
|
|
@@ -59479,9 +59825,9 @@ var ORG_DOMAIN = defineDomain({
|
|
|
59479
59825
|
prime: true,
|
|
59480
59826
|
summary: "Create a new organization",
|
|
59481
59827
|
args: "<name>",
|
|
59482
|
-
flags:
|
|
59828
|
+
flags: createFlags6,
|
|
59483
59829
|
examples: ['wh org create caryden --display-name "Carl Ryden"'],
|
|
59484
|
-
handler:
|
|
59830
|
+
handler: handleCreate5
|
|
59485
59831
|
},
|
|
59486
59832
|
view: {
|
|
59487
59833
|
prime: true,
|
|
@@ -59494,9 +59840,9 @@ var ORG_DOMAIN = defineDomain({
|
|
|
59494
59840
|
prime: true,
|
|
59495
59841
|
summary: "List all organizations",
|
|
59496
59842
|
args: "",
|
|
59497
|
-
flags:
|
|
59843
|
+
flags: listFlags4,
|
|
59498
59844
|
examples: ["wh org list", "wh org list --include-archived"],
|
|
59499
|
-
handler:
|
|
59845
|
+
handler: handleList5
|
|
59500
59846
|
},
|
|
59501
59847
|
update: {
|
|
59502
59848
|
summary: "Update org settings",
|
|
@@ -59538,7 +59884,7 @@ var ORG_DOMAIN = defineDomain({
|
|
|
59538
59884
|
});
|
|
59539
59885
|
|
|
59540
59886
|
// ../../packages/warmhub-cli/src/domains/prime-content.md
|
|
59541
|
-
var prime_content_default = "# WarmHub CLI Context\n> **Context Recovery**: Run `wh prime` after compaction or new session\n\n## Environment\n{{REPO_LINE}}\n\n## Core Concepts\n- **Thing**: A named entity versioned by writes. **Assertion**: A thing that makes a shape-validated claim about another thing.\n- **Shape**: A thing defining data structure; every other thing has one. **Write**: One or more add/revise/retract operations with per-operation results.\n- **wref**: A reference to a thing. Local: `Player` (the shape) or `Player/alice` (a thing with that shape). Cross-repo: `wh:org/repo/Shape` or `wh:org/repo/Shape/name`.\n\n## Versioned Wrefs\n- `Shape` addresses the shape itself; `Shape/name` addresses a thing with that shape. `@vN` pins either.\n- Floating write refs to retracted targets fail; existing pinned versions remain valid.\n- Rename invalidates old spellings, including `@vN`; the new name resolves history.\n- Untyped wrefs accept any thing. `wref<T>` requires the target's shape to be `T`; a shape has no shape, so never satisfies it. `wref?` coalesces only `thing_absent`, never a missing shape.\n\n## Key Workflows\n\n**Write data** (discover shapes → scaffold ops → submit):\n```bash\nwh shape list --repo org/repo # list available shapes\nwh shape view ShapeName --repo org/repo # inspect fields\nwh shape template ShapeName -o ops.json --repo org/repo # scaffold write ops (supports --kind assertion)\n# edit ops.json — fill FILL_IN placeholders — then:\nwh commit submit --file ops.json -m \"msg\" --repo org/repo # submit operations (bare `wh commit` also works)\n# or single assertion (no file needed):\nwh assertion create --shape ShapeName --about Target/name --name my-assertion --data '{\"field\":1}' --repo org/repo\n# Relay failed operation details when present. Never hand-guess ops JSON — use `wh shape template <Shape>`.\n```\n\n**Read data:**\n```bash\nwh thing list --repo org/repo # all things at HEAD\nwh thing view Shape/name --repo org/repo # inspect a thing\nwh thing query --shape MyShape --repo org/repo # find things by shape\nwh thing about Shape --repo org/repo # assertions about a shape\nwh assertion list --repo org/repo # all assertions at HEAD\nwh thing history Shape/name --repo org/repo # version history\n\n# Batch read — wh thing view is variadic (max 500 wrefs/call):\nwh thing view Player/alice Player/bob # variadic positionals\nwh thing view --file wrefs.txt --json # one wref per line\ncat wrefs.txt | wh thing view --format jsonl # one JSON line per *deduped* requested wref\n```\n\n## Wref Quick Reference\n\nWrites use explicit names and wrefs. Untyped fields, collection members,\nassertion `about`, and committers accept any thing. Create a deterministic\ntarget before referencing it in the same commit.\n\n## Command Reference\n\n**Global flags**: `--repo`, `--format`, `--json`, `--live`\n### thing — Thing operations\n- `wh thing list [--shape] [--kind] [--match] [--include-retracted]` — Current HEAD state\n- `wh thing view [<wref>...] [--file <path>] [--version] [--depth] [--include-retracted] [--data-mode auto|full]` — Thing details. Variadic (max 500). `--version` implies `--include-retracted`. Batch JSON returns `{ requested, items, missing }`; jsonl emits one row per deduped requested wref. Large Set/List bodies summarize by default; use `--data-mode full` for canonical collection JSON.\n- `wh thing history [wref] [--shape] [--about] [--include-retracted]` — Version history\n- `wh thing resolve <wref>` — Resolve a wref to its canonical thing identity\n- `wh thing create <name|Shape/name> (--data|--file) [--shape]` — Create\n- `wh thing revise <name> [--data] [--message] [--committer] [--expected-version]` — Revise (CONFLICT if HEAD≠n)\n- `wh thing retract <wref> -m <message> [--reason] [--kind] [--expected-version]` — Retract\n- `wh thing query [--shape] [--kind] [--about] [--match]` — Query by filters\n- `wh thing search <query> [--shape] [--kind] [--about] [--mode]` — Search text\n- `wh thing rename <Shape/oldName> <newName>` — Rename\n- `wh thing refs <wref> [--inbound] [--outbound] [--field]` — Show field references; use `wh thing about` for assertions about the target thing\n- `wh thing about <wref> [--shape] [--match] [--depth] [--resolve-collections] [--role from|to|ends] [--limit] [--include-retracted]` — Show assertions about the target identity; `--resolve-collections` expands bare/@HEAD/@ALL members, `--role` filters direction; not pinned @vN\n\n### commit — Write operations\n- `wh commit submit [--ops|--file|--add|--revise|--retract] [--kind] [--data] [--reason] [--expected-version] [--chunk-size] [--skip-existing] [--progress] [--stream-id]` — Submit operations (bare `wh commit` is equivalent). Use `--file ops.jsonl --stream-id <id> --chunk-size 5000 --skip-existing` for bulk ingest.\n- `wh shape template <shape> [shape2 ...] [--kind] [--operation add|revise|retract] [-o file]` — Generate sample ops\n\n### assertion — Assertion operations\n- `wh assertion list [--about wref] [--shape] [--match] [--include-retracted]` — Browse assertions\n- `wh assertion view <wref> [--version] [--include-retracted]` — Assertion details\n- `wh assertion create --shape <s> --name <n> --about <wref> [--data] [-m] [--committer]` — Create assertion\n- `wh assertion revise <wref> --data <json> [--message] [--committer]` — Revise assertion\n- `wh assertion retract <wref> -m <message> [--reason] [--committer] [--expected-version]` — Retract assertion\n- `wh assertion history <wref> [--include-retracted]` — Assertion history\n\n### shape — Shape management\n- `wh shape list [--match] [--include-retracted]` — List all shapes\n- `wh shape view <name> [--include-retracted]` — Shape details\n- `wh shape revise <name> (--fields|--file)`\n- `wh shape create <name> (--fields|--file)`\n- `wh shape retract <name> -m <message> [--reason] [--expected-version]` — Retract shape\n- `wh shape history <name> [--include-retracted]` — Shape history\n- `wh shape rename <oldName> <newName>` — Rename shape\n\n### repo — Repository management\n- `wh repo create <org/name> [--display-name] [--description] [--visibility]` — Create repo\n- `wh repo list [org]` — List repos\n- `wh repo view [org/repo]` — Repo details\n\n### org — Organization management\n- `wh org create <name> [--display-name]` — Create a new organization\n- `wh org view <name>` — View organization details (alias: info)\n- `wh org list` — List all organizations\n\n### sub — Subscription management\n- `wh sub create <name> [flags]` — Create a subscription\n- `wh sub view <name>` — View subscription details\n- `wh sub list` — List all subscriptions\n- `wh sub log <name>` — Tail subscription delivery feed\n- `wh sub attempts <runId>` — Show attempt history for a run\n- `wh sub pause <name>` — Pause a subscription\n- `wh sub resume <name>` — Resume a paused subscription\n- `wh sub bind <name> [--credentials]` — Bind a credential set to a subscription for webhook auth\n- `wh sub unbind <name>` — Remove credential binding from a subscription\n- `wh sub delete <name>` — Retire; name reserved\n\n### notifications — Action notification listing\n- `wh notifications [--limit] [--since]` — List repo-scoped action notifications\n\n### credential — Credential set management\n- `wh credential create <name> [--repo org/repo | --org org] [--scope] [--description]` — Create an empty credential set\n- `wh credential list [--repo org/repo | --org org]` — List credential sets accessible from a repo or org\n- `wh credential view <name> [--repo org/repo | --org org]` — View a credential set (key names only, no values)\n- `wh credential delete <name> [--repo org/repo | --org org]` — Delete a credential set and its Vault object\n- `wh credential set <setName> [<keyName>] [--repo org/repo | --org org] [--value]` — Set credential key(s). With `<keyName>`: single-key form (reads value from `--value` or stdin). Without `<keyName>`: batch form (reads JSON object from stdin, e.g. `{\"KEY\":\"val\"}`)\n- `wh credential unset <setName> <keyName> [--repo org/repo | --org org]` — Remove a key from a credential set\n- `wh credential audit <setName> [--repo org/repo | --org org]` — View audit log for a credential set\n- `wh credential revoke <setName> [--repo org/repo | --org org] [--reason]` — Revoke a credential set (blocks new binds and stops bound webhook deliveries)\n\n### component — Component management\n- `wh component validate <path>` — Validate package\n- `wh component install <org/name>` — Install a registered component\n- `wh component register <name> --org <org> --manifest <path> [flags]` — Register component identity\n- `wh component unregister <org/name>` — Remove a registered component identity\n- `wh component registry list --org <org>` — List registered components\n- `wh component registry view <org/name>` — View a registered component\n- `wh component registry update <org/name> [flags]` — Update a registered component\n- `wh component list` — List installed components\n- `wh component update <org/name>` — Update installed component\n- `wh component view <org/name>` — Show component details (alias: show)\n- `wh component doctor <org/name>` — Run component health checks\n- `wh component teardown <org/name>` — Pause component subscriptions\n\n### Getting More Info\n- `wh help` — help overview\n- `wh <domain>` — domain verbs\n- `wh <domain> <verb> --help` — verb flags and examples\n- `wh help --format json` — `CliSpecV2` (`schemaVersion: 2`): global/contextual/root tables and command overrides\n\n## Common Workflows\n\n**Explore a repo:**\n```bash\nwh thing list --repo org/repo # see all things in HEAD\nwh thing view Shape/name --repo org/repo # inspect a specific thing\nwh thing history Shape/name --repo org/repo # inspect version history\nwh thing about Shape/name # assertions about thing/shape\n```\n\n**Create an assertion** (most common write):\n```bash\n# --about takes an untyped target wref: Shape or Shape/name.\nwh assertion create --shape MyShape --about TargetShape/target-name \\\n --name my-assertion --data '{\"field_a\":1,\"field_b\":\"value\"}' --repo org/repo\n# Output includes per-operation status; relay failures when present.\n```\n\n**Create via write entrypoint** (alternative, supports batches and streams):\n```bash\nwh commit submit --add my-item --shape MyShape --kind assertion \\\n --about TargetShape/target-name --data '{\"field_a\":1}' --repo org/repo\n```\n\n**Batch write via file** (generate template → edit → submit):\n```bash\nwh shape template Hypothesis Evidence -o ops.json # add --kind assertion --about TargetShape/name for assertions\n# edit ops.json — fill FILL_IN placeholders\nwh commit submit --file ops.json -m \"batch update\" # submit all operations (bare `wh commit` is equivalent)\n# --file format: docs.warmhub.ai/cli-reference/commit-operations\n```\n\n**Bulk write (JSONL stream, >1k ops)** — one chunked stream beats per-record commits (~60× faster):\n```bash\nwh shape template MyShape -o ops.jsonl # one op per line (.jsonl)\nID=\"bulk-$(date +%s)\" # caller id for chunk correlation\nwh commit submit --file ops.jsonl --stream-id \"$ID\" --chunk-size 5000 \\\n --skip-existing --progress -m \"bulk ingest\" --repo org/repo\n# --chunk-size: ops per append chunk (default 1000, max 10000); chunk≈1 is ~60× slower\n# --skip-existing: skips already-written add ops (drops per-row read-before-write)\n# --stream-id identifies the submission but provides no receipt or resume.\n# After an outcome-unknown append, stop writes and reconcile attempted + unsent\n# work from a later verified checkpoint; never blindly replay revise/retract.\n```\n\n**Create collections:**\n```bash\nwh commit submit --type arc --name route --members Location/a,Location/b --repo org/repo\nwh assertion create --shape Supports --name route-support --about Arc/route --data '{\"confidence\":0.8}' --repo org/repo\n```\n\n**Modify data:**\n```bash\nwh thing revise Shape/name --data '{\"x\":5,\"y\":3}' -m \"update\" --repo org/repo\nwh thing retract Shape/old-item -m \"withdrawn\" --reason \"data feed contaminated\" --repo org/repo\n```\n\n**Query and filter:**\n```bash\nwh thing query --shape MyShape # by shape\nwh thing query --kind assertion --about Shape/name # by kind + target\nwh thing history Shape/name --limit 10 # version history\n```\n\n## Built-in Content shape\n\nWarmHub repos expose three well-known content wrefs:\n- `Content/Readme` — stored markdown for humans\n- `Content/Agents` — stored markdown guidance for AI agents\n- `Content/LlmsTxt` — synthesized per-request sitemap (read-only)\n\nFetch via `wh repo content get --kind readme|agents|llms-txt`,\n`client.repo.getReadme/getAgents/getLlmsTxt`, MCP `warmhub_repo_content_get`,\nor raw HTTP `GET /{org}/{repo}/readme.md|agents.md|llms.txt`.\nSee `wh repo describe` → `additionalInformation` for the discovery field.\n\n## Query Discipline\n- Plan the repo, shapes, and wrefs you need before the first query.\n- Gather the needed facts from one repo before switching to another.\n- Do the queries first, then write one complete answer.\n\n## Agent Tips\n- **Always run commands for live data** — this context describes the CLI, not repo contents\n- **Before writing, discover wrefs** — run `wh thing list` or `wh shape list`\n- **Shape field types**: `string`, `number`, `boolean`, `wref`, arrays, optionals, nested objects\n- **Write commands return per-operation results** — relay failures and affected wrefs to the user\n- **Pass data inline** with `--data '{...}'` — do NOT create temp files\n- Add `--json` to any command for machine-readable JSON output\n- **Aliases teach canonical commands** — executing aliases emit a status hint; misleading lifecycle aliases reject and point to `retract`\n- Writes go through `wh commit submit` (or bare `wh commit`) or wrappers (`create`, `revise`, `retract`, `assertion create`). `retract` irreversibly withdraws an identity and creates a history entry.\n- Use `wh doctor` to check environment health\n";
|
|
59887
|
+
var prime_content_default = "# WarmHub CLI Context\n> **Context Recovery**: Run `wh prime` after compaction or new session\n\n## Environment\n{{REPO_LINE}}\n\n## Core Concepts\n- **Thing**: A named entity versioned by writes. **Assertion**: A thing that makes a shape-validated claim about another thing.\n- **Shape**: A thing defining data structure; every other thing has one. **Write**: One or more add/revise/retract operations with per-operation results.\n- **wref**: A reference to a thing. Local: `Player` (the shape) or `Player/alice` (a thing with that shape). Cross-repo: `wh:org/repo/Shape` or `wh:org/repo/Shape/name`.\n\n## Versioned Wrefs\n- `Shape` addresses the shape itself; `Shape/name` addresses a thing with that shape. `@vN` pins either.\n- Floating write refs to retracted targets fail; existing pinned versions remain valid.\n- Rename invalidates old spellings, including `@vN`; the new name resolves history.\n- Untyped wrefs accept any thing. `wref<T>` requires the target's shape to be `T`; a shape has no shape, so never satisfies it. `wref?` coalesces only `thing_absent`, never a missing shape.\n\n## Key Workflows\n\n**Write data** (discover shapes → scaffold ops → submit):\n```bash\nwh shape list --repo org/repo # list available shapes\nwh shape view ShapeName --repo org/repo # inspect fields\nwh shape template ShapeName -o ops.json --repo org/repo # scaffold write ops (supports --kind assertion)\n# edit ops.json — fill FILL_IN placeholders — then:\nwh commit submit --file ops.json -m \"msg\" --repo org/repo # submit operations (bare `wh commit` also works)\n# or single assertion (no file needed):\nwh assertion create --shape ShapeName --about Target/name --name my-assertion --data '{\"field\":1}' --repo org/repo\n# Relay failed operation details when present. Never hand-guess ops JSON — use `wh shape template <Shape>`.\n```\n\n**Read data:**\n```bash\nwh thing list --repo org/repo # all things at HEAD\nwh thing view Shape/name --repo org/repo # inspect a thing\nwh thing query --shape MyShape --repo org/repo # find things by shape\nwh thing about Shape --repo org/repo # assertions about a shape\nwh assertion list --repo org/repo # all assertions at HEAD\nwh thing history Shape/name --repo org/repo # version history\n\n# Batch read — wh thing view is variadic (max 500 wrefs/call):\nwh thing view Player/alice Player/bob # variadic positionals\nwh thing view --file wrefs.txt --json # one wref per line\ncat wrefs.txt | wh thing view --format jsonl # one JSON line per *deduped* requested wref\n```\n\n## Wref Quick Reference\n\nWrites use explicit names and wrefs. Untyped fields, collection members,\nassertion `about`, and committers accept any thing. Create a deterministic\ntarget before referencing it in the same commit.\n\n## Command Reference\n\n**Global flags**: `--repo`, `--format`, `--json`, `--live`\n### thing — Things\n- `wh thing list [--shape] [--kind] [--match] [--include-retracted]` — Current HEAD state\n- `wh thing view [<wref>...] [--file <path>] [--version] [--depth] [--include-retracted] [--data-mode auto|full]` — Thing details. Variadic (max 500). `--version` implies `--include-retracted`. Batch JSON returns `{ requested, items, missing }`; jsonl emits one row per deduped requested wref. Large Set/List bodies summarize by default; use `--data-mode full` for canonical collection JSON.\n- `wh thing history [wref] [--shape] [--about] [--include-retracted]` — Version history\n- `wh thing resolve <wref>` — Resolve a wref to its canonical thing identity\n- `wh thing create <name|Shape/name> (--data|--file) [--shape]` — Create\n- `wh thing revise <name> [--data] [--message] [--committer] [--expected-version]` — Revise (CONFLICT if HEAD≠n)\n- `wh thing retract <wref> -m <message> [--reason] [--kind] [--expected-version]` — Retract\n- `wh thing query [--shape] [--kind] [--about] [--match]` — Query by filters\n- `wh thing search <query> [--shape] [--kind] [--about] [--mode]` — Search text\n- `wh thing rename <Shape/oldName> <newName>` — Rename\n- `wh thing refs <wref> [--inbound] [--outbound] [--field]` — Show field references; use `wh thing about` for assertions about the target thing\n- `wh thing about <wref> [--shape] [--match] [--depth] [--resolve-collections] [--role from|to|ends] [--limit] [--include-retracted]` — Show assertions about the target identity; `--resolve-collections` expands bare/@HEAD/@ALL members, `--role` filters direction; not pinned @vN\n\n- `wh view evaluate VIEW [--limit N] [--cursor TOK] [--all]`\n### commit — Write operations\n- `wh commit submit [--ops|--file|--add|--revise|--retract] [--kind] [--data] [--reason] [--expected-version] [--chunk-size] [--skip-existing] [--progress] [--stream-id]` — Submit operations (bare `wh commit` is equivalent). Use `--file ops.jsonl --stream-id <id> --chunk-size 5000 --skip-existing` for bulk ingest.\n- `wh shape template <shape> [shape2 ...] [--kind] [--operation add|revise|retract] [-o file]` — Generate sample ops\n\n### assertion — Assertion operations\n- `wh assertion list [--about wref] [--shape] [--match] [--include-retracted]` — Browse assertions\n- `wh assertion view <wref> [--version] [--include-retracted]` — Assertion details\n- `wh assertion create --shape <s> --name <n> --about <wref> [--data] [-m] [--committer]` — Create assertion\n- `wh assertion revise <wref> --data <json> [--message] [--committer]` — Revise assertion\n- `wh assertion retract <wref> -m <message> [--reason] [--committer] [--expected-version]` — Retract assertion\n- `wh assertion history <wref> [--include-retracted]` — Assertion history\n\n### shape — Shape management\n- `wh shape list [--match] [--include-retracted]` — List all shapes\n- `wh shape view <name> [--include-retracted]` — Shape details\n- `wh shape revise <name> (--fields|--file)`\n- `wh shape create <name> (--fields|--file)`\n- `wh shape retract <name> -m <message> [--reason] [--expected-version]` — Retract shape\n- `wh shape history <name> [--include-retracted]` — Shape history\n- `wh shape rename <oldName> <newName>` — Rename shape\n\n### repo — Repository management\n- `wh repo create <org/name> [--display-name] [--description] [--visibility]` — Create repo\n- `wh repo list [org]` — List repos\n- `wh repo view [org/repo]` — Repo details\n\n### org — Organization management\n- `wh org create <name> [--display-name]` — Create a new organization\n- `wh org view <name>` — View organization details (alias: info)\n- `wh org list` — List all organizations\n\n### sub — Subscription management\n- `wh sub create <name> [flags]` — Create a subscription\n- `wh sub view <name>` — View subscription details\n- `wh sub list` — List all subscriptions\n- `wh sub log <name>` — Tail subscription delivery feed\n- `wh sub attempts <runId>` — Show attempt history for a run\n- `wh sub pause <name>` — Pause a subscription\n- `wh sub resume <name>` — Resume a paused subscription\n- `wh sub bind <name> [--credentials]` — Bind a credential set to a subscription for webhook auth\n- `wh sub unbind <name>` — Remove credential binding from a subscription\n- `wh sub delete <name>` — Retire; name reserved\n\n### notifications — Action notification listing\n- `wh notifications [--limit] [--since]` — List repo-scoped action notifications\n\n### credential — Credential set management\n- `wh credential create <name> [--repo org/repo | --org org] [--scope] [--description]` — Create an empty credential set\n- `wh credential list [--repo org/repo | --org org]` — List credential sets accessible from a repo or org\n- `wh credential view <name> [--repo org/repo | --org org]` — View a credential set (key names only, no values)\n- `wh credential delete <name> [--repo org/repo | --org org]` — Delete a credential set and its Vault object\n- `wh credential set <setName> [<keyName>] [--repo org/repo | --org org] [--value]` — Set credential key(s). With `<keyName>`: single-key form (reads value from `--value` or stdin). Without `<keyName>`: batch form (reads JSON object from stdin, e.g. `{\"KEY\":\"val\"}`)\n- `wh credential unset <setName> <keyName> [--repo org/repo | --org org]` — Remove a key from a credential set\n- `wh credential audit <setName> [--repo org/repo | --org org]` — View audit log for a credential set\n- `wh credential revoke <setName> [--repo org/repo | --org org] [--reason]` — Revoke a credential set (blocks new binds and stops bound webhook deliveries)\n\n### component — Component management\n- `wh component validate <path>` — Validate package\n- `wh component install <org/name>` — Install a registered component\n- `wh component register <name> --org <org> --manifest <path> [flags]` — Register component identity\n- `wh component unregister <org/name>` — Remove a registered component identity\n- `wh component registry list --org <org>` — List registered components\n- `wh component registry view <org/name>` — View a registered component\n- `wh component registry update <org/name> [flags]` — Update a registered component\n- `wh component list` — List installed components\n- `wh component update <org/name>` — Update installed component\n- `wh component view <org/name>` — Show component details (alias: show)\n- `wh component doctor <org/name>` — Run component health checks\n- `wh component teardown <org/name>` — Pause component subscriptions\n\n### Getting More Info\n- `wh help` — help overview\n- `wh <domain>` — domain verbs\n- `wh <domain> <verb> --help` — verb flags and examples\n- `wh help --format json` — `CliSpecV2` (`schemaVersion: 2`): global/contextual/root tables and command overrides\n\n## Common Workflows\n\n**Explore a repo:**\n```bash\nwh thing list --repo org/repo # see all things in HEAD\nwh thing view Shape/name --repo org/repo # inspect a specific thing\nwh thing history Shape/name --repo org/repo # inspect version history\nwh thing about Shape/name # assertions about thing/shape\n```\n\n**Create an assertion** (most common write):\n```bash\n# --about takes an untyped target wref: Shape or Shape/name.\nwh assertion create --shape MyShape --about TargetShape/target-name \\\n --name my-assertion --data '{\"field_a\":1,\"field_b\":\"value\"}' --repo org/repo\n# Output includes per-operation status; relay failures when present.\n```\n\n**Create via write entrypoint** (alternative, supports batches and streams):\n```bash\nwh commit submit --add my-item --shape MyShape --kind assertion \\\n --about TargetShape/target-name --data '{\"field_a\":1}' --repo org/repo\n```\n\n**Batch write via file** (generate template → edit → submit):\n```bash\nwh shape template Hypothesis Evidence -o ops.json # add --kind assertion --about TargetShape/name for assertions\n# edit ops.json — fill FILL_IN placeholders\nwh commit submit --file ops.json -m \"batch update\" # submit all operations (bare `wh commit` is equivalent)\n# --file format: docs.warmhub.ai/cli-reference/commit-operations\n```\n\n**Bulk write (JSONL stream, >1k ops)** — one chunked stream beats per-record commits (~60× faster):\n```bash\nwh shape template MyShape -o ops.jsonl # one op per line (.jsonl)\nID=\"bulk-$(date +%s)\" # caller id for chunk correlation\nwh commit submit --file ops.jsonl --stream-id \"$ID\" --chunk-size 5000 \\\n --skip-existing --progress -m \"bulk ingest\" --repo org/repo\n# --chunk-size: ops per append chunk (default 1000, max 10000); chunk≈1 is ~60× slower\n# --skip-existing: skips already-written add ops (drops per-row read-before-write)\n# --stream-id identifies the submission but provides no receipt or resume.\n# After an outcome-unknown append, stop writes and reconcile attempted + unsent\n# work from a later verified checkpoint; never blindly replay revise/retract.\n```\n\n**Create collections:**\n```bash\nwh commit submit --type arc --name route --members Location/a,Location/b --repo org/repo\nwh assertion create --shape Supports --name route-support --about Arc/route --data '{\"confidence\":0.8}' --repo org/repo\n```\n\n**Modify data:**\n```bash\nwh thing revise Shape/name --data '{\"x\":5,\"y\":3}' -m \"update\" --repo org/repo\nwh thing retract Shape/old-item -m \"withdrawn\" --reason \"data feed contaminated\" --repo org/repo\n```\n\n**Query and filter:**\n```bash\nwh thing query --shape MyShape # by shape\nwh thing query --kind assertion --about Shape/name # by kind + target\nwh thing history Shape/name --limit 10 # version history\n```\n\n## Built-in Content shape\n\nWarmHub repos expose three well-known content wrefs:\n- `Content/Readme` — stored markdown for humans\n- `Content/Agents` — stored markdown guidance for AI agents\n- `Content/LlmsTxt` — synthesized per-request sitemap (read-only)\n\nFetch via `wh repo content get --kind readme|agents|llms-txt`,\n`client.repo.getReadme/getAgents/getLlmsTxt`, MCP `warmhub_repo_content_get`,\nor raw HTTP `GET /{org}/{repo}/readme.md|agents.md|llms.txt`.\nSee `wh repo describe` → `additionalInformation` for the discovery field.\n\n## Query Discipline\n- Plan the repo, shapes, and wrefs you need before the first query.\n- Gather the needed facts from one repo before switching to another.\n- Do the queries first, then write one complete answer.\n\n## Agent Tips\n- **Always run commands for live data** — this context describes the CLI, not repo contents\n- **Before writing, discover wrefs** — run `wh thing list` or `wh shape list`\n- **Shape field types**: `string`, `number`, `boolean`, `wref`, arrays, optionals, nested objects\n- **Write commands return per-operation results** — relay failures and affected wrefs to the user\n- **Pass data inline** with `--data '{...}'` — do NOT create temp files\n- Add `--json` to any command for machine-readable JSON output\n- **Aliases teach canonical commands** — executing aliases emit a status hint; misleading lifecycle aliases reject and point to `retract`\n- Writes go through `wh commit submit` (or bare `wh commit`) or wrappers (`create`, `revise`, `retract`, `assertion create`). `retract` irreversibly withdraws an identity and creates a history entry.\n- Use `wh doctor` to check environment health\n";
|
|
59542
59888
|
|
|
59543
59889
|
// ../../packages/warmhub-cli/src/domains/prime.ts
|
|
59544
59890
|
function buildMarkdown(config2) {
|
|
@@ -60702,10 +61048,10 @@ var checkpointFlags = {
|
|
|
60702
61048
|
latest: flag.boolean({
|
|
60703
61049
|
description: "Use the latest completed checkpoint"
|
|
60704
61050
|
}),
|
|
60705
|
-
archive: flag.boolean({ description: "
|
|
60706
|
-
manifest: flag.boolean({ description: "
|
|
61051
|
+
archive: flag.boolean({ description: "Select the checkpoint archive" }),
|
|
61052
|
+
manifest: flag.boolean({ description: "Select the checkpoint manifest" }),
|
|
60707
61053
|
chunk: flag.string({
|
|
60708
|
-
description: "
|
|
61054
|
+
description: "Select this checkpoint chunk path",
|
|
60709
61055
|
constraints: { nonEmpty: true }
|
|
60710
61056
|
}),
|
|
60711
61057
|
output: flag.string({
|
|
@@ -60714,6 +61060,8 @@ var checkpointFlags = {
|
|
|
60714
61060
|
})
|
|
60715
61061
|
};
|
|
60716
61062
|
var CHECKPOINT_ID_EXAMPLE = "0198f6d5-78aa-7000-8000-000000000001";
|
|
61063
|
+
var CHECKPOINT_ACCESS_EXAMPLE = "wh repo checkpoint access acme/widgets --latest --archive";
|
|
61064
|
+
var CHECKPOINT_DOWNLOAD_EXAMPLE = "wh repo checkpoint download acme/widgets --latest --archive --output checkpoint.zip";
|
|
60717
61065
|
var CHECKPOINT_READ_NOTE = "Requires unrestricted repo:read plus repo:checkpoint-read.";
|
|
60718
61066
|
var CHECKPOINT_MANAGEMENT_NOTE = "Requires unrestricted repo:read, repo:checkpoint-read, and repo:admin.";
|
|
60719
61067
|
var generateFlags = {
|
|
@@ -60728,13 +61076,16 @@ var retryFlags = {
|
|
|
60728
61076
|
checkpoint: checkpointFlags.checkpoint,
|
|
60729
61077
|
wait: checkpointFlags.wait
|
|
60730
61078
|
};
|
|
60731
|
-
var
|
|
61079
|
+
var accessFlags = {
|
|
60732
61080
|
latest: checkpointFlags.latest,
|
|
60733
61081
|
checkpoint: checkpointFlags.checkpoint,
|
|
60734
61082
|
"repo-seq": checkpointFlags["repo-seq"],
|
|
60735
61083
|
archive: checkpointFlags.archive,
|
|
60736
61084
|
manifest: checkpointFlags.manifest,
|
|
60737
|
-
chunk: checkpointFlags.chunk
|
|
61085
|
+
chunk: checkpointFlags.chunk
|
|
61086
|
+
};
|
|
61087
|
+
var downloadFlags = {
|
|
61088
|
+
...accessFlags,
|
|
60738
61089
|
output: checkpointFlags.output
|
|
60739
61090
|
};
|
|
60740
61091
|
function repoFor(ctx, args) {
|
|
@@ -60760,19 +61111,30 @@ function selectCheckpoint(flags) {
|
|
|
60760
61111
|
return { repoSeq };
|
|
60761
61112
|
throw new Error("Checkpoint selector was validated without a selector");
|
|
60762
61113
|
}
|
|
60763
|
-
function
|
|
61114
|
+
function selectArtifactCheckpoint(flags, example) {
|
|
60764
61115
|
const selected = Number(flags.latest === true) + Number(flags.checkpoint !== undefined) + Number(flags["repo-seq"] !== undefined);
|
|
60765
61116
|
if (selected !== 1) {
|
|
60766
|
-
usageError("Provide exactly one checkpoint selector: --latest, --checkpoint, or --repo-seq.",
|
|
61117
|
+
usageError("Provide exactly one checkpoint selector: --latest, --checkpoint, or --repo-seq.", example);
|
|
60767
61118
|
}
|
|
60768
61119
|
if (flags.latest)
|
|
60769
61120
|
return "latest";
|
|
60770
61121
|
return selectCheckpoint(flags);
|
|
60771
61122
|
}
|
|
60772
|
-
function
|
|
61123
|
+
function printAccess(ctx, result) {
|
|
61124
|
+
writeOutput(ctx, result, () => {
|
|
61125
|
+
ctx.out(`Checkpoint: ${result.checkpointId}`);
|
|
61126
|
+
ctx.out(`Repository sequence: ${result.repoSeq}`);
|
|
61127
|
+
ctx.out(`Content type: ${result.contentType}`);
|
|
61128
|
+
ctx.out(`Bytes: ${result.byteLength}`);
|
|
61129
|
+
ctx.out(`SHA-256: ${result.sha256}`);
|
|
61130
|
+
ctx.out(`Expires at: ${result.expiresAt.toISOString()}`);
|
|
61131
|
+
ctx.out(`URL: ${result.url}`);
|
|
61132
|
+
});
|
|
61133
|
+
}
|
|
61134
|
+
function selectArtifact(flags, example) {
|
|
60773
61135
|
const selected = Number(flags.archive === true) + Number(flags.manifest === true) + Number(flags.chunk !== undefined);
|
|
60774
61136
|
if (selected !== 1) {
|
|
60775
|
-
usageError("Provide exactly one artifact selector: --archive, --manifest, or --chunk PATH.",
|
|
61137
|
+
usageError("Provide exactly one artifact selector: --archive, --manifest, or --chunk PATH.", example);
|
|
60776
61138
|
}
|
|
60777
61139
|
if (flags.archive)
|
|
60778
61140
|
return "archive";
|
|
@@ -60803,13 +61165,13 @@ function printCheckpoint(ctx, result) {
|
|
|
60803
61165
|
ctx.out(`Failure: ${result.failureCode}`);
|
|
60804
61166
|
});
|
|
60805
61167
|
}
|
|
60806
|
-
async function waitForCompletion(ctx, org,
|
|
61168
|
+
async function waitForCompletion(ctx, org, repo2, initial) {
|
|
60807
61169
|
let result = initial;
|
|
60808
61170
|
let delayMs = 200;
|
|
60809
61171
|
while (result.state === "queued" || result.state === "running") {
|
|
60810
61172
|
ctx.status(`Checkpoint ${result.checkpointId} is ${result.state}; waiting…`);
|
|
60811
61173
|
await delay2(delayMs, ctx.signal);
|
|
60812
|
-
result = await checkpointClient(ctx).status(org,
|
|
61174
|
+
result = await checkpointClient(ctx).status(org, repo2, {
|
|
60813
61175
|
checkpointId: result.checkpointId
|
|
60814
61176
|
});
|
|
60815
61177
|
delayMs = Math.min(delayMs * 2, 5000);
|
|
@@ -60834,39 +61196,39 @@ function delay2(ms, signal) {
|
|
|
60834
61196
|
});
|
|
60835
61197
|
}
|
|
60836
61198
|
var handleGenerate = async (ctx, { args, flags }) => {
|
|
60837
|
-
const { org, repo } = repoFor(ctx, args);
|
|
60838
|
-
const result = await checkpointClient(ctx).generate(org,
|
|
61199
|
+
const { org, repo: repo2 } = repoFor(ctx, args);
|
|
61200
|
+
const result = await checkpointClient(ctx).generate(org, repo2, {
|
|
60839
61201
|
atLeastRepoSeq: requireSequence(flags["at-least-repo-seq"], "--at-least-repo-seq")
|
|
60840
61202
|
});
|
|
60841
|
-
printCheckpoint(ctx, flags.wait ? await waitForCompletion(ctx, org,
|
|
61203
|
+
printCheckpoint(ctx, flags.wait ? await waitForCompletion(ctx, org, repo2, result) : result);
|
|
60842
61204
|
};
|
|
60843
61205
|
var handleStatus2 = async (ctx, { args, flags }) => {
|
|
60844
|
-
const { org, repo } = repoFor(ctx, args);
|
|
60845
|
-
printCheckpoint(ctx, await checkpointClient(ctx).status(org,
|
|
61206
|
+
const { org, repo: repo2 } = repoFor(ctx, args);
|
|
61207
|
+
printCheckpoint(ctx, await checkpointClient(ctx).status(org, repo2, selectCheckpoint(flags)));
|
|
60846
61208
|
};
|
|
60847
61209
|
var handleLatest = async (ctx, { args }) => {
|
|
60848
|
-
const { org, repo } = repoFor(ctx, args);
|
|
60849
|
-
printCheckpoint(ctx, await checkpointClient(ctx).latest(org,
|
|
61210
|
+
const { org, repo: repo2 } = repoFor(ctx, args);
|
|
61211
|
+
printCheckpoint(ctx, await checkpointClient(ctx).latest(org, repo2));
|
|
60850
61212
|
};
|
|
60851
61213
|
var handleRetry = async (ctx, { args, flags }) => {
|
|
60852
61214
|
if (!flags.checkpoint) {
|
|
60853
61215
|
usageError("--checkpoint is required for retry.", `wh repo checkpoint retry acme/widgets --checkpoint ${CHECKPOINT_ID_EXAMPLE}`);
|
|
60854
61216
|
}
|
|
60855
|
-
const { org, repo } = repoFor(ctx, args);
|
|
60856
|
-
const result = await checkpointClient(ctx).retry(org,
|
|
60857
|
-
printCheckpoint(ctx, flags.wait ? await waitForCompletion(ctx, org,
|
|
61217
|
+
const { org, repo: repo2 } = repoFor(ctx, args);
|
|
61218
|
+
const result = await checkpointClient(ctx).retry(org, repo2, flags.checkpoint);
|
|
61219
|
+
printCheckpoint(ctx, flags.wait ? await waitForCompletion(ctx, org, repo2, result) : result);
|
|
60858
61220
|
};
|
|
60859
61221
|
var handleDownload = async (ctx, { args, flags }) => {
|
|
60860
61222
|
if (!flags.output) {
|
|
60861
|
-
usageError("--output PATH|- is required for download.",
|
|
61223
|
+
usageError("--output PATH|- is required for download.", CHECKPOINT_DOWNLOAD_EXAMPLE);
|
|
60862
61224
|
}
|
|
60863
61225
|
if (flags.output === "-" && ctx.format !== "pretty") {
|
|
60864
61226
|
throw new CliError(2 /* UserInput */, "USER_INPUT", "Binary stdout requires --format pretty; JSON and JSONL cannot carry artifact bytes.");
|
|
60865
61227
|
}
|
|
60866
|
-
const { org, repo } = repoFor(ctx, args);
|
|
60867
|
-
const access = await checkpointClient(ctx).getAccess(org,
|
|
60868
|
-
checkpoint:
|
|
60869
|
-
artifact: selectArtifact(flags)
|
|
61228
|
+
const { org, repo: repo2 } = repoFor(ctx, args);
|
|
61229
|
+
const access = await checkpointClient(ctx).getAccess(org, repo2, {
|
|
61230
|
+
checkpoint: selectArtifactCheckpoint(flags, CHECKPOINT_DOWNLOAD_EXAMPLE),
|
|
61231
|
+
artifact: selectArtifact(flags, CHECKPOINT_DOWNLOAD_EXAMPLE)
|
|
60870
61232
|
});
|
|
60871
61233
|
if (!ctx.rawFetch) {
|
|
60872
61234
|
throw new CliError(1 /* Runtime */, "UNKNOWN", "Raw signed-URL transport is unavailable for this command context.");
|
|
@@ -60878,6 +61240,13 @@ var handleDownload = async (ctx, { args, flags }) => {
|
|
|
60878
61240
|
if (flags.output !== "-")
|
|
60879
61241
|
ctx.status(`Downloaded checkpoint artifact to ${flags.output}`);
|
|
60880
61242
|
};
|
|
61243
|
+
var handleAccess = async (ctx, { args, flags }) => {
|
|
61244
|
+
const { org, repo: repo2 } = repoFor(ctx, args);
|
|
61245
|
+
printAccess(ctx, await checkpointClient(ctx).getAccess(org, repo2, {
|
|
61246
|
+
checkpoint: selectArtifactCheckpoint(flags, CHECKPOINT_ACCESS_EXAMPLE),
|
|
61247
|
+
artifact: selectArtifact(flags, CHECKPOINT_ACCESS_EXAMPLE)
|
|
61248
|
+
}));
|
|
61249
|
+
};
|
|
60881
61250
|
var handleVerify = async (ctx, { args }) => {
|
|
60882
61251
|
const archive = args[0];
|
|
60883
61252
|
if (!archive) {
|
|
@@ -60905,7 +61274,7 @@ var handleVerify = async (ctx, { args }) => {
|
|
|
60905
61274
|
};
|
|
60906
61275
|
var CHECKPOINT_SUBDOMAIN = defineDomain({
|
|
60907
61276
|
name: "checkpoint",
|
|
60908
|
-
summary: "Generate, download, and verify
|
|
61277
|
+
summary: "Generate, access, download, and verify repository checkpoints",
|
|
60909
61278
|
verbs: {
|
|
60910
61279
|
generate: {
|
|
60911
61280
|
summary: "Generate a repository checkpoint",
|
|
@@ -60945,6 +61314,18 @@ var CHECKPOINT_SUBDOMAIN = defineDomain({
|
|
|
60945
61314
|
],
|
|
60946
61315
|
handler: handleRetry
|
|
60947
61316
|
},
|
|
61317
|
+
access: {
|
|
61318
|
+
summary: "Show a short-lived checkpoint artifact URL",
|
|
61319
|
+
args: "[org/repo]",
|
|
61320
|
+
flags: accessFlags,
|
|
61321
|
+
notes: [
|
|
61322
|
+
CHECKPOINT_READ_NOTE,
|
|
61323
|
+
"The URL is a short-lived bearer credential. Handle command output as a secret.",
|
|
61324
|
+
"Requires exactly one checkpoint selector and one artifact selector."
|
|
61325
|
+
],
|
|
61326
|
+
examples: [CHECKPOINT_ACCESS_EXAMPLE],
|
|
61327
|
+
handler: handleAccess
|
|
61328
|
+
},
|
|
60948
61329
|
download: {
|
|
60949
61330
|
summary: "Download one checkpoint artifact",
|
|
60950
61331
|
args: "[org/repo]",
|
|
@@ -60953,9 +61334,7 @@ var CHECKPOINT_SUBDOMAIN = defineDomain({
|
|
|
60953
61334
|
CHECKPOINT_READ_NOTE,
|
|
60954
61335
|
"Requires exactly one checkpoint selector, one artifact selector, and --output PATH|-."
|
|
60955
61336
|
],
|
|
60956
|
-
examples: [
|
|
60957
|
-
"wh repo checkpoint download acme/widgets --latest --archive --output checkpoint.zip"
|
|
60958
|
-
],
|
|
61337
|
+
examples: [CHECKPOINT_DOWNLOAD_EXAMPLE],
|
|
60959
61338
|
handler: handleDownload
|
|
60960
61339
|
},
|
|
60961
61340
|
verify: {
|
|
@@ -61071,24 +61450,22 @@ function parseExplicitOrgRepoArg(ref, usage, example) {
|
|
|
61071
61450
|
if (!ref?.includes("/")) {
|
|
61072
61451
|
usageError(usage, example);
|
|
61073
61452
|
}
|
|
61074
|
-
const
|
|
61075
|
-
if (
|
|
61453
|
+
const parsed = parseRepoSlug(ref);
|
|
61454
|
+
if (!parsed) {
|
|
61076
61455
|
usageError(`Invalid repo format "${ref}". Expected "org/repo" with no extra slashes or empty segments.`, example);
|
|
61077
61456
|
}
|
|
61078
|
-
|
|
61079
|
-
return { orgName, repoName };
|
|
61457
|
+
return { orgName: parsed.org, repoName: parsed.repo };
|
|
61080
61458
|
}
|
|
61081
61459
|
function resolveOrgRepoArg(ref, orgFlag) {
|
|
61082
61460
|
if (ref?.includes("/")) {
|
|
61083
|
-
const
|
|
61084
|
-
if (
|
|
61461
|
+
const parsed = parseRepoSlug(ref);
|
|
61462
|
+
if (!parsed) {
|
|
61085
61463
|
usageError(`Invalid repo format '${ref}'. Expected '<org>/<name>' with no extra slashes and no empty parts.`, "wh repo create myorg/myrepo");
|
|
61086
61464
|
}
|
|
61087
|
-
|
|
61088
|
-
|
|
61089
|
-
usageError(`Conflicting org: positional '${orgName}' vs --org '${orgFlag}'`, "wh repo create myorg/myrepo");
|
|
61465
|
+
if (orgFlag && orgFlag !== parsed.org) {
|
|
61466
|
+
usageError(`Conflicting org: positional '${parsed.org}' vs --org '${orgFlag}'`, "wh repo create myorg/myrepo");
|
|
61090
61467
|
}
|
|
61091
|
-
return { orgName, repoName };
|
|
61468
|
+
return { orgName: parsed.org, repoName: parsed.repo };
|
|
61092
61469
|
}
|
|
61093
61470
|
if (ref && orgFlag) {
|
|
61094
61471
|
return {
|
|
@@ -61104,10 +61481,11 @@ function nameStrings(items) {
|
|
|
61104
61481
|
}
|
|
61105
61482
|
|
|
61106
61483
|
// ../../packages/warmhub-cli/src/domains/repo/content.ts
|
|
61107
|
-
var READ_ONLY_KINDS = new Set(["llms-txt"]);
|
|
61108
61484
|
var CONTENT_KINDS = ["readme", "agents", "llms-txt"];
|
|
61485
|
+
var CONTENT_KIND_LIST = CONTENT_KINDS.join(", ");
|
|
61486
|
+
var READ_ONLY_KINDS = new Set(["llms-txt"]);
|
|
61109
61487
|
var kindFlagDef = flag.string({
|
|
61110
|
-
description:
|
|
61488
|
+
description: `Which content kind to operate on (${CONTENT_KIND_LIST})`
|
|
61111
61489
|
});
|
|
61112
61490
|
var contentGetFlags = {
|
|
61113
61491
|
kind: kindFlagDef
|
|
@@ -61127,19 +61505,20 @@ var promptFlags = {
|
|
|
61127
61505
|
};
|
|
61128
61506
|
function requireKind(kind) {
|
|
61129
61507
|
if (!kind) {
|
|
61130
|
-
throw new CliError(2 /* UserInput */, "USER_INPUT",
|
|
61508
|
+
throw new CliError(2 /* UserInput */, "USER_INPUT", `--kind is required. Choose one of: ${CONTENT_KIND_LIST}`, undefined, "Example: wh repo content get myorg/myrepo --kind readme");
|
|
61131
61509
|
}
|
|
61132
|
-
|
|
61133
|
-
|
|
61510
|
+
const parsed = CONTENT_KINDS.find((candidate) => candidate === kind);
|
|
61511
|
+
if (!parsed) {
|
|
61512
|
+
throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid --kind '${kind}'. Choose one of: ${CONTENT_KIND_LIST}`);
|
|
61134
61513
|
}
|
|
61135
|
-
return
|
|
61514
|
+
return parsed;
|
|
61136
61515
|
}
|
|
61137
61516
|
var handleContentGet = async (ctx, { args, flags }) => {
|
|
61138
61517
|
const kind = requireKind(flags.kind);
|
|
61139
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx) ?? args[0], ctx.config);
|
|
61518
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx) ?? args[0], ctx.config);
|
|
61140
61519
|
switch (kind) {
|
|
61141
61520
|
case "readme": {
|
|
61142
|
-
const result = await ctx.client.repo.getReadme(org,
|
|
61521
|
+
const result = await ctx.client.repo.getReadme(org, repo2);
|
|
61143
61522
|
const content = result?.data?.content;
|
|
61144
61523
|
const text = typeof content === "string" ? content : "";
|
|
61145
61524
|
writeOutput(ctx, result, () => {
|
|
@@ -61148,7 +61527,7 @@ var handleContentGet = async (ctx, { args, flags }) => {
|
|
|
61148
61527
|
break;
|
|
61149
61528
|
}
|
|
61150
61529
|
case "agents": {
|
|
61151
|
-
const result = await ctx.client.repo.getAgents(org,
|
|
61530
|
+
const result = await ctx.client.repo.getAgents(org, repo2);
|
|
61152
61531
|
const content = result?.data?.content;
|
|
61153
61532
|
const text = typeof content === "string" ? content : "";
|
|
61154
61533
|
writeOutput(ctx, result, () => {
|
|
@@ -61157,7 +61536,7 @@ var handleContentGet = async (ctx, { args, flags }) => {
|
|
|
61157
61536
|
break;
|
|
61158
61537
|
}
|
|
61159
61538
|
case "llms-txt": {
|
|
61160
|
-
const result = await ctx.client.repo.getLlmsTxt(org,
|
|
61539
|
+
const result = await ctx.client.repo.getLlmsTxt(org, repo2);
|
|
61161
61540
|
writeOutput(ctx, result, () => {
|
|
61162
61541
|
ctx.out(result.data.content);
|
|
61163
61542
|
});
|
|
@@ -61170,26 +61549,26 @@ var handleContentSet = async (ctx, { args, flags }) => {
|
|
|
61170
61549
|
if (READ_ONLY_KINDS.has(kind)) {
|
|
61171
61550
|
throw new CliError(2 /* UserInput */, "USER_INPUT", `--kind ${kind} is read-only; \`set\` is rejected.`, undefined, `Use \`wh repo content get [org/repo] --kind ${kind}\` (or set --repo)`);
|
|
61172
61551
|
}
|
|
61173
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx) ?? args[0], ctx.config);
|
|
61552
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx) ?? args[0], ctx.config);
|
|
61174
61553
|
const inputContent = await readContentInput(flags.file, flags.content, ctx.stdin);
|
|
61175
61554
|
const eventRequestId = flags["event-request-id"] ?? createOperationEventRequestId();
|
|
61176
61555
|
ctx.status(`Operation event request: ${eventRequestId}`);
|
|
61177
61556
|
switch (kind) {
|
|
61178
61557
|
case "readme": {
|
|
61179
|
-
const result = await ctx.client.repo.setReadme(org,
|
|
61558
|
+
const result = await ctx.client.repo.setReadme(org, repo2, inputContent, {
|
|
61180
61559
|
eventRequestId
|
|
61181
61560
|
});
|
|
61182
61561
|
writeOutput(ctx, result, () => {
|
|
61183
|
-
ctx.status(`Content/Readme updated in ${org}/${
|
|
61562
|
+
ctx.status(`Content/Readme updated in ${org}/${repo2}`);
|
|
61184
61563
|
});
|
|
61185
61564
|
break;
|
|
61186
61565
|
}
|
|
61187
61566
|
case "agents": {
|
|
61188
|
-
const result = await ctx.client.repo.setAgents(org,
|
|
61567
|
+
const result = await ctx.client.repo.setAgents(org, repo2, inputContent, {
|
|
61189
61568
|
eventRequestId
|
|
61190
61569
|
});
|
|
61191
61570
|
writeOutput(ctx, result, () => {
|
|
61192
|
-
ctx.status(`Content/Agents updated in ${org}/${
|
|
61571
|
+
ctx.status(`Content/Agents updated in ${org}/${repo2}`);
|
|
61193
61572
|
});
|
|
61194
61573
|
break;
|
|
61195
61574
|
}
|
|
@@ -61203,24 +61582,24 @@ var handleContentPrompt = async (ctx, { args, flags }) => {
|
|
|
61203
61582
|
throw new CliError(2 /* UserInput */, "USER_INPUT", `--kind ${kind} is read-only; \`prompt\` is rejected.`, undefined, `Use \`wh repo content get [org/repo] --kind ${kind}\` (or set --repo)`);
|
|
61204
61583
|
}
|
|
61205
61584
|
const promptKind = kind;
|
|
61206
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx) ?? args[0], ctx.config);
|
|
61585
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx) ?? args[0], ctx.config);
|
|
61207
61586
|
const [repoInfo, shapesPage, stats, thingsPage] = await Promise.all([
|
|
61208
|
-
ctx.client.repo.get(org,
|
|
61209
|
-
ctx.client.shape.list(org,
|
|
61210
|
-
ctx.client.repo.getStats(org,
|
|
61211
|
-
ctx.client.thing.query(org,
|
|
61587
|
+
ctx.client.repo.get(org, repo2),
|
|
61588
|
+
ctx.client.shape.list(org, repo2),
|
|
61589
|
+
ctx.client.repo.getStats(org, repo2),
|
|
61590
|
+
ctx.client.thing.query(org, repo2, { limit: 30 })
|
|
61212
61591
|
]);
|
|
61213
61592
|
const { prompt, saveCommand } = buildContentPrompt({
|
|
61214
61593
|
kind: promptKind,
|
|
61215
61594
|
org,
|
|
61216
|
-
repo,
|
|
61595
|
+
repo: repo2,
|
|
61217
61596
|
description: repoInfo.description ?? null,
|
|
61218
61597
|
byKind: stats.byKind,
|
|
61219
61598
|
byShape: stats.byShape,
|
|
61220
61599
|
shapeNames: nameStrings(shapesPage.items),
|
|
61221
61600
|
sampleThingNames: nameStrings(thingsPage.items)
|
|
61222
61601
|
});
|
|
61223
|
-
writeOutput(ctx, { kind: promptKind, org, repo, prompt, saveCommand }, () => {
|
|
61602
|
+
writeOutput(ctx, { kind: promptKind, org, repo: repo2, prompt, saveCommand }, () => {
|
|
61224
61603
|
ctx.out(prompt);
|
|
61225
61604
|
});
|
|
61226
61605
|
ctx.status(`Next: draft the content, then run:
|
|
@@ -61276,7 +61655,7 @@ var CONTENT_SUBDOMAIN = defineDomain({
|
|
|
61276
61655
|
});
|
|
61277
61656
|
|
|
61278
61657
|
// ../../packages/warmhub-cli/src/domains/repo/create.ts
|
|
61279
|
-
var
|
|
61658
|
+
var createFlags7 = {
|
|
61280
61659
|
"display-name": flag.string({
|
|
61281
61660
|
description: "Display name for the repo"
|
|
61282
61661
|
}),
|
|
@@ -61289,7 +61668,7 @@ var createFlags6 = {
|
|
|
61289
61668
|
description: "Org name (tolerance fallback; prefer the `<org/name>` positional form)"
|
|
61290
61669
|
})
|
|
61291
61670
|
};
|
|
61292
|
-
var
|
|
61671
|
+
var handleCreate6 = async (ctx, { flags, args }) => {
|
|
61293
61672
|
const ref = args[0];
|
|
61294
61673
|
const orgFlag = flags.org;
|
|
61295
61674
|
const resolved = resolveOrgRepoArg(ref, orgFlag);
|
|
@@ -61393,7 +61772,7 @@ var repoListFlags = {
|
|
|
61393
61772
|
};
|
|
61394
61773
|
var DEFAULT_REPO_LIST_LIMIT = 50;
|
|
61395
61774
|
var MAX_REPO_LIST_LIMIT = 200;
|
|
61396
|
-
var
|
|
61775
|
+
var handleList6 = async (ctx, { flags, args }) => {
|
|
61397
61776
|
const orgName = args[0] ?? ctx.config.defaultOrg;
|
|
61398
61777
|
if (!orgName) {
|
|
61399
61778
|
usageError("Usage: wh repo list <org> (or set WARMHUB_ORG)", "wh repo list myorg");
|
|
@@ -61519,15 +61898,15 @@ var describeFlags = {
|
|
|
61519
61898
|
};
|
|
61520
61899
|
var handleDescribe = async (ctx, { args, flags }) => {
|
|
61521
61900
|
const repoRef = args[0];
|
|
61522
|
-
const { org, repo } = parseOrgRepo(repoRef, ctx.config);
|
|
61901
|
+
const { org, repo: repo2 } = parseOrgRepo(repoRef, ctx.config);
|
|
61523
61902
|
const c = ctx.colors;
|
|
61524
61903
|
const showIndexedFields = flags["indexed-fields"] === true;
|
|
61525
61904
|
const [repoInfo, license, shapesPage, stats, indexedFields] = await Promise.all([
|
|
61526
|
-
ctx.client.repo.get(org,
|
|
61527
|
-
ctx.client.repo.getLicense(org,
|
|
61528
|
-
ctx.client.shape.list(org,
|
|
61529
|
-
ctx.client.repo.getStats(org,
|
|
61530
|
-
showIndexedFields ? ctx.client.repo.index.describe(org,
|
|
61905
|
+
ctx.client.repo.get(org, repo2),
|
|
61906
|
+
ctx.client.repo.getLicense(org, repo2),
|
|
61907
|
+
ctx.client.shape.list(org, repo2),
|
|
61908
|
+
ctx.client.repo.getStats(org, repo2),
|
|
61909
|
+
showIndexedFields ? ctx.client.repo.index.describe(org, repo2) : null
|
|
61531
61910
|
]);
|
|
61532
61911
|
const shapes = shapesPage.items;
|
|
61533
61912
|
const byShape = Object.fromEntries([
|
|
@@ -61545,7 +61924,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
|
|
|
61545
61924
|
} : null;
|
|
61546
61925
|
const payload = {
|
|
61547
61926
|
org,
|
|
61548
|
-
repo,
|
|
61927
|
+
repo: repo2,
|
|
61549
61928
|
description: repoInfo.description ?? null,
|
|
61550
61929
|
license,
|
|
61551
61930
|
counts: {
|
|
@@ -61567,7 +61946,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
|
|
|
61567
61946
|
...indexedFieldsPublic ? { indexedFields: indexedFieldsPublic } : {}
|
|
61568
61947
|
};
|
|
61569
61948
|
writeOutput(ctx, payload, () => {
|
|
61570
|
-
ctx.out(`${c.bold}${org}/${
|
|
61949
|
+
ctx.out(`${c.bold}${org}/${repo2}${c.reset}`);
|
|
61571
61950
|
if (repoInfo.description) {
|
|
61572
61951
|
ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.description)}`);
|
|
61573
61952
|
}
|
|
@@ -61695,12 +62074,12 @@ var handleRepoSearch = async (ctx, { flags, args }) => {
|
|
|
61695
62074
|
// ../../packages/warmhub-cli/src/domains/repo/view.ts
|
|
61696
62075
|
var handleView6 = async (ctx, { args }) => {
|
|
61697
62076
|
const repoRef = args[0];
|
|
61698
|
-
const { org, repo } = parseOrgRepo(repoRef, ctx.config);
|
|
62077
|
+
const { org, repo: repo2 } = parseOrgRepo(repoRef, ctx.config);
|
|
61699
62078
|
const c = ctx.colors;
|
|
61700
62079
|
const [repoInfo, stats, configureStats] = await Promise.all([
|
|
61701
|
-
ctx.client.repo.get(org,
|
|
61702
|
-
ctx.client.repo.getStats(org,
|
|
61703
|
-
ctx.client.repo.getConfigureStats(org,
|
|
62080
|
+
ctx.client.repo.get(org, repo2),
|
|
62081
|
+
ctx.client.repo.getStats(org, repo2),
|
|
62082
|
+
ctx.client.repo.getConfigureStats(org, repo2).catch((err) => {
|
|
61704
62083
|
if (err instanceof WarmHubError && (err.kind === "FORBIDDEN" || err.kind === "UNAUTHENTICATED")) {
|
|
61705
62084
|
return null;
|
|
61706
62085
|
}
|
|
@@ -61708,7 +62087,7 @@ var handleView6 = async (ctx, { args }) => {
|
|
|
61708
62087
|
})
|
|
61709
62088
|
]);
|
|
61710
62089
|
writeOutput(ctx, { ...repoInfo, stats, configureStats }, () => {
|
|
61711
|
-
ctx.out(`${c.bold}${org}/${
|
|
62090
|
+
ctx.out(`${c.bold}${org}/${repo2}${c.reset}`);
|
|
61712
62091
|
if (repoInfo.displayName && repoInfo.displayName !== repoInfo.name) {
|
|
61713
62092
|
ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.displayName)}`);
|
|
61714
62093
|
}
|
|
@@ -61730,7 +62109,7 @@ var handleVisibility = async (ctx, { args }) => {
|
|
|
61730
62109
|
if (!orgRepo || !newVisibility || !orgRepo.includes("/") || newVisibility !== "public" && newVisibility !== "private") {
|
|
61731
62110
|
usageError("Usage: wh repo visibility <org/repo> <public|private>", "wh repo visibility myorg/myrepo public");
|
|
61732
62111
|
}
|
|
61733
|
-
const parsed =
|
|
62112
|
+
const parsed = parseRepoSlug(orgRepo);
|
|
61734
62113
|
if (!parsed) {
|
|
61735
62114
|
usageError("Usage: wh repo visibility <org/repo> <public|private>", "wh repo visibility myorg/myrepo public");
|
|
61736
62115
|
}
|
|
@@ -61752,14 +62131,14 @@ var REPO_DOMAIN = defineDomain({
|
|
|
61752
62131
|
prime: true,
|
|
61753
62132
|
summary: "Create a new repo",
|
|
61754
62133
|
args: "<org/name>",
|
|
61755
|
-
flags:
|
|
62134
|
+
flags: createFlags7,
|
|
61756
62135
|
examples: [
|
|
61757
62136
|
"wh repo create myorg/myrepo",
|
|
61758
62137
|
'wh repo create myorg/myrepo -d "My repo"',
|
|
61759
62138
|
'wh repo create myorg/myrepo --display-name "My Repo"',
|
|
61760
62139
|
'wh repo create myorg/myrepo --visibility private -d "Private repo"'
|
|
61761
62140
|
],
|
|
61762
|
-
handler:
|
|
62141
|
+
handler: handleCreate6
|
|
61763
62142
|
},
|
|
61764
62143
|
list: {
|
|
61765
62144
|
prime: true,
|
|
@@ -61771,7 +62150,7 @@ var REPO_DOMAIN = defineDomain({
|
|
|
61771
62150
|
"wh repo list myorg",
|
|
61772
62151
|
"wh repo list myorg --include-archived"
|
|
61773
62152
|
],
|
|
61774
|
-
handler:
|
|
62153
|
+
handler: handleList6
|
|
61775
62154
|
},
|
|
61776
62155
|
search: {
|
|
61777
62156
|
prime: true,
|
|
@@ -61898,7 +62277,7 @@ var handleHistory3 = async (ctx, { flags, args }) => {
|
|
|
61898
62277
|
if (!shapeName) {
|
|
61899
62278
|
usageError("Usage: wh shape history <name>", "wh shape history Location");
|
|
61900
62279
|
}
|
|
61901
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62280
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
61902
62281
|
const limit = flags.limit;
|
|
61903
62282
|
const cursor = flags.cursor;
|
|
61904
62283
|
const all = flags.all;
|
|
@@ -61914,7 +62293,7 @@ var handleHistory3 = async (ctx, { flags, args }) => {
|
|
|
61914
62293
|
if (ctx.liveMode) {
|
|
61915
62294
|
await runLive({
|
|
61916
62295
|
apiUrl: ctx.config.apiUrl,
|
|
61917
|
-
poll: (c) => c.shape.history(org,
|
|
62296
|
+
poll: (c) => c.shape.history(org, repo2, bareName, {
|
|
61918
62297
|
includeRetracted,
|
|
61919
62298
|
limit: pageLimit,
|
|
61920
62299
|
cursor
|
|
@@ -61929,6 +62308,7 @@ var handleHistory3 = async (ctx, { flags, args }) => {
|
|
|
61929
62308
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
61930
62309
|
functionLogs: ctx.functionLogMode,
|
|
61931
62310
|
profile: ctx.profile,
|
|
62311
|
+
clientFlags: ctx.clientFlags,
|
|
61932
62312
|
signal: ctx.signal
|
|
61933
62313
|
});
|
|
61934
62314
|
return;
|
|
@@ -61938,7 +62318,7 @@ var handleHistory3 = async (ctx, { flags, args }) => {
|
|
|
61938
62318
|
let thing;
|
|
61939
62319
|
let nextCursor;
|
|
61940
62320
|
do {
|
|
61941
|
-
const page = await ctx.client.shape.history(org,
|
|
62321
|
+
const page = await ctx.client.shape.history(org, repo2, bareName, {
|
|
61942
62322
|
includeRetracted,
|
|
61943
62323
|
limit: pageLimit,
|
|
61944
62324
|
cursor: next
|
|
@@ -61960,7 +62340,7 @@ var handleHistory3 = async (ctx, { flags, args }) => {
|
|
|
61960
62340
|
};
|
|
61961
62341
|
|
|
61962
62342
|
// ../../packages/warmhub-cli/src/domains/shape/list.ts
|
|
61963
|
-
var
|
|
62343
|
+
var listFlags5 = {
|
|
61964
62344
|
match: flag.string({ description: "Filter by name glob pattern" }),
|
|
61965
62345
|
component: flag.string({
|
|
61966
62346
|
description: "Filter to shapes owned by this component (Org/Name ref)"
|
|
@@ -61972,15 +62352,15 @@ var listFlags4 = {
|
|
|
61972
62352
|
description: "Include retracted shapes"
|
|
61973
62353
|
})
|
|
61974
62354
|
};
|
|
61975
|
-
var
|
|
61976
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62355
|
+
var handleList7 = async (ctx, { flags }) => {
|
|
62356
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
61977
62357
|
const c = ctx.colors;
|
|
61978
62358
|
const match = flags.match;
|
|
61979
62359
|
const componentRef = flags.component;
|
|
61980
62360
|
const excludeComponents = !!flags["exclude-components"];
|
|
61981
62361
|
const includeRetracted = flags["include-retracted"];
|
|
61982
62362
|
validateComponentFilters(componentRef, excludeComponents, "wh shape list --component acme/veritas", "wh shape list --exclude-components");
|
|
61983
|
-
const result = await ctx.client.shape.list(org,
|
|
62363
|
+
const result = await ctx.client.shape.list(org, repo2, {
|
|
61984
62364
|
match,
|
|
61985
62365
|
componentRef,
|
|
61986
62366
|
excludeComponents,
|
|
@@ -61992,7 +62372,7 @@ var handleList6 = async (ctx, { flags }) => {
|
|
|
61992
62372
|
ctx.status(`${c.dim}No shapes registered${c.reset}`);
|
|
61993
62373
|
return;
|
|
61994
62374
|
}
|
|
61995
|
-
ctx.out(`${c.bold}Shapes${c.reset} ${c.cyan}${org}/${
|
|
62375
|
+
ctx.out(`${c.bold}Shapes${c.reset} ${c.cyan}${org}/${repo2}${c.reset}`);
|
|
61996
62376
|
for (const item of items) {
|
|
61997
62377
|
const shape = item;
|
|
61998
62378
|
const name = shape.name;
|
|
@@ -62036,9 +62416,9 @@ var handleView7 = async (ctx, { flags, args }) => {
|
|
|
62036
62416
|
if (!shapeName) {
|
|
62037
62417
|
usageError("Usage: wh shape view <name>", "wh shape view location");
|
|
62038
62418
|
}
|
|
62039
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62419
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62040
62420
|
const c = ctx.colors;
|
|
62041
|
-
const result = await ctx.client.shape.get(org,
|
|
62421
|
+
const result = await ctx.client.shape.get(org, repo2, shapeName, {
|
|
62042
62422
|
includeRetracted: flags["include-retracted"]
|
|
62043
62423
|
});
|
|
62044
62424
|
writeOutput(ctx, result, () => {
|
|
@@ -62075,7 +62455,7 @@ var handleView7 = async (ctx, { flags, args }) => {
|
|
|
62075
62455
|
var fieldsFileFlag = flag.string({
|
|
62076
62456
|
description: "read fields from a JSON object file (portable alternative to inline --fields)"
|
|
62077
62457
|
});
|
|
62078
|
-
var
|
|
62458
|
+
var createFlags8 = {
|
|
62079
62459
|
"event-request-id": operationEventRequestIdFlag,
|
|
62080
62460
|
fields: flag.string({ description: FIELDS_FLAG_DESCRIPTION }),
|
|
62081
62461
|
file: fieldsFileFlag,
|
|
@@ -62098,9 +62478,8 @@ var renameFlags3 = {
|
|
|
62098
62478
|
"event-request-id": operationEventRequestIdFlag
|
|
62099
62479
|
};
|
|
62100
62480
|
function shapeChangeFromReceipt(receipt) {
|
|
62101
|
-
|
|
62102
|
-
|
|
62103
|
-
if (!entry || entry.operation === "rename" || !("version" in entry) || typeof entry.version !== "number" || !("dataHash" in entry) || typeof entry.dataHash !== "string") {
|
|
62481
|
+
const entry = requireSingleOpSuccess(receipt);
|
|
62482
|
+
if (entry.operation === "rename" || !("version" in entry) || typeof entry.version !== "number" || !("dataHash" in entry) || typeof entry.dataHash !== "string") {
|
|
62104
62483
|
throw new Error("Shape mutation returned no version-bearing operation");
|
|
62105
62484
|
}
|
|
62106
62485
|
return {
|
|
@@ -62158,7 +62537,7 @@ var retractFlags3 = {
|
|
|
62158
62537
|
description: "Committer wref (shape or shaped thing; e.g. Agent/bot-1)"
|
|
62159
62538
|
})
|
|
62160
62539
|
};
|
|
62161
|
-
var
|
|
62540
|
+
var handleCreate7 = async (ctx, { flags, args }) => {
|
|
62162
62541
|
const shapeName = args[0];
|
|
62163
62542
|
if (!shapeName) {
|
|
62164
62543
|
usageError("Usage: wh shape create <name> (--fields '<json>' | --file <path>)", `wh shape create Location --fields '{"x":"number","y":"number"}'`, "wh shape create Location --file fields.json", `wh shape create Tags --fields '{"labels":["string"],"scores":["number"]}'`, `wh shape create Player --fields '{"name":"string","position":{"x":"number","y":"number"}}'`, `wh shape create Review --fields '{"score":"number","reason?":"string"}'`);
|
|
@@ -62170,14 +62549,14 @@ var handleCreate6 = async (ctx, { flags, args }) => {
|
|
|
62170
62549
|
missingMessage: "Usage: wh shape create <name> (--fields '<json>' | --file <path>)",
|
|
62171
62550
|
example: "wh shape create Location --file fields.json"
|
|
62172
62551
|
});
|
|
62173
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62552
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62174
62553
|
const c = ctx.colors;
|
|
62175
62554
|
const eventRequestId = flags["event-request-id"] ?? createOperationEventRequestId();
|
|
62176
62555
|
ctx.status(`Operation event request: ${eventRequestId}`);
|
|
62177
62556
|
const opts = { eventRequestId };
|
|
62178
62557
|
if (flags.description !== undefined)
|
|
62179
62558
|
opts.description = flags.description;
|
|
62180
|
-
const response = await ctx.client.shape.create(org,
|
|
62559
|
+
const response = await ctx.client.shape.create(org, repo2, shapeName, fields, opts);
|
|
62181
62560
|
const result = shapeChangeFromReceipt(response.receipt);
|
|
62182
62561
|
writeOutput(ctx, response, () => {
|
|
62183
62562
|
if (result.operation === "noop") {
|
|
@@ -62199,9 +62578,9 @@ var handleRevise3 = async (ctx, { flags, args }) => {
|
|
|
62199
62578
|
missingMessage: "Usage: wh shape revise <name> (--fields '<json>' | --file <path>)",
|
|
62200
62579
|
example: "wh shape revise Location --file fields.json"
|
|
62201
62580
|
});
|
|
62202
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62581
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62203
62582
|
const c = ctx.colors;
|
|
62204
|
-
const previousShape = flags["show-diff"] ? await ctx.client.shape.get(org,
|
|
62583
|
+
const previousShape = flags["show-diff"] ? await ctx.client.shape.get(org, repo2, shapeName) : undefined;
|
|
62205
62584
|
const previousVersion = previousShape?.version?.version;
|
|
62206
62585
|
const previousFields = previousShape ? fieldsFromShapeData(previousShape.version?.data) : undefined;
|
|
62207
62586
|
const eventRequestId = flags["event-request-id"] ?? createOperationEventRequestId();
|
|
@@ -62209,7 +62588,7 @@ var handleRevise3 = async (ctx, { flags, args }) => {
|
|
|
62209
62588
|
const opts = { eventRequestId };
|
|
62210
62589
|
if (flags.description !== undefined)
|
|
62211
62590
|
opts.description = flags.description;
|
|
62212
|
-
const response = await ctx.client.shape.revise(org,
|
|
62591
|
+
const response = await ctx.client.shape.revise(org, repo2, shapeName, newFields, opts);
|
|
62213
62592
|
const result = shapeChangeFromReceipt(response.receipt);
|
|
62214
62593
|
let diff;
|
|
62215
62594
|
if (previousFields) {
|
|
@@ -62217,7 +62596,7 @@ var handleRevise3 = async (ctx, { flags, args }) => {
|
|
|
62217
62596
|
if (result.operation === "noop") {
|
|
62218
62597
|
committedBaseFields = newFields;
|
|
62219
62598
|
} else if (previousVersion !== result.version - 1) {
|
|
62220
|
-
const committedBase = await ctx.client.thing.get(org,
|
|
62599
|
+
const committedBase = await ctx.client.thing.get(org, repo2, shapeName, result.version - 1);
|
|
62221
62600
|
committedBaseFields = fieldsFromShapeData(committedBase.data);
|
|
62222
62601
|
}
|
|
62223
62602
|
diff = diffShapeFields(committedBaseFields, newFields);
|
|
@@ -62237,10 +62616,10 @@ var handleRetract2 = async (ctx, { flags, args }) => {
|
|
|
62237
62616
|
if (!shapeName) {
|
|
62238
62617
|
usageError("Usage: wh shape retract <name> [--expected-version <n>]", "wh shape retract Location");
|
|
62239
62618
|
}
|
|
62240
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62619
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62241
62620
|
const expectedVersion = parsePositiveIntFlag(flags["expected-version"], "--expected-version", "wh shape retract Location --expected-version 3");
|
|
62242
62621
|
const c = ctx.colors;
|
|
62243
|
-
const commitResult = await ctx.client.commit.apply(org,
|
|
62622
|
+
const commitResult = await ctx.client.commit.apply(org, repo2, flags.message ?? `retract shape ${shapeName}`, [
|
|
62244
62623
|
{
|
|
62245
62624
|
operation: "retract",
|
|
62246
62625
|
kind: "shape",
|
|
@@ -62249,10 +62628,7 @@ var handleRetract2 = async (ctx, { flags, args }) => {
|
|
|
62249
62628
|
...expectedVersion !== undefined ? { expectedVersion } : {}
|
|
62250
62629
|
}
|
|
62251
62630
|
], { committer: flags.committer });
|
|
62252
|
-
|
|
62253
|
-
if (!result)
|
|
62254
|
-
throw new Error("Commit returned no operation result");
|
|
62255
|
-
assertSingleOpSuccess(commitResult);
|
|
62631
|
+
requireSingleOpSuccess(commitResult);
|
|
62256
62632
|
writeOutput(ctx, commitResult, () => {
|
|
62257
62633
|
renderCommitterEcho(ctx.out, c, flags.committer);
|
|
62258
62634
|
ctx.out(`${c.red}Retracted${c.reset} ${c.magenta}${shapeName}${c.reset}`);
|
|
@@ -62264,11 +62640,11 @@ var handleShapeRename = async (ctx, { flags, args }) => {
|
|
|
62264
62640
|
if (!oldName || !newName) {
|
|
62265
62641
|
usageError("Usage: wh shape rename <oldName> <newName>", "wh shape rename Location Place");
|
|
62266
62642
|
}
|
|
62267
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62643
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
62268
62644
|
const c = ctx.colors;
|
|
62269
62645
|
const eventRequestId = flags["event-request-id"] ?? createOperationEventRequestId();
|
|
62270
62646
|
ctx.status(`Operation event request: ${eventRequestId}`);
|
|
62271
|
-
const response = await ctx.client.shape.rename(org,
|
|
62647
|
+
const response = await ctx.client.shape.rename(org, repo2, oldName, newName, {
|
|
62272
62648
|
eventRequestId
|
|
62273
62649
|
});
|
|
62274
62650
|
writeOutput(ctx, response, () => {
|
|
@@ -62286,9 +62662,9 @@ var SHAPE_DOMAIN = defineDomain({
|
|
|
62286
62662
|
prime: true,
|
|
62287
62663
|
summary: "List all shapes",
|
|
62288
62664
|
args: "",
|
|
62289
|
-
flags:
|
|
62665
|
+
flags: listFlags5,
|
|
62290
62666
|
examples: ["wh shape list", 'wh shape list --match "Game*"'],
|
|
62291
|
-
handler:
|
|
62667
|
+
handler: handleList7
|
|
62292
62668
|
},
|
|
62293
62669
|
view: {
|
|
62294
62670
|
prime: true,
|
|
@@ -62315,14 +62691,14 @@ var SHAPE_DOMAIN = defineDomain({
|
|
|
62315
62691
|
prime: true,
|
|
62316
62692
|
summary: "Create a new shape",
|
|
62317
62693
|
args: "<name>",
|
|
62318
|
-
flags:
|
|
62694
|
+
flags: createFlags8,
|
|
62319
62695
|
examples: [
|
|
62320
62696
|
`wh shape create GameConfig --repo org/repo --fields '{"x":"number"}'`,
|
|
62321
62697
|
"wh shape create GameConfig --repo org/repo --file fields.json",
|
|
62322
62698
|
`wh shape create Player --fields '{"name":{"type":"string","minLength":1,"maxLength":40},"role":{"type":"string","enum":["dm","player"]},"level":{"type":"number","minimum":1,"integer":true},"home":{"type":"wref","shape":"Location"},"tags":{"type":"array","items":"string","minItems":1}}'`
|
|
62323
62699
|
],
|
|
62324
62700
|
notes: [...FIELD_CONSTRAINTS_NOTES],
|
|
62325
|
-
handler:
|
|
62701
|
+
handler: handleCreate7
|
|
62326
62702
|
},
|
|
62327
62703
|
retract: {
|
|
62328
62704
|
prime: true,
|
|
@@ -62370,7 +62746,7 @@ var SHAPE_DOMAIN = defineDomain({
|
|
|
62370
62746
|
var orgScopeFlag = flag.string({
|
|
62371
62747
|
description: `org slug for org-scoped events (${ORG_SCOPED_EVENT_TYPES.join(", ")}); use instead of --repo`
|
|
62372
62748
|
});
|
|
62373
|
-
var
|
|
62749
|
+
var createFlags9 = {
|
|
62374
62750
|
on: flag.string({
|
|
62375
62751
|
description: "Shape to subscribe to"
|
|
62376
62752
|
}),
|
|
@@ -62408,27 +62784,27 @@ var createFlags8 = {
|
|
|
62408
62784
|
})
|
|
62409
62785
|
};
|
|
62410
62786
|
var updateFlags4 = {
|
|
62411
|
-
on:
|
|
62412
|
-
kind:
|
|
62413
|
-
filter:
|
|
62414
|
-
cronspec:
|
|
62415
|
-
timezone:
|
|
62787
|
+
on: createFlags9.on,
|
|
62788
|
+
kind: createFlags9.kind,
|
|
62789
|
+
filter: createFlags9.filter,
|
|
62790
|
+
cronspec: createFlags9.cronspec,
|
|
62791
|
+
timezone: createFlags9.timezone,
|
|
62416
62792
|
"webhook-url": flag.string({
|
|
62417
62793
|
description: "Webhook destination URL"
|
|
62418
62794
|
}),
|
|
62419
|
-
url:
|
|
62420
|
-
"fallback-webhook-url":
|
|
62795
|
+
url: createFlags9.url,
|
|
62796
|
+
"fallback-webhook-url": createFlags9["fallback-webhook-url"],
|
|
62421
62797
|
"clear-fallback-webhook-url": flag.boolean({
|
|
62422
62798
|
description: "Clear the fallback webhook URL"
|
|
62423
62799
|
}),
|
|
62424
|
-
"allow-trace-reentry":
|
|
62425
|
-
name:
|
|
62800
|
+
"allow-trace-reentry": createFlags9["allow-trace-reentry"],
|
|
62801
|
+
name: createFlags9.name,
|
|
62426
62802
|
org: orgScopeFlag
|
|
62427
62803
|
};
|
|
62428
62804
|
var logFlags = {
|
|
62429
62805
|
limit: flag.number({ description: "Max deliveries to return" })
|
|
62430
62806
|
};
|
|
62431
|
-
var
|
|
62807
|
+
var listFlags6 = {
|
|
62432
62808
|
limit: flag.number({ description: "Max subscriptions to return" }),
|
|
62433
62809
|
org: orgScopeFlag
|
|
62434
62810
|
};
|
|
@@ -62499,9 +62875,9 @@ function parseEventType(raw, _usage, example) {
|
|
|
62499
62875
|
if (raw === undefined) {
|
|
62500
62876
|
return COMMIT_EVENT_TYPE;
|
|
62501
62877
|
}
|
|
62502
|
-
|
|
62503
|
-
|
|
62504
|
-
|
|
62878
|
+
const parsed = SUBSCRIBABLE_EVENT_TYPES.find((candidate) => candidate === raw);
|
|
62879
|
+
if (parsed)
|
|
62880
|
+
return parsed;
|
|
62505
62881
|
usageError(`--event must be one of: ${SUBSCRIBABLE_EVENT_TYPES.join(", ")}`, example);
|
|
62506
62882
|
}
|
|
62507
62883
|
function buildSubscriptionPatchArgs(flags, usage, example) {
|
|
@@ -62561,8 +62937,8 @@ function resolveSubScope(ctx, flags, correctiveExample) {
|
|
|
62561
62937
|
if (typeof flags.org === "string" && flags.org) {
|
|
62562
62938
|
return { orgName: flags.org };
|
|
62563
62939
|
}
|
|
62564
|
-
const { org, repo } = resolveRepoContext(ctx);
|
|
62565
|
-
return { orgName: org, repoName:
|
|
62940
|
+
const { org, repo: repo2 } = resolveRepoContext(ctx);
|
|
62941
|
+
return { orgName: org, repoName: repo2 };
|
|
62566
62942
|
}
|
|
62567
62943
|
function rejectConflictingSubScope(ctx, flags, correctiveExample) {
|
|
62568
62944
|
if (flags.org !== undefined && ctx.invocation.flags.repo !== undefined) {
|
|
@@ -62574,7 +62950,7 @@ function scopeLabel(scope) {
|
|
|
62574
62950
|
}
|
|
62575
62951
|
|
|
62576
62952
|
// ../../packages/warmhub-cli/src/domains/sub/handlers-create.ts
|
|
62577
|
-
var
|
|
62953
|
+
var handleCreate8 = async (ctx, { flags, args }) => {
|
|
62578
62954
|
const name = args[0] ?? flags.name;
|
|
62579
62955
|
const usage = `Usage: wh sub create <name> (--repo org/repo | --org org) [--event ${SUBSCRIBABLE_EVENT_TYPES.join("|")}] [options]`;
|
|
62580
62956
|
const example = `wh sub create signal-hook --repo myorg/myrepo --on Signal --filter '{"shape":"Signal"}' --webhook-url https://example.com/hook`;
|
|
@@ -62618,12 +62994,12 @@ var handleCreate7 = async (ctx, { flags, args }) => {
|
|
|
62618
62994
|
if (flags.org !== undefined) {
|
|
62619
62995
|
usageError(`Flag --org cannot be used with repo-scoped ${eventType} subscriptions`, `wh sub create repo-hook --repo myorg/myrepo --event ${eventType} --webhook-url https://example.com/hook`);
|
|
62620
62996
|
}
|
|
62621
|
-
const { org, repo } = resolveRepoContext(ctx);
|
|
62997
|
+
const { org, repo: repo2 } = resolveRepoContext(ctx);
|
|
62622
62998
|
if (eventType !== "commit") {
|
|
62623
62999
|
rejectCommitOnlyFlags(flags, eventType);
|
|
62624
63000
|
const result2 = await ctx.client.subscription.create({
|
|
62625
63001
|
orgName: org,
|
|
62626
|
-
repoName:
|
|
63002
|
+
repoName: repo2,
|
|
62627
63003
|
name,
|
|
62628
63004
|
eventType,
|
|
62629
63005
|
kind,
|
|
@@ -62632,7 +63008,7 @@ var handleCreate7 = async (ctx, { flags, args }) => {
|
|
|
62632
63008
|
});
|
|
62633
63009
|
writeOutput(ctx, result2, () => {
|
|
62634
63010
|
const c = ctx.colors;
|
|
62635
|
-
ctx.status(`${c.green}Created subscription${c.reset} ${c.cyan}${name}${c.reset} on ${c.cyan}${org}/${
|
|
63011
|
+
ctx.status(`${c.green}Created subscription${c.reset} ${c.cyan}${name}${c.reset} on ${c.cyan}${org}/${repo2}${c.reset} (${eventType})`);
|
|
62636
63012
|
});
|
|
62637
63013
|
return;
|
|
62638
63014
|
}
|
|
@@ -62640,7 +63016,7 @@ var handleCreate7 = async (ctx, { flags, args }) => {
|
|
|
62640
63016
|
const sourceRepoRef = typeof flags.source === "string" ? flags.source : undefined;
|
|
62641
63017
|
const result = await ctx.client.subscription.create({
|
|
62642
63018
|
orgName: org,
|
|
62643
|
-
repoName:
|
|
63019
|
+
repoName: repo2,
|
|
62644
63020
|
name,
|
|
62645
63021
|
webhookUrl,
|
|
62646
63022
|
fallbackWebhookUrl: createArgs.fallbackWebhookUrl,
|
|
@@ -62652,7 +63028,7 @@ var handleCreate7 = async (ctx, { flags, args }) => {
|
|
|
62652
63028
|
});
|
|
62653
63029
|
writeOutput(ctx, result, () => {
|
|
62654
63030
|
const c = ctx.colors;
|
|
62655
|
-
ctx.status(`${c.green}Created subscription${c.reset} ${c.cyan}${name}${c.reset} on ${c.cyan}${org}/${
|
|
63031
|
+
ctx.status(`${c.green}Created subscription${c.reset} ${c.cyan}${name}${c.reset} on ${c.cyan}${org}/${repo2}${c.reset}`);
|
|
62656
63032
|
});
|
|
62657
63033
|
};
|
|
62658
63034
|
var handleUpdate4 = async (ctx, { flags, args }) => {
|
|
@@ -62828,7 +63204,7 @@ function renderSubscriptionLog(out, statusOut, c, subscriptionName, result) {
|
|
|
62828
63204
|
}
|
|
62829
63205
|
|
|
62830
63206
|
// ../../packages/warmhub-cli/src/domains/sub/handlers-management.ts
|
|
62831
|
-
var
|
|
63207
|
+
var handleList8 = async (ctx, { flags }) => {
|
|
62832
63208
|
const scope = resolveSubScope(ctx, flags, "wh sub list --repo myorg/myrepo");
|
|
62833
63209
|
const label = scopeLabel(scope);
|
|
62834
63210
|
const all = await ctx.client.subscription.list(scope);
|
|
@@ -62928,11 +63304,11 @@ var handleLog = async (ctx, { flags, args }) => {
|
|
|
62928
63304
|
usageError("Usage: wh sub log <name> [--repo org/repo]", "wh sub log my-sub --repo myorg/myrepo");
|
|
62929
63305
|
}
|
|
62930
63306
|
const org = scope.orgName;
|
|
62931
|
-
const
|
|
63307
|
+
const repo2 = scope.repoName;
|
|
62932
63308
|
if (ctx.liveMode) {
|
|
62933
63309
|
await runLive({
|
|
62934
63310
|
apiUrl: ctx.config.apiUrl,
|
|
62935
|
-
poll: (c) => c.action.liveFeed(org,
|
|
63311
|
+
poll: (c) => c.action.liveFeed(org, repo2, name, { limit: flags.limit }),
|
|
62936
63312
|
render: (result2) => renderSubscriptionLog(ctx.out, ctx.status, ctx.colors, name, result2),
|
|
62937
63313
|
out: ctx.out,
|
|
62938
63314
|
err: ctx.err,
|
|
@@ -62943,11 +63319,12 @@ var handleLog = async (ctx, { flags, args }) => {
|
|
|
62943
63319
|
inactivityTimeoutMs: ctx.inactivityTimeoutMs,
|
|
62944
63320
|
functionLogs: ctx.functionLogMode,
|
|
62945
63321
|
profile: ctx.profile,
|
|
63322
|
+
clientFlags: ctx.clientFlags,
|
|
62946
63323
|
signal: ctx.signal
|
|
62947
63324
|
});
|
|
62948
63325
|
return;
|
|
62949
63326
|
}
|
|
62950
|
-
const result = await ctx.client.action.liveFeed(org,
|
|
63327
|
+
const result = await ctx.client.action.liveFeed(org, repo2, name, {
|
|
62951
63328
|
limit: flags.limit
|
|
62952
63329
|
});
|
|
62953
63330
|
writeOutput(ctx, result, () => renderSubscriptionLog(ctx.out, ctx.status, ctx.colors, name, result));
|
|
@@ -62957,8 +63334,8 @@ var handleAttempts = async (ctx, { args }) => {
|
|
|
62957
63334
|
if (!runIdArg) {
|
|
62958
63335
|
usageError("Usage: wh sub attempts <runId> [--repo org/repo]", "wh sub attempts 019d90f0-1111-7000-8000-000000000001 --repo myorg/myrepo");
|
|
62959
63336
|
}
|
|
62960
|
-
const { org, repo } = resolveRepoContext(ctx);
|
|
62961
|
-
const result = await ctx.client.action.getRunAttempts(org,
|
|
63337
|
+
const { org, repo: repo2 } = resolveRepoContext(ctx);
|
|
63338
|
+
const result = await ctx.client.action.getRunAttempts(org, repo2, runIdArg);
|
|
62962
63339
|
writeOutput(ctx, result, () => {
|
|
62963
63340
|
const c = ctx.colors;
|
|
62964
63341
|
if (!result.length) {
|
|
@@ -62992,7 +63369,7 @@ var SUB_DOMAIN = defineDomain({
|
|
|
62992
63369
|
prime: true,
|
|
62993
63370
|
summary: "Create a subscription",
|
|
62994
63371
|
args: "<name>",
|
|
62995
|
-
flags:
|
|
63372
|
+
flags: createFlags9,
|
|
62996
63373
|
examples: [
|
|
62997
63374
|
"# Create a webhook subscription for things of a shape",
|
|
62998
63375
|
` $ wh sub create signal-hook --repo myorg/myrepo --on Signal --kind webhook --filter '{"shape":"Signal"}' --webhook-url https://example.com/hook`,
|
|
@@ -63018,7 +63395,7 @@ var SUB_DOMAIN = defineDomain({
|
|
|
63018
63395
|
' $ echo "tok_secret" | wh credential set webhook-keys WEBHOOK_BEARER_TOKEN --repo myorg/myrepo',
|
|
63019
63396
|
" $ wh sub bind signal-hook --credentials webhook-keys --repo myorg/myrepo"
|
|
63020
63397
|
],
|
|
63021
|
-
handler:
|
|
63398
|
+
handler: handleCreate8
|
|
63022
63399
|
},
|
|
63023
63400
|
update: {
|
|
63024
63401
|
status: "live",
|
|
@@ -63053,14 +63430,14 @@ var SUB_DOMAIN = defineDomain({
|
|
|
63053
63430
|
prime: true,
|
|
63054
63431
|
summary: "List all subscriptions",
|
|
63055
63432
|
args: "",
|
|
63056
|
-
flags:
|
|
63433
|
+
flags: listFlags6,
|
|
63057
63434
|
examples: [
|
|
63058
63435
|
"wh sub list --repo myorg/myrepo",
|
|
63059
63436
|
"wh sub list --limit 10",
|
|
63060
63437
|
"# Org-scoped metadata subscriptions",
|
|
63061
63438
|
" $ wh sub list --org myorg"
|
|
63062
63439
|
],
|
|
63063
|
-
handler:
|
|
63440
|
+
handler: handleList8
|
|
63064
63441
|
},
|
|
63065
63442
|
log: {
|
|
63066
63443
|
status: "live",
|
|
@@ -63239,7 +63616,7 @@ function tokenStatus(pat) {
|
|
|
63239
63616
|
return "expired";
|
|
63240
63617
|
return "active";
|
|
63241
63618
|
}
|
|
63242
|
-
var
|
|
63619
|
+
var createFlags10 = {
|
|
63243
63620
|
name: flag.string({ short: "n", description: "Token name" }),
|
|
63244
63621
|
scope: flag.string({
|
|
63245
63622
|
short: "s",
|
|
@@ -63260,7 +63637,7 @@ var createFlags9 = {
|
|
|
63260
63637
|
var nameFlags = {
|
|
63261
63638
|
name: flag.string({ short: "n", description: "Token name" })
|
|
63262
63639
|
};
|
|
63263
|
-
var
|
|
63640
|
+
var listFlags7 = {
|
|
63264
63641
|
all: flag.boolean({
|
|
63265
63642
|
short: "a",
|
|
63266
63643
|
description: "Include expired and revoked tokens (default: active only)"
|
|
@@ -63298,7 +63675,7 @@ function formatScopes(scopes) {
|
|
|
63298
63675
|
return `${base}${formatAllowedMatches(e.allowedMatches)}`;
|
|
63299
63676
|
}).join(" ");
|
|
63300
63677
|
}
|
|
63301
|
-
var
|
|
63678
|
+
var handleCreate9 = async (ctx, { flags }) => {
|
|
63302
63679
|
if (!flags.name) {
|
|
63303
63680
|
usageError("Usage: wh token create --name <name> [flags]", "wh token create --name ci-bot --scope myorg/myrepo=role:editor --expires 90d");
|
|
63304
63681
|
}
|
|
@@ -63347,7 +63724,7 @@ var handleCreate8 = async (ctx, { flags }) => {
|
|
|
63347
63724
|
ctx.status(` expires: ${new Date(result.expiresAt).toISOString().slice(0, 16)}`);
|
|
63348
63725
|
});
|
|
63349
63726
|
};
|
|
63350
|
-
var
|
|
63727
|
+
var handleList9 = async (ctx, { flags }) => {
|
|
63351
63728
|
const c = ctx.colors;
|
|
63352
63729
|
const items = await ctx.client.token.list({ includeInactive: flags.all });
|
|
63353
63730
|
writePageOutput(ctx, items, { limit: items.length, nextCursor: null }, () => {
|
|
@@ -63367,7 +63744,7 @@ var handleList8 = async (ctx, { flags }) => {
|
|
|
63367
63744
|
}
|
|
63368
63745
|
});
|
|
63369
63746
|
};
|
|
63370
|
-
var
|
|
63747
|
+
var handleGet2 = async (ctx, { flags }) => {
|
|
63371
63748
|
if (!flags.name) {
|
|
63372
63749
|
usageError("Usage: wh token get --name <name>", "wh token get --name ci-bot");
|
|
63373
63750
|
}
|
|
@@ -63391,7 +63768,7 @@ var handleGet = async (ctx, { flags }) => {
|
|
|
63391
63768
|
}
|
|
63392
63769
|
});
|
|
63393
63770
|
};
|
|
63394
|
-
var
|
|
63771
|
+
var handleRevoke3 = async (ctx, { flags }) => {
|
|
63395
63772
|
if (!flags.name) {
|
|
63396
63773
|
usageError("Usage: wh token revoke --name <name>", "wh token revoke --name ci-bot");
|
|
63397
63774
|
}
|
|
@@ -63409,7 +63786,7 @@ var TOKEN_DOMAIN = defineDomain({
|
|
|
63409
63786
|
create: {
|
|
63410
63787
|
summary: "Create a new personal access token",
|
|
63411
63788
|
args: "",
|
|
63412
|
-
flags:
|
|
63789
|
+
flags: createFlags10,
|
|
63413
63790
|
examples: [
|
|
63414
63791
|
"wh token create --name ci-bot --scope myorg/myrepo=repo:read,repo:write",
|
|
63415
63792
|
"wh token create --name ci-bot --scope myorg/myrepo=role:editor",
|
|
@@ -63418,32 +63795,32 @@ var TOKEN_DOMAIN = defineDomain({
|
|
|
63418
63795
|
`wh token create --name scoped --scopes-json '[{"resource":"myorg/myrepo","permissions":["repo:read"],"allowedMatches":["Signal/*"]}]'`,
|
|
63419
63796
|
`wh token create --name global-reader --scopes-json '[{"permissions":["repo:read"]}]'`
|
|
63420
63797
|
],
|
|
63421
|
-
handler:
|
|
63798
|
+
handler: handleCreate9
|
|
63422
63799
|
},
|
|
63423
63800
|
list: {
|
|
63424
63801
|
summary: "List your personal access tokens (active by default)",
|
|
63425
63802
|
args: "",
|
|
63426
|
-
flags:
|
|
63803
|
+
flags: listFlags7,
|
|
63427
63804
|
examples: [
|
|
63428
63805
|
"wh token list",
|
|
63429
63806
|
"wh token list --all",
|
|
63430
63807
|
"wh token list --json"
|
|
63431
63808
|
],
|
|
63432
|
-
handler:
|
|
63809
|
+
handler: handleList9
|
|
63433
63810
|
},
|
|
63434
63811
|
get: {
|
|
63435
63812
|
summary: "View a token by name",
|
|
63436
63813
|
args: "",
|
|
63437
63814
|
flags: nameFlags,
|
|
63438
63815
|
examples: ["wh token get --name ci-bot"],
|
|
63439
|
-
handler:
|
|
63816
|
+
handler: handleGet2
|
|
63440
63817
|
},
|
|
63441
63818
|
revoke: {
|
|
63442
63819
|
summary: "Revoke a token by name",
|
|
63443
63820
|
args: "",
|
|
63444
63821
|
flags: nameFlags,
|
|
63445
63822
|
examples: ["wh token revoke --name ci-bot"],
|
|
63446
|
-
handler:
|
|
63823
|
+
handler: handleRevoke3
|
|
63447
63824
|
}
|
|
63448
63825
|
}
|
|
63449
63826
|
});
|
|
@@ -64069,14 +64446,14 @@ var handleUse = async (ctx, { args, flags }) => {
|
|
|
64069
64446
|
});
|
|
64070
64447
|
return;
|
|
64071
64448
|
}
|
|
64072
|
-
const
|
|
64073
|
-
if (
|
|
64449
|
+
const parsed = parseRepoSlug(repoArg);
|
|
64450
|
+
if (!parsed) {
|
|
64074
64451
|
throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid repo format "${repoArg}". Expected "org/repo" (exactly one slash).`, undefined, "Example: wh use myorg/myrepo");
|
|
64075
64452
|
}
|
|
64076
|
-
const
|
|
64453
|
+
const { org, repo: repo2 } = parsed;
|
|
64077
64454
|
const repoNotFoundMessage = `Repo "${repoArg}" not found`;
|
|
64078
64455
|
try {
|
|
64079
|
-
await ctx.client.repo.get(org,
|
|
64456
|
+
await ctx.client.repo.get(org, repo2);
|
|
64080
64457
|
} catch (e) {
|
|
64081
64458
|
if (!(e instanceof WarmHubError) || e.kind !== "NOT_FOUND" || e.errorCode !== "NOT_FOUND" || e.message !== repoNotFoundMessage) {
|
|
64082
64459
|
throw e;
|
|
@@ -64111,6 +64488,69 @@ var USE_DOMAIN = defineDomain({
|
|
|
64111
64488
|
handler: handleUse
|
|
64112
64489
|
});
|
|
64113
64490
|
|
|
64491
|
+
// ../../packages/warmhub-cli/src/domains/view.ts
|
|
64492
|
+
var evaluateFlags = {
|
|
64493
|
+
limit: flag.number({
|
|
64494
|
+
description: "Max results per page (default: 50, max: 500)"
|
|
64495
|
+
}),
|
|
64496
|
+
cursor: flag.string({ description: "Opaque pagination cursor" }),
|
|
64497
|
+
all: flag.boolean({ description: "Fetch all pages" })
|
|
64498
|
+
};
|
|
64499
|
+
var handleEvaluate = async (ctx, { args, flags }) => {
|
|
64500
|
+
const wref = args[0]?.trim();
|
|
64501
|
+
if (!wref) {
|
|
64502
|
+
usageError("Usage: wh view evaluate <wref> [--limit N] [--cursor TOKEN] [--all]", "wh view evaluate View/active-users --limit 50");
|
|
64503
|
+
}
|
|
64504
|
+
if (flags.cursor && !flags.limit) {
|
|
64505
|
+
usageError("Usage: wh view evaluate <wref> --limit N --cursor TOKEN", "wh view evaluate View/active-users --limit 50 --cursor <token>");
|
|
64506
|
+
}
|
|
64507
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
64508
|
+
const boundedLimit = Math.min(flags.limit ?? DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT);
|
|
64509
|
+
const pageLimit = flags.all ? Math.min(flags.limit ?? AUTO_PAGE_LIMIT, MAX_PAGE_LIMIT) : boundedLimit;
|
|
64510
|
+
if (flags.all) {
|
|
64511
|
+
const items = await ctx.client.view.evaluateAll(org, repo2, wref, {
|
|
64512
|
+
limit: pageLimit,
|
|
64513
|
+
cursor: flags.cursor
|
|
64514
|
+
});
|
|
64515
|
+
writePageOutput(ctx, items, { limit: pageLimit, nextCursor: null }, () => {
|
|
64516
|
+
ctx.out(`${ctx.colors.bold}View ${escapeTerminalTextForDisplay(wref)}${ctx.colors.reset}`);
|
|
64517
|
+
renderQueryResults(ctx.out, ctx.colors, { items });
|
|
64518
|
+
});
|
|
64519
|
+
return;
|
|
64520
|
+
}
|
|
64521
|
+
const result = await ctx.client.view.evaluate(org, repo2, wref, {
|
|
64522
|
+
limit: boundedLimit,
|
|
64523
|
+
cursor: flags.cursor
|
|
64524
|
+
});
|
|
64525
|
+
if (result.nextCursor) {
|
|
64526
|
+
emitPartialPageHint(ctx, result.items.length, result.nextCursor, boundedLimit);
|
|
64527
|
+
}
|
|
64528
|
+
writePageOutput(ctx, result.items, { limit: boundedLimit, nextCursor: result.nextCursor ?? null }, () => {
|
|
64529
|
+
const selected = `${result.view.wref}@v${result.view.version}`;
|
|
64530
|
+
ctx.out(`${ctx.colors.bold}View ${escapeTerminalTextForDisplay(selected)}${ctx.colors.reset}`);
|
|
64531
|
+
renderQueryResults(ctx.out, ctx.colors, result);
|
|
64532
|
+
});
|
|
64533
|
+
};
|
|
64534
|
+
var VIEW_DOMAIN = defineDomain({
|
|
64535
|
+
name: "view",
|
|
64536
|
+
summary: "Stored View operations",
|
|
64537
|
+
group: "resource",
|
|
64538
|
+
verbs: {
|
|
64539
|
+
evaluate: {
|
|
64540
|
+
prime: true,
|
|
64541
|
+
summary: "Evaluate a stored View against live repository results",
|
|
64542
|
+
args: "<wref>",
|
|
64543
|
+
flags: evaluateFlags,
|
|
64544
|
+
examples: [
|
|
64545
|
+
"wh view evaluate View/active-users",
|
|
64546
|
+
"wh view evaluate View/active-users@v3 --limit 50",
|
|
64547
|
+
"wh view evaluate View/active-users --all"
|
|
64548
|
+
],
|
|
64549
|
+
handler: handleEvaluate
|
|
64550
|
+
}
|
|
64551
|
+
}
|
|
64552
|
+
});
|
|
64553
|
+
|
|
64114
64554
|
// ../../packages/warmhub-cli/src/domains/index.ts
|
|
64115
64555
|
function registerAllDomains(registry3) {
|
|
64116
64556
|
registry3.register(AUTH_DOMAIN);
|
|
@@ -64133,6 +64573,8 @@ function registerAllDomains(registry3) {
|
|
|
64133
64573
|
registry3.register(TOKEN_DOMAIN);
|
|
64134
64574
|
registry3.register(COMPONENT_DOMAIN);
|
|
64135
64575
|
registry3.register(USE_DOMAIN);
|
|
64576
|
+
registry3.register(VIEW_DOMAIN);
|
|
64577
|
+
registry3.register(GRANT_DOMAIN);
|
|
64136
64578
|
}
|
|
64137
64579
|
|
|
64138
64580
|
// ../../packages/warmhub-cli/src/production-domain-registry.ts
|
|
@@ -64332,8 +64774,8 @@ async function printRootHelp(ctx) {
|
|
|
64332
64774
|
}
|
|
64333
64775
|
let repoSlug;
|
|
64334
64776
|
try {
|
|
64335
|
-
const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
64336
|
-
repoSlug = `${org}/${
|
|
64777
|
+
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
64778
|
+
repoSlug = `${org}/${repo2}`;
|
|
64337
64779
|
} catch {
|
|
64338
64780
|
repoSlug = undefined;
|
|
64339
64781
|
}
|
|
@@ -65370,60 +65812,6 @@ var catalog = {
|
|
|
65370
65812
|
function prepareCliInvocation(argv) {
|
|
65371
65813
|
return prepare(argv, resolver, catalog);
|
|
65372
65814
|
}
|
|
65373
|
-
// ../../packages/warmhub-cli/src/cli-context.ts
|
|
65374
|
-
function resolveCliContext(args) {
|
|
65375
|
-
const { invocation, format } = args;
|
|
65376
|
-
const config2 = args.config ?? loadConfig();
|
|
65377
|
-
const apiUrlFlag = invocation.flags["api-url"];
|
|
65378
|
-
const explicitApiUrl = typeof apiUrlFlag === "string" ? apiUrlFlag : undefined;
|
|
65379
|
-
const profileFlag = invocation.flags.profile;
|
|
65380
|
-
const apiUrl = explicitApiUrl ?? process.env.WARMHUB_API_URL ?? config2.apiUrl;
|
|
65381
|
-
config2.apiUrl = apiUrl;
|
|
65382
|
-
const explicitProfile = (typeof profileFlag === "string" ? profileFlag : undefined) ?? config2.profile;
|
|
65383
|
-
const effectiveProfile = explicitProfile ?? "default";
|
|
65384
|
-
const overridesBypassProfile = !explicitProfile && !!process.env.WH_TOKEN && (!!process.env.WARMHUB_API_URL || !!explicitApiUrl);
|
|
65385
|
-
let profileData = null;
|
|
65386
|
-
if (!overridesBypassProfile) {
|
|
65387
|
-
try {
|
|
65388
|
-
profileData = getProfile(effectiveProfile);
|
|
65389
|
-
} catch (err) {
|
|
65390
|
-
if (explicitProfile)
|
|
65391
|
-
throw err;
|
|
65392
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
65393
|
-
if (format === "json" || format === "jsonl") {
|
|
65394
|
-
process.stderr.write(`${JSON.stringify({
|
|
65395
|
-
level: "warning",
|
|
65396
|
-
kind: "auth-file-unreadable",
|
|
65397
|
-
message: `could not read auth.json: ${reason}`
|
|
65398
|
-
})}
|
|
65399
|
-
`);
|
|
65400
|
-
} else {
|
|
65401
|
-
process.stderr.write(`warning: could not read auth.json (${reason})
|
|
65402
|
-
`);
|
|
65403
|
-
}
|
|
65404
|
-
}
|
|
65405
|
-
}
|
|
65406
|
-
if (profileData) {
|
|
65407
|
-
if (profileData.apiUrl && !explicitApiUrl) {
|
|
65408
|
-
config2.apiUrl = profileData.apiUrl;
|
|
65409
|
-
}
|
|
65410
|
-
} else if (explicitProfile) {
|
|
65411
|
-
const isAuthLogin = invocation.kind === "static" && invocation.commandPath[0] === "auth" && invocation.commandPath[1] === "login";
|
|
65412
|
-
if (!isAuthLogin) {
|
|
65413
|
-
const available = listProfiles();
|
|
65414
|
-
const availableHint = available.length > 0 ? `Available profiles: ${available.join(", ")}.` : "No profiles found.";
|
|
65415
|
-
throw new CliError(5 /* Auth */, "AUTH", `Auth profile "${explicitProfile}" does not exist.`, undefined, `${availableHint}
|
|
65416
|
-
Run \`wh auth login --profile ${explicitProfile}\` to create it.`);
|
|
65417
|
-
}
|
|
65418
|
-
}
|
|
65419
|
-
const client = args.client ?? createClient(config2, {
|
|
65420
|
-
functionLogs: args.functionLogs,
|
|
65421
|
-
profile: effectiveProfile,
|
|
65422
|
-
signal: args.signal
|
|
65423
|
-
});
|
|
65424
|
-
return { config: config2, profile: effectiveProfile, client };
|
|
65425
|
-
}
|
|
65426
|
-
|
|
65427
65815
|
// ../../packages/warmhub-cli/src/confirm-prompt.ts
|
|
65428
65816
|
function confirmPrompt(message, opts = {}) {
|
|
65429
65817
|
const input = opts.input ?? process.stdin;
|
|
@@ -65471,8 +65859,8 @@ function selectedRepo(flags, config2) {
|
|
|
65471
65859
|
}
|
|
65472
65860
|
}
|
|
65473
65861
|
try {
|
|
65474
|
-
const { org, repo } = parseOrgRepo(repoRef, config2);
|
|
65475
|
-
return `${org}/${
|
|
65862
|
+
const { org, repo: repo2 } = parseOrgRepo(repoRef, config2);
|
|
65863
|
+
return `${org}/${repo2}`;
|
|
65476
65864
|
} catch {
|
|
65477
65865
|
return;
|
|
65478
65866
|
}
|
|
@@ -65670,10 +66058,11 @@ async function runPreparedCli(rawArgv, prepared, opts) {
|
|
|
65670
66058
|
requestedMode: requestedFunctionLogs
|
|
65671
66059
|
});
|
|
65672
66060
|
const localOnlyCommand = isLocalOnlyInvocation(invocation);
|
|
65673
|
-
const { config: config2, client, profile } = localOnlyCommand ? {
|
|
66061
|
+
const { config: config2, client, profile, clientFlags } = localOnlyCommand ? {
|
|
65674
66062
|
config: loadConfig(),
|
|
65675
66063
|
client: createLocalOnlyClient(),
|
|
65676
|
-
profile: "default"
|
|
66064
|
+
profile: "default",
|
|
66065
|
+
clientFlags: []
|
|
65677
66066
|
} : resolveCliContext({
|
|
65678
66067
|
invocation,
|
|
65679
66068
|
format,
|
|
@@ -65693,6 +66082,7 @@ async function runPreparedCli(rawArgv, prepared, opts) {
|
|
|
65693
66082
|
config: config2,
|
|
65694
66083
|
invocation,
|
|
65695
66084
|
profile,
|
|
66085
|
+
clientFlags,
|
|
65696
66086
|
colors,
|
|
65697
66087
|
chars,
|
|
65698
66088
|
format,
|
|
@@ -65810,7 +66200,7 @@ function resolveLogLevel(flagLevel, env) {
|
|
|
65810
66200
|
// package.json
|
|
65811
66201
|
var package_default3 = {
|
|
65812
66202
|
name: "@warmhub/cli",
|
|
65813
|
-
version: "0.
|
|
66203
|
+
version: "0.89.0",
|
|
65814
66204
|
private: false,
|
|
65815
66205
|
type: "module",
|
|
65816
66206
|
description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
|
|
@@ -65954,9 +66344,9 @@ async function performRegisteredInstall(args) {
|
|
|
65954
66344
|
}
|
|
65955
66345
|
function mapInstallError(error51, componentRef, verb) {
|
|
65956
66346
|
if (isMissingRegistrationError(error51)) {
|
|
65957
|
-
const
|
|
66347
|
+
const parsed = parseComponentRef(componentRef);
|
|
65958
66348
|
const backendCode = warmHubErrorBackendCode(error51);
|
|
65959
|
-
return new CliError(2 /* UserInput */, "USER_INPUT", `No component registered as ${componentRef}`, undefined, `Register it first with 'wh component register ${name ?? componentRef} --org ${
|
|
66349
|
+
return new CliError(2 /* UserInput */, "USER_INPUT", `No component registered as ${componentRef}`, undefined, `Register it first with 'wh component register ${parsed?.name ?? componentRef} --org ${parsed?.org ?? "<org>"} --manifest <path>'.`, undefined, backendCode ?? "NOT_FOUND");
|
|
65960
66350
|
}
|
|
65961
66351
|
if (isMissingManifestPermissionError(error51)) {
|
|
65962
66352
|
const backendCode = warmHubErrorBackendCode(error51) ?? warmHubErrorKind(error51);
|
|
@@ -66429,5 +66819,5 @@ process.exitCode = interceptedExitCode === undefined ? await runPreparedCli(laun
|
|
|
66429
66819
|
version: package_default3.version
|
|
66430
66820
|
}) : interceptedExitCode;
|
|
66431
66821
|
|
|
66432
|
-
//# debugId=
|
|
66433
|
-
//# warmhub-cli-build-info {"cliVersion":"0.
|
|
66822
|
+
//# debugId=0D9B1F5B8E62352264756E2164756E21
|
|
66823
|
+
//# warmhub-cli-build-info {"cliVersion":"0.89.0","sdkVersion":"0.87.0"}
|