@warmhub/cli 0.65.0 → 0.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/wh.js +95 -180
  2. package/package.json +1 -1
package/dist/wh.js CHANGED
@@ -18602,21 +18602,6 @@ function inferOperationKind(op) {
18602
18602
  const segments = op.name ? op.name.split("/").filter(Boolean) : [];
18603
18603
  return segments.length >= 3 ? "assertion" : "thing";
18604
18604
  }
18605
- // ../../packages/rules/src/component-manifest-hash.ts
18606
- function stableJson(value) {
18607
- if (!value || typeof value !== "object") {
18608
- return JSON.stringify(value);
18609
- }
18610
- if (Array.isArray(value)) {
18611
- return `[${value.map((entry) => stableJson(entry)).join(",")}]`;
18612
- }
18613
- const record = value;
18614
- return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${stableJson(record[key])}`).join(",")}}`;
18615
- }
18616
- function stableJsonEquals(left, right) {
18617
- return stableJson(left) === stableJson(right);
18618
- }
18619
-
18620
18605
  // ../../packages/rules/src/component-name-templates.ts
18621
18606
  var COMPONENT_TEMPLATE_VALUES = {
18622
18607
  "org-name": (ctx) => ctx.orgName,
@@ -18645,6 +18630,21 @@ function resolveComponentTemplate(value, ctx) {
18645
18630
  });
18646
18631
  }
18647
18632
 
18633
+ // ../../packages/rules/src/stable-json.ts
18634
+ function stableJson(value) {
18635
+ if (!value || typeof value !== "object") {
18636
+ return JSON.stringify(value);
18637
+ }
18638
+ if (Array.isArray(value)) {
18639
+ return `[${value.map((entry) => stableJson(entry)).join(",")}]`;
18640
+ }
18641
+ const record = value;
18642
+ return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${stableJson(record[key])}`).join(",")}}`;
18643
+ }
18644
+ function stableJsonEquals(left, right) {
18645
+ return stableJson(left) === stableJson(right);
18646
+ }
18647
+
18648
18648
  // ../../packages/rules/src/component-install.ts
18649
18649
  function manifestShapeData(shape) {
18650
18650
  const data = { fields: shape.fields };
@@ -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.64.0",
27355
+ version: "0.66.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({
@@ -28915,6 +28926,23 @@ class WarmHubClient {
28915
28926
  throw toWarmHubError(error);
28916
28927
  }
28917
28928
  },
28929
+ explore: async (opts) => {
28930
+ try {
28931
+ return await this.trpc.repo.explore.query({
28932
+ search: opts?.search,
28933
+ org: opts?.org,
28934
+ activity: opts?.activity,
28935
+ hasSubscriptions: opts?.hasSubscriptions,
28936
+ minThings: opts?.minThings,
28937
+ sort: opts?.sort,
28938
+ limit: opts?.limit,
28939
+ cursor: opts?.cursor,
28940
+ slugs: opts?.slugs
28941
+ });
28942
+ } catch (error) {
28943
+ throw toWarmHubError(error);
28944
+ }
28945
+ },
28918
28946
  getReadme: async (orgName, repoName) => {
28919
28947
  try {
28920
28948
  return await this.trpc.repo.getReadme.query({
@@ -29560,7 +29588,8 @@ class WarmHubClient {
29560
29588
  componentRef: opts?.componentRef,
29561
29589
  excludeComponents: opts?.excludeComponents,
29562
29590
  excludeInfraShapes: opts?.excludeInfraShapes,
29563
- mode: opts?.mode
29591
+ mode: opts?.mode,
29592
+ nameMatch: opts?.nameMatch
29564
29593
  });
29565
29594
  } catch (error) {
29566
29595
  throw toWarmHubError(error);
@@ -38010,9 +38039,10 @@ async function refreshFromSummaries(repoSlug, parsed, activeItems, client, now,
38010
38039
  }
38011
38040
  continue;
38012
38041
  }
38013
- const manifest = extractInstalledManifest(detail.install.data);
38014
- if (!manifest)
38015
- continue;
38042
+ if (!detail.installedManifest || typeof detail.installedManifest !== "object") {
38043
+ throw new Error(`component.get returned no installedManifest for ${itemRef}; the backend must support GH-4690 (installedManifest on component.get)`);
38044
+ }
38045
+ const manifest = detail.installedManifest;
38016
38046
  installs[item.componentName] = {
38017
38047
  ref: itemRef,
38018
38048
  version: manifest.component.version ?? item.version ?? "",
@@ -38022,7 +38052,7 @@ async function refreshFromSummaries(repoSlug, parsed, activeItems, client, now,
38022
38052
  const methods = manifest.cli?.methods ?? [];
38023
38053
  if (methods.length === 0)
38024
38054
  continue;
38025
- const ref = extractRegisteredRef(detail.install.data);
38055
+ const ref = extractRegisteredRef(itemRef);
38026
38056
  if (!ref)
38027
38057
  continue;
38028
38058
  components[item.componentName] = {
@@ -38068,10 +38098,7 @@ async function fetchAllSummaries(client, org, repo) {
38068
38098
  function filterActiveItems(items) {
38069
38099
  return items.filter((i) => i.active && i.state !== "uninstalled" && i.state !== "paused" && i.state !== "error");
38070
38100
  }
38071
- function extractRegisteredRef(data) {
38072
- if (typeof data !== "object" || data === null)
38073
- return null;
38074
- const ref = data.registeredComponentRef;
38101
+ function extractRegisteredRef(ref) {
38075
38102
  if (typeof ref !== "string" || ref.length === 0)
38076
38103
  return null;
38077
38104
  const segments = ref.split("/");
@@ -38082,27 +38109,6 @@ function extractRegisteredRef(data) {
38082
38109
  return null;
38083
38110
  return { ownerOrgName: org, registeredComponentName: name };
38084
38111
  }
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
38112
 
38107
38113
  // ../../packages/warmhub-cli/src/manifest.ts
38108
38114
  var GLOBAL_FLAGS = [
@@ -38754,6 +38760,9 @@ function renderTeardownResult(ctx, result) {
38754
38760
  if (result.pausedSubscriptions.length > 0) {
38755
38761
  ctx.out(` ${c.green}paused${c.reset} ${result.pausedSubscriptions.length} subscription(s): ${result.pausedSubscriptions.join(", ")}`);
38756
38762
  }
38763
+ if (result.releasedShapes.length > 0) {
38764
+ ctx.out(` ${c.green}released${c.reset} ${result.releasedShapes.length} shape(s): ${result.releasedShapes.join(", ")}`);
38765
+ }
38757
38766
  if (result.tokensRevoked > 0) {
38758
38767
  ctx.out(` ${c.green}revoked${c.reset} ${result.tokensRevoked} token(s)`);
38759
38768
  }
@@ -38913,46 +38922,6 @@ function readManifestArg(path2) {
38913
38922
  }
38914
38923
  return parsed;
38915
38924
  }
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
38925
 
38957
38926
  // ../../packages/warmhub-cli/src/domains/component-handlers.ts
38958
38927
  var handleUpdate = async (ctx, { args }) => {
@@ -39084,7 +39053,7 @@ var handleView3 = async (ctx, { args }) => {
39084
39053
  ctx.out(`${c.bold}Component:${c.reset} ${c.cyan}${viewData.ref ?? ref}${c.reset}`);
39085
39054
  const update = viewData.updateAvailable && viewData.latestVersion ? ` ${c.yellow}(${viewData.latestVersion} available — run wh component update ${viewData.ref ?? ref} --repo ${org}/${repo})${c.reset}` : "";
39086
39055
  ctx.out(`${c.bold}Version:${c.reset} ${viewData.version ?? "unknown"}${update}`);
39087
- ctx.out(`${c.bold}State:${c.reset} ${viewData.state ?? "-"}`);
39056
+ ctx.out(`${c.bold}Lifecycle:${c.reset} ${viewData.state ?? "-"}`);
39088
39057
  ctx.out(`${c.bold}Source:${c.reset} ${viewData.source ?? "-"}`);
39089
39058
  if (viewData.ownedShapes.length > 0) {
39090
39059
  ctx.out("");
@@ -39135,67 +39104,37 @@ var handleValidate = async (ctx, { args }) => {
39135
39104
  throw new CliError(2 /* UserInput */, "USER_INPUT", "Component package validation failed");
39136
39105
  }
39137
39106
  };
39138
- // ../../packages/warmhub-cli/src/manifest/shared-infra.ts
39139
- var SHARED_INFRA_SHAPES = findSystemComponent(SYSTEM_COMPONENT_ID)?.shapes ?? [];
39140
-
39141
39107
  // ../../packages/warmhub-cli/src/manifest/doctor.ts
39142
- async function doctorComponent(client, org, repo, componentId) {
39108
+ async function doctorComponent(client, org, repo, ref) {
39143
39109
  const findings = [];
39144
- let installData;
39110
+ let detail;
39145
39111
  try {
39146
- const thing = await client.thing.get(org, repo, `ComponentInstall/${componentId}`);
39147
- installData = thing.data && typeof thing.data === "object" ? thing.data : {};
39112
+ detail = await client.component.get(org, repo, ref);
39148
39113
  findings.push({
39149
- resource: "ComponentInstall",
39114
+ resource: "install",
39150
39115
  status: "ok",
39151
39116
  message: "Install record found"
39152
39117
  });
39153
- } catch {
39118
+ } catch (err) {
39119
+ const kind = isWarmHubError(err) ? err.kind : undefined;
39120
+ const notInstalled = kind === "NOT_FOUND";
39154
39121
  return {
39155
- componentId,
39156
- componentName: componentId,
39157
- state: "error",
39122
+ componentId: ref,
39123
+ componentName: ref,
39124
+ state: notInstalled ? "uninstalled" : "error",
39158
39125
  findings: [
39159
39126
  {
39160
- resource: "ComponentInstall",
39127
+ resource: "install",
39161
39128
  status: "missing",
39162
- message: `ComponentInstall/${componentId} not found`
39129
+ message: notInstalled ? `Component "${ref}" is not actively installed` : `Failed to resolve component "${ref}"`
39163
39130
  }
39164
39131
  ]
39165
39132
  };
39166
39133
  }
39167
- const componentName = typeof installData.name === "string" ? installData.name : componentId;
39168
- const registeredComponentRef = typeof installData.registeredComponentRef === "string" && installData.registeredComponentRef.length > 0 ? installData.registeredComponentRef : undefined;
39169
- if (!registeredComponentRef) {
39170
- findings.push({
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 {
39134
+ const componentName = detail.componentName;
39135
+ const componentId = detail.installComponentId ?? ref;
39136
+ const registeredComponentRef = detail.ref ?? ref;
39137
+ if (!detail.installedManifest || typeof detail.installedManifest !== "object") {
39199
39138
  return {
39200
39139
  componentId,
39201
39140
  componentName,
@@ -39205,11 +39144,12 @@ async function doctorComponent(client, org, repo, componentId) {
39205
39144
  {
39206
39145
  resource: "manifest",
39207
39146
  status: "error",
39208
- message: "Failed to parse installed manifest snapshot"
39147
+ message: "Installed manifest unavailable from the registry"
39209
39148
  }
39210
39149
  ]
39211
39150
  };
39212
39151
  }
39152
+ const manifest = detail.installedManifest;
39213
39153
  for (const shape of manifest.shapes ?? []) {
39214
39154
  try {
39215
39155
  const s = await client.shape.get(org, repo, shape.name);
@@ -39340,22 +39280,19 @@ async function doctorComponent(client, org, repo, componentId) {
39340
39280
  });
39341
39281
  }
39342
39282
  }
39343
- try {
39344
- const detail = await client.component.get(org, repo, registeredComponentRef);
39345
- if (detail.updateAvailable === true && detail.latestVersion) {
39346
- findings.push({
39347
- resource: "version",
39348
- status: "warning",
39349
- message: `Installed ${detail.version ?? "version"}; ${detail.latestVersion} available — run wh component update ${registeredComponentRef} --repo ${org}/${repo}`
39350
- });
39351
- } else if (detail.updateAvailable === false && detail.version) {
39352
- findings.push({
39353
- resource: "version",
39354
- status: "ok",
39355
- message: `Up to date (${detail.version})`
39356
- });
39357
- }
39358
- } catch {}
39283
+ if (detail.updateAvailable === true && detail.latestVersion) {
39284
+ findings.push({
39285
+ resource: "version",
39286
+ status: "warning",
39287
+ message: `Installed ${detail.version ?? "version"}; ${detail.latestVersion} available — run wh component update ${registeredComponentRef} --repo ${org}/${repo}`
39288
+ });
39289
+ } else if (detail.updateAvailable === false && detail.version) {
39290
+ findings.push({
39291
+ resource: "version",
39292
+ status: "ok",
39293
+ message: `Up to date (${detail.version})`
39294
+ });
39295
+ }
39359
39296
  const hasMissing = findings.some((f) => f.status === "missing");
39360
39297
  const hasInactive = findings.some((f) => f.status === "inactive" && !f.resource.startsWith("sub:"));
39361
39298
  const hasShapeDrift = findings.some((f) => f.resource.startsWith("shape:") && f.status === "warning" && f.message.includes("differs from installed manifest"));
@@ -39368,24 +39305,6 @@ async function doctorComponent(client, org, repo, componentId) {
39368
39305
  } else {
39369
39306
  state = "ready";
39370
39307
  }
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
39308
  return { componentId, componentName, state, findings };
39390
39309
  }
39391
39310
 
@@ -39396,8 +39315,7 @@ var handleDoctor = async (ctx, { args }) => {
39396
39315
  usageError("Usage: wh component doctor <org/name> --repo org/repo", "wh component doctor warmhub/research-knowledge --repo myorg/myrepo");
39397
39316
  }
39398
39317
  const { org, repo } = parseOrgRepo(getRepoRef(ctx), ctx.config);
39399
- const componentId = await resolveInstalledComponentRefId(ctx.client, org, repo, name);
39400
- const result = await doctorComponent(ctx.client, org, repo, componentId);
39318
+ const result = await doctorComponent(ctx.client, org, repo, name);
39401
39319
  writeOutput(ctx, result, () => renderDoctorResult(ctx, result));
39402
39320
  };
39403
39321
  var handleTeardown = async (ctx, { args }) => {
@@ -39528,16 +39446,11 @@ var handleSearch2 = async (ctx, { flags, args }) => {
39528
39446
  };
39529
39447
  function stateToColor2(c, state) {
39530
39448
  switch (state) {
39531
- case "ready":
39449
+ case "active":
39532
39450
  return c.green;
39533
- case "paused":
39534
39451
  case "uninstalled":
39535
39452
  return c.yellow;
39536
- case "degraded":
39537
- return c.red;
39538
- case "error":
39539
- return c.red;
39540
- case "installing":
39453
+ case "initiated":
39541
39454
  return c.cyan;
39542
39455
  default:
39543
39456
  return c.dim;
@@ -45492,6 +45405,8 @@ async function dispatch(ctx) {
45492
45405
  const hint = ctx._domainHint ? ` ${ctx._domainHint}` : "";
45493
45406
  throw new CliError(2 /* UserInput */, "USER_INPUT", `Unknown command: ${command}`, undefined, hint.trim() || "Run 'wh help' for available commands.");
45494
45407
  }
45408
+ // ../../packages/warmhub-cli/src/manifest/shared-infra.ts
45409
+ var SHARED_INFRA_SHAPES = findSystemComponent(SYSTEM_COMPONENT_ID)?.shapes ?? [];
45495
45410
  // ../../packages/warmhub-cli/src/apply-global-flags.ts
45496
45411
  function invokesRemovedVerb(ctx) {
45497
45412
  return ctx.invocation.command === "credential" && ctx.invocation.positional[0] === "export";
@@ -45838,7 +45753,7 @@ function resolveLogLevel(flags, env) {
45838
45753
  // package.json
45839
45754
  var package_default3 = {
45840
45755
  name: "@warmhub/cli",
45841
- version: "0.65.0",
45756
+ version: "0.67.0",
45842
45757
  private: false,
45843
45758
  type: "module",
45844
45759
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -46493,4 +46408,4 @@ if (!updateCheckSuppressedByArgv && shouldRunUpdateCheck(updateEligibility)) {
46493
46408
  var interceptedExitCode = await maybeHandleComponentShellBoundary(dispatchArgv);
46494
46409
  process.exitCode = interceptedExitCode === undefined ? await runCli(dispatchArgv, { version: package_default3.version }) : interceptedExitCode;
46495
46410
 
46496
- //# debugId=B70D5B946B8CF0E364756E2164756E21
46411
+ //# debugId=F47337F68EA6DF1364756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmhub/cli",
3
- "version": "0.65.0",
3
+ "version": "0.67.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",