@warmhub/cli 0.47.0 → 0.48.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 +88 -44
  2. package/package.json +1 -1
package/dist/wh.js CHANGED
@@ -19192,16 +19192,28 @@ var PLATFORM_STATUS_PROBE_ARTIFACT_FIELDS = {
19192
19192
  }
19193
19193
  };
19194
19194
  // ../../packages/rules/src/reserved-orgs.ts
19195
+ var RESERVED_RAW_CONTENT_TOP_LEVEL_NAMES = [
19196
+ "_app",
19197
+ "_static",
19198
+ "api",
19199
+ "health",
19200
+ "healthz",
19201
+ "mcp",
19202
+ "readyz",
19203
+ "robots.txt",
19204
+ "sse",
19205
+ "trpc",
19206
+ "version"
19207
+ ];
19195
19208
  var RESERVED_ORG_NAMES = [
19209
+ ...RESERVED_RAW_CONTENT_TOP_LEVEL_NAMES,
19196
19210
  "admin",
19197
- "api",
19198
19211
  "billing",
19199
19212
  "blog",
19200
19213
  "docs",
19201
19214
  "help",
19202
19215
  "login",
19203
19216
  "public",
19204
- "robots.txt",
19205
19217
  "settings",
19206
19218
  "signup",
19207
19219
  "status",
@@ -19515,7 +19527,7 @@ function findSystemComponent(componentId) {
19515
19527
  // ../../packages/sdk-ts/package.json
19516
19528
  var package_default = {
19517
19529
  name: "@warmhub/sdk-ts",
19518
- version: "0.46.0",
19530
+ version: "0.47.0",
19519
19531
  private: false,
19520
19532
  type: "module",
19521
19533
  description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -30099,6 +30111,17 @@ async function reconcileComponent(client, org, repo, pkg, source, existingInstal
30099
30111
  };
30100
30112
  }
30101
30113
  steps.push({ step: "validate", status: "ok" });
30114
+ const partitionedShapes = partitionByProvisioning(manifest.shapes, "Shape");
30115
+ const partitionedCreds = partitionByProvisioning(manifest.credentials, "CredentialSet");
30116
+ const partitionedSubs = partitionByProvisioning(manifest.subscriptions, "Subscription");
30117
+ const setupCreates = [
30118
+ ...partitionedShapes.setupRefs,
30119
+ ...partitionedCreds.setupRefs,
30120
+ ...partitionedSubs.setupRefs
30121
+ ];
30122
+ const reconcileShapes = partitionedShapes.manifestEntries;
30123
+ const reconcileCreds = partitionedCreds.manifestEntries;
30124
+ const reconcileSubs = partitionedSubs.manifestEntries;
30102
30125
  await ensureSharedInfra(client, org, repo);
30103
30126
  steps.push({ step: "ensure-shared-infra", status: "ok" });
30104
30127
  const existingData = existingInstall.data;
@@ -30118,7 +30141,7 @@ async function reconcileComponent(client, org, repo, pkg, source, existingInstal
30118
30141
  const liveShapeNames = new Set;
30119
30142
  const liveShapeDataByName = new Map;
30120
30143
  const liveShapeComponentIdByName = new Map;
30121
- for (const shape of manifest.shapes) {
30144
+ for (const shape of reconcileShapes) {
30122
30145
  if (isFailedInstallState || previousState !== "degraded" && !oldShapeNames.has(shape.name)) {
30123
30146
  continue;
30124
30147
  }
@@ -30139,7 +30162,7 @@ async function reconcileComponent(client, org, repo, pkg, source, existingInstal
30139
30162
  } catch {}
30140
30163
  }
30141
30164
  const liveSubNames = new Set;
30142
- for (const sub of manifest.subscriptions) {
30165
+ for (const sub of reconcileSubs) {
30143
30166
  if (wasIncomplete || !oldSubNames.has(sub.name))
30144
30167
  continue;
30145
30168
  try {
@@ -30148,7 +30171,7 @@ async function reconcileComponent(client, org, repo, pkg, source, existingInstal
30148
30171
  } catch {}
30149
30172
  }
30150
30173
  const liveCredNames = new Set;
30151
- for (const cred of manifest.credentials) {
30174
+ for (const cred of reconcileCreds) {
30152
30175
  if (wasIncomplete || !oldCredNames.has(cred.name))
30153
30176
  continue;
30154
30177
  const credentialSetName = resolveManifestCredentialName(cred.name, {
@@ -30160,7 +30183,7 @@ async function reconcileComponent(client, org, repo, pkg, source, existingInstal
30160
30183
  liveCredNames.add(cred.name);
30161
30184
  } catch {}
30162
30185
  }
30163
- const newShapes = manifest.shapes.filter((s) => !liveShapeNames.has(s.name));
30186
+ const newShapes = reconcileShapes.filter((s) => !liveShapeNames.has(s.name));
30164
30187
  if (newShapes.length > 0) {
30165
30188
  const shapeOps = newShapes.map((shape) => ({
30166
30189
  operation: "add",
@@ -30181,7 +30204,7 @@ async function reconcileComponent(client, org, repo, pkg, source, existingInstal
30181
30204
  }
30182
30205
  }
30183
30206
  }
30184
- const changedShapes = manifest.shapes.filter((shape) => {
30207
+ const changedShapes = reconcileShapes.filter((shape) => {
30185
30208
  if (!liveShapeNames.has(shape.name))
30186
30209
  return false;
30187
30210
  const liveData = liveShapeDataByName.get(shape.name);
@@ -30208,7 +30231,7 @@ async function reconcileComponent(client, org, repo, pkg, source, existingInstal
30208
30231
  });
30209
30232
  }
30210
30233
  }
30211
- const newCreds = manifest.credentials.filter((c) => !oldCredNames.has(c.name) || !liveCredNames.has(c.name));
30234
+ const newCreds = reconcileCreds.filter((c) => !oldCredNames.has(c.name) || !liveCredNames.has(c.name));
30212
30235
  for (const cred of newCreds) {
30213
30236
  const credentialSetName = resolveManifestCredentialName(cred.name, {
30214
30237
  orgName: org,
@@ -30237,7 +30260,7 @@ async function reconcileComponent(client, org, repo, pkg, source, existingInstal
30237
30260
  }
30238
30261
  }
30239
30262
  }
30240
- const newSubs = manifest.subscriptions.filter((s) => !oldSubNames.has(s.name) || !liveSubNames.has(s.name));
30263
+ const newSubs = reconcileSubs.filter((s) => !oldSubNames.has(s.name) || !liveSubNames.has(s.name));
30241
30264
  for (const sub of newSubs) {
30242
30265
  let compiled;
30243
30266
  try {
@@ -30288,7 +30311,7 @@ async function reconcileComponent(client, org, repo, pkg, source, existingInstal
30288
30311
  } catch {}
30289
30312
  }
30290
30313
  }
30291
- const existingSubs = manifest.subscriptions.filter((s) => oldSubNames.has(s.name) && liveSubNames.has(s.name));
30314
+ const existingSubs = reconcileSubs.filter((s) => oldSubNames.has(s.name) && liveSubNames.has(s.name));
30292
30315
  for (const sub of existingSubs) {
30293
30316
  const stepName = `update-sub-${sub.name}`;
30294
30317
  let compiled;
@@ -30418,7 +30441,7 @@ async function reconcileComponent(client, org, repo, pkg, source, existingInstal
30418
30441
  state,
30419
30442
  steps,
30420
30443
  errors,
30421
- setupCreates: []
30444
+ setupCreates
30422
30445
  };
30423
30446
  }
30424
30447
 
@@ -37332,7 +37355,7 @@ function resolveLogLevel(flags, env) {
37332
37355
  // package.json
37333
37356
  var package_default3 = {
37334
37357
  name: "@warmhub/cli",
37335
- version: "0.47.0",
37358
+ version: "0.48.0",
37336
37359
  private: false,
37337
37360
  type: "module",
37338
37361
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -37576,7 +37599,10 @@ async function maybeHandleComponentShellBoundary(argv, deps = {}) {
37576
37599
  pathExists,
37577
37600
  runGit,
37578
37601
  installFromPath: installFromPathImpl,
37579
- materializeComponentArchive: materializeComponentArchiveImpl
37602
+ resolveRegisteredInstall: resolveRegisteredInstallImpl,
37603
+ downloadRegisteredSource: downloadRegisteredSourceImpl,
37604
+ materializeComponentArchive: materializeComponentArchiveImpl,
37605
+ callRegisteredSetup: callRegisteredSetupImpl
37580
37606
  });
37581
37607
  } catch (error) {
37582
37608
  return printCliError(toCliError2(error), writeErr, {
@@ -37649,13 +37675,33 @@ async function handleGithubInstall(args) {
37649
37675
  }
37650
37676
  async function handleRegisteredInstall(args) {
37651
37677
  const parsedRepo = parseOrgRepo(args.repoFlag, args.config);
37652
- const installRepo = `${parsedRepo.org}/${parsedRepo.repo}`;
37678
+ return performRegisteredInstall({
37679
+ componentRef: args.componentRef,
37680
+ refOverride: args.refOverride,
37681
+ verb: "Installed",
37682
+ client: args.client,
37683
+ parsedRepo,
37684
+ format: args.format,
37685
+ writeOut: args.writeOut,
37686
+ writeErr: args.writeErr,
37687
+ installFromPath: args.installFromPath,
37688
+ resolveRegisteredInstall: args.resolveRegisteredInstall,
37689
+ downloadRegisteredSource: args.downloadRegisteredSource,
37690
+ materializeComponentArchive: args.materializeComponentArchive,
37691
+ callRegisteredSetup: args.callRegisteredSetup
37692
+ });
37693
+ }
37694
+ async function performRegisteredInstall(args) {
37695
+ const installRepo = `${args.parsedRepo.org}/${args.parsedRepo.repo}`;
37653
37696
  const resolved = await args.resolveRegisteredInstall({
37654
37697
  componentRef: args.componentRef,
37655
37698
  installRepo,
37656
37699
  client: args.client
37657
37700
  });
37658
- const ref = normalizeGitRef(args.refOverride ?? resolved.sourceDefaultRef ?? undefined);
37701
+ const persistedInstallId = readPersistedString(args.persistedInstallData, "installId");
37702
+ const persistedRef = readPersistedString(args.persistedInstallData, "sourceRef");
37703
+ const installId = persistedInstallId ?? resolved.installId;
37704
+ const ref = normalizeGitRef(args.refOverride ?? persistedRef ?? resolved.sourceDefaultRef ?? undefined);
37659
37705
  const downloaded = await args.downloadRegisteredSource({
37660
37706
  componentRef: args.componentRef,
37661
37707
  installRepo,
@@ -37666,16 +37712,16 @@ async function handleRegisteredInstall(args) {
37666
37712
  try {
37667
37713
  const resolvedRef = ref ?? downloaded.sourceRef;
37668
37714
  invalidateInstallSnapshotCache(installRepo);
37669
- const result = await args.installFromPath(args.client, parsedRepo.org, parsedRepo.repo, extracted.componentDir, {
37715
+ const result = await args.installFromPath(args.client, args.parsedRepo.org, args.parsedRepo.repo, extracted.componentDir, {
37670
37716
  githubUrl: downloaded.sourceUrl,
37671
37717
  ref: resolvedRef,
37672
37718
  resolvedSha: downloaded.resolvedSha ?? "",
37673
- installId: resolved.installId,
37719
+ installId,
37674
37720
  sourceKind: "registered",
37675
37721
  registeredComponentRef: args.componentRef
37676
37722
  });
37677
37723
  if (!result.ok) {
37678
- await writeInstallResult(args.writeOut, args.writeErr, args.format, "Installed", result, installRepo, args.client);
37724
+ await writeInstallResult(args.writeOut, args.writeErr, args.format, args.verb, result, installRepo, args.client);
37679
37725
  return 1 /* Runtime */;
37680
37726
  }
37681
37727
  if (resolved.hasSetup) {
@@ -37684,7 +37730,7 @@ async function handleRegisteredInstall(args) {
37684
37730
  setupResult = await args.callRegisteredSetup({
37685
37731
  componentRef: args.componentRef,
37686
37732
  installRepo,
37687
- installId: resolved.installId,
37733
+ installId,
37688
37734
  ref: resolvedRef,
37689
37735
  resolvedSha: downloaded.resolvedSha,
37690
37736
  client: args.client
@@ -37692,7 +37738,7 @@ async function handleRegisteredInstall(args) {
37692
37738
  } catch (error) {
37693
37739
  if (isMissingManifestPermissionError(error)) {
37694
37740
  const backendCode = warmHubErrorBackendCode(error) ?? warmHubErrorKind(error);
37695
- throw new CliError(2 /* UserInput */, "USER_INPUT", error.message, undefined, "Ask an org owner/admin to grant the missing permissions on the install repo, then re-run install.", undefined, backendCode);
37741
+ throw new CliError(2 /* UserInput */, "USER_INPUT", error.message, undefined, `Ask an org owner/admin to grant the missing permissions on the install repo, then re-run ${args.verb === "Installed" ? "install" : "update"}.`, undefined, backendCode);
37696
37742
  }
37697
37743
  throw error;
37698
37744
  }
@@ -37700,12 +37746,16 @@ async function handleRegisteredInstall(args) {
37700
37746
  throw new CliError(1 /* Runtime */, "BACKEND", `Component setup failed with status ${setupResult.status}${setupResult.body ? `: ${setupResult.body}` : ""}`);
37701
37747
  }
37702
37748
  }
37703
- await writeInstallResult(args.writeOut, args.writeErr, args.format, "Installed", result, installRepo, args.client);
37749
+ await writeInstallResult(args.writeOut, args.writeErr, args.format, args.verb, result, installRepo, args.client);
37704
37750
  return result.ok ? 0 /* Ok */ : 1 /* Runtime */;
37705
37751
  } finally {
37706
37752
  extracted.cleanup();
37707
37753
  }
37708
37754
  }
37755
+ function readPersistedString(data, key) {
37756
+ const value = data?.[key];
37757
+ return typeof value === "string" && value.length > 0 ? value : undefined;
37758
+ }
37709
37759
  function isMissingManifestPermissionError(error) {
37710
37760
  return warmHubErrorKind(error) === "FORBIDDEN" && error instanceof Error && error.message.startsWith("Cannot install: caller is missing repo permissions required by the manifest:");
37711
37761
  }
@@ -37749,28 +37799,22 @@ async function handleGithubUpdate(args) {
37749
37799
  throw new CliError(2 /* UserInput */, "USER_INPUT", `Component '${args.name}' is a bundled system component. Use 'wh component install ${source.componentId} --repo ${installRepo}' to update it.`);
37750
37800
  }
37751
37801
  if (source.kind === "registered") {
37752
- const installRepo2 = `${parsedRepo.org}/${parsedRepo.repo}`;
37753
- const [ownerOrg, componentName] = source.componentRef.split("/");
37754
- const downloaded = await args.client.component.registry.downloadSource(ownerOrg, componentName, {
37755
- installRepo: installRepo2,
37756
- ...source.ref ? { ref: source.ref } : {}
37802
+ return performRegisteredInstall({
37803
+ componentRef: source.componentRef,
37804
+ refOverride: args.refOverride,
37805
+ persistedInstallData: installData,
37806
+ verb: "Updated",
37807
+ client: args.client,
37808
+ parsedRepo,
37809
+ format: args.format,
37810
+ writeOut: args.writeOut,
37811
+ writeErr: args.writeErr,
37812
+ installFromPath: args.installFromPath,
37813
+ resolveRegisteredInstall: args.resolveRegisteredInstall,
37814
+ downloadRegisteredSource: args.downloadRegisteredSource,
37815
+ materializeComponentArchive: args.materializeComponentArchive,
37816
+ callRegisteredSetup: args.callRegisteredSetup
37757
37817
  });
37758
- const extracted = args.materializeComponentArchive(downloaded.archive, downloaded.componentRef, source.ref ?? downloaded.sourceRef);
37759
- try {
37760
- const updateRef2 = source.ref ?? downloaded.sourceRef;
37761
- invalidateInstallSnapshotCache(installRepo2);
37762
- const result2 = await args.installFromPath(args.client, parsedRepo.org, parsedRepo.repo, extracted.componentDir, {
37763
- githubUrl: downloaded.sourceUrl,
37764
- ref: updateRef2,
37765
- resolvedSha: downloaded.resolvedSha ?? "",
37766
- sourceKind: "registered",
37767
- registeredComponentRef: source.componentRef
37768
- });
37769
- await writeInstallResult(args.writeOut, args.writeErr, args.format, "Updated", result2, installRepo2, args.client);
37770
- return result2.ok ? 0 /* Ok */ : 1 /* Runtime */;
37771
- } finally {
37772
- extracted.cleanup();
37773
- }
37774
37818
  }
37775
37819
  const componentDir = args.getComponentPath(`${source.owner}--${source.repo}`);
37776
37820
  args.ensureCacheDir();
@@ -38338,4 +38382,4 @@ if (!updateCheckSuppressedByArgv && shouldRunUpdateCheck(updateEligibility)) {
38338
38382
  var interceptedExitCode = await maybeHandleComponentShellBoundary(dispatchArgv);
38339
38383
  process.exitCode = interceptedExitCode === undefined ? await runCli(dispatchArgv, { version: package_default3.version }) : interceptedExitCode;
38340
38384
 
38341
- //# debugId=7F3BC88908F9842C64756E2164756E21
38385
+ //# debugId=4217C1CF64E0C7F164756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmhub/cli",
3
- "version": "0.47.0",
3
+ "version": "0.48.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.",