@koda-sl/baker-cli 0.306.1-dev.bb28562ac → 0.306.2-dev.bb28562ac

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/cli.js CHANGED
@@ -30506,13 +30506,19 @@ function failValidation2(message, fix) {
30506
30506
  writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message, ...fix ? { fix } : {} } });
30507
30507
  process.exit(1);
30508
30508
  }
30509
- function avatarFailureFix(err, handle) {
30509
+ function avatarFailureFix(err, handle, context = {}) {
30510
30510
  if (err.code === "NOT_FOUND") {
30511
30511
  return {
30512
30512
  action: "list_avatars",
30513
30513
  explanation: `Run \`baker avatars list\` to see which avatars this company has${handle ? ` \u2014 "${handle}" is not one of them` : ""}. Handles are lowercase letters, numbers and dashes ("maria-founder", not "Maria Founder"). If the roster is empty, create the avatar first with \`baker avatars create\`. Do not abandon the wider job over this \u2014 carry on without the avatar and say so.`
30514
30514
  };
30515
30515
  }
30516
+ if (err.code === "CONFLICT" && context.operation === "remove") {
30517
+ return {
30518
+ action: "wait_for_the_user",
30519
+ explanation: `Do not remove or recreate${handle ? ` @${handle}` : " this avatar"} \u2014 wait. The portraits are on the user's screen and the turn continues once they answer. If you think the faces are wrong, say so in your reply and let them turn all four down; that recasts the same avatar from what they tell you was missing, and keeps everything already pointing at it.`
30520
+ };
30521
+ }
30516
30522
  if (err.code === "CONFLICT" && handle) {
30517
30523
  return {
30518
30524
  action: "use_the_existing_avatar",
@@ -30521,9 +30527,9 @@ function avatarFailureFix(err, handle) {
30521
30527
  }
30522
30528
  return void 0;
30523
30529
  }
30524
- function failAvatarApi(err, handle) {
30530
+ function failAvatarApi(err, handle, context = {}) {
30525
30531
  if (err instanceof ApiError) {
30526
- const fix = avatarFailureFix(err, handle);
30532
+ const fix = avatarFailureFix(err, handle, context);
30527
30533
  writeJson({ ok: false, error: { code: err.code, message: err.message, ...fix ? { fix } : {} } });
30528
30534
  process.exit(1);
30529
30535
  }
@@ -30814,7 +30820,7 @@ var deleteCommand = defineCommand97({
30814
30820
  });
30815
30821
  writeJson({ ok: true, data, hints: removalHints({ handle: data.handle, archived: data.archived }) });
30816
30822
  } catch (err) {
30817
- failAvatarApi(err, handle);
30823
+ failAvatarApi(err, handle, { operation: "remove" });
30818
30824
  }
30819
30825
  }
30820
30826
  });