@koda-sl/baker-cli 0.353.0-dev.847cbae62 → 0.353.0-dev.8bdd8f915
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/README.md +5 -0
- package/dist/{chunk-B7MLH3K6.js → chunk-YBLNCFK4.js} +2 -1
- package/dist/chunk-YBLNCFK4.js.map +1 -0
- package/dist/cli.js +19 -28
- package/dist/cli.js.map +1 -1
- package/dist/engine/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-B7MLH3K6.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
clipDurationsFor,
|
|
29
29
|
clipParamRecipe,
|
|
30
30
|
clipProfileFor,
|
|
31
|
+
coercePathUrlToUrl,
|
|
31
32
|
collectAssetRefLikes,
|
|
32
33
|
createEngineFromEnv,
|
|
33
34
|
defaultRegistry,
|
|
@@ -68,7 +69,7 @@ import {
|
|
|
68
69
|
validateCanvasDeep,
|
|
69
70
|
withoutCastName,
|
|
70
71
|
ytDlpBlockSignal
|
|
71
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-YBLNCFK4.js";
|
|
72
73
|
import {
|
|
73
74
|
csvOrJson,
|
|
74
75
|
daysAgoIso,
|
|
@@ -11035,20 +11036,6 @@ function adCopyHints(payload) {
|
|
|
11035
11036
|
return tells.slice(0, MAX_HINTS).map(hintFor);
|
|
11036
11037
|
}
|
|
11037
11038
|
|
|
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
|
-
|
|
11052
11039
|
// src/commands/ads/google/draft-status.ts
|
|
11053
11040
|
var OPERATION_LABELS = {
|
|
11054
11041
|
create: "Creating",
|
|
@@ -11378,7 +11365,7 @@ async function stageGoogleOp(raw, hints2) {
|
|
|
11378
11365
|
const chatId = requireChatId();
|
|
11379
11366
|
const response = await apiPost("/api/ads/google/draft/stage", { chatId, op: preflight.data });
|
|
11380
11367
|
const allHints = [...noopHints(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
|
|
11381
|
-
writeJsonEnvelope(
|
|
11368
|
+
writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
|
|
11382
11369
|
} catch (err) {
|
|
11383
11370
|
handleGoogleError(err);
|
|
11384
11371
|
}
|
|
@@ -11416,7 +11403,7 @@ async function stageGoogleOps(rawOps, hints2) {
|
|
|
11416
11403
|
const chatId = requireChatId();
|
|
11417
11404
|
const response = await apiPost("/api/ads/google/draft/stage-batch", { chatId, ops });
|
|
11418
11405
|
const allHints = [...skippedHints(response.data.skipped ?? [], ops.length), ...hints2 ?? [], ...adCopyHints(ops)];
|
|
11419
|
-
writeJsonEnvelope(
|
|
11406
|
+
writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
|
|
11420
11407
|
} catch (err) {
|
|
11421
11408
|
handleGoogleError(err);
|
|
11422
11409
|
}
|
|
@@ -11444,7 +11431,7 @@ async function draftListAction(json, chat) {
|
|
|
11444
11431
|
writeJsonEnvelope(response);
|
|
11445
11432
|
return;
|
|
11446
11433
|
}
|
|
11447
|
-
process.stdout.write(`${renderDraftStatus(response.data)}
|
|
11434
|
+
process.stdout.write(`${renderDraftStatus(response.data)}
|
|
11448
11435
|
`);
|
|
11449
11436
|
} catch (err) {
|
|
11450
11437
|
handleGoogleError(err);
|
|
@@ -19228,7 +19215,7 @@ async function stageOp(raw, hints2) {
|
|
|
19228
19215
|
op: preflight.data
|
|
19229
19216
|
});
|
|
19230
19217
|
const allHints = [...batchNudge(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
|
|
19231
|
-
writeJsonEnvelope(
|
|
19218
|
+
writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
|
|
19232
19219
|
} catch (err) {
|
|
19233
19220
|
handleLinkedinError(err);
|
|
19234
19221
|
}
|
|
@@ -19255,7 +19242,7 @@ async function stageLinkedinOps(rawOps, hints2) {
|
|
|
19255
19242
|
const chatId = requireChatId();
|
|
19256
19243
|
const response = await apiPost("/api/ads/linkedin/draft/stage-batch", { chatId, ops });
|
|
19257
19244
|
const allHints = [...hints2 ?? [], ...adCopyHints(ops)];
|
|
19258
|
-
writeJsonEnvelope(
|
|
19245
|
+
writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
|
|
19259
19246
|
} catch (err) {
|
|
19260
19247
|
handleLinkedinError(err);
|
|
19261
19248
|
}
|
|
@@ -22464,7 +22451,7 @@ async function listDraft(json, chat) {
|
|
|
22464
22451
|
writeJsonEnvelope(response);
|
|
22465
22452
|
return;
|
|
22466
22453
|
}
|
|
22467
|
-
process.stdout.write(`${renderDraftStatus2(response.data)}
|
|
22454
|
+
process.stdout.write(`${renderDraftStatus2(response.data)}
|
|
22468
22455
|
`);
|
|
22469
22456
|
} catch (err) {
|
|
22470
22457
|
handleLinkedinError(err);
|
|
@@ -24993,7 +24980,7 @@ async function stageOp2(raw) {
|
|
|
24993
24980
|
const chatId = requireChatId();
|
|
24994
24981
|
const response = await apiPost("/api/ads/meta/draft/stage", { chatId, op: preflight.data });
|
|
24995
24982
|
const copyHints = adCopyHints(preflight.data);
|
|
24996
|
-
writeJsonEnvelope(
|
|
24983
|
+
writeJsonEnvelope(copyHints.length > 0 ? { ...response, hints: copyHints } : response);
|
|
24997
24984
|
} catch (err) {
|
|
24998
24985
|
handleMetaError(err);
|
|
24999
24986
|
}
|
|
@@ -35909,7 +35896,7 @@ function rewriteTarget(value, workspaceRoot) {
|
|
|
35909
35896
|
}
|
|
35910
35897
|
return null;
|
|
35911
35898
|
}
|
|
35912
|
-
function
|
|
35899
|
+
function normalizeCanvasPaths(canvas, canvasDir, workspaceRoot) {
|
|
35913
35900
|
if (!canvas || typeof canvas !== "object") return { canvas, rewrites: [] };
|
|
35914
35901
|
const c = canvas;
|
|
35915
35902
|
if (!Array.isArray(c.nodes)) return { canvas, rewrites: [] };
|
|
@@ -35922,6 +35909,10 @@ function normalizeAbsoluteCanvasPaths(canvas, canvasDir, workspaceRoot) {
|
|
|
35922
35909
|
const params = n.params;
|
|
35923
35910
|
if (!params || typeof params !== "object") return node;
|
|
35924
35911
|
const nodeId = typeof n.id === "string" ? n.id : "?";
|
|
35912
|
+
if (n.type === "ingest" && params.source === "path" && looksLikeHttpUrl(params.path)) {
|
|
35913
|
+
rewrites.push({ nodeId, param: "source", from: "path", to: "url" });
|
|
35914
|
+
return { ...node, params: coercePathUrlToUrl(params) };
|
|
35915
|
+
}
|
|
35925
35916
|
const key = n.type === "ingest" && params.source === "path" ? "path" : n.type === "hyperframe_render" ? "composition" : null;
|
|
35926
35917
|
if (!key) return node;
|
|
35927
35918
|
const target = rewriteTarget(params[key], root);
|
|
@@ -35932,11 +35923,11 @@ function normalizeAbsoluteCanvasPaths(canvas, canvasDir, workspaceRoot) {
|
|
|
35932
35923
|
});
|
|
35933
35924
|
return rewrites.length === 0 ? { canvas, rewrites } : { canvas: { ...canvas, nodes }, rewrites };
|
|
35934
35925
|
}
|
|
35935
|
-
async function
|
|
35926
|
+
async function healCanvasPaths(filePath, canvas) {
|
|
35936
35927
|
const canvasDir = path5.dirname(filePath);
|
|
35937
35928
|
const workspaceRoot = findWorkspaceRoot(canvasDir);
|
|
35938
35929
|
if (!workspaceRoot) return { canvas, rewrites: [], text: null };
|
|
35939
|
-
const normalized =
|
|
35930
|
+
const normalized = normalizeCanvasPaths(canvas, canvasDir, workspaceRoot);
|
|
35940
35931
|
if (normalized.rewrites.length === 0) return { ...normalized, text: null };
|
|
35941
35932
|
const text2 = `${JSON.stringify(normalized.canvas, null, 2)}
|
|
35942
35933
|
`;
|
|
@@ -40878,12 +40869,12 @@ async function executeCanvasRun(opts) {
|
|
|
40878
40869
|
}
|
|
40879
40870
|
const attemptedSlug = creativeSlugFromCanvasPath(filePath);
|
|
40880
40871
|
if (attemptedSlug) await clearCreativeDirty(attemptedSlug);
|
|
40881
|
-
const healed = await
|
|
40872
|
+
const healed = await healCanvasPaths(filePath, parsed);
|
|
40882
40873
|
parsed = healed.canvas;
|
|
40883
40874
|
const canvasText = healed.text ?? raw;
|
|
40884
40875
|
if (healed.rewrites.length > 0) {
|
|
40885
40876
|
process.stderr.write(
|
|
40886
|
-
`[canvas] rewrote ${healed.rewrites.length}
|
|
40877
|
+
`[canvas] rewrote ${healed.rewrites.length} asset reference(s) in the canvas file so it says what runs (absolute paths \u2192 canvas-relative, a URL in an ingest path \u2192 source "url"):
|
|
40887
40878
|
${describeRewrites(healed.rewrites)}
|
|
40888
40879
|
`
|
|
40889
40880
|
);
|
|
@@ -44476,7 +44467,7 @@ var validateCommand = defineCommand118({
|
|
|
44476
44467
|
`);
|
|
44477
44468
|
process.exit(2);
|
|
44478
44469
|
}
|
|
44479
|
-
const healed = await
|
|
44470
|
+
const healed = await healCanvasPaths(filePath, parsed);
|
|
44480
44471
|
parsed = healed.canvas;
|
|
44481
44472
|
parsed = resolveRelativeCanvasPaths(parsed, path28.dirname(filePath));
|
|
44482
44473
|
let styleProjection = "not_applicable";
|