@koda-sl/baker-cli 0.380.0 → 0.381.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.
- package/dist/cli.js +48 -24
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -12127,6 +12127,24 @@ function adCopyHints(payload) {
|
|
|
12127
12127
|
return tells.slice(0, MAX_HINTS).map(hintFor);
|
|
12128
12128
|
}
|
|
12129
12129
|
|
|
12130
|
+
// src/commands/ads/hints.ts
|
|
12131
|
+
function backendHints(envelope) {
|
|
12132
|
+
const hints2 = envelope.hints;
|
|
12133
|
+
return Array.isArray(hints2) ? hints2.filter((hint) => typeof hint === "string") : [];
|
|
12134
|
+
}
|
|
12135
|
+
function withHints(envelope, extra) {
|
|
12136
|
+
const hints2 = [...backendHints(envelope), ...extra];
|
|
12137
|
+
return hints2.length > 0 ? { ...envelope, hints: hints2 } : envelope;
|
|
12138
|
+
}
|
|
12139
|
+
function hintLines(envelope) {
|
|
12140
|
+
return backendHints(envelope).map((hint) => `
|
|
12141
|
+
> ${hint}`).join("");
|
|
12142
|
+
}
|
|
12143
|
+
function splitHints(response) {
|
|
12144
|
+
const { hints: hints2, ...data } = response;
|
|
12145
|
+
return { data, hints: hints2 ?? [] };
|
|
12146
|
+
}
|
|
12147
|
+
|
|
12130
12148
|
// src/commands/ads/google/copy-list-usage.ts
|
|
12131
12149
|
var AD_COPY_LIST_USAGE = `repeat the flag once per item, or pass one comma-separated list and wrap an item that contains a comma in double quotes: '"Fast, free quotes",Book today'. A flag given once is read as a list, so a lone item with a comma needs its double quotes too: '"Fast, free quotes"'`;
|
|
12132
12150
|
var COPY_LIST_FLAG = {
|
|
@@ -12491,7 +12509,7 @@ async function stageGoogleOp(raw, hints2) {
|
|
|
12491
12509
|
const chatId = requireChatId();
|
|
12492
12510
|
const response = await apiPost("/api/ads/google/draft/stage", { chatId, op: preflight.data });
|
|
12493
12511
|
const allHints = [...noopHints(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
|
|
12494
|
-
writeJsonEnvelope(
|
|
12512
|
+
writeJsonEnvelope(withHints(response, allHints));
|
|
12495
12513
|
} catch (err) {
|
|
12496
12514
|
handleGoogleError(err);
|
|
12497
12515
|
}
|
|
@@ -12529,7 +12547,7 @@ async function stageGoogleOps(rawOps, hints2) {
|
|
|
12529
12547
|
const chatId = requireChatId();
|
|
12530
12548
|
const response = await apiPost("/api/ads/google/draft/stage-batch", { chatId, ops });
|
|
12531
12549
|
const allHints = [...skippedHints(response.data.skipped ?? [], ops.length), ...hints2 ?? [], ...adCopyHints(ops)];
|
|
12532
|
-
writeJsonEnvelope(
|
|
12550
|
+
writeJsonEnvelope(withHints(response, allHints));
|
|
12533
12551
|
} catch (err) {
|
|
12534
12552
|
handleGoogleError(err);
|
|
12535
12553
|
}
|
|
@@ -12557,7 +12575,7 @@ async function draftListAction(json, chat) {
|
|
|
12557
12575
|
writeJsonEnvelope(response);
|
|
12558
12576
|
return;
|
|
12559
12577
|
}
|
|
12560
|
-
process.stdout.write(`${renderDraftStatus(response.data)}
|
|
12578
|
+
process.stdout.write(`${renderDraftStatus(response.data)}${hintLines(response)}
|
|
12561
12579
|
`);
|
|
12562
12580
|
} catch (err) {
|
|
12563
12581
|
handleGoogleError(err);
|
|
@@ -20432,7 +20450,7 @@ async function stageOp(raw, hints2) {
|
|
|
20432
20450
|
op: preflight.data
|
|
20433
20451
|
});
|
|
20434
20452
|
const allHints = [...batchNudge(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
|
|
20435
|
-
writeJsonEnvelope(
|
|
20453
|
+
writeJsonEnvelope(withHints(response, allHints));
|
|
20436
20454
|
} catch (err) {
|
|
20437
20455
|
handleLinkedinError(err);
|
|
20438
20456
|
}
|
|
@@ -20459,7 +20477,7 @@ async function stageLinkedinOps(rawOps, hints2) {
|
|
|
20459
20477
|
const chatId = requireChatId();
|
|
20460
20478
|
const response = await apiPost("/api/ads/linkedin/draft/stage-batch", { chatId, ops });
|
|
20461
20479
|
const allHints = [...hints2 ?? [], ...adCopyHints(ops)];
|
|
20462
|
-
writeJsonEnvelope(
|
|
20480
|
+
writeJsonEnvelope(withHints(response, allHints));
|
|
20463
20481
|
} catch (err) {
|
|
20464
20482
|
handleLinkedinError(err);
|
|
20465
20483
|
}
|
|
@@ -23731,7 +23749,7 @@ async function listDraft(json, chat) {
|
|
|
23731
23749
|
writeJsonEnvelope(response);
|
|
23732
23750
|
return;
|
|
23733
23751
|
}
|
|
23734
|
-
process.stdout.write(`${renderDraftStatus2(response.data)}
|
|
23752
|
+
process.stdout.write(`${renderDraftStatus2(response.data)}${hintLines(response)}
|
|
23735
23753
|
`);
|
|
23736
23754
|
} catch (err) {
|
|
23737
23755
|
handleLinkedinError(err);
|
|
@@ -26436,7 +26454,7 @@ async function stageOp2(raw) {
|
|
|
26436
26454
|
const chatId = requireChatId();
|
|
26437
26455
|
const response = await apiPost("/api/ads/meta/draft/stage", { chatId, op: preflight.data });
|
|
26438
26456
|
const copyHints = adCopyHints(preflight.data);
|
|
26439
|
-
writeJsonEnvelope(
|
|
26457
|
+
writeJsonEnvelope(withHints(response, copyHints));
|
|
26440
26458
|
} catch (err) {
|
|
26441
26459
|
handleMetaError(err);
|
|
26442
26460
|
}
|
|
@@ -27709,7 +27727,7 @@ async function listDraft2(json, chat) {
|
|
|
27709
27727
|
writeJsonEnvelope(response);
|
|
27710
27728
|
return;
|
|
27711
27729
|
}
|
|
27712
|
-
process.stdout.write(`${renderDraftStatus3(response.data)}
|
|
27730
|
+
process.stdout.write(`${renderDraftStatus3(response.data)}${hintLines(response)}
|
|
27713
27731
|
`);
|
|
27714
27732
|
} catch (err) {
|
|
27715
27733
|
handleMetaError(err);
|
|
@@ -51625,11 +51643,11 @@ var WARNING_HINT = "Read the warnings above before telling the user this is read
|
|
|
51625
51643
|
async function stageOp3(op) {
|
|
51626
51644
|
const chatId = requireChatId();
|
|
51627
51645
|
try {
|
|
51628
|
-
const data = await apiPost("/api/ga4/draft/stage", { chatId, op });
|
|
51646
|
+
const { data, hints: hints2 } = splitHints(await apiPost("/api/ga4/draft/stage", { chatId, op }));
|
|
51629
51647
|
writeJsonEnvelope({
|
|
51630
51648
|
ok: true,
|
|
51631
51649
|
data,
|
|
51632
|
-
hints: [...STAGE_HINTS, ...data.warnings.length > 0 ? [WARNING_HINT] : []]
|
|
51650
|
+
hints: [...hints2, ...STAGE_HINTS, ...data.warnings.length > 0 ? [WARNING_HINT] : []]
|
|
51633
51651
|
});
|
|
51634
51652
|
} catch (err) {
|
|
51635
51653
|
handleError5(err);
|
|
@@ -51643,11 +51661,13 @@ async function stageOps(ops) {
|
|
|
51643
51661
|
}
|
|
51644
51662
|
const chatId = requireChatId();
|
|
51645
51663
|
try {
|
|
51646
|
-
const data
|
|
51664
|
+
const { data, hints: hints2 } = splitHints(
|
|
51665
|
+
await apiPost("/api/ga4/draft/stage-batch", { chatId, ops })
|
|
51666
|
+
);
|
|
51647
51667
|
writeJsonEnvelope({
|
|
51648
51668
|
ok: true,
|
|
51649
51669
|
data,
|
|
51650
|
-
hints: [...STAGE_HINTS, ...data.ops.some((op) => op.warnings.length > 0) ? [WARNING_HINT] : []]
|
|
51670
|
+
hints: [...hints2, ...STAGE_HINTS, ...data.ops.some((op) => op.warnings.length > 0) ? [WARNING_HINT] : []]
|
|
51651
51671
|
});
|
|
51652
51672
|
} catch (err) {
|
|
51653
51673
|
handleError5(err);
|
|
@@ -51656,8 +51676,8 @@ async function stageOps(ops) {
|
|
|
51656
51676
|
async function draftAction2(path48, body, chat) {
|
|
51657
51677
|
const chatId = resolveChatId(chat);
|
|
51658
51678
|
try {
|
|
51659
|
-
const data = await apiPost(path48, { chatId, ...body });
|
|
51660
|
-
writeJsonEnvelope({ ok: true, data });
|
|
51679
|
+
const { data, hints: hints2 } = splitHints(await apiPost(path48, { chatId, ...body }));
|
|
51680
|
+
writeJsonEnvelope({ ok: true, data, ...hints2.length > 0 ? { hints: hints2 } : {} });
|
|
51661
51681
|
return data;
|
|
51662
51682
|
} catch (err) {
|
|
51663
51683
|
handleError5(err);
|
|
@@ -51689,12 +51709,13 @@ function renderDraft(response) {
|
|
|
51689
51709
|
async function draftList(json, chat) {
|
|
51690
51710
|
const chatId = resolveChatId(chat);
|
|
51691
51711
|
try {
|
|
51692
|
-
const
|
|
51712
|
+
const response = await apiPost("/api/ga4/draft", { chatId });
|
|
51713
|
+
const { data, hints: hints2 } = splitHints(response);
|
|
51693
51714
|
if (json) {
|
|
51694
|
-
writeJsonEnvelope({ ok: true, data });
|
|
51715
|
+
writeJsonEnvelope({ ok: true, data, ...hints2.length > 0 ? { hints: hints2 } : {} });
|
|
51695
51716
|
return;
|
|
51696
51717
|
}
|
|
51697
|
-
process.stdout.write(`${renderDraft(data)}
|
|
51718
|
+
process.stdout.write(`${renderDraft(data)}${hintLines(response)}
|
|
51698
51719
|
`);
|
|
51699
51720
|
} catch (err) {
|
|
51700
51721
|
handleError5(err);
|
|
@@ -66784,8 +66805,10 @@ var STAGE_HINTS2 = [
|
|
|
66784
66805
|
async function stageOp4(op) {
|
|
66785
66806
|
const chatId = requireChatId();
|
|
66786
66807
|
try {
|
|
66787
|
-
const data
|
|
66788
|
-
|
|
66808
|
+
const { data, hints: hints2 } = splitHints(
|
|
66809
|
+
await apiPost("/api/tag-manager/draft/stage", { chatId, op })
|
|
66810
|
+
);
|
|
66811
|
+
writeJsonEnvelope({ ok: true, data, hints: [...hints2, ...STAGE_HINTS2] });
|
|
66789
66812
|
} catch (err) {
|
|
66790
66813
|
handleError8(err);
|
|
66791
66814
|
}
|
|
@@ -66793,8 +66816,8 @@ async function stageOp4(op) {
|
|
|
66793
66816
|
async function draftAction3(path48, body, chat) {
|
|
66794
66817
|
const chatId = resolveChatId(chat);
|
|
66795
66818
|
try {
|
|
66796
|
-
const data = await apiPost(path48, { chatId, ...body });
|
|
66797
|
-
writeJsonEnvelope({ ok: true, data });
|
|
66819
|
+
const { data, hints: hints2 } = splitHints(await apiPost(path48, { chatId, ...body }));
|
|
66820
|
+
writeJsonEnvelope({ ok: true, data, ...hints2.length > 0 ? { hints: hints2 } : {} });
|
|
66798
66821
|
return data;
|
|
66799
66822
|
} catch (err) {
|
|
66800
66823
|
handleError8(err);
|
|
@@ -66825,12 +66848,13 @@ function renderDraft2(response) {
|
|
|
66825
66848
|
async function draftList2(json, chat) {
|
|
66826
66849
|
const chatId = resolveChatId(chat);
|
|
66827
66850
|
try {
|
|
66828
|
-
const
|
|
66851
|
+
const response = await apiPost("/api/tag-manager/draft", { chatId });
|
|
66852
|
+
const { data, hints: hints2 } = splitHints(response);
|
|
66829
66853
|
if (json) {
|
|
66830
|
-
writeJsonEnvelope({ ok: true, data });
|
|
66854
|
+
writeJsonEnvelope({ ok: true, data, ...hints2.length > 0 ? { hints: hints2 } : {} });
|
|
66831
66855
|
return;
|
|
66832
66856
|
}
|
|
66833
|
-
process.stdout.write(`${renderDraft2(data)}
|
|
66857
|
+
process.stdout.write(`${renderDraft2(data)}${hintLines(response)}
|
|
66834
66858
|
`);
|
|
66835
66859
|
} catch (err) {
|
|
66836
66860
|
handleError8(err);
|