@geonosis/walk 3.1.0 → 3.2.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 (43) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +7 -6
  3. package/dist/browser.d.ts +2 -18
  4. package/dist/config.d.ts +0 -2
  5. package/dist/config.js +19 -13
  6. package/dist/options.d.ts +2 -11
  7. package/dist/options.js +4 -1
  8. package/dist/probes/buy-box-above-fold.d.ts +1 -14
  9. package/dist/probes/buy-box-above-fold.js +3 -5
  10. package/dist/probes/define.d.ts +7 -0
  11. package/dist/probes/define.js +12 -0
  12. package/dist/probes/empty-section.d.ts +1 -16
  13. package/dist/probes/empty-section.js +3 -3
  14. package/dist/probes/error-page-status.d.ts +1 -20
  15. package/dist/probes/error-page-status.js +8 -31
  16. package/dist/probes/fabricated-claim.d.ts +1 -14
  17. package/dist/probes/fabricated-claim.js +6 -23
  18. package/dist/probes/fake-session.d.ts +1 -14
  19. package/dist/probes/fake-session.js +3 -4
  20. package/dist/probes/index.d.ts +1 -5
  21. package/dist/probes/light-on-light.d.ts +1 -15
  22. package/dist/probes/light-on-light.js +3 -3
  23. package/dist/probes/link-integrity.d.ts +2 -14
  24. package/dist/probes/link-integrity.js +13 -7
  25. package/dist/probes/money-format.d.ts +1 -14
  26. package/dist/probes/money-format.js +3 -3
  27. package/dist/probes/ops-leakage.d.ts +1 -13
  28. package/dist/probes/ops-leakage.js +6 -23
  29. package/dist/probes/orphan-url.d.ts +1 -13
  30. package/dist/probes/orphan-url.js +3 -3
  31. package/dist/probes/placeholder-asset.d.ts +1 -14
  32. package/dist/probes/placeholder-asset.js +3 -4
  33. package/dist/probes/stub-only-entity.d.ts +1 -14
  34. package/dist/probes/stub-only-entity.js +3 -3
  35. package/dist/probes/text-probe.d.ts +12 -0
  36. package/dist/probes/text-probe.js +37 -0
  37. package/dist/probes/thin-page.d.ts +1 -14
  38. package/dist/probes/thin-page.js +3 -3
  39. package/dist/types.d.ts +8 -55
  40. package/dist/walk-cli.js +4 -3
  41. package/dist/walk.d.ts +1 -12
  42. package/dist/walk.js +3 -2
  43. package/package.json +5 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @geonosis/walk
2
2
 
3
+ ## 3.2.0
4
+
5
+ ### Patch Changes
6
+
7
+ - f5632b7: New `@geonosis/base`: the zero-dependency bottom of the method, holding what packages used to copy. `@geonosis/base` is `isRecord`, `isStringList`, `stringsOf`, the error text helpers and the markdown readers (`headingsOf`, `sectionUnder`, `fencedLines`, `titleOf`), safe in a browser or a Worker; `@geonosis/base/node` is `packageRootFrom`, `versionOf` and `isDirectory`; `@geonosis/base/bin-harness` is `binRunner(runtime)` for running a package's bin in a test, with `GIT_ISOLATED` for a bin that shells to git.
8
+ `cli`, `create-geonosis`, `ledger`, `mcp`, `observability`, `rails`, `release`, `review`, `themekit`, `verify`, `verify-arch` and `walk` import the guards from it instead of carrying their own; their behaviour is unchanged and each now installs `@geonosis/base`, which a consumer never declares.
9
+ The ratchet keeps its own copies: the build runs on its source before any package exists, so nothing it imports may be a package the build produces.
10
+ - 58eaf3a: `link-integrity` refuses an `ignore` pattern that is not a regular expression before it reads a link, naming the pattern, and reports why a target could not be reached rather than `answered 599`.
11
+ - deef511: The README's account of what the probes reach is recounted for the thirteen it ships: of the audit's 36 defects, six reproduce from a probe alone, sixteen partially and fourteen by none (it said four, fourteen and eighteen, for the first eight).
12
+ - Updated dependencies [f5632b7]
13
+ - @geonosis/base@3.2.0
14
+
3
15
  ## 3.1.0
4
16
 
5
17
  No changes in this release.
package/README.md CHANGED
@@ -128,10 +128,11 @@ the status agrees with the body, and asking the server again asks a different qu
128
128
 
129
129
  ## What this is not
130
130
 
131
- A green report is not a clean surface. Eight of the nine came from an audit that held 36 defects;
132
- four are reproduced by a probe alone, fourteen partially, and eighteen — five product tables that
133
- disagree, a cart that re-prices what the product page quoted, copy promising a control nobody built,
134
- four levels of taxonomy for fourteen products — are invisible to any browser probe there could be.
135
- Those stay the walker's judgement. The ninth came from a production incident instead, which is how
136
- the list is meant to grow. The reasoning, defect by defect, is in
131
+ A green report is not a clean surface. Twelve of the thirteen probes came from hand audits of one
132
+ storefront, the largest holding 36 defects; six are reproduced by a probe alone, sixteen partially,
133
+ and fourteen — five product tables that disagree, a cart that re-prices what the product page
134
+ quoted, copy promising a control nobody built, four levels of taxonomy for fourteen products — are
135
+ invisible to any browser probe there could be. Those stay the walker's judgement. The thirteenth
136
+ came from a production incident instead, which is how the list is meant to grow. The reasoning,
137
+ defect by defect, is in
137
138
  [`docs/walk-review-inventory-2026-08-30.md`](../../docs/walk-review-inventory-2026-08-30.md).
package/dist/browser.d.ts CHANGED
@@ -1,12 +1,5 @@
1
1
  import type { Page } from 'playwright';
2
- /**
3
- * The browser's own globals, declared here rather than by adding `"lib": ["DOM"]`.
4
- *
5
- * The repo typechecks eleven packages against one `tsconfig.base.json`; turning the DOM on for all
6
- * of them so that this one file can say `document` would put `fetch`, `Response` and `Request` into
7
- * ten Node packages that have their own. So the surface these probes actually read is written out,
8
- * module-locally — it leaks into nothing, and it is a list of exactly what the walk touches.
9
- */
2
+ /** Declared module-locally: enabling `lib: DOM` would put `fetch`, `Response` and `Request` into every Node package sharing `tsconfig.base.json`. */
10
3
  type DomRect = {
11
4
  height: number;
12
5
  left: number;
@@ -49,11 +42,6 @@ export type GeometryHit = {
49
42
  rect: DomRect | null;
50
43
  selector: string;
51
44
  };
52
- /**
53
- * How much a container actually says, counted after layout: the words a reader is shown, how many
54
- * of them are its own headings, and how many pieces of media stand in for the rest. A section with
55
- * a heading and nothing under it renders perfectly and tells nobody anything.
56
- */
57
45
  export type ProseHit = {
58
46
  headingWords: number;
59
47
  media: number;
@@ -113,11 +101,7 @@ export type JobResult = {
113
101
  prose: ProseHit[];
114
102
  text: TextHit[];
115
103
  };
116
- /**
117
- * The one cast in the package. `page.evaluate` runs `inPage` in another VM, so nothing about the
118
- * value that comes back is checkable from here — the discriminant is the contract, and it is
119
- * covered by the probe tests that read each shape through a real browser.
120
- */
104
+ /** The one cast: the value comes back from another VM, so the discriminant is the contract, covered by the probe tests. */
121
105
  export declare const collect: <K extends Job['kind']>(page: Page, job: Extract<Job, {
122
106
  kind: K;
123
107
  }>) => Promise<JobResult[K]>;
package/dist/config.d.ts CHANGED
@@ -9,8 +9,6 @@ export type WalkConfig = {
9
9
  export declare const WALK_REPORT = ".geonosis/walk-report.json";
10
10
  export declare const WALK_DEFAULT: WalkConfig;
11
11
  export declare const configShape: () => string;
12
- /** `WxH`, the shape a viewport is written in everywhere else — 1440x900, 390x844. */
13
12
  export declare const parseViewport: (value: string) => Viewport;
14
- /** The `walk` block of `geonosis.json`, every key optional, every default a contract. */
15
13
  export declare const loadWalkConfig: (file: string) => WalkConfig;
16
14
  export declare const configPath: (cwd: string, given?: string) => string;
package/dist/config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // src/config.ts
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import { resolve } from "node:path";
4
+ import { errorMessage, isRecord, isStringList } from "@geonosis/base";
4
5
  import { DEFAULT_PROBES } from "./probes/index.js";
5
6
  import { WalkError } from "./types.js";
6
7
  var VIEWPORT = { height: 900, width: 1440 };
@@ -12,7 +13,6 @@ var WALK_DEFAULT = {
12
13
  urls: [],
13
14
  viewport: VIEWPORT
14
15
  };
15
- var KNOWN = new Set(["options", "probes", "report", "urls", "viewport"]);
16
16
  var ABOUT = {
17
17
  options: "object? keyed by probe id; each probe validates its own",
18
18
  probes: "string[]? the probe ids to run",
@@ -20,17 +20,17 @@ var ABOUT = {
20
20
  urls: "string[]? the pages to walk",
21
21
  viewport: 'object? { "width": <number>, "height": <number> }'
22
22
  };
23
+ var KNOWN = new Set(Object.keys(ABOUT));
23
24
  var configShape = () => [
24
25
  "geonosis-walk reads geonosis.json",
25
26
  "",
26
27
  'geonosis.json → "walk" every key optional, every default a contract',
27
- ...[...KNOWN].toSorted().map((key) => ` ${key.padEnd(11)}${ABOUT[key] ?? ""}`),
28
+ ...Object.entries(ABOUT).map(([key, about]) => ` ${key.padEnd(11)}${about}`),
28
29
  "",
29
30
  "A key outside this list is REFUSED by name: a misspelling accepted in silence is a probe nobody",
30
31
  "is running against a page nobody is walking."
31
32
  ].join(`
32
33
  `);
33
- var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
34
34
  var readViewport = (value) => {
35
35
  if (value === undefined)
36
36
  return VIEWPORT;
@@ -46,10 +46,23 @@ var parseViewport = (value) => {
46
46
  }
47
47
  return { height: Number(found[2]), width: Number(found[1]) };
48
48
  };
49
+ var readOptions = (value) => {
50
+ if (value === undefined)
51
+ return {};
52
+ if (!isRecord(value))
53
+ throw new WalkError("walk.options must be an object keyed by probe id");
54
+ const options = {};
55
+ for (const [id, one] of Object.entries(value)) {
56
+ if (!isRecord(one))
57
+ throw new WalkError(`walk.options.${id} must be an object`);
58
+ options[id] = one;
59
+ }
60
+ return options;
61
+ };
49
62
  var readStrings = (value, name, fallback) => {
50
63
  if (value === undefined)
51
64
  return fallback;
52
- if (!Array.isArray(value) || value.some((one) => typeof one !== "string")) {
65
+ if (!isStringList(value)) {
53
66
  throw new WalkError(`walk.${name} must be a list of strings`);
54
67
  }
55
68
  return value;
@@ -61,7 +74,7 @@ var loadWalkConfig = (file) => {
61
74
  try {
62
75
  parsed = JSON.parse(readFileSync(file, "utf8"));
63
76
  } catch (error) {
64
- throw new WalkError(`${file} is not valid JSON: ${error.message}`);
77
+ throw new WalkError(`${file} is not valid JSON: ${errorMessage(error)}`);
65
78
  }
66
79
  if (!isRecord(parsed))
67
80
  throw new WalkError(`${file} must hold an object`);
@@ -74,15 +87,8 @@ var loadWalkConfig = (file) => {
74
87
  if (!KNOWN.has(key))
75
88
  throw new WalkError(`walk.${key} is not a key of the walk block`);
76
89
  }
77
- const options = block.options ?? {};
78
- if (!isRecord(options))
79
- throw new WalkError("walk.options must be an object keyed by probe id");
80
- for (const [id, one] of Object.entries(options)) {
81
- if (!isRecord(one))
82
- throw new WalkError(`walk.options.${id} must be an object`);
83
- }
84
90
  return {
85
- options,
91
+ options: readOptions(block.options),
86
92
  probes: readStrings(block.probes, "probes", WALK_DEFAULT.probes),
87
93
  report: typeof block.report === "string" ? block.report : WALK_REPORT,
88
94
  urls: readStrings(block.urls, "urls", []),
package/dist/options.d.ts CHANGED
@@ -2,18 +2,9 @@ export declare const stringOption: (probe: string, options: Record<string, unkno
2
2
  export declare const stringsOption: (options: Record<string, unknown>, name: string, fallback: string[]) => string[];
3
3
  export declare const numberOption: (options: Record<string, unknown>, name: string, fallback: number) => number;
4
4
  export declare const flagOption: (options: Record<string, unknown>, name: string, fallback: boolean) => boolean;
5
- /** The refusal half of D-031, as one line at the top of a probe that cannot work without a list. */
6
5
  export declare const requireStrings: (probe: string, options: Record<string, unknown>, name: string) => string[];
7
- /** The same refusal for a number a probe cannot invent: a floor, a threshold, a count. */
8
6
  export declare const requireNumber: (probe: string, options: Record<string, unknown>, name: string) => number;
9
- /**
10
- * The `flags` option, validated, with `g` left out on purpose: every use of these patterns is a
11
- * scan for all matches, and `g` belongs to the call that scans — a shared `g` regex carries a
12
- * `lastIndex` between calls, which is how a scan silently skips half a page.
13
- */
7
+ /** `g` is left out: a shared `g` regex carries `lastIndex` between calls and silently skips half a page. */
14
8
  export declare const patternFlags: (probe: string, options: Record<string, unknown>) => string;
15
- /**
16
- * Compiled at the top of the run, never at the point of use, so a typo in one entry is a refusal
17
- * naming the pattern rather than a crash inside a page evaluation three URLs later.
18
- */
9
+ /** Compiled at the top of the run so a typo is a refusal naming the pattern, not a crash inside a page evaluation. */
19
10
  export declare const assertPatterns: (probe: string, patterns: string[], flags: string) => void;
package/dist/options.js CHANGED
@@ -18,7 +18,10 @@ var numberOption = (options, name, fallback) => {
18
18
  const value = options[name];
19
19
  return typeof value === "number" && Number.isFinite(value) ? value : fallback;
20
20
  };
21
- var flagOption = (options, name, fallback) => typeof options[name] === "boolean" ? options[name] : fallback;
21
+ var flagOption = (options, name, fallback) => {
22
+ const value = options[name];
23
+ return typeof value === "boolean" ? value : fallback;
24
+ };
22
25
  var requireStrings = (probe, options, name) => {
23
26
  const value = stringsOption(options, name, []);
24
27
  if (value.length === 0) {
@@ -1,14 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * The thing a buyer came to do, below the thing they did not.
4
- *
5
- * A Medusa storefront's phone PDP ordered gallery → full-screen 3D preview → (scroll) → name →
6
- * price → … → Add to cart: the buy box was two screens down behind a decoration. This is the one
7
- * class of the eight that is pure geometry — `getBoundingClientRect()` at a stated viewport, which
8
- * is why a viewport is part of the walk's input and not a probe option.
9
- *
10
- * A page with no buy box says nothing by default: a home page is not a defect, and a probe that
11
- * fired on every other URL of a walk would be turned off. `required: true` inverts that for a walk
12
- * whose URLs are all product pages.
13
- */
14
- export declare const buyBoxAboveFold: Probe;
1
+ export declare const buyBoxAboveFold: import('../index.js').Probe;
@@ -1,7 +1,8 @@
1
1
  // src/probes/buy-box-above-fold.ts
2
2
  import { collect } from "../browser.js";
3
3
  import { flagOption, numberOption, stringOption } from "../options.js";
4
- var buyBoxAboveFold = {
4
+ import { defineProbe } from "./define.js";
5
+ var buyBoxAboveFold = defineProbe({
5
6
  class: "buy-box-above-fold",
6
7
  id: "buy-box-above-fold",
7
8
  needs: (options) => {
@@ -18,7 +19,6 @@ var buyBoxAboveFold = {
18
19
  if (buyBox === null) {
19
20
  return flagOption(options, "required", false) ? [
20
21
  {
21
- class: "buy-box-above-fold",
22
22
  evidence: `no element matches "${selector}" on a page the walk requires one on`,
23
23
  severity: "major",
24
24
  url
@@ -30,7 +30,6 @@ var buyBoxAboveFold = {
30
30
  const found = [];
31
31
  if (other !== null && buyBox.top > other.top) {
32
32
  found.push({
33
- class: "buy-box-above-fold",
34
33
  evidence: `the buy box starts at ${Math.round(buyBox.top)}px, below "${above}" at ${Math.round(other.top)}px`,
35
34
  selector,
36
35
  severity: "major",
@@ -39,7 +38,6 @@ var buyBoxAboveFold = {
39
38
  }
40
39
  if (buyBox.top >= fold) {
41
40
  found.push({
42
- class: "buy-box-above-fold",
43
41
  evidence: `the buy box starts at ${Math.round(buyBox.top)}px, below the fold at ${Math.round(fold)}px`,
44
42
  selector,
45
43
  severity: "major",
@@ -48,7 +46,7 @@ var buyBoxAboveFold = {
48
46
  }
49
47
  return found;
50
48
  }
51
- };
49
+ });
52
50
  export {
53
51
  buyBoxAboveFold
54
52
  };
@@ -0,0 +1,7 @@
1
+ import type { Finding, FinishContext, Probe } from '../types.js';
2
+ export type Reported = Omit<Finding, 'class'>;
3
+ export type ProbeSpec = Omit<Probe, 'finish' | 'run'> & {
4
+ finish?: (context: FinishContext) => Reported[];
5
+ run: (...given: Parameters<Probe['run']>) => Promise<Reported[]>;
6
+ };
7
+ export declare const defineProbe: ({ finish, run, ...rest }: ProbeSpec) => Probe;
@@ -0,0 +1,12 @@
1
+ // src/probes/define.ts
2
+ var defineProbe = ({ finish, run, ...rest }) => {
3
+ const stamp = (found) => found.map((one) => ({ class: rest.class, ...one }));
4
+ return {
5
+ ...rest,
6
+ ...finish === undefined ? {} : { finish: (context) => stamp(finish(context)) },
7
+ run: async (...given) => stamp(await run(...given))
8
+ };
9
+ };
10
+ export {
11
+ defineProbe
12
+ };
@@ -1,16 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * A section that promises something in its heading and delivers nothing under it.
4
- *
5
- * The heading is the promise: "Care and repair", "How it works", "Shipping". A section carrying one
6
- * and no body is a heading a reader scrolls to and then leaves — and it renders exactly like a
7
- * section that is merely short, so nothing that looks at pixels or at status codes sees it.
8
- *
9
- * Media counts as a body. An illustrated section with a caption in the image is a section that says
10
- * something, and a probe that fired on it would be switched off.
11
- *
12
- * `selector` is REQUIRED (D-031): which containers are sections is a fact about a repo's markup —
13
- * `section`, `[data-block]`, a grid child — and defaulting to `section` would assume semantic HTML
14
- * and then report a clean page for every repo that does not write it.
15
- */
16
- export declare const emptySection: Probe;
1
+ export declare const emptySection: import('../index.js').Probe;
@@ -1,7 +1,8 @@
1
1
  // src/probes/empty-section.ts
2
2
  import { collect } from "../browser.js";
3
3
  import { stringOption } from "../options.js";
4
- var emptySection = {
4
+ import { defineProbe } from "./define.js";
5
+ var emptySection = defineProbe({
5
6
  class: "content-integrity",
6
7
  id: "empty-section",
7
8
  needs: (options) => {
@@ -16,14 +17,13 @@ var emptySection = {
16
17
  selector: stringOption("empty-section", options, "selector")
17
18
  });
18
19
  return hits.filter((hit) => hit.headingWords > 0 && hit.words <= hit.headingWords && hit.media === 0).map((hit) => ({
19
- class: "content-integrity",
20
20
  evidence: `the section renders ${hit.headingWords} heading word(s) and nothing else — no body text, no media`,
21
21
  selector: hit.selector,
22
22
  severity: "major",
23
23
  url
24
24
  }));
25
25
  }
26
- };
26
+ });
27
27
  export {
28
28
  emptySection
29
29
  };
@@ -1,20 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * A page that renders an error and answers 200.
4
- *
5
- * From a production incident: a framework error boundary was served with a 200, so every
6
- * curl-style health check, every uptime monitor and every load balancer read the surface as
7
- * healthy while nobody could use it. The status is the only thing those readers look at, and it
8
- * was the one thing that was wrong.
9
- *
10
- * The status comes from the page's OWN response, which is why it is on the context rather than
11
- * re-requested here: a second request asks a different question of a server that may not answer
12
- * twice the same way. A page that answered 400 or worse is a server that told the truth, and this
13
- * probe says nothing about it — `walk` itself refuses that URL, which is the other half of the
14
- * same rule.
15
- *
16
- * What an error surface LOOKS like is a framework's and a repo's own vocabulary — a digest line, a
17
- * boundary's copy, a status page's wording, in a language the kit does not know — so `patterns` is
18
- * required and the probe refuses without it (D-031).
19
- */
20
- export declare const errorPageStatus: Probe;
1
+ export declare const errorPageStatus: import('../index.js').Probe;
@@ -1,37 +1,14 @@
1
1
  // src/probes/error-page-status.ts
2
- import { collect } from "../browser.js";
3
- import {
4
- assertPatterns,
5
- numberOption,
6
- patternFlags,
7
- requireStrings,
8
- stringOption
9
- } from "../options.js";
10
- var errorPageStatus = {
2
+ import { numberOption } from "../options.js";
3
+ import { defineTextProbe } from "./text-probe.js";
4
+ var errorPageStatus = defineTextProbe({
11
5
  class: "error-page-status",
6
+ evidence: (hit, status) => `"${hit.text}" is on a page that answered ${status} — every health check reads that as healthy`,
12
7
  id: "error-page-status",
13
- needs: (options) => {
14
- const patterns = requireStrings("error-page-status", options, "patterns");
15
- assertPatterns("error-page-status", patterns, patternFlags("error-page-status", options));
16
- },
17
- run: async (page, { options, status, url }) => {
18
- if (status >= numberOption(options, "honestFrom", 400))
19
- return [];
20
- const hits = await collect(page, {
21
- flags: patternFlags("error-page-status", options),
22
- kind: "text",
23
- patterns: requireStrings("error-page-status", options, "patterns"),
24
- scope: stringOption("error-page-status", options, "scope", "")
25
- });
26
- return hits.map((hit) => ({
27
- class: "error-page-status",
28
- evidence: `"${hit.text}" is on a page that answered ${status} — every health check reads that as healthy`,
29
- selector: hit.selector,
30
- severity: "blocking",
31
- url
32
- }));
33
- }
34
- };
8
+ option: "patterns",
9
+ severity: "blocking",
10
+ skip: (options, status) => status >= numberOption(options, "honestFrom", 400)
11
+ });
35
12
  export {
36
13
  errorPageStatus
37
14
  };
@@ -1,14 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * Claims the repo has said it cannot stand behind, in the text a reader can actually read.
4
- *
5
- * A Medusa storefront's home page carried "4.9/5 average rating", "2,400+ brands ship with us" and
6
- * "12M+ units printed to date" on a business that had not shipped a unit. Which sentences those are
7
- * is a fact about a company, never about a kit, so `claims` is required and the probe refuses
8
- * without it (D-031): a claim scanner that ran with an empty list would report a clean page for
9
- * every repo that had not configured it.
10
- *
11
- * `innerText`, not the markup: a claim in a comment or in a `hidden` element is a claim nobody was
12
- * shown, and reporting it sends the fixer to a string that is already dead.
13
- */
14
- export declare const fabricatedClaim: Probe;
1
+ export declare const fabricatedClaim: import('../index.js').Probe;
@@ -1,29 +1,12 @@
1
1
  // src/probes/fabricated-claim.ts
2
- import { collect } from "../browser.js";
3
- import { assertPatterns, patternFlags, requireStrings, stringOption } from "../options.js";
4
- var fabricatedClaim = {
2
+ import { defineTextProbe } from "./text-probe.js";
3
+ var fabricatedClaim = defineTextProbe({
5
4
  class: "fabricated-claim",
5
+ evidence: (hit) => `"${hit.text}" is on the page, matching /${hit.pattern}/`,
6
6
  id: "fabricated-claim",
7
- needs: (options) => {
8
- const claims = requireStrings("fabricated-claim", options, "claims");
9
- assertPatterns("fabricated-claim", claims, patternFlags("fabricated-claim", options));
10
- },
11
- run: async (page, { options, url }) => {
12
- const hits = await collect(page, {
13
- flags: patternFlags("fabricated-claim", options),
14
- kind: "text",
15
- patterns: requireStrings("fabricated-claim", options, "claims"),
16
- scope: stringOption("fabricated-claim", options, "scope", "")
17
- });
18
- return hits.map((hit) => ({
19
- class: "fabricated-claim",
20
- evidence: `"${hit.text}" is on the page, matching /${hit.pattern}/`,
21
- selector: hit.selector,
22
- severity: "blocking",
23
- url
24
- }));
25
- }
26
- };
7
+ option: "claims",
8
+ severity: "blocking"
9
+ });
27
10
  export {
28
11
  fabricatedClaim
29
12
  };
@@ -1,14 +1 @@
1
- import { type Probe } from '../types.js';
2
- /**
3
- * A visitor who never signed in, shown somebody's session.
4
- *
5
- * A Medusa storefront's default session object carried a profile, so an anonymous first-time
6
- * visitor with no cookies was shown "Your account — Dana Reyes · 4 orders · Sign out". `walk` gives
7
- * every page a context with no cookies and no storage, which is what makes the reading mean
8
- * anything: whatever is on the page was rendered for somebody who is not signed in.
9
- *
10
- * What "signed in" LOOKS like is a repo's own vocabulary — a `data-` attribute, a menu, a word in a
11
- * language the kit does not know — so the probe refuses until it is told (D-031), by selector or by
12
- * text or both.
13
- */
14
- export declare const fakeSession: Probe;
1
+ export declare const fakeSession: import('../index.js').Probe;
@@ -2,8 +2,9 @@
2
2
  import { collect } from "../browser.js";
3
3
  import { stringsOption } from "../options.js";
4
4
  import { WalkError } from "../types.js";
5
+ import { defineProbe } from "./define.js";
5
6
  var escapeForRegex = (value) => value.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&");
6
- var fakeSession = {
7
+ var fakeSession = defineProbe({
7
8
  class: "fake-session",
8
9
  id: "fake-session",
9
10
  needs: (options) => {
@@ -24,14 +25,12 @@ var fakeSession = {
24
25
  scope: ""
25
26
  });
26
27
  const bySelector = present.filter((hit) => hit.present).map((hit) => ({
27
- class: "fake-session",
28
28
  evidence: `a context nobody signed in to renders ${hit.selector}`,
29
29
  selector: hit.selector,
30
30
  severity: "blocking",
31
31
  url
32
32
  }));
33
33
  const byText = said.map((hit) => ({
34
- class: "fake-session",
35
34
  evidence: `a context nobody signed in to reads "${hit.text}"`,
36
35
  selector: hit.selector,
37
36
  severity: "blocking",
@@ -39,7 +38,7 @@ var fakeSession = {
39
38
  }));
40
39
  return [...bySelector, ...byText];
41
40
  }
42
- };
41
+ });
43
42
  export {
44
43
  fakeSession
45
44
  };
@@ -1,9 +1,5 @@
1
1
  import type { Probe } from '../types.js';
2
2
  export declare const PROBES: Probe[];
3
3
  export declare const probeById: (id: string) => Probe;
4
- /**
5
- * The probes a walk runs when nobody named any: the ones whose reading is a property of any page.
6
- * The other five need a repo's own list to mean anything (D-031) and would refuse the run, so a
7
- * default set that included them would make `geonosis-walk <url>` fail on every repo.
8
- */
4
+ /** The probes that need no option; the rest refuse the run without a repo's own list (D-031). */
9
5
  export declare const DEFAULT_PROBES: Probe[];
@@ -1,15 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * An element that declares its own surface, and is invisible on the one behind it.
4
- *
5
- * A Medusa storefront's t34 shipped a "cream" chip on a cream page and t22 a skeleton on paper;
6
- * both passed a screenshot review, because a JPEG of two colours a reader cannot tell apart looks
7
- * exactly like a JPEG of a surface that is there. The DOM tells the truth, so the probe reads
8
- * painted backgrounds and computes the WCAG ratio rather than looking at pixels.
9
- *
10
- * It only judges an element that is trying to be a distinct surface and is distinguished by nothing
11
- * else: an opaque background of its own, no background image, no border, no shadow, no outline, and
12
- * a box that does not simply repaint the one behind it. Every one of those exclusions is a shape a
13
- * designer used deliberately, and a probe that fired on them would be switched off within a week.
14
- */
15
- export declare const lightOnLight: Probe;
1
+ export declare const lightOnLight: import('../index.js').Probe;
@@ -1,7 +1,8 @@
1
1
  // src/probes/light-on-light.ts
2
2
  import { collect } from "../browser.js";
3
3
  import { numberOption, stringOption, stringsOption } from "../options.js";
4
- var lightOnLight = {
4
+ import { defineProbe } from "./define.js";
5
+ var lightOnLight = defineProbe({
5
6
  class: "light-on-light",
6
7
  id: "light-on-light",
7
8
  run: async (page, { options, url }) => {
@@ -13,14 +14,13 @@ var lightOnLight = {
13
14
  selector: stringOption("light-on-light", options, "selector", "*")
14
15
  });
15
16
  return hits.map((hit) => ({
16
- class: "light-on-light",
17
17
  evidence: `${hit.background} on ${hit.container} (${hit.containerSelector}) — contrast ${hit.contrast.toFixed(2)}, floor ${minContrast}`,
18
18
  selector: hit.selector,
19
19
  severity: "major",
20
20
  url
21
21
  }));
22
22
  }
23
- };
23
+ });
24
24
  export {
25
25
  lightOnLight
26
26
  };
@@ -1,14 +1,2 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * Controls that go nowhere, and links that go somewhere gone.
4
- *
5
- * The dead half is a DOM read: an `href` that is absent, empty, `#` or `javascript:` is a control a
6
- * buyer will click and nothing will happen — a Medusa storefront shipped a kit default's "Looking
7
- * for a gift?" pointing at `#` on every category page. The broken half is a request: same-origin
8
- * links are HEAD-ed (GET when a server answers 405 or 501, which some do), and anything from 400 up
9
- * is a link that 404s in front of the buyer.
10
- *
11
- * Another origin is left alone unless asked for: a gate that fails because someone else's site was
12
- * down is a gate that gets disabled, and it would make the walk a crawler of the whole internet.
13
- */
14
- export declare const linkIntegrity: Probe;
1
+ /** Another origin is left alone unless asked: a gate that fails when someone else's site is down gets disabled. */
2
+ export declare const linkIntegrity: import('../index.js').Probe;
@@ -1,13 +1,16 @@
1
1
  // src/probes/link-integrity.ts
2
+ import { errorMessage } from "@geonosis/base";
2
3
  import { collect } from "../browser.js";
3
- import { flagOption, stringOption, stringsOption } from "../options.js";
4
+ import { assertPatterns, flagOption, stringOption, stringsOption } from "../options.js";
5
+ import { defineProbe } from "./define.js";
4
6
  var DEAD = ["", "#"];
5
- var linkIntegrity = {
7
+ var linkIntegrity = defineProbe({
6
8
  class: "link-integrity",
7
9
  id: "link-integrity",
8
10
  run: async (page, { memo, options, url }) => {
9
11
  const dead = stringsOption(options, "deadHrefs", DEAD);
10
12
  const ignore = stringsOption(options, "ignore", []);
13
+ assertPatterns("link-integrity", ignore, "");
11
14
  const checkExternal = flagOption(options, "checkExternal", false);
12
15
  const origin = new URL(url).origin;
13
16
  const hits = await collect(page, {
@@ -19,7 +22,6 @@ var linkIntegrity = {
19
22
  const href = hit.href;
20
23
  if (href === null || dead.includes(href.trim()) || href.trim().startsWith("javascript:")) {
21
24
  found.push({
22
- class: "link-integrity",
23
25
  evidence: `dead control: href ${href === null ? "absent" : `"${href}"`} on "${hit.text}"`,
24
26
  selector: hit.selector,
25
27
  severity: "major",
@@ -38,8 +40,7 @@ var linkIntegrity = {
38
40
  if (status < 400)
39
41
  continue;
40
42
  found.push({
41
- class: "link-integrity",
42
- evidence: `${target} answered ${status}`,
43
+ evidence: unreachable(memo, target) ?? `${target} answered ${status}`,
43
44
  selector: hit.selector,
44
45
  severity: "blocking",
45
46
  url
@@ -47,9 +48,14 @@ var linkIntegrity = {
47
48
  }
48
49
  return found;
49
50
  }
51
+ });
52
+ var unreachable = (memo, target) => {
53
+ const why = memo.get(`${statusKey(target)}:why`);
54
+ return typeof why === "string" ? `${target} could not be reached: ${why}` : undefined;
50
55
  };
56
+ var statusKey = (target) => `link-integrity:${target}`;
51
57
  var statusOf = async (page, memo, target) => {
52
- const key = `link-integrity:${target}`;
58
+ const key = statusKey(target);
53
59
  const seen = memo.get(key);
54
60
  if (typeof seen === "number")
55
61
  return seen;
@@ -59,7 +65,7 @@ var statusOf = async (page, memo, target) => {
59
65
  status = head.status() === 405 || head.status() === 501 ? (await page.request.get(target, { failOnStatusCode: false })).status() : head.status();
60
66
  } catch (error) {
61
67
  status = 599;
62
- memo.set(`${key}:why`, error.message);
68
+ memo.set(`${key}:why`, errorMessage(error));
63
69
  }
64
70
  memo.set(key, status);
65
71
  return status;
@@ -1,14 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * A price on the page in a shape this repo does not write.
4
- *
5
- * `£24` beside `£24.00` is not a rendering bug and not a broken page; it is two answers to "what
6
- * does a price look like here", and the one a reader meets is whichever component happened to
7
- * format it. A currency that lost its minor units, a thousands separator that appears on one page
8
- * and not the next, a bare number where every other price carries a symbol.
9
- *
10
- * `accept` is REQUIRED (D-031): what a correct price looks like is a fact about a business, never
11
- * about a kit, and a probe that ran with no accepted shape would report a clean page for every repo
12
- * that had not configured it.
13
- */
14
- export declare const moneyFormat: Probe;
1
+ export declare const moneyFormat: import('../index.js').Probe;
@@ -1,9 +1,10 @@
1
1
  // src/probes/money-format.ts
2
2
  import { collect } from "../browser.js";
3
3
  import { assertPatterns, patternFlags, requireStrings, stringOption } from "../options.js";
4
+ import { defineProbe } from "./define.js";
4
5
  var AMOUNT = String.raw`\d{1,3}(?:[.,]\d{3})*(?:[.,]\d{1,2})?`;
5
6
  var MONEY = String.raw`[€$£¥₺]\s?${AMOUNT}|${AMOUNT}\s?(?:USD|EUR|GBP|TRY|JPY)\b`;
6
- var moneyFormat = {
7
+ var moneyFormat = defineProbe({
7
8
  class: "content-integrity",
8
9
  id: "money-format",
9
10
  needs: (options) => {
@@ -20,14 +21,13 @@ var moneyFormat = {
20
21
  scope: stringOption("money-format", options, "scope", "")
21
22
  });
22
23
  return hits.filter((hit) => !accept.some((one) => one.test(hit.text.trim()))).map((hit) => ({
23
- class: "content-integrity",
24
24
  evidence: `"${hit.text}" is money in a shape this repo does not accept`,
25
25
  selector: hit.selector,
26
26
  severity: "major",
27
27
  url
28
28
  }));
29
29
  }
30
- };
30
+ });
31
31
  export {
32
32
  moneyFormat
33
33
  };
@@ -1,13 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * The operations side, showing through into what a customer is offered.
4
- *
5
- * A Medusa storefront's checkout offered a US buyer of 5,000 mailer boxes four ocean-freight options — the
6
- * INBOUND freight the logistics side books, registered in the same seed as store-visible shipping.
7
- * The words that mean "internal" are a repo's own vocabulary, so `patterns` is required (D-031).
8
- *
9
- * `scope` is what separates this from a page-wide word hunt: the same words in a footnote about how
10
- * the company sources board are not a leak. The probe's own fixture pair is exactly that — the same
11
- * two phrases inside the delivery fieldset and outside it.
12
- */
13
- export declare const opsLeakage: Probe;
1
+ export declare const opsLeakage: import('../index.js').Probe;
@@ -1,29 +1,12 @@
1
1
  // src/probes/ops-leakage.ts
2
- import { collect } from "../browser.js";
3
- import { assertPatterns, patternFlags, requireStrings, stringOption } from "../options.js";
4
- var opsLeakage = {
2
+ import { defineTextProbe } from "./text-probe.js";
3
+ var opsLeakage = defineTextProbe({
5
4
  class: "ops-leakage",
5
+ evidence: (hit) => `"${hit.text}" is offered to the customer, matching /${hit.pattern}/`,
6
6
  id: "ops-leakage",
7
- needs: (options) => {
8
- const patterns = requireStrings("ops-leakage", options, "patterns");
9
- assertPatterns("ops-leakage", patterns, patternFlags("ops-leakage", options));
10
- },
11
- run: async (page, { options, url }) => {
12
- const hits = await collect(page, {
13
- flags: patternFlags("ops-leakage", options),
14
- kind: "text",
15
- patterns: requireStrings("ops-leakage", options, "patterns"),
16
- scope: stringOption("ops-leakage", options, "scope", "")
17
- });
18
- return hits.map((hit) => ({
19
- class: "ops-leakage",
20
- evidence: `"${hit.text}" is offered to the customer, matching /${hit.pattern}/`,
21
- selector: hit.selector,
22
- severity: "blocking",
23
- url
24
- }));
25
- }
26
- };
7
+ option: "patterns",
8
+ severity: "blocking"
9
+ });
27
10
  export {
28
11
  opsLeakage
29
12
  };
@@ -1,13 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * A page the walk was told about that nothing on the walk links to.
4
- *
5
- * It answers 200, it renders, every per-page probe passes it — and the only way a reader reaches it
6
- * is by being handed the URL. That is not a fact any one page can know, which is why this is the
7
- * probe with a report-level half: `run` records what each page links to, and `finish` names the
8
- * walked URLs nothing pointed at.
9
- *
10
- * A page that is deliberately unlinked — a campaign landing page, a print view — goes in `entry`,
11
- * which is the repo's list and empty by default.
12
- */
13
- export declare const orphanUrl: Probe;
1
+ export declare const orphanUrl: import('../index.js').Probe;
@@ -1,6 +1,7 @@
1
1
  // src/probes/orphan-url.ts
2
2
  import { collect } from "../browser.js";
3
3
  import { stringOption, stringsOption } from "../options.js";
4
+ import { defineProbe } from "./define.js";
4
5
  var MEMO = "orphan-url:linked";
5
6
  var linkedIn = (memo) => {
6
7
  const seen = memo.get(MEMO);
@@ -18,7 +19,7 @@ var bare = (url) => {
18
19
  return url;
19
20
  }
20
21
  };
21
- var orphanUrl = {
22
+ var orphanUrl = defineProbe({
22
23
  class: "content-integrity",
23
24
  finish: ({ memo, options, urls }) => {
24
25
  if (urls.length < 2)
@@ -26,7 +27,6 @@ var orphanUrl = {
26
27
  const linked = linkedIn(memo);
27
28
  const entry = stringsOption(options, "entry", []).map(bare);
28
29
  return urls.filter((url) => !linked.has(bare(url)) && !entry.includes(bare(url))).map((url) => ({
29
- class: "content-integrity",
30
30
  evidence: `no page in this walk links to ${bare(url)} — it is reachable only by being handed the URL`,
31
31
  severity: "major",
32
32
  url
@@ -48,7 +48,7 @@ var orphanUrl = {
48
48
  }
49
49
  return [];
50
50
  }
51
- };
51
+ });
52
52
  export {
53
53
  orphanUrl
54
54
  };
@@ -1,14 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * One mark in many slots, and marks whose own name says they are stand-ins.
4
- *
5
- * A Medusa storefront shipped ONE green-square SVG for thirteen content-icon keys and one stacked-shippers
6
- * photo for four of six category tiles. A screenshot showed thirteen shapes; the DOM showed one
7
- * repeated, which is what `new Set(signatures).size` is for. A signature is the resolved `src` of
8
- * an image or the geometry of an SVG's own shapes, so two files that draw the same thing under
9
- * different names still read as different marks, and one file under two names reads as one.
10
- *
11
- * `signatures` is the second half: patterns matched against the signature AND the element's
12
- * alt/aria-label/title, because the audit's own placeholder said "placeholder" in its label.
13
- */
14
- export declare const placeholderAsset: Probe;
1
+ export declare const placeholderAsset: import('../index.js').Probe;
@@ -1,7 +1,8 @@
1
1
  // src/probes/placeholder-asset.ts
2
2
  import { collect } from "../browser.js";
3
3
  import { assertPatterns, numberOption, patternFlags, stringOption, stringsOption } from "../options.js";
4
- var placeholderAsset = {
4
+ import { defineProbe } from "./define.js";
5
+ var placeholderAsset = defineProbe({
5
6
  class: "placeholder-asset",
6
7
  id: "placeholder-asset",
7
8
  run: async (page, { options, url }) => {
@@ -15,7 +16,6 @@ var placeholderAsset = {
15
16
  scope: stringOption("placeholder-asset", options, "scope", "body")
16
17
  });
17
18
  const named = hits.filter((hit) => signatures.some((pattern) => new RegExp(pattern, flags).test(`${hit.signature} ${hit.label}`))).map((hit) => ({
18
- class: "placeholder-asset",
19
19
  evidence: `asset matches a placeholder signature: ${hit.signature.slice(0, 120)}`,
20
20
  selector: hit.selector,
21
21
  severity: "major",
@@ -26,7 +26,6 @@ var placeholderAsset = {
26
26
  bySignature.set(hit.signature, [...bySignature.get(hit.signature) ?? [], hit.selector]);
27
27
  }
28
28
  const repeated = [...bySignature.entries()].filter(([, selectors]) => selectors.length > maxRepeats).map(([signature, selectors]) => ({
29
- class: "placeholder-asset",
30
29
  evidence: `the same asset in ${selectors.length} slots, more than the ${maxRepeats} allowed — ${signature.slice(0, 120)}`,
31
30
  selector: selectors[0],
32
31
  severity: "major",
@@ -34,7 +33,7 @@ var placeholderAsset = {
34
33
  }));
35
34
  return [...named, ...repeated];
36
35
  }
37
- };
36
+ });
38
37
  export {
39
38
  placeholderAsset
40
39
  };
@@ -1,14 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * A page that offers to sell something the backend does not have.
4
- *
5
- * A Medusa storefront rendered full product pages with an Add to cart for three handles that were
6
- * in no live store: a buyer could configure `standard-mailer-box` and never place an order for it.
7
- * The page cannot know this on its own, so the authoritative set is required (D-031) — it comes
8
- * from the store's own API, the seed, or wherever the repo's truth actually lives.
9
- *
10
- * The affordance matters as much as the id: a retired handle that renders an explainer and no way
11
- * to buy is the FIX (a redirect stub), not the bug, and a probe that could not tell them apart
12
- * would fire on every correct retirement.
13
- */
14
- export declare const stubOnlyEntity: Probe;
1
+ export declare const stubOnlyEntity: import('../index.js').Probe;
@@ -1,7 +1,8 @@
1
1
  // src/probes/stub-only-entity.ts
2
2
  import { collect } from "../browser.js";
3
3
  import { requireStrings, stringOption } from "../options.js";
4
- var stubOnlyEntity = {
4
+ import { defineProbe } from "./define.js";
5
+ var stubOnlyEntity = defineProbe({
5
6
  class: "stub-only-entity",
6
7
  id: "stub-only-entity",
7
8
  needs: (options) => {
@@ -17,14 +18,13 @@ var stubOnlyEntity = {
17
18
  selector: stringOption("stub-only-entity", options, "selector", `[${attribute}]`)
18
19
  });
19
20
  return hits.filter((hit) => hit.id !== "" && hit.affordance && !known.has(hit.id)).map((hit) => ({
20
- class: "stub-only-entity",
21
21
  evidence: `"${hit.id}" can be bought here and is in no authoritative set of ${known.size} entities`,
22
22
  selector: hit.selector,
23
23
  severity: "blocking",
24
24
  url
25
25
  }));
26
26
  }
27
- };
27
+ });
28
28
  export {
29
29
  stubOnlyEntity
30
30
  };
@@ -0,0 +1,12 @@
1
+ import { type TextHit } from '../browser.js';
2
+ import type { DefectClass, Probe, Severity } from '../types.js';
3
+ type TextProbeSpec = {
4
+ class: DefectClass;
5
+ evidence: (hit: TextHit, status: number) => string;
6
+ id: string;
7
+ option: string;
8
+ severity: Severity;
9
+ skip?: (options: Record<string, unknown>, status: number) => boolean;
10
+ };
11
+ export declare const defineTextProbe: ({ class: defect, evidence, id, option, severity, skip }: TextProbeSpec) => Probe;
12
+ export {};
@@ -0,0 +1,37 @@
1
+ // src/probes/text-probe.ts
2
+ import { collect } from "../browser.js";
3
+ import { assertPatterns, patternFlags, requireStrings, stringOption } from "../options.js";
4
+ import { defineProbe } from "./define.js";
5
+ var defineTextProbe = ({
6
+ class: defect,
7
+ evidence,
8
+ id,
9
+ option,
10
+ severity,
11
+ skip
12
+ }) => defineProbe({
13
+ class: defect,
14
+ id,
15
+ needs: (options) => {
16
+ assertPatterns(id, requireStrings(id, options, option), patternFlags(id, options));
17
+ },
18
+ run: async (page, { options, status, url }) => {
19
+ if (skip?.(options, status))
20
+ return [];
21
+ const hits = await collect(page, {
22
+ flags: patternFlags(id, options),
23
+ kind: "text",
24
+ patterns: requireStrings(id, options, option),
25
+ scope: stringOption(id, options, "scope", "")
26
+ });
27
+ return hits.map((hit) => ({
28
+ evidence: evidence(hit, status),
29
+ selector: hit.selector,
30
+ severity,
31
+ url
32
+ }));
33
+ }
34
+ });
35
+ export {
36
+ defineTextProbe
37
+ };
@@ -1,14 +1 @@
1
- import type { Probe } from '../types.js';
2
- /**
3
- * A page that renders correctly and says almost nothing.
4
- *
5
- * The page is not broken: it has a heading, a layout, a 200. It has three sentences where a reader
6
- * came for an answer, and every gate in the stack reads it as fine — a screenshot looks like a
7
- * page, a link check passes, a status check passes. Only counting the words a reader is actually
8
- * shown says otherwise.
9
- *
10
- * `minWords` is REQUIRED (D-031), because how much a page owes a reader is a property of what the
11
- * page is for — a checkout step owes almost nothing, a guide owes a lot — and a floor the kit
12
- * picked would be somebody else's idea of thin applied to every repo that never chose one.
13
- */
14
- export declare const thinPage: Probe;
1
+ export declare const thinPage: import('../index.js').Probe;
@@ -1,7 +1,8 @@
1
1
  // src/probes/thin-page.ts
2
2
  import { collect } from "../browser.js";
3
3
  import { requireNumber, stringOption } from "../options.js";
4
- var thinPage = {
4
+ import { defineProbe } from "./define.js";
5
+ var thinPage = defineProbe({
5
6
  class: "content-integrity",
6
7
  id: "thin-page",
7
8
  needs: (options) => {
@@ -17,14 +18,13 @@ var thinPage = {
17
18
  selector: scope
18
19
  });
19
20
  return hits.filter((hit) => hit.words < minWords).map((hit) => ({
20
- class: "content-integrity",
21
21
  evidence: `${scope} renders ${hit.words} word(s), ${hit.headingWords} of them headings — the floor is ${minWords}`,
22
22
  ...hit.selector === "" ? {} : { selector: hit.selector },
23
23
  severity: "major",
24
24
  url
25
25
  }));
26
26
  }
27
- };
27
+ });
28
28
  export {
29
29
  thinPage
30
30
  };
package/dist/types.d.ts CHANGED
@@ -1,27 +1,9 @@
1
1
  import type { Page } from 'playwright';
2
- /**
3
- * The ten defect classes the walk is mechanical about.
4
- *
5
- * Six are a storefront CX audit's own groups, generalised; `light-on-light` is that audit's
6
- * browser-proof probe (a cream chip on a cream page reads as broken, and the screenshot says it is
7
- * fine), `buy-box-above-fold` is one of its groups promoted to a class, and `error-page-status`
8
- * came from an error surface served with a 200, which every health check read as healthy.
9
- * `content-integrity` is the tenth: a page that renders correctly and says nothing — a section with
10
- * a heading and no body, a price in a shape the repo does not write, a page nothing links to. Four
11
- * of an audit's own defects were filed under `fabricated-claim`'s forbidden-string engine for want
12
- * of it, which is a class borrowing another class's mechanism. What the ten do NOT cover — a number that disagrees with a number on another page, copy
13
- * that promises a control nobody built, four levels of taxonomy for fourteen products — is in
14
- * `docs/walk-review-inventory-2026-08-30.md`, and stays the walker's judgement. A green walk report
15
- * is not a clean surface.
16
- */
2
+ /** A green walk is not a clean surface: what these classes do not cover is in docs/walk-review-inventory-2026-08-30.md. */
17
3
  export type DefectClass = 'buy-box-above-fold' | 'content-integrity' | 'error-page-status' | 'fabricated-claim' | 'fake-session' | 'light-on-light' | 'link-integrity' | 'ops-leakage' | 'placeholder-asset' | 'stub-only-entity';
18
4
  /** `blocking` breaks trust or the buy path; `major` confuses the buyer; `minor` is polish. */
19
5
  export type Severity = 'blocking' | 'major' | 'minor';
20
- /**
21
- * One defect, as the build plan's contract states it. `evidence` is the measured value — the two
22
- * colours and the ratio, the status code, the matched text — never a restatement of the class,
23
- * because the reader's next question is always "what did you actually see".
24
- */
6
+ /** `evidence` is the measured value (colours and ratio, status code, matched text), never a restatement of the class. */
25
7
  export type Finding = {
26
8
  class: DefectClass;
27
9
  evidence: string;
@@ -34,18 +16,10 @@ export type Viewport = {
34
16
  width: number;
35
17
  };
36
18
  export type ProbeContext = {
37
- /**
38
- * One walk, one memo. `link-integrity` would otherwise send a HEAD request for the same footer
39
- * link once per page, which is forty requests for one answer on a forty-page walk.
40
- */
19
+ /** One memo per walk: `link-integrity` would otherwise HEAD the same footer link once per page. */
41
20
  memo: Map<string, unknown>;
42
- /** This probe's own block of the `options` map, already narrowed by id. */
43
21
  options: Record<string, unknown>;
44
- /**
45
- * The status the page's OWN response carried. Read from `page.goto`, because nothing on a loaded
46
- * page remembers it and a second request for it would ask a different question of a server that
47
- * may not answer twice the same way.
48
- */
22
+ /** From `page.goto`'s own response; nothing on a loaded page remembers it. */
49
23
  status: number;
50
24
  url: string;
51
25
  viewport: Viewport;
@@ -53,25 +27,12 @@ export type ProbeContext = {
53
27
  export type Probe = {
54
28
  class: DefectClass;
55
29
  id: string;
56
- /**
57
- * D-031, per probe: a probe that cannot mean anything without an option refuses the run when it
58
- * is missing, naming the option. Five of the eight have one — a claim list, an authoritative id
59
- * set, what "signed in" looks like, the operations patterns, the buy-box selector — because none
60
- * of those five can have a default that is true of a repo that has not configured it. A probe
61
- * that ran and reported nothing because nobody told it what to look for is indistinguishable
62
- * from a clean page.
63
- */
30
+ /** D-031: refuses the run when a required option is missing; a probe with nothing to look for is indistinguishable from a clean page. */
64
31
  needs?: (options: Record<string, unknown>) => void;
65
32
  run: (page: Page, context: ProbeContext) => Promise<Finding[]>;
66
- /**
67
- * The reading no single page can make. `orphan-url` is the reason it exists: whether anything
68
- * links to a page is a fact about the whole walk, and a probe handed one page at a time can only
69
- * record what it saw. Called once, after every page, with the pages walked; each finding is filed
70
- * against the page whose `url` it names.
71
- */
33
+ /** The reading no single page can make, called once after every page; each finding is filed against the page whose `url` it names. */
72
34
  finish?: (context: FinishContext) => Finding[];
73
35
  };
74
- /** What a probe knows once the walk is over: its own memo, its options, and where it went. */
75
36
  export type FinishContext = {
76
37
  memo: Map<string, unknown>;
77
38
  options: Record<string, unknown>;
@@ -82,11 +43,7 @@ export type PageReport = {
82
43
  url: string;
83
44
  };
84
45
  export type WalkReport = {
85
- /**
86
- * Keyed by the classes that RAN. A zero therefore means "probed for, none found"; a class that is
87
- * absent was never looked for. All eight keys with five zeros would read as five clean gates
88
- * nobody enabled.
89
- */
46
+ /** Keyed by the classes that ran: a zero means probed for, none found; an absent class was never looked for. */
90
47
  counts: Partial<Record<DefectClass, number>>;
91
48
  finishedAt: string;
92
49
  pages: PageReport[];
@@ -94,11 +51,7 @@ export type WalkReport = {
94
51
  startedAt: string;
95
52
  viewport: Viewport;
96
53
  };
97
- /**
98
- * The walk could not run: no browser, no URL, a page that did not answer, a probe with no option it
99
- * needs. Distinct from "the walk ran and found nothing", which is a report with zeros in it — the
100
- * CLI turns this into exit 2 and that into exit 0.
101
- */
54
+ /** The walk could not run (exit 2), as distinct from a run that found nothing. */
102
55
  export declare class WalkError extends Error {
103
56
  constructor(message: string);
104
57
  }
package/dist/walk-cli.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { mkdirSync, writeFileSync } from "node:fs";
3
3
  import { dirname, resolve } from "node:path";
4
4
  import { parseArgs } from "node:util";
5
+ import { errorMessage } from "@geonosis/base";
5
6
  import { configPath, configShape, loadWalkConfig, parseViewport } from "./config.js";
6
7
  import { PROBES, probeById } from "./probes/index.js";
7
8
  import { WalkError } from "./types.js";
@@ -27,7 +28,7 @@ var parse = (argv) => {
27
28
  ...values.viewport === undefined ? {} : { viewport: values.viewport }
28
29
  };
29
30
  } catch (error) {
30
- throw new WalkError(`${error instanceof Error ? error.message : String(error)} — run geonosis-walk --help`);
31
+ throw new WalkError(`${errorMessage(error)} — run geonosis-walk --help`);
31
32
  }
32
33
  };
33
34
  var USAGE = `geonosis-walk [url…] [--config <geonosis.json>] [--probe <id>] [--viewport <WxH>] [--report <path>]
@@ -78,7 +79,7 @@ var main = async () => {
78
79
  try {
79
80
  return probeById(id);
80
81
  } catch (error) {
81
- throw new WalkError(error.message);
82
+ throw new WalkError(errorMessage(error));
82
83
  }
83
84
  });
84
85
  const report = await walk({
@@ -99,7 +100,7 @@ ${at}
99
100
  main().then((code) => {
100
101
  process.exitCode = code;
101
102
  }, (error) => {
102
- process.stderr.write(`${error instanceof Error ? error.message : String(error)}
103
+ process.stderr.write(`${errorMessage(error)}
103
104
  `);
104
105
  process.exitCode = 2;
105
106
  });
package/dist/walk.d.ts CHANGED
@@ -1,23 +1,12 @@
1
1
  import type { Browser } from 'playwright';
2
2
  import type { Probe, Viewport, WalkReport } from './types.js';
3
3
  export type WalkInput = {
4
- /** An already-open browser, for a walker driving a flow. Absent means launch one and close it. */
5
4
  browser?: Browser;
6
- /** Each probe's options, keyed by probe id. */
7
5
  options?: Record<string, Record<string, unknown>>;
8
6
  probes: Probe[];
9
7
  urls: string[];
10
8
  viewport: Viewport;
11
9
  };
12
- /**
13
- * Every URL, every probe, one report.
14
- *
15
- * Each page gets its OWN context, with no cookies and no storage. That is what makes `fake-session`
16
- * mean anything, and it is why `walk` is the stateless surface: a walker that has to reach a
17
- * checkout with a cart in it drives its own page and calls `probe.run(page, context)` directly.
18
- *
19
- * Refusals come BEFORE the browser opens, and a page that did not answer stops the walk. A report
20
- * with no findings in it must only ever mean the probes looked and found none.
21
- */
10
+ /** Each page gets its own context with no cookies or storage, which is what gives `fake-session` meaning. Refusals come before the browser opens and an unanswered page stops the walk. */
22
11
  export declare const walk: ({ browser, options, probes, urls, viewport }: WalkInput) => Promise<WalkReport>;
23
12
  export declare const findingsIn: (report: WalkReport) => number;
package/dist/walk.js CHANGED
@@ -1,16 +1,17 @@
1
1
  // src/walk.ts
2
+ import { errorMessage } from "@geonosis/base";
2
3
  import { WalkError } from "./types.js";
3
4
  var launch = async () => {
4
5
  let chromium;
5
6
  try {
6
7
  ({ chromium } = await import("playwright"));
7
8
  } catch (error) {
8
- throw new WalkError(`playwright is a peer dependency of @geonosis/walk and is not installed: ${error.message}`);
9
+ throw new WalkError(`playwright is a peer dependency of @geonosis/walk and is not installed: ${errorMessage(error)}`);
9
10
  }
10
11
  try {
11
12
  return await chromium.launch({ headless: true });
12
13
  } catch (error) {
13
- throw new WalkError(`chromium would not launch — \`npx playwright install chromium\`: ${error.message}`);
14
+ throw new WalkError(`chromium would not launch — \`npx playwright install chromium\`: ${errorMessage(error)}`);
14
15
  }
15
16
  };
16
17
  var walk = async ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geonosis/walk",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "description": "The customer walk as a gate: eight computed-DOM probes over a list of URLs, one JSON report, and an exit code that tells a could-not-run from a clean page.",
6
6
  "keywords": [
@@ -35,6 +35,9 @@
35
35
  "bin",
36
36
  "dist"
37
37
  ],
38
+ "dependencies": {
39
+ "@geonosis/base": "3.2.0"
40
+ },
38
41
  "peerDependencies": {
39
42
  "playwright": ">=1.40.0"
40
43
  },
@@ -44,7 +47,7 @@
44
47
  }
45
48
  },
46
49
  "devDependencies": {
47
- "playwright": "1.63.0"
50
+ "playwright": "1.64.0"
48
51
  },
49
52
  "engines": {
50
53
  "node": ">=22",