@koda-sl/baker-cli 0.281.3-dev.1f1c09c80 → 0.281.4-dev.1f1c09c80

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
@@ -32938,6 +32938,20 @@ function endCardCta(spec) {
32938
32938
  return declared.toLowerCase().replace(/[.!?]$/, "") === closing.replace(/[.!?]$/, "") ? null : declared;
32939
32939
  }
32940
32940
  var AD_CAST_ID = "customer";
32941
+ function castedAvatarOnRoster(cast, roster) {
32942
+ if (!cast || cast.avatar || !cast.description) return null;
32943
+ const words2 = new Set(
32944
+ cast.description.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean)
32945
+ );
32946
+ for (const person of roster) {
32947
+ for (const label of [person.name, person.handle]) {
32948
+ const token = label.trim().toLowerCase();
32949
+ if (!token || token.includes("-") || token.length < 3) continue;
32950
+ if (words2.has(token)) return person.handle;
32951
+ }
32952
+ }
32953
+ return null;
32954
+ }
32941
32955
  function adSpecCastElements(spec, avatar) {
32942
32956
  const description = (avatar?.subjectDescription ?? spec.cast?.description)?.trim();
32943
32957
  if (!description) return [];
@@ -33398,6 +33412,25 @@ var scaffoldAdCommand = defineCommand105({
33398
33412
  process.exit(1);
33399
33413
  return;
33400
33414
  }
33415
+ if (!flagAvatar && !spec.data.cast?.avatar && spec.data.cast?.description) {
33416
+ const roster = await readAvatars(
33417
+ "/api/avatars",
33418
+ { status: "ready" }
33419
+ ).catch(() => null);
33420
+ const named = roster ? castedAvatarOnRoster(spec.data.cast, roster.avatars) : null;
33421
+ if (named) {
33422
+ writeJson({
33423
+ ok: false,
33424
+ error: {
33425
+ code: "VALIDATION_ERROR",
33426
+ message: `This ad describes its cast in words, but \`${named}\` is already one of this company's avatars \u2014 and the description names them. Described, they are re-invented every shot: the face drifts, their own voice is never used, and they cannot be shown speaking.`,
33427
+ fix: `Cast them instead: put \`"cast": { "avatar": "${named}" }\` in the spec, or pass \`--avatar ${named}\`. Keep a written description only for someone the company does not have.`
33428
+ }
33429
+ });
33430
+ process.exit(1);
33431
+ return;
33432
+ }
33433
+ }
33401
33434
  const handle = flagAvatar || spec.data.cast?.avatar?.trim();
33402
33435
  let avatar = null;
33403
33436
  let avatarError = null;
@@ -33477,7 +33510,7 @@ var scaffoldAdCommand = defineCommand105({
33477
33510
  error: {
33478
33511
  code: "VALIDATION_ERROR",
33479
33512
  message: `The brand mark at \`${resolvedLogo}\` could not be read, so there is no way to tell whether it is a real logo or a typed stand-in. An ad is not shipped on a mark nobody could open.`,
33480
- fix: `Check the file is there and readable, or put the client's logo in \`${BRAND_DIR}/logos/\` \u2014 a PNG at 1000px or wider, or an outlined SVG.`
33513
+ fix: `Check the file is there and readable, or put the client's logo in \`${BRAND_DIR}/logos/\` \u2014 the file their designer delivered \u2014 an outlined SVG, or the PNG they gave you.`
33481
33514
  }
33482
33515
  });
33483
33516
  process.exit(1);