vouchington-tooling 0.52.1 → 0.54.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.
Files changed (199) hide show
  1. package/README.md +103 -12
  2. package/dist/agent-blackboard/index.d.mts +0 -1
  3. package/dist/agent-blackboard/index.mjs +0 -23
  4. package/dist/cli/commands/agent-blackboard-flags.d.mts +0 -1
  5. package/dist/cli/commands/agent-blackboard-flags.mjs +0 -9
  6. package/dist/cli/commands/agent-blackboard.d.mts +0 -2
  7. package/dist/cli/commands/agent-blackboard.mjs +7 -121
  8. package/dist/cli/commands/story-coverage.d.mts +2 -0
  9. package/dist/cli/commands/story-coverage.mjs +56 -0
  10. package/dist/cli/commands/worktree.d.mts +2 -0
  11. package/dist/cli/commands/worktree.mjs +21 -0
  12. package/dist/cli/index.mjs +9 -0
  13. package/dist/cli/parse-forwarded-commands.d.mts +6 -0
  14. package/dist/cli/parse-forwarded-commands.mjs +4 -0
  15. package/dist/cli/parse-story-coverage-fields.d.mts +19 -0
  16. package/dist/cli/parse-story-coverage-fields.mjs +69 -0
  17. package/dist/cli/parse-story-coverage.d.mts +8 -0
  18. package/dist/cli/parse-story-coverage.mjs +34 -0
  19. package/dist/cli/parse.d.mts +8 -1
  20. package/dist/cli/parse.mjs +3 -0
  21. package/dist/cli/usage.d.mts +1 -1
  22. package/dist/cli/usage.mjs +14 -7
  23. package/dist/git-worktrees/assess.d.mts +14 -0
  24. package/dist/git-worktrees/assess.mjs +68 -0
  25. package/dist/git-worktrees/list.d.mts +10 -0
  26. package/dist/git-worktrees/list.mjs +34 -0
  27. package/dist/git-worktrees/reclaim.d.mts +15 -0
  28. package/dist/git-worktrees/reclaim.mjs +80 -0
  29. package/dist/git-worktrees/reclaim.test-helpers.d.mts +16 -0
  30. package/dist/git-worktrees/reclaim.test-helpers.mjs +113 -0
  31. package/dist/git-worktrees/run.d.mts +13 -0
  32. package/dist/git-worktrees/run.mjs +50 -0
  33. package/dist/host-storage/check.d.mts +38 -0
  34. package/dist/host-storage/check.mjs +109 -0
  35. package/dist/host-storage/cli.d.mts +7 -0
  36. package/dist/host-storage/cli.mjs +102 -0
  37. package/dist/host-storage/host-storage.test-helpers.d.mts +26 -0
  38. package/dist/host-storage/host-storage.test-helpers.mjs +58 -0
  39. package/dist/host-storage/index.d.mts +3 -0
  40. package/dist/host-storage/index.mjs +3 -0
  41. package/dist/host-storage/preflight.d.mts +22 -0
  42. package/dist/host-storage/preflight.mjs +105 -0
  43. package/dist/index.d.mts +2 -0
  44. package/dist/index.mjs +1 -0
  45. package/dist/playwright/assertions.d.mts +1 -0
  46. package/dist/playwright/assertions.mjs +5 -0
  47. package/dist/playwright/blocked-external-network.d.mts +15 -0
  48. package/dist/playwright/blocked-external-network.mjs +73 -0
  49. package/dist/playwright/browser-dialog-issues.d.mts +12 -0
  50. package/dist/playwright/browser-dialog-issues.mjs +29 -0
  51. package/dist/playwright/browser-errors.d.mts +22 -0
  52. package/dist/playwright/browser-errors.mjs +130 -0
  53. package/dist/playwright/browser-issue-monitor.test-helpers.d.mts +31 -0
  54. package/dist/playwright/browser-issue-monitor.test-helpers.mjs +51 -0
  55. package/dist/playwright/browser-issue-records.d.mts +42 -0
  56. package/dist/playwright/browser-issue-records.mjs +148 -0
  57. package/dist/playwright/browser-test.d.mts +21 -0
  58. package/dist/playwright/browser-test.mjs +68 -0
  59. package/dist/playwright/expect-no-broken-images.d.mts +17 -0
  60. package/dist/playwright/expect-no-broken-images.mjs +39 -0
  61. package/dist/playwright/index.d.mts +30 -0
  62. package/dist/playwright/index.mjs +22 -0
  63. package/dist/playwright/mobile-assertions.d.mts +14 -0
  64. package/dist/playwright/mobile-assertions.mjs +43 -0
  65. package/dist/playwright/navigate-to.d.mts +27 -0
  66. package/dist/playwright/navigate-to.mjs +39 -0
  67. package/dist/playwright/radix-select.d.mts +18 -0
  68. package/dist/playwright/radix-select.mjs +19 -0
  69. package/dist/playwright/random-id.d.mts +34 -0
  70. package/dist/playwright/random-id.mjs +37 -0
  71. package/dist/playwright/retry-on-connection-lost.d.mts +7 -0
  72. package/dist/playwright/retry-on-connection-lost.mjs +107 -0
  73. package/dist/playwright/scroll-to-load-more.d.mts +37 -0
  74. package/dist/playwright/scroll-to-load-more.mjs +158 -0
  75. package/dist/playwright/storybook.d.mts +2 -0
  76. package/dist/playwright/storybook.mjs +13 -0
  77. package/dist/playwright/test-fixtures.d.mts +1 -0
  78. package/dist/playwright/test-fixtures.mjs +2 -0
  79. package/dist/playwright/test-lifecycle-reporter.d.mts +11 -0
  80. package/dist/playwright/test-lifecycle-reporter.mjs +35 -0
  81. package/dist/playwright/totp.d.mts +6 -0
  82. package/dist/playwright/totp.mjs +37 -0
  83. package/dist/playwright/turnstile-stub.d.mts +8 -0
  84. package/dist/playwright/turnstile-stub.mjs +61 -0
  85. package/dist/playwright/viewport-constants.d.mts +30 -0
  86. package/dist/playwright/viewport-constants.mjs +9 -0
  87. package/dist/playwright/virtual-authenticator.d.mts +5 -0
  88. package/dist/playwright/virtual-authenticator.mjs +15 -0
  89. package/dist/playwright/wait-for-hydration.d.mts +29 -0
  90. package/dist/playwright/wait-for-hydration.mjs +81 -0
  91. package/dist/shell-parse/ansi-c-string.d.mts +12 -0
  92. package/dist/shell-parse/ansi-c-string.mjs +80 -0
  93. package/dist/shell-parse/index.d.mts +20 -0
  94. package/dist/shell-parse/index.mjs +15 -0
  95. package/dist/shell-parse/shell-command-substitution-reads.d.mts +8 -0
  96. package/dist/shell-parse/shell-command-substitution-reads.mjs +53 -0
  97. package/dist/shell-parse/shell-command-substitutions.d.mts +8 -0
  98. package/dist/shell-parse/shell-command-substitutions.mjs +52 -0
  99. package/dist/shell-parse/shell-command-wrappers.d.mts +26 -0
  100. package/dist/shell-parse/shell-command-wrappers.mjs +143 -0
  101. package/dist/shell-parse/shell-commands.d.mts +24 -0
  102. package/dist/shell-parse/shell-commands.mjs +155 -0
  103. package/dist/shell-parse/shell-heredoc-delimiter.d.mts +5 -0
  104. package/dist/shell-parse/shell-heredoc-delimiter.mjs +52 -0
  105. package/dist/shell-parse/shell-heredoc-parser.d.mts +7 -0
  106. package/dist/shell-parse/shell-heredoc-parser.mjs +49 -0
  107. package/dist/shell-parse/shell-heredoc-quote-state.d.mts +19 -0
  108. package/dist/shell-parse/shell-heredoc-quote-state.mjs +40 -0
  109. package/dist/shell-parse/shell-heredoc.d.mts +10 -0
  110. package/dist/shell-parse/shell-heredoc.mjs +90 -0
  111. package/dist/shell-parse/shell-redirections.d.mts +5 -0
  112. package/dist/shell-parse/shell-redirections.mjs +34 -0
  113. package/dist/shell-parse/shell-script-operand.d.mts +13 -0
  114. package/dist/shell-parse/shell-script-operand.mjs +103 -0
  115. package/dist/shell-parse/shell-stdin-script.d.mts +6 -0
  116. package/dist/shell-parse/shell-stdin-script.mjs +61 -0
  117. package/dist/shell-parse/shell-token-utils.d.mts +9 -0
  118. package/dist/shell-parse/shell-token-utils.mjs +33 -0
  119. package/dist/shell-parse/shell-tokenizer-comments.d.mts +1 -0
  120. package/dist/shell-parse/shell-tokenizer-comments.mjs +57 -0
  121. package/dist/shell-parse/shell-tokenizer-operators.d.mts +14 -0
  122. package/dist/shell-parse/shell-tokenizer-operators.mjs +47 -0
  123. package/dist/shell-parse/shell-tokenizer.d.mts +12 -0
  124. package/dist/shell-parse/shell-tokenizer.mjs +104 -0
  125. package/dist/story-coverage/analyze.d.mts +8 -0
  126. package/dist/story-coverage/analyze.mjs +24 -0
  127. package/dist/story-coverage/check.d.mts +11 -0
  128. package/dist/story-coverage/check.mjs +42 -0
  129. package/dist/story-coverage/components.d.mts +10 -0
  130. package/dist/story-coverage/components.mjs +40 -0
  131. package/dist/story-coverage/coverage.d.mts +10 -0
  132. package/dist/story-coverage/coverage.mjs +43 -0
  133. package/dist/story-coverage/index.d.mts +13 -0
  134. package/dist/story-coverage/index.mjs +7 -0
  135. package/dist/story-coverage/messages.d.mts +10 -0
  136. package/dist/story-coverage/messages.mjs +42 -0
  137. package/dist/story-coverage/options.d.mts +27 -0
  138. package/dist/story-coverage/options.mjs +51 -0
  139. package/dist/story-coverage/workspace.d.mts +2 -0
  140. package/dist/story-coverage/workspace.mjs +27 -0
  141. package/dist/test-helpers/cancel-runs.test-helpers.d.mts +39 -0
  142. package/dist/test-helpers/cancel-runs.test-helpers.mjs +124 -0
  143. package/dist/test-helpers/run-bounded-exit-observer.test-helpers.d.mts +12 -0
  144. package/dist/test-helpers/run-bounded-exit-observer.test-helpers.mjs +68 -0
  145. package/dist/test-helpers/run-bounded-output-fixture.test-helpers.d.mts +18 -0
  146. package/dist/test-helpers/run-bounded-output-fixture.test-helpers.mjs +162 -0
  147. package/dist/vitest-diagnostics/index.d.mts +9 -1
  148. package/dist/vitest-diagnostics/index.mjs +5 -1
  149. package/dist/vitest-diagnostics/vitest-fake-timer-guard.d.mts +6 -0
  150. package/dist/vitest-diagnostics/vitest-fake-timer-guard.mjs +34 -0
  151. package/dist/vitest-diagnostics/vitest-fork-leak-detection.d.mts +1 -0
  152. package/dist/vitest-diagnostics/vitest-fork-leak-detection.mjs +8 -0
  153. package/dist/vitest-diagnostics/vitest-fork-leak-diagnostics.d.mts +10 -1
  154. package/dist/vitest-diagnostics/vitest-fork-leak-diagnostics.mjs +43 -2
  155. package/dist/vitest-diagnostics/vitest-fork-leak-handshake-samples.d.mts +50 -0
  156. package/dist/vitest-diagnostics/vitest-fork-leak-handshake-samples.mjs +69 -0
  157. package/dist/vitest-diagnostics/vitest-fork-leak-handshake.d.mts +19 -0
  158. package/dist/vitest-diagnostics/vitest-fork-leak-handshake.mjs +136 -0
  159. package/dist/vitest-diagnostics/vitest-network-allowlist-dns.d.mts +7 -0
  160. package/dist/vitest-diagnostics/vitest-network-allowlist-dns.mjs +54 -0
  161. package/dist/vitest-diagnostics/vitest-network-allowlist-host.d.mts +8 -0
  162. package/dist/vitest-diagnostics/vitest-network-allowlist-host.mjs +48 -0
  163. package/dist/vitest-diagnostics/vitest-network-allowlist-socket.d.mts +14 -0
  164. package/dist/vitest-diagnostics/vitest-network-allowlist-socket.mjs +39 -0
  165. package/dist/vitest-diagnostics/vitest-network-allowlist.d.mts +7 -0
  166. package/dist/vitest-diagnostics/vitest-network-allowlist.mjs +72 -0
  167. package/dist/vitest-diagnostics/vitest-process-resources.d.mts +6 -0
  168. package/dist/vitest-diagnostics/vitest-process-resources.mjs +51 -0
  169. package/dist/vitest-effective-timeout/cap.d.mts +9 -0
  170. package/dist/vitest-effective-timeout/cap.mjs +28 -0
  171. package/dist/vitest-effective-timeout/check-profiles.d.mts +15 -0
  172. package/dist/vitest-effective-timeout/check-profiles.mjs +52 -0
  173. package/dist/vitest-effective-timeout/config-file.d.mts +6 -0
  174. package/dist/vitest-effective-timeout/config-file.mjs +23 -0
  175. package/dist/vitest-effective-timeout/fixtures.d.mts +2 -0
  176. package/dist/vitest-effective-timeout/fixtures.mjs +18 -0
  177. package/dist/vitest-effective-timeout/index.d.mts +7 -0
  178. package/dist/vitest-effective-timeout/index.mjs +4 -0
  179. package/dist/vitest-effective-timeout/profiles.d.mts +10 -0
  180. package/dist/vitest-effective-timeout/profiles.mjs +33 -0
  181. package/dist/vitest-effective-timeout/run-profile.d.mts +31 -0
  182. package/dist/vitest-effective-timeout/run-profile.mjs +95 -0
  183. package/docs/mcp-server.md +2 -13
  184. package/package.json +32 -2
  185. package/scripts/__pycache__/run_bounded_process.cpython-312.pyc +0 -0
  186. package/scripts/chromium-launch-probe.d.mts +7 -0
  187. package/scripts/chromium-launch-probe.mjs +101 -0
  188. package/scripts/run-bounded-fixtures/run-bounded-backpressure.py +186 -0
  189. package/scripts/run-bounded-fixtures/run-bounded-merged-output.py +75 -0
  190. package/scripts/run-bounded-fixtures/run-bounded-reset-socket.py +25 -0
  191. package/scripts/run-bounded.py +199 -0
  192. package/scripts/run_bounded_process.py +129 -0
  193. package/scripts/worktree/git-index-lock.sh +16 -0
  194. package/scripts/worktree/git-worktrees.sh +23 -20
  195. package/scripts/worktree/reset-worktree-run.sh +199 -0
  196. package/scripts/worktree/reset-worktree.sh +122 -0
  197. package/skills/blackboard/SKILL.md +4 -64
  198. package/skills/stacked-prs/SKILL.md +1 -1
  199. package/skills/stacked-prs/references/drain.md +2 -2
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Fulfill the Cloudflare Turnstile script with a synthetic `window.turnstile`
3
+ * that resolves the widget synchronously. Background traffic from the real
4
+ * script can keep `networkidle` from settling. The synthetic widget implements
5
+ * render, reset, remove, and getResponse. Callers that reject the token on
6
+ * the server should mock that request.
7
+ */
8
+ const TURNSTILE_API_PATTERN = '**/turnstile/v0/api.js**';
9
+ export const DEFAULT_TURNSTILE_STUB_TOKEN = 'PLAYWRIGHT_TURNSTILE_TOKEN';
10
+ export const DEFAULT_TURNSTILE_STUB_ATTRIBUTE = 'data-pw';
11
+ function renderTurnstileStubScript(token, attributeName) {
12
+ return `
13
+ ;(function () {
14
+ if (window.turnstile) return
15
+ var fakeToken = ${JSON.stringify(token)}
16
+ var handlers = new Map()
17
+ window.turnstile = {
18
+ render: function (container, params) {
19
+ var id = 'pw-' + Math.random().toString(36).slice(2)
20
+ if (typeof container === 'string') container = document.querySelector(container)
21
+ if (!container) throw new Error('Turnstile container not found')
22
+ container.replaceChildren()
23
+ var widget = document.createElement('div')
24
+ widget.setAttribute('role', 'group')
25
+ widget.setAttribute('aria-label', 'Cloudflare Turnstile verification')
26
+ widget.setAttribute(${JSON.stringify(attributeName)}, 'turnstile-widget')
27
+ widget.textContent = 'Cloudflare Turnstile verification'
28
+ container.appendChild(widget)
29
+ handlers.set(id, params)
30
+ queueMicrotask(function () {
31
+ try { params && params.callback && params.callback(fakeToken) } catch (_) {}
32
+ })
33
+ return id
34
+ },
35
+ reset: function (id) {
36
+ var params = handlers.get(id)
37
+ if (!params) return
38
+ queueMicrotask(function () {
39
+ try { params.callback && params.callback(fakeToken) } catch (_) {}
40
+ })
41
+ },
42
+ remove: function (id) { handlers.delete(id) },
43
+ getResponse: function () { return fakeToken },
44
+ }
45
+ })();
46
+ `;
47
+ }
48
+ const stubbedPages = new WeakSet();
49
+ export async function installTurnstileStub(page, options = {}) {
50
+ if (stubbedPages.has(page))
51
+ return;
52
+ const token = options.token ?? DEFAULT_TURNSTILE_STUB_TOKEN;
53
+ const attributeName = options.attributeName ?? DEFAULT_TURNSTILE_STUB_ATTRIBUTE;
54
+ const body = renderTurnstileStubScript(token, attributeName);
55
+ await page.route(TURNSTILE_API_PATTERN, (route) => route.fulfill({
56
+ status: 200,
57
+ contentType: 'application/javascript',
58
+ body,
59
+ }));
60
+ stubbedPages.add(page);
61
+ }
@@ -0,0 +1,30 @@
1
+ export declare const MOBILE_VIEWPORTS: {
2
+ readonly 'iphone-se': {
3
+ readonly width: 375;
4
+ readonly height: 667;
5
+ };
6
+ readonly 'iphone-14-pro': {
7
+ readonly width: 393;
8
+ readonly height: 852;
9
+ };
10
+ readonly 'pixel-7': {
11
+ readonly width: 412;
12
+ readonly height: 915;
13
+ };
14
+ readonly 'iphone-14-plus': {
15
+ readonly width: 428;
16
+ readonly height: 926;
17
+ };
18
+ readonly 'galaxy-s21': {
19
+ readonly width: 360;
20
+ readonly height: 800;
21
+ };
22
+ readonly smallest: {
23
+ readonly width: 320;
24
+ readonly height: 568;
25
+ };
26
+ };
27
+ export declare const DESKTOP_VIEWPORT: {
28
+ width: number;
29
+ height: number;
30
+ };
@@ -0,0 +1,9 @@
1
+ export const MOBILE_VIEWPORTS = {
2
+ 'iphone-se': { width: 375, height: 667 },
3
+ 'iphone-14-pro': { width: 393, height: 852 },
4
+ 'pixel-7': { width: 412, height: 915 },
5
+ 'iphone-14-plus': { width: 428, height: 926 },
6
+ 'galaxy-s21': { width: 360, height: 800 },
7
+ smallest: { width: 320, height: 568 },
8
+ };
9
+ export const DESKTOP_VIEWPORT = { width: 1280, height: 720 };
@@ -0,0 +1,5 @@
1
+ import type { Page } from '@playwright/test';
2
+ export declare function setupVirtualAuthenticator(page: Page): Promise<{
3
+ client: import("@playwright/test").CDPSession;
4
+ authenticatorId: string;
5
+ }>;
@@ -0,0 +1,15 @@
1
+ export async function setupVirtualAuthenticator(page) {
2
+ const client = await page.context().newCDPSession(page);
3
+ await client.send('WebAuthn.enable', { enableUI: false });
4
+ const { authenticatorId } = await client.send('WebAuthn.addVirtualAuthenticator', {
5
+ options: {
6
+ protocol: 'ctap2',
7
+ transport: 'internal',
8
+ hasResidentKey: true,
9
+ hasUserVerification: true,
10
+ isUserVerified: true,
11
+ automaticPresenceSimulation: true,
12
+ },
13
+ });
14
+ return { client, authenticatorId };
15
+ }
@@ -0,0 +1,29 @@
1
+ import type { Page } from '@playwright/test';
2
+ /**
3
+ * Wait for React hydration of below-fold streaming components.
4
+ *
5
+ * React 19 prioritises above-fold hydration; components scrolled out of
6
+ * view receive lower-priority MessageChannel callbacks. The idle/animation
7
+ * probe is a bounded readiness heuristic, not proof that every client handler
8
+ * is attached. A control that cannot accept an early interaction must expose
9
+ * its own disabled-until-hydrated state; tests then wait for that state.
10
+ *
11
+ * Use this when navigateTo() alone is insufficient because the element you
12
+ * need to interact with lives inside a below-fold streaming boundary. Prefer
13
+ * scrolling the element into view first (element.scrollIntoViewIfNeeded())
14
+ * so React has a chance to bump its hydration priority before you call this.
15
+ *
16
+ * Tolerates a client-side redirect arriving mid-wait: the document the
17
+ * readiness probe started in can be replaced before the probe resolves, which
18
+ * destroys its execution context. Rather than failing, the wait restarts
19
+ * against the document that replaced it, so hydration is always measured
20
+ * against the document the caller ends up on. `waitUntil` is the load state to
21
+ * settle that replacement document to; callers that navigated under a stricter
22
+ * state should pass their own so a redirect does not silently weaken it.
23
+ *
24
+ * If you find yourself calling this frequently, consider fixing navigate-to.mts
25
+ * to use a more deterministic hydration signal instead.
26
+ */
27
+ export declare function waitForBelowFoldHydration(page: Page, { waitUntil }?: {
28
+ waitUntil?: "load" | "networkidle" | undefined;
29
+ }): Promise<void>;
@@ -0,0 +1,81 @@
1
+ // Playwright rejects an in-flight page.evaluate() with this message when a
2
+ // navigation replaces the document that evaluate was running in.
3
+ const DESTROYED_EXECUTION_CONTEXT_PATTERN = /Execution context was destroyed/i;
4
+ // A redirect chain can replace the document more than once, so re-waiting is
5
+ // bounded: a redirect loop has to fail the test rather than hang it.
6
+ const MAX_DOCUMENT_REPLACEMENTS = 2;
7
+ function isDestroyedExecutionContextError(error) {
8
+ const message = error instanceof Error ? error.message : String(error);
9
+ return DESTROYED_EXECUTION_CONTEXT_PATTERN.test(message);
10
+ }
11
+ function evaluateHydrationSettled(page) {
12
+ return page.evaluate(() => new Promise((resolve) => {
13
+ const requestIdleCallbackMaybe = globalThis.window.requestIdleCallback;
14
+ if (requestIdleCallbackMaybe) {
15
+ requestIdleCallbackMaybe(() => resolve(), { timeout: 500 });
16
+ return;
17
+ }
18
+ // When requestIdleCallback is unavailable, wait for two animation
19
+ // frames so React has had paint cycles to hydrate below-fold
20
+ // components. Race double-RAF against a short timeout so
21
+ // throttled/hidden tabs cannot hang indefinitely; the timeout is a
22
+ // completion bound, not the primary readiness signal.
23
+ let timeoutId;
24
+ let isResolved = false;
25
+ const resolveOnce = () => {
26
+ if (isResolved)
27
+ return;
28
+ isResolved = true;
29
+ if (timeoutId !== undefined) {
30
+ clearTimeout(timeoutId);
31
+ }
32
+ // `isResolved` makes the RAF/timeout race first-winner-only
33
+ resolve();
34
+ };
35
+ const requestFrame = globalThis.requestAnimationFrame;
36
+ requestFrame(() => requestFrame(resolveOnce));
37
+ timeoutId = setTimeout(resolveOnce, 50);
38
+ }));
39
+ }
40
+ async function waitForHydrationSettled(page, waitUntil, remainingReplacements) {
41
+ try {
42
+ await evaluateHydrationSettled(page);
43
+ }
44
+ catch (err) {
45
+ if (!isDestroyedExecutionContextError(err) || remainingReplacements <= 0)
46
+ throw err;
47
+ // A client-side redirect landed after the first document had already gone
48
+ // quiet, destroying the context this evaluate was waiting in. Wait for the
49
+ // document that replaced it, then measure hydration against that one.
50
+ await page.waitForLoadState(waitUntil);
51
+ await waitForHydrationSettled(page, waitUntil, remainingReplacements - 1);
52
+ }
53
+ }
54
+ /**
55
+ * Wait for React hydration of below-fold streaming components.
56
+ *
57
+ * React 19 prioritises above-fold hydration; components scrolled out of
58
+ * view receive lower-priority MessageChannel callbacks. The idle/animation
59
+ * probe is a bounded readiness heuristic, not proof that every client handler
60
+ * is attached. A control that cannot accept an early interaction must expose
61
+ * its own disabled-until-hydrated state; tests then wait for that state.
62
+ *
63
+ * Use this when navigateTo() alone is insufficient because the element you
64
+ * need to interact with lives inside a below-fold streaming boundary. Prefer
65
+ * scrolling the element into view first (element.scrollIntoViewIfNeeded())
66
+ * so React has a chance to bump its hydration priority before you call this.
67
+ *
68
+ * Tolerates a client-side redirect arriving mid-wait: the document the
69
+ * readiness probe started in can be replaced before the probe resolves, which
70
+ * destroys its execution context. Rather than failing, the wait restarts
71
+ * against the document that replaced it, so hydration is always measured
72
+ * against the document the caller ends up on. `waitUntil` is the load state to
73
+ * settle that replacement document to; callers that navigated under a stricter
74
+ * state should pass their own so a redirect does not silently weaken it.
75
+ *
76
+ * If you find yourself calling this frequently, consider fixing navigate-to.mts
77
+ * to use a more deterministic hydration signal instead.
78
+ */
79
+ export async function waitForBelowFoldHydration(page, { waitUntil = 'load' } = {}) {
80
+ await waitForHydrationSettled(page, waitUntil, MAX_DOCUMENT_REPLACEMENTS);
81
+ }
@@ -0,0 +1,12 @@
1
+ export declare function readAnsiCString(command: string, startIndex: number): {
2
+ value: string;
3
+ endIndex: number;
4
+ } | null;
5
+ export declare function decodeAnsiCStringEscape(command: string, escapeIndex: number): {
6
+ value: string;
7
+ endIndex: number;
8
+ };
9
+ export declare function decodeNumericAnsiEscape(command: string, startIndex: number, maxLength: number, radix: 8 | 16, fallbackPrefix: string): {
10
+ value: string;
11
+ endIndex: number;
12
+ };
@@ -0,0 +1,80 @@
1
+ export function readAnsiCString(command, startIndex) {
2
+ let value = '';
3
+ for (let index = startIndex; index < command.length; index += 1) {
4
+ const char = command[index];
5
+ if (char === "'") {
6
+ return { value, endIndex: index };
7
+ }
8
+ if (char !== '\\') {
9
+ value += char;
10
+ continue;
11
+ }
12
+ if (index === command.length - 1) {
13
+ value += '\\';
14
+ continue;
15
+ }
16
+ const escape = decodeAnsiCStringEscape(command, index + 1);
17
+ value += escape.value;
18
+ index = escape.endIndex;
19
+ }
20
+ return null;
21
+ }
22
+ export function decodeAnsiCStringEscape(command, escapeIndex) {
23
+ const char = command[escapeIndex];
24
+ switch (char) {
25
+ case 'a':
26
+ return { value: '\u0007', endIndex: escapeIndex };
27
+ case 'b':
28
+ return { value: '\b', endIndex: escapeIndex };
29
+ case 'e':
30
+ case 'E':
31
+ return { value: '\u001b', endIndex: escapeIndex };
32
+ case 'f':
33
+ return { value: '\f', endIndex: escapeIndex };
34
+ case 'n':
35
+ return { value: '\n', endIndex: escapeIndex };
36
+ case 'r':
37
+ return { value: '\r', endIndex: escapeIndex };
38
+ case 't':
39
+ return { value: '\t', endIndex: escapeIndex };
40
+ case 'v':
41
+ return { value: '\v', endIndex: escapeIndex };
42
+ case '\\':
43
+ case "'":
44
+ case '"':
45
+ case '?':
46
+ return { value: char, endIndex: escapeIndex };
47
+ case '\n':
48
+ return { value: '', endIndex: escapeIndex };
49
+ case 'x':
50
+ return decodeNumericAnsiEscape(command, escapeIndex + 1, 2, 16, '\\x');
51
+ case 'u':
52
+ return decodeNumericAnsiEscape(command, escapeIndex + 1, 4, 16, '\\u');
53
+ case 'U':
54
+ return decodeNumericAnsiEscape(command, escapeIndex + 1, 8, 16, '\\U');
55
+ default:
56
+ if (/[0-7]/.test(char)) {
57
+ return decodeNumericAnsiEscape(command, escapeIndex, 3, 8, '\\');
58
+ }
59
+ return { value: char, endIndex: escapeIndex };
60
+ }
61
+ }
62
+ export function decodeNumericAnsiEscape(command, startIndex, maxLength, radix, fallbackPrefix) {
63
+ const pattern = radix === 16 ? /[0-9a-fA-F]/ : /[0-7]/;
64
+ let digits = '';
65
+ let endIndex = startIndex - 1;
66
+ for (let index = startIndex; index < command.length && digits.length < maxLength && pattern.test(command[index]); index += 1) {
67
+ digits += command[index];
68
+ endIndex = index;
69
+ }
70
+ if (digits.length === 0) {
71
+ return { value: fallbackPrefix, endIndex: startIndex - 1 };
72
+ }
73
+ const codePoint = Number.parseInt(digits, radix);
74
+ try {
75
+ return { value: String.fromCodePoint(codePoint), endIndex };
76
+ }
77
+ catch {
78
+ return { value: `${fallbackPrefix}${digits}`, endIndex };
79
+ }
80
+ }
@@ -0,0 +1,20 @@
1
+ export { decodeAnsiCStringEscape, decodeNumericAnsiEscape, readAnsiCString, } from './ansi-c-string.mts';
2
+ export { readBacktickSubstitution, readParenthesizedSubstitution, } from './shell-command-substitution-reads.mts';
3
+ export { extractShellCommandSubstitutions } from './shell-command-substitutions.mts';
4
+ export { parseCommandPrefix, readCommandPrefix, withoutRedirections, } from './shell-command-wrappers.mts';
5
+ export type { CommandPrefix } from './shell-command-wrappers.mts';
6
+ export { commandsToInspectForGitPolicy, commandsToInspectPreservingQuotes, envPrefixSetsEditor, extractShellCommandArguments, isInteractiveRebaseContinue, shellCommandInheritsEditor, stripGitGlobalOptionsForPolicy, stripQuotedShellText, } from './shell-commands.mts';
7
+ export type { ShellCommandArgument } from './shell-commands.mts';
8
+ export { readHeredocDelimiter } from './shell-heredoc-delimiter.mts';
9
+ export { heredocSpecsFromLine } from './shell-heredoc-parser.mts';
10
+ export type { HeredocSpec } from './shell-heredoc-parser.mts';
11
+ export { stripNonShellHeredocBodies } from './shell-heredoc.mts';
12
+ export { isRedirectionFd, isShellRedirectionOperatorToken, redirectionOperatorOf, SHELL_REDIRECTION_OPERATORS, shellRedirectionOperatorAt, } from './shell-redirections.mts';
13
+ export { findShellScriptArguments, isShellWord, shellScriptOperandIndex, } from './shell-script-operand.mts';
14
+ export type { ShellScriptArgument } from './shell-script-operand.mts';
15
+ export { shellReadsStdinAt } from './shell-stdin-script.mts';
16
+ export { commandSegmentStart, isShellAssignment, isShellCommandSeparator, nextShellCommandSeparatorIndex, plainShellAssignment, } from './shell-token-utils.mts';
17
+ export { stripUnquotedShellComments } from './shell-tokenizer-comments.mts';
18
+ export { consumeShellSeparator } from './shell-tokenizer-operators.mts';
19
+ export { tokenizeShellWords, tokenizeShellWordsDetailed } from './shell-tokenizer.mts';
20
+ export type { ShellWord } from './shell-tokenizer.mts';
@@ -0,0 +1,15 @@
1
+ export { decodeAnsiCStringEscape, decodeNumericAnsiEscape, readAnsiCString, } from "./ansi-c-string.mjs";
2
+ export { readBacktickSubstitution, readParenthesizedSubstitution, } from "./shell-command-substitution-reads.mjs";
3
+ export { extractShellCommandSubstitutions } from "./shell-command-substitutions.mjs";
4
+ export { parseCommandPrefix, readCommandPrefix, withoutRedirections, } from "./shell-command-wrappers.mjs";
5
+ export { commandsToInspectForGitPolicy, commandsToInspectPreservingQuotes, envPrefixSetsEditor, extractShellCommandArguments, isInteractiveRebaseContinue, shellCommandInheritsEditor, stripGitGlobalOptionsForPolicy, stripQuotedShellText, } from "./shell-commands.mjs";
6
+ export { readHeredocDelimiter } from "./shell-heredoc-delimiter.mjs";
7
+ export { heredocSpecsFromLine } from "./shell-heredoc-parser.mjs";
8
+ export { stripNonShellHeredocBodies } from "./shell-heredoc.mjs";
9
+ export { isRedirectionFd, isShellRedirectionOperatorToken, redirectionOperatorOf, SHELL_REDIRECTION_OPERATORS, shellRedirectionOperatorAt, } from "./shell-redirections.mjs";
10
+ export { findShellScriptArguments, isShellWord, shellScriptOperandIndex, } from "./shell-script-operand.mjs";
11
+ export { shellReadsStdinAt } from "./shell-stdin-script.mjs";
12
+ export { commandSegmentStart, isShellAssignment, isShellCommandSeparator, nextShellCommandSeparatorIndex, plainShellAssignment, } from "./shell-token-utils.mjs";
13
+ export { stripUnquotedShellComments } from "./shell-tokenizer-comments.mjs";
14
+ export { consumeShellSeparator } from "./shell-tokenizer-operators.mjs";
15
+ export { tokenizeShellWords, tokenizeShellWordsDetailed } from "./shell-tokenizer.mjs";
@@ -0,0 +1,8 @@
1
+ export declare function readParenthesizedSubstitution(command: string, startIndex: number): {
2
+ command: string;
3
+ endIndex: number;
4
+ } | null;
5
+ export declare function readBacktickSubstitution(command: string, startIndex: number): {
6
+ command: string;
7
+ endIndex: number;
8
+ } | null;
@@ -0,0 +1,53 @@
1
+ export function readParenthesizedSubstitution(command, startIndex) {
2
+ let depth = 1;
3
+ let quote = null;
4
+ let escaping = false;
5
+ for (let index = startIndex; index < command.length; index += 1) {
6
+ const char = command[index];
7
+ if (escaping) {
8
+ escaping = false;
9
+ continue;
10
+ }
11
+ if (char === '\\' && quote !== "'") {
12
+ escaping = true;
13
+ continue;
14
+ }
15
+ if (char === "'" && quote !== '"') {
16
+ quote = quote === "'" ? null : "'";
17
+ continue;
18
+ }
19
+ if (char === '"' && quote !== "'") {
20
+ quote = quote === '"' ? null : '"';
21
+ continue;
22
+ }
23
+ if (quote === null && char === '(') {
24
+ depth += 1;
25
+ continue;
26
+ }
27
+ if (quote === null && char === ')' && --depth === 0) {
28
+ return { command: command.slice(startIndex, index), endIndex: index };
29
+ }
30
+ }
31
+ return null;
32
+ }
33
+ export function readBacktickSubstitution(command, startIndex) {
34
+ let value = '';
35
+ let escaping = false;
36
+ for (let index = startIndex; index < command.length; index += 1) {
37
+ const char = command[index];
38
+ if (escaping) {
39
+ value += char === '`' || char === '\\' || char === '$' ? char : `\\${char}`;
40
+ escaping = false;
41
+ continue;
42
+ }
43
+ if (char === '\\') {
44
+ escaping = true;
45
+ continue;
46
+ }
47
+ if (char === '`') {
48
+ return { command: value, endIndex: index };
49
+ }
50
+ value += char;
51
+ }
52
+ return null;
53
+ }
@@ -0,0 +1,8 @@
1
+ import { readBacktickSubstitution, readParenthesizedSubstitution } from './shell-command-substitution-reads.mts';
2
+ /**
3
+ * The command substitutions a command's text runs. Heredoc bodies follow other quoting rules, so
4
+ * the caller blanks them first and reads their substitutions from the heredoc scan
5
+ * (shell-heredoc.mts).
6
+ */
7
+ export declare function extractShellCommandSubstitutions(textWithoutBodies: string): string[];
8
+ export { readBacktickSubstitution, readParenthesizedSubstitution };
@@ -0,0 +1,52 @@
1
+ import { readBacktickSubstitution, readParenthesizedSubstitution, } from "./shell-command-substitution-reads.mjs";
2
+ import { stripUnquotedShellComments } from "./shell-tokenizer.mjs";
3
+ /**
4
+ * The command substitutions a command's text runs. Heredoc bodies follow other quoting rules, so
5
+ * the caller blanks them first and reads their substitutions from the heredoc scan
6
+ * (shell-heredoc.mts).
7
+ */
8
+ export function extractShellCommandSubstitutions(textWithoutBodies) {
9
+ const source = stripUnquotedShellComments(textWithoutBodies);
10
+ const substitutions = [];
11
+ let quote = null;
12
+ let escaping = false;
13
+ for (let index = 0; index < source.length; index += 1) {
14
+ const char = source[index];
15
+ if (escaping) {
16
+ escaping = false;
17
+ continue;
18
+ }
19
+ if (char === '\\' && quote !== "'") {
20
+ escaping = true;
21
+ continue;
22
+ }
23
+ if (char === "'" && quote !== '"') {
24
+ quote = quote === "'" ? null : "'";
25
+ continue;
26
+ }
27
+ if (char === '"' && quote !== "'") {
28
+ quote = quote === '"' ? null : '"';
29
+ continue;
30
+ }
31
+ if (quote === "'") {
32
+ continue;
33
+ }
34
+ if (char === '$' && source[index + 1] === '(') {
35
+ const substitution = readParenthesizedSubstitution(source, index + 2);
36
+ if (substitution !== null) {
37
+ substitutions.push(substitution.command);
38
+ index = substitution.endIndex;
39
+ }
40
+ continue;
41
+ }
42
+ if (char === '`') {
43
+ const substitution = readBacktickSubstitution(source, index + 1);
44
+ if (substitution !== null) {
45
+ substitutions.push(substitution.command);
46
+ index = substitution.endIndex;
47
+ }
48
+ }
49
+ }
50
+ return substitutions;
51
+ }
52
+ export { readBacktickSubstitution, readParenthesizedSubstitution };
@@ -0,0 +1,26 @@
1
+ /** What a recognized wrapper chain before a command word changes about how that command runs. */
2
+ export type CommandPrefix = {
3
+ /** The effective `env -C` directory of each `env` in the chain, outermost first. */
4
+ chdir: string[];
5
+ /** Assignments and `env -u` unsets the command sees. */
6
+ env: Record<string, string | undefined>;
7
+ /** Wrapper basenames, outermost first. */
8
+ wrappers: string[];
9
+ };
10
+ /**
11
+ * Parses the words between a command segment's start and a command word. Returns null when they
12
+ * are not a recognized wrapper chain, i.e. the command word is an argument rather than the
13
+ * program the shell runs. Wrappers chain in any order (`nohup env -C /tmp gh`) and match by
14
+ * basename (`/usr/bin/env`).
15
+ */
16
+ export declare function parseCommandPrefix(prefixWords: readonly string[]): CommandPrefix | null;
17
+ /**
18
+ * Reads the wrapper chain that opens a simple command's words (redirections already removed) and
19
+ * finds the command word it runs. Returns null when a wrapper's options are unrecognized or only
20
+ * describe the command (`command -v gh`).
21
+ */
22
+ export declare function readCommandPrefix(words: readonly string[]): {
23
+ commandIndex: number;
24
+ prefix: CommandPrefix;
25
+ } | null;
26
+ export declare function withoutRedirections(words: readonly string[]): string[] | null;