@aayambansal/squint 0.6.0 → 0.6.1

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.
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  App
4
- } from "./chunk-2KJLEM53.js";
4
+ } from "./chunk-ZG3XQDUW.js";
5
5
  import "./chunk-3GHZOVAA.js";
6
- import "./chunk-VCDZGQBB.js";
6
+ import "./chunk-5MQOJYUC.js";
7
7
  import "./chunk-UBADCBPT.js";
8
8
  import "./chunk-IEQGTVWN.js";
9
9
  import "./chunk-AUJJGMZG.js";
@@ -14,9 +14,9 @@ import "./chunk-DOWWBLX2.js";
14
14
  import "./chunk-K5QJMSJH.js";
15
15
  import "./chunk-WAJXATCO.js";
16
16
  import "./chunk-62JNF5M2.js";
17
- import "./chunk-7FAS2O3L.js";
17
+ import "./chunk-UMDV4ITQ.js";
18
18
  import "./chunk-7CAGWFAQ.js";
19
- import "./chunk-P6D4RSWD.js";
19
+ import "./chunk-N7YEWQGZ.js";
20
20
  import "./chunk-PZV2FJE5.js";
21
21
  import "./chunk-DABIMOMV.js";
22
22
  export {
@@ -5,7 +5,7 @@ import {
5
5
  pixelDiffAttributed,
6
6
  pixelDiffPct,
7
7
  runFlow
8
- } from "./chunk-P6D4RSWD.js";
8
+ } from "./chunk-N7YEWQGZ.js";
9
9
  export {
10
10
  cdpCapture,
11
11
  hasWebSocket,
@@ -143,8 +143,8 @@ function stepExpression(step) {
143
143
  async function suggestFlows(cwd, baseUrl, chromePath) {
144
144
  const fs2 = await import("fs");
145
145
  const path2 = await import("path");
146
- const { cdpCapture } = await import("./cdp-RFQCIQFP.js");
147
- const { loadRoutes } = await import("./preview-WYFBPFFL.js");
146
+ const { cdpCapture } = await import("./cdp-IGPGFMC6.js");
147
+ const { loadRoutes } = await import("./preview-4OF6JB5B.js");
148
148
  const dir = path2.join(cwd, ".squint", "flows");
149
149
  fs2.mkdirSync(dir, { recursive: true });
150
150
  const created = [];
@@ -51,7 +51,7 @@ import {
51
51
  comparePulseAttributed,
52
52
  probeRuntime,
53
53
  runtimeSummary
54
- } from "./chunk-7FAS2O3L.js";
54
+ } from "./chunk-UMDV4ITQ.js";
55
55
  import {
56
56
  clearState,
57
57
  loadState,
@@ -769,7 +769,13 @@ squint verifies every turn \u2014 gates, runtime probe, page audits. Do not decl
769
769
  this.push("image", pulsePath);
770
770
  return null;
771
771
  }
772
- const diff = await comparePulseAttributed(previous, current, this.state.devUrl ?? void 0);
772
+ const { previewDir } = await import("./preview-4OF6JB5B.js");
773
+ const diff = await comparePulseAttributed(
774
+ previous,
775
+ current,
776
+ this.state.devUrl ?? void 0,
777
+ (await import("path")).join(previewDir(this.opts.cwd), "triptych.png")
778
+ );
773
779
  if (diff === null) return null;
774
780
  const pct = diff.pct;
775
781
  this.push(
@@ -778,7 +784,7 @@ squint verifies every turn \u2014 gates, runtime probe, page audits. Do not decl
778
784
  ${diff.sentences.map((s) => ` ${s}`).join("\n")}` : ""}`
779
785
  );
780
786
  runHook(this.opts.cwd, "on-pulse-diff", { pct: pct.toFixed(1) });
781
- if (pct >= 0.5) this.push("image", pulsePath);
787
+ if (pct >= 0.5) this.push("image", diff.triptychPath ?? pulsePath);
782
788
  return pct;
783
789
  }
784
790
  /** Screenshot the running app (and watch its runtime where CDP is available). */
@@ -1129,7 +1135,7 @@ every ask now carries it; auto-fix presses to ${MAX_GOAL_FIX_ATTEMPTS} attempts
1129
1135
  this.push("error", "no Chrome/Chromium found");
1130
1136
  return;
1131
1137
  }
1132
- const { suggestFlows } = await import("./flows-G5K3XYQZ.js");
1138
+ const { suggestFlows } = await import("./flows-OY4BSCKD.js");
1133
1139
  this.push("status", "drafting flows from the live routes\u2026");
1134
1140
  const { created, skipped } = await suggestFlows(this.opts.cwd, this.state.devUrl, chrome);
1135
1141
  if (created.length > 0) this.push("status", `drafted ${created.length} flow(s): ${created.join(", ")} \u2014 edit .squint/flows/*.flow or ask the engine to deepen them`);
@@ -1139,7 +1145,7 @@ every ask now carries it; auto-fix presses to ${MAX_GOAL_FIX_ATTEMPTS} attempts
1139
1145
  break;
1140
1146
  }
1141
1147
  void (async () => {
1142
- const { loadFlows } = await import("./flows-G5K3XYQZ.js");
1148
+ const { loadFlows } = await import("./flows-OY4BSCKD.js");
1143
1149
  const flows = loadFlows(this.opts.cwd);
1144
1150
  if (flows.length === 0) {
1145
1151
  this.push("status", "no flows \u2014 add .squint/flows/<name>.flow (goto/click/fill/press/expect/shot lines), or ask the engine to write one");
@@ -1150,8 +1156,8 @@ every ask now carries it; auto-fix presses to ${MAX_GOAL_FIX_ATTEMPTS} attempts
1150
1156
  this.push("error", "no Chrome/Chromium found for flows");
1151
1157
  return;
1152
1158
  }
1153
- const { runFlow } = await import("./cdp-RFQCIQFP.js");
1154
- const { previewDir } = await import("./preview-WYFBPFFL.js");
1159
+ const { runFlow } = await import("./cdp-IGPGFMC6.js");
1160
+ const { previewDir } = await import("./preview-4OF6JB5B.js");
1155
1161
  this.push("status", `replaying ${flows.length} flow(s)\u2026`);
1156
1162
  this.notify({ running: true, runStartedAt: Date.now() });
1157
1163
  const failures = [];
@@ -179,7 +179,7 @@ var describe = (value) => {
179
179
  return String(value);
180
180
  };
181
181
  async function runFlow(chromePath, baseUrl, flow, outDir) {
182
- const { stepExpression } = await import("./flows-G5K3XYQZ.js");
182
+ const { stepExpression } = await import("./flows-OY4BSCKD.js");
183
183
  const { child, wsUrl, profileDir } = await launchChrome(chromePath);
184
184
  const shots = [];
185
185
  let connection = null;
@@ -238,7 +238,7 @@ async function runFlow(chromePath, baseUrl, flow, outDir) {
238
238
  setTimeout(() => fs.rmSync(profileDir, { recursive: true, force: true }), 500).unref?.();
239
239
  }
240
240
  }
241
- async function pixelDiffAttributed(chromePath, pngA, pngB, url) {
241
+ async function pixelDiffAttributed(chromePath, pngA, pngB, url, outPath) {
242
242
  const { child, wsUrl, profileDir } = await launchChrome(chromePath);
243
243
  let connection = null;
244
244
  try {
@@ -312,7 +312,35 @@ async function pixelDiffAttributed(chromePath, pngA, pngB, url) {
312
312
  }
313
313
  regions.sort((p, q) => q.cells - p.cells);
314
314
  const sizePenalty = (a.width !== b.width || a.height !== b.height) ? 1 : 0;
315
- return { pct: Math.min(100, (differ / total) * 100 + sizePenalty), regions: regions.slice(0, 5), w, h };
315
+ const pct = Math.min(100, (differ / total) * 100 + sizePenalty);
316
+ let triptych = null;
317
+ if (pct >= 0.5) {
318
+ // before | after | heatmap, half scale, labeled.
319
+ const panelW = Math.round(w / 2), panelH = Math.round(h / 2), gap = 6;
320
+ const c = document.createElement('canvas');
321
+ c.width = panelW * 3 + gap * 2; c.height = panelH + 22;
322
+ const ctx = c.getContext('2d');
323
+ ctx.fillStyle = '#111'; ctx.fillRect(0, 0, c.width, c.height);
324
+ ctx.drawImage(a, 0, 22, panelW, panelH);
325
+ ctx.drawImage(b, panelW + gap, 22, panelW, panelH);
326
+ ctx.globalAlpha = 0.3;
327
+ ctx.drawImage(b, (panelW + gap) * 2, 22, panelW, panelH);
328
+ ctx.globalAlpha = 1;
329
+ ctx.fillStyle = 'rgba(255,60,40,0.75)';
330
+ const sx = panelW / w, sy = panelH / h;
331
+ for (let cy = 0; cy < gh; cy++) {
332
+ for (let cx = 0; cx < gw; cx++) {
333
+ if (!marked[cy * gw + cx]) continue;
334
+ ctx.fillRect((panelW + gap) * 2 + cx * CELL * sx, 22 + cy * CELL * sy, CELL * sx, CELL * sy);
335
+ }
336
+ }
337
+ ctx.fillStyle = '#ddd'; ctx.font = '12px system-ui';
338
+ ctx.fillText('before', 2, 14);
339
+ ctx.fillText('after', panelW + gap + 2, 14);
340
+ ctx.fillText('changed ' + pct.toFixed(1) + '%', (panelW + gap) * 2 + 2, 14);
341
+ triptych = c.toDataURL('image/png');
342
+ }
343
+ return { pct, regions: regions.slice(0, 5), w, h, triptych };
316
344
  })()`;
317
345
  const { result } = await connection.send(
318
346
  "Runtime.evaluate",
@@ -321,7 +349,15 @@ async function pixelDiffAttributed(chromePath, pngA, pngB, url) {
321
349
  );
322
350
  const value = result?.value;
323
351
  if (!value || typeof value.pct !== "number") return null;
324
- if (!url || value.regions.length === 0 || value.pct < 0.5) return { pct: value.pct, sentences: [] };
352
+ let triptychPath;
353
+ if (value.triptych && outPath) {
354
+ try {
355
+ fs.writeFileSync(outPath, Buffer.from(value.triptych.split(",")[1] ?? "", "base64"));
356
+ triptychPath = outPath;
357
+ } catch {
358
+ }
359
+ }
360
+ if (!url || value.regions.length === 0 || value.pct < 0.5) return { pct: value.pct, sentences: [], triptychPath };
325
361
  let sentences = [];
326
362
  try {
327
363
  const page = await connection.send("Target.createTarget", { url: "about:blank" });
@@ -368,7 +404,7 @@ async function pixelDiffAttributed(chromePath, pngA, pngB, url) {
368
404
  if (Array.isArray(hit.result?.value)) sentences = hit.result.value.map(String);
369
405
  } catch {
370
406
  }
371
- return { pct: value.pct, sentences };
407
+ return { pct: value.pct, sentences, triptychPath };
372
408
  } catch {
373
409
  return null;
374
410
  } finally {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Session
4
- } from "./chunk-VCDZGQBB.js";
4
+ } from "./chunk-5MQOJYUC.js";
5
5
 
6
6
  // src/daemon/client.ts
7
7
  import net from "net";
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  cdpCapture,
7
7
  hasWebSocket
8
- } from "./chunk-P6D4RSWD.js";
8
+ } from "./chunk-N7YEWQGZ.js";
9
9
  import {
10
10
  findChrome,
11
11
  screenshot
@@ -164,14 +164,14 @@ async function probeRuntime(url, cwd) {
164
164
  async function comparePulse(previous, current) {
165
165
  const chrome = findChrome();
166
166
  if (!chrome || !hasWebSocket()) return null;
167
- const { pixelDiffPct } = await import("./cdp-RFQCIQFP.js");
167
+ const { pixelDiffPct } = await import("./cdp-IGPGFMC6.js");
168
168
  return pixelDiffPct(chrome, previous, current);
169
169
  }
170
- async function comparePulseAttributed(previous, current, url) {
170
+ async function comparePulseAttributed(previous, current, url, outPath) {
171
171
  const chrome = findChrome();
172
172
  if (!chrome || !hasWebSocket()) return null;
173
- const { pixelDiffAttributed } = await import("./cdp-RFQCIQFP.js");
174
- return pixelDiffAttributed(chrome, previous, current, url);
173
+ const { pixelDiffAttributed } = await import("./cdp-IGPGFMC6.js");
174
+ return pixelDiffAttributed(chrome, previous, current, url, outPath);
175
175
  }
176
176
  function buildRuntimeFixPrompt(report) {
177
177
  return `The running app has runtime problems.${runtimeSection(report)}
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-3GHZOVAA.js";
5
5
  import {
6
6
  Session
7
- } from "./chunk-VCDZGQBB.js";
7
+ } from "./chunk-5MQOJYUC.js";
8
8
 
9
9
  // src/tui/App.tsx
10
10
  import { Box as Box3, Static, Text as Text3, useApp, useInput } from "ink";
package/dist/cli.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  App
4
- } from "./chunk-2KJLEM53.js";
4
+ } from "./chunk-ZG3XQDUW.js";
5
5
  import "./chunk-3GHZOVAA.js";
6
6
  import {
7
7
  connectDaemon,
8
8
  socketPath,
9
9
  startDaemon
10
- } from "./chunk-BYT6OOGK.js";
11
- import "./chunk-VCDZGQBB.js";
10
+ } from "./chunk-SKNZ2PJF.js";
11
+ import "./chunk-5MQOJYUC.js";
12
12
  import "./chunk-UBADCBPT.js";
13
13
  import "./chunk-IEQGTVWN.js";
14
14
  import "./chunk-AUJJGMZG.js";
@@ -23,9 +23,9 @@ import {
23
23
  composePrompt
24
24
  } from "./chunk-WAJXATCO.js";
25
25
  import "./chunk-62JNF5M2.js";
26
- import "./chunk-7FAS2O3L.js";
26
+ import "./chunk-UMDV4ITQ.js";
27
27
  import "./chunk-7CAGWFAQ.js";
28
- import "./chunk-P6D4RSWD.js";
28
+ import "./chunk-N7YEWQGZ.js";
29
29
  import "./chunk-PZV2FJE5.js";
30
30
  import {
31
31
  detectEngines,
@@ -187,18 +187,18 @@ function registerDaemon(program2) {
187
187
  process.on("SIGTERM", stop);
188
188
  });
189
189
  program2.command("mcp").description("serve the gates as MCP tools over stdio (check, shot, flows, context)").action(async () => {
190
- const { runMcpServer } = await import("./server-BCHVAJJQ.js");
190
+ const { runMcpServer } = await import("./server-N2PGAV2C.js");
191
191
  runMcpServer(process.cwd());
192
192
  });
193
193
  program2.command("attach").description("attach this terminal to a running squint daemon (full TUI; --plain for line mode)").option("--plain", "line-mode attach instead of the full TUI").action(async (opts) => {
194
194
  const cwd = process.cwd();
195
195
  if (!opts.plain) {
196
196
  try {
197
- const { RemoteSession } = await import("./remote-WS6XGUBU.js");
197
+ const { RemoteSession } = await import("./remote-LOQ5WKAS.js");
198
198
  const remote = await RemoteSession.connect(cwd);
199
199
  const config = loadConfig(defaultPaths(cwd));
200
200
  const { render: render2 } = await import("ink");
201
- const { App: App2 } = await import("./App-HPUWFBRV.js");
201
+ const { App: App2 } = await import("./App-54M5DS3T.js");
202
202
  const React = await import("react");
203
203
  render2(
204
204
  React.createElement(App2, {
@@ -315,7 +315,7 @@ function registerEnv(program2) {
315
315
  }
316
316
  }
317
317
  const { findChrome } = await import("./chrome-CAN7TVH6.js");
318
- const { hasWebSocket } = await import("./cdp-RFQCIQFP.js");
318
+ const { hasWebSocket } = await import("./cdp-IGPGFMC6.js");
319
319
  const chrome = findChrome();
320
320
  console.log(
321
321
  chrome ? `${pc3.green("\u2713")} Chrome ${pc3.dim(chrome)}` : `${pc3.yellow("\u25CB")} Chrome ${pc3.dim("\u2014 screenshots and runtime probing disabled")}`
@@ -551,7 +551,7 @@ function registerQuality(program2) {
551
551
  report.gates = gateResults.map((r) => ({ id: r.gate.id, ok: r.ok, durationMs: r.durationMs, outputTail: r.ok ? void 0 : r.outputTail }));
552
552
  if (gateResults.some((r) => !r.ok)) failed = true;
553
553
  if (opts.url) {
554
- const { captureViewports, runtimeSummary, previewDir } = await import("./preview-WYFBPFFL.js");
554
+ const { captureViewports, runtimeSummary, previewDir } = await import("./preview-4OF6JB5B.js");
555
555
  const capture = await captureViewports(cwd, opts.url);
556
556
  if (!capture) {
557
557
  console.log(pc5.red("\u2717 audit: capture failed (Chrome missing or URL unreachable)"));
@@ -583,14 +583,14 @@ function registerQuality(program2) {
583
583
  console.log(`${pc5.green("\u2713")} audit ${pc5.dim(`(${advisories.a11y.length} a11y, ${advisories.slop.length} slop, ${advisories.jank.length} jank advisories)`)}`);
584
584
  }
585
585
  }
586
- const { loadFlows } = await import("./flows-G5K3XYQZ.js");
586
+ const { loadFlows } = await import("./flows-OY4BSCKD.js");
587
587
  const flows = loadFlows(cwd);
588
588
  if (flows.length > 0) {
589
589
  const { findChrome } = await import("./chrome-CAN7TVH6.js");
590
590
  const chrome = findChrome();
591
591
  const flowReport = [];
592
592
  if (chrome) {
593
- const { runFlow } = await import("./cdp-RFQCIQFP.js");
593
+ const { runFlow } = await import("./cdp-IGPGFMC6.js");
594
594
  for (const flow of flows) {
595
595
  const result = await runFlow(chrome, opts.url, flow, previewDir(cwd));
596
596
  flowReport.push({ name: flow.name, ok: result.ok, detail: result.ok ? void 0 : `step ${result.failedStep}: ${result.detail}` });
@@ -604,7 +604,7 @@ function registerQuality(program2) {
604
604
  report.ok = !failed;
605
605
  report.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
606
606
  try {
607
- const { writeReceipt } = await import("./receipts-INSRID6M.js");
607
+ const { writeReceipt } = await import("./receipts-JEOMBMFI.js");
608
608
  console.log(pc5.dim(`receipt \u2192 ${writeReceipt(cwd, report)}`));
609
609
  } catch {
610
610
  }
@@ -616,7 +616,7 @@ function registerQuality(program2) {
616
616
  if (failed) process.exitCode = 1;
617
617
  });
618
618
  program2.command("shot").description("Screenshot a running app at mobile/tablet/desktop viewports (+ .squint/routes)").argument("<url>", "URL of the running app (e.g. http://localhost:5173)").action(async (url) => {
619
- const { captureViewports } = await import("./preview-WYFBPFFL.js");
619
+ const { captureViewports } = await import("./preview-4OF6JB5B.js");
620
620
  const result = await captureViewports(process.cwd(), url);
621
621
  if (!result) {
622
622
  console.error(pc5.red("\u2717 no Chrome/Chromium found"));
@@ -803,7 +803,7 @@ function registerTui(program2) {
803
803
  }
804
804
 
805
805
  // src/cli.tsx
806
- var VERSION = true ? "0.6.0" : "0.0.0-dev";
806
+ var VERSION = true ? "0.6.1" : "0.0.0-dev";
807
807
  var program = new Command();
808
808
  program.name("squint").description("Lovable for your terminal \u2014 a frontend harness on top of Claude Code, Codex, and friends.").version(VERSION);
809
809
  registerRun(program);
@@ -4,7 +4,7 @@ import {
4
4
  parseFlow,
5
5
  stepExpression,
6
6
  suggestFlows
7
- } from "./chunk-K7JNVCCU.js";
7
+ } from "./chunk-3XO3GF5X.js";
8
8
  export {
9
9
  loadFlows,
10
10
  parseFlow,
@@ -11,9 +11,9 @@ import {
11
11
  probeRuntime,
12
12
  routeShotName,
13
13
  runtimeSummary
14
- } from "./chunk-7FAS2O3L.js";
14
+ } from "./chunk-UMDV4ITQ.js";
15
15
  import "./chunk-7CAGWFAQ.js";
16
- import "./chunk-P6D4RSWD.js";
16
+ import "./chunk-N7YEWQGZ.js";
17
17
  import "./chunk-PZV2FJE5.js";
18
18
  import "./chunk-DABIMOMV.js";
19
19
  export {
@@ -31,7 +31,7 @@ function buildReceipt(cwd, report) {
31
31
  }
32
32
  }
33
33
  const unsigned = {
34
- version: true ? "0.6.0" : "0.0.0-dev",
34
+ version: true ? "0.6.1" : "0.0.0-dev",
35
35
  node: process.version,
36
36
  gitHead,
37
37
  report,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  connectDaemon,
4
4
  socketPath
5
- } from "./chunk-BYT6OOGK.js";
6
- import "./chunk-VCDZGQBB.js";
5
+ } from "./chunk-SKNZ2PJF.js";
6
+ import "./chunk-5MQOJYUC.js";
7
7
  import "./chunk-UBADCBPT.js";
8
8
  import "./chunk-IEQGTVWN.js";
9
9
  import "./chunk-AUJJGMZG.js";
@@ -14,9 +14,9 @@ import "./chunk-DOWWBLX2.js";
14
14
  import "./chunk-K5QJMSJH.js";
15
15
  import "./chunk-WAJXATCO.js";
16
16
  import "./chunk-62JNF5M2.js";
17
- import "./chunk-7FAS2O3L.js";
17
+ import "./chunk-UMDV4ITQ.js";
18
18
  import "./chunk-7CAGWFAQ.js";
19
- import "./chunk-P6D4RSWD.js";
19
+ import "./chunk-N7YEWQGZ.js";
20
20
  import "./chunk-PZV2FJE5.js";
21
21
  import "./chunk-DABIMOMV.js";
22
22
 
@@ -12,14 +12,14 @@ import {
12
12
  } from "./chunk-62JNF5M2.js";
13
13
  import {
14
14
  loadFlows
15
- } from "./chunk-K7JNVCCU.js";
15
+ } from "./chunk-3XO3GF5X.js";
16
16
  import {
17
17
  captureViewports,
18
18
  previewDir,
19
19
  runtimeSummary
20
- } from "./chunk-7FAS2O3L.js";
20
+ } from "./chunk-UMDV4ITQ.js";
21
21
  import "./chunk-7CAGWFAQ.js";
22
- import "./chunk-P6D4RSWD.js";
22
+ import "./chunk-N7YEWQGZ.js";
23
23
  import {
24
24
  findChrome
25
25
  } from "./chunk-PZV2FJE5.js";
@@ -75,7 +75,7 @@ ${list.join("\n")}`);
75
75
  if (flows.length === 0) return "no flows declared \u2014 add .squint/flows/<name>.flow";
76
76
  const chrome = findChrome();
77
77
  if (!chrome) return "no Chrome/Chromium found";
78
- const { runFlow } = await import("./cdp-RFQCIQFP.js");
78
+ const { runFlow } = await import("./cdp-IGPGFMC6.js");
79
79
  const lines = [];
80
80
  for (const flow of flows) {
81
81
  const result = await runFlow(chrome, url, flow, previewDir(cwd));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aayambansal/squint",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Lovable for your terminal \u2014 a frontend harness on top of Claude Code, Codex, and other coding agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",