@koda-sl/baker-cli 0.353.0-dev.5d1d795f9 → 0.353.0-dev.847cbae62

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
@@ -68,7 +68,7 @@ import {
68
68
  validateCanvasDeep,
69
69
  withoutCastName,
70
70
  ytDlpBlockSignal
71
- } from "./chunk-PHHQLFY3.js";
71
+ } from "./chunk-B7MLH3K6.js";
72
72
  import {
73
73
  csvOrJson,
74
74
  daysAgoIso,
@@ -11035,6 +11035,20 @@ function adCopyHints(payload) {
11035
11035
  return tells.slice(0, MAX_HINTS).map(hintFor);
11036
11036
  }
11037
11037
 
11038
+ // src/commands/ads/hints.ts
11039
+ function backendHints(envelope) {
11040
+ const hints2 = envelope.hints;
11041
+ return Array.isArray(hints2) ? hints2.filter((hint) => typeof hint === "string") : [];
11042
+ }
11043
+ function withHints(envelope, extra) {
11044
+ const hints2 = [...backendHints(envelope), ...extra];
11045
+ return hints2.length > 0 ? { ...envelope, hints: hints2 } : envelope;
11046
+ }
11047
+ function hintLines(envelope) {
11048
+ return backendHints(envelope).map((hint) => `
11049
+ > ${hint}`).join("");
11050
+ }
11051
+
11038
11052
  // src/commands/ads/google/draft-status.ts
11039
11053
  var OPERATION_LABELS = {
11040
11054
  create: "Creating",
@@ -11364,7 +11378,7 @@ async function stageGoogleOp(raw, hints2) {
11364
11378
  const chatId = requireChatId();
11365
11379
  const response = await apiPost("/api/ads/google/draft/stage", { chatId, op: preflight.data });
11366
11380
  const allHints = [...noopHints(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
11367
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
11381
+ writeJsonEnvelope(withHints(response, allHints));
11368
11382
  } catch (err) {
11369
11383
  handleGoogleError(err);
11370
11384
  }
@@ -11402,7 +11416,7 @@ async function stageGoogleOps(rawOps, hints2) {
11402
11416
  const chatId = requireChatId();
11403
11417
  const response = await apiPost("/api/ads/google/draft/stage-batch", { chatId, ops });
11404
11418
  const allHints = [...skippedHints(response.data.skipped ?? [], ops.length), ...hints2 ?? [], ...adCopyHints(ops)];
11405
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
11419
+ writeJsonEnvelope(withHints(response, allHints));
11406
11420
  } catch (err) {
11407
11421
  handleGoogleError(err);
11408
11422
  }
@@ -11430,7 +11444,7 @@ async function draftListAction(json, chat) {
11430
11444
  writeJsonEnvelope(response);
11431
11445
  return;
11432
11446
  }
11433
- process.stdout.write(`${renderDraftStatus(response.data)}
11447
+ process.stdout.write(`${renderDraftStatus(response.data)}${hintLines(response)}
11434
11448
  `);
11435
11449
  } catch (err) {
11436
11450
  handleGoogleError(err);
@@ -19214,7 +19228,7 @@ async function stageOp(raw, hints2) {
19214
19228
  op: preflight.data
19215
19229
  });
19216
19230
  const allHints = [...batchNudge(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
19217
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
19231
+ writeJsonEnvelope(withHints(response, allHints));
19218
19232
  } catch (err) {
19219
19233
  handleLinkedinError(err);
19220
19234
  }
@@ -19241,7 +19255,7 @@ async function stageLinkedinOps(rawOps, hints2) {
19241
19255
  const chatId = requireChatId();
19242
19256
  const response = await apiPost("/api/ads/linkedin/draft/stage-batch", { chatId, ops });
19243
19257
  const allHints = [...hints2 ?? [], ...adCopyHints(ops)];
19244
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
19258
+ writeJsonEnvelope(withHints(response, allHints));
19245
19259
  } catch (err) {
19246
19260
  handleLinkedinError(err);
19247
19261
  }
@@ -22450,7 +22464,7 @@ async function listDraft(json, chat) {
22450
22464
  writeJsonEnvelope(response);
22451
22465
  return;
22452
22466
  }
22453
- process.stdout.write(`${renderDraftStatus2(response.data)}
22467
+ process.stdout.write(`${renderDraftStatus2(response.data)}${hintLines(response)}
22454
22468
  `);
22455
22469
  } catch (err) {
22456
22470
  handleLinkedinError(err);
@@ -24979,7 +24993,7 @@ async function stageOp2(raw) {
24979
24993
  const chatId = requireChatId();
24980
24994
  const response = await apiPost("/api/ads/meta/draft/stage", { chatId, op: preflight.data });
24981
24995
  const copyHints = adCopyHints(preflight.data);
24982
- writeJsonEnvelope(copyHints.length > 0 ? { ...response, hints: copyHints } : response);
24996
+ writeJsonEnvelope(withHints(response, copyHints));
24983
24997
  } catch (err) {
24984
24998
  handleMetaError(err);
24985
24999
  }