pagesight 0.18.0 → 0.20.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 (46) hide show
  1. package/README.md +19 -0
  2. package/docs/changes.md +118 -0
  3. package/docs/cloudflare.md +31 -0
  4. package/docs/crawl.md +64 -0
  5. package/docs/investigation.md +85 -0
  6. package/docs/measurement.md +178 -0
  7. package/docs/monitoring.md +39 -0
  8. package/docs/opportunities.md +78 -0
  9. package/docs/rendering.md +102 -0
  10. package/docs/seo-agent-workflow.md +153 -0
  11. package/docs/snapshots.md +7 -0
  12. package/docs/usage.md +25 -17
  13. package/package.json +5 -2
  14. package/src/api/assessment.ts +315 -0
  15. package/src/api/change-record.ts +31 -0
  16. package/src/api/cloudflare.ts +201 -0
  17. package/src/api/compare-snapshots.ts +5 -215
  18. package/src/api/crawl.ts +53 -0
  19. package/src/api/evaluate-change.ts +189 -0
  20. package/src/api/execute.ts +42 -0
  21. package/src/api/followup-changes.ts +264 -0
  22. package/src/api/ga-freshness.ts +20 -0
  23. package/src/api/ga-realtime.ts +40 -0
  24. package/src/api/http-url.ts +13 -0
  25. package/src/api/investigation.ts +344 -0
  26. package/src/api/opportunities.ts +317 -0
  27. package/src/api/report-table.ts +216 -0
  28. package/src/api/reports.ts +19 -1
  29. package/src/api/schema.ts +162 -11
  30. package/src/api/snapshot.ts +20 -1
  31. package/src/api/technical-changes.ts +124 -0
  32. package/src/api/ui-findings.ts +1 -1
  33. package/src/api/verify-render.ts +134 -0
  34. package/src/assessment-text.ts +55 -0
  35. package/src/cli.ts +173 -38
  36. package/src/followup-manifest.ts +42 -0
  37. package/src/followup-text.ts +45 -0
  38. package/src/investigation-text.ts +32 -0
  39. package/src/opportunities-text.ts +61 -0
  40. package/src/providers/cloudflare.ts +46 -0
  41. package/src/tools/observe.ts +1 -1
  42. package/src/web/fetch.ts +2 -1
  43. package/src/web/render-browser.ts +190 -0
  44. package/src/web/render-dom.ts +72 -0
  45. package/src/web/render-network.ts +122 -0
  46. package/src/web/site-graph.ts +443 -0
@@ -0,0 +1,102 @@
1
+ # Verify rendered SEO evidence on demand
2
+
3
+ `page.verify` compares fetched server HTML with a fresh anonymous Chromium load.
4
+ It can also click one exact internal link in a separate fresh context and compare
5
+ that result with the direct load. This is an observation at a specified capture
6
+ point, not Google's renderer or proof of indexing.
7
+
8
+ Install Chromium once from the Pagesight installation directory:
9
+
10
+ ```sh
11
+ bunx playwright install chromium
12
+ # Linux machines may also require: bunx playwright install --with-deps chromium
13
+ ```
14
+
15
+ Other Pagesight operations do not launch a browser. Missing browser binaries produce
16
+ `browser_unavailable` with setup guidance. CI installs Chromium for real browser tests.
17
+
18
+ ```sh
19
+ pagesight render --url https://example.com/target
20
+ pagesight render --url https://example.com/target \
21
+ --from-url https://example.com/source --link-selector 'a#target-link' \
22
+ --settle-ms 1000 --timeout-ms 20000 --out render.json
23
+ ```
24
+
25
+ The selector must match exactly one anchor, with a resolved `href` equal to the
26
+ requested target URL, no download attribute and same-tab navigation. Source and
27
+ target must share an origin. Selectors identify links, not buttons, forms or arbitrary
28
+ actions. Ambiguous links, navigation failures and URL mismatches never become empty
29
+ successful comparisons. The initial version does not exercise form-driven filters,
30
+ back/forward history, screenshots, or visual layout; use a browser workflow for those.
31
+
32
+ API, authenticated local HTTP and MCP `observe` take the same operation:
33
+
34
+ ```json
35
+ {
36
+ "operation": "page.verify",
37
+ "url": "https://example.com/target",
38
+ "navigation": { "fromUrl": "https://example.com/source", "linkSelector": "a#target-link" },
39
+ "settleMs": 1000,
40
+ "timeoutMs": 20000,
41
+ "viewport": { "width": 1280, "height": 800 }
42
+ }
43
+ ```
44
+
45
+ Browser paths wait for DOMContentLoaded, then a fixed settle interval; navigation
46
+ also waits for the exact target URL. `settleMs` is 0–5000 and `timeoutMs` is
47
+ 1000–60000 per browser path, including source load and click. A late hydration
48
+ update can occur after capture. Use a larger explicit interval to investigate a
49
+ known delay; elapsed time never proves network or application completion.
50
+
51
+ The result retains independent server, direct and optional navigation observations:
52
+
53
+ - Arrays of title, description, canonical, robots, H1, JSON-LD and anchor values
54
+ preserve duplicates and empty values. Canonical and anchor URLs include raw and
55
+ resolved forms; JSON-LD syntax validity is separate from semantic validity.
56
+ - The server HTML hash identifies the independently fetched response; browser DOM
57
+ hashes identify extracted evidence. Capture timestamps, browser version, viewport,
58
+ requested/final URLs, document response status/redirect headers and X-Robots-Tag
59
+ preserve provenance. A client route can have no target document response.
60
+ - DOM-field comparisons (including base href) are `equal`, `different`, `unavailable` or `not_requested`. Differences
61
+ are data for investigation, not automatic defects. A capture failure makes the
62
+ envelope partial when other evidence survives. Truncated captures are explicitly
63
+ unavailable for comparison; missing values are not invented.
64
+
65
+ Server HTML uses Pagesight's user agent, a 2 MB response limit and a same-origin
66
+ redirect limit, then inert Chromium parsing. It can differ from the browser's
67
+ response because of user agents, timing, experiments or deployments. Raw HTML and
68
+ cookies are not returned. Keep URLs and extracted page content private when needed.
69
+
70
+ Each browser path uses fresh storage, a maximum of 500 attempted requests, blocked
71
+ service workers and WebSockets, and only GET/HEAD requests. Cross-origin top-level navigation and
72
+ downloads are blocked. These restrictions can change application behavior and are
73
+ reported with blocked-request counts. Subresources may use other public origins; ordinary
74
+ page requests can reach analytics. No user browser profile or authentication state
75
+ is loaded. Browser network response sizes are not globally capped; the server HTML
76
+ limit is separate. Extracted fields cap at 200 items and 4000 characters per value. Selection stops
77
+ at the first excess match, and extraction uses a Chromium isolated world so page
78
+ scripts cannot replace the extraction primitives. Document response history caps
79
+ at 20 entries; `documentsTruncated` makes the result partial and the target HTTP
80
+ response unavailable.
81
+
82
+ Both server HTML and browser requests use a temporary local proxy. It resolves each
83
+ upstream connection once, rejects nonpublic addresses, and connects to the checked
84
+ IP without a second DNS lookup. Chromium's implicit loopback proxy bypass is removed;
85
+ QUIC and non-proxied WebRTC UDP are disabled. TLS certificate checks remain enabled.
86
+ This is request filtering, not an operating-system sandbox for untrusted browsers.
87
+
88
+ For deliberate local fixtures, request a literal IP URL such as
89
+ `http://127.0.0.1:3000/target`. Only that exact IP and port is permitted as a nonpublic
90
+ destination; `localhost` and other names resolving to private addresses are rejected.
91
+ A fixture cannot request another local port. Blocked proxy destinations are counted
92
+ in `network.blockedRequests`, separately from browser route restrictions. GET requests
93
+ can still cause site-side effects, including on the deliberately selected fixture.
94
+
95
+ Run this separately when investigating a URL or verifying a deployment. It does not
96
+ schedule analysis, alter production pages, validate rich-result eligibility, or
97
+ establish SEO impact.
98
+
99
+ `documentComparison` separately compares server/browser status and X-Robots-Tag.
100
+ DOM equality never implies equivalent HTTP responses; inspect both comparisons
101
+ and recorded redirect chains. Browser integration tests run in a separate Bun
102
+ process from provider/mock tests, under the same root verification command.
@@ -0,0 +1,153 @@
1
+ # Agent SEO workflow
2
+
3
+ Pagesight supplies evidence for decisions. Run this loop on a small cohort before
4
+ expanding it: establish access and measurement context, identify a question,
5
+ inspect the relevant pages, propose one change, verify the deployment, and collect
6
+ a comparable later window. Keep raw evidence private with dated filenames.
7
+
8
+ ## Establish access and meaning
9
+
10
+ Run `pagesight doctor --config seo.config.json`. Verify the exact GSC property,
11
+ GA property and production hostname. Distinguish access failures from empty
12
+ reports. Define named meaningful events in project context, including introduction
13
+ dates and tracking changes. A configured key event is not a validated conversion.
14
+ Test the event against a real action and check provider data separately from the
15
+ browser request. Realtime activity cannot identify an individual test session.
16
+
17
+ GSC measures search visibility, GA measures collected activity, and edge analytics (Cloudflare)
18
+ sample edge requests. They have different omissions, timezones and units. Never combine
19
+ them into a conversion funnel or SEO score. Review access when a provider fails;
20
+ do not request broader credentials unless a specific read requires them.
21
+
22
+ ## Find demand and decide what deserves investigation
23
+
24
+ 1. Save a snapshot for a finalized reporting interval. Run `opportunities` against
25
+ it, then `investigate` for one exact candidate URL. Inspect page-filtered queries,
26
+ device/country mix, Google's stored inspection and current HTML. Property query
27
+ totals cannot establish which queries led to a particular page.
28
+ 2. Read query intent and the page together. Separate model/reference-price lookup,
29
+ purchase intent, historical comparison, and unrelated queries. Low observed CTR
30
+ alone does not establish a poor snippet; position and intent matter. Missing
31
+ queries may be anonymized, and absent rows are not zero demand.
32
+ 3. For wording or market questions, compare 2–5 terms in one Google Trends chart:
33
+ same country, period, category, search type and term/topic type. Save the chart
34
+ URL, capture time, accessible table, relative averages, equal-window direction
35
+ and relevant related searches. Exclude the unfinished current week when comparing
36
+ complete weeks. Trends is relative interest, not search volume; rounded zero and
37
+ Breakout do not quantify demand. Check product/data coverage before acting on a
38
+ rising query.
39
+ 4. Inspect a bounded set of actual search results when intent or competing content
40
+ remains uncertain. Save query, country/language, device, date, result URLs and
41
+ observed features. Personalized samples are not stable rank tracking. A paid
42
+ SERP provider is justified only for repeatable geographic/device coverage that
43
+ the current question needs; record cost/coverage before subscribing.
44
+ 5. Make a short brief: exact question, source pointers and dates, existing useful
45
+ content, missing user answer, proposed page/cohort, verification plan, caveats.
46
+ Improve a relevant existing page before creating overlapping pages. Similar
47
+ keyword wording alone is not evidence of cannibalization; inspect query/page
48
+ overlap, intent and canonicals before consolidation.
49
+
50
+ ## Discovery, architecture and technical policy
51
+
52
+ Use bounded site discovery to inspect real HTML links, redirects, canonical edges,
53
+ robots policy, sitemap samples and link depth from selected seeds. Depth is measured
54
+ in that sample; sitemap membership does not establish internal links or a true
55
+ orphan. Prioritize broken paths from important hubs and useful links to relevant
56
+ content. Verify source and destination before adding links. Avoid site-wide
57
+ keyword anchors and mechanically linking every page to every other page.
58
+
59
+ Keep indexable, filtered, legacy and account-only routes explicit in project
60
+ context. A noindex diagnostic can be intentional. Check sitemap dates against
61
+ actual publication and content/reference versions; a future lastmod is not proof
62
+ that the underlying data is wrong. Validate structured data against visible facts:
63
+ reference prices are not inventory offers; do not invent availability, reviews,
64
+ shipping or merchant claims merely to satisfy a validator.
65
+
66
+ ## Rendered-template and performance verification
67
+
68
+ For repeatable direct-load and internal-anchor checks, use [rendered-page verification](rendering.md). Keep the manual workflow below for forms, history navigation and visual inspection.
69
+
70
+ Select one known URL per important template, plus an intentional noindex or
71
+ functional-filter example. Record browser, viewport, capture time, URL and navigation
72
+ path (direct load versus client navigation). Run `pagesight page --url URL` to save
73
+ server-HTML evidence. In an available browser tool, inspect the rendered page and
74
+ record the same metadata and headings with this read-only DOM expression:
75
+
76
+ ```js
77
+ ({
78
+ url: location.href,
79
+ title: document.title,
80
+ canonical: [...document.querySelectorAll('link[rel="canonical"]')].map((e) => e.getAttribute("href")),
81
+ robots: [...document.querySelectorAll('meta[name="robots"]')].map((e) => e.getAttribute("content")),
82
+ description: document.querySelector('meta[name="description"]')?.getAttribute("content"),
83
+ h1: [...document.querySelectorAll("h1")].map((e) => e.textContent),
84
+ jsonLd: [...document.querySelectorAll('script[type="application/ld+json"]')].map((e) => e.textContent),
85
+ linkCount: document.querySelectorAll("a[href]").length,
86
+ });
87
+ ```
88
+
89
+ HTTP status, final URL, redirects and X-Robots-Tag come from the Pagesight page
90
+ response, not this DOM expression.
91
+
92
+ Retain exact values; distinguish duplicate tags, absent directives and legitimate
93
+ URL variants. Compare with the independently fetched HTML, noting timing/version
94
+ differences. Exercise one internal navigation and relevant filter state: confirm
95
+ URL, heading, content and metadata update together. Verify actual links, price or
96
+ other primary content, and a representative mobile viewport. Inspect a screenshot
97
+ and document overflow; a string search can miss nonbreaking spaces and does not
98
+ prove visibility. Check console errors without treating unrelated third-party
99
+ warnings as demonstrated indexing failures. Restore temporary viewport overrides.
100
+
101
+ Save raw browser observations/screenshots where the tool supports export. If export
102
+ is unavailable, retain the tool transcript and label manually transcribed artifacts;
103
+ do not claim they are original screenshots. Browser findings may be imported using
104
+ `evidence.import` with provider `other`, exact sampled URLs, capture time, coverage
105
+ and source label. Imports remain unverified by Pagesight. Avoid cookies, client IDs,
106
+ full tracking payloads and private browser data in shared artifacts.
107
+
108
+ Run `pagesight speed psi --url URL --strategy mobile` for lab evidence and
109
+ `pagesight speed crux --url URL` (or `--origin`) for field evidence. Save requests, collection windows, device
110
+ and response failures. PSI variability calls for repeated comparable lab conditions
111
+ when diagnosing a specific issue. CrUX no-record means unavailable evidence for
112
+ that scope. A visible fast load is not a Core Web Vitals measurement. Neither
113
+ successful rendering nor crawler permission proves Google indexed the page.
114
+
115
+ ## Authority and trustworthy content
116
+
117
+ Start with first-party provenance, clear methodology, reference/publication dates,
118
+ limitations, ownership/contact and useful primary data. Cite original sources and
119
+ explain what the product adds. Inspect GSC's Links UI/export or Bing link reads when
120
+ available, retaining their coverage and dates. GSC Links has no supported Pagesight API endpoint; import its UI/export findings
121
+ with `evidence.import`, preserving dates and coverage. Existing API access does not imply
122
+ access to every UI-only report. If a competitor backlink question needs a third-party
123
+ index, specify the domains, export limits and cost first; different indexes are not
124
+ an exhaustive census and their authority scores are not Google ranking metrics.
125
+
126
+ Turn unique useful data or research into a concrete resource relevant publishers
127
+ can cite. Verify real mentions and source pages before proposing outreach. Drafting
128
+ an outreach idea does not authorize sending it. Avoid paid link schemes, bulk
129
+ unrelated guest posts and fabricated expertise or reviews.
130
+
131
+ ## Cadence and decisions
132
+
133
+ - Daily: access/collection failures and technical regressions in a fixed small
134
+ cohort. Keep errors and missed-run gaps; do not overwrite the last good evidence.
135
+ - Weekly: finalized GSC/GA opportunities, page/query intent checks and one small
136
+ prioritized improvement with evidence and effort described in plain terms.
137
+ - Monthly or on reference-data publication: verify date/provenance accuracy,
138
+ sitemap policy, template consistency, internal-link coverage and useful content.
139
+ - After deployments: run rendered/technical checks immediately; record deployment,
140
+ measurement and overlapping changes; compare later equal windows with proper
141
+ timezone and instrumentation gates. Leave outcomes pending or inconclusive when
142
+ evidence is not available. No unsupported uplift claims.
143
+
144
+ Use an external scheduler for recurring collection, with bounded runs and private
145
+ credentials/artifacts. Record successful run times and failures separately from
146
+ traffic. Alerts should cite exact observations and changes; missing capped rows
147
+ cannot establish a disappearance. Provider retention can make a missed collection
148
+ unrecoverable. A scheduler on a sleeping/offline laptop is not an always-on service.
149
+
150
+ Further guidance: [Google SEO Starter Guide](https://developers.google.com/search/docs/fundamentals/seo-starter-guide),
151
+ [helpful content](https://developers.google.com/search/docs/fundamentals/creating-helpful-content),
152
+ [structured data policies](https://developers.google.com/search/docs/appearance/structured-data/sd-policies),
153
+ and [Google Trends data](https://support.google.com/trends/answer/4365533).
package/docs/snapshots.md CHANGED
@@ -121,3 +121,10 @@ object keys sorted lexically and array order retained. These identify comparison
121
121
  inputs, not raw file bytes; whitespace changes in saved JSON do not change them. Keep source snapshots for their full requests,
122
122
  responses and metadata. Changes are descriptive and do not establish that an SEO
123
123
  edit caused traffic changes; Pagesight does not apply SEO edits automatically.
124
+
125
+ ## Read the evidence
126
+
127
+ Run `pagesight assess --snapshot saved.json --format text` for a deterministic
128
+ summary of report rows, measurement findings and unknowns. It retains references
129
+ to the saved observations and makes no new provider calls. See
130
+ [measurement and verification](measurement.md) for scope and examples.
package/docs/usage.md CHANGED
@@ -26,23 +26,27 @@ GA evidence identifies the credential source variable, credential type, and serv
26
26
  account email when present. It never includes the token or private key. Aggregate
27
27
  results include a concise per-observation `summary` alongside full observations.
28
28
 
29
- | Operation | Required inputs |
30
- | -------------------------------------------- | -------------------------------------------------------- |
31
- | `discover` | `url`; optional `providers` (`["gsc", "ga"]` by default) |
32
- | `bing.sites` | None |
33
- | `bing.queries`, `bing.pages`, `bing.traffic` | `site` |
34
- | `gsc.sites` | None |
35
- | `gsc.sitemaps` | `site` |
36
- | `gsc.inspect` | `site`, `url` |
37
- | `gsc.report` | `site`, `request`; optional `maxPages` |
38
- | `ga.accounts` | None |
39
- | `ga.property`, `ga.key-events` | `property` |
40
- | `ga.report` | `property`, `request`; optional `maxPages` |
41
- | `page` | `url` |
42
- | `speed.psi` | `url`; optional `strategy` (`mobile` or `desktop`) |
43
- | `speed.crux`, `speed.history` | `url`; optional `origin: true`, `formFactor` |
44
- | `doctor` | `config` |
45
- | `snapshot` | `config`, `startDate`, `endDate`; optional `maxPages` |
29
+ | Operation | Required inputs |
30
+ | -------------------------------------------- | -------------------------------------------------------------------------- |
31
+ | `discover` | `url`; optional `providers` (`["gsc", "ga"]` by default) |
32
+ | `bing.sites` | None |
33
+ | `bing.queries`, `bing.pages`, `bing.traffic` | `site` |
34
+ | `gsc.sites` | None |
35
+ | `gsc.sitemaps` | `site` |
36
+ | `gsc.inspect` | `site`, `url` |
37
+ | `gsc.report` | `site`, `request`; optional `maxPages` |
38
+ | `ga.accounts` | None |
39
+ | `ga.property`, `ga.key-events` | `property` |
40
+ | `ga.realtime` | `property`, `request`; moving window, no offset |
41
+ | `ga.report` | `property`, `request`; optional `maxPages` |
42
+ | `page` | `url` |
43
+ | `speed.psi` | `url`; optional `strategy` (`mobile` or `desktop`) |
44
+ | `speed.crux`, `speed.history` | `url`; optional `origin: true`, `formFactor` |
45
+ | `doctor` | `config` |
46
+ | `crawl` | `config`; optional crawl bounds and `inspectLimit` (see [crawl](crawl.md)) |
47
+ | `investigate` | `config`, `url`, `startDate`, `endDate`; optional `maxPages`, `maxRows` |
48
+ | `assess` | `snapshot`; optional `maxRows` (default 10, max 100) |
49
+ | `snapshot` | `config`, `startDate`, `endDate`; optional `maxPages` |
46
50
 
47
51
  `operationSchema` and `configSchema` are exported for typed validation. The MCP
48
52
  `observe` input uses the same schema. `page` observes fetched HTML, status,
@@ -50,6 +54,10 @@ redirects, canonical, robots directives, JSON-LD and a content hash. It does not
50
54
  execute browser JavaScript. The original MCP page tool retains its additional
51
55
  link, social-meta and contrast checks.
52
56
 
57
+ See [measurement and verification](measurement.md) for saved-snapshot assessments,
58
+ Realtime requests, freshness limits and repeatable browser checks.
59
+ See [investigating one URL](investigation.md) for fresh exact-page search, organic and technical evidence.
60
+
53
61
  ## CLI
54
62
 
55
63
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pagesight",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "See your site the way search engines and AI see it.",
5
5
  "keywords": [
6
6
  "ai-crawlers",
@@ -38,10 +38,13 @@
38
38
  "scripts": {
39
39
  "start": "bun run src/index.ts",
40
40
  "typecheck": "tsc -p tsconfig.json",
41
- "test": "bun test __tests__"
41
+ "test": "bun test __tests__ && bun test browser-tests"
42
42
  },
43
43
  "dependencies": {
44
44
  "@modelcontextprotocol/sdk": "^1.12.1",
45
+ "entities": "^8.1.0",
46
+ "ipaddr.js": "^2.5.0",
47
+ "playwright": "1.63.0",
45
48
  "saxes": "^6.0.0",
46
49
  "zod": "^3.24.4"
47
50
  },