@warmhub/cli 0.137.0 → 0.138.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/dist/wh.js +94 -28
- package/package.json +1 -1
package/dist/wh.js
CHANGED
|
@@ -44526,7 +44526,7 @@ class PartialStreamSubmissionError extends Error {
|
|
|
44526
44526
|
}
|
|
44527
44527
|
|
|
44528
44528
|
class AllStreamOperationsFailedError extends Error {
|
|
44529
|
-
code
|
|
44529
|
+
code;
|
|
44530
44530
|
receipts;
|
|
44531
44531
|
result;
|
|
44532
44532
|
operations;
|
|
@@ -44536,6 +44536,7 @@ class AllStreamOperationsFailedError extends Error {
|
|
|
44536
44536
|
const primaryFailure = result.operations.find((operation) => operation.status === "error")?.errors[0];
|
|
44537
44537
|
super(primaryFailure ? `All ${result.operationCount} stream operations failed: ${primaryFailure.message}` : `All ${result.operationCount} stream operations failed.`);
|
|
44538
44538
|
this.name = "WarmHubError";
|
|
44539
|
+
this.code = primaryFailure && result.operations.every((operation) => operation.status === "error" && operation.errors.length > 0 && operation.errors.every((error51) => error51.code === primaryFailure.code)) ? primaryFailure.code : "STREAM_ALL_OPERATIONS_FAILED";
|
|
44539
44540
|
this.cause = primaryFailure;
|
|
44540
44541
|
this.result = result;
|
|
44541
44542
|
this.receipts = result.receipts;
|
|
@@ -45489,7 +45490,7 @@ function createStreamingSubmissionHandle(input, deps) {
|
|
|
45489
45490
|
// ../../packages/sdk-ts/package.json
|
|
45490
45491
|
var package_default = {
|
|
45491
45492
|
name: "@warmhub/sdk-ts",
|
|
45492
|
-
version: "0.
|
|
45493
|
+
version: "0.136.0",
|
|
45493
45494
|
private: false,
|
|
45494
45495
|
type: "module",
|
|
45495
45496
|
description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
|
|
@@ -46953,7 +46954,8 @@ class WarmHubClient {
|
|
|
46953
46954
|
orgName,
|
|
46954
46955
|
repoName,
|
|
46955
46956
|
shapeName,
|
|
46956
|
-
includeRetracted: opts?.includeRetracted
|
|
46957
|
+
includeRetracted: opts?.includeRetracted,
|
|
46958
|
+
includeComposition: opts?.includeComposition
|
|
46957
46959
|
});
|
|
46958
46960
|
} catch (error51) {
|
|
46959
46961
|
throw toWarmHubError(error51);
|
|
@@ -57661,12 +57663,68 @@ function identifyCommitSubmitStreamRow(row) {
|
|
|
57661
57663
|
|
|
57662
57664
|
// ../../packages/warmhub-cli/src/domains/commit-submit-template.ts
|
|
57663
57665
|
import { writeFile } from "node:fs/promises";
|
|
57666
|
+
|
|
57667
|
+
// ../../packages/warmhub-cli/src/domains/shape/composition.ts
|
|
57668
|
+
function capturedShapeMembers(shape) {
|
|
57669
|
+
const data = shape.version?.data;
|
|
57670
|
+
if (Array.isArray(data?.composes) && data.composes.length > 0 && !shape.composition) {
|
|
57671
|
+
throw new CliError(4 /* Backend */, "BACKEND", "The server did not return this Shape’s captured composition. Update the server before scaffolding or displaying inherited fields.");
|
|
57672
|
+
}
|
|
57673
|
+
return shape.composition ?? [];
|
|
57674
|
+
}
|
|
57675
|
+
function effectiveShapeFields(shape) {
|
|
57676
|
+
const data = shape.version?.data;
|
|
57677
|
+
const own = isPlainObject(data?.fields) ? data.fields : {};
|
|
57678
|
+
const fields = structuredClone(own);
|
|
57679
|
+
for (const member of capturedShapeMembers(shape)) {
|
|
57680
|
+
mergeFields(fields, member.fields);
|
|
57681
|
+
}
|
|
57682
|
+
return fields;
|
|
57683
|
+
}
|
|
57684
|
+
function mergeFields(target, source) {
|
|
57685
|
+
for (const [name, spec] of Object.entries(source)) {
|
|
57686
|
+
const bare = name.endsWith("?") ? name.slice(0, -1) : name;
|
|
57687
|
+
if (name.endsWith("?") && Object.hasOwn(target, bare)) {
|
|
57688
|
+
const required2 = target[bare];
|
|
57689
|
+
if (isPlainObject(required2) && !isTypeSpecObject(required2) && isPlainObject(spec) && !isTypeSpecObject(spec)) {
|
|
57690
|
+
mergeFields(required2, spec);
|
|
57691
|
+
}
|
|
57692
|
+
continue;
|
|
57693
|
+
}
|
|
57694
|
+
const optionalName = `${name}?`;
|
|
57695
|
+
if (!name.endsWith("?") && Object.hasOwn(target, optionalName)) {
|
|
57696
|
+
const optional2 = target[optionalName];
|
|
57697
|
+
delete target[optionalName];
|
|
57698
|
+
Object.defineProperty(target, name, {
|
|
57699
|
+
configurable: true,
|
|
57700
|
+
enumerable: true,
|
|
57701
|
+
writable: true,
|
|
57702
|
+
value: isPlainObject(optional2) && !isTypeSpecObject(optional2) && isPlainObject(spec) && !isTypeSpecObject(spec) ? optional2 : spec
|
|
57703
|
+
});
|
|
57704
|
+
}
|
|
57705
|
+
const current = Object.hasOwn(target, name) ? target[name] : undefined;
|
|
57706
|
+
if (isPlainObject(current) && !isTypeSpecObject(current) && isPlainObject(spec) && !isTypeSpecObject(spec)) {
|
|
57707
|
+
mergeFields(current, spec);
|
|
57708
|
+
} else if (current === undefined) {
|
|
57709
|
+
Object.defineProperty(target, name, {
|
|
57710
|
+
configurable: true,
|
|
57711
|
+
enumerable: true,
|
|
57712
|
+
writable: true,
|
|
57713
|
+
value: spec
|
|
57714
|
+
});
|
|
57715
|
+
}
|
|
57716
|
+
}
|
|
57717
|
+
}
|
|
57718
|
+
|
|
57719
|
+
// ../../packages/warmhub-cli/src/domains/commit-submit-template.ts
|
|
57664
57720
|
var WRITE_TEMPLATE_KINDS = ["thing", "assertion"];
|
|
57665
|
-
function composesLocalAssertion(shapeData, org, repo) {
|
|
57721
|
+
function composesLocalAssertion(shapeData, org, repo, captured = []) {
|
|
57666
57722
|
const composes = shapeData?.composes;
|
|
57667
|
-
|
|
57668
|
-
|
|
57669
|
-
|
|
57723
|
+
const candidates = [
|
|
57724
|
+
...Array.isArray(composes) ? composes : [],
|
|
57725
|
+
...captured.map((entry) => entry.wref)
|
|
57726
|
+
];
|
|
57727
|
+
return candidates.some((entry) => {
|
|
57670
57728
|
if (typeof entry !== "string")
|
|
57671
57729
|
return false;
|
|
57672
57730
|
const unversioned = entry.replace(/@(HEAD|v\d+)$/i, "");
|
|
@@ -57675,7 +57733,9 @@ function composesLocalAssertion(shapeData, org, repo) {
|
|
|
57675
57733
|
}
|
|
57676
57734
|
async function readTemplateShape(ctx, org, repo, shapeName) {
|
|
57677
57735
|
try {
|
|
57678
|
-
const shape = await ctx.client.shape.get(org, repo, shapeName
|
|
57736
|
+
const shape = await ctx.client.shape.get(org, repo, shapeName, {
|
|
57737
|
+
includeComposition: true
|
|
57738
|
+
});
|
|
57679
57739
|
if ((shapeName === "Set" || shapeName === "List") && shape.componentRef !== "warmhub/system") {
|
|
57680
57740
|
return;
|
|
57681
57741
|
}
|
|
@@ -57722,21 +57782,15 @@ function zeroValueForField(fieldSpec) {
|
|
|
57722
57782
|
}
|
|
57723
57783
|
}
|
|
57724
57784
|
if (isPlainObject(fieldSpec)) {
|
|
57725
|
-
|
|
57726
|
-
for (const [key, value] of Object.entries(fieldSpec)) {
|
|
57727
|
-
result[key] = zeroValueForField(value);
|
|
57728
|
-
}
|
|
57729
|
-
return result;
|
|
57785
|
+
return buildTemplateData(fieldSpec);
|
|
57730
57786
|
}
|
|
57731
57787
|
return null;
|
|
57732
57788
|
}
|
|
57733
57789
|
function buildTemplateData(fields) {
|
|
57734
|
-
|
|
57735
|
-
|
|
57736
|
-
|
|
57737
|
-
|
|
57738
|
-
}
|
|
57739
|
-
return data;
|
|
57790
|
+
return Object.fromEntries(Object.entries(fields).map(([fieldName, fieldSpec]) => [
|
|
57791
|
+
fieldName.endsWith("?") ? fieldName.slice(0, -1) : fieldName,
|
|
57792
|
+
zeroValueForField(fieldSpec)
|
|
57793
|
+
]));
|
|
57740
57794
|
}
|
|
57741
57795
|
var templateFlags = {
|
|
57742
57796
|
operation: flag.string({
|
|
@@ -57817,12 +57871,12 @@ var handleTemplate = async (ctx, { flags, args }) => {
|
|
|
57817
57871
|
}
|
|
57818
57872
|
const shapeVersion = shape.version;
|
|
57819
57873
|
const shapeData = shapeVersion?.data;
|
|
57820
|
-
const fields =
|
|
57874
|
+
const fields = effectiveShapeFields(shape);
|
|
57821
57875
|
let aboutPlaceholder;
|
|
57822
57876
|
if (templateKind === "assertion") {
|
|
57823
57877
|
aboutPlaceholder = flags.about ? parseCollectionAboutFlag(flags.about) : "Shape/FILL_IN";
|
|
57824
57878
|
}
|
|
57825
|
-
const composesAssertion = composesLocalAssertion(shapeData, org, repo);
|
|
57879
|
+
const composesAssertion = composesLocalAssertion(shapeData, org, repo, shape.composition);
|
|
57826
57880
|
const emittedKind = templateKind === "assertion" && composesAssertion ? "thing" : templateKind;
|
|
57827
57881
|
const data = buildTemplateData(fields);
|
|
57828
57882
|
const emittedData = aboutPlaceholder && emittedKind === "thing" ? { ...data, about: aboutPlaceholder } : data;
|
|
@@ -66264,7 +66318,8 @@ var handleView7 = async (ctx, { flags, args }) => {
|
|
|
66264
66318
|
const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
66265
66319
|
const c = ctx.colors;
|
|
66266
66320
|
const result = await ctx.client.shape.get(org, repo2, shapeName, {
|
|
66267
|
-
includeRetracted: flags["include-retracted"]
|
|
66321
|
+
includeRetracted: flags["include-retracted"],
|
|
66322
|
+
includeComposition: ctx.format === "pretty"
|
|
66268
66323
|
});
|
|
66269
66324
|
writeOutput(ctx, result, () => {
|
|
66270
66325
|
const shapeVersion = result.version;
|
|
@@ -66281,15 +66336,26 @@ var handleView7 = async (ctx, { flags, args }) => {
|
|
|
66281
66336
|
ctx.out(` ${c.dim}owner:${c.reset} ${c.yellow}${componentRef}${c.reset}`);
|
|
66282
66337
|
}
|
|
66283
66338
|
const fields = shapeData?.fields;
|
|
66284
|
-
|
|
66285
|
-
|
|
66286
|
-
|
|
66339
|
+
const composes = shapeData?.composes;
|
|
66340
|
+
if (Array.isArray(composes) && composes.length > 0) {
|
|
66341
|
+
ctx.out(` ${c.dim}composes:${c.reset} ${composes.map((name) => escapeTerminalTextForDisplay(String(name))).join(", ")}`);
|
|
66342
|
+
}
|
|
66343
|
+
const printFields = (entries) => {
|
|
66344
|
+
for (const [fieldName, fieldType] of Object.entries(entries)) {
|
|
66287
66345
|
const typeStr = displayFieldType(fieldType);
|
|
66288
66346
|
const fieldDesc = fieldDescriptionFromSpec(fieldType);
|
|
66289
66347
|
const descSuffix = fieldDesc ? ` ${c.dim}${escapeTerminalTextForDisplay(fieldDesc)}${c.reset}` : "";
|
|
66290
66348
|
const safeFieldName = escapeFieldNameForDisplay(fieldName);
|
|
66291
66349
|
ctx.out(` ${c.cyan}${safeFieldName}${c.reset}: ${c.dim}${typeStr}${c.reset}${descSuffix}`);
|
|
66292
66350
|
}
|
|
66351
|
+
};
|
|
66352
|
+
if (fields && Object.keys(fields).length > 0) {
|
|
66353
|
+
ctx.out(` ${c.dim}fields:${c.reset}`);
|
|
66354
|
+
printFields(fields);
|
|
66355
|
+
}
|
|
66356
|
+
for (const member of capturedShapeMembers(result)) {
|
|
66357
|
+
ctx.out(` ${c.dim}inherited from ${escapeTerminalTextForDisplay(member.wref)}:${c.reset}`);
|
|
66358
|
+
printFields(member.fields);
|
|
66293
66359
|
}
|
|
66294
66360
|
ctx.out("");
|
|
66295
66361
|
ctx.out(` ${c.dim}Scaffold a write ops file for this shape:${c.reset} ${c.cyan}wh shape template ${result.name ?? shapeName}${c.reset}`);
|
|
@@ -70075,7 +70141,7 @@ function resolveLogLevel(flagLevel, env) {
|
|
|
70075
70141
|
// package.json
|
|
70076
70142
|
var package_default3 = {
|
|
70077
70143
|
name: "@warmhub/cli",
|
|
70078
|
-
version: "0.
|
|
70144
|
+
version: "0.138.0",
|
|
70079
70145
|
private: false,
|
|
70080
70146
|
type: "module",
|
|
70081
70147
|
description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
|
|
@@ -70700,5 +70766,5 @@ process.exitCode = interceptedExitCode === undefined ? await runPreparedCli(laun
|
|
|
70700
70766
|
version: package_default3.version
|
|
70701
70767
|
}) : interceptedExitCode;
|
|
70702
70768
|
|
|
70703
|
-
//# debugId=
|
|
70704
|
-
//# warmhub-cli-build-info {"cliVersion":"0.
|
|
70769
|
+
//# debugId=34AED26DA6FD886964756E2164756E21
|
|
70770
|
+
//# warmhub-cli-build-info {"cliVersion":"0.138.0","sdkVersion":"0.136.0"}
|
package/package.json
CHANGED