@warmhub/cli 0.65.0 → 0.66.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 +61 -164
- package/package.json +1 -1
package/dist/wh.js
CHANGED
|
@@ -27292,7 +27292,6 @@ var SUBSCRIBABLE_EVENT_TYPES = [
|
|
|
27292
27292
|
];
|
|
27293
27293
|
// ../../packages/rules/src/system-components/system.ts
|
|
27294
27294
|
var SYSTEM_COMPONENT_ID = "com.warmhub.system";
|
|
27295
|
-
var SYSTEM_REGISTERED_COMPONENT_REF = "warmhub/system";
|
|
27296
27295
|
var COMPONENT_INSTALL_FIELDS = {
|
|
27297
27296
|
componentId: "string",
|
|
27298
27297
|
name: "string",
|
|
@@ -27353,7 +27352,7 @@ function findSystemComponent(componentId) {
|
|
|
27353
27352
|
// ../../packages/sdk-ts/package.json
|
|
27354
27353
|
var package_default = {
|
|
27355
27354
|
name: "@warmhub/sdk-ts",
|
|
27356
|
-
version: "0.
|
|
27355
|
+
version: "0.65.0",
|
|
27357
27356
|
private: false,
|
|
27358
27357
|
type: "module",
|
|
27359
27358
|
description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
|
|
@@ -28439,6 +28438,18 @@ class WarmHubClient {
|
|
|
28439
28438
|
throw toWarmHubError(error);
|
|
28440
28439
|
}
|
|
28441
28440
|
},
|
|
28441
|
+
history: async (orgName, repoName, opts) => {
|
|
28442
|
+
try {
|
|
28443
|
+
return await this.trpc.component.history.query({
|
|
28444
|
+
orgName,
|
|
28445
|
+
repoName,
|
|
28446
|
+
componentRef: opts?.componentRef,
|
|
28447
|
+
limit: opts?.limit
|
|
28448
|
+
});
|
|
28449
|
+
} catch (error) {
|
|
28450
|
+
throw toWarmHubError(error);
|
|
28451
|
+
}
|
|
28452
|
+
},
|
|
28442
28453
|
install: async (orgName, repoName, componentRef) => {
|
|
28443
28454
|
try {
|
|
28444
28455
|
return await this.trpc.component.install.mutate({
|
|
@@ -38010,9 +38021,10 @@ async function refreshFromSummaries(repoSlug, parsed, activeItems, client, now,
|
|
|
38010
38021
|
}
|
|
38011
38022
|
continue;
|
|
38012
38023
|
}
|
|
38013
|
-
|
|
38014
|
-
|
|
38015
|
-
|
|
38024
|
+
if (!detail.installedManifest || typeof detail.installedManifest !== "object") {
|
|
38025
|
+
throw new Error(`component.get returned no installedManifest for ${itemRef}; the backend must support GH-4690 (installedManifest on component.get)`);
|
|
38026
|
+
}
|
|
38027
|
+
const manifest = detail.installedManifest;
|
|
38016
38028
|
installs[item.componentName] = {
|
|
38017
38029
|
ref: itemRef,
|
|
38018
38030
|
version: manifest.component.version ?? item.version ?? "",
|
|
@@ -38022,7 +38034,7 @@ async function refreshFromSummaries(repoSlug, parsed, activeItems, client, now,
|
|
|
38022
38034
|
const methods = manifest.cli?.methods ?? [];
|
|
38023
38035
|
if (methods.length === 0)
|
|
38024
38036
|
continue;
|
|
38025
|
-
const ref = extractRegisteredRef(
|
|
38037
|
+
const ref = extractRegisteredRef(itemRef);
|
|
38026
38038
|
if (!ref)
|
|
38027
38039
|
continue;
|
|
38028
38040
|
components[item.componentName] = {
|
|
@@ -38068,10 +38080,7 @@ async function fetchAllSummaries(client, org, repo) {
|
|
|
38068
38080
|
function filterActiveItems(items) {
|
|
38069
38081
|
return items.filter((i) => i.active && i.state !== "uninstalled" && i.state !== "paused" && i.state !== "error");
|
|
38070
38082
|
}
|
|
38071
|
-
function extractRegisteredRef(
|
|
38072
|
-
if (typeof data !== "object" || data === null)
|
|
38073
|
-
return null;
|
|
38074
|
-
const ref = data.registeredComponentRef;
|
|
38083
|
+
function extractRegisteredRef(ref) {
|
|
38075
38084
|
if (typeof ref !== "string" || ref.length === 0)
|
|
38076
38085
|
return null;
|
|
38077
38086
|
const segments = ref.split("/");
|
|
@@ -38082,27 +38091,6 @@ function extractRegisteredRef(data) {
|
|
|
38082
38091
|
return null;
|
|
38083
38092
|
return { ownerOrgName: org, registeredComponentName: name };
|
|
38084
38093
|
}
|
|
38085
|
-
function extractInstalledManifest(data) {
|
|
38086
|
-
if (typeof data !== "object" || data === null)
|
|
38087
|
-
return null;
|
|
38088
|
-
const raw = data.manifest;
|
|
38089
|
-
let manifest;
|
|
38090
|
-
if (typeof raw === "string") {
|
|
38091
|
-
try {
|
|
38092
|
-
manifest = JSON.parse(raw);
|
|
38093
|
-
} catch {
|
|
38094
|
-
return null;
|
|
38095
|
-
}
|
|
38096
|
-
} else {
|
|
38097
|
-
manifest = raw;
|
|
38098
|
-
}
|
|
38099
|
-
if (typeof manifest !== "object" || manifest === null)
|
|
38100
|
-
return null;
|
|
38101
|
-
const component = manifest.component;
|
|
38102
|
-
if (typeof component !== "object" || component === null)
|
|
38103
|
-
return null;
|
|
38104
|
-
return manifest;
|
|
38105
|
-
}
|
|
38106
38094
|
|
|
38107
38095
|
// ../../packages/warmhub-cli/src/manifest.ts
|
|
38108
38096
|
var GLOBAL_FLAGS = [
|
|
@@ -38754,6 +38742,9 @@ function renderTeardownResult(ctx, result) {
|
|
|
38754
38742
|
if (result.pausedSubscriptions.length > 0) {
|
|
38755
38743
|
ctx.out(` ${c.green}paused${c.reset} ${result.pausedSubscriptions.length} subscription(s): ${result.pausedSubscriptions.join(", ")}`);
|
|
38756
38744
|
}
|
|
38745
|
+
if (result.releasedShapes.length > 0) {
|
|
38746
|
+
ctx.out(` ${c.green}released${c.reset} ${result.releasedShapes.length} shape(s): ${result.releasedShapes.join(", ")}`);
|
|
38747
|
+
}
|
|
38757
38748
|
if (result.tokensRevoked > 0) {
|
|
38758
38749
|
ctx.out(` ${c.green}revoked${c.reset} ${result.tokensRevoked} token(s)`);
|
|
38759
38750
|
}
|
|
@@ -38913,46 +38904,6 @@ function readManifestArg(path2) {
|
|
|
38913
38904
|
}
|
|
38914
38905
|
return parsed;
|
|
38915
38906
|
}
|
|
38916
|
-
function asRecord(value) {
|
|
38917
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
38918
|
-
return;
|
|
38919
|
-
}
|
|
38920
|
-
return value;
|
|
38921
|
-
}
|
|
38922
|
-
function readString(data, key) {
|
|
38923
|
-
const candidate = data?.[key];
|
|
38924
|
-
return typeof candidate === "string" && candidate.length > 0 ? candidate : undefined;
|
|
38925
|
-
}
|
|
38926
|
-
function componentInstallIdFromWref(wref) {
|
|
38927
|
-
const prefix = "ComponentInstall/";
|
|
38928
|
-
return wref.startsWith(prefix) ? wref.slice(prefix.length) : undefined;
|
|
38929
|
-
}
|
|
38930
|
-
function componentInstallCanonicalId(item) {
|
|
38931
|
-
const data = asRecord(item.data);
|
|
38932
|
-
return componentInstallIdFromWref(item.wref) ?? readString(data, "id") ?? readString(data, "componentId") ?? item.name;
|
|
38933
|
-
}
|
|
38934
|
-
function componentInstallHasRegisteredRef(item, ref) {
|
|
38935
|
-
return readString(asRecord(item.data), "registeredComponentRef") === ref;
|
|
38936
|
-
}
|
|
38937
|
-
async function resolveInstalledComponentRefId(client, org, repo, ref) {
|
|
38938
|
-
let cursor;
|
|
38939
|
-
do {
|
|
38940
|
-
const result = await client.thing.head(org, repo, {
|
|
38941
|
-
shape: "ComponentInstall",
|
|
38942
|
-
kind: "thing",
|
|
38943
|
-
limit: 500,
|
|
38944
|
-
cursor
|
|
38945
|
-
});
|
|
38946
|
-
const items = result.items ?? [];
|
|
38947
|
-
const exactMatch = items.find((item) => componentInstallHasRegisteredRef(item, ref));
|
|
38948
|
-
const resolved = exactMatch ? componentInstallCanonicalId(exactMatch) : undefined;
|
|
38949
|
-
if (resolved) {
|
|
38950
|
-
return resolved;
|
|
38951
|
-
}
|
|
38952
|
-
cursor = result.nextCursor;
|
|
38953
|
-
} while (cursor);
|
|
38954
|
-
throw new CliError(2 /* UserInput */, "USER_INPUT", `Component '${ref}' is not installed. Run 'wh component install <org>/<name>' first.`);
|
|
38955
|
-
}
|
|
38956
38907
|
|
|
38957
38908
|
// ../../packages/warmhub-cli/src/domains/component-handlers.ts
|
|
38958
38909
|
var handleUpdate = async (ctx, { args }) => {
|
|
@@ -39084,7 +39035,7 @@ var handleView3 = async (ctx, { args }) => {
|
|
|
39084
39035
|
ctx.out(`${c.bold}Component:${c.reset} ${c.cyan}${viewData.ref ?? ref}${c.reset}`);
|
|
39085
39036
|
const update = viewData.updateAvailable && viewData.latestVersion ? ` ${c.yellow}(${viewData.latestVersion} available — run wh component update ${viewData.ref ?? ref} --repo ${org}/${repo})${c.reset}` : "";
|
|
39086
39037
|
ctx.out(`${c.bold}Version:${c.reset} ${viewData.version ?? "unknown"}${update}`);
|
|
39087
|
-
ctx.out(`${c.bold}
|
|
39038
|
+
ctx.out(`${c.bold}Lifecycle:${c.reset} ${viewData.state ?? "-"}`);
|
|
39088
39039
|
ctx.out(`${c.bold}Source:${c.reset} ${viewData.source ?? "-"}`);
|
|
39089
39040
|
if (viewData.ownedShapes.length > 0) {
|
|
39090
39041
|
ctx.out("");
|
|
@@ -39135,67 +39086,37 @@ var handleValidate = async (ctx, { args }) => {
|
|
|
39135
39086
|
throw new CliError(2 /* UserInput */, "USER_INPUT", "Component package validation failed");
|
|
39136
39087
|
}
|
|
39137
39088
|
};
|
|
39138
|
-
// ../../packages/warmhub-cli/src/manifest/shared-infra.ts
|
|
39139
|
-
var SHARED_INFRA_SHAPES = findSystemComponent(SYSTEM_COMPONENT_ID)?.shapes ?? [];
|
|
39140
|
-
|
|
39141
39089
|
// ../../packages/warmhub-cli/src/manifest/doctor.ts
|
|
39142
|
-
async function doctorComponent(client, org, repo,
|
|
39090
|
+
async function doctorComponent(client, org, repo, ref) {
|
|
39143
39091
|
const findings = [];
|
|
39144
|
-
let
|
|
39092
|
+
let detail;
|
|
39145
39093
|
try {
|
|
39146
|
-
|
|
39147
|
-
installData = thing.data && typeof thing.data === "object" ? thing.data : {};
|
|
39094
|
+
detail = await client.component.get(org, repo, ref);
|
|
39148
39095
|
findings.push({
|
|
39149
|
-
resource: "
|
|
39096
|
+
resource: "install",
|
|
39150
39097
|
status: "ok",
|
|
39151
39098
|
message: "Install record found"
|
|
39152
39099
|
});
|
|
39153
|
-
} catch {
|
|
39100
|
+
} catch (err) {
|
|
39101
|
+
const kind = isWarmHubError(err) ? err.kind : undefined;
|
|
39102
|
+
const notInstalled = kind === "NOT_FOUND";
|
|
39154
39103
|
return {
|
|
39155
|
-
componentId,
|
|
39156
|
-
componentName:
|
|
39157
|
-
state: "error",
|
|
39104
|
+
componentId: ref,
|
|
39105
|
+
componentName: ref,
|
|
39106
|
+
state: notInstalled ? "uninstalled" : "error",
|
|
39158
39107
|
findings: [
|
|
39159
39108
|
{
|
|
39160
|
-
resource: "
|
|
39109
|
+
resource: "install",
|
|
39161
39110
|
status: "missing",
|
|
39162
|
-
message: `
|
|
39111
|
+
message: notInstalled ? `Component "${ref}" is not actively installed` : `Failed to resolve component "${ref}"`
|
|
39163
39112
|
}
|
|
39164
39113
|
]
|
|
39165
39114
|
};
|
|
39166
39115
|
}
|
|
39167
|
-
const componentName =
|
|
39168
|
-
const
|
|
39169
|
-
|
|
39170
|
-
|
|
39171
|
-
resource: "ComponentInstall",
|
|
39172
|
-
status: "error",
|
|
39173
|
-
message: "Install record is missing registeredComponentRef"
|
|
39174
|
-
});
|
|
39175
|
-
return { componentId, componentName, state: "error", findings };
|
|
39176
|
-
}
|
|
39177
|
-
const existingState = typeof installData.state === "string" ? installData.state : undefined;
|
|
39178
|
-
if (existingState === "error") {
|
|
39179
|
-
findings.push({
|
|
39180
|
-
resource: "state",
|
|
39181
|
-
status: "error",
|
|
39182
|
-
message: "Component is in error state from a previous operation"
|
|
39183
|
-
});
|
|
39184
|
-
return { componentId, componentName, state: "error", findings };
|
|
39185
|
-
}
|
|
39186
|
-
if (existingState === "uninstalled") {
|
|
39187
|
-
findings.push({
|
|
39188
|
-
resource: "state",
|
|
39189
|
-
status: "inactive",
|
|
39190
|
-
message: "Component is uninstalled; reinstall to revive it"
|
|
39191
|
-
});
|
|
39192
|
-
return { componentId, componentName, state: "uninstalled", findings };
|
|
39193
|
-
}
|
|
39194
|
-
let manifest;
|
|
39195
|
-
try {
|
|
39196
|
-
const raw = typeof installData.manifest === "string" ? installData.manifest : undefined;
|
|
39197
|
-
manifest = raw ? JSON.parse(raw) : { shapes: [], subscriptions: [], credentials: [], seeds: [] };
|
|
39198
|
-
} catch {
|
|
39116
|
+
const componentName = detail.componentName;
|
|
39117
|
+
const componentId = detail.installComponentId ?? ref;
|
|
39118
|
+
const registeredComponentRef = detail.ref ?? ref;
|
|
39119
|
+
if (!detail.installedManifest || typeof detail.installedManifest !== "object") {
|
|
39199
39120
|
return {
|
|
39200
39121
|
componentId,
|
|
39201
39122
|
componentName,
|
|
@@ -39205,11 +39126,12 @@ async function doctorComponent(client, org, repo, componentId) {
|
|
|
39205
39126
|
{
|
|
39206
39127
|
resource: "manifest",
|
|
39207
39128
|
status: "error",
|
|
39208
|
-
message: "
|
|
39129
|
+
message: "Installed manifest unavailable from the registry"
|
|
39209
39130
|
}
|
|
39210
39131
|
]
|
|
39211
39132
|
};
|
|
39212
39133
|
}
|
|
39134
|
+
const manifest = detail.installedManifest;
|
|
39213
39135
|
for (const shape of manifest.shapes ?? []) {
|
|
39214
39136
|
try {
|
|
39215
39137
|
const s = await client.shape.get(org, repo, shape.name);
|
|
@@ -39340,22 +39262,19 @@ async function doctorComponent(client, org, repo, componentId) {
|
|
|
39340
39262
|
});
|
|
39341
39263
|
}
|
|
39342
39264
|
}
|
|
39343
|
-
|
|
39344
|
-
|
|
39345
|
-
|
|
39346
|
-
|
|
39347
|
-
|
|
39348
|
-
|
|
39349
|
-
|
|
39350
|
-
|
|
39351
|
-
|
|
39352
|
-
|
|
39353
|
-
|
|
39354
|
-
|
|
39355
|
-
|
|
39356
|
-
});
|
|
39357
|
-
}
|
|
39358
|
-
} catch {}
|
|
39265
|
+
if (detail.updateAvailable === true && detail.latestVersion) {
|
|
39266
|
+
findings.push({
|
|
39267
|
+
resource: "version",
|
|
39268
|
+
status: "warning",
|
|
39269
|
+
message: `Installed ${detail.version ?? "version"}; ${detail.latestVersion} available — run wh component update ${registeredComponentRef} --repo ${org}/${repo}`
|
|
39270
|
+
});
|
|
39271
|
+
} else if (detail.updateAvailable === false && detail.version) {
|
|
39272
|
+
findings.push({
|
|
39273
|
+
resource: "version",
|
|
39274
|
+
status: "ok",
|
|
39275
|
+
message: `Up to date (${detail.version})`
|
|
39276
|
+
});
|
|
39277
|
+
}
|
|
39359
39278
|
const hasMissing = findings.some((f) => f.status === "missing");
|
|
39360
39279
|
const hasInactive = findings.some((f) => f.status === "inactive" && !f.resource.startsWith("sub:"));
|
|
39361
39280
|
const hasShapeDrift = findings.some((f) => f.resource.startsWith("shape:") && f.status === "warning" && f.message.includes("differs from installed manifest"));
|
|
@@ -39368,24 +39287,6 @@ async function doctorComponent(client, org, repo, componentId) {
|
|
|
39368
39287
|
} else {
|
|
39369
39288
|
state = "ready";
|
|
39370
39289
|
}
|
|
39371
|
-
if (state !== existingState) {
|
|
39372
|
-
try {
|
|
39373
|
-
await client.commit.apply(org, repo, `Doctor: update ${componentName} state to ${state}`, [
|
|
39374
|
-
{
|
|
39375
|
-
operation: "revise",
|
|
39376
|
-
kind: "thing",
|
|
39377
|
-
name: `ComponentInstall/${componentId}`,
|
|
39378
|
-
data: { ...installData, state }
|
|
39379
|
-
}
|
|
39380
|
-
], { componentRef: SYSTEM_REGISTERED_COMPONENT_REF });
|
|
39381
|
-
} catch {
|
|
39382
|
-
findings.push({
|
|
39383
|
-
resource: "state-update",
|
|
39384
|
-
status: "warning",
|
|
39385
|
-
message: "Failed to persist computed state"
|
|
39386
|
-
});
|
|
39387
|
-
}
|
|
39388
|
-
}
|
|
39389
39290
|
return { componentId, componentName, state, findings };
|
|
39390
39291
|
}
|
|
39391
39292
|
|
|
@@ -39396,8 +39297,7 @@ var handleDoctor = async (ctx, { args }) => {
|
|
|
39396
39297
|
usageError("Usage: wh component doctor <org/name> --repo org/repo", "wh component doctor warmhub/research-knowledge --repo myorg/myrepo");
|
|
39397
39298
|
}
|
|
39398
39299
|
const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
|
|
39399
|
-
const
|
|
39400
|
-
const result = await doctorComponent(ctx.client, org, repo, componentId);
|
|
39300
|
+
const result = await doctorComponent(ctx.client, org, repo, name);
|
|
39401
39301
|
writeOutput(ctx, result, () => renderDoctorResult(ctx, result));
|
|
39402
39302
|
};
|
|
39403
39303
|
var handleTeardown = async (ctx, { args }) => {
|
|
@@ -39528,16 +39428,11 @@ var handleSearch2 = async (ctx, { flags, args }) => {
|
|
|
39528
39428
|
};
|
|
39529
39429
|
function stateToColor2(c, state) {
|
|
39530
39430
|
switch (state) {
|
|
39531
|
-
case "
|
|
39431
|
+
case "active":
|
|
39532
39432
|
return c.green;
|
|
39533
|
-
case "paused":
|
|
39534
39433
|
case "uninstalled":
|
|
39535
39434
|
return c.yellow;
|
|
39536
|
-
case "
|
|
39537
|
-
return c.red;
|
|
39538
|
-
case "error":
|
|
39539
|
-
return c.red;
|
|
39540
|
-
case "installing":
|
|
39435
|
+
case "initiated":
|
|
39541
39436
|
return c.cyan;
|
|
39542
39437
|
default:
|
|
39543
39438
|
return c.dim;
|
|
@@ -45492,6 +45387,8 @@ async function dispatch(ctx) {
|
|
|
45492
45387
|
const hint = ctx._domainHint ? ` ${ctx._domainHint}` : "";
|
|
45493
45388
|
throw new CliError(2 /* UserInput */, "USER_INPUT", `Unknown command: ${command}`, undefined, hint.trim() || "Run 'wh help' for available commands.");
|
|
45494
45389
|
}
|
|
45390
|
+
// ../../packages/warmhub-cli/src/manifest/shared-infra.ts
|
|
45391
|
+
var SHARED_INFRA_SHAPES = findSystemComponent(SYSTEM_COMPONENT_ID)?.shapes ?? [];
|
|
45495
45392
|
// ../../packages/warmhub-cli/src/apply-global-flags.ts
|
|
45496
45393
|
function invokesRemovedVerb(ctx) {
|
|
45497
45394
|
return ctx.invocation.command === "credential" && ctx.invocation.positional[0] === "export";
|
|
@@ -45838,7 +45735,7 @@ function resolveLogLevel(flags, env) {
|
|
|
45838
45735
|
// package.json
|
|
45839
45736
|
var package_default3 = {
|
|
45840
45737
|
name: "@warmhub/cli",
|
|
45841
|
-
version: "0.
|
|
45738
|
+
version: "0.66.0",
|
|
45842
45739
|
private: false,
|
|
45843
45740
|
type: "module",
|
|
45844
45741
|
description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
|
|
@@ -46493,4 +46390,4 @@ if (!updateCheckSuppressedByArgv && shouldRunUpdateCheck(updateEligibility)) {
|
|
|
46493
46390
|
var interceptedExitCode = await maybeHandleComponentShellBoundary(dispatchArgv);
|
|
46494
46391
|
process.exitCode = interceptedExitCode === undefined ? await runCli(dispatchArgv, { version: package_default3.version }) : interceptedExitCode;
|
|
46495
46392
|
|
|
46496
|
-
//# debugId=
|
|
46393
|
+
//# debugId=C5B05FE58189780B64756E2164756E21
|
package/package.json
CHANGED