@outerlayer/cli 0.36.0-next.20261031231928 → 0.36.0-next.20261101022001

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 +1 @@
1
- {"id":"2026-10-31T23:21:34.649Z+b5d4159","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
1
+ {"id":"2026-11-01T02:22:18.298Z+44175da","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
package/dist/recorder.cjs CHANGED
@@ -49,6 +49,15 @@ async function recordChecksDuring(checks, body, onPass) {
49
49
  await Promise.allSettled(store.pending);
50
50
  }
51
51
  }
52
+ var beat = new async_hooks.AsyncLocalStorage();
53
+ function pointAtChecksDuring(onChecked, body) {
54
+ return beat.run({ onChecked }, async () => await body());
55
+ }
56
+ var NOT_POINTED = /* @__PURE__ */ new Set(["toHaveScreenshot", "toMatchAriaSnapshot"]);
57
+ function isLocator(value) {
58
+ const candidate = value;
59
+ return typeof candidate?.boundingBox === "function" && typeof candidate.page === "function" && typeof candidate.count === "function";
60
+ }
52
61
  var RECORDED = /* @__PURE__ */ Symbol.for("outerlayer.playwright.recorded");
53
62
  function describeValue(value) {
54
63
  if (value === null || value === void 0 || typeof value !== "object") return JSON.stringify(value) ?? String(value);
@@ -94,7 +103,7 @@ function wrapMatchers(matchers, context) {
94
103
  return (...args) => {
95
104
  const text = `${context.subject}.${context.modifiers}${property}(${describeArgs(args)})`;
96
105
  const errorsBefore = context.soft ? test$1.test.info().errors.length : 0;
97
- const settle = (error, hasError) => {
106
+ const settle2 = (error, hasError) => {
98
107
  const softFailure = context.soft && test$1.test.info().errors.length > errorsBefore;
99
108
  const after = record({ text, passed: !hasError && !softFailure });
100
109
  if (hasError) throw failed(error);
@@ -104,20 +113,25 @@ function wrapMatchers(matchers, context) {
104
113
  try {
105
114
  result = value.apply(target, args);
106
115
  } catch (error) {
107
- settle(error, true);
116
+ settle2(error, true);
108
117
  }
109
118
  if (isThenable(result)) {
110
119
  return result.then(
111
120
  async (resolved) => {
112
- await settle(void 0, false);
121
+ await settle2(void 0, false);
122
+ const pointing = beat.getStore();
123
+ const softFailure = context.soft && test$1.test.info().errors.length > errorsBefore;
124
+ if (pointing !== void 0 && !softFailure && context.modifiers === "" && !NOT_POINTED.has(property) && isLocator(context.received)) {
125
+ await pointing.onChecked(context.received).catch(() => void 0);
126
+ }
113
127
  return resolved;
114
128
  },
115
129
  (error) => {
116
- settle(error, true);
130
+ settle2(error, true);
117
131
  }
118
132
  );
119
133
  }
120
- settle(void 0, false);
134
+ settle2(void 0, false);
121
135
  return result;
122
136
  };
123
137
  }
@@ -126,7 +140,7 @@ function wrapMatchers(matchers, context) {
126
140
  function wrapEntry(entry, thisArg, args, soft, label) {
127
141
  const matchers = Reflect.apply(entry, thisArg, args);
128
142
  const [received] = args;
129
- return wrapMatchers(matchers, { subject: `expect${label}(${describeValue(received)})`, modifiers: "", soft });
143
+ return wrapMatchers(matchers, { subject: `expect${label}(${describeValue(received)})`, received, modifiers: "", soft });
130
144
  }
131
145
  var expect = new Proxy(test$1.expect, {
132
146
  apply(target, thisArg, args) {
@@ -275,7 +289,7 @@ async function bringIntoView(locator) {
275
289
  }
276
290
  }
277
291
  var TEXT_INPUT_TYPES = /* @__PURE__ */ new Set(["", "text", "search", "email", "url", "tel", "password", "number"]);
278
- function actLikeAPerson(page, hand) {
292
+ function actLikeAPerson(page, hand, beforeApproach) {
279
293
  const prototype = Object.getPrototypeOf(page.locator("html"));
280
294
  const original = {
281
295
  click: prototype.click,
@@ -289,6 +303,7 @@ function actLikeAPerson(page, hand) {
289
303
  };
290
304
  const approach = async (locator, position) => {
291
305
  await locator.waitFor({ state: "visible", timeout: STEP_TIMEOUT }).catch(() => void 0);
306
+ await beforeApproach?.(locator);
292
307
  await bringIntoView(locator);
293
308
  await hand.pointAt(locator, position);
294
309
  await sleep(130);
@@ -427,52 +442,136 @@ function takeStill(page, params) {
427
442
 
428
443
  // ../playwright/src/highlight.ts
429
444
  var HIGHLIGHT_ATTRIBUTE = "data-outerlayer-highlight";
430
- async function showHighlight(locator) {
431
- await locator.evaluate(
432
- (element, attribute) => {
433
- const box = document.createElement("div");
434
- box.setAttribute(attribute, "");
435
- box.style.cssText = "position:fixed;pointer-events:none;z-index:2147483630;border-radius:10px;opacity:0;box-shadow:0 0 0 3px rgba(59,130,246,.95),0 0 0 9999px rgba(15,23,42,.42);";
436
- document.documentElement.appendChild(box);
437
- const place = () => {
438
- if (!box.isConnected) return;
445
+ var CHECK_TIMEOUT = 2e3;
446
+ var LARGEST_SHARE = 0.5;
447
+ function ring(element, params) {
448
+ const { attribute, join: join4, share } = params;
449
+ const unite = (elements) => {
450
+ let left = Infinity;
451
+ let top = Infinity;
452
+ let right = -Infinity;
453
+ let bottom = -Infinity;
454
+ for (const target of elements) {
455
+ if (!target.isConnected) continue;
456
+ const rect = target.getBoundingClientRect();
457
+ if (rect.width === 0 && rect.height === 0) continue;
458
+ left = Math.min(left, rect.left);
459
+ top = Math.min(top, rect.top);
460
+ right = Math.max(right, rect.right);
461
+ bottom = Math.max(bottom, rect.bottom);
462
+ }
463
+ return left === Infinity ? void 0 : { left, top, width: right - left, height: bottom - top };
464
+ };
465
+ const tooLarge = (box2) => box2.width * box2.height > window.innerWidth * window.innerHeight * share || box2.height > window.innerHeight * 0.8;
466
+ const current = Array.from(document.querySelectorAll(`[${attribute}]`)).find((box2) => box2.dataset.leaving === void 0);
467
+ const targets = current?.outerlayerTargets ?? [];
468
+ if (current !== void 0 && targets.some((target) => target === element || target.contains(element))) return "same";
469
+ if (join4 && current !== void 0) {
470
+ const kept = targets.filter((target) => !element.contains(target));
471
+ const united = unite([...kept, element]);
472
+ if (united !== void 0 && !tooLarge(united)) {
473
+ current.outerlayerTargets = [...kept, element];
474
+ return "grown";
475
+ }
476
+ }
477
+ const alone = unite([element]);
478
+ if (alone === void 0 || tooLarge(alone)) return "none";
479
+ for (const old of Array.from(document.querySelectorAll(`[${attribute}]`))) {
480
+ old.dataset.leaving = "";
481
+ const began2 = performance.now();
482
+ const hide = (now) => {
483
+ const p = Math.min(1, (now - began2) / 220);
484
+ old.style.opacity = String(1 - p);
485
+ if (p < 1) requestAnimationFrame(hide);
486
+ else old.remove();
487
+ };
488
+ requestAnimationFrame(hide);
489
+ }
490
+ const box = document.createElement("div");
491
+ box.outerlayerTargets = [element];
492
+ box.setAttribute(attribute, "");
493
+ box.style.cssText = "position:fixed;pointer-events:none;z-index:2147483630;border-radius:10px;opacity:0;box-shadow:0 0 0 3px rgba(59,130,246,.95),0 0 0 9999px rgba(15,23,42,.42);";
494
+ document.documentElement.appendChild(box);
495
+ let shown;
496
+ const place = () => {
497
+ if (!box.isConnected) return;
498
+ const target = unite(box.outerlayerTargets ?? []);
499
+ if (target !== void 0) {
500
+ const step = (from, to) => Math.abs(to - from) < 0.5 ? to : from + (to - from) * 0.3;
501
+ shown = shown === void 0 ? target : { left: step(shown.left, target.left), top: step(shown.top, target.top), width: step(shown.width, target.width), height: step(shown.height, target.height) };
502
+ box.style.left = `${shown.left - 8}px`;
503
+ box.style.top = `${shown.top - 6}px`;
504
+ box.style.width = `${shown.width + 16}px`;
505
+ box.style.height = `${shown.height + 12}px`;
506
+ }
507
+ requestAnimationFrame(place);
508
+ };
509
+ place();
510
+ const began = performance.now();
511
+ const show = (now) => {
512
+ const p = Math.min(1, (now - began) / 260);
513
+ box.style.opacity = String(p);
514
+ if (p < 1) requestAnimationFrame(show);
515
+ };
516
+ requestAnimationFrame(show);
517
+ return "new";
518
+ }
519
+ async function settle(page, change) {
520
+ if (change === "new" || change === "grown") await page.waitForTimeout(300);
521
+ }
522
+ async function showHighlight(locator, timeout = 1e4) {
523
+ const change = await locator.evaluate(ring, { attribute: HIGHLIGHT_ATTRIBUTE, join: false, share: Number.POSITIVE_INFINITY }, { timeout });
524
+ await settle(locator.page(), change);
525
+ return change !== "same" && change !== "none";
526
+ }
527
+ async function highlightCheckedElement(locator) {
528
+ try {
529
+ if (await locator.count() !== 1) return false;
530
+ const pointable = await locator.evaluate(
531
+ (element) => {
532
+ for (let node = element; node !== null; node = node.parentElement) {
533
+ if (node.getAttributeNames().some((name) => name.startsWith("data-outerlayer-"))) return false;
534
+ }
439
535
  const rect = element.getBoundingClientRect();
440
- box.style.left = `${rect.left - 8}px`;
441
- box.style.top = `${rect.top - 6}px`;
442
- box.style.width = `${rect.width + 16}px`;
443
- box.style.height = `${rect.height + 12}px`;
444
- requestAnimationFrame(place);
445
- };
446
- place();
536
+ return rect.width > 0 && rect.height > 0;
537
+ },
538
+ void 0,
539
+ { timeout: CHECK_TIMEOUT }
540
+ );
541
+ if (!pointable) return false;
542
+ await bringIntoView(locator);
543
+ const change = await locator.evaluate(ring, { attribute: HIGHLIGHT_ATTRIBUTE, join: true, share: LARGEST_SHARE }, { timeout: CHECK_TIMEOUT });
544
+ await settle(locator.page(), change);
545
+ return change === "new" || change === "grown";
546
+ } catch {
547
+ return false;
548
+ }
549
+ }
550
+ async function clearHighlights(page, keep) {
551
+ let handle = null;
552
+ if (keep !== void 0) handle = await keep.elementHandle({ timeout: CHECK_TIMEOUT }).catch(() => null);
553
+ await page.evaluate(
554
+ async ({ attribute, kept }) => {
555
+ const boxes = Array.from(document.querySelectorAll(`[${attribute}]`)).filter(
556
+ (box) => !(kept instanceof Element && (box.outerlayerTargets ?? []).some((target) => target.contains(kept)))
557
+ );
558
+ if (boxes.length === 0) return;
559
+ for (const box of boxes) box.dataset.leaving = "";
447
560
  const began = performance.now();
448
- const show = (now) => {
449
- const p = Math.min(1, (now - began) / 260);
450
- box.style.opacity = String(p);
451
- if (p < 1) requestAnimationFrame(show);
452
- };
453
- requestAnimationFrame(show);
561
+ await new Promise((resolve) => {
562
+ const hide = (now) => {
563
+ const p = Math.min(1, (now - began) / 220);
564
+ for (const box of boxes) box.style.opacity = String(1 - p);
565
+ if (p < 1) requestAnimationFrame(hide);
566
+ else resolve();
567
+ };
568
+ requestAnimationFrame(hide);
569
+ });
570
+ for (const box of boxes) box.remove();
454
571
  },
455
- HIGHLIGHT_ATTRIBUTE,
456
- { timeout: 1e4 }
457
- );
458
- await locator.page().waitForTimeout(300);
459
- }
460
- async function clearHighlights(page) {
461
- await page.evaluate(async (attribute) => {
462
- const boxes = Array.from(document.querySelectorAll(`[${attribute}]`));
463
- if (boxes.length === 0) return;
464
- const began = performance.now();
465
- await new Promise((resolve) => {
466
- const hide = (now) => {
467
- const p = Math.min(1, (now - began) / 220);
468
- for (const box of boxes) box.style.opacity = String(1 - p);
469
- if (p < 1) requestAnimationFrame(hide);
470
- else resolve();
471
- };
472
- requestAnimationFrame(hide);
473
- });
474
- for (const box of boxes) box.remove();
475
- }, HIGHLIGHT_ATTRIBUTE).catch(() => void 0);
572
+ { attribute: HIGHLIGHT_ATTRIBUTE, kept: handle }
573
+ ).catch(() => void 0);
574
+ await handle?.dispose().catch(() => void 0);
476
575
  }
477
576
 
478
577
  // ../playwright/src/panel.ts
@@ -722,6 +821,7 @@ var pad = (n) => String(n).padStart(2, "0");
722
821
  var DEMO_FOLDER = "demo";
723
822
  var BEAT_LEAD_IN = 0.15;
724
823
  var BEAT_TAIL = 0.45;
824
+ var HIGHLIGHT_HOLD = 1200;
725
825
  var test = test$1.test.extend({
726
826
  // The settings that vary between runs. A config's `use` or a test's `test.use` replaces any of them.
727
827
  viewport: [FIXED_SETTINGS.viewport, { option: true }],
@@ -775,6 +875,7 @@ var test = test$1.test.extend({
775
875
  return hand;
776
876
  };
777
877
  let panelOpen = false;
878
+ let pointing;
778
879
  const demo = {
779
880
  async say(narration, steps) {
780
881
  const chapter = running2;
@@ -788,13 +889,22 @@ var test = test$1.test.extend({
788
889
  panelOpen = false;
789
890
  await closePanels(page);
790
891
  }
791
- const restore = actLikeAPerson(page, person);
892
+ const current = { chosen: false, shownAt: Number.NEGATIVE_INFINITY };
893
+ pointing = current;
894
+ const restore = actLikeAPerson(page, person, (target) => clearHighlights(page, target));
792
895
  try {
793
- if (steps !== void 0) await steps();
896
+ if (steps !== void 0) {
897
+ await pointAtChecksDuring(async (checked) => {
898
+ if (current.chosen) return;
899
+ if (await highlightCheckedElement(checked)) current.shownAt = performance.now();
900
+ }, steps);
901
+ }
794
902
  } finally {
795
903
  restore();
904
+ pointing = void 0;
796
905
  }
797
- const due = startedAtMs + (spoken.seconds === 0 ? 0 : (BEAT_LEAD_IN + spoken.seconds + BEAT_TAIL) * 1e3);
906
+ const spokenDue = startedAtMs + (spoken.seconds === 0 ? 0 : (BEAT_LEAD_IN + spoken.seconds + BEAT_TAIL) * 1e3);
907
+ const due = Math.max(spokenDue, current.shownAt + HIGHLIGHT_HOLD);
798
908
  const wait = due - performance.now();
799
909
  if (wait > 0) await page.waitForTimeout(wait);
800
910
  const end = Math.max(seconds(performance.now() - startedAt), start + 1e-3);
@@ -820,7 +930,8 @@ var test = test$1.test.extend({
820
930
  return response;
821
931
  },
822
932
  async highlight(locator) {
823
- await showHighlight(locator);
933
+ if (pointing !== void 0) pointing.chosen = true;
934
+ if (await showHighlight(locator) && pointing !== void 0) pointing.shownAt = performance.now();
824
935
  },
825
936
  async screenshot(screenshotOptions = {}) {
826
937
  const chapter = running2;
@@ -870,7 +981,7 @@ var test = test$1.test.extend({
870
981
  end,
871
982
  title,
872
983
  // A chapter told in beats lists its lines in the narration, for a reader of the record.
873
- narration: told ? beats.map((beat) => beat.narration).join(" ").slice(0, 2e3) : narration,
984
+ narration: told ? beats.map((beat2) => beat2.narration).join(" ").slice(0, 2e3) : narration,
874
985
  checks,
875
986
  stills: stills.sort((a, b) => a.check - b.check),
876
987
  ...current.screenshot === void 0 ? {} : { screenshot: current.screenshot },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outerlayer/cli",
3
- "version": "0.36.0-next.20261031231928",
3
+ "version": "0.36.0-next.20261101022001",
4
4
  "description": "OuterLayer CLI — commands: init, claude, connect, doctor, login, logout, sync, daemon (alias: watch), emit, demo, findings, work, spec, runner, hooks, mcp, context. Capture and sync coding-agent sessions, and record proof of factory work.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Magu Studios, Inc.",
@@ -294,8 +294,10 @@ tests at HEAD that hold the id of each proof that is not current, and runs them.
294
294
  video criterion in the criteria's order, as the outerlayer-evidence skill's
295
295
  "Record a demo" says. Tell each chapter in beats with `demo.say()`: sign in
296
296
  once, and seed and wait between beats, so the demo shows only narrated
297
- steps. Render it with `outerlayer emit demo <manifest> --output demo.webm`
298
- and watch it before you commit the test. The fixture writes the manifest
297
+ steps. In each beat, check with `expect(locator)` the element its line
298
+ names, so the recorder rings it. Render it with `outerlayer emit demo
299
+ <manifest> --output demo.webm` and watch it before you commit the test:
300
+ each beat rings what its line names. The fixture writes the manifest
299
301
  where `OUTERLAYER_PROOF_OUT` names.
300
302
  - A report, log or file proof is a test, in any language, that writes
301
303
  `$OUTERLAYER_PROOF_OUT/<criterion id>.<ext>`. The kind of the file must be the
@@ -84,8 +84,11 @@ only when Playwright cannot drive the flow.
84
84
 
85
85
  A demo plays like a person showing the app. Tell each chapter in beats with
86
86
  `demo.say(line, steps)`: the line is spoken while its steps run on screen.
87
- The demo shows only beats, so sign in, seed data and wait outside them. Show
88
- a CLI step with `demo.terminal()`. The recorder ships inside the CLI, so
87
+ The demo shows only beats, so sign in, seed data and wait outside them. In
88
+ each beat, check with `expect(locator)` the element its line names: the
89
+ recorder dims the page around each element a beat checks and rings it, so
90
+ the viewer sees what the line talks about. Show a CLI step with
91
+ `demo.terminal()`. The recorder ships inside the CLI, so
89
92
  install nothing. The script, and the rules a reviewer holds it to, are in
90
93
  [references/demo.md](references/demo.md).
91
94
 
@@ -95,7 +98,9 @@ chapter ids. Record it, then emit the demo:
95
98
  outerlayer demo record e2e/<name>.demo.ts --config <playwright config> --project <name>
96
99
  outerlayer emit demo <the manifest it prints>
97
100
 
98
- Pass `--output demo.webm` first and watch the demo. The command shows only
101
+ Pass `--output demo.webm` first and watch the demo. Each beat rings what its
102
+ line names. Where a ring is missing or marks the wrong part, check the
103
+ element the line names in that beat. The command shows only
99
104
  the beats and cuts each stretch in which the screen does not move and nothing
100
105
  is said. It refuses a demo that still holds one over 2 s, a chapter id that is
101
106
  not recorded, or a line too long for its beat. A chapter whose checks all
@@ -31,7 +31,10 @@ it against the app as it is now, not from an older demo. Import `test` and
31
31
  });
32
32
 
33
33
  Each beat lasts as long as its line. Inside a beat a pointer moves to each
34
- click, `fill` types its text, and the page scrolls smoothly.
34
+ click, `fill` types its text, and the page scrolls smoothly. Each `expect` on
35
+ a locator dims the page around the element it checks and rings it, so the
36
+ viewer sees what the line talks about. A second check in the beat widens the
37
+ ring to take in both elements.
35
38
 
36
39
  Record it with `outerlayer demo record <script>`. In a repository with its
37
40
  own Playwright config, add `--config <file>` and `--project <name>` to reuse
@@ -62,9 +65,18 @@ prints the manifest's path.
62
65
  - Show a call to an API with `await demo.http({ method, url, body }, run)`
63
66
  when a criterion's proof is an API response, or a step goes through the
64
67
  API and no page shows it. Return the real `{ status, body }` from `run`.
65
- - Point to the one element a line talks about on a busy page with
66
- `await demo.highlight(locator)`, such as a status in a long list. Highlight
67
- at most one element in a beat, and none where the element is plain to see.
68
+ - In each beat, check with `expect(locator)` each element its line names,
69
+ such as the new status in a list. The ring covers every element the beat
70
+ checks. A check of a computed value, such as a style read with
71
+ `evaluate`, rings nothing, so check the element itself too. A locator that
72
+ matches several elements, a negated check, and an element that fills most
73
+ of the screen ring nothing. When the box around all the checked elements
74
+ would fill most of the screen, the ring starts again on the latest one.
75
+ The pointer moving to an element outside the ring clears it.
76
+ - Call `await demo.highlight(locator)` to ring an element no check looks at.
77
+ After it, checks in that beat leave the ring in place.
78
+ - Write the script against the guidance here, not by copying an older demo:
79
+ an older demo can break a rule that came later.
68
80
  - Turn off `demoOptions.animations` to keep the app's own transitions. Each
69
81
  still and screenshot stops motion either way.
70
82
 
@@ -72,5 +84,6 @@ prints the manifest's path.
72
84
 
73
85
  Render the demo with `outerlayer emit demo <manifest> --output demo.webm`
74
86
  and watch it. Fix a beat that shows a loading screen, a sign-in or a step
87
+ its line does not name. Fix a beat whose ring is missing, or marks a part
75
88
  its line does not name. The command exits 1 while the demo holds a frozen,
76
89
  silent stretch over 2 s.