@geonosis/walk 2.12.0 → 3.0.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 (45) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/bin/geonosis-walk.mjs +7 -192
  3. package/dist/browser.d.ts +124 -0
  4. package/dist/browser.js +242 -0
  5. package/dist/config.d.ts +16 -0
  6. package/dist/config.js +100 -0
  7. package/dist/index.d.ts +7 -153
  8. package/dist/index.js +5 -13
  9. package/dist/options.d.ts +19 -0
  10. package/dist/options.js +64 -0
  11. package/dist/probes/buy-box-above-fold.d.ts +14 -0
  12. package/dist/probes/buy-box-above-fold.js +54 -0
  13. package/dist/probes/empty-section.d.ts +16 -0
  14. package/dist/probes/empty-section.js +29 -0
  15. package/dist/probes/error-page-status.d.ts +20 -0
  16. package/dist/probes/error-page-status.js +37 -0
  17. package/dist/probes/fabricated-claim.d.ts +14 -0
  18. package/dist/probes/fabricated-claim.js +29 -0
  19. package/dist/probes/fake-session.d.ts +14 -0
  20. package/dist/probes/fake-session.js +45 -0
  21. package/dist/probes/index.d.ts +9 -0
  22. package/dist/probes/index.js +42 -0
  23. package/dist/probes/light-on-light.d.ts +15 -0
  24. package/dist/probes/light-on-light.js +26 -0
  25. package/dist/probes/link-integrity.d.ts +14 -0
  26. package/dist/probes/link-integrity.js +69 -0
  27. package/dist/probes/money-format.d.ts +14 -0
  28. package/dist/probes/money-format.js +33 -0
  29. package/dist/probes/ops-leakage.d.ts +13 -0
  30. package/dist/probes/ops-leakage.js +29 -0
  31. package/dist/probes/orphan-url.d.ts +13 -0
  32. package/dist/probes/orphan-url.js +54 -0
  33. package/dist/probes/placeholder-asset.d.ts +14 -0
  34. package/dist/probes/placeholder-asset.js +40 -0
  35. package/dist/probes/stub-only-entity.d.ts +14 -0
  36. package/dist/probes/stub-only-entity.js +30 -0
  37. package/dist/probes/thin-page.d.ts +14 -0
  38. package/dist/probes/thin-page.js +30 -0
  39. package/dist/types.d.ts +104 -0
  40. package/dist/types.js +10 -0
  41. package/dist/walk-cli.js +41 -47
  42. package/dist/walk.d.ts +23 -0
  43. package/dist/walk.js +93 -0
  44. package/package.json +5 -4
  45. package/dist/chunk-VCGYSFL5.js +0 -956
package/dist/config.js ADDED
@@ -0,0 +1,100 @@
1
+ // src/config.ts
2
+ import { existsSync, readFileSync } from "node:fs";
3
+ import { resolve } from "node:path";
4
+ import { DEFAULT_PROBES } from "./probes/index.js";
5
+ import { WalkError } from "./types.js";
6
+ var VIEWPORT = { height: 900, width: 1440 };
7
+ var WALK_REPORT = ".geonosis/walk-report.json";
8
+ var WALK_DEFAULT = {
9
+ options: {},
10
+ probes: DEFAULT_PROBES.map((one) => one.id),
11
+ report: WALK_REPORT,
12
+ urls: [],
13
+ viewport: VIEWPORT
14
+ };
15
+ var KNOWN = new Set(["options", "probes", "report", "urls", "viewport"]);
16
+ var ABOUT = {
17
+ options: "object? keyed by probe id; each probe validates its own",
18
+ probes: "string[]? the probe ids to run",
19
+ report: "string? where the JSON report is written",
20
+ urls: "string[]? the pages to walk",
21
+ viewport: 'object? { "width": <number>, "height": <number> }'
22
+ };
23
+ var configShape = () => [
24
+ "geonosis-walk reads geonosis.json",
25
+ "",
26
+ 'geonosis.json → "walk" every key optional, every default a contract',
27
+ ...[...KNOWN].toSorted().map((key) => ` ${key.padEnd(11)}${ABOUT[key] ?? ""}`),
28
+ "",
29
+ "A key outside this list is REFUSED by name: a misspelling accepted in silence is a probe nobody",
30
+ "is running against a page nobody is walking."
31
+ ].join(`
32
+ `);
33
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
34
+ var readViewport = (value) => {
35
+ if (value === undefined)
36
+ return VIEWPORT;
37
+ if (!isRecord(value) || typeof value.height !== "number" || typeof value.width !== "number") {
38
+ throw new WalkError('walk.viewport must be { "width": <number>, "height": <number> }');
39
+ }
40
+ return { height: value.height, width: value.width };
41
+ };
42
+ var parseViewport = (value) => {
43
+ const found = /^(\d+)x(\d+)$/.exec(value.trim());
44
+ if (found?.[1] === undefined || found[2] === undefined) {
45
+ throw new WalkError(`"${value}" is not a viewport — write it as WIDTHxHEIGHT, e.g. 390x844`);
46
+ }
47
+ return { height: Number(found[2]), width: Number(found[1]) };
48
+ };
49
+ var readStrings = (value, name, fallback) => {
50
+ if (value === undefined)
51
+ return fallback;
52
+ if (!Array.isArray(value) || value.some((one) => typeof one !== "string")) {
53
+ throw new WalkError(`walk.${name} must be a list of strings`);
54
+ }
55
+ return value;
56
+ };
57
+ var loadWalkConfig = (file) => {
58
+ if (!existsSync(file))
59
+ return WALK_DEFAULT;
60
+ let parsed;
61
+ try {
62
+ parsed = JSON.parse(readFileSync(file, "utf8"));
63
+ } catch (error) {
64
+ throw new WalkError(`${file} is not valid JSON: ${error.message}`);
65
+ }
66
+ if (!isRecord(parsed))
67
+ throw new WalkError(`${file} must hold an object`);
68
+ const block = parsed.walk;
69
+ if (block === undefined)
70
+ return WALK_DEFAULT;
71
+ if (!isRecord(block))
72
+ throw new WalkError("walk must be an object");
73
+ for (const key of Object.keys(block)) {
74
+ if (!KNOWN.has(key))
75
+ throw new WalkError(`walk.${key} is not a key of the walk block`);
76
+ }
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
+ return {
85
+ options,
86
+ probes: readStrings(block.probes, "probes", WALK_DEFAULT.probes),
87
+ report: typeof block.report === "string" ? block.report : WALK_REPORT,
88
+ urls: readStrings(block.urls, "urls", []),
89
+ viewport: readViewport(block.viewport)
90
+ };
91
+ };
92
+ var configPath = (cwd, given) => resolve(cwd, given ?? "geonosis.json");
93
+ export {
94
+ WALK_DEFAULT,
95
+ WALK_REPORT,
96
+ configPath,
97
+ configShape,
98
+ loadWalkConfig,
99
+ parseViewport
100
+ };
package/dist/index.d.ts CHANGED
@@ -1,153 +1,7 @@
1
- import { Page, Browser } from 'playwright';
2
-
3
- /**
4
- * The ten defect classes the walk is mechanical about.
5
- *
6
- * Six are a storefront CX audit's own groups, generalised; `light-on-light` is that audit's
7
- * browser-proof probe (a cream chip on a cream page reads as broken, and the screenshot says it is
8
- * fine), `buy-box-above-fold` is one of its groups promoted to a class, and `error-page-status`
9
- * came from an error surface served with a 200, which every health check read as healthy.
10
- * `content-integrity` is the tenth: a page that renders correctly and says nothing — a section with
11
- * a heading and no body, a price in a shape the repo does not write, a page nothing links to. Four
12
- * of an audit's own defects were filed under `fabricated-claim`'s forbidden-string engine for want
13
- * 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
14
- * that promises a control nobody built, four levels of taxonomy for fourteen products — is in
15
- * `docs/walk-review-inventory-2026-08-30.md`, and stays the walker's judgement. A green walk report
16
- * is not a clean surface.
17
- */
18
- 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';
19
- /** `blocking` breaks trust or the buy path; `major` confuses the buyer; `minor` is polish. */
20
- type Severity = 'blocking' | 'major' | 'minor';
21
- /**
22
- * One defect, as the build plan's contract states it. `evidence` is the measured value — the two
23
- * colours and the ratio, the status code, the matched text — never a restatement of the class,
24
- * because the reader's next question is always "what did you actually see".
25
- */
26
- type Finding = {
27
- class: DefectClass;
28
- evidence: string;
29
- selector?: string;
30
- severity: Severity;
31
- url: string;
32
- };
33
- type Viewport = {
34
- height: number;
35
- width: number;
36
- };
37
- type ProbeContext = {
38
- /**
39
- * One walk, one memo. `link-integrity` would otherwise send a HEAD request for the same footer
40
- * link once per page, which is forty requests for one answer on a forty-page walk.
41
- */
42
- memo: Map<string, unknown>;
43
- /** This probe's own block of the `options` map, already narrowed by id. */
44
- options: Record<string, unknown>;
45
- /**
46
- * The status the page's OWN response carried. Read from `page.goto`, because nothing on a loaded
47
- * page remembers it and a second request for it would ask a different question of a server that
48
- * may not answer twice the same way.
49
- */
50
- status: number;
51
- url: string;
52
- viewport: Viewport;
53
- };
54
- type Probe = {
55
- class: DefectClass;
56
- id: string;
57
- /**
58
- * D-031, per probe: a probe that cannot mean anything without an option refuses the run when it
59
- * is missing, naming the option. Five of the eight have one — a claim list, an authoritative id
60
- * set, what "signed in" looks like, the operations patterns, the buy-box selector — because none
61
- * of those five can have a default that is true of a repo that has not configured it. A probe
62
- * that ran and reported nothing because nobody told it what to look for is indistinguishable
63
- * from a clean page.
64
- */
65
- needs?: (options: Record<string, unknown>) => void;
66
- run: (page: Page, context: ProbeContext) => Promise<Finding[]>;
67
- /**
68
- * The reading no single page can make. `orphan-url` is the reason it exists: whether anything
69
- * links to a page is a fact about the whole walk, and a probe handed one page at a time can only
70
- * record what it saw. Called once, after every page, with the pages walked; each finding is filed
71
- * against the page whose `url` it names.
72
- */
73
- finish?: (context: FinishContext) => Finding[];
74
- };
75
- /** What a probe knows once the walk is over: its own memo, its options, and where it went. */
76
- type FinishContext = {
77
- memo: Map<string, unknown>;
78
- options: Record<string, unknown>;
79
- urls: string[];
80
- };
81
- type PageReport = {
82
- findings: Finding[];
83
- url: string;
84
- };
85
- type WalkReport = {
86
- /**
87
- * Keyed by the classes that RAN. A zero therefore means "probed for, none found"; a class that is
88
- * absent was never looked for. All eight keys with five zeros would read as five clean gates
89
- * nobody enabled.
90
- */
91
- counts: Partial<Record<DefectClass, number>>;
92
- finishedAt: string;
93
- pages: PageReport[];
94
- probes: string[];
95
- startedAt: string;
96
- viewport: Viewport;
97
- };
98
- /**
99
- * The walk could not run: no browser, no URL, a page that did not answer, a probe with no option it
100
- * needs. Distinct from "the walk ran and found nothing", which is a report with zeros in it — the
101
- * CLI turns this into exit 2 and that into exit 0.
102
- */
103
- declare class WalkError extends Error {
104
- constructor(message: string);
105
- }
106
-
107
- type WalkConfig = {
108
- options: Record<string, Record<string, unknown>>;
109
- probes: string[];
110
- report: string;
111
- urls: string[];
112
- viewport: Viewport;
113
- };
114
- declare const WALK_REPORT = ".geonosis/walk-report.json";
115
- declare const WALK_DEFAULT: WalkConfig;
116
- /** `WxH`, the shape a viewport is written in everywhere else — 1440x900, 390x844. */
117
- declare const parseViewport: (value: string) => Viewport;
118
- /** The `walk` block of `geonosis.json`, every key optional, every default a contract. */
119
- declare const loadWalkConfig: (file: string) => WalkConfig;
120
- declare const configPath: (cwd: string, given?: string) => string;
121
-
122
- declare const PROBES: Probe[];
123
- declare const probeById: (id: string) => Probe;
124
- /**
125
- * The probes a walk runs when nobody named any: the ones whose reading is a property of any page.
126
- * The other five need a repo's own list to mean anything (D-031) and would refuse the run, so a
127
- * default set that included them would make `geonosis-walk <url>` fail on every repo.
128
- */
129
- declare const DEFAULT_PROBES: Probe[];
130
-
131
- type WalkInput = {
132
- /** An already-open browser, for a walker driving a flow. Absent means launch one and close it. */
133
- browser?: Browser;
134
- /** Each probe's options, keyed by probe id. */
135
- options?: Record<string, Record<string, unknown>>;
136
- probes: Probe[];
137
- urls: string[];
138
- viewport: Viewport;
139
- };
140
- /**
141
- * Every URL, every probe, one report.
142
- *
143
- * Each page gets its OWN context, with no cookies and no storage. That is what makes `fake-session`
144
- * mean anything, and it is why `walk` is the stateless surface: a walker that has to reach a
145
- * checkout with a cart in it drives its own page and calls `probe.run(page, context)` directly.
146
- *
147
- * Refusals come BEFORE the browser opens, and a page that did not answer stops the walk. A report
148
- * with no findings in it must only ever mean the probes looked and found none.
149
- */
150
- declare const walk: ({ browser, options, probes, urls, viewport }: WalkInput) => Promise<WalkReport>;
151
- declare const findingsIn: (report: WalkReport) => number;
152
-
153
- export { DEFAULT_PROBES, type DefectClass, type Finding, PROBES, type PageReport, type Probe, type ProbeContext, type Severity, type Viewport, WALK_DEFAULT, WALK_REPORT, type WalkConfig, WalkError, type WalkInput, type WalkReport, configPath, findingsIn, loadWalkConfig, parseViewport, probeById, walk };
1
+ export type { WalkConfig } from './config.js';
2
+ export { configPath, loadWalkConfig, parseViewport, WALK_DEFAULT, WALK_REPORT } from './config.js';
3
+ export { DEFAULT_PROBES, PROBES, probeById } from './probes/index.js';
4
+ export type { DefectClass, Finding, PageReport, Probe, ProbeContext, Severity, Viewport, WalkReport } from './types.js';
5
+ export { WalkError } from './types.js';
6
+ export type { WalkInput } from './walk.js';
7
+ export { findingsIn, walk } from './walk.js';
package/dist/index.js CHANGED
@@ -1,16 +1,8 @@
1
- import {
2
- DEFAULT_PROBES,
3
- PROBES,
4
- WALK_DEFAULT,
5
- WALK_REPORT,
6
- WalkError,
7
- configPath,
8
- findingsIn,
9
- loadWalkConfig,
10
- parseViewport,
11
- probeById,
12
- walk
13
- } from "./chunk-VCGYSFL5.js";
1
+ // src/index.ts
2
+ import { configPath, loadWalkConfig, parseViewport, WALK_DEFAULT, WALK_REPORT } from "./config.js";
3
+ import { DEFAULT_PROBES, PROBES, probeById } from "./probes/index.js";
4
+ import { WalkError } from "./types.js";
5
+ import { findingsIn, walk } from "./walk.js";
14
6
  export {
15
7
  DEFAULT_PROBES,
16
8
  PROBES,
@@ -0,0 +1,19 @@
1
+ export declare const stringOption: (probe: string, options: Record<string, unknown>, name: string, fallback?: string) => string;
2
+ export declare const stringsOption: (options: Record<string, unknown>, name: string, fallback: string[]) => string[];
3
+ export declare const numberOption: (options: Record<string, unknown>, name: string, fallback: number) => number;
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
+ 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
+ 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
+ */
14
+ 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
+ */
19
+ export declare const assertPatterns: (probe: string, patterns: string[], flags: string) => void;
@@ -0,0 +1,64 @@
1
+ // src/options.ts
2
+ import { WalkError } from "./types.js";
3
+ var stringOption = (probe, options, name, fallback) => {
4
+ const value = options[name];
5
+ if (typeof value === "string" && value !== "")
6
+ return value;
7
+ if (fallback !== undefined)
8
+ return fallback;
9
+ throw new WalkError(`${probe}: needs a "${name}" in the walk options`);
10
+ };
11
+ var stringsOption = (options, name, fallback) => {
12
+ const value = options[name];
13
+ if (!Array.isArray(value))
14
+ return fallback;
15
+ return value.filter((one) => typeof one === "string");
16
+ };
17
+ var numberOption = (options, name, fallback) => {
18
+ const value = options[name];
19
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
20
+ };
21
+ var flagOption = (options, name, fallback) => typeof options[name] === "boolean" ? options[name] : fallback;
22
+ var requireStrings = (probe, options, name) => {
23
+ const value = stringsOption(options, name, []);
24
+ if (value.length === 0) {
25
+ throw new WalkError(`${probe}: needs a non-empty "${name}" in the walk options`);
26
+ }
27
+ return value;
28
+ };
29
+ var requireNumber = (probe, options, name) => {
30
+ const value = options[name];
31
+ if (typeof value !== "number" || !Number.isFinite(value)) {
32
+ throw new WalkError(`${probe}: needs a "${name}" number in the walk options`);
33
+ }
34
+ return value;
35
+ };
36
+ var ALLOWED_FLAGS = new Set(["i", "m", "s", "u"]);
37
+ var patternFlags = (probe, options) => {
38
+ const flags = stringOption(probe, options, "flags", "");
39
+ for (const flag of flags) {
40
+ if (!ALLOWED_FLAGS.has(flag)) {
41
+ throw new WalkError(`${probe}: "${flags}" is not a set of regex flags (i, m, s, u)`);
42
+ }
43
+ }
44
+ return flags;
45
+ };
46
+ var assertPatterns = (probe, patterns, flags) => {
47
+ for (const pattern of patterns) {
48
+ try {
49
+ RegExp(pattern, `${flags}g`);
50
+ } catch {
51
+ throw new WalkError(`${probe}: "${pattern}" is not a regular expression`);
52
+ }
53
+ }
54
+ };
55
+ export {
56
+ assertPatterns,
57
+ flagOption,
58
+ numberOption,
59
+ patternFlags,
60
+ requireNumber,
61
+ requireStrings,
62
+ stringOption,
63
+ stringsOption
64
+ };
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,54 @@
1
+ // src/probes/buy-box-above-fold.ts
2
+ import { collect } from "../browser.js";
3
+ import { flagOption, numberOption, stringOption } from "../options.js";
4
+ var buyBoxAboveFold = {
5
+ class: "buy-box-above-fold",
6
+ id: "buy-box-above-fold",
7
+ needs: (options) => {
8
+ stringOption("buy-box-above-fold", options, "selector");
9
+ },
10
+ run: async (page, { options, url }) => {
11
+ const selector = stringOption("buy-box-above-fold", options, "selector");
12
+ const above = stringOption("buy-box-above-fold", options, "above", "");
13
+ const { rects, viewportHeight } = await collect(page, {
14
+ kind: "geometry",
15
+ selectors: above === "" ? [selector] : [selector, above]
16
+ });
17
+ const buyBox = rects.find((one) => one.selector === selector)?.rect ?? null;
18
+ if (buyBox === null) {
19
+ return flagOption(options, "required", false) ? [
20
+ {
21
+ class: "buy-box-above-fold",
22
+ evidence: `no element matches "${selector}" on a page the walk requires one on`,
23
+ severity: "major",
24
+ url
25
+ }
26
+ ] : [];
27
+ }
28
+ const fold = numberOption(options, "maxTop", viewportHeight);
29
+ const other = above === "" ? null : rects.find((one) => one.selector === above)?.rect ?? null;
30
+ const found = [];
31
+ if (other !== null && buyBox.top > other.top) {
32
+ found.push({
33
+ class: "buy-box-above-fold",
34
+ evidence: `the buy box starts at ${Math.round(buyBox.top)}px, below "${above}" at ${Math.round(other.top)}px`,
35
+ selector,
36
+ severity: "major",
37
+ url
38
+ });
39
+ }
40
+ if (buyBox.top >= fold) {
41
+ found.push({
42
+ class: "buy-box-above-fold",
43
+ evidence: `the buy box starts at ${Math.round(buyBox.top)}px, below the fold at ${Math.round(fold)}px`,
44
+ selector,
45
+ severity: "major",
46
+ url
47
+ });
48
+ }
49
+ return found;
50
+ }
51
+ };
52
+ export {
53
+ buyBoxAboveFold
54
+ };
@@ -0,0 +1,16 @@
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;
@@ -0,0 +1,29 @@
1
+ // src/probes/empty-section.ts
2
+ import { collect } from "../browser.js";
3
+ import { stringOption } from "../options.js";
4
+ var emptySection = {
5
+ class: "content-integrity",
6
+ id: "empty-section",
7
+ needs: (options) => {
8
+ stringOption("empty-section", options, "selector");
9
+ },
10
+ run: async (page, { options, url }) => {
11
+ const headingSelector = stringOption("empty-section", options, "headingSelector", "h1,h2,h3,h4,h5,h6");
12
+ const hits = await collect(page, {
13
+ headingSelector,
14
+ kind: "prose",
15
+ mediaSelector: stringOption("empty-section", options, "mediaSelector", "img,svg,video,iframe,canvas"),
16
+ selector: stringOption("empty-section", options, "selector")
17
+ });
18
+ return hits.filter((hit) => hit.headingWords > 0 && hit.words <= hit.headingWords && hit.media === 0).map((hit) => ({
19
+ class: "content-integrity",
20
+ evidence: `the section renders ${hit.headingWords} heading word(s) and nothing else — no body text, no media`,
21
+ selector: hit.selector,
22
+ severity: "major",
23
+ url
24
+ }));
25
+ }
26
+ };
27
+ export {
28
+ emptySection
29
+ };
@@ -0,0 +1,20 @@
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;
@@ -0,0 +1,37 @@
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 = {
11
+ class: "error-page-status",
12
+ 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
+ };
35
+ export {
36
+ errorPageStatus
37
+ };
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,29 @@
1
+ // src/probes/fabricated-claim.ts
2
+ import { collect } from "../browser.js";
3
+ import { assertPatterns, patternFlags, requireStrings, stringOption } from "../options.js";
4
+ var fabricatedClaim = {
5
+ class: "fabricated-claim",
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
+ };
27
+ export {
28
+ fabricatedClaim
29
+ };
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,45 @@
1
+ // src/probes/fake-session.ts
2
+ import { collect } from "../browser.js";
3
+ import { stringsOption } from "../options.js";
4
+ import { WalkError } from "../types.js";
5
+ var escapeForRegex = (value) => value.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&");
6
+ var fakeSession = {
7
+ class: "fake-session",
8
+ id: "fake-session",
9
+ needs: (options) => {
10
+ const selectors = stringsOption(options, "selectors", []);
11
+ const text = stringsOption(options, "text", []);
12
+ if (selectors.length === 0 && text.length === 0) {
13
+ throw new WalkError('fake-session: needs "selectors" or "text" — what a signed-in page looks like here');
14
+ }
15
+ },
16
+ run: async (page, { options, url }) => {
17
+ const selectors = stringsOption(options, "selectors", []);
18
+ const text = stringsOption(options, "text", []);
19
+ const present = selectors.length === 0 ? [] : await collect(page, { kind: "present", selectors });
20
+ const said = text.length === 0 ? [] : await collect(page, {
21
+ flags: "",
22
+ kind: "text",
23
+ patterns: text.map(escapeForRegex),
24
+ scope: ""
25
+ });
26
+ const bySelector = present.filter((hit) => hit.present).map((hit) => ({
27
+ class: "fake-session",
28
+ evidence: `a context nobody signed in to renders ${hit.selector}`,
29
+ selector: hit.selector,
30
+ severity: "blocking",
31
+ url
32
+ }));
33
+ const byText = said.map((hit) => ({
34
+ class: "fake-session",
35
+ evidence: `a context nobody signed in to reads "${hit.text}"`,
36
+ selector: hit.selector,
37
+ severity: "blocking",
38
+ url
39
+ }));
40
+ return [...bySelector, ...byText];
41
+ }
42
+ };
43
+ export {
44
+ fakeSession
45
+ };
@@ -0,0 +1,9 @@
1
+ import type { Probe } from '../types.js';
2
+ export declare const PROBES: Probe[];
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
+ */
9
+ export declare const DEFAULT_PROBES: Probe[];