seo 0.22.2 → 0.22.3
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.
- package/dist/cli.js +2 -2
- package/dist/{dist-JixQfSQ8.js → dist-Bl6qdzNs.js} +5 -16
- package/dist/{dist-JixQfSQ8.js.map → dist-Bl6qdzNs.js.map} +1 -1
- package/dist/{dist-CRzQ_u-z.js → dist-DyjgE4zS.js} +1 -1
- package/dist/{esm-BiZWi2n6.js → esm-CdEzuBxD.js} +2 -2
- package/dist/{esm-BiZWi2n6.js.map → esm-CdEzuBxD.js.map} +1 -1
- package/dist/index.d.ts +76 -76
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +6 -3
- package/dist/mcp.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __seoCreateRequire } from 'node:module'; const require = __seoCreateRequire(import.meta.url);
|
|
3
|
-
import{$ as e,$n as t,$t as n,A as r,An as i,Ar as a,At as o,B as s,Bn as c,Br as l,Bt as u,C as d,Cn as f,Cr as ee,Ct as te,D as p,Dn as ne,Dr as re,Dt as m,E as ie,En as ae,Er as oe,Et as se,F as ce,Fn as le,Fr as ue,G as de,Gn as fe,Gt as pe,H as me,Hn as he,Ht as ge,I as _e,In as ve,Ir as h,It as ye,J as be,Jn as xe,Jt as Se,K as Ce,Kn as we,Kt as Te,L as Ee,Ln as De,Lr as Oe,Lt as ke,M as Ae,Mn as je,Mr as Me,Mt as Ne,N as Pe,Nn as Fe,Nr as Ie,Nt as Le,O as Re,On as ze,Or as Be,Ot as Ve,P as He,Pn as Ue,Pr as We,Pt as Ge,Q as Ke,Qn as qe,Qt as Je,R as Ye,Rn as Xe,Rr as Ze,Rt as Qe,S as $e,Sn as et,Sr as tt,St as nt,T as rt,Tn as it,Tr as at,Tt as ot,U as st,Un as ct,Ut as lt,V as ut,Vn as dt,Vt as ft,W as pt,Wn as mt,Wt as ht,X as gt,Xn as _t,Xt as vt,Y as yt,Yn as bt,Yt as xt,Z as St,Zn as Ct,Zt as wt,_ as Tt,_n as Et,_r as Dt,_t as Ot,a as kt,an as At,ar as jt,at as Mt,b as Nt,bn as Pt,br as Ft,bt as It,c as Lt,cn as Rt,cr as zt,ct as Bt,d as Vt,dn as Ht,dr as Ut,dt as Wt,en as Gt,er as Kt,et as qt,f as Jt,fn as Yt,fr as Xt,ft as Zt,g as Qt,gn as $t,gr as en,gt as tn,h as nn,hn as rn,hr as an,ht as on,i as sn,in as cn,ir as ln,it as un,j as dn,jn as fn,jr as pn,jt as mn,k as hn,kn as gn,kr as _n,kt as vn,l as yn,ln as bn,lr as xn,lt as Sn,m as Cn,mn as wn,mr as Tn,mt as En,nn as Dn,nr as On,nt as kn,o as An,on as jn,or as Mn,ot as Nn,p as Pn,pn as Fn,pr as In,pt as Ln,q as Rn,qn as zn,qt as Bn,rn as Vn,rr as Hn,rt as Un,sn as Wn,sr as Gn,st as Kn,t as qn,tn as Jn,tr as Yn,tt as Xn,u as Zn,un as Qn,ur as $n,ut as er,v as tr,vn as nr,vr as rr,vt as ir,w as ar,wn as or,wr as sr,wt as cr,x as lr,xn as ur,xr as dr,xt as fr,y as pr,yn as mr,yr as hr,yt as gr,z as _r,zn as vr,zr as yr,zt as br}from"./dist-JixQfSQ8.js";import{randomBytes as xr}from"node:crypto";import{arch as Sr,homedir as Cr,platform as wr}from"node:os";import{basename as Tr,dirname as Er,join as g,posix as Dr,relative as Or,resolve as kr,sep as Ar,win32 as jr}from"node:path";import{constants as Mr,copyFileSync as Nr,createWriteStream as Pr,existsSync as _,mkdirSync as Fr,readFileSync as Ir,readdirSync as Lr,realpathSync as Rr,renameSync as zr,rmSync as Br,statSync as Vr,writeFileSync as Hr}from"node:fs";import{fileURLToPath as Ur}from"node:url";import{cp as Wr,mkdir as Gr,open as Kr,readFile as v,readdir as qr,rename as Jr,stat as Yr,writeFile as Xr}from"node:fs/promises";import{isDeepStrictEqual as Zr,stripVTControlCharacters as Qr}from"node:util";import{spawn as $r,spawnSync as ei}from"node:child_process";import{defineCommand as y,runCommand as ti,runMain as ni}from"citty";import{cancel as ri,confirm as ii,intro as b,isCancel as ai,log as oi,multiselect as si,note as x,outro as S,password as ci,select as li,text as ui}from"@clack/prompts";import di from"picocolors";import fi from"string-width";import pi from"cli-table3";import{finished as mi}from"node:stream/promises";import{applyEdits as hi,modify as gi,parse as _i,printParseErrorCode as vi}from"jsonc-parser";import yi from"update-notifier";const C={summary:/* @__PURE__ */ `workflow.site.generated_at.summary.attribution.confidence.classification.updates_matched.known_confounders.page_segment_status.page_segment_eligible_rows.page_segment_returned_rows.page_segment_limited_rows.page_segment_result_limit.page_segment_source_row_limit.page_segment_source_possibly_truncated.page_segment_warnings.query_segment_status.query_segment_eligible_rows.query_segment_returned_rows.query_segment_limited_rows.query_segment_result_limit.query_segment_source_row_limit.query_segment_source_possibly_truncated.query_segment_warnings.device_segment_status.device_segment_eligible_rows.device_segment_returned_rows.device_segment_limited_rows.device_segment_result_limit.device_segment_source_row_limit.device_segment_source_possibly_truncated.device_segment_warnings.country_segment_status.country_segment_eligible_rows.country_segment_returned_rows.country_segment_limited_rows.country_segment_result_limit.country_segment_source_row_limit.country_segment_source_possibly_truncated.country_segment_warnings`.split(`.`),steps:[`rank`,`tool`,`status`,`summary`],actions:[`rank`,`title`,`confidence`,`action`],findings:[`dimension`,`data_status`,`eligible_rows`,`returned_rows`,`limited_rows`,`result_limit`,`unmatched_rows`,`summary`,`winner_key`,`winner_click_delta`,`winner_impression_delta`,`winner_position_delta`,`loser_key`,`loser_click_delta`,`loser_impression_delta`,`loser_position_delta`],templates:[`rank`,`direction`,`template`,`confidence`,`url_count`,`click_delta`,`impression_delta`,`movement_share`,`movement_share_scope`,`confidence_scope`,`eligible_rows`,`returned_rows`,`limited_rows`,`result_limit`,`source_possibly_truncated`,`common_terms`,`sample_urls`,`summary`],evidence:[`rank`,`evidence`],confounders:[`rank`,`source`,`title`,`date`,`scope`,`target`,`description`],segment:[`rank`,`dimension`,`data_status`,`evidence_scope`,`key`,`before_clicks`,`after_clicks`,`click_delta`,`before_impressions`,`after_impressions`,`impression_delta`,`before_position`,`after_position`,`position_delta`],unmatchedSegment:[`rank`,`dimension`,`data_status`,`key`,`retained_in`,`clicks`,`impressions`,`position`,`reason`]};function bi(e,t){return[...e.output.segments[t].winners,...e.output.segments[t].losers].map((n,r)=>({rank:r+1,dimension:t,data_status:e.output.segments[t].dataStatus,evidence_scope:n.evidenceScope,key:n.key,before_clicks:n.beforeClicks,after_clicks:n.afterClicks,click_delta:n.clickDelta,before_impressions:n.beforeImpressions,after_impressions:n.afterImpressions,impression_delta:n.impressionDelta,before_position:n.beforePosition,after_position:n.afterPosition,position_delta:n.positionDelta}))}function xi(e,t){return e.output.segments[t].unmatchedSegments.map((n,r)=>({rank:r+1,dimension:t,data_status:e.output.segments[t].dataStatus,key:n.key,retained_in:n.retainedIn,clicks:n.clicks,impressions:n.impressions,position:n.position,reason:n.reason}))}function Si(e){return[{filename:`postmortem-summary.csv`,headers:[...C.summary],rows:[{workflow:e.workflow,site:e.site,generated_at:e.generatedAt,summary:e.summary,attribution:e.output.update.attribution,confidence:e.output.update.confidence,classification:e.output.update.classification,updates_matched:e.output.update.overlappingUpdates.length,known_confounders:e.output.update.confounders.length,page_segment_status:e.output.segments.page.dataStatus,page_segment_eligible_rows:e.output.segments.page.coverage.eligibleRows,page_segment_returned_rows:e.output.segments.page.coverage.returnedRows,page_segment_limited_rows:e.output.segments.page.coverage.limitedRows,page_segment_result_limit:e.output.segments.page.coverage.resultLimit,page_segment_source_row_limit:e.output.segments.page.coverage.sourceRowLimit,page_segment_source_possibly_truncated:e.output.segments.page.coverage.sourcePossiblyTruncated,page_segment_warnings:e.output.segments.page.warnings.join(`; `),query_segment_status:e.output.segments.query.dataStatus,query_segment_eligible_rows:e.output.segments.query.coverage.eligibleRows,query_segment_returned_rows:e.output.segments.query.coverage.returnedRows,query_segment_limited_rows:e.output.segments.query.coverage.limitedRows,query_segment_result_limit:e.output.segments.query.coverage.resultLimit,query_segment_source_row_limit:e.output.segments.query.coverage.sourceRowLimit,query_segment_source_possibly_truncated:e.output.segments.query.coverage.sourcePossiblyTruncated,query_segment_warnings:e.output.segments.query.warnings.join(`; `),device_segment_status:e.output.segments.device.dataStatus,device_segment_eligible_rows:e.output.segments.device.coverage.eligibleRows,device_segment_returned_rows:e.output.segments.device.coverage.returnedRows,device_segment_limited_rows:e.output.segments.device.coverage.limitedRows,device_segment_result_limit:e.output.segments.device.coverage.resultLimit,device_segment_source_row_limit:e.output.segments.device.coverage.sourceRowLimit,device_segment_source_possibly_truncated:e.output.segments.device.coverage.sourcePossiblyTruncated,device_segment_warnings:e.output.segments.device.warnings.join(`; `),country_segment_status:e.output.segments.country.dataStatus,country_segment_eligible_rows:e.output.segments.country.coverage.eligibleRows,country_segment_returned_rows:e.output.segments.country.coverage.returnedRows,country_segment_limited_rows:e.output.segments.country.coverage.limitedRows,country_segment_result_limit:e.output.segments.country.coverage.resultLimit,country_segment_source_row_limit:e.output.segments.country.coverage.sourceRowLimit,country_segment_source_possibly_truncated:e.output.segments.country.coverage.sourcePossiblyTruncated,country_segment_warnings:e.output.segments.country.warnings.join(`; `)}]},{filename:`workflow-steps.csv`,headers:[...C.steps],rows:e.steps.map((e,t)=>({rank:t+1,tool:e.tool,status:e.status,summary:e.summary}))},{filename:`workflow-actions.csv`,headers:[...C.actions],rows:e.actions.map((e,t)=>({rank:t+1,title:e.title,confidence:e.confidence,action:e.action}))},{filename:`postmortem-findings.csv`,headers:[...C.findings],rows:e.output.insights.map(e=>({dimension:e.dimension,data_status:e.dataStatus,eligible_rows:e.coverage.eligibleRows,returned_rows:e.coverage.returnedRows,limited_rows:e.coverage.limitedRows,result_limit:e.coverage.resultLimit,unmatched_rows:e.unmatchedRows,summary:e.summary,winner_key:e.winner?.key,winner_click_delta:e.winner?.clickDelta,winner_impression_delta:e.winner?.impressionDelta,winner_position_delta:e.winner?.positionDelta,loser_key:e.loser?.key,loser_click_delta:e.loser?.clickDelta,loser_impression_delta:e.loser?.impressionDelta,loser_position_delta:e.loser?.positionDelta}))},{filename:`postmortem-template-movement.csv`,headers:[...C.templates],rows:e.output.templateMovement.map((e,t)=>({rank:t+1,direction:e.direction,template:e.signature,confidence:e.confidence,url_count:e.urlCount,click_delta:e.clickDelta,impression_delta:e.impressionDelta,movement_share:e.movementShare,movement_share_scope:e.movementShareScope,confidence_scope:e.confidenceScope,eligible_rows:e.segmentCoverage.eligibleRows,returned_rows:e.segmentCoverage.returnedRows,limited_rows:e.segmentCoverage.limitedRows,result_limit:e.segmentCoverage.resultLimit,source_possibly_truncated:e.segmentCoverage.sourcePossiblyTruncated,common_terms:e.commonTerms.join(`; `),sample_urls:e.sampleUrls.join(`; `),summary:e.summary}))},{filename:`postmortem-update-evidence.csv`,headers:[...C.evidence],rows:e.output.update.evidence.map((e,t)=>({rank:t+1,evidence:e}))},{filename:`postmortem-confounders.csv`,headers:[...C.confounders],rows:e.output.update.confounders.map((e,t)=>({rank:t+1,source:e.source,title:e.title,date:e.date,scope:e.scope,target:e.target,description:e.description}))},...[`page`,`query`,`device`,`country`].map(t=>({filename:`postmortem-segment-${t}.csv`,headers:[...C.segment],rows:bi(e,t)})),...[`page`,`query`,`device`,`country`].map(t=>({filename:`postmortem-segment-${t}-unmatched.csv`,headers:[...C.unmatchedSegment],rows:xi(e,t)}))]}function Ci(e){return _(e)?Lr(e,{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(`.log`)).map(t=>{let n=g(e,t.name),r=Vr(n);return{path:n,size:r.size,modifiedAt:r.mtimeMs}}):[]}function wi(e,t){let n=Er(e),r=Tr(e,`.log`),i=0;for(;;){let e=g(n,`${r}.${t}${i?`-${i}`:``}.log`);if(!_(e))return e;i+=1}}function Ti(e={}){let t=e.directory??a().logDir,n=e.now??Date.now(),r=e.maxFileBytes??8388608,i=e.maxTotalBytes??67108864,o=e.maxAgeMs??12096e5;Fr(t,{recursive:!0,mode:448});let s=0,c=0;for(let e of Ci(t))e.size<=r||(zr(e.path,wi(e.path,n)),s+=1);for(let e of Ci(t))e.modifiedAt>=n-o||(Br(e.path,{force:!0}),c+=1);let l=Ci(t).sort((e,t)=>e.modifiedAt-t.modifiedAt||(e.path<t.path?-1:+(e.path>t.path))),u=l.reduce((e,t)=>e+t.size,0);for(let e of l){if(u<=i)break;Br(e.path,{force:!0}),u-=e.size,c+=1}return{rotated:s,removed:c,sizeBytes:u}}function Ei(e){let t=e-Date.now();if(t<=0)return`expired`;let n=Math.round(t/6e4);if(n<60)return`in ${n}m`;let r=Math.floor(n/60),i=n%60;return i?`in ${r}h ${i}m`:`in ${r}h`}function Di(e,t){return{type:`boolean`,default:!0,description:e,negativeDescription:t}}function w(e){return typeof e==`string`?e:void 0}function T(e){return typeof e==`boolean`?e:void 0}function Oi(e){let t=w(e.rendering);if(t!==void 0&&t!==`auto`&&t!==`on`&&t!==`off`)throw new h(`INVALID_INPUT`,`--rendering must be auto, on, or off.`);if(T(e.js)===!0&&t&&t!==`on`)throw new h(`INVALID_INPUT`,`Use either --js or --rendering on, not both with different modes.`);return t??(T(e.js)?`on`:`auto`)}function E(e,t){let n=T(e[t]);if(n===!1)return!0;if(n===!0)return!1;let r=T(e[ki(t)]);if(r===!1)return!0;if(r===!0)return!1;if(T(e[`no-${t}`])===!0||T(e[`no${Ai(t)}`])===!0)return!0}function ki(e){return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Ai(e){let t=ki(e);return t?`${t[0]?.toUpperCase()}${t.slice(1)}`:``}function D(e){if(typeof e==`number`)return e;if(typeof e!=`string`||!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function O(e,t){if(e===void 0||e===``)return;let n=D(e);if(n===void 0)throw new h(`INVALID_INPUT`,`${t} must be a number.`);return n}function k(e){if(typeof e!=`string`)return;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length?t:void 0}function ji(e){return k(e)??[]}function Mi(e){let t={concurrency:D(e[`fetch-concurrency`]),intervalCap:D(e[`fetch-interval-cap`]),intervalMs:D(e[`fetch-interval-ms`])};return Object.values(t).some(e=>e!==void 0)?t:void 0}function A(e){return e.json===!0}async function Ni(e,t){let n=w(e),r=w(t);if(n&&r)throw Error(`Use either --body or --body-file, not both.`);if(!n&&!r)return;let i=n??await v(r??``,`utf8`),a=JSON.parse(i);if(!a||typeof a!=`object`||Array.isArray(a))throw Error(`JSON body must be an object.`);return a}function j(e){if(e)return e;throw new h(`INVALID_INPUT`,"No site given. Pass --site with a domain, URL or sc-domain: property. Run `seo sites` to list your Search Console properties.")}async function Pi(e,t={}){let n=j(e),r=(await le(t.refresh,t.account)).map(e=>e.siteUrl),i=Me(r,n);if(!i)throw new h(`PROPERTY_NOT_FOUND`,`This Google login has no Search Console property for ${n}. Run \`seo sites\` to list the properties it can read.`);return i}function Fi(e){if(e)return e;throw new h(`INVALID_INPUT`,"No Google Analytics property given. Pass --property with the numeric property id. Run `seo analytics google properties` to list them.")}function Ii(e){if(typeof e==`number`)return Number.isFinite(e)?Math.round(e):void 0;if(!e)return;let t=Number.parseInt(e,10);return Number.isFinite(t)?t:void 0}function Li(e={}){let t=e.env??process.env,n=Ii(e.columns)??Ii(e.streamColumns)??Ii(t.COLUMNS)??80;return Math.min(200,Math.max(40,n))}function M(e={}){let t=e.env??process.env,n=e.isTTY??!!process.stdout.isTTY,r=e.color??!!(n&&t.NO_COLOR===void 0);return{columns:Li({...e,env:t,streamColumns:e.streamColumns??process.stdout.columns}),colors:di.createColors(r),hasColor:r,isInteractive:n&&!t.CI}}function N(e){return fi(Qr(e))}function Ri(e,t){let n=[],r=``;for(let i of e)r&&N(`${r}${i}`)>t?(n.push(r),r=i):r+=i;return r&&n.push(r),n}function zi(e,t){if(!e)return[``];let n=e.trim().split(/\s+/u),r=[],i=``;for(let e of n){let n=N(e)>t?Ri(e,t):[e];for(let e of n)i?N(`${i} ${e}`)<=t?i+=` ${e}`:(r.push(i),i=e):i=e}return i&&r.push(i),r.length>0?r:[``]}function P(e,t){let n=Math.max(1,t);return e.replaceAll(`\r
|
|
3
|
+
import{$ as e,$n as t,$t as n,A as r,An as i,Ar as a,At as o,B as s,Bn as c,Br as l,Bt as u,C as d,Cn as f,Cr as ee,Ct as te,D as p,Dn as ne,Dr as re,Dt as m,E as ie,En as ae,Er as oe,Et as se,F as ce,Fn as le,Fr as ue,G as de,Gn as fe,Gt as pe,H as me,Hn as he,Ht as ge,I as _e,In as ve,Ir as h,It as ye,J as be,Jn as xe,Jt as Se,K as Ce,Kn as we,Kt as Te,L as Ee,Ln as De,Lr as Oe,Lt as ke,M as Ae,Mn as je,Mr as Me,Mt as Ne,N as Pe,Nn as Fe,Nr as Ie,Nt as Le,O as Re,On as ze,Or as Be,Ot as Ve,P as He,Pn as Ue,Pr as We,Pt as Ge,Q as Ke,Qn as qe,Qt as Je,R as Ye,Rn as Xe,Rr as Ze,Rt as Qe,S as $e,Sn as et,Sr as tt,St as nt,T as rt,Tn as it,Tr as at,Tt as ot,U as st,Un as ct,Ut as lt,V as ut,Vn as dt,Vt as ft,W as pt,Wn as mt,Wt as ht,X as gt,Xn as _t,Xt as vt,Y as yt,Yn as bt,Yt as xt,Z as St,Zn as Ct,Zt as wt,_ as Tt,_n as Et,_r as Dt,_t as Ot,a as kt,an as At,ar as jt,at as Mt,b as Nt,bn as Pt,br as Ft,bt as It,c as Lt,cn as Rt,cr as zt,ct as Bt,d as Vt,dn as Ht,dr as Ut,dt as Wt,en as Gt,er as Kt,et as qt,f as Jt,fn as Yt,fr as Xt,ft as Zt,g as Qt,gn as $t,gr as en,gt as tn,h as nn,hn as rn,hr as an,ht as on,i as sn,in as cn,ir as ln,it as un,j as dn,jn as fn,jr as pn,jt as mn,k as hn,kn as gn,kr as _n,kt as vn,l as yn,ln as bn,lr as xn,lt as Sn,m as Cn,mn as wn,mr as Tn,mt as En,nn as Dn,nr as On,nt as kn,o as An,on as jn,or as Mn,ot as Nn,p as Pn,pn as Fn,pr as In,pt as Ln,q as Rn,qn as zn,qt as Bn,rn as Vn,rr as Hn,rt as Un,sn as Wn,sr as Gn,st as Kn,t as qn,tn as Jn,tr as Yn,tt as Xn,u as Zn,un as Qn,ur as $n,ut as er,v as tr,vn as nr,vr as rr,vt as ir,w as ar,wn as or,wr as sr,wt as cr,x as lr,xn as ur,xr as dr,xt as fr,y as pr,yn as mr,yr as hr,yt as gr,z as _r,zn as vr,zr as yr,zt as br}from"./dist-Bl6qdzNs.js";import{randomBytes as xr}from"node:crypto";import{arch as Sr,homedir as Cr,platform as wr}from"node:os";import{basename as Tr,dirname as Er,join as g,posix as Dr,relative as Or,resolve as kr,sep as Ar,win32 as jr}from"node:path";import{constants as Mr,copyFileSync as Nr,createWriteStream as Pr,existsSync as _,mkdirSync as Fr,readFileSync as Ir,readdirSync as Lr,realpathSync as Rr,renameSync as zr,rmSync as Br,statSync as Vr,writeFileSync as Hr}from"node:fs";import{fileURLToPath as Ur}from"node:url";import{cp as Wr,mkdir as Gr,open as Kr,readFile as v,readdir as qr,rename as Jr,stat as Yr,writeFile as Xr}from"node:fs/promises";import{isDeepStrictEqual as Zr,stripVTControlCharacters as Qr}from"node:util";import{spawn as $r,spawnSync as ei}from"node:child_process";import{defineCommand as y,runCommand as ti,runMain as ni}from"citty";import{cancel as ri,confirm as ii,intro as b,isCancel as ai,log as oi,multiselect as si,note as x,outro as S,password as ci,select as li,text as ui}from"@clack/prompts";import di from"picocolors";import fi from"string-width";import pi from"cli-table3";import{finished as mi}from"node:stream/promises";import{applyEdits as hi,modify as gi,parse as _i,printParseErrorCode as vi}from"jsonc-parser";import yi from"update-notifier";const C={summary:/* @__PURE__ */ `workflow.site.generated_at.summary.attribution.confidence.classification.updates_matched.known_confounders.page_segment_status.page_segment_eligible_rows.page_segment_returned_rows.page_segment_limited_rows.page_segment_result_limit.page_segment_source_row_limit.page_segment_source_possibly_truncated.page_segment_warnings.query_segment_status.query_segment_eligible_rows.query_segment_returned_rows.query_segment_limited_rows.query_segment_result_limit.query_segment_source_row_limit.query_segment_source_possibly_truncated.query_segment_warnings.device_segment_status.device_segment_eligible_rows.device_segment_returned_rows.device_segment_limited_rows.device_segment_result_limit.device_segment_source_row_limit.device_segment_source_possibly_truncated.device_segment_warnings.country_segment_status.country_segment_eligible_rows.country_segment_returned_rows.country_segment_limited_rows.country_segment_result_limit.country_segment_source_row_limit.country_segment_source_possibly_truncated.country_segment_warnings`.split(`.`),steps:[`rank`,`tool`,`status`,`summary`],actions:[`rank`,`title`,`confidence`,`action`],findings:[`dimension`,`data_status`,`eligible_rows`,`returned_rows`,`limited_rows`,`result_limit`,`unmatched_rows`,`summary`,`winner_key`,`winner_click_delta`,`winner_impression_delta`,`winner_position_delta`,`loser_key`,`loser_click_delta`,`loser_impression_delta`,`loser_position_delta`],templates:[`rank`,`direction`,`template`,`confidence`,`url_count`,`click_delta`,`impression_delta`,`movement_share`,`movement_share_scope`,`confidence_scope`,`eligible_rows`,`returned_rows`,`limited_rows`,`result_limit`,`source_possibly_truncated`,`common_terms`,`sample_urls`,`summary`],evidence:[`rank`,`evidence`],confounders:[`rank`,`source`,`title`,`date`,`scope`,`target`,`description`],segment:[`rank`,`dimension`,`data_status`,`evidence_scope`,`key`,`before_clicks`,`after_clicks`,`click_delta`,`before_impressions`,`after_impressions`,`impression_delta`,`before_position`,`after_position`,`position_delta`],unmatchedSegment:[`rank`,`dimension`,`data_status`,`key`,`retained_in`,`clicks`,`impressions`,`position`,`reason`]};function bi(e,t){return[...e.output.segments[t].winners,...e.output.segments[t].losers].map((n,r)=>({rank:r+1,dimension:t,data_status:e.output.segments[t].dataStatus,evidence_scope:n.evidenceScope,key:n.key,before_clicks:n.beforeClicks,after_clicks:n.afterClicks,click_delta:n.clickDelta,before_impressions:n.beforeImpressions,after_impressions:n.afterImpressions,impression_delta:n.impressionDelta,before_position:n.beforePosition,after_position:n.afterPosition,position_delta:n.positionDelta}))}function xi(e,t){return e.output.segments[t].unmatchedSegments.map((n,r)=>({rank:r+1,dimension:t,data_status:e.output.segments[t].dataStatus,key:n.key,retained_in:n.retainedIn,clicks:n.clicks,impressions:n.impressions,position:n.position,reason:n.reason}))}function Si(e){return[{filename:`postmortem-summary.csv`,headers:[...C.summary],rows:[{workflow:e.workflow,site:e.site,generated_at:e.generatedAt,summary:e.summary,attribution:e.output.update.attribution,confidence:e.output.update.confidence,classification:e.output.update.classification,updates_matched:e.output.update.overlappingUpdates.length,known_confounders:e.output.update.confounders.length,page_segment_status:e.output.segments.page.dataStatus,page_segment_eligible_rows:e.output.segments.page.coverage.eligibleRows,page_segment_returned_rows:e.output.segments.page.coverage.returnedRows,page_segment_limited_rows:e.output.segments.page.coverage.limitedRows,page_segment_result_limit:e.output.segments.page.coverage.resultLimit,page_segment_source_row_limit:e.output.segments.page.coverage.sourceRowLimit,page_segment_source_possibly_truncated:e.output.segments.page.coverage.sourcePossiblyTruncated,page_segment_warnings:e.output.segments.page.warnings.join(`; `),query_segment_status:e.output.segments.query.dataStatus,query_segment_eligible_rows:e.output.segments.query.coverage.eligibleRows,query_segment_returned_rows:e.output.segments.query.coverage.returnedRows,query_segment_limited_rows:e.output.segments.query.coverage.limitedRows,query_segment_result_limit:e.output.segments.query.coverage.resultLimit,query_segment_source_row_limit:e.output.segments.query.coverage.sourceRowLimit,query_segment_source_possibly_truncated:e.output.segments.query.coverage.sourcePossiblyTruncated,query_segment_warnings:e.output.segments.query.warnings.join(`; `),device_segment_status:e.output.segments.device.dataStatus,device_segment_eligible_rows:e.output.segments.device.coverage.eligibleRows,device_segment_returned_rows:e.output.segments.device.coverage.returnedRows,device_segment_limited_rows:e.output.segments.device.coverage.limitedRows,device_segment_result_limit:e.output.segments.device.coverage.resultLimit,device_segment_source_row_limit:e.output.segments.device.coverage.sourceRowLimit,device_segment_source_possibly_truncated:e.output.segments.device.coverage.sourcePossiblyTruncated,device_segment_warnings:e.output.segments.device.warnings.join(`; `),country_segment_status:e.output.segments.country.dataStatus,country_segment_eligible_rows:e.output.segments.country.coverage.eligibleRows,country_segment_returned_rows:e.output.segments.country.coverage.returnedRows,country_segment_limited_rows:e.output.segments.country.coverage.limitedRows,country_segment_result_limit:e.output.segments.country.coverage.resultLimit,country_segment_source_row_limit:e.output.segments.country.coverage.sourceRowLimit,country_segment_source_possibly_truncated:e.output.segments.country.coverage.sourcePossiblyTruncated,country_segment_warnings:e.output.segments.country.warnings.join(`; `)}]},{filename:`workflow-steps.csv`,headers:[...C.steps],rows:e.steps.map((e,t)=>({rank:t+1,tool:e.tool,status:e.status,summary:e.summary}))},{filename:`workflow-actions.csv`,headers:[...C.actions],rows:e.actions.map((e,t)=>({rank:t+1,title:e.title,confidence:e.confidence,action:e.action}))},{filename:`postmortem-findings.csv`,headers:[...C.findings],rows:e.output.insights.map(e=>({dimension:e.dimension,data_status:e.dataStatus,eligible_rows:e.coverage.eligibleRows,returned_rows:e.coverage.returnedRows,limited_rows:e.coverage.limitedRows,result_limit:e.coverage.resultLimit,unmatched_rows:e.unmatchedRows,summary:e.summary,winner_key:e.winner?.key,winner_click_delta:e.winner?.clickDelta,winner_impression_delta:e.winner?.impressionDelta,winner_position_delta:e.winner?.positionDelta,loser_key:e.loser?.key,loser_click_delta:e.loser?.clickDelta,loser_impression_delta:e.loser?.impressionDelta,loser_position_delta:e.loser?.positionDelta}))},{filename:`postmortem-template-movement.csv`,headers:[...C.templates],rows:e.output.templateMovement.map((e,t)=>({rank:t+1,direction:e.direction,template:e.signature,confidence:e.confidence,url_count:e.urlCount,click_delta:e.clickDelta,impression_delta:e.impressionDelta,movement_share:e.movementShare,movement_share_scope:e.movementShareScope,confidence_scope:e.confidenceScope,eligible_rows:e.segmentCoverage.eligibleRows,returned_rows:e.segmentCoverage.returnedRows,limited_rows:e.segmentCoverage.limitedRows,result_limit:e.segmentCoverage.resultLimit,source_possibly_truncated:e.segmentCoverage.sourcePossiblyTruncated,common_terms:e.commonTerms.join(`; `),sample_urls:e.sampleUrls.join(`; `),summary:e.summary}))},{filename:`postmortem-update-evidence.csv`,headers:[...C.evidence],rows:e.output.update.evidence.map((e,t)=>({rank:t+1,evidence:e}))},{filename:`postmortem-confounders.csv`,headers:[...C.confounders],rows:e.output.update.confounders.map((e,t)=>({rank:t+1,source:e.source,title:e.title,date:e.date,scope:e.scope,target:e.target,description:e.description}))},...[`page`,`query`,`device`,`country`].map(t=>({filename:`postmortem-segment-${t}.csv`,headers:[...C.segment],rows:bi(e,t)})),...[`page`,`query`,`device`,`country`].map(t=>({filename:`postmortem-segment-${t}-unmatched.csv`,headers:[...C.unmatchedSegment],rows:xi(e,t)}))]}function Ci(e){return _(e)?Lr(e,{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(`.log`)).map(t=>{let n=g(e,t.name),r=Vr(n);return{path:n,size:r.size,modifiedAt:r.mtimeMs}}):[]}function wi(e,t){let n=Er(e),r=Tr(e,`.log`),i=0;for(;;){let e=g(n,`${r}.${t}${i?`-${i}`:``}.log`);if(!_(e))return e;i+=1}}function Ti(e={}){let t=e.directory??a().logDir,n=e.now??Date.now(),r=e.maxFileBytes??8388608,i=e.maxTotalBytes??67108864,o=e.maxAgeMs??12096e5;Fr(t,{recursive:!0,mode:448});let s=0,c=0;for(let e of Ci(t))e.size<=r||(zr(e.path,wi(e.path,n)),s+=1);for(let e of Ci(t))e.modifiedAt>=n-o||(Br(e.path,{force:!0}),c+=1);let l=Ci(t).sort((e,t)=>e.modifiedAt-t.modifiedAt||(e.path<t.path?-1:+(e.path>t.path))),u=l.reduce((e,t)=>e+t.size,0);for(let e of l){if(u<=i)break;Br(e.path,{force:!0}),u-=e.size,c+=1}return{rotated:s,removed:c,sizeBytes:u}}function Ei(e){let t=e-Date.now();if(t<=0)return`expired`;let n=Math.round(t/6e4);if(n<60)return`in ${n}m`;let r=Math.floor(n/60),i=n%60;return i?`in ${r}h ${i}m`:`in ${r}h`}function Di(e,t){return{type:`boolean`,default:!0,description:e,negativeDescription:t}}function w(e){return typeof e==`string`?e:void 0}function T(e){return typeof e==`boolean`?e:void 0}function Oi(e){let t=w(e.rendering);if(t!==void 0&&t!==`auto`&&t!==`on`&&t!==`off`)throw new h(`INVALID_INPUT`,`--rendering must be auto, on, or off.`);if(T(e.js)===!0&&t&&t!==`on`)throw new h(`INVALID_INPUT`,`Use either --js or --rendering on, not both with different modes.`);return t??(T(e.js)?`on`:`auto`)}function E(e,t){let n=T(e[t]);if(n===!1)return!0;if(n===!0)return!1;let r=T(e[ki(t)]);if(r===!1)return!0;if(r===!0)return!1;if(T(e[`no-${t}`])===!0||T(e[`no${Ai(t)}`])===!0)return!0}function ki(e){return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Ai(e){let t=ki(e);return t?`${t[0]?.toUpperCase()}${t.slice(1)}`:``}function D(e){if(typeof e==`number`)return e;if(typeof e!=`string`||!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function O(e,t){if(e===void 0||e===``)return;let n=D(e);if(n===void 0)throw new h(`INVALID_INPUT`,`${t} must be a number.`);return n}function k(e){if(typeof e!=`string`)return;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length?t:void 0}function ji(e){return k(e)??[]}function Mi(e){let t={concurrency:D(e[`fetch-concurrency`]),intervalCap:D(e[`fetch-interval-cap`]),intervalMs:D(e[`fetch-interval-ms`])};return Object.values(t).some(e=>e!==void 0)?t:void 0}function A(e){return e.json===!0}async function Ni(e,t){let n=w(e),r=w(t);if(n&&r)throw Error(`Use either --body or --body-file, not both.`);if(!n&&!r)return;let i=n??await v(r??``,`utf8`),a=JSON.parse(i);if(!a||typeof a!=`object`||Array.isArray(a))throw Error(`JSON body must be an object.`);return a}function j(e){if(e)return e;throw new h(`INVALID_INPUT`,"No site given. Pass --site with a domain, URL or sc-domain: property. Run `seo sites` to list your Search Console properties.")}async function Pi(e,t={}){let n=j(e),r=(await le(t.refresh,t.account)).map(e=>e.siteUrl),i=Me(r,n);if(!i)throw new h(`PROPERTY_NOT_FOUND`,`This Google login has no Search Console property for ${n}. Run \`seo sites\` to list the properties it can read.`);return i}function Fi(e){if(e)return e;throw new h(`INVALID_INPUT`,"No Google Analytics property given. Pass --property with the numeric property id. Run `seo analytics google properties` to list them.")}function Ii(e){if(typeof e==`number`)return Number.isFinite(e)?Math.round(e):void 0;if(!e)return;let t=Number.parseInt(e,10);return Number.isFinite(t)?t:void 0}function Li(e={}){let t=e.env??process.env,n=Ii(e.columns)??Ii(e.streamColumns)??Ii(t.COLUMNS)??80;return Math.min(200,Math.max(40,n))}function M(e={}){let t=e.env??process.env,n=e.isTTY??!!process.stdout.isTTY,r=e.color??!!(n&&t.NO_COLOR===void 0);return{columns:Li({...e,env:t,streamColumns:e.streamColumns??process.stdout.columns}),colors:di.createColors(r),hasColor:r,isInteractive:n&&!t.CI}}function N(e){return fi(Qr(e))}function Ri(e,t){let n=[],r=``;for(let i of e)r&&N(`${r}${i}`)>t?(n.push(r),r=i):r+=i;return r&&n.push(r),n}function zi(e,t){if(!e)return[``];let n=e.trim().split(/\s+/u),r=[],i=``;for(let e of n){let n=N(e)>t?Ri(e,t):[e];for(let e of n)i?N(`${i} ${e}`)<=t?i+=` ${e}`:(r.push(i),i=e):i=e}return i&&r.push(i),r.length>0?r:[``]}function P(e,t){let n=Math.max(1,t);return e.replaceAll(`\r
|
|
4
4
|
`,`
|
|
5
5
|
`).split(`
|
|
6
6
|
`).flatMap(e=>zi(e,n))}function Bi(e,t){if(N(e)<=t)return e;let n=Math.max(1,t-N(`...`)),r=``;for(let t of e){if(N(`${r}${t}`)>n)break;r+=t}return`${r}...`}const Vi={top:``,"top-mid":``,"top-left":``,"top-right":``,bottom:``,"bottom-mid":``,"bottom-left":``,"bottom-right":``,left:``,"left-mid":``,mid:``,"mid-mid":``,right:``,"right-mid":``,middle:``};function Hi(e){return e===void 0?``:String(e)}function Ui(e,t){return e.map((e,n)=>{let r=t.map(e=>Hi(e[n]));return Math.min(42,Math.max(N(e),...r.map(N),4))})}function Wi(e,t,n){return e.length===0||e.length>4||!e.map((e,n)=>t.every(e=>/^-?(?:\d+(?:\.\d+)?|\d+(?:\.\d+)?%)$/u.test(Hi(e[n]).trim()))).some(Boolean)?!1:Ui(e,t).reduce((e,t)=>e+t+2,0)<=n.columns}function Gi(e,t,n){if(!/(?:status|state|assessment|data|allowed)/iu.test(e))return t;let r=t.trim().toLowerCase();return[`pass`,`passed`,`completed`,`allowed`,`yes`].includes(r)?n.colors.green(t):[`warn`,`warning`,`review`,`partial`].includes(r)?n.colors.yellow(t):[`fail`,`failed`,`blocked`,`no`].includes(r)?n.colors.red(t):[`unknown`,`unavailable`].includes(r)?n.colors.blue(t):t}function Ki(e,t,n){let r=Ui(e,t).map(e=>e+2),i=new pi({chars:Vi,colWidths:r,head:e.map(e=>n.colors.bold(e)),style:{border:[],head:[],"padding-left":0,"padding-right":2},wordWrap:!1});for(let a of t)i.push(e.map((e,t)=>P(Gi(e,Hi(a[t]),n),Math.max(1,(r[t]??3)-2)).join(`
|
|
@@ -62,7 +62,7 @@ Updates
|
|
|
62
62
|
`),`Setup will`),x(mc.join(`
|
|
63
63
|
`),`Then run`),S(`Dry run complete. Nothing was changed.`));return}_n();let n=F({json:t}),r=await cc({interactive:n})??await dc({interactive:n}),i=n?await pc():[],a=n?await fc():{status:`skipped`};if(t){I({auth:r,mcp:i,skill:a,next:mc});return}L([[`Sign-in`,gc(r)],[`MCP server`,vc(i)],[`SEO skill`,_c(a)]]);let o=i.filter(e=>e.error);o.length&&x(o.map(e=>`${e.client}: ${e.error}`).join(`
|
|
64
64
|
`),`MCP setup skipped`),a.error&&x(a.error,`SEO skill install failed`),x(`seo sites list your Search Console properties
|
|
65
|
-
seo report --site <site> run the main report for one of them`,`Try next`),S(`Setup complete.`),yc()}const xc=y({meta:{name:`setup`,description:`Sign in with Google, then add the MCP server and skill`},args:{"dry-run":{type:`boolean`,default:!1,description:`Show what setup does without changing anything.`},json:{type:`boolean`,default:!1,description:`Print machine-readable JSON. Never prompts.`}},run:async({args:e})=>bc(e)}),Sc=y({...xc,meta:{name:`start`,description:`Start here: sign in with Google, then add the MCP server and skill to your agents`}}),Cc=y({...Sc,meta:{name:`init`,description:"Legacy alias for `seo start`."}}),wc=y({meta:{name:`logs`,description:`Manage local log retention`},subCommands:{prune:y({meta:{name:`prune`,description:`Rotate large logs and remove old local logs`},args:{quiet:{type:`boolean`,default:!1,description:`Do not print a result.`},json:{type:`boolean`,default:!1,description:`Print machine-readable JSON.`}},run:async({args:e})=>{let t=Ti();A(e)?I(t):e.quiet||process.stdout.write(`Rotated ${t.rotated} and removed ${t.removed} log files. ${Ta(t.sizeBytes)} retained.\n`)}})}}),Tc=[{client:`claude-desktop`,flag:`claude-desktop`},{client:`claude-code`,flag:`claude-code`},{client:`codex`,flag:`codex`},{client:`cursor`,flag:`cursor`}];function Ec(e,t){return T(e.all)?t:Tc.filter(({flag:t})=>T(e[t])).map(({client:e})=>e)}const Dc=y({meta:{name:`mcp`,description:`MCP server helpers`},subCommands:{serve:y({meta:{name:`serve`,description:`Run the SEO MCP server`},args:{test:{type:`boolean`,default:!1,description:`Start in test mode`}},run:async({args:e})=>{let{startMcpServer:t}=await import(`./dist-
|
|
65
|
+
seo report --site <site> run the main report for one of them`,`Try next`),S(`Setup complete.`),yc()}const xc=y({meta:{name:`setup`,description:`Sign in with Google, then add the MCP server and skill`},args:{"dry-run":{type:`boolean`,default:!1,description:`Show what setup does without changing anything.`},json:{type:`boolean`,default:!1,description:`Print machine-readable JSON. Never prompts.`}},run:async({args:e})=>bc(e)}),Sc=y({...xc,meta:{name:`start`,description:`Start here: sign in with Google, then add the MCP server and skill to your agents`}}),Cc=y({...Sc,meta:{name:`init`,description:"Legacy alias for `seo start`."}}),wc=y({meta:{name:`logs`,description:`Manage local log retention`},subCommands:{prune:y({meta:{name:`prune`,description:`Rotate large logs and remove old local logs`},args:{quiet:{type:`boolean`,default:!1,description:`Do not print a result.`},json:{type:`boolean`,default:!1,description:`Print machine-readable JSON.`}},run:async({args:e})=>{let t=Ti();A(e)?I(t):e.quiet||process.stdout.write(`Rotated ${t.rotated} and removed ${t.removed} log files. ${Ta(t.sizeBytes)} retained.\n`)}})}}),Tc=[{client:`claude-desktop`,flag:`claude-desktop`},{client:`claude-code`,flag:`claude-code`},{client:`codex`,flag:`codex`},{client:`cursor`,flag:`cursor`}];function Ec(e,t){return T(e.all)?t:Tc.filter(({flag:t})=>T(e[t])).map(({client:e})=>e)}const Dc=y({meta:{name:`mcp`,description:`MCP server helpers`},subCommands:{serve:y({meta:{name:`serve`,description:`Run the SEO MCP server`},args:{test:{type:`boolean`,default:!1,description:`Start in test mode`}},run:async({args:e})=>{let{startMcpServer:t}=await import(`./dist-DyjgE4zS.js`);await t({test:T(e.test)})}}),install:y({meta:{name:`install`,description:`Install or remove SEO MCP config for local clients`},args:{uninstall:{type:`boolean`,default:!1,description:`Remove the SEO MCP config instead of adding it`},reinstall:{type:`boolean`,default:!1,description:`Rewrite an existing managed SEO MCP config`},"claude-desktop":{type:`boolean`,default:!1,description:`Update Claude Desktop`},"claude-code":{type:`boolean`,default:!1,description:`Update Claude Code`},codex:{type:`boolean`,default:!1,description:`Update Codex CLI, app, and IDE extension`},cursor:{type:`boolean`,default:!1,description:`Update Cursor`},all:{type:`boolean`,default:!1,description:`Update every detected MCP client`},json:{type:`boolean`,default:!1,description:`Print structured JSON output`}},run:async({args:e})=>{if(T(e.uninstall)&&T(e.reinstall))throw new h(`INVALID_INPUT`,`Use either --uninstall or --reinstall, not both.`);let t=Ts(),n=Os({targets:t}),r=A(e),i=Ec(e,n.map(e=>e.client));if(i.length===0){if(!F({json:r}))throw new h(`INVALID_INPUT`,`Choose an MCP client with --claude-desktop, --claude-code, --codex, --cursor, or --all.`);let a=n.length>0?n:t;i=z(await si({message:e.uninstall?`Remove seo from which MCP clients?`:`Install seo into which MCP clients?`,options:a.map(e=>({value:e.client,label:e.label,hint:e.path})),initialValues:n.map(e=>e.client),required:!0}))}let a=i.filter(e=>!t.some(t=>t.client===e));if(a.length>0)throw new h(`INVALID_INPUT`,`MCP setup is not supported for ${a.join(`, `)} on ${process.platform}.`);let o=t.filter(e=>i.includes(e.client)).map(t=>T(e.uninstall)?qs(t):Ks(t,{reinstall:T(e.reinstall)}));if(r)I({operation:T(e.uninstall)?`uninstall`:`install`,results:o});else for(let e of o)process.stdout.write(`${e.changed?`updated`:`skipped`} ${e.client} · ${e.path}\n`)}})}}),Oc=y({meta:{name:`index-coverage`,description:`Find crawlable pages that deserve a closer Google index check`},args:{site:{type:`string`,description:`GSC property URL, for example sc-domain:example.com.`},url:{type:`string`,description:`Start URL to crawl. Defaults to the home page.`},sitemaps:{type:`string`,description:`Comma-separated XML sitemap URLs. Defaults to declarations captured by the crawl.`},days:{type:`string`,description:`Finalized Search Console date range. Defaults to 90 days.`},"row-limit":{type:`string`,description:`Maximum Search Console page rows. Defaults to 100000.`},"max-sitemap-urls":{type:`string`,description:`Maximum sitemap inventory URLs. Defaults to 100000.`},limit:{type:`string`,description:`Maximum URLs returned in each evidence group. Defaults to 100.`},refresh:{type:`boolean`,default:!1,description:`Bypass the local Search Console cache.`},json:{type:`boolean`,default:!1,description:`Print machine-readable JSON.`}},run:async({args:e})=>{let t=A(e),n=j(w(e.site)),r=ji(e.sitemaps),i=await vt({site:n,url:w(e.url),sitemaps:r.length?r:void 0,days:D(e.days),rowLimit:D(e[`row-limit`]),maxSitemapUrls:D(e[`max-sitemap-urls`]),itemsPerSection:D(e.limit),refresh:T(e.refresh)});t?I(i):(K({title:`Index coverage`,target:i.site,status:i.sources.crawl.completeness===`complete`&&i.sources.searchConsole.completeness===`complete`?i.summary.crawlableCandidatesWithoutRetainedSearchVisibility>0?`warning`:`pass`:`unknown`,summary:`${i.summary.crawlableCandidatesWithoutRetainedSearchVisibility} crawlable pages need URL Inspection review.`,metrics:[{label:`Crawl report`,value:i.input.crawlReport.id},{label:`Crawl evidence`,value:i.sources.crawl.completeness},{label:`Sitemap evidence`,value:i.sources.sitemap.completeness},{label:`Search evidence`,value:i.sources.searchConsole.completeness},{label:`Search window`,value:`${i.sources.searchConsole.startDate} to ${i.sources.searchConsole.endDate}`},{label:`Search-visible pages`,value:i.summary.retainedSearchVisibleUrls},{label:`Blocked/non-indexable`,value:i.summary.blockedOrNonIndexableCrawlUrls},{label:`Sitemap only`,value:i.summary.sitemapOnlyUrls},{label:`Search Console only`,value:i.summary.searchConsoleOnlyUrls}]}),i.crawlableWithoutRetainedSearchVisibility.items.length&&(process.stdout.write(`
|
|
66
66
|
Representative URL Inspection candidates
|
|
67
67
|
`),R([`URL`,`Status`,`In sitemap`],i.crawlableWithoutRetainedSearchVisibility.items.map(e=>[G(e.url,80),e.status,e.inSitemap?`yes`:`no`]))),Y(`How to read this report`,i.caveats))}}),kc=y({meta:{name:`link-recover`,description:`Find search-value URLs that are now broken, blocked, or poorly redirected`},args:{site:{type:`string`},...X([`days`,`limit`,`minImpressions`,`refresh`,`js`],{days:{description:`GSC lookback window. Defaults to 90.`},limit:{description:`Maximum GSC pages to check. Defaults to 50.`},minImpressions:{description:`Minimum impressions to check a page. Defaults to 100.`},refresh:{description:`Bypass local GSC and HTTP caches.`},js:{description:`Force JavaScript rendering for final page extraction.`}}),"min-clicks":{type:`string`,description:`Minimum clicks to check a page. Defaults to 1.`},json:{type:`boolean`,default:!1,description:`Print machine-readable JSON.`}},run:async({args:e})=>{let t=A(e),n=await Se({site:j(w(e.site)),days:D(e.days),limit:D(e.limit),minClicks:D(e[`min-clicks`]),minImpressions:D(e[`min-impressions`]),refresh:T(e.refresh),js:T(e.js)?!0:`auto`});t?I(n):(K({title:`Link recovery`,target:n.site,status:n.warnings.length>0?`unknown`:n.summary.recoverable>0?`warning`:`pass`,summary:n.summary.recoverable>0?`${U(n.summary.recoverable)} previously visible URLs need recovery review.`:`No recoverable URLs were found in the retained evidence.`,metrics:[{label:`Range`,value:`${n.range.startDate} to ${n.range.endDate}`},{label:`Checked`,value:U(n.summary.checked)},{label:`Recoverable`,value:U(n.summary.recoverable)},{label:`High severity`,value:U(n.summary.high)},{label:`Clicks at risk`,value:U(n.summary.clicksAtRisk)},{label:`Impressions at risk`,value:U(n.summary.impressionsAtRisk)}]}),n.items.length&&(q([`Severity`,`Issue`,`Clicks`,`Impr`,`URL`,`Action`],n.items.map(e=>[e.severity,e.issue,U(e.clicks),U(e.impressions),G(e.url,56),G(e.recommendation.action,72)])),J(`Top recovery actions`,n.items.map(e=>({label:G(e.url,96),context:`${e.severity}, ${U(e.clicks)} clicks at risk`,action:e.recommendation.action})))),Y(`Warnings`,n.warnings.slice(0,10)))}}),Ac=y({meta:{name:`redirect-trace`,description:`Trace redirects and report final indexability/canonical issues, or check a redirect map`},args:{url:{type:`string`,description:`URL to trace.`},map:{type:`string`,description:`CSV of old_url,expected_new_url lines (header optional), or one URL per line. Traces up to ${c.toLocaleString(`en-US`)} rows, 5 at a time.`},"max-hops":{type:`string`,description:`Maximum redirect hops to follow, up to 10. Defaults to 10.`},refresh:{type:`boolean`,default:!1,description:`Bypass local HTTP cache for final page extraction.`},js:{type:`boolean`,default:!1,description:`Force JavaScript rendering for final page extraction.`},json:{type:`boolean`,default:!1,description:`Print machine-readable JSON.`}},run:async({args:e})=>{let t=w(e.map);if(t){await Pc(e,t);return}let n=w(e.url);if(!n)throw new h(`INVALID_INPUT`,`Pass --url to trace one URL, or --map with a CSV of old and expected URLs.`);let r=await xt({url:n,maxHops:D(e[`max-hops`]),refresh:T(e.refresh),js:T(e.js)?!0:`auto`});A(e)?I(r):(K({title:`Redirect trace`,target:r.url,status:r.summary.issues.length>0||r.summary.error?`warning`:r.summary.finalIndexable===void 0?`unknown`:`pass`,summary:[r.summary.error?`${r.summary.outcome===`timeout`?`Timed out`:`Failed`} at ${r.finalUrl}: ${r.summary.error}`:r.summary.issues.length>0?``:`${r.summary.hops} redirect ${r.summary.hops===1?`hop`:`hops`} ended at HTTP ${r.summary.finalStatus}.`,r.summary.issues.join(`, `)].filter(Boolean).join(` `),metrics:[{label:`Final URL`,value:r.finalUrl},{label:`Final status`,value:r.summary.finalStatus??`No response`},{label:`Indexable`,value:r.summary.finalIndexable===void 0?`Unknown`:r.summary.finalIndexable?`Yes`:`No`},{label:`Hops`,value:r.summary.hops}]}),R([`#`,`Status`,`URL`,`Next`],r.chain.map((e,t)=>[t+1,e.status,G(e.url,72),G(e.nextUrl??`-`,72)])),r.finalPage&&(process.stdout.write(`
|
|
68
68
|
Final page
|
|
@@ -10,7 +10,7 @@ import{createRequire as e}from"node:module";import t,{createHash as n,randomUUID
|
|
|
10
10
|
`),data:{summary:Jn(t.summary)?t.summary:null,path:i?.path??null,total:a.length,columns:u,rows:l,limits:c}}}function cr(e,t,n){let r=Xn(e);if(!r)return{total:0,text:``};let i=r.rows.map(Zn);return{total:i.length,text:er(i.slice(0,n),Qn(i,6),t)}}async function lr(e,t){return(await Ut(e,{signIn:t})).filter(e=>e.permissionLevel!==`siteUnverifiedUser`).map(e=>({siteUrl:e.siteUrl,permissionLevel:e.permissionLevel??``})).sort((e,t)=>e.siteUrl.localeCompare(t.siteUrl))}const ur=e=>{try{return new URL(e.includes(`://`)?e:`https://${e.replace(/^sc-domain:/,``)}`).hostname.replace(/^www\./,``)}catch{return e}};async function dr(e){let t=e.accounts.length>1,[n,r]=await Promise.all([Promise.all(e.accounts.map(async t=>{let[n,r]=await Promise.all([lr(t.google,e.signIn).catch(e=>e instanceof Error?e:Error(String(e))),Gt(t.google,{signIn:e.signIn}).catch(()=>null)]);return{email:t.email,properties:n,analytics:r}})),e.bing?Zt(e.bing).catch(e=>e instanceof Error?e:Error(String(e))):Promise.resolve(null)]),i=Array.isArray(r)?r.filter(e=>e.verified):[],a=new Map(i.map(e=>[ur(e.url),e])),o=n.flatMap(e=>e.properties instanceof Error?[]:e.properties.map(n=>({...n,...t?{account:e.email??``}:{},...Array.isArray(r)?{bing:a.get(ur(n.siteUrl))?.url??``}:{}}))),s=new Set(o.map(e=>ur(e.siteUrl))),c=i.filter(e=>!s.has(ur(e.url))),l=n.filter(e=>e.properties instanceof Error),u=n.flatMap(e=>(e.analytics??[]).flatMap(n=>n.propertySummaries.map(r=>({property:r.property.replace(`properties/`,``),name:r.displayName??``,account:n.displayName??``,...t?{signIn:e.email??``}:{}})))),d=[[`dataforseo`,`x-dataforseo-login`],[`ahrefs`,`x-ahrefs-key`]].filter(([,t])=>e.keys.get(t??``)).map(([e])=>e),f=[`siteUrl`,`permissionLevel`,...t?[`account`]:[],...Array.isArray(r)?[`bing`]:[]];return{text:[t?`Google accounts: ${e.accounts.map(e=>e.email).join(`, `)}.`:null,`Search Console properties (${o.length}):`,o.length?er(o,f,null):`None. These Google sign-ins have no Search Console access, so the reports cannot run.`,...l.map(e=>`${e.email??`Google`}: could not list properties. ${e.properties.message}`),u.length?`Google Analytics properties (${u.length}):\n${er(u,[`property`,`name`,`account`,...t?[`signIn`]:[]],null)}`:`Google Analytics: no properties readable with these sign-ins.`,e.bing===void 0?null:r===null?`Bing Webmaster: not connected.`:r instanceof Error?`Bing Webmaster: could not list sites. ${r.message}`:c.length?`Bing Webmaster sites with no Search Console property here (${c.length}): ${c.map(e=>e.url).join(`, `)}.`:`Bing Webmaster: ${i.length} verified sites; the bing column shows each one.`,`Research keys: ${d.length?d.join(`, `):`none`}.`,e.clicky?.length?`Clicky sites (seo_data with source "clicky"): ${e.clicky.join(`, `)}.`:null,e.simpleAnalytics?`Simple Analytics: API key saved; seo_data with source "simple_analytics" and the site's domain.`:null,`Add a Google account${e.bing===void 0?``:`, Bing`} or a key: ${e.connect}`,`Next: seo_report with a site.`].filter(Boolean).join(`
|
|
11
11
|
|
|
12
12
|
`),data:{searchConsole:o,googleAnalytics:u,bing:Array.isArray(r)?i:null,research:d,clicky:e.clicky??[],simpleAnalytics:!!e.simpleAnalytics}}}const fr={siteOwner:0,siteFullUser:1,siteRestrictedUser:2};function pr(e){if(e.length===0)return null;let t=e[0];if(e.length===1&&t)return t;let n,r=()=>(n??=Promise.all(e.map(async e=>({call:e,sites:await e(`GetUserSites`).then(e=>Array.isArray(e)?e:[]).catch(()=>[])}))),n);return async(e,n={})=>{let i=await r();return e===`GetUserSites`?i.flatMap(e=>e.sites):(i.find(e=>e.sites.some(e=>e.IsVerified===!0&&e.Url===n.siteUrl))?.call??t)(e,n)}}var mr=class{hint;google;bing;sites=/* @__PURE__ */ new Map;owners;constructor(e,t){this.hint=t,this.google=e.google.map(e=>({email:e.email,google:Lt(e.token)})),this.bing=pr(e.bing)}accounts(){return this.google.map(e=>({email:e.email,google:e.google}))}sitesOf(e){let t=this.sites.get(e);return t||(t=lr(e.google,this.hint.signIn),this.sites.set(e,t)),t}ownerMap(){return this.owners??=(async()=>{let e=await Promise.all(this.google.map(async e=>({linked:e,sites:await this.sitesOf(e).catch(e=>{if(this.google.length===1)throw e;return[]})}))),t=/* @__PURE__ */ new Map;for(let{linked:n,sites:r}of e)for(let e of r){let r=fr[e.permissionLevel]??3,i=t.get(e.siteUrl);(!i||r<i.rank)&&t.set(e.siteUrl,{linked:n,rank:r})}return new Map([...t].map(([e,{linked:t}])=>[e,t]))})(),this.owners}async properties(){return[...(await this.ownerMap()).keys()].sort()}async resolve(e){if(this.google.length===0)throw new I(`NOT_CONNECTED`,`No Google account is connected. ${this.hint.signIn}`);let t=await this.properties(),n=Un(t,e);if(n)return n;throw new I(`NO_ACCESS`,`None of the connected Google accounts (${this.google.map(e=>e.email).join(`, `)}) has a Search Console property for ${e}. ${Hn(t,`they`)} ${this.hint.addGoogle}`)}async owner(e){let t=(await this.ownerMap()).get(await this.resolve(e));if(!t)throw new I(`NO_ACCESS`,`No access to ${e}.`);return t}searchAnalytics(){return async(e,t)=>Ht((await this.owner(e)).google,e,{...t,maxRows:t.maxRows??t.rowLimit??1e5},{signIn:this.hint.signIn})}async inspect(e,t){return Wt((await this.owner(e)).google,e,t,{signIn:this.hint.signIn,languageCode:`en-US`})}};let hr;function gr(e){return e.platform===`win32`?g(e.env.APPDATA??g(e.home,`AppData`,`Roaming`),`seo`,`Config`):g(e.env.XDG_CONFIG_HOME??g(e.home,`.config`),`seo`)}function _r(e){return e.platform===`darwin`?g(e.home,`Library`,`Caches`,`seo`):e.platform===`win32`?g(e.env.LOCALAPPDATA??g(e.home,`AppData`,`Local`),`seo`,`Cache`):g(e.env.XDG_CACHE_HOME??g(e.home,`.cache`),`seo`)}function vr(e){return e.platform===`darwin`?g(e.home,`Library`,`Logs`,`seo`):e.platform===`win32`?g(e.env.LOCALAPPDATA??g(e.home,`AppData`,`Local`),`seo`,`Log`):g(e.env.XDG_STATE_HOME??g(e.home,`.local`,`state`),`seo`)}function yr(e){return{env:e.env??process.env,home:e.home??c(),platform:e.platform??process.platform}}function br(e={}){let t=yr(e),n=t.env.SEO_CONFIG_DIR??gr(t),r=t.env.SEO_CACHE_DIR??_r(t);return{configDir:n,cacheDir:r,logDir:t.env.SEO_LOG_DIR??vr(t),providerPackagesDir:g(n,`providers`),installedProviderPackagesFile:g(n,`provider-packages.json`),configFile:g(n,`config.json`),tokensFile:g(n,`tokens.json`),oauthClientFile:g(n,`oauth-client.json`),providerSecretsFile:g(n,`provider-secrets.json`),telemetryStateFile:g(n,`telemetry.json`),cacheDbFile:g(r,`cache.db`)}}function xr(e){let t=yr(e);if(!(t.platform!==`darwin`||t.env.SEO_CONFIG_DIR||t.env.XDG_CONFIG_HOME))return g(t.home,`Library`,`Preferences`,`seo`)}function Sr(e={}){let t=xr(e);if(!t)return;let n=br(e);if(S(t)&&!S(n.configDir))try{C(p(n.configDir),{recursive:!0,mode:448}),D(t,n.configDir)}catch(e){let t=e.code;if(t!==`EEXIST`&&t!==`ENOENT`)throw e}}function Cr(){return hr||(hr=br(),hr)}function wr(){let e=Cr();return Sr(),C(e.configDir,{recursive:!0,mode:448}),C(e.cacheDir,{recursive:!0,mode:448}),C(e.logDir,{recursive:!0,mode:448}),C(e.providerPackagesDir,{recursive:!0,mode:448}),e}function Tr(e){try{return k(e).size}catch{return 0}}function Er(e,t=448){C(p(e),{recursive:!0,mode:t})}function Dr(e){try{return JSON.parse(w(e,`utf8`))}catch{return}}function Or(e,t,n){Er(e);let r=`${e}.${process.pid}.${Date.now()}.tmp`;A(r,JSON.stringify(t,null,2),{encoding:`utf8`,mode:n}),b(r,n),D(r,e),b(e,n)}function kr(e){try{return`0${(k(e).mode&511).toString(8)}`}catch{return`missing`}}function Ar(e){O(e,{recursive:!0,force:!0})}const jr=[`auth`,`crawl_timeout`,`network`,`config`,`data`,`database`,`filesystem`,`internal`,`unknown`],Mr=[`access_denied`,`auth_config_required`,`auth_expired`,`auth_required`,`crawl_timeout`,`database_constraint`,`database_corrupt`,`database_locked`,`database_read_only`,`database_unique_constraint`,`filesystem_full`,`filesystem_not_found`,`filesystem_permission`,`insufficient_data`,`internal_error`,`invalid_input`,`network_connection`,`network_dns`,`network_timeout`,`network_tls`,`optional_provider_unavailable`,`property_not_found`,`provider_unavailable`,`rate_limited`,`unknown`],Nr=[`crawl_pages_run_id_url`],Pr=/* @__PURE__ */ `analytics.auth.cache.change-log.client.content.content-groups.crawl-reports.diagnose.export.gsc-query.indexnow.init.llms.logs.mcp.monitoring.okf.perf.privacy.project.projects.providers.pseo.reports.reset.schedule.server-logs.setup.skill.sites.start.telemetry.tests.updates.url-inspect`.split(`.`),Fr={ACCESS_DENIED:{errorCategory:`auth`,failureReason:`access_denied`},AUTH_CONFIG_REQUIRED:{errorCategory:`auth`,failureReason:`auth_config_required`},AUTH_EXPIRED:{errorCategory:`auth`,failureReason:`auth_expired`},AUTH_REQUIRED:{errorCategory:`auth`,failureReason:`auth_required`},INSUFFICIENT_DATA:{errorCategory:`data`,failureReason:`insufficient_data`},INTERNAL_ERROR:{errorCategory:`internal`,failureReason:`internal_error`},INVALID_INPUT:{errorCategory:`config`,failureReason:`invalid_input`},OPTIONAL_PROVIDER_UNAVAILABLE:{errorCategory:`network`,failureReason:`optional_provider_unavailable`},PROPERTY_NOT_FOUND:{errorCategory:`config`,failureReason:`property_not_found`},PROVIDER_UNAVAILABLE:{errorCategory:`network`,failureReason:`provider_unavailable`},RATE_LIMITED:{errorCategory:`network`,failureReason:`rate_limited`}},Ir=/* @__PURE__ */ new Set([`EAI_AGAIN`,`ENODATA`,`ENOTFOUND`]),Lr=/* @__PURE__ */ new Set([`ECONNREFUSED`,`ECONNRESET`,`ECONNABORTED`,`EPIPE`,`EHOSTUNREACH`,`ENETUNREACH`,`UND_ERR_SOCKET`,`UND_ERR_CONNECT`]),Rr=/* @__PURE__ */ new Set([`ETIMEDOUT`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`]);function zr(e,t){try{return e[t]}catch{return}}function Br(e){if(typeof e!=`string`&&typeof e!=`number`)return;let t=String(e);return t.length>2048?t.slice(0,2048):t}function aee(e){let t=[e],n=/* @__PURE__ */ new Set,r=[];for(;t.length>0&&r.length<4;){let e=t.shift();typeof e==`string`?r.push({message:Br(e)}):e&&typeof e==`object`&&!n.has(e)&&(n.add(e),r.push({code:Br(zr(e,`code`)),message:Br(zr(e,`message`)),name:Br(zr(e,`name`))}),t.push(zr(e,`cause`),zr(e,`error`)))}return r}function oee(e,t){if(e.has(`SQLITE_CONSTRAINT_PRIMARYKEY`)||e.has(`SQLITE_CONSTRAINT_UNIQUE`)||/unique constraint failed/i.test(t)){let e=/unique constraint failed:\s*crawl_pages\.run_id\s*,\s*crawl_pages\.url/i.test(t)?`crawl_pages_run_id_url`:void 0;return{errorCategory:`database`,failureReason:`database_unique_constraint`,...e?{failureContext:e}:{}}}if([...e].some(e=>e.startsWith(`SQLITE_CONSTRAINT`))||/constraint failed/i.test(t))return{errorCategory:`database`,failureReason:`database_constraint`};if([...e].some(e=>e.startsWith(`SQLITE_BUSY`)||e.startsWith(`SQLITE_LOCKED`))||/database is locked/i.test(t))return{errorCategory:`database`,failureReason:`database_locked`};if([...e].some(e=>e.startsWith(`SQLITE_CORRUPT`))||e.has(`SQLITE_NOTADB`)||/database disk image is malformed|file is not a database/i.test(t))return{errorCategory:`database`,failureReason:`database_corrupt`};if([...e].some(e=>e.startsWith(`SQLITE_READONLY`))||/attempt to write a readonly database/i.test(t))return{errorCategory:`database`,failureReason:`database_read_only`}}function see(e){if(e.has(`EACCES`)||e.has(`EPERM`)||e.has(`EROFS`))return{errorCategory:`filesystem`,failureReason:`filesystem_permission`};if(e.has(`ENOENT`))return{errorCategory:`filesystem`,failureReason:`filesystem_not_found`};if(e.has(`ENOSPC`)||e.has(`EDQUOT`)||e.has(`SQLITE_FULL`))return{errorCategory:`filesystem`,failureReason:`filesystem_full`};if([...e].some(e=>Ir.has(e)))return{errorCategory:`network`,failureReason:`network_dns`};if([...e].some(e=>Rr.has(e)))return{errorCategory:`network`,failureReason:`network_timeout`};if([...e].some(e=>Lr.has(e)))return{errorCategory:`network`,failureReason:`network_connection`};if([...e].some(e=>/^(?:CERT_|DEPTH_ZERO_SELF_SIGNED_CERT$|ERR_SSL_|ERR_TLS_|SELF_SIGNED_CERT_IN_CHAIN$|UNABLE_TO_VERIFY_LEAF_SIGNATURE$)/.test(e)))return{errorCategory:`network`,failureReason:`network_tls`}}function cee(e){let t=aee(e),n=new Set(t.map(e=>e.code?.toUpperCase()).filter(e=>!!e)),r=oee(n,t.map(e=>e.message).filter(e=>!!e).join(`
|
|
13
|
-
`));if(r)return r;let i=see(n);if(i)return i;if(t.some(e=>e.name===`AbortError`||e.name===`TimeoutError`))return{errorCategory:`crawl_timeout`,failureReason:`crawl_timeout`};let a=t.find(e=>e.name===`ProviderError`),o=yt[a?.code],s=o&&Fr[o];if(s)return s;for(let e of n){let t=Fr[e];if(t)return t}return t.some(e=>e.name===`CLIError`)?{errorCategory:`config`,failureReason:`invalid_input`}:{errorCategory:`unknown`,failureReason:`unknown`}}function Vr(e){try{return cee(e)}catch{return{errorCategory:`unknown`,failureReason:`unknown`}}}function Hr(e){return typeof e==`string`&&Pr.includes(e)}function Ur(e){let t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())),n=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-n);let r=new Date(Date.UTC(t.getUTCFullYear(),0,1)),i=Math.ceil(((t.getTime()-r.getTime())/864e5+1)/7);return`${t.getUTCFullYear()}-W${String(i).padStart(2,`0`)}`}function Wr(e){let t=e?.toLowerCase()??``;return t?t.includes(`claude`)?`claude-code`:t.includes(`cursor`)?`cursor`:t.includes(`codex`)||t.includes(`openai`)?`codex`:`unknown`:null}const Gr=`0.22.
|
|
13
|
+
`));if(r)return r;let i=see(n);if(i)return i;if(t.some(e=>e.name===`AbortError`||e.name===`TimeoutError`))return{errorCategory:`crawl_timeout`,failureReason:`crawl_timeout`};let a=t.find(e=>e.name===`ProviderError`),o=yt[a?.code],s=o&&Fr[o];if(s)return s;for(let e of n){let t=Fr[e];if(t)return t}return t.some(e=>e.name===`CLIError`)?{errorCategory:`config`,failureReason:`invalid_input`}:{errorCategory:`unknown`,failureReason:`unknown`}}function Vr(e){try{return cee(e)}catch{return{errorCategory:`unknown`,failureReason:`unknown`}}}function Hr(e){return typeof e==`string`&&Pr.includes(e)}function Ur(e){let t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())),n=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-n);let r=new Date(Date.UTC(t.getUTCFullYear(),0,1)),i=Math.ceil(((t.getTime()-r.getTime())/864e5+1)/7);return`${t.getUTCFullYear()}-W${String(i).padStart(2,`0`)}`}function Wr(e){let t=e?.toLowerCase()??``;return t?t.includes(`claude`)?`claude-code`:t.includes(`cursor`)?`cursor`:t.includes(`codex`)||t.includes(`openai`)?`codex`:`unknown`:null}const Gr=`0.22.3`,Kr=/* @__PURE__ */ `affected-urls.ai-referrals.audit-page.audit-urls.cannibalisation.compare-crawls.content-optimization.crawl-diff.site-crawl.ctr-underperformers.decaying-pages.setup-check.explain-crawl-issue.crawl-report.index-coverage.index-coverage-plan.index-monitor.index-watch.internal-links.keyword-metrics.link-evidence.link-recovery.crawl-history.crawler-rules.measure-change.page-opportunities.performance-audit.query-clusters.quick-wins.ranked-keywords.redirect-trace.second-page.segment-impact.serp-results.serp-competitors.striking-distance.top-fixes.traffic-anomaly.update-correlation.search-performance-overview.refresh-priorities.technical-watch.update-postmortem`.split(`.`),qr=[{days:1,event:`active_d1`},{days:7,event:`active_d7`},{days:30,event:`active_d30`}],Jr=[`GITHUB_ACTIONS`,`GITLAB_CI`,`CIRCLECI`,`TRAVIS`,`BUILDKITE`,`JENKINS_URL`,`TEAMCITY_VERSION`,`TF_BUILD`,`BITBUCKET_BUILD_NUMBER`,`CODEBUILD_BUILD_ID`];function Yr(e){return e.env??process.env}function Xr(e){return e.now??/* @__PURE__ */ new Date}function Zr(e){return e.stateFile??Cr().telemetryStateFile}function Qr(e){return e===`1`||e?.toLowerCase()===`true`}function $r(e=process.env){return e.NODE_ENV===`test`||!!e.NODE_TEST_CONTEXT||Qr(e.CI)||Jr.some(t=>!!e[t])}function ei(e){if($r(e))return`ci`;if(Qr(e.DO_NOT_TRACK))return`do_not_track`;if(Qr(e.SEOSKILL_TELEMETRY_DISABLED)||Qr(e.SEO_TELEMETRY_DISABLED))return`environment`}function ti(e){return typeof e==`string`&&[`first_run`,`setup_complete`,`first_audit_complete`,`active_d1`,`active_d7`,`active_d30`].includes(e)}function ni(e){return typeof e==`string`&&Kr.includes(e)}function ri(e){return typeof e==`string`&&/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/.test(e)}function ii(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.telemetryEnabled==`boolean`&&typeof t.firstRunAt==`string`&&Number.isFinite(Date.parse(t.firstRunAt))&&ri(t.cohort)&&Array.isArray(t.sentMilestones)&&t.sentMilestones.every(ti)}function ai(e){if(!S(e))return{kind:`missing`};let t=Dr(e);return ii(t)?{kind:`valid`,state:t}:{kind:`invalid`}}function oi(e,t){Or(e,t,384)}function si(e,t=!0){let n=Xr(e);return{telemetryEnabled:t,firstRunAt:n.toISOString(),cohort:Ur(n),sentMilestones:[]}}function ci(e={}){let t=e.env??process.env;return Wr(e.clientName)||(t.CLAUDECODE||t.CLAUDE_CODE?`claude-code`:t.CURSOR_AGENT||t.CURSOR_TRACE_ID||t.CURSOR_SESSION_ID?`cursor`:t.CODEX_HOME||t.CODEX_THREAD_ID||t.CODEX_SANDBOX?`codex`:`cli`)}function li(e=process.env){let t=(e.AI_AGENT||e.AGENT)?.trim().toLowerCase();if(t)return t.slice(0,40);let n=ci({env:e});return n===`cli`?e.GEMINI_CLI?`gemini`:e.OPENCODE||e.OPENCODE_CLIENT?`opencode`:e.ANTIGRAVITY_AGENT?`antigravity`:e.AUGMENT_AGENT?`augment`:e.COPILOT_MODEL||e.COPILOT_ALLOW_ALL?`github-copilot`:e.REPL_ID?`replit`:null:n}function ui(e){return e.agent??ci({clientName:e.clientName,env:Yr(e)})}function di(e){return e.replace(/^v/,``).split(`.`)[0]||`unknown`}function fi(e,t,n={},r={}){return{event:e,version:r.version??Gr,agent:ui(r),os:r.processPlatform??u(),arch:r.processArch??s(),node:di(r.nodeVersion??process.version),cohort:t.cohort,schema:2,...n.errorCategory?{errorCategory:n.errorCategory}:{},...n.failureReason?{failureReason:n.failureReason}:{},...n.failureContext?{failureContext:n.failureContext}:{},...n.operation?{operation:n.operation}:{},...n.report?{report:n.report}:{}}}function pi(e,t){let n=t.fetch??globalThis.fetch;try{n(t.endpoint??`https://seoskill.dev/api/t`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e),signal:AbortSignal.timeout(2e3)}).catch(()=>void 0)}catch{}}function mi(e){let t=Zr(e),n=ei(Yr(e)),r=ai(t);return n?{enabled:!1,reason:n,stateFile:t,...r.kind===`valid`?{state:r.state}:{}}:r.kind===`invalid`?{enabled:!1,reason:`invalid_state`,stateFile:t}:r.kind===`valid`&&!r.state.telemetryEnabled?{enabled:!1,reason:`local_setting`,stateFile:t,state:r.state}:{enabled:!0,stateFile:t,...r.kind===`valid`?{state:r.state}:{}}}function hi(e={}){return mi(e)}function gi(e,t={}){let n=Zr(t),r=ai(n),i=r.kind===`valid`?r.state:si(t,e);return i.telemetryEnabled=e,oi(n,i),mi(t)}function _i(e){let t=mi(e);return t.enabled?t.state:void 0}function vi(e={}){let t=mi(e);if(!t.enabled)return t;let n=t.stateFile,r=t.state??si(e),i=[];if(!r.sentMilestones.includes(`first_run`)){try{(e.notice??(e=>process.stderr.write(e)))(`SEO Skill collects anonymous usage data to improve the tool (event name,
|
|
14
14
|
fixed report or command name, fixed failure classification, version, agent,
|
|
15
15
|
OS, architecture, Node major, and install week; never URLs, report data, error
|
|
16
16
|
messages, command arguments, or identifiers of any kind).
|
|
@@ -375,19 +375,8 @@ a!==-1&&(Af(i,a,0,t,r),n.push(...t))}),this._make(n)}function Wf(e){return Ql(e?
|
|
|
375
375
|
|
|
376
376
|
`)}const FJ=`x-clicky-`;function IJ(e){let t=[];for(let[n,r]of e){if(!n.startsWith(`x-clicky-`))continue;let e=n.slice(9);if(!uH(e))continue;let i=r.trim(),a=null,o=!1;if(i.startsWith(`{`))try{let e=JSON.parse(i);i=typeof e.sitekey==`string`?e.sitekey:``,a=typeof e.domain==`string`?e.domain:null,o=e.account===!0}catch{continue}dH(i)&&t.push({siteId:e,sitekey:i,domain:a,account:o})}return t.sort((e,t)=>e.siteId<t.siteId?-1:+(e.siteId>t.siteId))}const LJ=e=>e.domain?`${e.siteId} (${e.domain})`:e.siteId;function RJ(e){let t=e.trim().toLowerCase().replace(/^sc-domain:/u,``);try{return new URL(t.includes(`://`)?t:`https://${t}`).hostname.replace(/^www\./u,``)}catch{return t}}async function zJ(e,t,n,r){let i=RJ(t),a=e=>e.siteId===t.trim()||e.domain===i,o=e;if(!o.some(a)&&r&&(o=await r()??o),!o.length)throw new I(`NO_KEY`,`No Clicky site is saved. Add your Clicky account, or one site's ID and sitekey (Clicky, Preferences, Info): ${n}`);let s=o.find(a);if(s)return s;if(!uH(t)){for(let e of o.filter(e=>!e.domain).slice(0,10))e.domain=await pH(e).catch(()=>null);let e=o.find(a);if(e)return e}throw new I(`NO_ACCESS`,`No saved Clicky site matches ${t}. Saved Clicky sites: ${o.map(LJ).join(`, `)}. Pass one of these site IDs, or add the site: ${n}`)}const BJ=864e5,VJ=e=>new Date(e).toISOString().slice(0,10);function HJ(e){if(!e.startDate&&!e.endDate){let e=Date.now()-BJ;return{startDate:VJ(e-27*BJ),endDate:VJ(e)}}let t=Date.parse(`${e.startDate}T00:00:00Z`),n=Date.parse(`${e.endDate}T00:00:00Z`);if(!e.startDate||!e.endDate||!(t<=n))throw new I(`INVALID_INPUT`,`Send a start date and an end date together, in order.`);if((n-t)/BJ+1>31)throw new I(`INVALID_INPUT`,`Clicky reads at most 31 days at a time. Send a shorter range.`);return{startDate:e.startDate,endDate:e.endDate}}const UJ=e=>{let t=Number(e.value);return Number.isSafeInteger(t)&&t>=0?t:null},WJ=e=>e.map(e=>({name:e.title??``,visits:UJ(e)})).filter(e=>!!e.name&&e.visits!==null),GJ=e=>{let t=e.slice(0,10).map(e=>`${e.name} ${e.visits}`),n=e.slice(10);return n.length&&t.push(`${n.length} others ${n.reduce((e,t)=>e+t.visits,0)}`),t.join(`; `)},KJ=1e3;async function qJ(e,t,n){let r=n.refresh,i=await zJ(IJ(t),e.site,n.connect,r&&(async()=>{let e=await r().catch(()=>null);return e&&IJ(e)})),a=HJ(e),o=e.offset??0,s=await fH(i,[`pages-entrance`,`traffic-sources`,`searches-engines`],{date:`${a.startDate},${a.endDate}`,limit:KJ}).catch(e=>{throw e instanceof lH?new I(e.code===`auth`?`NO_ACCESS`:`PROVIDER_ERROR`,e.code===`auth`?`${e.message} Save it again: ${n.connect}`:e.message):e}),c=s[`pages-entrance`]??[],l=/* @__PURE__ */ new Map;for(let e of c){let t=UJ(e);if(t===null||!e.url)continue;let n;try{n=new URL(e.url).pathname}catch{continue}l.set(n,(l.get(n)??0)+t)}let u=[...l].map(([e,t])=>({page:e,visits:t})).sort((e,t)=>t.visits-e.visits||(e.page<t.page?-1:+(e.page>t.page))),d=WJ(s[`traffic-sources`]??[]),f=WJ(s[`searches-engines`]??[]),p=[`Visits by landing page from every source, as Clicky counts them, in the Clicky site’s time zone. Clicky does not split landing pages by source.`,d.length?`Traffic sources (visits): ${GJ(d)}.`:`Traffic sources: none in this range.`,f.length?`Search engines (visits): ${GJ(f)}.`:`Search engines: none in this range.`];return c.length>=KJ&&p.push(`Clicky returned its ${KJ}-row limit; pages past it are missing, not zero.`),{text:HK({title:`Clicky site ${LJ(i)}: landing pages, ${a.startDate} to ${a.endDate}.`,rows:u,offset:o,limit:50,detail:e.detail??`summary`,notes:p,more:n.call}),data:{siteId:i.siteId,domain:i.domain,range:a,metric:`visits`,sources:d,searchEngines:f,capped:c.length>=KJ,total:u.length,offset:o,rows:u.slice(o,o+50)}}}function JJ(e,t){let n=/* @__PURE__ */ new Map,r=(e,t,r)=>{let i=n.get(e)??{visits:0,previousVisits:0};i[r]+=t,n.set(e,i)};for(let t of e)r(t.name,t.visits,`visits`);for(let e of t)r(e.name,e.visits,`previousVisits`);return[...n].map(([e,t])=>({name:e,...t})).sort((e,t)=>t.visits-e.visits||t.previousVisits-e.previousVisits||(e.name<t.name?-1:+(e.name>t.name)))}const YJ=e=>({visits:e.reduce((e,t)=>e+t.visits,0),previousVisits:e.reduce((e,t)=>e+t.previousVisits,0)}),XJ=e=>e.slice(0,10).map(e=>`${e.name} ${e.visits} (was ${e.previousVisits})`).join(`, `);async function ZJ(e,t,n,r,i){let a=e?IJ(e):[];if(!a.length)return null;let o;try{o=await zJ(a,t,``)}catch{return null}let s=[`visitors`,`traffic-sources`,`links-domains`,...i?[`pages-entrance`]:[]];try{let e=e=>fH(o,s,{date:`${e.startDate},${e.endDate}`,limit:KJ}),t=await e(n),a=await e(r),c=e=>e.reduce((e,t)=>e+(UJ(t)??0),0),l={visits:c(t.visitors??[]),previousVisits:c(a.visitors??[])},u=JJ(WJ(t[`traffic-sources`]??[]),WJ(a[`traffic-sources`]??[])),d=e=>WJ(e).flatMap(e=>{let t=ws(e.name);return t?[{name:t.label,visits:e.visits}]:[]}),f=JJ(d(t[`links-domains`]??[]),d(a[`links-domains`]??[])),p=YJ(f),m=e=>{let t=0;for(let n of e){let e=UJ(n);if(e!==null&&n.url)try{new URL(n.url).pathname.includes(i??``)&&(t+=e)}catch{}}return t},h=i?{contains:i,visits:m(t[`pages-entrance`]??[]),previousVisits:m(a[`pages-entrance`]??[])}:null,g=e=>[t,a].some(t=>{let n=t[e]?.length??0;return n>=KJ||n===100}),_=g(`links-domains`),v=!!i&&g(`pages-entrance`),y=Math.round((Date.now()-Date.parse(`${r.startDate}T00:00:00Z`))/BJ),b=[`Visits are Clicky’s own count, in the Clicky site’s time zone; they are not Google Analytics sessions or Search Console clicks.`,v?`Clicky’s list of landing pages reached its row limit (100 on a free account, 1,000 otherwise), so the landing-page total can be higher than shown.`:``,y>30?`The earlier period starts ${y} days ago; a free Clicky account keeps 30 days, so on one it can read as zero.`:``].filter(Boolean),x=`${l.visits} (was ${l.previousVisits}, ${Wq(Fn(l.visits,l.previousVisits))})`,S=[`Clicky site ${LJ(o)}: visits ${x}${i?` on the whole site`:``}.`,u.length?`Traffic sources (visits): ${XJ(u)}.`:``,h?`Visits that landed on pages whose path contains "${i}", from every source: ${h.visits} (was ${h.previousVisits}, ${Wq(Fn(h.visits,h.previousVisits))}). Clicky does not split landing pages by source.`:``,...b].filter(Boolean).join(` `),C=`Clicky’s list of incoming link domains reached its row limit (100 on a free account, 1,000 otherwise)`;return{text:`${S}\n\n${[p.visits||p.previousVisits?`Visits from AI assistants in Clicky’s incoming links (whole site): ${p.visits} (was ${p.previousVisits}, ${Wq(Fn(p.visits,p.previousVisits))}). By source: ${XJ(f)}.`:_?`Visits from AI assistants in Clicky’s incoming links (whole site): none among the domains Clicky listed. ${C}, so this is unknown, not zero.`:`Visits from AI assistants in Clicky’s incoming links (whole site): none in either period.`,_&&(p.visits||p.previousVisits)?`${C}, so these can be higher.`:``,`Only visits that pass a referrer count; AI apps that send none show as direct.`].filter(Boolean).join(` `)}`,data:{siteId:o.siteId,domain:o.domain,metric:`visits`,...l,visitsChangePct:Fn(l.visits,l.previousVisits),trafficSources:u.map(({name:e,...t})=>({source:e,...t})),...h?{landingPages:{...h,capped:v}}:{},aiAssistants:{...p,visitsChangePct:Fn(p.visits,p.previousVisits),bySource:f.map(({name:e,...t})=>({source:e,...t})),capped:_},notes:b}}}catch(e){let t=e instanceof lH||e instanceof Error?e.message:String(e);return{text:`Clicky: could not be read. ${t}`,data:{error:t}}}}const QJ=8e3,$J=864e5;function eY(e){return new Date(Date.parse(e.updated_at)+90*$J).toISOString().slice(0,10)}function tY(e,t){let n=Date.parse(e.updated_at);return!Number.isFinite(n)||t.getTime()-n>90*$J}function nY(e){let t=e.trim();if(!t)throw new I(`INVALID_INPUT`,`context is empty. Nothing was saved.`);if(t.length>8e3)throw new I(`INVALID_INPUT`,`context is ${t.length.toLocaleString(`en-US`)} characters; the most is ${QJ.toLocaleString(`en-US`)}. Shorten it and save again. Nothing was saved.`);return t}function rY(e,t){let n=e.split(`
|
|
377
377
|
`),r=n.findIndex(e=>/^##\s/.test(e)&&e.slice(2).trim().toLowerCase()===t);if(r<0)return[];let i=[];for(let e of n.slice(r+1)){if(/^#{1,2}\s/.test(e))break;let t=e.replace(/^\s*(?:[-*+]|\d+[.)])\s+/,``).trim();t&&i.push(t)}return i}function iY(e){let t=rY(e,`brand names`).map(e=>e.split(/\s+[(\u2013\u2014-]\s*|\s*[\u2013\u2014:]\s+/)[0]?.replace(/[`"“”*]/g,``).trim()).filter(e=>!!e);return[...new Set(t)]}function aY(e){let t=[];for(let n of rY(e,`conversion pages`)){let e=n.split(/\s/)[0]?.replace(/[`<>]/g,``);if(!e)continue;let r=null;if(e.startsWith(`/`))r=e;else if(/^https?:\/\//i.test(e))try{r=new URL(e.replace(/\*$/,``)).pathname,e.endsWith(`*`)&&(r+=`*`)}catch{r=null}if(!r)continue;let i=r.endsWith(`*`)||r.endsWith(`/`)&&r!==`/`;t.push({path:oY(r.replace(/\*$/,``)),prefix:i})}return t}const oY=e=>e.length>1?e.replace(/\/+$/,``):e,sY=e=>e.match(/https?:\/\/\S+/)?.[0];function cY(e,t){if(!t.length)return!1;let n=sY(e);if(!n)return!1;let r;try{r=oY(new URL(n).pathname)}catch{return!1}return t.some(e=>e.prefix?r===e.path||r.startsWith(`${e.path}/`):r===e.path)}function lY(e,t){return[`Write the business context for ${e}, which says what the business sells, who buys it, and which pages turn a visit into a customer. Every later step uses it to put the pages that bring customers first and to judge whether a search fits the product.`,`Research it in this order, and stop once each heading below has an answer:`,[`1. Read the home page, the pricing page and the main product or feature pages (${t(`page`,{url:`<url>`})} reads one live).`,`2. Read the pages and queries that already bring clicks with ${t(`report`,{site:e})}.`,`3. Find the competitors with ${t(`research`,{action:`competitors`,target:new URL(Pn(e)).hostname})}, plus the companies the site's own comparison or alternatives pages name. Without a research key, use any SEO tool or signed-in browser the person has.`,`4. Read what customers say, where the business has reviews (G2, Capterra, Trustpilot, app stores, Reddit), and note the words buyers use for their problem.`].join(`
|
|
378
|
-
`),`Write it in Markdown under these headings, short and factual, at most ${QJ.toLocaleString(`en-US`)} characters
|
|
379
|
-
|
|
380
|
-
## What counts as a conversion
|
|
381
|
-
Name the Google Analytics key events that count, such as sign_up, where the site has them.
|
|
382
|
-
## Conversion pages
|
|
383
|
-
The pages whose main job is to get a visitor to sign up, start a trial, book a demo or buy, and the pricing page. A docs page counts when it is the sign-up or install step itself. Jobs on these pages come first, so name single pages rather than whole sections. One path or URL per line, such as /pricing or /demo. A path ending in / covers every page under it, such as /features/, but / on its own is the home page. Use a section path only when every page there does that job.
|
|
384
|
-
## Brand names
|
|
385
|
-
The names people type when they look for this business by name, one per line, such as the product name, the company name and the domain. The reports count every search that contains one of them as a brand search and leave it out, so a name that is also an everyday word belongs here only when the searches show people mean this business. Propose them from the queries in the report, and give the evidence for each: the name with words such as login, pricing, app, download or a competitor's name, clicks that land on the home page, or a top position with a high click rate. The person confirms or removes them when they reply to the draft.
|
|
386
|
-
## Competitors
|
|
387
|
-
One domain per line.
|
|
388
|
-
## Markets
|
|
389
|
-
## Voice
|
|
390
|
-
## Notes`,`Send the person the draft in one message, with up to three questions on what your research left unsure, such as what counts as a conversion, which customers they want more of, or who they lose deals to. Wait for their reply before you save, even when the site or its code seems to answer everything, because only the person can confirm which customers they want. Change what they correct, then save it with ${t(`next`,{site:e,context:`<the Markdown>`})}, which replaces any earlier version and returns the next step.`].join(`
|
|
378
|
+
`),`Write it in Markdown under these headings, short and factual, at most ${QJ.toLocaleString(`en-US`)} characters:`,[`## What it sells`,`## Who buys it`,`## What counts as a conversion`,`Name the Google Analytics key events that count, such as sign_up, where the site has them.`,`## Conversion pages`,`The pages whose main job is to get a visitor to sign up, start a trial, book a demo or buy, and the pricing page. A docs page counts when it is the sign-up or install step itself. Jobs on these pages come first, so name single pages rather than whole sections. One path or URL per line, such as /pricing or /demo. A path ending in / covers every page under it, such as /features/, but / on its own is the home page. Use a section path only when every page there does that job.`,`## Brand names`,`The names people type when they look for this business by name, one per line: the product or company name, and the domain as people type it, such as example.com. The reports leave out every search that contains one of these names, with or without a space inside it, so "openbook" also catches "open book". Before you propose a name, list the searches it would catch with ${t(`data`,{site:e,query:`<name>`})}. Propose it only when those searches are about this business: the name with words such as login, pricing, app, download or a competitor's name, clicks that land on the home page, or a top position with a high click rate. Leave a name out when it is also the words people use for the product category or the service itself, such as a recipe site called Easy Recipes, because it would hide the searches that bring new customers. The domain alone is enough then. Show the person each name with its evidence and the clicks it would hide, and they confirm or remove them when they reply to the draft.`,`## Competitors`,`One domain per line.`,`## Markets`,`## Voice`,`## Notes`].join(`
|
|
379
|
+
`),`Send the person the draft in one message, with up to three questions on what your research left unsure, such as what counts as a conversion, which customers they want more of, or who they lose deals to. Wait for their reply before you save, even when the site or its code seems to answer everything, because only the person can confirm which customers they want. Change what they correct, then save it with ${t(`next`,{site:e,context:`<the Markdown>`})}, which replaces any earlier version and returns the next step.`].join(`
|
|
391
380
|
|
|
392
381
|
`)}const uY=`domain_rating: Domain Rating by Ahrefs (https://ahrefs.com/).`,dY=[`domain`,`competitor_domain`,`Dn`];function fY(e){return e.replace(/^sc-domain:/,``).replace(/^https?:\/\//,``).replace(/\/.*$/,``).replace(/^www\./,``).toLowerCase()}async function pY(e,t){let n=`https://api.ahrefs.com/v3/public/domain-rating-free?target=${encodeURIComponent(e)}`,r=globalThis.caches?.default,i=new Request(n),a=await r?.match(i),o=a??await fetch(n,{headers:{authorization:`Bearer ${t}`,accept:`application/json`},signal:AbortSignal.timeout(5e3)});if(!o.ok)return null;let s=await Mt(o.clone(),`Ahrefs Domain Rating`);if(r&&!a){let e=new Response(o.body,o);e.headers.set(`cache-control`,`max-age=86400`),await r.put(i,e)}return s.domain_rating?.domain_rating??null}async function mY(e,t,n=50){let r=/* @__PURE__ */ new Map;if(!t)return r;let i=[...new Set(e.map(fY).filter(Boolean))].slice(0,n);for(let e=0;e<i.length;e+=25){let n=i.slice(e,e+25),a=await Promise.all(n.map(e=>pY(e,t).catch(()=>null)));n.forEach((e,t)=>{r.set(e,a[t]??null)})}return r}async function hY(e,t,n=0){let r=dY.find(t=>e.some(e=>typeof e[t]==`string`));if(!t||!r||e.some(e=>`domain_rating`in e))return{rows:e,added:!1};let i=await mY(e.slice(n).map(e=>String(e[r]??``)),t);return{rows:e.map(e=>{let t={};for(let[n,a]of Object.entries(e))t[n]=a,n===r&&(t.domain_rating=i.get(fY(String(a??``)))??null);return t}),added:!0}}const gY=2e3,_Y={fix:`the evidence shows a fault on the site`,check:`a person should look; the evidence alone does not settle it`,expected:`the evidence shows the site works as built, nothing to fix`,indexed:`Google indexes it and the live check shows no fault`},vY=/* @__PURE__ */ new Set([`account`,`admin`,`api`,`auth`,`cart`,`checkout`,`dashboard`,`login`,`logout`,`my-account`,`oauth`,`sign-in`,`signin`,`wp-admin`,`wp-login.php`]),yY=e=>new URL(e).hostname.replace(/^www\./,``),bY=(e,t)=>{try{return yY(e)===yY(t)}catch{return!1}};function xY(e,t){let n=new URL(e),r=new URL(t);return n.pathname!==r.pathname||n.search!==r.search||!bY(e,t)?null:n.protocol===r.protocol?n.host===r.host?null:`host variant (${n.host})`:`http:// variant`}const SY=(e,t)=>{let[n,r]=[new URL(e),new URL(t)];return n.pathname===r.pathname&&n.search===r.search},CY=e=>vY.has(new URL(e).pathname.split(`/`)[1]?.toLowerCase()??``),wY=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function TY(e){let{url:t,status:n,live:r}=e,{first:i,hops:a,last:o}=r,s=n.verdict===`PASS`,c=n.coverage??``,l=n.referring_urls.filter(e=>e!==t&&bY(e,t)&&!SY(e,t)),u=[e.inSitemap?`the sitemap lists it`:null,l.length?`Google lists ${wY(l.length,`referring page`)} on this site as of its last crawl (${l[0]}${l.length>1?`, and more`:``})`:null].filter(Boolean);if(i.error)return s?{label:`indexed`,why:`Google indexes it. The live check failed (${i.error}).`}:{label:`check`,why:`The live check failed (${i.error}), so only Google's reason is shown.`};let d=a.find(e=>e.kind===`temporary`&&new URL(e.from).host===new URL(e.to).host);if(d)return{label:`fix`,why:`${d.from} sends a ${d.status} (temporary) redirect to ${d.to} on the same host; a permanent move uses 301 or 308.`};if(!o)return{label:`fix`,why:`The redirects loop or pass 10 hops (${a.map(e=>e.status).join(` > `)}).`};if(o.error)return{label:`check`,why:`It redirects to ${o.url}, which could not be fetched (${o.error}).`};let f=o.status??0,p=a.length?`redirects to ${o.url}, which returns ${f}`:`returns ${f} now`,m=`It ${p}`;if(f===404||f===410)return u.length?{label:`fix`,why:`${m}, and ${u.join(` and `)}.`}:a.length?{label:`fix`,why:`${m}: a redirect to a missing page.`}:{label:`expected`,why:`${m}, and neither the sitemap nor any referring page Google lists on this site points to it.`};if((f===401||f===403)&&!a.length)return e.inSitemap?{label:`fix`,why:`${m}, but the sitemap lists it.`}:f===401&&i.www_authenticate?{label:`expected`,why:`${m} with a WWW-Authenticate header (${i.www_authenticate.split(/\s/)[0]}), so the server asks for sign-in here.`}:CY(t)?{label:`expected`,why:`${m} on a path that looks like a sign-in area (heuristic: from the path only).`}:{label:`check`,why:`${m} with no WWW-Authenticate header and no sign-in path, so the evidence does not show whether it should be public.`};if(a.length){let n=a.map(e=>e.status).join(` > `);if(f!==200)return{label:`check`,why:`${m} (${n}).`};if(e.inSitemap)return{label:`fix`,why:`The sitemap lists it, but it redirects (${n}) to ${o.url}.`};let r=o.canonical===o.url?`declares itself canonical`:e.sitemap.has(o.url)?`is in the sitemap`:null,i=xY(t,o.url),c=`${i?`An ${i}`:`A permanent redirect`}: ${n} to ${o.url}`,d=s?` Google still indexes this URL as of its last crawl.`:``,p=l.length?` ${u.at(-1)}.`:``;return r?{label:`expected`,why:`${c}, which returns 200 and ${r}.${d}${p}`}:{label:`check`,why:`${c}, which declares ${o.canonical?`${o.canonical} as canonical`:`no canonical`}.${d}${p}`}}if(/^(Crawled|Discovered) - currently not indexed$|^URL is unknown to Google$/i.test(c))return{label:`check`,why:`${c.startsWith(`Crawled`)?`Google crawled it but has not indexed it, and gives no further reason`:c.startsWith(`Discovered`)?`Google knows the URL but has not crawled it yet`:`Google has no record of this URL`}.${e.inSitemap?` The sitemap lists it.`:``} It returns ${f} now.`};let h=o.robots?` with robots "${o.robots}"`:` with no robots meta tag or X-Robots-Tag header`;if(/noindex/i.test(c)&&o.google_noindex===!1)return{label:`check`,why:`Google saw noindex when it last crawled${n.last_crawl?` (${n.last_crawl.slice(0,10)})`:``}, but it ${p}${h}, so Google's reason may be out of date.${e.inSitemap?` The sitemap lists it.`:``}`};let g=n.user_canonical??o.canonical;return n.google_canonical&&g&&n.google_canonical!==g?{label:`check`,why:`Google chose ${n.google_canonical} as canonical; the page declares ${g}.`}:s?f===200?{label:`indexed`,why:`Google indexes it and it returns 200 now.`}:{label:`check`,why:`Google indexes it, but it ${p}.`}:e.inSitemap?{label:`fix`,why:`The sitemap lists it, but Google does not index it. It ${p}${h}.`}:n.google_canonical&&n.google_canonical===n.user_canonical&&n.google_canonical!==t?{label:`expected`,why:`The page declares ${n.user_canonical} as canonical and Google uses it.`}:{label:`check`,why:o.google_noindex?`${m}${h} and the sitemap does not list it. Whether it should be indexed is the site's call.`:`${m}${h}. No rule here settles this reason.`}}function EY(e,t,n){let{status:r,live:i}=e,{label:a,why:o}=TY(e);return{reason:r.coverage??r.verdict??`No reason returned`,url:e.url,label:a,why:o,verdict:r.verdict,indexing:r.indexing,status:i.first.status,redirects:i.hops.length?i.hops.map(e=>`${e.status} ${e.kind}`).join(` > `):null,redirects_to:i.first.redirects_to,final_url:i.last?.url??null,final_status:i.last?.status??null,page_canonical:i.last?.canonical??null,user_canonical:r.user_canonical,google_canonical:r.google_canonical,in_sitemap:e.inSitemap,referring_urls:r.referring_urls.slice(0,10),last_crawl:r.last_crawl,inspected_at:n,page_fetch:r.page_fetch,robots_txt:r.robots_txt,crawled_as:r.crawled_as,sources:t,...i.first.error?{live_error:i.first.error}:{}}}const DY=(e,t)=>e<t?-1:+(e>t);function OY(e){return[...e].sort((e,t)=>DY(e.reason,t.reason)||DY(e.url,t.url))}function kY(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=t.get(n.reason)??{fix:0,check:0,expected:0,indexed:0};e[n.label]+=1,t.set(n.reason,e)}return[...t].sort((e,t)=>DY(e[0],t[0])).map(([e,t])=>({reason:e,urls:t.fix+t.check+t.expected+t.indexed,...t}))}const AY=(e,t)=>t.includes(String(e?.code));function jY(e){let t=/* @__PURE__ */ new Map,n=(e,n)=>{let r=t.get(e)??[];r.includes(n)||r.push(n),t.set(e,r)},r=e.pages.filter(e=>e.impressions>0&&!e.url.includes(`#`)).sort((e,t)=>t.clicks-e.clicks||t.impressions-e.impressions||DY(e.url,t.url));for(let t of e.lost)n(t,`lost_clicks`);for(let e of r)n(e.url,`search_console`);for(let t of e.sitemap.urls)n(t,`sitemap`);return e.home&&n(e.home,`home`),{urls:[...t].map(([e,t])=>({url:e,sources:t})),sitemap:e.sitemap,searchConsole:r.length,searchConsoleCapped:e.pagesCapped,lostClicks:e.lost.length}}async function MY(e,t,n,r=100){let i=Math.min(Math.max(1,Math.floor(r)),gY),a=t.urls.slice(0,i),o=/* @__PURE__ */ new Map;try{o=n.savedInspections?.read(e,a.map(e=>e.url))??o}catch{}let s=a.filter(e=>!o.has(e.url)),c=n.inspectionQuota?await n.inspectionQuota(e).catch(()=>null):null,l=c?Math.max(0,c.limit-c.used):s.length,u=new Set(s.slice(0,l).map(e=>e.url)),d=a.filter(e=>o.has(e.url)||u.has(e.url)),f=l<s.length,p=/* @__PURE__ */ new Map,m=[],h=[],g=new Set(t.sitemap.urls),_=()=>(n.now?.()??/* @__PURE__ */ new Date).toISOString(),v=!1,y=0,b=null;if(await Promise.all(Array.from({length:20},async()=>{for(;b===null&&y<d.length;){let t=d[y++],r=o.get(t.url),i,a;if(r)i=r.status,a=r.inspectedAt;else{if(v)continue;try{i=await n.inspect(e,t.url),a=_()}catch(e){AY(e,[`RATE_LIMITED`])?v=!0:AY(e,[`AUTH_EXPIRED`,`AUTH_REQUIRED`,`NOT_CONNECTED`])?b=e:h.push({url:t.url,error:e instanceof Error?e.message:String(e)});continue}try{n.savedInspections?.save(e,t.url,i)}catch{}}p.set(t.url,i);let s=await n.liveCheck(t.url);m.push(EY({url:t.url,status:i,live:s,inSitemap:t.sources.includes(`sitemap`),sitemap:g},t.sources,a))}})),b!==null)throw b;let x=m.filter(e=>o.has(e.url)),S=x.reduce((e,t)=>e===null||t.inspected_at<e?t.inspected_at:e,null);return{rows:OY(m),statuses:p,known:t,limit:i,inspected:m.length,fromSaved:x.length,oldestSaved:S,failed:h.sort((e,t)=>DY(e.url,t.url)),stoppedBy:v||f?`quota`:t.urls.length>a.length?`limit`:null,quota:c}}const NY=e=>e.toLocaleString(`en-US`);function PY(e){return e.live_error?`error: ${e.live_error}`:e.redirects?`${e.redirects.replace(/ (permanent|temporary)/g,``)} > ${e.final_status??`loop`}`:String(e.status??``)}function FY(e,t,n,r,i,a){let{known:o}=t,s=o.urls.length,c=s-t.inspected-t.failed.length,l=[`lost-click pages ${NY(o.lostClicks)}`,`Search Console pages with impressions in the last 28 days ${NY(o.searchConsole)}${o.searchConsoleCapped?`, capped`:``}`,`sitemap ${NY(o.sitemap.urls.length)} from ${wY(o.sitemap.files,`file`)}${o.sitemap.partial?`, partial`:``}`],u=o.sitemap.partial||o.searchConsoleCapped?` at least`:``,d=t.inspected-t.fromSaved,f=Math.min(s,gY,t.quota?t.inspected+t.quota.limit-t.quota.used-d:gY),p=t.oldestSaved?Math.floor((a.getTime()-Date.parse(t.oldestSaved))/864e5):0,m=t.fromSaved?` (${NY(d)} asked of Google now, ${NY(t.fromSaved)} from saved results; the oldest was inspected ${t.oldestSaved?.slice(0,16).replace(`T`,` `)} UTC, ${p===0?`under a day`:wY(p,`day`)} ago. Saved results are reused for 7 days)`:``,h=t.stoppedBy===`quota`?`The URL Inspection quota stopped it.`:t.stoppedBy===`limit`?`It stopped at ${NY(t.limit)}, the number of inspections for this run${i&&f>t.limit?`; to inspect more, up to the quota left today: ${i(f)}`:``}.`:`Every known URL has a result.`,g=[`Google's indexing reasons for ${e}, from URL Inspection. Search Console's Page indexing report has no API, so known URLs are inspected one at a time, in a fixed order (lost-click pages, Search Console pages by clicks then impressions, sitemap URLs, then the rest), and checked live from here.`,`Known URLs:${u} ${NY(s)} (${l.join(`; `)}). Inspected ${NY(t.inspected)} of ${NY(s)}${m}. ${h}${c>0?` The ${NY(c)} URLs not inspected have no result here, so this is not an all-clear for them.`:``}${o.sitemap.notes.length?` Sitemap: ${o.sitemap.notes.join(`; `)}.`:``}`,t.quota?`URL Inspection quota: this machine had used ${NY(t.quota.used)} of ${NY(t.quota.limit)} today for this property before the run. Google also counts inspections from other tools.`:`URL Inspection quota: not counted on this server; Google stops inspections at 2,000 a day per property.`];t.failed.length&&g.push(`URL Inspection failed for ${wY(t.failed.length,`URL`)}: ${t.failed.slice(0,5).map(e=>`${e.url} (${e.error})`).join(`; `)}${t.failed.length>5?`; and more`:``}.`);let _=kY(t.rows);_.length&&g.push(`By Google's reason, with labels from the rules below (not Google's):\n${er(_,[`reason`,`urls`,`fix`,`check`,`expected`,`indexed`],null)}`);let v=t.rows.filter(e=>e.label!==`indexed`),y=n.summary?v.filter(e=>e.label===`fix`||e.label===`check`):v,b=t.rows.length-v.length,x=v.length-y.length,S=y.slice(n.offset,n.offset+n.size).map(e=>({reason:e.reason,label:e.label,url:e.url,live:PY(e),final_url:e.final_url===e.url?``:e.final_url,in_sitemap:e.in_sitemap?`yes`:`no`,last_crawl:e.last_crawl?.slice(0,10)??``,why:e.why})),C=n.offset+S.length,w=y.length-C,T=n.summary?[w?`${w} more labelled fix or check`:null,x?`${x} expected`:null,b?`${b} indexed with no fault found (in the full result)`:null].filter(Boolean):[];return n.summary&&(w||x)&&T.push(`every row but the indexed ones: ${n.more(0)}`),g.push(`${y.length===0?`No inspected URL is labelled ${n.summary?`fix or check`:`fix, check or expected`}.`:`${n.summary?`URLs labelled fix or check`:`URLs that are not indexed or show a fault`}, ${n.offset+1} to ${C} of ${y.length}:\n${er(S,Object.keys(S[0]??{}),r,400)}`}${T.length?`\nNot listed here: ${T.join(`; `)}.`:``}`,`Labels: ${Object.entries(_Y).map(([e,t])=>`${e}, ${t}`).join(`; `)}. Rules: a same-host 302 or 307 is fix; a 404 or 410 that the sitemap or a referring page on this site points to is fix; a sitemap URL that redirects or that Google does not index is fix; a URL outside the sitemap (such as an http:// or host variant) that permanently redirects to a page declaring itself canonical is expected; a 401 with a WWW-Authenticate header is expected, and a 401 or 403 on a sign-in path is expected by heuristic; "Crawled - currently not indexed", "Discovered - currently not indexed" and a Google canonical that differs from the declared one are check. Referring pages are as of Google's last crawl. Live checks are server responses, so a browser-only HSTS "307 Internal Redirect" never shows here.`),!n.summary&&w&&g.push(`More rows: ${n.more(C)}.`),g}function IY(e,t,n){return e.items.slice(t,t+n).map(e=>({source:e.source,target:e.target,tier:e.tier,p:e.probability??``,role:e.role??``,anchor:e.anchor??``,sentence:e.sentence??`no sentence: needs new text`}))}function LY(e,t){if(t.detail===`full`)return`${e.summary.verdict}\n\n${JSON.stringify(e)}`;let n=(()=>{try{return new URL(e.items[0]?.source??e.target?.url??e.crawl.startUrl).origin}catch{return null}})(),r=[`source`,`target`,`tier`,`p`,`role`,`anchor`,`sentence`];if(t.detail===`rows`){let i=IY(e,t.offset,50),a=t.offset+i.length;return[`Internal links · ${e.mode===`url`?e.targetUrl:e.site} · ${e.dataStatus}`,`Links ${t.offset+1} to ${a} of ${e.items.length}:`,er(i,r,n,120),a<e.items.length?`Next page: ${t.more(`rows`,a)}`:``].filter(Boolean).join(`
|
|
393
382
|
|
|
@@ -440,7 +429,7 @@ One domain per line.
|
|
|
440
429
|
`),data:{...c,...u?{analytics:u.data}:{},...d?{clicky:d.data}:{},...f?{simpleAnalytics:f.data}:{},googleUpdates:l}}}const R$=.2,z$=25e3;function B$(e,t){let n=e.filter(e=>e?.verdict!=null),r=n.filter(e=>e.verdict===`PASS`).length,i=/* @__PURE__ */ new Map;for(let e of n){if(e.verdict===`PASS`)continue;let t=e.coverage??e.verdict??`unknown`;i.set(t,(i.get(t)??0)+1)}let a=n.length-r,o=t?.status?.verdict?t.status.verdict===`PASS`:null,s=a>=5&&a*2>n.length&&o,c=[...i].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e,t])=>({state:e,count:t}));return{text:(n.length?[`Index status of the ${n.length} inspected pages: ${r} indexed, ${a} not indexed${c.length?` (${c.map(e=>`${e.count} ${e.state}`).join(`; `)})`:``}.${t&&o!==null?` Home page ${t.url}: ${o?`indexed`:`not indexed (${t.status?.coverage??t.status?.verdict})`}.`:``}`,s?`Site-wide pattern: ${a} of ${n.length} inspected pages are not in Google's index, but the home page is. This points to the whole site, not single pages. It does not show the cause.`:null]:[]).filter(Boolean).join(`
|
|
441
430
|
`),data:{inspected:n.length,indexed:r,notIndexed:a,byCoverage:c,homePage:t&&o!==null?{url:t.url,indexed:o}:null,siteWide:!!s}}}const V$=`Pages that had at least 3 clicks in the previous 28 days and kept ${R$*100}% or less of them in the last 28 days, with a live check of the top 20 and Google’s index status for the top 10 and the home page.`,H$=`Google’s indexing reasons for 100 known URLs a run in a fixed order (lost-click pages, Search Console pages by clicks then impressions, sitemap URLs, then the rest), each checked live and labelled fix, check, expected or indexed from the evidence, sorted by reason then URL.`;async function U$(e,t){let n=Mn(e,28),r=Nn(n),i=n=>t.searchAnalytics(e.site,{...n,dimensions:[`page`],type:`web`,maxRows:z$}),[a,o,s]=await Promise.all([i(n),i(r),s$(e.site)]),c=new Map(a.rows.map(e=>[e.keys[0],e.clicks])),l=o.rows.filter(e=>e.clicks>=3&&!e.keys[0]?.includes(`#`)).map(e=>({url:e.keys[0]??``,previous_clicks:e.clicks,clicks:c.get(e.keys[0])??0})).filter(e=>e.clicks<=e.previous_clicks*R$).sort((e,t)=>t.previous_clicks-t.clicks-(e.previous_clicks-e.clicks)||e.url.localeCompare(t.url)),u=l.slice(0,20),d=u[0]?.url??s.urls[0]??a.rows[0]?.keys[0],f=d?`${new URL(d).origin}/`:null,p=jY({lost:l.map(e=>e.url),home:f,sitemap:s,pages:a.rows.map(e=>({url:e.keys[0]??``,clicks:e.clicks,impressions:e.impressions})),pagesCapped:a.rows.length>=z$}),[m,h]=await Promise.all([t.checkPages(u.map(e=>e.url)),MY(e.site,p,t,e.maxUrls)]),g=e=>e?h.statuses.get(e)??null:null,_=B$(u.slice(0,10).filter(e=>e.url!==f).map(e=>g(e.url)),u.length&&f?{url:f,status:g(f)}:null),v=u.map((e,t)=>{let n=t<10?g(e.url):null;return{...e,status:m[t]?.status??null,redirects_to:m[t]?.redirects_to??null,robots:m[t]?.robots??null,canonical:m[t]?.canonical??null,verdict:n?.verdict??null,coverage:n?.coverage??null,google_canonical:n?.google_canonical??null}}),y=e.detail??`summary`,b=e.offset??0,x=Pn(e.site),S=h.rows.find(e=>e.label===`fix`),C=h.rows.filter(e=>e.label===`check`&&O$.test(e.reason)&&e.status===200&&!e.redirects&&(!e.page_canonical||e.page_canonical===e.url)).map(e=>e.url),w=FY(e.site,h,{summary:y===`summary`,offset:b,size:y===`summary`?25:50,more:n=>t.call(`index`,{site:e.site,max_urls:e.maxUrls,detail:`rows`,offset:n})},x,t.inspectionQuota?n=>t.call(`index`,{site:e.site,max_urls:n}):null,t.now?.()??/* @__PURE__ */ new Date),T=[`Pages that lost their clicks on ${e.site}: ${n.startDate} to ${n.endDate} against ${r.startDate} to ${r.endDate}.`,`${l.length} pages kept ${R$*100}% or less of at least 3 clicks${l.length>20?`; the top 20 by clicks lost are shown`:``}.`,v.length?er(v,Object.keys(v[0]??{}),x):`No pages lost their clicks.`,_.text,`Live checks are fetched now with no redirects followed. Index status is from URL Inspection.`,qX(v)],E={rule:H$,known:{total:p.urls.length,sitemap:s.urls.length,sitemapFiles:s.files,sitemapPartial:s.partial,searchConsole:p.searchConsole,searchConsoleCapped:p.searchConsoleCapped,lostClicks:p.lostClicks},limit:h.limit,inspected:h.inspected,fromSaved:h.fromSaved,oldestSaved:h.oldestSaved,failed:h.failed,stoppedBy:h.stoppedBy,quota:h.quota,byReason:kY(h.rows),rows:h.rows,submittable:C};return{text:[...y===`full`?[`Google's indexing reasons for ${e.site}, every inspected URL as JSON, sorted by reason then URL:`,JSON.stringify(E)]:[...y===`summary`?T:[],...w,k$(C.length,t.call)??``,`To see what changed, keep this run's full result (${t.call(`index`,{site:e.site,max_urls:e.maxUrls,detail:`full`})}) and compare it with the next run by url and reason. Inspect the same number each week: the order is fixed, so the same first URLs come back. Where results are saved (the CLI and the local MCP), a URL inspected in the last 7 days is reused; any other URL is inspected again and uses URL Inspection quota.`,`Next: ${S?t.call(`page`,{url:S.url}):t.call(`page`)} for one URL, including a URL from a Search Console email that is not in this set; ${t.call(`report`,{site:e.site,section:`content-decay`})} for pages that lost part of their clicks.`],On].filter(Boolean).join(`
|
|
442
431
|
|
|
443
|
-
`),data:{range:n,comparisonRange:r,rule:V$,lostPages:l.length,index:_.data,pages:v,indexing:E}}}const W$={overview:`search-performance-overview`,"quick-wins":`quick-wins`,"low-ctr":`ctr-underperformers`,"striking-distance":`striking-distance`,"second-page":`second-page`,"content-decay":`decaying-pages`,cannibalization:`cannibalisation`,"traffic-drop":`traffic-anomaly`},G$={keyword_metrics:`keyword-metrics`,ranked_keywords:`ranked-keywords`,serp:`serp-results`,competitors:`serp-competitors`,backlinks:`link-evidence`};function K$(e,t={}){return e===`report`?W$[t.section||`overview`]??null:e===`research`?G$[t.action??``]??null:{page:`page-opportunities`,compare:`measure-change`,index:`link-recovery`,crawl:`site-crawl`,"internal-links":`internal-links`}[e]??null}[...US];const q$=864e5;function J$(e,t){let n=e=>{let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return{day:t.getUTCDate(),month:t.toLocaleString(`en-GB`,{month:`short`,timeZone:`UTC`})}},r=n(e),i=n(t);return r.month===i.month?`${r.day} to ${i.day} ${i.month}`:`${r.day} ${r.month} to ${i.day} ${i.month}`}const Y$=e=>(/* @__PURE__ */ new Date(`${e}T00:00:00Z`)).toLocaleString(`en-GB`,{day:`numeric`,month:`short`,timeZone:`UTC`}),X$=e=>`Your SEO Skill week, ${J$(e.start,e.end)}`,Z$=e=>e.replace(/^sc-domain:|^https?:\/\//,``).replace(/\/$/,``),Q$=e=>e.toLocaleString(`en-US`),$$=(e,t,n=`${t}s`)=>`${Q$(e)} ${e===1?t:n}`,e1=e=>e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`,t1=e=>/[.!?]$/.test(e)?e:`${e}.`;function n1(e){try{let t=new URL(e);return`${t.pathname}${t.search}`}catch{return e}}function r1(e){let t=e.clicks;if(!t)return null;let n=t.clicks-t.previous;return Math.abs(n)<50?null:n<0&&t.previous>=100&&-n>=.3*t.previous?`fell`:n>0&&t.previous>=50&&n>=.3*t.previous?`rose`:null}const i1=e=>{let t=e.clicks;return Math.round(Math.abs(t.clicks-t.previous)/t.previous*100)};function a1(e,t,n,r=!1){let i=[];e.index?.dropped&&i.push({rank:0,heading:`${$$(e.index.dropped,`page`)} dropped`});let a=e.crawl,o=a!==null&&a.finished_at>=t&&a.finished_at<n;return o&&a.status===`failed`?i.push({rank:1,heading:`crawl stopped early`}):!o&&e.added_at<t&&i.push({rank:1,heading:`no crawl this week`}),r1(e)===`fell`&&i.push({rank:2,heading:`clicks down ${i1(e)}%`}),o&&a.new_issues>0&&i.push({rank:3,heading:$$(a.new_issues,r?`open finding`:`new issue`)}),i}function o1(e,t,n,r=!1){let i=[],a=e.index;if(!a)i.push(`Google index: no checks ran this week yet.`);else if(a.dropped){let e=a.dropped_pages.map(e=>n1(e.url)),t=a.dropped-e.length,n=t>0?`${e.join(`, `)} and ${$$(t,`more`)}`:e1(e),r=new Set(a.dropped_pages.map(e=>e.coverage)),o=r.size===1?[...r][0]:null;i.push(`Google index: ${$$(a.dropped,`page`)} dropped out (${n}${o?`: ${o}`:``}).${a.returned?` ${$$(a.returned,`page`)} now indexed.`:``} ${$$(a.checked,`page`)} checked.`)}else i.push(`Google index: ${$$(a.checked,`page`)} checked, none dropped${a.returned?`, ${$$(a.returned,`page`)} now indexed`:``}.`);let o=e.crawl,s=o!==null&&o.finished_at>=t&&o.finished_at<n;if(s&&o.status===`failed`)i.push(`Weekly crawl: stopped after ${$$(o.pages,`page`)}${o.error?`: ${t1(o.error)}`:`.`} It tries again next week.`);else if(s){let e=o.top_rule?Zq[o.top_rule]:void 0;i.push(o.new_issues?`Weekly crawl: ${$$(o.pages,`page`)}, ${$$(o.new_issues,r?`open finding`:`new issue`)}${e?`, most of them ${e.charAt(0).toLowerCase()}${e.slice(1)}`:``}.`:`Weekly crawl: ${$$(o.pages,`page`)}, no new issues.`)}else e.added_at<t?i.push(`Weekly crawl: none finished this week${e.start_error?`: ${t1(e.start_error)}`:`.`} It tries again each hour.`):i.push(`Weekly crawl: the first crawl is still running.`);let c=e.clicks;if(c){let e=c.previous>0?Math.round((c.clicks-c.previous)/c.previous*100):null,t=e===null?`from ${Q$(c.previous)}`:e===0?`level with`:`${e>0?`up`:`down`} ${Math.abs(e)}% on`;i.push(`Search clicks: ${Q$(c.clicks)} (${J$(c.start,c.end)}), ${t}${e===null?``:` ${Q$(c.previous)}`} the 7 days before.`)}else i.push(`Search clicks: not available this week.`);return i}function s1(e){return(e.google_updates??[]).map(e=>{let t=e.end?`ran`:`has been rolling out`,n=e.result;if(!n&&e.ready)return`- Google update: the ${e.name} ran ${e.start.slice(0,10)} to ${e.end?.slice(0,10)??`now`}. Ask for the report's google-updates section on this site for what moved.`;if(!n)return`- Google update: the ${e.name} ${t}${e.end?` (${e.start.slice(0,10)} to ${e.end.slice(0,10)})`:` since ${e.start.slice(0,10)}`}. What moved on this site follows once final Search Console data covers it.`;let r=n.clicks-n.previous,i=n.previous>0?Math.round(r/n.previous*100):null,a=i===null?`${Q$(n.clicks)} clicks from ${Q$(n.previous)}`:i===0?`clicks level at ${Q$(n.clicks)}`:`clicks ${i>0?`up`:`down`} ${Math.abs(i)}% (${Q$(n.clicks)} from ${Q$(n.previous)})`,o={"outside-normal":`more than this site usually moves`,"within-normal":`within this site’s normal movement`,"not-enough-data":`too little data to say if that is unusual`}[n.verdict];return`- Google update: the ${e.name}, ${a} over the ${n.days} days from its start against the ${n.days} before, ${o} (timing only, not cause).`})}function c1(e){let t=e.opportunities;if(!t)return[];let n=t.competitors.length?` (${$$(t.competitors.length,`competitor`)} checked)`:``;if(t.blocked&&!t.items.length)return[`- Competitor opportunities: ${t1(t.blocked)}`];let r=t.partial?` Not every candidate keyword was judged yet, so more may follow next week.`:``;if(!t.items.length)return[`- Competitor opportunities: none cleared every check this week${n}.${r}`];let i=e=>`$${e.toFixed(2)}`;return[`- Competitor opportunities: ${$$(t.items.length,`keyword`)} cleared every check${n}.${r}`,...t.items.map(e=>{let t=e1(e.competitors.map(e=>`${e.domain} (#${e.position})`)),n=e.kind===`tool`;return` - "${e.keyword}"${n?`, a free tool`:``}: ${Q$(e.search_volume)} searches a month, ${i(e.cpc)} CPC, ${e.intent} intent. Top 10 for ${t}.${n?` The best tool page ranks for ${$$(e.cluster,`paying keyword`)}.`:``} ${e.low_dr} of the top ${e.top} have Domain Rating at or below ${e.site_dr+10} (yours is ${e.site_dr}).`}),` - Searches, CPC and intent are DataForSEO estimates, Domain Rating is by Ahrefs, fit with the site is a model classification and "free tool" is a guess from the words.`]}const l1={chatgpt:`ChatGPT search`,google_ai_mode:`Google AI Mode`,google_ai_overview:`AI Overviews`};function u1(e){let t=e.ai_answers;if(!t)return[];if(t.blocked)return[`- AI answers: ${t1(t.blocked)}`];if(!t.checked_at)return[];let n=e=>Y$(new Date(e).toISOString().slice(0,10)),{counts:r}=t,i=Object.values(r).reduce((e,t)=>e+t,0),a=[r.unavailable?`${Q$(r.unavailable)} unavailable`:``,r.pending?`${Q$(r.pending)} not ready yet`:``].filter(Boolean),o=e1(Object.values(l1)),s=[`- AI answers, checked ${n(t.checked_at)}: ${$$(t.questions.length,`question`)} from Search Console asked in ${o}. Cited in ${Q$(r.cited)} of ${$$(i,`answer`)}, mentioned by name in ${Q$(r.mentioned)}, neither in ${Q$(r.neither)}, no AI answer shown in ${Q$(r.no_answer)}${a.length?`, ${e1(a)}`:``}.`];if(t.previous_checked_at){let e=t.changes.slice(0,10),i=e=>e.replace(`_`,` `);s.push(e.length?` - Changed since ${n(t.previous_checked_at)}:`:` - No answer changed since ${n(t.previous_checked_at)}${r.unavailable||r.pending?` among the ones known both weeks`:``}.`,...e.map(e=>` - "${e.question}" in ${l1[e.engine]??e.engine}: ${i(e.from)}, now ${i(e.to)}${e.cited_url?` (${e.cited_url})`:``}.`),...t.changes.length>e.length?[` - And ${$$(t.changes.length-e.length,`more`)}.`]:[])}return t.cited_sites.length&&s.push(` - Sites cited instead: ${t.cited_sites.slice(0,5).map(e=>`${e.host} (${e.answers})`).join(`, `)}.`),s.push(` - Each answer is one sample that can change from run to run, so one week’s change is not a trend.`),s}function d1(e){let t=e.measured;if(!t?.total)return[];let n=t.total-t.items.length;return[`- After fixes: ${$$(t.total,`result`)} from Search Console, the days from the day an issue was marked fixed against the same days before (timing, not proof the fix caused it).`,...t.items.map(e=>{let t=e.subject.replace(/https?:\/\/[^\s/]+/g,``)||`/`,n=e.after.clicks-e.before.clicks;return` - ${t}, ${e.days} days from ${Y$(e.fixed_on)}: ${$$(e.after.clicks,`click`)} (${n>0?`up`:n<0?`down`:`level`}${n?` ${Q$(Math.abs(n))}`:``} on ${Q$(e.before.clicks)}), ${$$(e.after.impressions,`impression`)} (from ${Q$(e.before.impressions)}).${e.updates?.length?` Google updates in these dates: ${e1(e.updates)}.`:``}`}),...n>0?[` - And ${$$(n,`more`)} in the issues list.`]:[]]}function f1(e){let t=Date.parse(`${e.start}T00:00:00Z`),n=Date.parse(`${e.end}T00:00:00Z`)+q$,r=`# ${X$(e)}`;if(!e.sites.length)return`${r}\n\nNo site is in your weekly audit yet. Add one on the Sites tab: ${e.account}#sites`;let i=(e,t)=>Z$(e.property).localeCompare(Z$(t.property))||e.property.localeCompare(t.property),a=e.sites.map(r=>({site:r,found:a1(r,t,n,e.first),waiting:!r.crawl||!r.index})),o=a.filter(e=>e.found.length),s=a.filter(e=>!e.found.length&&!e.waiting);a.sort((e,t)=>(e.found[0]?.rank??1/0)-(t.found[0]?.rank??1/0)||i(e.site,t.site));let c=a.length,l=[r,``,o.length?c===1?`Your site had changes worth a look this week.`:`${o.length} of your ${c} sites had changes worth a look this week.`:s.length?c===1?`Your site had a quiet week.`:s.length===c?`All ${c} of your sites had a quiet week.`:`${s.length} of your ${c} sites had a quiet week.`:`Your sites are still on their first checks.`];for(let{site:r,found:i}of a)l.push(``,`## ${Z$(r.property)}${i.length?`: ${e1(i.map(e=>e.heading))}`:``}`,``,...o1(r,t,n,e.first).map(e=>`- ${e}`),...c1(r),...u1(r),...d1(r),...s1(r),...r.link?[`- [View site](${r.link})`]:[]);return l.join(`
|
|
432
|
+
`),data:{range:n,comparisonRange:r,rule:V$,lostPages:l.length,index:_.data,pages:v,indexing:E}}}const W$={overview:`search-performance-overview`,"quick-wins":`quick-wins`,"low-ctr":`ctr-underperformers`,"striking-distance":`striking-distance`,"second-page":`second-page`,"content-decay":`decaying-pages`,cannibalization:`cannibalisation`,"traffic-drop":`traffic-anomaly`},G$={keyword_metrics:`keyword-metrics`,ranked_keywords:`ranked-keywords`,serp:`serp-results`,competitors:`serp-competitors`,backlinks:`link-evidence`};function K$(e,t={}){return e===`report`?W$[t.section||`overview`]??null:e===`research`?G$[t.action??``]??null:{page:`page-opportunities`,compare:`measure-change`,index:`link-recovery`,crawl:`site-crawl`,"internal-links":`internal-links`}[e]??null}[...US];const q$=864e5;function J$(e,t){let n=e=>{let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return{day:t.getUTCDate(),month:t.toLocaleString(`en-GB`,{month:`short`,timeZone:`UTC`})}},r=n(e),i=n(t);return r.month===i.month?`${r.day} to ${i.day} ${i.month}`:`${r.day} ${r.month} to ${i.day} ${i.month}`}const Y$=e=>(/* @__PURE__ */ new Date(`${e}T00:00:00Z`)).toLocaleString(`en-GB`,{day:`numeric`,month:`short`,timeZone:`UTC`}),X$=e=>`Your SEO Skill week${e.sites.length===1&&e.sites[0]?` for ${Z$(e.sites[0].property)}`:``}, ${J$(e.start,e.end)}`,Z$=e=>e.replace(/^sc-domain:|^https?:\/\//,``).replace(/\/$/,``),Q$=e=>e.toLocaleString(`en-US`),$$=(e,t,n=`${t}s`)=>`${Q$(e)} ${e===1?t:n}`,e1=e=>e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`,t1=e=>/[.!?]$/.test(e)?e:`${e}.`;function n1(e){try{let t=new URL(e);return`${t.pathname}${t.search}`}catch{return e}}function r1(e){let t=e.clicks;if(!t)return null;let n=t.clicks-t.previous;return Math.abs(n)<50?null:n<0&&t.previous>=100&&-n>=.3*t.previous?`fell`:n>0&&t.previous>=50&&n>=.3*t.previous?`rose`:null}const i1=e=>{let t=e.clicks;return Math.round(Math.abs(t.clicks-t.previous)/t.previous*100)};function a1(e,t,n,r=!1){let i=[];e.index?.dropped&&i.push({rank:0,heading:`${$$(e.index.dropped,`page`)} dropped`});let a=e.crawl,o=a!==null&&a.finished_at>=t&&a.finished_at<n;return o&&a.status===`failed`?i.push({rank:1,heading:`crawl stopped early`}):!o&&e.added_at<t&&i.push({rank:1,heading:`no crawl this week`}),r1(e)===`fell`&&i.push({rank:2,heading:`clicks down ${i1(e)}%`}),o&&a.new_issues>0&&i.push({rank:3,heading:$$(a.new_issues,r?`open finding`:`new issue`)}),i}function o1(e,t,n,r=!1){let i=[],a=e.index;if(!a)i.push(`Google index: no checks ran this week yet.`);else if(a.dropped){let e=a.dropped_pages.map(e=>n1(e.url)),t=a.dropped-e.length,n=t>0?`${e.join(`, `)} and ${$$(t,`more`)}`:e1(e),r=new Set(a.dropped_pages.map(e=>e.coverage)),o=r.size===1?[...r][0]:null;i.push(`Google index: ${$$(a.dropped,`page`)} dropped out (${n}${o?`: ${o}`:``}).${a.returned?` ${$$(a.returned,`page`)} now indexed.`:``} ${$$(a.checked,`page`)} checked.`)}else i.push(`Google index: ${$$(a.checked,`page`)} checked, none dropped${a.returned?`, ${$$(a.returned,`page`)} now indexed`:``}.`);let o=e.crawl,s=o!==null&&o.finished_at>=t&&o.finished_at<n;if(s&&o.status===`failed`)i.push(`Weekly crawl: stopped after ${$$(o.pages,`page`)}${o.error?`: ${t1(o.error)}`:`.`} It tries again next week.`);else if(s){let e=o.top_rule?Zq[o.top_rule]:void 0;i.push(o.new_issues?`Weekly crawl: ${$$(o.pages,`page`)}, ${$$(o.new_issues,r?`open finding`:`new issue`)}${e?`, most of them ${e.charAt(0).toLowerCase()}${e.slice(1)}`:``}.`:`Weekly crawl: ${$$(o.pages,`page`)}, no new issues.`)}else e.added_at<t?i.push(`Weekly crawl: none finished this week${e.start_error?`: ${t1(e.start_error)}`:`.`} It tries again each hour.`):i.push(`Weekly crawl: the first crawl is still running.`);let c=e.clicks;if(c){let e=c.previous>0?Math.round((c.clicks-c.previous)/c.previous*100):null,t=e===null?`from ${Q$(c.previous)}`:e===0?`level with`:`${e>0?`up`:`down`} ${Math.abs(e)}% on`;i.push(`Search clicks: ${Q$(c.clicks)} (${J$(c.start,c.end)}), ${t}${e===null?``:` ${Q$(c.previous)}`} the 7 days before.`)}else i.push(`Search clicks: not available this week.`);return i}function s1(e){return(e.google_updates??[]).map(e=>{let t=e.end?`ran`:`has been rolling out`,n=e.result;if(!n&&e.ready)return`- Google update: the ${e.name} ran ${e.start.slice(0,10)} to ${e.end?.slice(0,10)??`now`}. Ask for the report's google-updates section on this site for what moved.`;if(!n)return`- Google update: the ${e.name} ${t}${e.end?` (${e.start.slice(0,10)} to ${e.end.slice(0,10)})`:` since ${e.start.slice(0,10)}`}. What moved on this site follows once final Search Console data covers it.`;let r=n.clicks-n.previous,i=n.previous>0?Math.round(r/n.previous*100):null,a=i===null?`${Q$(n.clicks)} clicks from ${Q$(n.previous)}`:i===0?`clicks level at ${Q$(n.clicks)}`:`clicks ${i>0?`up`:`down`} ${Math.abs(i)}% (${Q$(n.clicks)} from ${Q$(n.previous)})`,o={"outside-normal":`more than this site usually moves`,"within-normal":`within this site’s normal movement`,"not-enough-data":`too little data to say if that is unusual`}[n.verdict];return`- Google update: the ${e.name}, ${a} over the ${n.days} days from its start against the ${n.days} before, ${o} (timing only, not cause).`})}function c1(e){let t=e.opportunities;if(!t)return[];let n=t.competitors.length?` (${$$(t.competitors.length,`competitor`)} checked)`:``;if(t.blocked&&!t.items.length)return[`- Competitor opportunities: ${t1(t.blocked)}`];let r=t.partial?` Not every candidate keyword was judged yet, so more may follow next week.`:``;if(!t.items.length)return[`- Competitor opportunities: none cleared every check this week${n}.${r}`];let i=e=>`$${e.toFixed(2)}`;return[`- Competitor opportunities: ${$$(t.items.length,`keyword`)} cleared every check${n}.${r}`,...t.items.map(e=>{let t=e1(e.competitors.map(e=>`${e.domain} (#${e.position})`)),n=e.kind===`tool`;return` - "${e.keyword}"${n?`, a free tool`:``}: ${Q$(e.search_volume)} searches a month, ${i(e.cpc)} CPC, ${e.intent} intent. Top 10 for ${t}.${n?` The best tool page ranks for ${$$(e.cluster,`paying keyword`)}.`:``} ${e.low_dr} of the top ${e.top} have Domain Rating at or below ${e.site_dr+10} (yours is ${e.site_dr}).`}),` - Searches, CPC and intent are DataForSEO estimates, Domain Rating is by Ahrefs, fit with the site is a model classification and "free tool" is a guess from the words.`]}const l1={chatgpt:`ChatGPT search`,google_ai_mode:`Google AI Mode`,google_ai_overview:`AI Overviews`};function u1(e){let t=e.ai_answers;if(!t)return[];if(t.blocked)return[`- AI answers: ${t1(t.blocked)}`];if(!t.checked_at)return[];let n=e=>Y$(new Date(e).toISOString().slice(0,10)),{counts:r}=t,i=Object.values(r).reduce((e,t)=>e+t,0),a=[r.unavailable?`${Q$(r.unavailable)} unavailable`:``,r.pending?`${Q$(r.pending)} not ready yet`:``].filter(Boolean),o=e1(Object.values(l1)),s=[`- AI answers, checked ${n(t.checked_at)}: ${$$(t.questions.length,`question`)} from Search Console asked in ${o}. Cited in ${Q$(r.cited)} of ${$$(i,`answer`)}, mentioned by name in ${Q$(r.mentioned)}, neither in ${Q$(r.neither)}, no AI answer shown in ${Q$(r.no_answer)}${a.length?`, ${e1(a)}`:``}.`];if(t.previous_checked_at){let e=t.changes.slice(0,10),i=e=>e.replace(`_`,` `);s.push(e.length?` - Changed since ${n(t.previous_checked_at)}:`:` - No answer changed since ${n(t.previous_checked_at)}${r.unavailable||r.pending?` among the ones known both weeks`:``}.`,...e.map(e=>` - "${e.question}" in ${l1[e.engine]??e.engine}: ${i(e.from)}, now ${i(e.to)}${e.cited_url?` (${e.cited_url})`:``}.`),...t.changes.length>e.length?[` - And ${$$(t.changes.length-e.length,`more`)}.`]:[])}return t.cited_sites.length&&s.push(` - Sites cited instead: ${t.cited_sites.slice(0,5).map(e=>`${e.host} (${e.answers})`).join(`, `)}.`),s.push(` - Each answer is one sample that can change from run to run, so one week’s change is not a trend.`),s}function d1(e){let t=e.measured;if(!t?.total)return[];let n=t.total-t.items.length;return[`- After fixes: ${$$(t.total,`result`)} from Search Console, the days from the day an issue was marked fixed against the same days before (timing, not proof the fix caused it).`,...t.items.map(e=>{let t=e.subject.replace(/https?:\/\/[^\s/]+/g,``)||`/`,n=e.after.clicks-e.before.clicks;return` - ${t}, ${e.days} days from ${Y$(e.fixed_on)}: ${$$(e.after.clicks,`click`)} (${n>0?`up`:n<0?`down`:`level`}${n?` ${Q$(Math.abs(n))}`:``} on ${Q$(e.before.clicks)}), ${$$(e.after.impressions,`impression`)} (from ${Q$(e.before.impressions)}).${e.updates?.length?` Google updates in these dates: ${e1(e.updates)}.`:``}`}),...n>0?[` - And ${$$(n,`more`)} in the issues list.`]:[]]}function f1(e){let t=Date.parse(`${e.start}T00:00:00Z`),n=Date.parse(`${e.end}T00:00:00Z`)+q$,r=`# ${X$(e)}`;if(!e.sites.length)return`${r}\n\nNo site is in your weekly audit yet. Add one on the Sites tab: ${e.account}#sites`;let i=(e,t)=>Z$(e.property).localeCompare(Z$(t.property))||e.property.localeCompare(t.property),a=e.sites.map(r=>({site:r,found:a1(r,t,n,e.first),waiting:!r.crawl||!r.index})),o=a.filter(e=>e.found.length),s=a.filter(e=>!e.found.length&&!e.waiting);a.sort((e,t)=>(e.found[0]?.rank??1/0)-(t.found[0]?.rank??1/0)||i(e.site,t.site));let c=a.length,l=[r,``,o.length?c===1?`Your site had changes worth a look this week.`:`${o.length} of your ${c} sites had changes worth a look this week.`:s.length?c===1?`Your site had a quiet week.`:s.length===c?`All ${c} of your sites had a quiet week.`:`${s.length} of your ${c} sites had a quiet week.`:`Your sites are still on their first checks.`];for(let{site:r,found:i}of a)l.push(``,`## ${Z$(r.property)}${i.length?`: ${e1(i.map(e=>e.heading))}`:``}`,``,...o1(r,t,n,e.first).map(e=>`- ${e}`),...c1(r),...u1(r),...d1(r),...s1(r),...r.link?[`- [View site](${r.link})`]:[]);return l.join(`
|
|
444
433
|
`)}async function p1(e,t){let n=e.week?await e.week():null;if(!n&&t){let n=await t();return{text:`No site given. Pick one below and send it: ${e.call(`report`,{site:`<site>`})}. The summary of every site is for accounts with the weekly site audit.\n\n${n.text}`,data:n.data}}if(!n)throw new I(`INVALID_INPUT`,`No site given. Name one: ${e.call(`report`,{site:`<site>`})}. The summary of every site is for accounts with the weekly site audit.`);let r=Date.parse(`${n.start}T00:00:00Z`),i=Date.parse(`${n.end}T00:00:00Z`)+q$,a=e=>a1(e,r,i)[0]?.rank??1/0,o=[...n.sites].sort((e,t)=>a(e)-a(t)||Z$(e.property).localeCompare(Z$(t.property)))[0],s=o?Z$(o.property):`<site>`;return{text:`${f1(n)}\n\nFull report on one site: ${e.call(`report`,{site:s})}`,data:n}}const m1=o.string().min(1).describe(`Search Console property or site, such as sc-domain:example.com, https://example.com/ or example.com.`),h1={start_date:o.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe(`YYYY-MM-DD. Optional; without end_date it runs to the latest final day.`),end_date:o.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe(`YYYY-MM-DD. Optional.`)},g1={detail:o.enum([`summary`,`rows`,`full`]).default(`summary`).describe(`summary first. rows: the next page of rows. full: every field as JSON.`),offset:o.number().int().min(0).default(0).describe(`rows only: the first row to return.`)},_1={mark:o.enum(zY).optional().describe(`Optional, with site and issues: fixed, ignored, or open to undo. Only when the person says so.`),issues:o.string().min(1).optional().describe(`With mark: issue ids from the issues section, comma-separated.`),note:o.string().max(300).optional().describe(`Optional, with mark: why, in the person’s words.`),saved:o.string().max(6e5).optional().describe(`Optional, with section issues or mark: a list saved in the person's project before, such as .seo/issues.json, to carry over its marks once. This server keeps the list from then on.`)},v1=[`search_console`,`google_analytics`,`bing`,`clicky`,`simple_analytics`];function y1(e){return e.writes?{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}:{readOnlyHint:!0,destructiveHint:!1,openWorldHint:!0}}function b1(e){return e}const x1=async e=>dr({accounts:await e.accounts(),keys:await e.keys(),clicky:IJ(await e.keys()).map(LJ),simpleAnalytics:!!LQ(await e.keys()),signIn:e.signIn,bing:e.deps.bing?await e.deps.bing():void 0,connect:e.connect}),S1={text:o.string().max(_G).optional().describe(`The copy to check: a page, post, title or description, up to ${_G.toLocaleString(`en-US`)} characters. Markdown, MDX or HTML as written, so line numbers match.`),url:o.url().optional().describe(`Optional instead of text: a live page. Its main content is extracted as Markdown (as seo_page with detail full shows it) and checked with the blog preset. Only the CLI and the local MCP server read pages.`),format:o.enum(hG).optional().describe(`Optional. md (default for text), mdx, html, astro or text. Code, tags and URLs are skipped; captions and titles are checked.`),preset:o.enum(pG).optional().describe(`Optional. blog (default for Markdown), landing (default for HTML: stricter on buzzwords, weak links and claims with no number), docs, or meta (one title or description per line; start a line with "title:" or "description:" to say which).`),meta_kind:o.enum(mG).optional().describe(`Optional, with the meta preset: title or description, what a line with no "title:" or "description:" label is. Default: a line up to 70 characters is a title, a longer one a description.`),ignore_rules:o.array(o.string().min(1).max(60)).max(50).optional().describe(`Optional rule ids or review lenses to skip.`),only:o.array(o.enum(gG)).max(gG.length).optional().describe(`Optional categories to check: ai (patterns common in AI-written text), copy (weak copy and house style, such as dashes) or seo (titles, descriptions, headings). Default: all.`),ignore_phrases:o.array(o.string().min(1).max(200)).max(50).optional().describe(`Optional phrases to allow, such as a product name a rule keeps matching.`),rules:o.boolean().optional().describe(`Optional. true lists every rule with its id, category, level and description instead of checking text; only limits the list, such as only ["ai"].`)},C1=[b1({name:`seo_sites`,command:`data`,title:`List sites`,description:`Lists the Search Console and Google Analytics properties the connected Google accounts can read, the Bing Webmaster site for each, and which research keys are set. Call it first. With add: starts the weekly site audit of that site on the hosted server (a weekly crawl, daily Google index checks, a Monday email and webhook with what changed, and alerts when a page drops out of Google's index). A site that needs paying for returns a Stripe Checkout link: give it to the person to open, and the audit starts once they pay.`,input:o.object({add:m1.optional().describe(`Optional. A site to add to the weekly site audit. Only when the person asks for it: a site can cost money.`)}),run:async(e,t)=>{if(!t.add)return x1(e);let n=e.deps.startAudit;if(!n)throw new I(`INVALID_INPUT`,`The weekly site audit runs on the hosted server only. Connect https://seoskill.dev/mcp and call seo_sites with add there.`);let r=await e.resolveSite(t.add),i=await n(r);return{text:{added:`Added ${r} to the weekly site audit. Its first crawl and index checks have started; ask ${e.deps.call(`report`,{site:r,section:Xq})} for the findings once the crawl is done.`,exists:`${r} is already in the weekly site audit.`,pending:`The payment went through and the plan is starting. Call seo_sites with add again in a minute.`,checkout:i.status===`checkout`?`${r} needs a plan: $${i.price} a month per site, cancel at any time. Give the person this Stripe Checkout link to open and pay: ${i.url}\nThe audit of ${r} starts once they pay. Call seo_sites with add again afterwards to confirm.`:``,full:i.status===`full`?`This account already audits ${i.limit} sites, the most it can. Remove one on the account page first.`:``,payment_failed:`Stripe could not take the payment for another site, so ${r} was not added. The person can check their card under Manage billing on the account page.`}[i.status],data:{property:r,...i}}}}),b1({name:`seo_next`,command:`next`,title:`What to do next`,description:`Start here when the person asks you to work on a site's SEO, to use SEO Skill, or what to do next. Where the site is in the SEO loop and the one step that is due, with its instructions, its first jobs (pages with Google Analytics key events from Organic Search first, then the conversion pages in the business context) and the call that marks each done. The steps: write the business context (when there is none, or it is more than 90 days old), unblock pages (crawl and Google index problems), improve the pages that rank (quick wins, low click-through rates, striking distance), then find new pages for buying searches. It runs the issues checks when the list is more than a day old. Do the step, then call it again. With context: saves the business context the first step asks for, replacing the old one, then returns the next step.`,input:o.object({site:m1,context:o.string().max(QJ).optional().describe(`Optional. The business context to save, as Markdown under the headings the context step gives. Only after the person has seen it.`),saved:_1.saved.describe(`Optional: an issues list saved in the person's project before, such as .seo/issues.json, to carry over its marks once. This server keeps the list from then on.`)}),run:async(e,t)=>BZ({site:await e.resolveSite(t.site),context:t.context,saved:t.saved},e.deps)}),b1({name:`seo_report`,command:`report`,title:`Search Console report`,description:`Start here for questions about a site's search traffic. Without site: a short summary of every site in the person's weekly site audit for last week, with each site's Google index, weekly crawl and search clicks, sites with changes first, ending with the site to ask about next; an account without the audit gets its site list to pick from. With site: the main report for that Search Console property, the overview plus each section's row count and top rows. With site and section: that section's rows; page sections also check their top 20 URLs live. Sections:\n${Object.entries(_Z).map(([e,t])=>`- ${e}: ${t}`).join(`
|
|
445
434
|
`)}\n- ${RY}: A list kept for the site between sessions: issues the striking-distance, low-ctr and quick-wins checks found (and the weekly crawl and Google index checks for an audited site), each with its id, the latest check and what the person marked it (open, fixed or ignored). A fixed page, or query on a page, gets its Search Console clicks and impressions for the 28 and 56 days from the day it was marked fixed against the same days before, once final data covers them. Asking for it runs those checks again. To mark issues, add mark and issues instead of section. The CLI and local MCP keep the list on this machine and the hosted server keeps it with the account, for every site. A list the agent saved in the project before can be passed once as saved to carry it over.\n- ${ZX}: One Google ranking update (core, spam and similar, from Google’s Search Status Dashboard) laid over the site’s Search Console data: clicks and impressions from the day it started against the same number of days just before (whole weeks, up to 28 days), whether that change is outside the site’s own movement in the 8 comparisons before it (a heuristic), and the folders, pages and queries that gained or lost most. The latest update by default; with end_date, the latest update that started on or before it. Timing only, not cause.\nWith site, mark and issues: records what the person decided about those issue ids (fixed, ignored, or open to undo) and runs no checks.`,input:o.object({site:m1.optional().describe(`Leave it out for the summary of every site in the weekly site audit. Otherwise a Search Console property or site, such as sc-domain:example.com, https://example.com/ or example.com.`),section:o.enum([...vZ,RY,ZX]).optional().describe(`Optional, needs site. Leave it out first; then ask for one section.`),...h1,...g1,..._1}),run:async(e,t)=>{if(!t.site){if(t.section)throw new I(`INVALID_INPUT`,`section needs a site: ${e.deps.call(`report`,{site:`<site>`,section:t.section})}.`);if(t.mark||t.issues)throw new I(`INVALID_INPUT`,`mark needs a site: ${e.deps.call(`report`,{site:`<site>`,mark:t.mark??`fixed`,issues:t.issues??`<id>`})}.`);return p1(e.deps,()=>x1(e))}let n=t.site;if(t.mark||t.issues)return LZ({site:await e.resolveSite(n),section:t.section,mark:t.mark,issues:t.issues?.split(`,`),note:t.note,saved:t.saved},e.deps);let r=await e.resolveSite(n).catch(e=>e instanceof Error?e:Error(String(e)));if(r instanceof Error&&!t.section&&e.deps.bing)return RZ({site:n,startDate:t.start_date,endDate:t.end_date},e.deps).catch(()=>{throw r});if(r instanceof Error&&t.section!==`bing`)throw r;return LZ({site:r instanceof Error?n:r,section:t.section,startDate:t.start_date,endDate:t.end_date,detail:t.detail,offset:t.offset,saved:t.saved},e.deps)}}),b1({name:`seo_page`,command:`page`,title:`One page`,description:`Everything for one URL: live page facts (status, redirect, title, description, H1, canonical, robots), Google’s index status from URL Inspection, and the page’s Search Console queries against the previous period.`,input:o.object({url:o.url(),...h1,...g1}),run:async(e,t)=>j$({site:await e.resolveSite(t.url),url:t.url,startDate:t.start_date,endDate:t.end_date,detail:t.detail,offset:t.offset},e.deps)}),b1({name:`seo_compare`,command:`compare`,title:`Before and after a date`,description:`Compares equal periods before and after a date, such as a site change or a Google update: totals, devices, and the pages and queries that moved, Google Analytics sessions from the property whose web stream matches the site, Clicky visits from a saved Clicky site with the same domain, Simple Analytics visitors when an API key is saved and it has the site, and Google updates in the window. Optional pages narrows it to URLs that contain that text, such as /blog/.`,input:o.object({site:m1,date:o.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe(`YYYY-MM-DD: the first day after the change.`),pages:o.string().min(1).optional().describe(`Optional URL text, such as /blog/.`)}),run:async(e,t)=>L$({site:await e.resolveSite(t.site),date:t.date,pages:t.pages},e.deps,await e.keys())}),b1({name:`seo_index`,command:`index`,title:`Google indexing reasons and pages that lost their clicks`,description:`${H$} Use it for a first baseline and then weekly: keep the full result and compare by URL and reason to find new reasons. Also: ${V$}`,input:o.object({site:m1,...h1,...g1}),localInput:o.object({site:m1,...h1,max_urls:o.number().int().min(1).max(gY).optional().describe(`URLs to inspect with Google, 100 by default, up to the URL Inspection quota left today.`),...g1}),run:async(e,t)=>U$({site:await e.resolveSite(t.site),startDate:t.start_date,endDate:t.end_date,detail:t.detail,offset:t.offset,maxUrls:t.max_urls},e.deps)}),b1({name:`seo_submit`,command:`submit`,title:`Ask search engines to crawl pages`,writes:!0,description:`Sends page URLs to search engines. IndexNow is free and reaches Bing, Yandex, Seznam, Naver and Yep, not Google; it needs a key file on the site, which indexnow_key sets up and checks. Index My Site (indexmysite.app) is paid from the person's own credits: it sends URLs to Google, checks each, and gives a credit back for each page Google has not indexed by its final check. It never sends without confirm true, and only after the person saw the cost. Submitting asks for a crawl; it does not make a search engine index a page. Fix redirects, noindex, errors and canonicals first. Actions: ${l$}`,input:o.object({action:o.enum(c$),site:o.string().min(1).max(300).optional().describe(`indexnow_key: the host or a URL on it, such as example.com.`),urls:o.array(o.string().min(1).max(2048)).max(2e3).optional().describe(`indexnow and indexmysite: full page URLs. indexnow takes one host per call.`),key:o.string().max(128).optional().describe(`indexnow_key and indexnow, optional: an IndexNow key the site already serves at /<key>.txt.`),fast:o.boolean().optional().describe(`indexmysite, optional: faster Google indexing, 1 more credit per URL, not returned. Only when the person asks.`),bing:o.boolean().optional().describe(`indexmysite, optional: also send each URL to Bing, 1 more credit per URL, not returned. Only when the person asks.`),name:o.string().max(120).optional().describe(`indexmysite, optional: a label for the job.`),job_id:o.string().min(1).max(100).optional().describe(`indexmysite_status and indexmysite_approve: the job id.`),url_ids:o.array(o.string().min(1).max(100)).max(2e3).optional().describe(`indexmysite_approve: the url_id of each URL the person chose.`),all:o.boolean().optional().describe(`indexmysite_approve: every URL waiting for approval, only when the person chose all of them.`),confirm:o.boolean().optional().describe(`indexmysite and indexmysite_approve: true sends and spends credits. Without it the call returns the cost and sends nothing.`)}),run:(e,t)=>h$({action:t.action,site:t.site,urls:t.urls,key:t.key,fast:t.fast,bing:t.bing,name:t.name,jobId:t.job_id,urlIds:t.url_ids,all:t.all,confirm:t.confirm},e.deps)}),b1({name:`seo_research`,command:`research`,title:`Keyword, competitor, backlink and AI answer data`,description:`Data from the person’s own DataForSEO or Ahrefs account, which costs them credits. It uses the key the person saved on their seoskill.dev account (or on this machine for the CLI). Actions: provider is optional: without it the call uses the saved key, DataForSEO when both are saved. In the CLI and the local MCP server, serp can also use a provider package installed on this machine that supplies live search results: pass its id as provider. The target is a domain (the whole site), a path ending in / such as example.com/blog/ (every URL under it), or one page; scope overrides that. keyword_metrics (keywords: volume, difficulty, CPC; or target a Search Console site with no keywords: its top queries by impressions that the provider rates at zero or does not know, zero-volume keywords, in one call of up to 700 queries, about $0.10 on DataForSEO or 100 on Ahrefs), keyword_ideas (up to 5 seed keywords: searches that contain each seed, by volume), ranked_keywords (target: keywords a site, subfolder or page ranks for, with the provider's traffic total for the whole target), top_pages (target: the pages with the most estimated organic traffic), serp (keywords, up to 5: the ranking pages with their organic position beside DataForSEO's rank_absolute, which also counts AI Overviews and other blocks, plus the AI Overview's sources and the People Also Ask questions; device desktop or mobile, DataForSEO only; each with its domain's authority: DataForSEO domain_rank 0 to 100, Ahrefs domain_rating; depth sets results per keyword, default 20; rows run position by position across the keywords), index_check (DataForSEO only; target: one page URL; keywords: up to 2 exact phrases from the page, default its H1 or title. Searches Google for site:<url> and each "<phrase>" on desktop and mobile, retries failed searches, treats Google's fallback to unrelated sites as no match, and says indexed, not found or unknown with each search's evidence; about $0.01 a page), serp_overlap (2 to 10 keywords: for each pair, how many of their top 10 pages and sites are the same, to decide one page or several; results behind a Google redirect link are compared by their breadcrumb's site and path, and counted, not compared, when it is shortened), mentions (DataForSEO only; target: a domain; brand: up to 3 brand names. Pages on other sites that name the domain or brand, one per site, from DataForSEO's content index, and whether each site already links to the target in DataForSEO's backlink index; sites with no link come first, to ask for the link. About $0.03 a term plus one backlinks call, under $0.10 a run), competitors (target: domains that share keywords), backlinks (target: referring domains), pages_by_backlinks (target: the pages with the most referring domains), link_gap (target and 2 to 5 competitors: referring domains that link to two or more competitors and not the target, highest authority first, from each site's top 1,000 referring domains; costs one backlinks call per site), ai_answers (DataForSEO only; target: the site. Without keywords it takes the site’s top 10 chat-style and long questions from Search Console’s AI-shaped queries itself. With up to 10 questions in keywords it asks those instead, and the target can be any domain, such as a competitor's. Each answer row also lists the other sites it cites, and the notes rank them. Answers come from DataForSEO's queue: answers not ready after about 40 seconds are returned as tasks, already paid for; call again with the same target and those tasks to read them at no cost. It asks ChatGPT search, Google AI Mode and Google AI Overviews each one and says whether the answer cites or mentions the site. Each ChatGPT row lists the web searches ChatGPT ran (fan-out), and the notes rank the most common; to see them for any questions, pass the questions in keywords with any target. Web search is not forced: forcing costs the same but makes ChatGPT search questions it answers from memory, so "none returned" means it answered without searching. AI Mode and AI Overviews do not report their searches. DataForSEO’s queue prices are about $0.0072 a question across the three engines, so about $0.07 a run: tell the person before running it). Rows with a domain, and the target, get a free Ahrefs domain_rating column. Numbers are provider estimates, not Search Console data.`,input:o.object({provider:o.string().max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).optional().describe(`${hQ.join(` or `)}. Optional: without it, the saved key; DataForSEO when both are saved. For serp in the CLI and the local MCP server it can also be the id of an installed provider package with live search results.`),action:o.enum(mQ),keywords:o.array(o.string().min(1)).max(100).default([]),target:o.string().default(``).describe(`Domain (the whole site), a path ending in / for every URL under it, such as example.com/blog/, or one page.`),scope:o.enum(ZG).optional().describe(`Optional: domain, prefix or exact, to read the target another way than its shape says.`),competitors:o.array(o.string().min(1)).max(5).default([]).describe(`link_gap only: 2 to 5 competitor domains.`),tasks:o.array(o.string().regex(wq)).max(30).default([]).describe(`ai_answers only: the tasks an earlier run returned as not ready, to read back at no cost.`),also:o.array(o.string().min(1)).max(4).default([]).describe(`ai_answers only: the brand's other domains, such as claude.ai beside claude.com. A citation to any of them counts as citing the target.`),brand:o.array(o.string().min(1).max(60)).max(10).default([]).describe(`ai_answers and mentions: the brand names that count as a mention, such as Datadog for datadoghq.com. Default: each domain's name for ai_answers; mentions searches the domain itself plus up to 3 names.`),country:o.string().regex(/^[a-z]{2}$/).default(`us`).describe(`Two-letter country code.`),depth:o.number().int().min(1).max(100).optional().describe(`serp only: results per keyword, default 20. Deeper costs more.`),device:o.enum(XG).optional().describe(`serp only: desktop (default) or mobile. Google ranks pages differently on each. DataForSEO only.`),...g1}),run:async(e,t)=>{let n=e=>`seo_research with the same input, detail "rows", offset ${e}`;if(t.action===`ai_answers`){if(t.provider&&t.provider!==`dataforseo`)throw new I(`INVALID_INPUT`,`ai_answers uses dataforseo.`);return Eq({site:t.keywords.length||t.tasks.length?t.target:await e.resolveSite(t.target),country:t.country,detail:t.detail,offset:t.offset,questions:t.keywords,tasks:t.tasks,also:t.also,brand:t.brand},await e.keys(),e.deps,(e,t)=>`seo_research with the same provider, action, target, also and brand, tasks ${JSON.stringify(t)}, detail "rows", offset ${e}. Passing the tasks reads these answers back at no cost; without them every question is asked and paid for again`)}let r=t.action===`keyword_metrics`&&!t.keywords.length&&t.target;return wQ(r?{...t,target:await e.resolveSite(t.target)}:t,await e.keys(),{searchAnalytics:r?e.deps.searchAnalytics:void 0,drKey:e.drKey,store:e.researchStore,installedSerp:e.installedSerp,call:n})}}),b1({name:`seo_data`,command:`data`,title:`Raw rows`,description:`Raw rows for questions the report does not answer. search_console (default): rows for any dimensions, each with the previous period and the change, from web search or with search_type from image, video, news, Discover or Google News; page and query narrow to rows whose URL or query contains that text; page_regex, query_regex and exclude_query_regex take RE2 regexes for custom cuts. google_analytics: landing pages for visits from search, with Google Analytics’ own metric names. bing: Bing Webmaster query or page rows (first dimension) for the same site, by week. clicky: landing-page visits, traffic sources and search engines from a Clicky site the person saved (site is its domain or Clicky site ID; at most 31 days). simple_analytics: landing-page visitors, referrers, utm_source tags and AI tools from Simple Analytics with the API key the person saved (site is its domain).`,input:o.object({source:o.enum(v1).default(`search_console`),site:o.string().min(1).describe(`search_console and bing: the property or site. google_analytics: numeric property id from seo_sites. clicky: the site or its Clicky site ID. simple_analytics: the site domain.`),dimensions:o.array(o.enum(GK)).max(4).optional().describe(`search_console, default query (page for discover and google_news); bing uses the first, query or page.`),...QK,...h1,...g1}),run:async(e,t)=>t.source===`simple_analytics`?$Q({site:t.site,startDate:t.start_date,endDate:t.end_date,detail:t.detail,offset:t.offset},await e.keys(),{connect:e.connect,call:e=>`seo_data with source "simple_analytics", site "${t.site}", detail "rows", offset ${e}`}):t.source===`clicky`?qJ({site:t.site,startDate:t.start_date,endDate:t.end_date,detail:t.detail,offset:t.offset},await e.keys(),{connect:e.connect,call:e=>`seo_data with source "clicky", site "${t.site}", detail "rows", offset ${e}`,refresh:e.refreshClicky}):t.source===`bing`?jJ({site:t.site,dimension:t.dimensions?.[0]===`page`?`page`:`query`,startDate:t.start_date,endDate:t.end_date,detail:t.detail,offset:t.offset},e.deps):t.source===`google_analytics`?Oq({property:t.site,startDate:t.start_date,endDate:t.end_date,detail:t.detail,offset:t.offset},await Dq(await e.accounts(),t.site,e.signIn),{signIn:e.signIn,call:e=>`seo_data with source "google_analytics", site "${t.site}", detail "rows", offset ${e}`}):iq({site:await e.resolveSite(t.site),dimensions:t.dimensions,filters:$K({page:t.page,query:t.query,pageRegex:t.page_regex,queryRegex:t.query_regex,excludeQueryRegex:t.exclude_query_regex}),searchType:t.search_type,startDate:t.start_date,endDate:t.end_date,detail:t.detail,offset:t.offset},e.deps)}),b1({name:`seo_lint`,command:`lint`,title:`Check copy for AI writing patterns`,description:`Checks landing page copy, blog posts, titles and meta descriptions for patterns common in AI-written text (such as "isn't X, it's Y" reframes, ", not X" contrasts, two-beat fragments, stock idioms and kicker lines), weak copy (dash punctuation, buzzwords, vague link text) and SEO rules (title 30 to 60 characters, description 70 to 160, one H1). Each error and warning has a line, the words, and a concrete fix. Each finding has a category (ai, copy or seo); only limits the check, such as only ["ai"] to leave out house style like dashes. Review items are judgement calls for you: read each quote and change it only when it fails the question. A url checks the main content of a live page (CLI and local MCP only). It reads no accounts.`,input:o.object(S1),localInput:o.object({...S1,paths:o.array(o.string().min(1)).max(20).optional().describe(`Optional instead of text: files, folders or globs on this machine (.md, .mdx, .html, .astro, .txt). The format comes from each file name.`)}),run:async(e,t)=>{let n=e.deps.pageMarkdown;return AX({text:t.text,paths:t.paths,url:t.url,format:t.format,preset:t.preset,ignoreRules:t.ignore_rules,ignorePhrases:t.ignore_phrases,only:t.only,metaKind:t.meta_kind,rules:t.rules},e.readFiles,n&&(e=>n(e,2e5)))}})];function w1(e){let t=`detail`in e.input.shape;return{...e,description:`${e.description} For a site in the weekly site audit it answers at once from the URL Inspection results this server keeps for the site, checked in the background each day, and says how many URLs are covered, how many are queued and the time left.`,run:async(n,r)=>{let i=r,a=n.deps.audit;if(!a)return e.run(n,r);let o=await n.resolveSite(i.site),s=i.detail??`summary`,c=s===`rows`?i.offset??0:0,l=s===`rows`?50:20,u=await a.checks(o,c,l);if(!u){if(await a.add(o)===`full`){let t=await e.run(n,r);return{text:`${t.text}\n\n${o} is not in the weekly site audit, and this account already audits the most sites the beta allows, so this ran the usual way. Remove a site under Beta on the account page to keep its checks here.`,data:t.data}}if(u=await a.checks(o,c,l),!u)throw Error(`The audit of ${o} did not start.`)}return mJ({site:o,detail:s,offset:c,paged:t},u,n.deps.call)}}}C1.map(e=>e.name===`seo_index`?w1(e):e.name===`seo_report`?{...e,description:`${e.description}\n- ${Xq}: What the weekly crawl of the site found (broken and redirected internal links, missing, empty or duplicate titles and descriptions, missing H1s, noindex for Google, canonicals to another page, sitemap URLs that do not return 200, thin pages, tags that JavaScript changes), with what is new, back or resolved since the crawl before. Only for sites in the weekly site audit.`,input:e.input.extend({section:o.enum([...vZ,RY,ZX,Xq]).optional().describe(`Optional. Leave it out first; then ask for one section.`)})}:e);async function T1(e,t,n,r=!1){let i=(r&&e.localInput||e.input).safeParse(n??{});if(!i.success)throw new I(`INVALID_INPUT`,i.error.issues.map(e=>`${e.path.join(`.`)||`input`}: ${e.message}`).join(`; `));return e.run(t,i.data)}const E1={name:`seo`,title:`SEO Skill`,description:`Search Console, Google Analytics and keyword data for your AI agent.`,websiteUrl:`https://seoskill.dev`,icons:[{src:`https://seoskill.dev/favicon-light.png`,mimeType:`image/png`,sizes:[`512x512`],theme:`light`},{src:`https://seoskill.dev/favicon-dark.png`,mimeType:`image/png`,sizes:[`512x512`],theme:`dark`},{src:`https://seoskill.dev/favicon.svg`,mimeType:`image/svg+xml`,sizes:[`any`]}]},D1=(e,t)=>{let n=`seo_${e.replace(`-`,`_`)}`;if(e===`submit`)return k1(t??{});let r=Object.entries(t??{}).filter(([,e])=>e!==void 0);return r.length?`${n} with ${r.map(([e,t])=>`${e} ${typeof t==`number`?t:`"${t}"`}`).join(`, `)}`:n},O1={name:`seo-skill`,uri:`skill://seo/SKILL.md`,title:`SEO Skill`,description:`How to use these tools: what each command returns and how to reach it.`,mimeType:`text/markdown`};function k1(e){let t=Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>t===`true`?`${e} true`:e===`urls`?`urls ${JSON.stringify(String(t).split(` `))}`:`${e} "${t}"`);return(e.action===`indexnow`||e.action===`indexmysite`)&&e.urls===void 0&&t.push(`the URLs in urls`),t.length?`seo_submit with ${t.join(`, `)}`:`seo_submit`}const A1=6048e5;function j1(e,t,n=Date.now()){let r=/* @__PURE__ */ new Map;try{let i=ss().prepare(`SELECT status_json, fetched_at FROM url_inspection_cache
|
|
446
435
|
WHERE site_url = ? AND url = ? AND fetched_at > ?`);for(let a of t){let t=i.get(e,a,n-A1);t&&r.set(a,{status:JSON.parse(t.status_json),inspectedAt:new Date(t.fetched_at).toISOString()})}}catch{return/* @__PURE__ */ new Map}return r}function M1(e,t,n,r=Date.now()){let i=JSON.stringify(n);cs(n=>{n.prepare(`INSERT OR REPLACE INTO url_inspection_cache
|
|
@@ -483,4 +472,4 @@ if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid
|
|
|
483
472
|
5. seo_lint checks copy you are writing or editing (a landing page, blog post, title or meta description) for patterns common in AI-written text and for title and description length. It reads only the text or files you give it.
|
|
484
473
|
seo_crawl and seo_internal_links run on this machine. Keys and Google sign-in come from \`seo start\` and \`seo providers <name> connect\`.`}),n=()=>({clientName:t.server.getClientVersion()?.name});Zte(t,{telemetry:e.telemetry===!1?void 0:n}),vte(t);let r=Qte();if(r){let{name:e,uri:n,...i}=O1;t.registerResource(e,n,i,async e=>({contents:[{uri:e.href,mimeType:i.mimeType,text:r}]}))}return e.telemetry!==!1&&(t.server.oninitialized=()=>{vi(n())}),t}async function $te(e={}){let t=$9();if(e.test){process.stdout.write(`seo MCP server constructed successfully.
|
|
485
474
|
`);return}let n=new _te;await t.connect(n),R4()}export{W1 as $,La as $n,XI as $t,B0 as A,WE as An,Cr as Ar,XG as At,b0 as B,Hb as Bn,Ye as Br,uH as Bt,l2 as C,XD as Cn,Si as Cr,Dq as Ct,G0 as D,JD as Dn,Vr as Dr,KK as Dt,z0 as E,KD as En,Gr as Er,GK as Et,T0 as F,ES as Fn,Zt as Fr,_G as Ft,o0 as G,_s as Gn,nV as Gt,r0 as H,kee as Hn,cH as Ht,E0 as I,yS as In,F as Ir,mG as It,t0 as J,Fo as Jn,hz as Jt,Z1 as K,ms as Kn,pB as Kt,l0 as L,gS as Ln,Tt as Lr,pG as Lt,P0 as M,VT as Mn,Un as Mr,IG as Mt,S0 as N,qw as Nn,Tn as Nr,gG as Nt,V0 as O,HD as On,Hr as Or,$K as Ot,D0 as P,HS as Pn,qt as Pr,hG as Pt,B1 as Q,Na as Qn,YI as Qt,u0 as R,Vb as Rn,Ct as Rr,lH as Rt,d2 as S,GD as Sn,xi as Sr,jJ as St,J0 as T,ZD as Tn,wi as Tr,Eq as Tt,c0 as U,Ks as Un,GV as Ut,v0 as V,Eee as Vn,dH as Vt,s0 as W,vs as Wn,xV as Wt,G1 as X,So as Xn,cz as Xt,e0 as Y,jo as Yn,uz as Yt,H1 as Z,bo as Zn,OR as Zt,A2 as _,GA as _n,hi as _r,zY as _t,Y9 as a,kN as an,Ia as ar,h$ as at,f2 as b,WA as bn,gi as br,FJ as bt,F4 as c,SM as cn,Ii as cr,hQ as ct,g4 as d,Hj as dn,Zi as dr,vZ as dt,CI as en,Pa as er,p1 as et,G2 as f,Lj as fn,Ri as fr,RZ as ft,k2 as g,FA as gn,ci as gr,RY as gt,O2 as h,_j as hn,Yi as hr,AX as ht,Yte as i,pF as in,uee as ir,j$ as it,F0 as j,BE as jn,Mn as jr,ZG as jt,H0 as k,VD as kn,wr as kr,iq as kt,R4 as l,MM as ln,ji as lr,wQ as lt,F2 as m,gj as mn,Xi as mr,ZX as mt,T9 as n,$F as nn,Aa as nr,L$ as nt,Jte as o,Y as on,Di as or,$Q as ot,R2 as p,vj as pn,$i as pr,LZ as pt,n0 as q,fs as qn,Kz as qt,$9 as r,AF as rn,lee as rr,U$ as rt,$te as s,oN as sn,Ji as sr,mQ as st,Pte as t,xI as tn,ja as tr,K$ as tt,j4 as u,xM as un,Qi as ur,BZ as ut,m2 as v,RA as vn,vi as vr,LY as vt,r2 as w,YD as wn,bi as wr,Oq as wt,u2 as x,qD as xn,Ci as xr,qJ as xt,p2 as y,UA as yn,ni as yr,gY as yt,x0 as z,Ub as zn,Xe as zr,pH as zt};
|
|
486
|
-
//# sourceMappingURL=dist-
|
|
475
|
+
//# sourceMappingURL=dist-Bl6qdzNs.js.map
|