@koda-sl/baker-cli 0.547.0 → 0.549.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.
@@ -25,7 +25,7 @@ import path from "path";
25
25
  import { defineCommand } from "citty";
26
26
  registerSchema({
27
27
  command: "landing.inspiration.search",
28
- description: "Search the shared library of real landing-page sections for reference before you design. Start here: baker landing inspiration search 'pricing with a monthly/annual toggle'. Returns the idea behind each section plus a downloaded screenshot you can Read. Defaults to this company's saved sections; pass --scope all for the whole library.",
28
+ description: "Search the shared library of real landing-page sections for reference before you design. Start here: baker landing inspiration search 'pricing with a monthly/annual toggle'. Returns the idea behind each section plus a downloaded screenshot to look at through the visual-check subagent. Defaults to this company's saved sections; pass --scope all for the whole library.",
29
29
  args: {
30
30
  query: { type: "string", description: "What you want to see, in plain English", required: false },
31
31
  type: {
@@ -121,6 +121,9 @@ async function downloadShots(results) {
121
121
  );
122
122
  return saved;
123
123
  }
124
+ function searchShotsHint(count) {
125
+ return `${count} screenshot${count === 1 ? "" : "s"} saved to .baker/inspiration/ \u2014 look at them through the visual-check subagent (the paths and what you need to decide) before deciding, not by Reading them yourself: every image you Read is re-sent on every later request.`;
126
+ }
124
127
  var searchCommand = defineCommand({
125
128
  meta: {
126
129
  name: "search",
@@ -198,7 +201,7 @@ var searchCommand = defineCommand({
198
201
  if (rows.length > 0 && data.moreInFullLibrary > 0) {
199
202
  hints.push(`${data.moreInFullLibrary} more match in the full library \u2014 re-run with --scope all.`);
200
203
  }
201
- if (shots.size > 0) hints.push(`Screenshots saved to .baker/inspiration/ \u2014 Read them before deciding.`);
204
+ if (shots.size > 0) hints.push(searchShotsHint(shots.size));
202
205
  writeJson({
203
206
  ok: true,
204
207
  data: {
@@ -219,6 +222,7 @@ var searchCommand = defineCommand({
219
222
  });
220
223
  export {
221
224
  buildSearchBody,
222
- searchCommand
225
+ searchCommand,
226
+ searchShotsHint
223
227
  };
224
- //# sourceMappingURL=search-BR5KK7BE.js.map
228
+ //# sourceMappingURL=search-37JQZPX3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/landing/inspiration/search.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { InspirationSearchRequest, InspirationSearchResponse } from \"@baker/api/landing-library\";\nimport { defineCommand } from \"citty\";\nimport { apiPost } from \"../../../client.ts\";\nimport { writeJson } from \"../../../output.ts\";\nimport { registerSchema } from \"../../../schemas.ts\";\nimport { favoritesScopeHints, INSPIRATION_HINTS, parseNumber, reportError, splitList } from \"./shared.ts\";\nimport { downloadReadableShot, READABLE_SHOT } from \"./shot.ts\";\n\nregisterSchema({\n command: \"landing.inspiration.search\",\n description:\n \"Search the shared library of real landing-page sections for reference before you design. Start here: baker landing inspiration search 'pricing with a monthly/annual toggle'. Returns the idea behind each section plus a downloaded screenshot to look at through the visual-check subagent. Defaults to this company's saved sections; pass --scope all for the whole library.\",\n args: {\n query: { type: \"string\", description: \"What you want to see, in plain English\", required: false },\n type: {\n type: \"string\",\n description: \"Comma list of section types: hero,pricing,faq,testimonials,…\",\n required: false,\n },\n composition: {\n type: \"string\",\n description: \"Comma list of composition patterns (references/composition.md)\",\n required: false,\n },\n register: {\n type: \"string\",\n description: \"Comma list of visual registers: dev-tool-minimal,luxury-high-end,…\",\n required: false,\n },\n interaction: { type: \"string\", description: \"Comma list of interaction patterns\", required: false },\n motion: {\n type: \"string\",\n description: \"Comma list of motion kinds: scroll-reveal,marquee,parallax,…\",\n required: false,\n },\n media: { type: \"string\", description: \"Comma list of media kinds\", required: false },\n device: { type: \"string\", description: \"Comma list of content devices\", required: false },\n theme: { type: \"string\", description: \"light | dark | mixed\", required: false },\n \"max-rank\": {\n type: \"number\",\n description: \"Show>Tell rank ceiling 1-7; 3 means 'rank 3 or better'\",\n required: false,\n },\n \"min-craft\": { type: \"number\", description: \"Craft floor 0-1\", required: false },\n \"min-fidelity\": {\n type: \"number\",\n description: \"Only sections whose markup reproduces this well (0-1)\",\n required: false,\n },\n domain: { type: \"string\", description: \"Restrict to one site\", required: false },\n \"similar-to\": {\n type: \"string\",\n description: \"Section id — find sections that look like this one\",\n required: false,\n },\n scope: { type: \"string\", description: \"favorites (default) | all\", required: false },\n limit: { type: \"number\", description: \"Max results (default 8)\", required: false },\n \"no-images\": { type: \"boolean\", description: \"Skip downloading screenshots\", required: false },\n full: {\n type: \"boolean\",\n description:\n \"Add every classification facet (theme, density, rank, interactions, media, devices, tags, headline)\",\n required: false,\n },\n },\n});\n\nexport function buildSearchBody(args: Record<string, unknown>): InspirationSearchRequest {\n const body: InspirationSearchRequest = {};\n const setList = (key: keyof InspirationSearchRequest, value: unknown) => {\n const list = splitList(value as string | undefined);\n if (list) Object.assign(body, { [key]: list });\n };\n\n if (args.query) body.query = String(args.query);\n if (args[\"similar-to\"]) body.similarToSectionId = String(args[\"similar-to\"]);\n setList(\"sectionType\", args.type);\n setList(\"composition\", args.composition);\n setList(\"visualRegister\", args.register);\n setList(\"interaction\", args.interaction);\n setList(\"motion\", args.motion);\n setList(\"mediaKind\", args.media);\n setList(\"contentDevice\", args.device);\n if (args.theme) body.theme = String(args.theme) as InspirationSearchRequest[\"theme\"];\n if (args.domain) body.domain = String(args.domain);\n\n const maxRank = parseNumber(args[\"max-rank\"] as string | undefined);\n if (maxRank !== undefined) body.maxShowTellRank = maxRank;\n const minCraft = parseNumber(args[\"min-craft\"] as string | undefined);\n if (minCraft !== undefined) body.minCraftScore = minCraft;\n const minFidelity = parseNumber(args[\"min-fidelity\"] as string | undefined);\n if (minFidelity !== undefined) body.minFidelity = minFidelity;\n const limit = parseNumber(args.limit as string | undefined);\n body.limit = limit ?? 8;\n body.scope = args.scope === \"all\" ? \"all\" : \"favorites\";\n return body;\n}\n\n/**\n * Put the screenshots on disk.\n *\n * The whole library is a visual one, and an agent that can only read a text\n * description of a section is working from exactly the second-hand doctrine this\n * was built to replace. Downloading each hit so it can be looked at (through visual-check) is the point.\n *\n * At the readable size, not the archive size — see `shot.ts`. This runs at the\n * default limit of eight hits, so the difference is eight 2x PNGs of context\n * against eight design-width renditions.\n */\nasync function downloadShots(results: InspirationSearchResponse[\"results\"]): Promise<Map<string, string>> {\n const dir = path.join(process.cwd(), \".baker\", \"inspiration\");\n const saved = new Map<string, string>();\n await Promise.all(\n results.map(async (result) => {\n const file = await downloadReadableShot(\n result.desktopShotUrl,\n path.join(dir, `${result.id}.${READABLE_SHOT.extension}`),\n );\n if (file) saved.set(result.id, file);\n }),\n );\n return saved;\n}\n\n/**\n * Where to look at the screenshots a search saved: through the visual-check\n * subagent, never a Read on the build thread, where each image rides every\n * later request.\n */\nexport function searchShotsHint(count: number): string {\n return `${count} screenshot${count === 1 ? \"\" : \"s\"} saved to .baker/inspiration/ — look at them through the visual-check subagent (the paths and what you need to decide) before deciding, not by Reading them yourself: every image you Read is re-sent on every later request.`;\n}\n\nexport const searchCommand = defineCommand({\n meta: {\n name: \"search\",\n description:\n \"Search real landing-page sections for reference. Example: baker landing inspiration search 'dark developer hero with a terminal' --register dev-tool-minimal --scope all\",\n },\n args: {\n query: { type: \"positional\", description: \"What you want to see, in plain English\", required: false },\n type: { type: \"string\", description: \"Comma list of section types\", required: false },\n composition: { type: \"string\", description: \"Comma list of composition patterns\", required: false },\n register: { type: \"string\", description: \"Comma list of visual registers\", required: false },\n interaction: { type: \"string\", description: \"Comma list of interaction patterns\", required: false },\n motion: { type: \"string\", description: \"Comma list of motion kinds\", required: false },\n media: { type: \"string\", description: \"Comma list of media kinds\", required: false },\n device: { type: \"string\", description: \"Comma list of content devices\", required: false },\n theme: { type: \"string\", description: \"light | dark | mixed\", required: false },\n \"max-rank\": { type: \"string\", description: \"Show>Tell rank ceiling 1-7\", required: false },\n \"min-craft\": { type: \"string\", description: \"Craft floor 0-1\", required: false },\n \"min-fidelity\": { type: \"string\", description: \"Reproduction-fidelity floor 0-1\", required: false },\n domain: { type: \"string\", description: \"Restrict to one site\", required: false },\n \"similar-to\": { type: \"string\", description: \"Section id to find lookalikes of\", required: false },\n scope: { type: \"string\", description: \"favorites (default) | all\", required: false, default: \"favorites\" },\n limit: { type: \"string\", description: \"Max results (default 8)\", required: false },\n \"no-images\": { type: \"boolean\", description: \"Skip downloading screenshots\", required: false, default: false },\n full: { type: \"boolean\", description: \"Include every classification facet\", required: false, default: false },\n },\n run: async ({ args }) => {\n try {\n const body = buildSearchBody(args as Record<string, unknown>);\n const data = await apiPost<InspirationSearchResponse>(\"/api/landing-inspiration/search\", body);\n const results = Array.isArray(data?.results) ? data.results : [];\n const shots = (args[\"no-images\"] as boolean) ? new Map<string, string>() : await downloadShots(results);\n\n const full = args.full as boolean;\n const rows = results.map((result) => ({\n id: result.id,\n // The id `page` takes. Its own schema says \"from a search result's source\n // id\", and until this line no projection emitted one — so the ordering\n // view could only be reached straight after `add`, never from a search.\n page_id: result.sourceId,\n section: result.sectionType,\n composition: result.composition,\n look: result.visualRegister,\n motion: result.motionSummary,\n why_it_works: result.whyItWorks,\n craft: Number(result.craftScore?.toFixed?.(2) ?? result.craftScore),\n fidelity: result.fidelity,\n domain: result.domain,\n // Only worth saying when it means something: >1 marks a section the site\n // reuses across its pages, which is a stronger signal than a one-off.\n ...(result.pageCount > 1 ? { used_on_pages: result.pageCount } : {}),\n // With --no-images there is no file, so hand back the URL instead. A row\n // with neither is a section the agent is asked to judge sight unseen,\n // which is the one thing a visual library must never produce.\n ...((args[\"no-images\"] as boolean)\n ? { screenshot_url: result.desktopShotUrl ?? null }\n : { screenshot: shots.get(result.id) ?? null }),\n ...(full\n ? {\n theme: result.theme,\n density: result.density,\n show_tell_rank: result.showTellRank,\n interactions: result.interactions,\n media: result.mediaKinds,\n devices: result.contentDevices,\n tags: result.tags,\n headline: result.headline,\n source_url: result.sourceUrl,\n }\n : {}),\n }));\n\n const hints = [INSPIRATION_HINTS.adapt];\n // A thin favorites result is explained by the state of the saved set, not\n // by the search — and the three states it can be in call for opposite\n // next moves. The scope is never widened here; it is only made legible.\n const scopeHints = body.scope === \"favorites\" ? favoritesScopeHints(data.favoritesHealth, rows.length) : [];\n if (scopeHints.length > 0) {\n hints.push(...scopeHints);\n } else if (rows.length === 0) {\n hints.push(\n body.scope === \"favorites\"\n ? \"No matches in this company's saved sections. Retry with --scope all to search the whole library, or add a page with `baker landing inspiration add <url>`.\"\n : \"No matches. Loosen the filters, or add reference pages with `baker landing inspiration add <url>`.\",\n );\n }\n if (rows.length > 0 && data.moreInFullLibrary > 0) {\n hints.push(`${data.moreInFullLibrary} more match in the full library — re-run with --scope all.`);\n }\n if (shots.size > 0) hints.push(searchShotsHint(shots.size));\n\n writeJson({\n ok: true,\n data: {\n results: rows,\n scope: data.scope,\n more_in_full_library: data.moreInFullLibrary,\n total: data.total,\n // Only present when there was something to explain, so a healthy\n // search pays nothing for it.\n ...(data.favoritesHealth ? { saved_pages: data.favoritesHealth } : {}),\n },\n hints,\n });\n } catch (error) {\n reportError(error);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AAEjB,SAAS,qBAAqB;AAO9B,eAAe;AAAA,EACb,SAAS;AAAA,EACT,aACE;AAAA,EACF,MAAM;AAAA,IACJ,OAAO,EAAE,MAAM,UAAU,aAAa,0CAA0C,UAAU,MAAM;AAAA,IAChG,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,IACZ;AAAA,IACA,aAAa;AAAA,MACX,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,IACZ;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,IACZ;AAAA,IACA,aAAa,EAAE,MAAM,UAAU,aAAa,sCAAsC,UAAU,MAAM;AAAA,IAClG,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,IACZ;AAAA,IACA,OAAO,EAAE,MAAM,UAAU,aAAa,6BAA6B,UAAU,MAAM;AAAA,IACnF,QAAQ,EAAE,MAAM,UA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,MAC1B,WAAW,KAAK,WAAW,GAAG;AAC5B,cAAM;AAAA,UACJ,KAAK,UAAU,cACX,+JACA;AAAA,QACN;AAAA,MACF;AACA,UAAI,KAAK,SAAS,KAAK,KAAK,oBAAoB,GAAG;AACjD,cAAM,KAAK,GAAG,KAAK,iBAAiB,iEAA4D;AAAA,MAClG;AACA,UAAI,MAAM,OAAO,EAAG,OAAM,KAAK,gBAAgB,MAAM,IAAI,CAAC;AAE1D,gBAAU;AAAA,QACR,IAAI;AAAA,QACJ,MAAM;AAAA,UACJ,SAAS;AAAA,UACT,OAAO,KAAK;AAAA,UACZ,sBAAsB,KAAK;AAAA,UAC3B,OAAO,KAAK;AAAA;AAAA;AAAA,UAGZ,GAAI,KAAK,kBAAkB,EAAE,aAAa,KAAK,gBAAgB,IAAI,CAAC;AAAA,QACtE;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,SAAS,OAAO;AACd,kBAAY,KAAK;AAAA,IACnB;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -23,7 +23,7 @@ import path from "path";
23
23
  import { defineCommand } from "citty";
24
24
  registerSchema({
25
25
  command: "landing.inspiration.view",
26
- description: "Everything known about one section: composition, motion, design tokens, the copy it uses, why it works, and what must change to make it yours. Downloads the desktop and mobile screenshots plus the motion filmstrip so you can look at them.",
26
+ description: "Everything known about one section: composition, motion, design tokens, the copy it uses, why it works, and what must change to make it yours. Downloads the desktop and mobile screenshots plus the motion filmstrip, to look at through the visual-check subagent.",
27
27
  args: {
28
28
  id: { type: "string", description: "Section id from search", required: true },
29
29
  full: {
@@ -33,10 +33,24 @@ registerSchema({
33
33
  }
34
34
  }
35
35
  });
36
+ function viewShotHints(shots) {
37
+ const hints = [];
38
+ if (shots.desktop) {
39
+ hints.push(
40
+ `Look at ${shots.desktop} through the visual-check subagent (the path and what you need to learn) before you build \u2014 the description is not the section \u2014 not by Reading it yourself: every image you Read is re-sent on every later request.`
41
+ );
42
+ }
43
+ if (shots.filmstrip) {
44
+ hints.push(
45
+ `${shots.filmstrip} shows this section animating in, six frames left-to-right then top-to-bottom, with the elapsed time on each. If you want the motion, not just the layout, ask visual-check about it.`
46
+ );
47
+ }
48
+ return hints;
49
+ }
36
50
  var viewCommand = defineCommand({
37
51
  meta: {
38
52
  name: "view",
39
- description: "Full detail for one reference section. Example: baker landing inspiration view k57abc\u2026 \u2014 read the screenshots it saves before you build."
53
+ description: "Full detail for one reference section. Example: baker landing inspiration view k57abc\u2026 \u2014 look at the screenshots it saves (through the visual-check subagent) before you build."
40
54
  },
41
55
  args: {
42
56
  id: { type: "positional", description: "Section id from search", required: true },
@@ -61,15 +75,12 @@ var viewCommand = defineCommand({
61
75
  ]);
62
76
  const full = args.full;
63
77
  const hints = [INSPIRATION_HINTS.structureNotCopy, INSPIRATION_HINTS.adapt];
64
- if (desktop) hints.push(`Read ${desktop} before you build \u2014 the description is not the section.`);
78
+ const [desktopHint, filmstripHint] = viewShotHints({ desktop, filmstrip });
79
+ if (desktopHint) hints.push(desktopHint);
65
80
  hints.push("Need the mechanics? `baker landing inspiration code <id>` writes the standalone HTML+CSS to disk.");
66
81
  const fidelity = fidelityHint(section.fidelity);
67
82
  if (fidelity) hints.push(fidelity);
68
- if (filmstrip) {
69
- hints.push(
70
- `${filmstrip} shows this section animating in, six frames left-to-right then top-to-bottom, with the elapsed time on each. Read it if you want the motion, not just the layout.`
71
- );
72
- }
83
+ if (filmstripHint) hints.push(filmstripHint);
73
84
  writeJson({
74
85
  ok: true,
75
86
  data: {
@@ -116,6 +127,7 @@ var viewCommand = defineCommand({
116
127
  }
117
128
  });
118
129
  export {
119
- viewCommand
130
+ viewCommand,
131
+ viewShotHints
120
132
  };
121
- //# sourceMappingURL=view-VFZUL5UL.js.map
133
+ //# sourceMappingURL=view-OZLXM7R6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/landing/inspiration/view.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { InspirationSectionResponse } from \"@baker/api/landing-library\";\nimport { defineCommand } from \"citty\";\nimport { apiGet } from \"../../../client.ts\";\nimport { writeJson } from \"../../../output.ts\";\nimport { registerSchema } from \"../../../schemas.ts\";\nimport { fidelityHint, INSPIRATION_HINTS, reportError } from \"./shared.ts\";\nimport { downloadReadableShot, READABLE_SHOT } from \"./shot.ts\";\n\nregisterSchema({\n command: \"landing.inspiration.view\",\n description:\n \"Everything known about one section: composition, motion, design tokens, the copy it uses, why it works, and what must change to make it yours. Downloads the desktop and mobile screenshots plus the motion filmstrip, to look at through the visual-check subagent.\",\n args: {\n id: { type: \"string\", description: \"Section id from search\", required: true },\n full: {\n type: \"boolean\",\n description:\n \"Add the classification facets (theme, density, rank, interactions, media, devices, tags) and the reproduction notes\",\n required: false,\n },\n },\n});\n\n/**\n * Where to look at what `view` saved: through the visual-check subagent, never\n * a Read on the build thread, where each image rides every later request.\n * Returns the desktop hint then the filmstrip hint, each absent without its file.\n */\nexport function viewShotHints(shots: { desktop: string | null; filmstrip: string | null }): string[] {\n const hints: string[] = [];\n if (shots.desktop) {\n hints.push(\n `Look at ${shots.desktop} through the visual-check subagent (the path and what you need to learn) before you build — the description is not the section — not by Reading it yourself: every image you Read is re-sent on every later request.`,\n );\n }\n if (shots.filmstrip) {\n hints.push(\n `${shots.filmstrip} shows this section animating in, six frames left-to-right then top-to-bottom, with the elapsed time on each. If you want the motion, not just the layout, ask visual-check about it.`,\n );\n }\n return hints;\n}\n\nexport const viewCommand = defineCommand({\n meta: {\n name: \"view\",\n description:\n \"Full detail for one reference section. Example: baker landing inspiration view k57abc… — look at the screenshots it saves (through the visual-check subagent) before you build.\",\n },\n args: {\n id: { type: \"positional\", description: \"Section id from search\", required: true },\n full: {\n type: \"boolean\",\n description: \"Include classification facets and reproduction notes\",\n required: false,\n default: false,\n },\n },\n run: async ({ args }) => {\n try {\n const id = args.id as string;\n const data = await apiGet<InspirationSectionResponse>(\"/api/landing-inspiration/section\", { id });\n const section = data.section;\n const dir = path.join(process.cwd(), \".baker\", \"inspiration\", id);\n\n const ext = READABLE_SHOT.extension;\n const [desktop, mobile, filmstrip] = await Promise.all([\n downloadReadableShot(section.desktopShotUrl, path.join(dir, `desktop.${ext}`)),\n downloadReadableShot(section.mobileShotUrl, path.join(dir, `mobile.${ext}`)),\n downloadReadableShot(section.motionFilmstripUrl, path.join(dir, `motion-filmstrip.${ext}`)),\n ]);\n\n const full = args.full as boolean;\n const hints = [INSPIRATION_HINTS.structureNotCopy, INSPIRATION_HINTS.adapt];\n const [desktopHint, filmstripHint] = viewShotHints({ desktop, filmstrip });\n if (desktopHint) hints.push(desktopHint);\n hints.push(\"Need the mechanics? `baker landing inspiration code <id>` writes the standalone HTML+CSS to disk.\");\n const fidelity = fidelityHint(section.fidelity);\n if (fidelity) hints.push(fidelity);\n if (filmstripHint) hints.push(filmstripHint);\n\n writeJson({\n ok: true,\n data: {\n id: section.id,\n page_id: section.sourceId,\n section: section.sectionType,\n composition: section.composition,\n look: section.visualRegister,\n motion: section.motionSummary,\n design_tokens: section.designTokens,\n size: section.boundingBox,\n copy: {\n headline: section.headline,\n subhead: section.subhead,\n ctas: section.ctaLabels,\n proof: section.proofSignals,\n },\n why_it_works: section.whyItWorks,\n adaptation_notes: section.adaptationNotes,\n craft: section.craftScore,\n fidelity: section.fidelity,\n source_url: section.sourceUrl,\n screenshots: { desktop, mobile, motion_filmstrip: filmstrip },\n // Behind --full: exactly the block `search` already gates, plus the\n // reproduction notes, which `code` returns again for the one caller\n // that acts on them. Everything above is what you design *from*;\n // these are how the section was filed and how it rebuilds.\n ...(full\n ? {\n theme: section.theme,\n density: section.density,\n show_tell_rank: section.showTellRank,\n interactions: section.interactions,\n media: section.mediaKinds,\n devices: section.contentDevices,\n tags: section.tags,\n reproduction_notes: section.reproductionNotes,\n }\n : {}),\n },\n hints,\n });\n } catch (error) {\n reportError(error);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AAEjB,SAAS,qBAAqB;AAO9B,eAAe;AA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A,QACP;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,SAAS,OAAO;AACd,kBAAY,KAAK;AAAA,IACnB;AAAA,EACF;AACF,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koda-sl/baker-cli",
3
- "version": "0.547.0",
3
+ "version": "0.549.0",
4
4
  "description": "AI-agent-first CLI for interacting with Baker, including the Baker creative canvas.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../api/src/accounts/crm-columns.ts","../../api/src/accounts/index.ts"],"sourcesContent":["import { CRM_COLUMN_FIELDS, CRM_DEAL_STATUSES, type CrmColumnField } from \"./crm\";\n\n/** A Jev Choice, as each caller's own Jev module sends it. */\nexport interface CrmColumnQuestion {\n type: \"choice\";\n instructions: Record<string, string>;\n criteria: Record<string, string>;\n}\n/** A Jev answer, as each caller's own Jev module reads it. */\nexport type CrmColumnAnswer =\n | { noul: number }\n | { choice: string; probabilities: Record<string, number> }\n | { score: number; probabilities: Record<string, number> };\n\n/**\n * What each column of a CRM spreadsheet holds, read by Jev from its header in\n * any language and a few of its cells — a Spanish \"Importe\", a Polish \"Kwota\",\n * a Pipedrive \"Deal - Value\" alike. Pure: the backend's action and `baker\n * accounts crm check` ask, these build the questions and read the answers,\n * so the upload and the check read a sheet alike. Baker's own headers never get here\n * (`exactCrmColumns`).\n */\n\n/**\n * A column is read only when Jev is this sure of its field; below it the\n * column is left behind and named as such, never filled with a guess. Set\n * from `scripts/crm-column-evals` against `JEV_MODEL`.\n */\nexport const COLUMN_HELD = 0.7;\n\nconst NONE = \"none\";\n\n/** Cells longer than this say nothing more about what the column is. */\nconst SAMPLE_CHARS = 60;\nconst EMAIL = /[^\\s@]+@[^\\s@]+\\.[^\\s@]+/g;\n\n/** Each field in plain words, with its boundary cases: Jev reads the criteria literally. */\nconst CRITERIA: Readonly<Record<CrmColumnField | typeof NONE, string>> = {\n id: \"The deal's own unique id or number in the CRM (a deal, opportunity or record id of the deal), not the company's id\",\n name: \"The deal's own title (a deal or opportunity name), not the name of the company or of a person\",\n companyId: \"The CRM's unique id (or record id) of the company or account the row is about or the deal is with\",\n companyName: \"The name of the company, account or organization the row is about or the deal is with\",\n companyDomain: \"The company's website or web domain, like acme.com\",\n companyLinkedinPage: \"The company's LinkedIn page address\",\n amount:\n \"The deal's own value in money (its amount, value or size), not a weighted or forecast amount, not a company's revenue or turnover, not a probability, a percentage or a count\",\n currency: \"The currency the amount is in, like EUR or USD\",\n pipeline: \"Which sales pipeline the deal belongs to, not its stage\",\n stage:\n \"The deal's stage or state in the sales pipeline, in any words (like Proposal, Negotiation, Closed Won, Ganado), not the status of a lead or a contact\",\n status: \"Whether the deal is open, won or lost, written as exactly the English word open, won or lost\",\n createdAt: \"The date the deal or the company was created, opened or added to the CRM\",\n closedAt: \"The date the deal was closed (won or lost) or is expected to close\",\n none: \"Anything else: a person (an owner, a contact, a person's name, email or phone), who created or last changed the record, a probability, a weighted amount, a company's revenue or size, a lead's or contact's status, a next step, a source, notes, an industry, a date of last activity, or any other field\",\n};\n\nconst QUESTION =\n \"`column` is the header of a column in a spreadsheet exported from a CRM, in any language or in the CRM's own wording, and `cells` are values from that column. `sheet` lists every header of the spreadsheet, for context. Which field does `column` hold?\";\n\n/** A cell as Jev sees it: an email address is shown as one, never sent. */\nfunction sampleCell(cell: string): string {\n return cell.replace(EMAIL, \"<email address>\").slice(0, SAMPLE_CHARS);\n}\n\nexport interface SampledColumn {\n header: string;\n samples: readonly string[];\n}\n\n/** One Choice per column, the column inside its own question, beside every header of the sheet (`headers`). */\nexport function crmColumnQuestions(\n columns: readonly SampledColumn[],\n headers: readonly string[] = columns.map((column) => column.header),\n): CrmColumnQuestion[] {\n const sheet = headers.join(\" | \");\n return columns.map(({ header, samples }) => ({\n type: \"choice\",\n instructions: {\n sheet,\n column: header,\n cells: samples.length > 0 ? samples.map(sampleCell).join(\" | \") : \"(empty)\",\n question: QUESTION,\n },\n criteria: CRITERIA,\n }));\n}\n\nexport const isCrmColumnField = (choice: string): choice is CrmColumnField =>\n (CRM_COLUMN_FIELDS as readonly string[]).includes(choice);\n\n/** Cells the contract takes as a status: anything else in a status column names the deal's state in its own words. */\nconst isStatusCell = (cell: string) => (CRM_DEAL_STATUSES as readonly string[]).includes(cell.trim().toLowerCase());\n\n/**\n * Each column Jev placed at `COLUMN_HELD` or above, and the field it holds;\n * `none` and unsure ones are absent. A status column whose cells are not\n * open, won and lost (\"Ganho\", \"Perdido\") is read as the deal's stage, so its\n * deals arrive with the stage a manager says won or lost, instead of every one\n * refused.\n */\nexport function crmColumnMeanings(\n columns: readonly SampledColumn[],\n answers: readonly CrmColumnAnswer[],\n held = COLUMN_HELD,\n): Record<string, CrmColumnField> {\n const meanings: Record<string, CrmColumnField> = {};\n columns.forEach(({ header, samples }, index) => {\n const answer = answers[index];\n if (answer === undefined || !(\"choice\" in answer)) return;\n const { choice, probabilities } = answer;\n if (!isCrmColumnField(choice) || (probabilities[choice] ?? 0) < held) return;\n meanings[header] = choice === \"status\" && !samples.every(isStatusCell) ? \"stage\" : choice;\n });\n return meanings;\n}\n","/**\n * Wire contract for `baker accounts` — which companies the LinkedIn ads are\n * warming, and which CRM deals they influenced — plus the pure rules every\n * reader of those numbers shares.\n *\n * \"Influenced\" is a labelled rule, not credit: a deal is influenced when its\n * company crossed the model's threshold in the months up to and including the\n * deal's reference month. A deal counts in full for every campaign that touched\n * it, so campaign numbers overlap and never sum to the total.\n */\n\nimport { z } from \"zod\";\nimport { calendarDaySchema, todayUtc, windowTooLong } from \"../calendarDays\";\nimport { targetAccountsSchema, targetsSummarySchema } from \"./targets\";\n\nexport const INFLUENCE_MODEL_KINDS = [\"engagement\", \"awareness\", \"intent\"] as const;\nexport type InfluenceModelKind = (typeof INFLUENCE_MODEL_KINDS)[number];\n\nexport const INFLUENCE_METRICS = [\"impressions\", \"engagements\", \"clicks\"] as const;\nexport type InfluenceMetric = (typeof INFLUENCE_METRICS)[number];\n\nexport const DEFAULT_LOOKBACK_MONTHS = 12;\n\n/** `low` is a match read off a subdomain or a name: kept, but out of the headline until confirmed. */\nexport const MATCH_CONFIDENCES = [\"high\", \"low\"] as const;\n\nconst MODEL_METRIC: Record<InfluenceModelKind, { metric: InfluenceMetric; threshold: number }> = {\n engagement: { metric: \"engagements\", threshold: 3 },\n awareness: { metric: \"impressions\", threshold: 7 },\n intent: { metric: \"clicks\", threshold: 3 },\n};\n\nexport interface InfluenceParams {\n metric: InfluenceMetric;\n threshold: number;\n lookbackMonths: number;\n}\n\n/** A rule read for one report only — the saved settings stay as they are. */\nexport interface InfluenceRuleOverride {\n model?: InfluenceModelKind;\n threshold?: number;\n}\n\n/**\n * What the store counts for a company's settings: which metric, how many, how\n * far back. An override's model brings its own default threshold unless the\n * override names one too; the lookback is always the saved one.\n */\nexport function influenceParams(\n settings: {\n model: { kind: InfluenceModelKind; threshold?: number };\n lookbackMonths?: number;\n },\n override: InfluenceRuleOverride = {},\n): InfluenceParams {\n const kind = override.model ?? settings.model.kind;\n const model = MODEL_METRIC[kind];\n const wholeAtLeastOne = (value: number | undefined): value is number =>\n value !== undefined && Number.isInteger(value) && value >= 1;\n const threshold = override.threshold ?? (override.model === undefined ? settings.model.threshold : undefined);\n return {\n metric: model.metric,\n threshold: wholeAtLeastOne(threshold) ? threshold : model.threshold,\n lookbackMonths: wholeAtLeastOne(settings.lookbackMonths) ? settings.lookbackMonths : DEFAULT_LOOKBACK_MONTHS,\n };\n}\n\nexport type WarmFlag = \"new\" | \"rising\";\n\n/**\n * Whether a company is warming, by one metric this period against the period\n * of the same length just before it: `new` when it did nothing before,\n * `rising` when it at least doubled.\n */\nexport function warmFlag(current: number, previous: number): WarmFlag | null {\n if (current <= 0) return null;\n if (previous <= 0) return \"new\";\n return current >= 2 * previous ? \"rising\" : null;\n}\n\n// --- Windows ---\n\n/** The months the nightly sync keeps. */\nexport const ACCOUNTS_MAX_MONTHS = 24;\n\nconst windowFields = {\n /** Calendar months including the current one. */\n lastMonths: z.number().int().min(1).max(ACCOUNTS_MAX_MONTHS).optional(),\n start: calendarDaySchema.optional(),\n end: calendarDaySchema.optional(),\n};\n\n/** A rule read for one report (`InfluenceRuleOverride`); the saved settings stay as they are. */\nconst ruleOverrideFields = {\n model: z.enum(INFLUENCE_MODEL_KINDS).optional(),\n threshold: z.number().int().min(1).optional(),\n};\n\n/** Only these companies (`targets.ts`): the rows and numbers narrow to them, and `targets` says how far the ads got. */\nconst targetsField = { targets: targetAccountsSchema.optional() };\n\n/** How far the ads got with the targets the read named; absent without targets. */\nconst targetsSummaryField = { targets: targetsSummarySchema.optional() };\n\nfunction windowRules(req: { lastMonths?: number; start?: string; end?: string }, ctx: z.RefinementCtx): void {\n if (req.start !== undefined && req.lastMonths !== undefined) {\n ctx.addIssue({ code: \"custom\", path: [\"lastMonths\"], message: \"pass lastMonths or start/end, not both\" });\n }\n if (req.end !== undefined && req.start === undefined) {\n ctx.addIssue({ code: \"custom\", path: [\"end\"], message: \"end needs a start\" });\n }\n if (req.start !== undefined && req.end !== undefined && req.end < req.start) {\n ctx.addIssue({ code: \"custom\", path: [\"end\"], message: \"end is before start\" });\n return;\n }\n const tooLong = req.start === undefined ? null : windowTooLong(req.start, req.end ?? todayUtc(), ACCOUNTS_MAX_MONTHS);\n if (tooLong !== null) ctx.addIssue({ code: \"custom\", path: [\"start\"], message: tooLong });\n}\n\nexport const accountsWindowSchema = z.object({ start: z.string(), end: z.string() });\nexport type AccountsWindow = z.infer<typeof accountsWindowSchema>;\n\n/**\n * The inclusive days a request reads. `lastMonths` counts calendar months\n * including the current one, because the store holds whole months.\n */\nexport function accountsWindow(\n req: { lastMonths?: number; start?: string; end?: string },\n today: string,\n defaultMonths: number,\n): AccountsWindow {\n if (req.start !== undefined) return { start: req.start, end: req.end ?? today };\n const months = req.lastMonths ?? defaultMonths;\n const [year, month] = today.split(\"-\").map(Number);\n const first = new Date(Date.UTC(year ?? 1970, (month ?? 1) - 1 - (months - 1), 1));\n return { start: first.toISOString().slice(0, 10), end: today };\n}\n\nfunction monthIndex(day: string): number {\n const [year, month] = day.split(\"-\").map(Number);\n return (year ?? 1970) * 12 + ((month ?? 1) - 1);\n}\n\nfunction monthStart(index: number): Date {\n return new Date(Date.UTC(Math.floor(index / 12), index % 12, 1));\n}\n\n/**\n * The period New and Rising compare against: as many whole calendar months as\n * the window touches, ending the month before it starts. Whole months, because\n * that is the grain the store keeps.\n */\nexport function previousWindow(window: AccountsWindow): AccountsWindow {\n const first = monthIndex(window.start);\n const months = monthIndex(window.end) - first + 1;\n const lastDay = new Date(monthStart(first).getTime() - 24 * 60 * 60 * 1000);\n return {\n start: monthStart(first - months)\n .toISOString()\n .slice(0, 10),\n end: lastDay.toISOString().slice(0, 10),\n };\n}\n\nconst influenceParamsSchema = z.object({\n metric: z.enum(INFLUENCE_METRICS),\n threshold: z.number(),\n lookbackMonths: z.number(),\n});\n\n// --- Companies reached ---\n\nexport const ACCOUNTS_ENGAGEMENT_DEFAULT_LIMIT = 500;\nexport const ACCOUNTS_ENGAGEMENT_MAX_LIMIT = 5000;\n\nexport const accountEngagementRowSchema = z.object({\n /** LinkedIn organization id; `urn:li:organization:<orgId>` on LinkedIn. */\n orgId: z.string(),\n /** Empty until the nightly sync has looked the company up. */\n name: z.string(),\n domain: z.string(),\n impressions: z.number(),\n clicks: z.number(),\n engagements: z.number(),\n videoViews: z.number(),\n /** LinkedIn does not always report spend per company; 0 then. */\n costLocal: z.number(),\n currency: z.string(),\n /** Months in the window the company saw or did anything. */\n monthsActive: z.number(),\n lastMonth: z.string().nullable(),\n /** The same-length period just before the window. */\n previous: z.object({ impressions: z.number(), clicks: z.number(), engagements: z.number() }),\n /** By engagements against the previous period. */\n flag: z.enum([\"new\", \"rising\"]).nullable(),\n crmCompanyId: z.string().nullable(),\n /** The matched CRM company's name; null without a match. Optional for older servers. */\n crmCompanyName: z.string().nullable().optional(),\n matchConfidence: z.enum(MATCH_CONFIDENCES).nullable(),\n hasOpenDeal: z.boolean(),\n hasWonDeal: z.boolean(),\n hasLostDeal: z.boolean(),\n /** When the company's most recent lost deal closed (created, when it has no close date), ISO; null without one. */\n lastLostAt: z.string().nullable(),\n /**\n * People whose work email named the company's domain on the website or the\n * API in the period, and how many became leads — the touches beside the ads.\n * Null when none did; absent from older servers.\n */\n website: z.object({ people: z.number(), leads: z.number() }).nullable().optional(),\n /**\n * Visits from the company's own network in the period (`baker analytics\n * companies`): visits, distinct pages read, and when it was last seen.\n * Matched by normalised name (`companyNameKey`) against the LinkedIn name or\n * the CRM match's name — the network gives no website to match on. Null when\n * none matched; absent from older servers.\n */\n visitorCompany: z.object({ visits: z.number(), pages: z.number(), lastSeen: z.string() }).nullable().optional(),\n});\nexport type AccountEngagementRow = z.infer<typeof accountEngagementRowSchema>;\n\n// --- Website people per company ---\n\n/**\n * One company domain's website people, by the work address they gave: how\n * many were seen in the window, how many of them handed a Form a step, and\n * when the first and last of them were seen. `domain` is registrable, as\n * `AccountEngagementRow.domain` is, so the two join on equality. Shown beside\n * LinkedIn engagement, never folded into influence.\n */\nexport const accountWebsiteRowSchema = z.object({\n domain: z.string(),\n people: z.number(),\n leads: z.number(),\n /** ISO. */\n firstSeen: z.string(),\n /** ISO. */\n lastSeen: z.string(),\n});\nexport type AccountWebsiteRow = z.infer<typeof accountWebsiteRowSchema>;\n\nexport const ACCOUNT_DEAL_STATUSES = [\"won\", \"open\", \"lost\", \"none\"] as const;\nexport type AccountDealStatus = (typeof ACCOUNT_DEAL_STATUSES)[number];\n\n/**\n * Where a company stands in the CRM, strongest fact first: a won deal outranks\n * an open one, an open one a lost one; `lost` means every deal it had was lost.\n */\nexport function accountDealStatus(row: {\n hasWonDeal: boolean;\n hasOpenDeal: boolean;\n hasLostDeal: boolean;\n}): AccountDealStatus {\n if (row.hasWonDeal) return \"won\";\n if (row.hasOpenDeal) return \"open\";\n if (row.hasLostDeal) return \"lost\";\n return \"none\";\n}\n\n/** A lost deal stops a company being warm for this many calendar months after it closed. */\nexport const LOST_DEAL_COOLDOWN_MONTHS = 6;\n\n/** `day` minus whole calendar months, clamped to the month's last day: 2026-08-31 − 6 → 2026-02-28. */\nfunction monthsBefore(day: string, months: number): string {\n const [year, month, date] = day.split(\"-\").map(Number);\n const index = (year ?? 1970) * 12 + ((month ?? 1) - 1) - months;\n const lastDate = new Date(Date.UTC(Math.floor(index / 12), (index % 12) + 1, 0)).getUTCDate();\n return new Date(Date.UTC(Math.floor(index / 12), index % 12, Math.min(date ?? 1, lastDate)))\n .toISOString()\n .slice(0, 10);\n}\n\nexport interface WarmAccountsOptions {\n /** Leave out a company below this on one metric in the period — e.g. the influence rule's threshold. */\n minimum?: { metric: InfluenceMetric; value: number };\n}\n\n/**\n * Warm accounts: engaging more than before, and not already somebody's deal —\n * no open deal, never won (a customer is not a prospect), and no deal lost in\n * the last six months. A loss older than that no longer counts, the same rule\n * Fibbler uses, so a company can warm up again. `today` is `YYYY-MM-DD`.\n * Without a `minimum`, one engagement after none already reads as New.\n */\nexport function warmAccounts(\n rows: readonly AccountEngagementRow[],\n today: string,\n options: WarmAccountsOptions = {},\n): AccountEngagementRow[] {\n const cooldownStart = monthsBefore(today, LOST_DEAL_COOLDOWN_MONTHS);\n const { minimum } = options;\n return rows.filter(\n (row) =>\n row.flag !== null &&\n (minimum === undefined || row[minimum.metric] >= minimum.value) &&\n !row.hasOpenDeal &&\n !row.hasWonDeal &&\n !(row.lastLostAt !== null && row.lastLostAt.slice(0, 10) >= cooldownStart),\n );\n}\n\nexport const accountsEngagementRequestSchema = z\n .object({\n ...windowFields,\n /** One campaign's companies; every campaign together when absent. */\n campaignId: z.string().regex(/^\\d+$/, \"use the numeric campaign id\").optional(),\n /** Companies per page. */\n limit: z.number().int().min(1).max(ACCOUNTS_ENGAGEMENT_MAX_LIMIT).default(ACCOUNTS_ENGAGEMENT_DEFAULT_LIMIT),\n /** Which page, 1-based, most engaged first. */\n page: z.number().int().min(1).default(1),\n ...targetsField,\n })\n .superRefine(windowRules);\nexport type AccountsEngagementRequest = z.input<typeof accountsEngagementRequestSchema>;\n\nexport const accountsEngagementResponseSchema = z.object({\n ok: z.literal(true),\n data: z.object({\n window: accountsWindowSchema,\n previousWindow: accountsWindowSchema,\n companies: z.array(accountEngagementRowSchema),\n /** True when more companies were reached than this page and the ones before it hold. */\n truncated: z.boolean(),\n /** Which page this is, and how many companies there are in all. Absent from older servers. */\n pageInfo: z.object({ page: z.number(), pageSize: z.number(), total: z.number(), hasMore: z.boolean() }).optional(),\n /** The company's influence rule (the default one before setup): the minimum `baker accounts warm` applies. */\n rule: influenceParamsSchema.optional(),\n ...targetsSummaryField,\n }),\n});\nexport type AccountsEngagementResponse = z.infer<typeof accountsEngagementResponseSchema>;\n\n// --- Influenced deals ---\n\nexport const INFLUENCE_BASES = [\"pipeline\", \"revenue\"] as const;\nexport type InfluenceBasis = (typeof INFLUENCE_BASES)[number];\n\nexport const accountDealRowSchema = z.object({\n dealId: z.string(),\n dealName: z.string(),\n crmCompanyId: z.string(),\n companyName: z.string(),\n domain: z.string(),\n /** Null when the deal has no amount — unknown, not zero. */\n amount: z.number().nullable(),\n currency: z.string(),\n /** Created (pipeline) or closed won (revenue), ISO. The date the lookback counts back from. */\n referenceAt: z.string(),\n /** By the won and lost stages chosen in the settings. */\n status: z.enum([\"open\", \"won\", \"lost\"]),\n /** The model's metric, summed over the company's lookback months. */\n touchValue: z.number(),\n /** The first month inside the lookback the company was reached, `YYYY-MM-01`. */\n firstTouchMonth: z.string().nullable(),\n /** How surely the CRM company is the LinkedIn one; null when no LinkedIn company matched. */\n matchConfidence: z.enum(MATCH_CONFIDENCES).nullable(),\n /** The company crossed the threshold — whatever the match confidence. */\n influenced: z.boolean(),\n});\nexport type AccountDealRow = z.infer<typeof accountDealRowSchema>;\n\n/** An amount per currency. Amounts in different currencies are never added together. */\nexport type MoneyByCurrency = Record<string, number>;\n\nexport const moneyByCurrencySchema = z.record(z.string(), z.number());\n\nexport const influenceSummarySchema = z.object({\n /** Every deal in the window for this basis. */\n deals: z.number(),\n /** Influenced, confirmed matches only — the headline. */\n influencedDeals: z.number(),\n influencedValue: moneyByCurrencySchema,\n /** Influenced deals with no amount entered: counted, not valued. */\n dealsWithoutAmount: z.number(),\n /** Influenced through a match nobody confirmed yet; not in the headline. */\n lowConfidenceDeals: z.number(),\n lowConfidenceValue: moneyByCurrencySchema,\n /** LinkedIn spend on the companies reached in the window, per currency. */\n spend: moneyByCurrencySchema,\n /** Influenced value per 1 of spend — only when both are in the same single currency. */\n valuePerSpend: z.object({ currency: z.string(), value: z.number() }).nullable(),\n});\nexport type InfluenceSummary = z.infer<typeof influenceSummarySchema>;\n\nfunction addMoney(into: MoneyByCurrency, currency: string, amount: number): void {\n const key = currency.trim().toUpperCase() || \"UNKNOWN\";\n into[key] = (into[key] ?? 0) + amount;\n}\n\n/** The headline numbers over one basis's deals. */\nexport function influenceSummary(deals: readonly AccountDealRow[], spend: MoneyByCurrency): InfluenceSummary {\n const influencedValue: MoneyByCurrency = {};\n const lowConfidenceValue: MoneyByCurrency = {};\n let influencedDeals = 0;\n let lowConfidenceDeals = 0;\n let dealsWithoutAmount = 0;\n for (const row of deals) {\n if (!row.influenced || row.matchConfidence === null) continue;\n if (row.matchConfidence === \"low\") {\n lowConfidenceDeals += 1;\n if (row.amount !== null) addMoney(lowConfidenceValue, row.currency, row.amount);\n continue;\n }\n influencedDeals += 1;\n if (row.amount === null) dealsWithoutAmount += 1;\n else addMoney(influencedValue, row.currency, row.amount);\n }\n return {\n deals: deals.length,\n influencedDeals,\n influencedValue,\n dealsWithoutAmount,\n lowConfidenceDeals,\n lowConfidenceValue,\n spend,\n valuePerSpend: valuePerSpend(influencedValue, spend),\n };\n}\n\nfunction valuePerSpend(value: MoneyByCurrency, spend: MoneyByCurrency): InfluenceSummary[\"valuePerSpend\"] {\n const valueCurrencies = Object.keys(value);\n const spendCurrencies = Object.keys(spend).filter((currency) => (spend[currency] ?? 0) > 0);\n const [currency] = valueCurrencies;\n if (currency === undefined || valueCurrencies.length !== 1 || spendCurrencies.length !== 1) return null;\n const spent = spend[spendCurrencies[0] ?? \"\"];\n if (spendCurrencies[0]?.toUpperCase() !== currency || spent === undefined) return null;\n return { currency, value: Math.round(((value[currency] ?? 0) / spent) * 100) / 100 };\n}\n\nexport const ACCOUNTS_INFLUENCED_DEFAULT_MONTHS = 12;\n\nexport const accountsInfluencedRequestSchema = z\n .object({\n ...windowFields,\n /** `pipeline`: deals created in the window and not won. `revenue`: deals closed won in the window. */\n basis: z.enum(INFLUENCE_BASES).default(\"pipeline\"),\n /** Every deal in the window, influenced or not; compact returns the influenced ones. */\n full: z.boolean().default(false),\n ...ruleOverrideFields,\n ...targetsField,\n })\n .superRefine(windowRules);\nexport type AccountsInfluencedRequest = z.input<typeof accountsInfluencedRequestSchema>;\n\nexport const accountsInfluencedResponseSchema = z.object({\n ok: z.literal(true),\n data: z.object({\n window: accountsWindowSchema,\n basis: z.enum(INFLUENCE_BASES),\n rule: influenceParamsSchema,\n summary: influenceSummarySchema,\n /** Influenced deals on confirmed matches; with `full`, every deal in the window. */\n deals: z.array(accountDealRowSchema),\n /** Influenced through a match nobody confirmed yet. Not in `summary`'s headline. */\n lowConfidence: z.array(accountDealRowSchema),\n /** True when the window held more deals than one read returns. */\n truncated: z.boolean(),\n ...targetsSummaryField,\n }),\n});\nexport type AccountsInfluencedResponse = z.infer<typeof accountsInfluencedResponseSchema>;\n\n// --- One company's timeline ---\n\nexport const accountsCompanyRequestSchema = z\n .object({\n /** LinkedIn organization id, or its `urn:li:organization:` URN. */\n orgId: z\n .string()\n .transform((value) => value.replace(/^urn:li:organization:/, \"\"))\n .pipe(z.string().regex(/^\\d+$/, \"use the LinkedIn company id or its urn:li:organization URN\"))\n .optional(),\n /** The company's website domain, `acme.com`. */\n domain: z\n .string()\n .min(3)\n .max(253)\n .transform((value) =>\n value\n .trim()\n .toLowerCase()\n .replace(/^https?:\\/\\//, \"\")\n .replace(/^www\\./, \"\")\n .replace(/\\/.*$/, \"\"),\n )\n .optional(),\n })\n .refine((req) => (req.orgId === undefined) !== (req.domain === undefined), {\n message: \"Give a LinkedIn company id or a domain, one of the two.\",\n });\nexport type AccountsCompanyRequest = z.input<typeof accountsCompanyRequestSchema>;\n\nexport const accountCompanyMonthSchema = z.object({\n orgId: z.string(),\n /** Empty for the whole ad account; a campaign id otherwise. */\n campaignId: z.string(),\n /** LinkedIn's name for the campaign; null for the account-wide row, or when LinkedIn could not be asked. */\n campaignName: z.string().nullable(),\n month: z.string(),\n impressions: z.number(),\n clicks: z.number(),\n engagements: z.number(),\n});\nexport type AccountCompanyMonth = z.infer<typeof accountCompanyMonthSchema>;\n\nexport const accountCompanyDealSchema = z.object({\n dealId: z.string(),\n dealName: z.string(),\n amount: z.number().nullable(),\n currency: z.string(),\n status: z.enum([\"open\", \"won\", \"lost\"]),\n createdAt: z.string(),\n closedAt: z.string().nullable(),\n /**\n * The rule's metric over the lookback ending with the deal's reference month\n * (created; closed for a won deal), from the pages in `orgs`. Absent before\n * setup or when the company matched no CRM company.\n */\n touchValue: z.number().optional(),\n /** `touchValue` reached the rule's threshold. */\n influenced: z.boolean().optional(),\n});\nexport type AccountCompanyDeal = z.infer<typeof accountCompanyDealSchema>;\n\nexport const accountCompanyOrgSchema = z.object({\n orgId: z.string(),\n name: z.string(),\n domain: z.string(),\n crmCompanyId: z.string().nullable(),\n matchConfidence: z.enum(MATCH_CONFIDENCES).nullable(),\n});\nexport type AccountCompanyOrg = z.infer<typeof accountCompanyOrgSchema>;\n\nexport const accountsCompanyResponseSchema = z.object({\n ok: z.literal(true),\n data: z.object({\n /** Usually one; a domain can name several LinkedIn pages of the same company. */\n orgs: z.array(accountCompanyOrgSchema),\n /** Month by month, per campaign (and the account-wide row, `campaignId: \"\"`), oldest first. */\n months: z.array(accountCompanyMonthSchema),\n /** Deals of the matched CRM company, oldest first. */\n deals: z.array(accountCompanyDealSchema),\n /** The rule `influenced` and `touchValue` on each deal were read with; absent before setup. */\n rule: influenceParamsSchema.optional(),\n }),\n});\nexport type AccountsCompanyResponse = z.infer<typeof accountsCompanyResponseSchema>;\n\n// --- Campaigns ---\n\nexport const accountsCampaignsRequestSchema = z\n .object({\n ...windowFields,\n ...ruleOverrideFields,\n basis: z.enum(INFLUENCE_BASES).default(\"pipeline\"),\n ...targetsField,\n })\n .superRefine(windowRules);\nexport type AccountsCampaignsRequest = z.input<typeof accountsCampaignsRequestSchema>;\n\nexport const accountCampaignRowSchema = z.object({\n campaignId: z.string(),\n /** LinkedIn's name for the campaign; null when LinkedIn could not be asked or no longer lists it. */\n campaignName: z.string().nullable(),\n /** Companies that saw at least one impression in the window. */\n companiesReached: z.number(),\n /** Companies with at least one engagement in the window. */\n companiesEngaged: z.number(),\n /** Influenced deals (of the read's basis) this campaign touched in their lookback. Overlaps other campaigns. */\n influencedDeals: z.number(),\n influencedValue: moneyByCurrencySchema,\n});\nexport type AccountCampaignRow = z.infer<typeof accountCampaignRowSchema>;\n\nexport const accountsCampaignsResponseSchema = z.object({\n ok: z.literal(true),\n data: z.object({\n window: accountsWindowSchema,\n /** Optional for older servers, which read pipeline only. */\n basis: z.enum(INFLUENCE_BASES).optional(),\n rule: influenceParamsSchema,\n campaigns: z.array(accountCampaignRowSchema),\n ...targetsSummaryField,\n }),\n});\nexport type AccountsCampaignsResponse = z.infer<typeof accountsCampaignsResponseSchema>;\n\n// --- Refusals the agent relays ---\n\n/** Deals cannot be counted until someone says where they are and what won and lost mean. */\nexport const ACCOUNTS_NO_SETTINGS_MESSAGE =\n \"Account insights are not set up yet: in Measure → Accounts, say where your deals are (HubSpot or another CRM) and what won and lost mean.\";\nexport * from \"./crm\";\nexport * from \"./crm-columns\";\nexport * from \"./targets\";\nexport * from \"./website\";\n"],"mappings":";;;;;;;;;;;;;AA4BO,IAAM,cAAc;AAK3B,IAAM,eAAe;AACrB,IAAM,QAAQ;AAGd,IAAM,WAAmE;AAAA,EACvE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAW;AAAA,EACX,aAA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IAAI,EAAE,QAAQ,IAAI;AAAA,EAClB,MAAM,EAAE,OAAO;AAAA;AAAA,IAEb,MAAM,EAAE,MAAM,uBAAuB;AAAA;AAAA,IAErC,QAAQ,EAAE,MAAM,yBAAyB;AAAA;AAAA,IAEzC,OAAO,EAAE,MAAM,wBAAwB;AAAA;AAAA,IAEvC,MAAM,sBAAsB,SAAS;AAAA,EACvC,CAAC;AACH,CAAC;AAKM,IAAM,iCAAiC,EAC3C,OAAO;AAAA,EACN,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,EAAE,KAAK,eAAe,EAAE,QAAQ,UAAU;AAAA,EACjD,GAAG;AACL,CAAC,EACA,YAAY,WAAW;AAGnB,IAAM,2BAA2B,EAAE,OAAO;AAAA,EAC/C,YAAY,EAAE,OAAO;AAAA;AAAA,EAErB,cAAc,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAElC,kBAAkB,EAAE,OAAO;AAAA;AAAA,EAE3B,kBAAkB,EAAE,OAAO;AAAA;AAAA,EAE3B,iBAAiB,EAAE,OAAO;AAAA,EAC1B,iBAAiB;AACnB,CAAC;AAGM,IAAM,kCAAkC,EAAE,OAAO;AAAA,EACtD,IAAI,EAAE,QAAQ,IAAI;AAAA,EAClB,MAAM,EAAE,OAAO;AAAA,IACb,QAAQ;AAAA;AAAA,IAER,OAAO,EAAE,KAAK,eAAe,EAAE,SAAS;AAAA,IACxC,MAAM;AAAA,IACN,WAAW,EAAE,MAAM,wBAAwB;AAAA,IAC3C,GAAG;AAAA,EACL,CAAC;AACH,CAAC;AAMM,IAAM,+BACX;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/landing/inspiration/index.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\n\nexport const inspirationCommand = defineCommand({\n meta: {\n name: \"inspiration\",\n description: `Reference library of real landing-page sections — look at how good pages actually solve a problem before you design one.\n\nStart here: \\`baker landing inspiration search \"<what you want to see>\"\\` during research, BEFORE you write the Direction Contract.\n\nThis is inspiration, never a clipboard. Take the mechanism — what the eye hits first, what proof arrives before the ask, how the grid is split. The words are never yours to reuse: shipping a reference's headline is a Tier 0 message-match failure.\n\nSubcommands:\n baker landing inspiration search \"<query>\" — search by look, section type, composition, register or motion; saves screenshots you can Read\n baker landing inspiration view <id> — one section in full: tokens, motion filmstrip, why it works, what to change\n baker landing inspiration code <id> — its standalone HTML+CSS, for structure only\n baker landing inspiration page <id> — a whole page as a sequence: how it orders its sections\n baker landing inspiration sequences \"<q>\" — what follows what across MANY pages: openers, transitions, closers\n baker landing inspiration add <url> — add a page to the library and save it to this company (returns immediately); --refresh re-studies a page that changed\n baker landing inspiration favorites — what this company has saved; the default search scope\n baker landing inspiration favorite <id> — save a section\n baker landing inspiration unfavorite <id> — unsave a section\n baker landing inspiration retry-failed — study again every saved page that failed\n baker landing inspiration scrape <url> — internal/ops: run the capture locally\n\nExamples:\n baker landing inspiration search \"pricing with a monthly/annual toggle\" --max-rank 3\n baker landing inspiration search \"dark developer hero with a terminal\" --register dev-tool-minimal --scope all\n baker landing inspiration search \"testimonial wall with faces and company logos\" --motion scroll-reveal\n baker landing inspiration sequences \"b2b saas pricing page\" --scope all\n baker landing inspiration add https://linear.app\n\nFull guide: __tooling__/docs/tools/baker/landing.md`,\n },\n subCommands: {\n search: () => import(\"./search.ts\").then((m) => m.searchCommand),\n view: () => import(\"./view.ts\").then((m) => m.viewCommand),\n code: () => import(\"./code.ts\").then((m) => m.codeCommand),\n page: () => import(\"./page.ts\").then((m) => m.pageCommand),\n sequences: () => import(\"./sequences.ts\").then((m) => m.sequencesCommand),\n add: () => import(\"./add.ts\").then((m) => m.addCommand),\n favorites: () => import(\"./favorites.ts\").then((m) => m.favoritesCommand),\n favorite: () => import(\"./favorites.ts\").then((m) => m.favoriteCommand),\n unfavorite: () => import(\"./favorites.ts\").then((m) => m.unfavoriteCommand),\n \"retry-failed\": () => import(\"./retry-failed.ts\").then((m) => m.retryFailedCommand),\n scrape: () => import(\"./scrape.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