@warmhub/cli 0.147.0 → 0.148.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 +39 -19
  2. package/package.json +1 -1
package/dist/wh.js CHANGED
@@ -46860,7 +46860,7 @@ function createStreamingSubmissionHandle(input, deps) {
46860
46860
  // ../../packages/sdk-ts/package.json
46861
46861
  var package_default = {
46862
46862
  name: "@warmhub/sdk-ts",
46863
- version: "0.145.0",
46863
+ version: "0.146.0",
46864
46864
  private: false,
46865
46865
  type: "module",
46866
46866
  description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -49844,6 +49844,10 @@ function unauthenticatedHint(message) {
49844
49844
  }
49845
49845
  return "Check credentials and backend permissions.";
49846
49846
  }
49847
+ function signedOutNotFoundHint(profile) {
49848
+ const flag = profile && profile !== "default" ? ` --profile ${profile}` : "";
49849
+ return `Not logged in, so only public data is visible. If this is private, run \`wh auth login${flag}\`.`;
49850
+ }
49847
49851
  function reloginHint(profile) {
49848
49852
  const named = profile ? ` for profile "${profile}"` : "";
49849
49853
  const flag = profile && profile !== "default" ? ` --profile ${profile}` : "";
@@ -50330,6 +50334,13 @@ function usageError(usage, ...examples) {
50330
50334
  `)}`;
50331
50335
  throw new CliError(2 /* UserInput */, "USER_INPUT", usage, undefined, hint);
50332
50336
  }
50337
+ function withSignedOutHint(error51, profile) {
50338
+ const notFound = error51.errorCode === "NOT_FOUND" || error51.cause instanceof WarmHubError && error51.cause.code === "NOT_FOUND";
50339
+ const login = signedOutNotFoundHint(profile);
50340
+ if (!notFound || error51.hint?.includes(login))
50341
+ return error51;
50342
+ return new CliError(error51.code, error51.kind, error51.message, error51.cause, error51.hint ? `${error51.hint} ${login}` : login, error51.context, error51.errorCode, error51.recovery);
50343
+ }
50333
50344
  function toCliError(err, opts) {
50334
50345
  if (err instanceof CliError)
50335
50346
  return err;
@@ -51985,6 +51996,14 @@ function getTokenInfo(profile) {
51985
51996
  canRefresh: source === "device" && !!tokens.refreshToken
51986
51997
  };
51987
51998
  }
51999
+ function isSignedOut(profile) {
52000
+ try {
52001
+ const info = getTokenInfo(profile);
52002
+ return !info || info.source === "token" && info.expired;
52003
+ } catch {
52004
+ return false;
52005
+ }
52006
+ }
51988
52007
  async function getValidToken(profile, signal, options = {}) {
51989
52008
  const log = getLog();
51990
52009
  const envToken = process.env.WH_TOKEN;
@@ -53243,21 +53262,17 @@ function writeInstallSnapshotCache(repoSlug, cache) {
53243
53262
  renameSync3(tmp, path);
53244
53263
  }
53245
53264
  }
53246
- function isPlainObject3(value) {
53247
- return typeof value === "object" && value !== null;
53248
- }
53249
53265
  function isInstallSnapshotCacheShape(value) {
53250
- if (!isPlainObject3(value))
53266
+ if (!isPlainObject(value))
53251
53267
  return false;
53252
53268
  if (typeof value.cachedAt !== "number")
53253
53269
  return false;
53254
53270
  if (typeof value.repoSlug !== "string")
53255
53271
  return false;
53256
- if (!isPlainObject3(value.components))
53272
+ if (!isPlainObject(value.components))
53257
53273
  return false;
53258
- const components = value.components;
53259
- for (const entry of Object.values(components)) {
53260
- if (!isPlainObject3(entry))
53274
+ for (const entry of Object.values(value.components)) {
53275
+ if (!isPlainObject(entry))
53261
53276
  return false;
53262
53277
  const component = entry;
53263
53278
  if (typeof component.ref !== "string")
@@ -53276,11 +53291,10 @@ function isInstallSnapshotCacheShape(value) {
53276
53291
  if (!Array.isArray(component.methods))
53277
53292
  return false;
53278
53293
  }
53279
- if (!isPlainObject3(value.installs))
53294
+ if (!isPlainObject(value.installs))
53280
53295
  return false;
53281
- const installs = value.installs;
53282
- for (const entry of Object.values(installs)) {
53283
- if (!isPlainObject3(entry))
53296
+ for (const entry of Object.values(value.installs)) {
53297
+ if (!isPlainObject(entry))
53284
53298
  return false;
53285
53299
  const install = entry;
53286
53300
  if (typeof install.ref !== "string")
@@ -72270,7 +72284,8 @@ async function runPreparedCli(rawArgv, prepared, opts) {
72270
72284
  exitCode = cancelledExitCode;
72271
72285
  return exitCode;
72272
72286
  }
72273
- const cliError = toCliError2(error51, { profile: activeProfile });
72287
+ const converted = toCliError2(error51, { profile: activeProfile });
72288
+ const cliError = isSignedOut(activeProfile) ? withSignedOutHint(converted, activeProfile) : converted;
72274
72289
  const fields = {
72275
72290
  kind: cliError.kind,
72276
72291
  exit_code: cliError.code,
@@ -72360,7 +72375,7 @@ function resolveLogLevel(flagLevel, env) {
72360
72375
  // package.json
72361
72376
  var package_default3 = {
72362
72377
  name: "@warmhub/cli",
72363
- version: "0.147.0",
72378
+ version: "0.148.0",
72364
72379
  private: false,
72365
72380
  type: "module",
72366
72381
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -72443,17 +72458,20 @@ async function maybeHandleComponentShellBoundary(prepared, deps = {}) {
72443
72458
  const writeErr = deps.err ?? err;
72444
72459
  const debug = prepared.presentation.debug === true || process.env.WARMHUB_DEBUG === "1";
72445
72460
  const format = prepared.presentation.format;
72461
+ let profile;
72446
72462
  try {
72447
72463
  if (invocation.flags["dry-run"] === true)
72448
72464
  return;
72449
72465
  const source = invocation.positionals[0];
72450
- const { config: config2, client } = resolveCliContext({
72466
+ const context = resolveCliContext({
72451
72467
  invocation,
72452
72468
  format,
72453
72469
  functionLogs: "off",
72454
72470
  config: deps.config,
72455
72471
  client: deps.client
72456
72472
  });
72473
+ const { config: config2, client } = context;
72474
+ profile = context.profile;
72457
72475
  if (!source) {
72458
72476
  return;
72459
72477
  }
@@ -72478,7 +72496,9 @@ async function maybeHandleComponentShellBoundary(prepared, deps = {}) {
72478
72496
  writeErr
72479
72497
  });
72480
72498
  } catch (error51) {
72481
- return printCliError(toCliError2(error51), writeErr, {
72499
+ const converted = toCliError2(error51, { profile });
72500
+ const cliError = isSignedOut(profile) ? withSignedOutHint(converted, profile) : converted;
72501
+ return printCliError(cliError, writeErr, {
72482
72502
  format,
72483
72503
  debug
72484
72504
  });
@@ -72985,5 +73005,5 @@ process.exitCode = interceptedExitCode === undefined ? await runPreparedCli(laun
72985
73005
  version: package_default3.version
72986
73006
  }) : interceptedExitCode;
72987
73007
 
72988
- //# debugId=2ABA0653C6EADCF764756E2164756E21
72989
- //# warmhub-cli-build-info {"cliVersion":"0.147.0","sdkVersion":"0.145.0"}
73008
+ //# debugId=1702690161D073CA64756E2164756E21
73009
+ //# warmhub-cli-build-info {"cliVersion":"0.148.0","sdkVersion":"0.146.0"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmhub/cli",
3
- "version": "0.147.0",
3
+ "version": "0.148.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.",