@datarails-ai/dr-appspace-cli 0.12.45 → 0.12.47

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.
Files changed (3) hide show
  1. package/README.md +25 -2
  2. package/dist/cli.js +169 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -333,8 +333,8 @@ command calls a model: the builders write `contract.json` themselves and run
333
333
  `app-space test --screenshot` draws, after the usual checks, every page of the
334
334
  pushed package once per declared role in headless Google Chrome, and writes
335
335
  `<out>/<page>.<role>.png` plus an `index.json` that a judge can read (page,
336
- role, file, size, which handlers the page called, which had no fixture). It
337
- judges nothing yet; the `look-*` findings come later.
336
+ role, file, size, which handlers the page called, which had no fixture), and
337
+ then reads each laid-out page back for the `look-*` findings below.
338
338
 
339
339
  | Flag | What it does | Default |
340
340
  | --- | --- | --- |
@@ -343,6 +343,7 @@ judges nothing yet; the `look-*` findings come later.
343
343
  | `--role <name>` | only this declared role (repeatable, or `a,b`) | every declared role (`default` for an app with none) |
344
344
  | `--width <px>` / `--height <px>` | the window | `1400` × `900` |
345
345
  | `--full` | grow the window to the page's full height (one extra load per picture) | off |
346
+ | `--no-look` | skip the look load (see below) | look on |
346
347
  | `--shelf <path>` | serve `vendor/` and `ui-kit/` from this dr-app-space checkout | the server the app is pushed to |
347
348
  | `--screenshot-budget <ms>` | the whole phase's ceiling; each picture is capped at 60 s | `180000` |
348
349
 
@@ -362,6 +363,28 @@ comes from the server the app is pushed to (its public `/vendor/*` and
362
363
  `/ui-kit/*`, fetched once per run). Use `--shelf` with a checkout to work
363
364
  offline.
364
365
 
366
+ **What the look load reports.** One more headless load per picture (the
367
+ same load `--full` measures on, when it is given) reads the laid-out page
368
+ back. Three things a builder can change in `contract.json` become **warnings**
369
+ in Findings, which `--strict` never counts. They are said once per page and
370
+ problem, with every role that saw it:
371
+
372
+ | Finding | What the page shows |
373
+ | --- | --- |
374
+ | `look-text-clipped` | a label or title wider than its box, cut by an ellipsis or a clip, or more lines than a line clamp shows |
375
+ | `look-band-underfilled` | a band whose tiles sit in one row and cover under 60% of it (B6: a titled `kpi_strip` on dr-app-runtime 1.13.1); a grid band whose own spans ask for less of the row is left alone |
376
+ | `look-page-overflow` | the page scrolls sideways, or something ends past the window's right edge with nothing scrolling it |
377
+
378
+ Each picture's `look` row in `index.json` also carries three more, which go
379
+ in the table's `look:` line and not in Findings: `low-contrast` (text under
380
+ WCAG's 4.5:1, once per colour pair: usually a platform colour, not the
381
+ app's), `empty-band` (a band heading with no tile, often only an empty
382
+ fixture) and `text-overlap`. The pictures are drawn on fixture data, not
383
+ the tenant's rows, so a page can lay out differently with real data. Without
384
+ `--full` the look loads run once every picture is taken, on what is left of
385
+ `--screenshot-budget`, so they never cost a picture; one with less than 5 s
386
+ left is skipped and its row says why in `lookSkipped`.
387
+
365
388
  Chrome is found through `CHROME_PATH`, then `google-chrome`, `chromium` or
366
389
  `chrome` on `PATH`, then the macOS app bundle and the usual Linux paths. With
367
390
  none, the command exits 2 before anything runs. No browser is ever
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import { fileURLToPath as fileURLToPath6 } from "url";
13
13
  // package.json
14
14
  var package_default = {
15
15
  name: "@datarails-ai/dr-appspace-cli",
16
- version: "0.12.45",
16
+ version: "0.12.47",
17
17
  description: "Datarails App Space CLI \u2014 build, try, push and publish App Space apps",
18
18
  type: "module",
19
19
  engines: {
@@ -57,7 +57,7 @@ var package_default = {
57
57
  };
58
58
 
59
59
  // src/buildInfo.ts
60
- var BUILD_TIME = "2026-10-28T20:57:24.497Z";
60
+ var BUILD_TIME = "2026-10-28T22:36:55.266Z";
61
61
  function formatBuildTime(iso) {
62
62
  if (iso === "") return "";
63
63
  const d = new Date(iso);
@@ -22997,6 +22997,11 @@ function describePostCommit(result) {
22997
22997
  }
22998
22998
  return lines.join("");
22999
22999
  }
23000
+ function describeServerWarnings(result) {
23001
+ const said2 = new Set((result.post_commit_failed ?? []).map((f) => f.warning).filter((w) => typeof w === "string"));
23002
+ return (Array.isArray(result.warnings) ? result.warnings : []).filter((line2) => typeof line2 === "string" && line2.trim() !== "" && !said2.has(line2)).map((line2) => `warning: ${line2}
23003
+ `).join("");
23004
+ }
23000
23005
  async function bindForPush(client, appId, contract, opts) {
23001
23006
  const transport = metricsTransport(client);
23002
23007
  const app = contract?.app;
@@ -23122,6 +23127,7 @@ async function pushFolder(dir, opts) {
23122
23127
  owner: result.owner ?? null
23123
23128
  });
23124
23129
  if (pushFailed(result)) process.exitCode = 1;
23130
+ process.stderr.write(describeServerWarnings(result));
23125
23131
  if (opts.json === true) {
23126
23132
  printJson(result);
23127
23133
  return outcome;
@@ -35354,6 +35360,8 @@ var VIRTUAL_TIME_MS = 8e3;
35354
35360
  var ATTEMPT_MS = 25e3;
35355
35361
  var MEASURE_MS = 15e3;
35356
35362
  var FULL_HEIGHT_CAP = 8e3;
35363
+ var LOOK_MIN_MS = 5e3;
35364
+ var BAND_FILL_MIN = 0.6;
35357
35365
  var NO_ROLE = "default";
35358
35366
  var CHROME_MISSING = "app-space test --screenshot needs Google Chrome: install Google Chrome or set CHROME_PATH to a Chrome or Chromium binary. Nothing is downloaded.";
35359
35367
  var CHROME_APP_PATHS = [
@@ -35583,11 +35591,32 @@ var Shelf = class {
35583
35591
  return missing;
35584
35592
  }
35585
35593
  };
35586
- var MEASURE_SCRIPT = '<script>addEventListener("load",function(){setTimeout(function(){var d=document.documentElement,b=document.body||d,extra=0;document.querySelectorAll("*").forEach(function(e){var s=getComputedStyle(e).overflowY;if((s==="auto"||s==="scroll")&&e.scrollHeight>e.clientHeight)extra=Math.max(extra,e.scrollHeight-e.clientHeight)});var h=Math.max(d.scrollHeight,b.scrollHeight,innerHeight+extra);var m=document.createElement("meta");m.id="dr-shot-height";m.content=String(h);document.head.appendChild(m)},3000)})</script>';
35587
- function injectMeasure(html) {
35594
+ var MEASURE_BODY = 'var d=document.documentElement,b=document.body||d,extra=0;document.querySelectorAll("*").forEach(function(e){var s=getComputedStyle(e).overflowY;if((s==="auto"||s==="scroll")&&e.scrollHeight>e.clientHeight)extra=Math.max(extra,e.scrollHeight-e.clientHeight)});var h=Math.max(d.scrollHeight,b.scrollHeight,innerHeight+extra);var m=document.createElement("meta");m.id="dr-shot-height";m.content=String(h);document.head.appendChild(m);';
35595
+ var LOOK_BODY = 'var R=[],vw=innerWidth,D=document.documentElement,N={};function nth(k){N[k]=(N[k]||0)+1;return N[k]}function tx(e){return (e.innerText||e.textContent||"").trim().replace(/\\s+/g," ").slice(0,80)}function vis(e){var r=e.getBoundingClientRect(),s=getComputedStyle(e);return r.width>0&&r.height>0&&s.visibility!=="hidden"&&s.display!=="none"}function own(e){return [].some.call(e.childNodes,function(n){return n.nodeType===3&&n.textContent.trim()!==""})}function ownW(e){var r=e.getBoundingClientRect(),x=r.left+e.clientLeft,m=0;[].forEach.call(e.childNodes,function(n){if(n.nodeType!==3||n.textContent.trim()==="")return;var g=document.createRange();g.selectNodeContents(n);m=Math.max(m,g.getBoundingClientRect().right-x)});return Math.ceil(m)}function rgb(c){var m=/rgba?\\(([^)]+)\\)/.exec(c);if(!m)return null;var p=m[1].split(/[\\s,\\/]+/).filter(Boolean).map(Number);return p.length>=3&&p.slice(0,3).every(isFinite)?[p[0],p[1],p[2],p.length>3&&isFinite(p[3])?p[3]:1]:null}function lum(c){return [c[0],c[1],c[2]].map(function(v){v/=255;return v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4)}).reduce(function(a,v,i){return a+v*[.2126,.7152,.0722][i]},0)}function bgOf(e){for(var p=e;p&&p.nodeType===1;p=p.parentElement){var s=getComputedStyle(p);if(s.backgroundImage!=="none")return null;var c=rgb(s.backgroundColor);if(c&&c[3]>=1)return c}return [255,255,255,1]}var all=[].filter.call(document.querySelectorAll("body *"),vis),pairs={};all.forEach(function(e){if(!own(e))return;var s=getComputedStyle(e);if(e.clientWidth>2&&e.clientHeight>2){var need=e.children.length===0?e.scrollWidth:ownW(e);if(need>e.clientWidth+1&&(s.textOverflow==="ellipsis"||s.overflowX==="hidden"||s.overflowX==="clip"))R.push({rule:"text-clipped",text:tx(e),n:nth("c|"+tx(e)),shown:e.clientWidth,needs:need});else if(s.webkitLineClamp&&s.webkitLineClamp!=="none"&&e.scrollHeight>e.clientHeight+1)R.push({rule:"text-clipped",text:tx(e),n:nth("c|"+tx(e)),shown:e.clientHeight,needs:e.scrollHeight,lines:true})}var f=rgb(s.color),b=bgOf(e);if(!f||!b)return;var a=f[3],fc=[f[0]*a+b[0]*(1-a),f[1]*a+b[1]*(1-a),f[2]*a+b[2]*(1-a)],L1=lum(fc),L2=lum(b),cr=(Math.max(L1,L2)+.05)/(Math.min(L1,L2)+.05),px=parseFloat(s.fontSize),big=px>=24||(px>=18.66&&Number(s.fontWeight)>=700);if(cr<(big?3:4.5)){var k=s.color+"|"+b.join(",");if(pairs[k])pairs[k].count++;else{pairs[k]={rule:"low-contrast",text:tx(e),ratio:Math.round(cr*100)/100,color:s.color,background:"rgb("+b.slice(0,3).join(", ")+")",count:1};R.push(pairs[k])}}});if(D.scrollWidth>vw+1)R.push({rule:"page-overflow",text:"",right:D.scrollWidth,viewport:vw});var off=0;all.forEach(function(e){if(off>=5)return;var r=e.getBoundingClientRect(),s=getComputedStyle(e);if(r.right<=vw+1||s.position==="fixed")return;var p=e.parentElement;if(p&&p!==document.body&&p!==D&&p.getBoundingClientRect().right>vw+1)return;for(var q=p;q&&q!==document.body&&q!==D;q=q.parentElement){if(getComputedStyle(q).overflowX!=="visible")return}off++;R.push({rule:"page-overflow",text:tx(e),n:nth("o|"+tx(e)),right:Math.round(r.right),viewport:vw})});document.querySelectorAll(".dr-app-band").forEach(function(b){if(!vis(b))return;var cs=[].filter.call(b.querySelectorAll(".dr-app-cell"),function(c){return vis(c)&&c.closest(".dr-app-band")===b});var hd=b.querySelector(".dr-app-band-head"),name=hd?tx(hd):"";if(cs.length===0){if(hd)R.push({rule:"empty-band",band:name});return}if(cs.length<2)return;if((b.getAttribute("data-dr-layout")||"grid")==="grid"&&cs.reduce(function(a,c){return a+(Number(c.getAttribute("data-dr-span"))||12)},0)<12*' + String(BAND_FILL_MIN) + ")return;var top=cs[0].getBoundingClientRect().top;if(!cs.every(function(c){return Math.abs(c.getBoundingClientRect().top-top)<2}))return;var w=cs.reduce(function(a,c){return a+c.getBoundingClientRect().width},0),bw=b.getBoundingClientRect().width;if(bw>0&&w<bw*" + String(BAND_FILL_MIN) + ')R.push({rule:"band-underfilled",band:name,filled:Math.round(100*w/bw),tiles:cs.length,tileWidth:Math.round(cs[0].getBoundingClientRect().width),bandWidth:Math.round(bw)})});var lv=all.filter(function(e){return e.children.length===0&&own(e)}).slice(0,400);for(var i=0;i<lv.length;i++)for(var j=i+1;j<lv.length;j++){var x=lv[i].getBoundingClientRect(),y=lv[j].getBoundingClientRect();if(Math.min(x.right,y.right)-Math.max(x.left,y.left)>4&&Math.min(x.bottom,y.bottom)-Math.max(x.top,y.top)>4)R.push({rule:"text-overlap",a:tx(lv[i]),b:tx(lv[j])})}var lm=document.createElement("meta");lm.id="dr-shot-look";lm.content=encodeURIComponent(JSON.stringify(R));document.head.appendChild(lm);';
35596
+ function probeScript(shot) {
35597
+ const body = (shot.measure === true ? MEASURE_BODY : "") + (shot.look === true ? LOOK_BODY : "");
35598
+ return `<script>addEventListener("load",function(){setTimeout(function(){${body}},3000)})</script>`;
35599
+ }
35600
+ function injectProbe(html, shot) {
35601
+ const script = probeScript(shot);
35588
35602
  const head = /<head\b[^>]*>/i.exec(html);
35589
- if (head === null) return MEASURE_SCRIPT + html;
35590
- return html.slice(0, head.index + head[0].length) + MEASURE_SCRIPT + html.slice(head.index + head[0].length);
35603
+ if (head === null) return script + html;
35604
+ return html.slice(0, head.index + head[0].length) + script + html.slice(head.index + head[0].length);
35605
+ }
35606
+ var LOOK_RULES = /* @__PURE__ */ new Set(["text-clipped", "band-underfilled", "page-overflow", "text-overlap", "low-contrast", "empty-band"]);
35607
+ function parseLook(dom) {
35608
+ const found = [...dom.matchAll(/id="dr-shot-look"[^>]*content="([^"]*)"|content="([^"]*)"[^>]*id="dr-shot-look"/g)].at(-1);
35609
+ const raw = found?.[1] ?? found?.[2];
35610
+ if (raw === void 0) return null;
35611
+ try {
35612
+ const rows2 = JSON.parse(decodeURIComponent(raw));
35613
+ if (!Array.isArray(rows2)) return null;
35614
+ return rows2.filter(
35615
+ (row) => typeof row === "object" && row !== null && LOOK_RULES.has(row.rule)
35616
+ );
35617
+ } catch {
35618
+ return null;
35619
+ }
35591
35620
  }
35592
35621
  function send(res, status, type, body) {
35593
35622
  res.writeHead(status, { "Content-Type": type, "Cache-Control": "no-store" });
@@ -35652,8 +35681,8 @@ async function startStubServer(opts) {
35652
35681
  const body = Object.prototype.hasOwnProperty.call(opts.files, entry) ? opts.files[entry] : void 0;
35653
35682
  if (body === void 0) return send(res, 404, "text/plain", "no such UI file");
35654
35683
  const type = contentType(entry);
35655
- if (shot.measure === true && type.startsWith("text/html")) {
35656
- return send(res, 200, type, injectMeasure(body.toString()));
35684
+ if ((shot.measure === true || shot.look === true) && type.startsWith("text/html")) {
35685
+ return send(res, 200, type, injectProbe(body.toString(), shot));
35657
35686
  }
35658
35687
  return send(res, 200, type, body);
35659
35688
  }
@@ -35804,6 +35833,7 @@ async function runScreenshots(opts) {
35804
35833
  const started = now();
35805
35834
  const budgetUntil = started + opts.budgetMs;
35806
35835
  const shotTimeout = opts.shotTimeoutMs ?? SHOT_TIMEOUT_MS;
35836
+ const look = opts.look !== false;
35807
35837
  await mkdir8(opts.outDir, { recursive: true });
35808
35838
  const answers = fixtureAnswers(opts.cases);
35809
35839
  const shelf2 = new Shelf(opts.shelf, opts.fetchImpl);
@@ -35820,6 +35850,29 @@ async function runScreenshots(opts) {
35820
35850
  for (const entry of opts.pages) for (const role of opts.roles) plan.push({ entry, role });
35821
35851
  const shots = new Array(plan.length);
35822
35852
  let nextId = 0;
35853
+ const toLook = [];
35854
+ const lookAt = async (index2) => {
35855
+ const { entry, role } = plan[index2];
35856
+ const shot = shots[index2];
35857
+ const left = Math.min(shotTimeout, budgetUntil - now());
35858
+ let seen;
35859
+ if (left < LOOK_MIN_MS) {
35860
+ seen = { look: null, skipped: "the screenshot budget ran out" };
35861
+ } else {
35862
+ const lid = nextId++;
35863
+ stub.register(lid, { role, look: true });
35864
+ const probed = await runChrome({
35865
+ chrome: opts.chrome,
35866
+ url: stub.urlFor(lid, entry),
35867
+ width: opts.width,
35868
+ height: opts.height,
35869
+ timeoutMs: Math.min(MEASURE_MS, left)
35870
+ });
35871
+ const rows2 = parseLook(probed.stdout);
35872
+ seen = rows2 === null ? { look: null, skipped: probed.error ?? "the page never settled" } : { look: rows2 };
35873
+ }
35874
+ shots[index2] = { ...shot, look: seen.look, ...seen.skipped === void 0 ? {} : { lookSkipped: seen.skipped } };
35875
+ };
35823
35876
  const one = async (index2) => {
35824
35877
  const { entry, role } = plan[index2];
35825
35878
  const file = `${pageName(entry)}.${safeRole(role)}.png`;
@@ -35849,9 +35902,10 @@ async function runScreenshots(opts) {
35849
35902
  const pageUntil = Math.min(t0 + shotTimeout, budgetUntil);
35850
35903
  const attemptMs = () => Math.max(500, Math.min(ATTEMPT_MS, Math.ceil(shotTimeout / 2), pageUntil - now()));
35851
35904
  let height = opts.height;
35905
+ let seen;
35852
35906
  if (opts.full) {
35853
35907
  const mid = nextId++;
35854
- stub.register(mid, { role, measure: true });
35908
+ stub.register(mid, { role, measure: true, look });
35855
35909
  const measured = await runChrome({
35856
35910
  chrome: opts.chrome,
35857
35911
  url: stub.urlFor(mid, entry),
@@ -35864,6 +35918,10 @@ async function runScreenshots(opts) {
35864
35918
  );
35865
35919
  const tall = Number(found?.[1] ?? found?.[2] ?? NaN);
35866
35920
  if (Number.isFinite(tall)) height = Math.min(FULL_HEIGHT_CAP, Math.max(opts.height, tall));
35921
+ if (look) {
35922
+ const rows2 = parseLook(measured.stdout);
35923
+ seen = rows2 === null ? { look: null, skipped: measured.error ?? "the page never settled" } : { look: rows2 };
35924
+ }
35867
35925
  }
35868
35926
  const out = join17(opts.outDir, file);
35869
35927
  let id = -1;
@@ -35900,7 +35958,14 @@ async function runScreenshots(opts) {
35900
35958
  return;
35901
35959
  }
35902
35960
  const bytes = await readFile12(out);
35903
- shots[index2] = { ...entryOut, path: file, size: pngSize(bytes), bytes: bytes.length };
35961
+ if (look && seen === void 0) toLook.push(index2);
35962
+ shots[index2] = {
35963
+ ...entryOut,
35964
+ path: file,
35965
+ size: pngSize(bytes),
35966
+ bytes: bytes.length,
35967
+ ...seen === void 0 ? {} : { look: seen.look, ...seen.skipped === void 0 ? {} : { lookSkipped: seen.skipped } }
35968
+ };
35904
35969
  };
35905
35970
  try {
35906
35971
  let cursor = 0;
@@ -35911,6 +35976,13 @@ async function runScreenshots(opts) {
35911
35976
  }
35912
35977
  });
35913
35978
  await Promise.all(workers);
35979
+ toLook.sort((a, b) => a - b);
35980
+ let lookCursor = 0;
35981
+ await Promise.all(
35982
+ Array.from({ length: Math.max(1, Math.min(opts.concurrency ?? SHOT_CONCURRENCY, toLook.length)) }, async () => {
35983
+ while (lookCursor < toLook.length) await lookAt(toLook[lookCursor++]);
35984
+ })
35985
+ );
35914
35986
  } finally {
35915
35987
  await stub.close();
35916
35988
  }
@@ -35925,6 +35997,7 @@ async function runScreenshots(opts) {
35925
35997
  fixtures: Object.fromEntries([...answers].map(([name, answer]) => [name, answer.from])),
35926
35998
  createdAt: new Date(started).toISOString(),
35927
35999
  ms: now() - started,
36000
+ look,
35928
36001
  shots
35929
36002
  };
35930
36003
  await writeFile9(join17(opts.outDir, "index.json"), JSON.stringify(index, null, 2) + "\n");
@@ -35978,10 +36051,50 @@ screenshots \u2192 ${outDir} (${String(written)} of ${String(index.shots.length
35978
36051
  out += ` not on the shelf (${index.shelf.kind === "server" ? index.shelf.url : index.shelf.path}): ${index.shelfMisses.slice(0, 5).join(", ")}${index.shelfMisses.length > 5 ? ", \u2026" : ""}
35979
36052
  `;
35980
36053
  }
36054
+ out += lookLine(index);
35981
36055
  out += ` index: ${join17(outDir, "index.json")}
35982
36056
  `;
35983
36057
  return out;
35984
36058
  }
36059
+ var LOOK_LABELS = {
36060
+ "text-clipped": "text cut short",
36061
+ "band-underfilled": "underfilled band",
36062
+ "page-overflow": "past the right edge",
36063
+ "text-overlap": "text over text",
36064
+ "low-contrast": "low-contrast colour pair",
36065
+ "empty-band": "band with no tile"
36066
+ };
36067
+ function lookLine(index) {
36068
+ if (!index.look) return "";
36069
+ const checked = index.shots.filter((shot) => Array.isArray(shot.look));
36070
+ const notChecked3 = index.shots.filter((shot) => shot.path !== null && !Array.isArray(shot.look)).length;
36071
+ const seen = /* @__PURE__ */ new Map();
36072
+ for (const shot of checked) {
36073
+ for (const row of shot.look ?? []) {
36074
+ const key = row.rule === "low-contrast" ? `${row.color}|${row.background}` : `${shot.page}|${lookKey(row)}`;
36075
+ const keys2 = seen.get(row.rule) ?? /* @__PURE__ */ new Set();
36076
+ keys2.add(key);
36077
+ seen.set(row.rule, keys2);
36078
+ }
36079
+ }
36080
+ const counts = Object.keys(LOOK_LABELS).filter((rule) => (seen.get(rule)?.size ?? 0) > 0).map((rule) => `${String(seen.get(rule)?.size ?? 0)} ${LOOK_LABELS[rule]}`);
36081
+ const skipped = notChecked3 === 0 ? "" : ` (${String(notChecked3)} picture(s) not checked)`;
36082
+ return ` look: ${counts.length === 0 ? "nothing seen" : counts.join(", ")}${skipped}
36083
+ `;
36084
+ }
36085
+ function lookKey(row) {
36086
+ switch (row.rule) {
36087
+ case "band-underfilled":
36088
+ case "empty-band":
36089
+ return `${row.rule}|${row.band}`;
36090
+ case "text-overlap":
36091
+ return `${row.rule}|${row.a}|${row.b}`;
36092
+ case "low-contrast":
36093
+ return `${row.rule}|${row.color}|${row.background}`;
36094
+ default:
36095
+ return `${row.rule}|${row.text}|${String(row.n ?? 1)}`;
36096
+ }
36097
+ }
35985
36098
 
35986
36099
  // src/commands/appspace/_roles.ts
35987
36100
  var PREVIEW_ROLE_HEADER = "x-app-space-preview-role";
@@ -37532,6 +37645,47 @@ function formatFindings(findings) {
37532
37645
  `;
37533
37646
  return out;
37534
37647
  }
37648
+ function lookFindings(index) {
37649
+ if (index === null || index === void 0) return [];
37650
+ const fixable = (row) => row.rule === "text-clipped" || row.rule === "band-underfilled" || row.rule === "page-overflow";
37651
+ const byKey2 = /* @__PURE__ */ new Map();
37652
+ for (const shot of index.shots) {
37653
+ for (const row of shot.look ?? []) {
37654
+ if (!fixable(row)) continue;
37655
+ const key = `${shot.page}|${lookKey(row)}`;
37656
+ const one = byKey2.get(key);
37657
+ if (one === void 0) byKey2.set(key, { page: shot.page, row, roles: [shot.role] });
37658
+ else if (!one.roles.includes(shot.role)) one.roles.push(shot.role);
37659
+ }
37660
+ }
37661
+ return [...byKey2.values()].map(({ page, row, roles }) => {
37662
+ const where2 = `ui/${page}${roles.length === 1 && roles[0] === NO_ROLE ? "" : ` (as ${roles.join(", ")})`}`;
37663
+ const base = { where: where2, see: SEE.pages, severity: "warning" };
37664
+ switch (row.rule) {
37665
+ case "text-clipped":
37666
+ return {
37667
+ ...base,
37668
+ code: "look-text-clipped",
37669
+ message: row.lines === true ? `"${row.text}" needs ${String(row.needs)} px of height and shows ${String(row.shown)}, so its last lines are cut` : `"${row.text}" needs ${String(row.needs)} px and has ${String(row.shown)}, so it is cut short`,
37670
+ fix: "Shorten the label, or give its card more room: a wider span, or a grid band instead of a kpi_strip"
37671
+ };
37672
+ case "band-underfilled":
37673
+ return {
37674
+ ...base,
37675
+ code: "look-band-underfilled",
37676
+ message: `the band${row.band === "" ? "" : ` "${row.band}"`} draws ${String(row.tiles)} tiles ${String(row.tileWidth)} px wide, ${String(row.filled)}% of its ${String(row.bandWidth)} px row`,
37677
+ fix: "Give its elements spans that fill the row; a titled kpi_strip fills its row from dr-app-runtime 1.13.2, so compile it again with the current CLI"
37678
+ };
37679
+ default:
37680
+ return {
37681
+ ...base,
37682
+ code: "look-page-overflow",
37683
+ message: row.text === "" ? `the page is ${String(row.right)} px wide in a ${String(row.viewport)} px window, so it scrolls sideways` : `"${row.text}" ends at ${String(row.right)} px, past the ${String(row.viewport)} px window`,
37684
+ fix: "Narrow what is named, or give wide content (a long table, a row of many controls) a card of its own"
37685
+ };
37686
+ }
37687
+ });
37688
+ }
37535
37689
 
37536
37690
  // src/commands/appspace/test.ts
37537
37691
  function positiveInt(raw, fallback, flag) {
@@ -38404,6 +38558,9 @@ function registerTestCommand(parent) {
38404
38558
  "With --screenshot: draw only this declared role (repeatable, or comma-separated). Default: every declared role.",
38405
38559
  collectRoles
38406
38560
  ).option("--width <px>", "With --screenshot: the window width.", "1400").option("--height <px>", "With --screenshot: the window height.", "900").option("--full", "With --screenshot: grow the window to the page\u2019s full height (one extra load per picture).").option(
38561
+ "--no-look",
38562
+ "With --screenshot: skip the look load (one more load per picture that reports text cut short, an underfilled band and content past the window edge as look-* warnings)."
38563
+ ).option(
38407
38564
  "--shelf <path>",
38408
38565
  "With --screenshot: serve vendor/ and ui-kit/ from this dr-app-space checkout instead of the server the app is pushed to (for offline use)."
38409
38566
  ).option(
@@ -38607,9 +38764,11 @@ function registerTestCommand(parent) {
38607
38764
  width: shotSize.width,
38608
38765
  height: shotSize.height,
38609
38766
  full: opts.full === true,
38767
+ look: opts.look !== false,
38610
38768
  budgetMs: shotSize.budget
38611
38769
  });
38612
38770
  shots = { index, outDir };
38771
+ findings.push(...lookFindings(index));
38613
38772
  }
38614
38773
  const handlerFailures = outcomes.filter((o) => !o.ok).length;
38615
38774
  const smokeFailures = runs.reduce(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarails-ai/dr-appspace-cli",
3
- "version": "0.12.45",
3
+ "version": "0.12.47",
4
4
  "description": "Datarails App Space CLI — build, try, push and publish App Space apps",
5
5
  "type": "module",
6
6
  "engines": {