seo 0.35.4 → 0.35.5
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/PRIVACY.md +9 -3
- package/dist/cli.js +2 -2
- package/dist/{dist-BhXLIbAL.js → dist-BEpnqpvo.js} +3 -3
- package/dist/dist-BEpnqpvo.js.map +1 -0
- package/dist/{dist-DcxfSo0P.js → dist-DxUk-ntA.js} +1 -1
- package/dist/{esm-BHzcZLja.js → esm-mRp0vTCV.js} +2 -2
- package/dist/{esm-BHzcZLja.js.map → esm-mRp0vTCV.js.map} +1 -1
- package/dist/index.d.ts +126 -126
- package/dist/index.js +47 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +47 -5
- package/dist/mcp.js.map +1 -1
- package/package.json +1 -1
- package/dist/dist-BhXLIbAL.js.map +0 -1
package/PRIVACY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Privacy policy
|
|
2
2
|
|
|
3
|
-
Last updated:
|
|
3
|
+
Last updated: 1 December 2026
|
|
4
4
|
|
|
5
5
|
This policy covers SEO Skill: the `seo` command-line tool and library, the
|
|
6
6
|
local and hosted MCP servers, your account at seoskill.dev, its paid plans
|
|
@@ -13,7 +13,9 @@ and weekly site audit, and the seoskill.dev website and its free tools.
|
|
|
13
13
|
you choose to send.
|
|
14
14
|
- The hosted server keeps your sign-ins and keys, encrypted, so it can fetch
|
|
15
15
|
your own data when you ask. It does not keep your Search Console or
|
|
16
|
-
analytics data, your reports or
|
|
16
|
+
analytics data, your reports or what you asked for. It counts which tools
|
|
17
|
+
you run and whether they worked, so we can spot failures and make them
|
|
18
|
+
good.
|
|
17
19
|
- The paid weekly site audit is the exception. For the sites you add, it
|
|
18
20
|
keeps what the audit needs, listed below, until you remove the site.
|
|
19
21
|
- We do not sell data or use it for advertising.
|
|
@@ -62,6 +64,10 @@ encrypted before they are written.
|
|
|
62
64
|
- **Usage totals.** One number a day for each kind of paid-for work we do
|
|
63
65
|
for you, such as browser time, Google index checks and research calls. No
|
|
64
66
|
URLs or results.
|
|
67
|
+
- **Tool runs.** For each day, how many times you ran each tool and how
|
|
68
|
+
each run ended: worked, or the fixed error code it failed with. No site,
|
|
69
|
+
URL, input or result. We use it to find failures, tell the people they
|
|
70
|
+
hit and make it good, such as with extra credit. Kept for 400 days.
|
|
65
71
|
- **Beta features** the maintainer turned on for your account.
|
|
66
72
|
- **Research results for a day.** What `seo_research` got from DataForSEO
|
|
67
73
|
or Ahrefs, with your key or on our DataForSEO account, and the AI answer
|
|
@@ -274,7 +280,7 @@ only:
|
|
|
274
280
|
- for a failure, a fixed reason code, never the error text.
|
|
275
281
|
|
|
276
282
|
It never holds a site, URL, query, key, account, file path, IP address or
|
|
277
|
-
any report data. We store only the
|
|
283
|
+
any report data. We store only the day it arrived, not the time. Every field is listed
|
|
278
284
|
on the [telemetry page](https://seoskill.dev/telemetry), and totals are on
|
|
279
285
|
the [stats page](https://seoskill.dev/stats). Failure and retention counts
|
|
280
286
|
stay private and reach the maintainer in a weekly message.
|
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,Bt as l,C as u,Cn as d,Cr as f,Ct as p,D as ee,Dn as m,Dr as te,Dt as ne,E as re,En as ie,Er as ae,Et as oe,F as se,Fn as ce,Ft as le,G as ue,Gn as de,Gt as fe,H as pe,Hn as me,Ht as he,I as ge,In as _e,It as ve,J as ye,Jn as be,Jt as xe,K as Se,Kn as Ce,Kt as we,L as Te,Ln as Ee,Lt as De,M as Oe,Mn as ke,Mr as Ae,Mt as je,N as Me,Nn as Ne,Nr as Pe,Nt as Fe,O as Ie,On as Le,Or as Re,Ot as ze,P as Be,Pn as Ve,Pr as He,Pt as Ue,Q as We,Qn as Ge,Qt as Ke,R as qe,Rn as Je,Rt as Ye,S as Xe,Sn as Ze,Sr as Qe,St as $e,T as et,Tn as tt,Tr as nt,Tt as rt,U as it,Un as at,Ut as ot,V as st,Vn as ct,Vt as lt,W as ut,Wn as dt,Wt as ft,X as pt,Xn as mt,Xt as ht,Y as gt,Yn as _t,Yt as vt,Z as yt,Zn as bt,Zt as xt,_ as St,_n as Ct,_r as wt,_t as Tt,a as Et,an as Dt,ar as Ot,at as kt,b as At,bn as jt,br as Mt,bt as Nt,c as Pt,cn as Ft,cr as It,ct as Lt,d as Rt,dn as zt,dr as Bt,dt as Vt,en as Ht,er as Ut,et as Wt,f as Gt,fn as Kt,fr as qt,ft as Jt,g as Yt,gn as Xt,gr as Zt,gt as Qt,h as $t,hn as en,hr as tn,ht as nn,i as rn,in as an,ir as on,it as sn,j as cn,jn as ln,jr as un,k as dn,kn as fn,kr as pn,kt as mn,l as hn,ln as gn,lr as _n,lt as vn,m as yn,mn as bn,mr as xn,mt as Sn,nn as Cn,nr as wn,nt as Tn,o as En,on as Dn,or as On,ot as kn,p as An,pn as jn,pr as Mn,pt as Nn,q as Pn,qn as Fn,qt as In,rn as Ln,rr as Rn,rt as zn,sn as Bn,sr as Vn,st as Hn,t as Un,tn as Wn,tr as Gn,tt as Kn,u as qn,un as Jn,ur as Yn,ut as Xn,v as Zn,vn as Qn,vr as $n,vt as er,w as tr,wn as nr,wr as rr,wt as ir,x as ar,xn as or,xr as sr,xt as cr,y as lr,yn as ur,yr as dr,yt as fr,z as pr,zn as mr,zt as hr}from"./dist-BhXLIbAL.js";import{$t as gr,D as _r,Gn as vr,I as yr,Jt as br,Kn as xr,Kt as Sr,L as Cr,O as wr,P as Tr,Qt as Er,Tn as Dr,Un as h,Yt as Or,Zt as kr,c as Ar,d as jr,dt as Mr,l as Nr,on as Pr,pn as Fr,rn as Ir,tn as Lr,vn as Rr}from"./progress-2jor-Zuz.js";import{randomBytes as zr}from"node:crypto";import{arch as Br,homedir as Vr,platform as Hr}from"node:os";import{basename as Ur,dirname as Wr,join as g,posix as Gr,relative as Kr,resolve as qr,sep as Jr,win32 as Yr}from"node:path";import{constants as Xr,copyFileSync as Zr,createWriteStream as Qr,existsSync as _,mkdirSync as $r,readFileSync as ei,readdirSync as ti,realpathSync as ni,renameSync as ri,rmSync as ii,statSync as ai,writeFileSync as oi}from"node:fs";import{fileURLToPath as si}from"node:url";import{cp as ci,mkdir as li,open as ui,readFile as v,readdir as di,rename as fi,stat as pi,writeFile as mi}from"node:fs/promises";import{isDeepStrictEqual as hi,stripVTControlCharacters as gi}from"node:util";import{spawn as _i,spawnSync as vi}from"node:child_process";import{defineCommand as y,runCommand as yi,runMain as bi}from"citty";import{cancel as xi,confirm as Si,intro as Ci,isCancel as wi,log as Ti,multiselect as Ei,note as b,outro as x,password as Di,select as Oi,text as ki}from"@clack/prompts";import Ai from"picocolors";import ji from"string-width";import Mi from"cli-table3";import{finished as Ni}from"node:stream/promises";import{applyEdits as Pi,modify as Fi,parse as Ii,printParseErrorCode as Li}from"jsonc-parser";import Ri from"update-notifier";const S={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 zi(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 Bi(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 Vi(e){return[{filename:`postmortem-summary.csv`,headers:[...S.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:[...S.steps],rows:e.steps.map((e,t)=>({rank:t+1,tool:e.tool,status:e.status,summary:e.summary}))},{filename:`workflow-actions.csv`,headers:[...S.actions],rows:e.actions.map((e,t)=>({rank:t+1,title:e.title,confidence:e.confidence,action:e.action}))},{filename:`postmortem-findings.csv`,headers:[...S.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:[...S.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:[...S.evidence],rows:e.output.update.evidence.map((e,t)=>({rank:t+1,evidence:e}))},{filename:`postmortem-confounders.csv`,headers:[...S.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:[...S.segment],rows:zi(e,t)})),...[`page`,`query`,`device`,`country`].map(t=>({filename:`postmortem-segment-${t}-unmatched.csv`,headers:[...S.unmatchedSegment],rows:Bi(e,t)}))]}function Hi(e){return _(e)?ti(e,{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(`.log`)).map(t=>{let n=g(e,t.name),r=ai(n);return{path:n,size:r.size,modifiedAt:r.mtimeMs}}):[]}function Ui(e,t){let n=Wr(e),r=Ur(e,`.log`),i=0;for(;;){let e=g(n,`${r}.${t}${i?`-${i}`:``}.log`);if(!_(e))return e;i+=1}}function Wi(e={}){let t=e.directory??Re().logDir,n=e.now??Date.now(),r=e.maxFileBytes??8388608,i=e.maxTotalBytes??67108864,a=e.maxAgeMs??12096e5;$r(t,{recursive:!0,mode:448});let o=0,s=0;for(let e of Hi(t))e.size<=r||(ri(e.path,Ui(e.path,n)),o+=1);for(let e of Hi(t))e.modifiedAt>=n-a||(ii(e.path,{force:!0}),s+=1);let c=Hi(t).sort((e,t)=>e.modifiedAt-t.modifiedAt||(e.path<t.path?-1:+(e.path>t.path))),l=c.reduce((e,t)=>e+t.size,0);for(let e of c){if(l<=i)break;ii(e.path,{force:!0}),l-=e.size,s+=1}return{rotated:o,removed:s,sizeBytes:l}}function Gi(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 Ki(e,t){return{type:`boolean`,default:!0,description:e,negativeDescription:t}}function C(e){return typeof e==`string`?e:void 0}function w(e){return typeof e==`boolean`?e:void 0}function qi(e){let t=C(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(w(e.js)===!0&&t&&t!==`on`)throw new h(`INVALID_INPUT`,`Use either --js or --rendering on, not both with different modes.`);return t??(w(e.js)?`on`:`auto`)}function T(e,t){let n=w(e[t]);if(n===!1)return!0;if(n===!0)return!1;let r=w(e[Ji(t)]);if(r===!1)return!0;if(r===!0)return!1;if(w(e[`no-${t}`])===!0||w(e[`no${Yi(t)}`])===!0)return!0}function Ji(e){return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Yi(e){let t=Ji(e);return t?`${t[0]?.toUpperCase()}${t.slice(1)}`:``}function E(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 D(e,t){if(e===void 0||e===``)return;let n=E(e);if(n===void 0)throw new h(`INVALID_INPUT`,`${t} must be a number.`);return n}function O(e){if(typeof e!=`string`)return;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length?t:void 0}function Xi(e){return O(e)??[]}function Zi(e){let t={concurrency:E(e[`fetch-concurrency`]),intervalCap:E(e[`fetch-interval-cap`]),intervalMs:E(e[`fetch-interval-ms`])};return Object.values(t).some(e=>e!==void 0)?t:void 0}function k(e){return e.json===!0}async function Qi(e,t){let n=C(e),r=C(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 A(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 $i(e,t={}){let n=A(e),r=(await ln(t.refresh,t.account)).map(e=>e.siteUrl),i=Rr(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 ea(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 ta(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 na(e={}){let t=e.env??process.env,n=ta(e.columns)??ta(e.streamColumns)??ta(t.COLUMNS)??80;return Math.min(200,Math.max(40,n))}function j(e={}){let t=e.env??process.env,n=e.isTTY??!!process.stdout.isTTY,r=e.color??!!(n&&t.NO_COLOR===void 0);return{columns:na({...e,env:t,streamColumns:e.streamColumns??process.stdout.columns}),colors:Ai.createColors(r),hasColor:r,isInteractive:n&&!t.CI}}function M(e){return ji(gi(e))}function ra(e,t){let n=[],r=``;for(let i of e)r&&M(`${r}${i}`)>t?(n.push(r),r=i):r+=i;return r&&n.push(r),n}function ia(e,t){if(!e)return[``];let n=e.trim().split(/\s+/u),r=[],i=``;for(let e of n){let n=M(e)>t?ra(e,t):[e];for(let e of n)i?M(`${i} ${e}`)<=t?i+=` ${e}`:(r.push(i),i=e):i=e}return i&&r.push(i),r.length>0?r:[``]}function N(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,Bt as l,C as u,Cn as d,Cr as f,Ct as p,D as ee,Dn as m,Dr as te,Dt as ne,E as re,En as ie,Er as ae,Et as oe,F as se,Fn as ce,Ft as le,G as ue,Gn as de,Gt as fe,H as pe,Hn as me,Ht as he,I as ge,In as _e,It as ve,J as ye,Jn as be,Jt as xe,K as Se,Kn as Ce,Kt as we,L as Te,Ln as Ee,Lt as De,M as Oe,Mn as ke,Mr as Ae,Mt as je,N as Me,Nn as Ne,Nr as Pe,Nt as Fe,O as Ie,On as Le,Or as Re,Ot as ze,P as Be,Pn as Ve,Pr as He,Pt as Ue,Q as We,Qn as Ge,Qt as Ke,R as qe,Rn as Je,Rt as Ye,S as Xe,Sn as Ze,Sr as Qe,St as $e,T as et,Tn as tt,Tr as nt,Tt as rt,U as it,Un as at,Ut as ot,V as st,Vn as ct,Vt as lt,W as ut,Wn as dt,Wt as ft,X as pt,Xn as mt,Xt as ht,Y as gt,Yn as _t,Yt as vt,Z as yt,Zn as bt,Zt as xt,_ as St,_n as Ct,_r as wt,_t as Tt,a as Et,an as Dt,ar as Ot,at as kt,b as At,bn as jt,br as Mt,bt as Nt,c as Pt,cn as Ft,cr as It,ct as Lt,d as Rt,dn as zt,dr as Bt,dt as Vt,en as Ht,er as Ut,et as Wt,f as Gt,fn as Kt,fr as qt,ft as Jt,g as Yt,gn as Xt,gr as Zt,gt as Qt,h as $t,hn as en,hr as tn,ht as nn,i as rn,in as an,ir as on,it as sn,j as cn,jn as ln,jr as un,k as dn,kn as fn,kr as pn,kt as mn,l as hn,ln as gn,lr as _n,lt as vn,m as yn,mn as bn,mr as xn,mt as Sn,nn as Cn,nr as wn,nt as Tn,o as En,on as Dn,or as On,ot as kn,p as An,pn as jn,pr as Mn,pt as Nn,q as Pn,qn as Fn,qt as In,rn as Ln,rr as Rn,rt as zn,sn as Bn,sr as Vn,st as Hn,t as Un,tn as Wn,tr as Gn,tt as Kn,u as qn,un as Jn,ur as Yn,ut as Xn,v as Zn,vn as Qn,vr as $n,vt as er,w as tr,wn as nr,wr as rr,wt as ir,x as ar,xn as or,xr as sr,xt as cr,y as lr,yn as ur,yr as dr,yt as fr,z as pr,zn as mr,zt as hr}from"./dist-BEpnqpvo.js";import{$t as gr,D as _r,Gn as vr,I as yr,Jt as br,Kn as xr,Kt as Sr,L as Cr,O as wr,P as Tr,Qt as Er,Tn as Dr,Un as h,Yt as Or,Zt as kr,c as Ar,d as jr,dt as Mr,l as Nr,on as Pr,pn as Fr,rn as Ir,tn as Lr,vn as Rr}from"./progress-2jor-Zuz.js";import{randomBytes as zr}from"node:crypto";import{arch as Br,homedir as Vr,platform as Hr}from"node:os";import{basename as Ur,dirname as Wr,join as g,posix as Gr,relative as Kr,resolve as qr,sep as Jr,win32 as Yr}from"node:path";import{constants as Xr,copyFileSync as Zr,createWriteStream as Qr,existsSync as _,mkdirSync as $r,readFileSync as ei,readdirSync as ti,realpathSync as ni,renameSync as ri,rmSync as ii,statSync as ai,writeFileSync as oi}from"node:fs";import{fileURLToPath as si}from"node:url";import{cp as ci,mkdir as li,open as ui,readFile as v,readdir as di,rename as fi,stat as pi,writeFile as mi}from"node:fs/promises";import{isDeepStrictEqual as hi,stripVTControlCharacters as gi}from"node:util";import{spawn as _i,spawnSync as vi}from"node:child_process";import{defineCommand as y,runCommand as yi,runMain as bi}from"citty";import{cancel as xi,confirm as Si,intro as Ci,isCancel as wi,log as Ti,multiselect as Ei,note as b,outro as x,password as Di,select as Oi,text as ki}from"@clack/prompts";import Ai from"picocolors";import ji from"string-width";import Mi from"cli-table3";import{finished as Ni}from"node:stream/promises";import{applyEdits as Pi,modify as Fi,parse as Ii,printParseErrorCode as Li}from"jsonc-parser";import Ri from"update-notifier";const S={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 zi(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 Bi(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 Vi(e){return[{filename:`postmortem-summary.csv`,headers:[...S.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:[...S.steps],rows:e.steps.map((e,t)=>({rank:t+1,tool:e.tool,status:e.status,summary:e.summary}))},{filename:`workflow-actions.csv`,headers:[...S.actions],rows:e.actions.map((e,t)=>({rank:t+1,title:e.title,confidence:e.confidence,action:e.action}))},{filename:`postmortem-findings.csv`,headers:[...S.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:[...S.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:[...S.evidence],rows:e.output.update.evidence.map((e,t)=>({rank:t+1,evidence:e}))},{filename:`postmortem-confounders.csv`,headers:[...S.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:[...S.segment],rows:zi(e,t)})),...[`page`,`query`,`device`,`country`].map(t=>({filename:`postmortem-segment-${t}-unmatched.csv`,headers:[...S.unmatchedSegment],rows:Bi(e,t)}))]}function Hi(e){return _(e)?ti(e,{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(`.log`)).map(t=>{let n=g(e,t.name),r=ai(n);return{path:n,size:r.size,modifiedAt:r.mtimeMs}}):[]}function Ui(e,t){let n=Wr(e),r=Ur(e,`.log`),i=0;for(;;){let e=g(n,`${r}.${t}${i?`-${i}`:``}.log`);if(!_(e))return e;i+=1}}function Wi(e={}){let t=e.directory??Re().logDir,n=e.now??Date.now(),r=e.maxFileBytes??8388608,i=e.maxTotalBytes??67108864,a=e.maxAgeMs??12096e5;$r(t,{recursive:!0,mode:448});let o=0,s=0;for(let e of Hi(t))e.size<=r||(ri(e.path,Ui(e.path,n)),o+=1);for(let e of Hi(t))e.modifiedAt>=n-a||(ii(e.path,{force:!0}),s+=1);let c=Hi(t).sort((e,t)=>e.modifiedAt-t.modifiedAt||(e.path<t.path?-1:+(e.path>t.path))),l=c.reduce((e,t)=>e+t.size,0);for(let e of c){if(l<=i)break;ii(e.path,{force:!0}),l-=e.size,s+=1}return{rotated:o,removed:s,sizeBytes:l}}function Gi(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 Ki(e,t){return{type:`boolean`,default:!0,description:e,negativeDescription:t}}function C(e){return typeof e==`string`?e:void 0}function w(e){return typeof e==`boolean`?e:void 0}function qi(e){let t=C(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(w(e.js)===!0&&t&&t!==`on`)throw new h(`INVALID_INPUT`,`Use either --js or --rendering on, not both with different modes.`);return t??(w(e.js)?`on`:`auto`)}function T(e,t){let n=w(e[t]);if(n===!1)return!0;if(n===!0)return!1;let r=w(e[Ji(t)]);if(r===!1)return!0;if(r===!0)return!1;if(w(e[`no-${t}`])===!0||w(e[`no${Yi(t)}`])===!0)return!0}function Ji(e){return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Yi(e){let t=Ji(e);return t?`${t[0]?.toUpperCase()}${t.slice(1)}`:``}function E(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 D(e,t){if(e===void 0||e===``)return;let n=E(e);if(n===void 0)throw new h(`INVALID_INPUT`,`${t} must be a number.`);return n}function O(e){if(typeof e!=`string`)return;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length?t:void 0}function Xi(e){return O(e)??[]}function Zi(e){let t={concurrency:E(e[`fetch-concurrency`]),intervalCap:E(e[`fetch-interval-cap`]),intervalMs:E(e[`fetch-interval-ms`])};return Object.values(t).some(e=>e!==void 0)?t:void 0}function k(e){return e.json===!0}async function Qi(e,t){let n=C(e),r=C(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 A(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 $i(e,t={}){let n=A(e),r=(await ln(t.refresh,t.account)).map(e=>e.siteUrl),i=Rr(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 ea(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 ta(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 na(e={}){let t=e.env??process.env,n=ta(e.columns)??ta(e.streamColumns)??ta(t.COLUMNS)??80;return Math.min(200,Math.max(40,n))}function j(e={}){let t=e.env??process.env,n=e.isTTY??!!process.stdout.isTTY,r=e.color??!!(n&&t.NO_COLOR===void 0);return{columns:na({...e,env:t,streamColumns:e.streamColumns??process.stdout.columns}),colors:Ai.createColors(r),hasColor:r,isInteractive:n&&!t.CI}}function M(e){return ji(gi(e))}function ra(e,t){let n=[],r=``;for(let i of e)r&&M(`${r}${i}`)>t?(n.push(r),r=i):r+=i;return r&&n.push(r),n}function ia(e,t){if(!e)return[``];let n=e.trim().split(/\s+/u),r=[],i=``;for(let e of n){let n=M(e)>t?ra(e,t):[e];for(let e of n)i?M(`${i} ${e}`)<=t?i+=` ${e}`:(r.push(i),i=e):i=e}return i&&r.push(i),r.length>0?r:[``]}function N(e,t){let n=Math.max(1,t);return e.replaceAll(`\r
|
|
4
4
|
`,`
|
|
5
5
|
`).split(`
|
|
6
6
|
`).flatMap(e=>ia(e,n))}function aa(e,t){if(M(e)<=t)return e;let n=Math.max(1,t-M(`...`)),r=``;for(let t of e){if(M(`${r}${t}`)>n)break;r+=t}return`${r}...`}const oa={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 sa(e){return e===void 0?``:String(e)}function ca(e,t){return e.map((e,n)=>{let r=t.map(e=>sa(e[n]));return Math.min(42,Math.max(M(e),...r.map(M),4))})}function la(e,t,n){return e.length===0||e.length>4||!e.map((e,n)=>t.every(e=>/^-?(?:\d+(?:\.\d+)?|\d+(?:\.\d+)?%)$/u.test(sa(e[n]).trim()))).some(Boolean)?!1:ca(e,t).reduce((e,t)=>e+t+2,0)<=n.columns}function ua(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 da(e,t,n){let r=ca(e,t).map(e=>e+2),i=new Mi({chars:oa,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)=>N(ua(e,sa(a[t]),n),Math.max(1,(r[t]??3)-2)).join(`
|
|
@@ -68,7 +68,7 @@ What changed: https://github.com/iannuttall/seo/blob/main/CHANGELOG.md
|
|
|
68
68
|
`),`Setup will`),b(Lc.join(`
|
|
69
69
|
`),`Then run`),x(`Dry run complete. Nothing was changed.`));return}te();let n=P({json:t}),r=await jc({interactive:n})??await Pc({interactive:n}),i=n?await Ic():[],a=n?await Fc():{status:`skipped`};if(t){F({auth:r,mcp:i,skill:a,next:Lc});return}I([[`Sign-in`,zc(r)],[`MCP server`,Vc(i)],[`SEO skill`,Bc(a)]]);let o=i.filter(e=>e.error);o.length&&b(o.map(e=>`${e.client}: ${e.error}`).join(`
|
|
70
70
|
`),`MCP setup skipped`),a.error&&b(a.error,`SEO skill install failed`),b(`seo sites list your Search Console properties
|
|
71
|
-
seo report --site <site> run the main report for one of them`,`Try next`),x(`Setup complete.`),Hc()}const Wc=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})=>Uc(e)}),Gc=y({...Wc,meta:{name:`start`,description:`Start here: sign in with Google, then add the MCP server and skill to your agents`}}),Kc=y({...Gc,meta:{name:`init`,description:"Legacy alias for `seo start`."}}),qc=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=Wi();k(e)?F(t):e.quiet||process.stdout.write(`Rotated ${t.rotated} and removed ${t.removed} log files. ${Wa(t.sizeBytes)} retained.\n`)}})}}),Jc=[{client:`claude-desktop`,flag:`claude-desktop`},{client:`claude-code`,flag:`claude-code`},{client:`codex`,flag:`codex`},{client:`cursor`,flag:`cursor`}];function Yc(e,t){return w(e.all)?t:Jc.filter(({flag:t})=>w(e[t])).map(({client:e})=>e)}const Xc=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-
|
|
71
|
+
seo report --site <site> run the main report for one of them`,`Try next`),x(`Setup complete.`),Hc()}const Wc=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})=>Uc(e)}),Gc=y({...Wc,meta:{name:`start`,description:`Start here: sign in with Google, then add the MCP server and skill to your agents`}}),Kc=y({...Gc,meta:{name:`init`,description:"Legacy alias for `seo start`."}}),qc=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=Wi();k(e)?F(t):e.quiet||process.stdout.write(`Rotated ${t.rotated} and removed ${t.removed} log files. ${Wa(t.sizeBytes)} retained.\n`)}})}}),Jc=[{client:`claude-desktop`,flag:`claude-desktop`},{client:`claude-code`,flag:`claude-code`},{client:`codex`,flag:`codex`},{client:`cursor`,flag:`cursor`}];function Yc(e,t){return w(e.all)?t:Jc.filter(({flag:t})=>w(e[t])).map(({client:e})=>e)}const Xc=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-DxUk-ntA.js`);await t({test:w(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(w(e.uninstall)&&w(e.reinstall))throw new h(`INVALID_INPUT`,`Use either --uninstall or --reinstall, not both.`);let t=Js(),n=Zs({targets:t}),r=k(e),i=Yc(e,n.map(e=>e.client));if(i.length===0){if(!P({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=R(await Ei({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=>w(e.uninstall)?gc(t):hc(t,{reinstall:w(e.reinstall)}));if(r)F({operation:w(e.uninstall)?`uninstall`:`install`,results:o});else for(let e of o)process.stdout.write(`${e.changed?`updated`:`skipped`} ${e.client} · ${e.path}\n`)}})}}),Zc=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=k(e),n=A(C(e.site)),r=Xi(e.sitemaps),i=await we({site:n,url:C(e.url),sitemaps:r.length?r:void 0,days:E(e.days),rowLimit:E(e[`row-limit`]),maxSitemapUrls:E(e[`max-sitemap-urls`]),itemsPerSection:E(e.limit),refresh:w(e.refresh)});t?F(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(`
|
|
72
72
|
Representative URL Inspection candidates
|
|
73
73
|
`),L([`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))}}),Qc=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=k(e),n=await ft({site:A(C(e.site)),days:E(e.days),limit:E(e.limit),minClicks:E(e[`min-clicks`]),minImpressions:E(e[`min-impressions`]),refresh:w(e.refresh),js:w(e.js)?!0:`auto`});t?F(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)))}}),$c=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 ${_e.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=C(e.map);if(t){await rl(e,t);return}let n=C(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 fe({url:n,maxHops:E(e[`max-hops`]),refresh:w(e.refresh),js:w(e.js)?!0:`auto`});k(e)?F(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}]}),L([`#`,`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(`
|
|
74
74
|
Final page
|
|
@@ -5,7 +5,7 @@ import{$ as e,$t as t,A as n,An as r,At as i,B as a,Bn as o,Bt as s,C as c,Cn as
|
|
|
5
5
|
`,Ji(s.aiAssistants)),data:{...s,...c.length?{otherMatches:c}:{}}}}catch(e){let t=e instanceof Error?e.message:String(e);return{text:`Google Analytics: could not be read. ${t}`,data:{error:t}}}}const $i=(e,t)=>(t?e.get(`x-simpleanalytics-site-${ta(t)}`):null)?.trim()||e.get(`x-simpleanalytics-key`)?.trim()||null;function ea(e){let t=[];for(let[n,r]of e)n.startsWith(`x-simpleanalytics-site-`)&&r.trim()&&t.push(n.slice(23));return t.sort()}const ta=e=>oa(e)[0]??``,na=864e5,ra=e=>new Date(e).toISOString().slice(0,10),ia={chatgpt:`chatgpt`,openai:`chatgpt`,perplexity:`perplexity`,claude:`claude`,gemini:`gemini`,copilot:`copilot`,grok:`grok`,deepseek:`deepseek`},aa=e=>wi(e)??xi.find(t=>t.id===ia[e.trim().toLowerCase()]);function oa(e){let t=e.trim().toLowerCase().replace(/^sc-domain:/u,``),n;try{n=new URL(t.includes(`://`)?t:`https://${t}`).hostname}catch{n=t}let r=n.replace(/^www\./u,``);return[r,`www.${r}`]}const sa=(e,t)=>t.visitors-e.visitors||t.pageviews-e.pageviews||(e.value<t.value?-1:+(e.value>t.value));async function ca(e,t,n,r,i){let a=await Ai(e,t,n,[`pageviews`,`visitors`,...i?[`pages`]:[],`referrers`,`utm_sources`],r),o=[...a.referrers].sort(sa),s=[...a.utm_sources].sort(sa),c=/* @__PURE__ */ new Map,l=(e,t)=>{for(let n of e){let e=aa(n.value);if(!e||!n.visitors)continue;let r=c.get(e.id)??{label:e.label,refs:[],utms:[]};r[t].push(n),c.set(e.id,r)}};l(o,`refs`),l(s,`utms`);let u=e=>e.reduce((e,t)=>e+t.visitors,0),d=[...c.values()].map(e=>({...e,total:u(e.refs)+u(e.utms)})).sort((e,t)=>t.total-e.total||(e.label<t.label?-1:+(e.label>t.label))),f=await Promise.all(d.slice(0,5).map(async i=>{let a=i.refs.flatMap(e=>i.utms.map(t=>({ref:e,utm:t}))).sort((e,t)=>Math.min(t.ref.visitors,t.utm.visitors)-Math.min(e.ref.visitors,e.utm.visitors)||(e.ref.value+e.utm.value<t.ref.value+t.utm.value?-1:1)),o=a.slice(0,4),s=await Promise.all(o.map(async({ref:i,utm:a})=>(await Ai(e,t,n,[`visitors`],{...r,referrer:i.value,utm_source:a.value})).visitors??0));return{tool:i.label,visitors:i.total-s.reduce((e,t)=>e+t,0),referrers:i.refs.map(e=>e.value),utmSources:i.utms.map(e=>e.value),exact:a.length<=4}})),p=e=>e.length>=Ti;return{hostname:a.hostname,timezone:a.timezone,range:n,visitors:a.visitors??0,pageviews:a.pageviews??0,pages:[...a.pages].sort(sa),referrers:o,utmSources:s,ai:{visitors:f.reduce((e,t)=>e+t.visitors,0),tools:f,notCounted:Math.max(0,d.length-5)},capped:{pages:p(a.pages),referrers:p(a.referrers),utmSources:p(a.utm_sources)}}}async function la(e,t){for(let n of oa(e))try{return await t(n)}catch(e){if(e instanceof Ei&&e.code===`not_found`)continue;throw e}return null}function ua(e){return e?.startsWith(`/`)?{pages:`${e.replace(/\*+$/u,``)}*`}:{}}const da=e=>e.slice(0,10).map(e=>`${e.value} ${e.visitors}`).join(`; `),fa=e=>[e.ai.tools.some(e=>!e.exact)?`${e.ai.tools.filter(e=>!e.exact).map(e=>e.tool).join(`, `)} came in more referrer and utm_source pairs than were checked, so a visitor with both can count twice there.`:``,e.ai.notCounted?`${e.ai.notCounted} more AI ${e.ai.notCounted===1?`tool is`:`tools are`} left out of this count.`:``,e.capped.referrers||e.capped.utmSources?`A referrer or utm_source list reached Simple Analytics' ${Ti}-row limit, so AI tools past it are missing, not zero.`:``].filter(Boolean),pa=`Visitors are Simple Analytics’ own count: a pageview with no referrer or one from another site, which it also counts as a visit. They are not Google Analytics sessions or users, or Search Console clicks.`,ma=e=>e.timezone?`Days are in the website’s time zone, ${e.timezone}.`:``,ha=e=>e instanceof Error?e.message:String(e);async function ga(e,t,n,r,i){let a=e?$i(e,t):null;if(!a)return null;let o=ua(i);try{let e=await la(t,e=>ca(a,e,n,o,!1));if(!e)return null;let s=await ca(a,e.hostname,r,o,!1),c=(e,t,n)=>{let r=/* @__PURE__ */ new Map;for(let t of e){let e=r.get(n(t))??{visitors:0,previousVisitors:0};e.visitors+=t.visitors,r.set(n(t),e)}for(let e of t){let t=r.get(n(e))??{visitors:0,previousVisitors:0};t.previousVisitors+=e.visitors,r.set(n(e),t)}return[...r].map(([e,t])=>({name:e,...t})).sort((e,t)=>t.visitors-e.visitors||t.previousVisitors-e.previousVisitors||(e.name<t.name?-1:+(e.name>t.name)))},l=e=>e.slice(0,10).map(e=>`${e.name} ${e.visitors} (was ${e.previousVisitors})`).join(`, `),u=c(e.referrers,s.referrers,e=>e.value),d=c(e.ai.tools,s.ai.tools,e=>e.tool),f=o.pages?`, pages whose path starts with "${i}"`:``,p=[pa,ma(e),i&&!o.pages?`Simple Analytics narrows only to paths that start with some text, so these numbers cover the whole site, not pages containing "${i}".`:``,e.capped.referrers||s.capped.referrers?`The referrer list reached Simple Analytics' ${Ti}-row limit, so referrers past it are missing, not zero.`:``].filter(Boolean);return{text:`${[`Simple Analytics, website ${e.hostname}${f}: visitors ${e.visitors} (was ${s.visitors}, ${Ki(Ue(e.visitors,s.visitors))}), pageviews ${e.pageviews} (was ${s.pageviews}, ${Ki(Ue(e.pageviews,s.pageviews))}).`,u.length?`Top referrers (visitors): ${l(u)}.`:``,...p].filter(Boolean).join(` `)}\n\n${[e.ai.visitors||s.ai.visitors?`Visitors from AI assistants in Simple Analytics (referrers and utm_source tags, a visitor with both counted once): ${e.ai.visitors} (was ${s.ai.visitors}, ${Ki(Ue(e.ai.visitors,s.ai.visitors))}). By tool: ${l(d)}.`:e.capped.referrers||e.capped.utmSources?`Visitors from AI assistants in Simple Analytics: none among the referrers and utm_source tags it listed, but a list reached its row limit, so this is unknown, not zero.`:`Visitors from AI assistants in Simple Analytics: none in either period.`,.../* @__PURE__ */ new Set([...fa(e),...fa(s)]),`Only visits that pass a referrer or utm_source count; AI apps that send neither show as direct.`].join(` `)}`,data:{hostname:e.hostname,timezone:e.timezone,...o.pages?{pathStartsWith:i}:{},metric:`visitors`,visitors:e.visitors,previousVisitors:s.visitors,visitorsChangePct:Ue(e.visitors,s.visitors),pageviews:e.pageviews,previousPageviews:s.pageviews,referrers:u.map(({name:e,...t})=>({referrer:e,...t})),aiAssistants:{visitors:e.ai.visitors,previousVisitors:s.ai.visitors,visitorsChangePct:Ue(e.ai.visitors,s.ai.visitors),byTool:d.map(({name:e,...t})=>({tool:e,...t})),tools:e.ai.tools,previousTools:s.ai.tools},capped:{now:e.capped,before:s.capped},notes:p}}}catch(e){return{text:`Simple Analytics: could not be read. ${ha(e)}`,data:{error:ha(e)}}}}async function _a(e,t,n){let r=$i(t,e.site);if(!r)throw new h(`NO_KEY`,`No Simple Analytics API key is saved. Add one: ${n.connect}`);let i;if(!e.startDate&&!e.endDate){let e=Date.now()-na;i={startDate:ra(e-27*na),endDate:ra(e)}}else if(!e.startDate||!e.endDate||!(Date.parse(e.startDate)<=Date.parse(e.endDate)))throw new h(`INVALID_INPUT`,`Send a start date and an end date together, in order.`);else i={startDate:e.startDate,endDate:e.endDate};let a;try{a=await la(e.site,e=>ca(r,e,i,{},!0))}catch(e){throw new h(e instanceof Ei&&e.code===`auth`?`NO_ACCESS`:`PROVIDER_ERROR`,e instanceof Ei&&e.code===`auth`?`${e.message} Save it again: ${n.connect}`:ha(e))}if(!a)throw new h(`NO_ACCESS`,`Simple Analytics has no website ${oa(e.site).join(` or `)} for this API key. If the site is in another Simple Analytics login, save that login's key for this site: ${n.connect}`);let o=e.offset??0,s=a.pages.filter(e=>e.visitors>0).map(e=>({page:e.value,visitors:e.visitors,pageviews:e.pageviews})),c=[`Visitors ${a.visitors}, pageviews ${a.pageviews} in all. A page’s visitors are the visits that started on it; pages with pageviews but no visitors are left out.`,pa,ma(a),a.referrers.length?`Referrers (visitors): ${da(a.referrers)}.`:`Referrers: none in this range.`,a.utmSources.length?`utm_source tags (visitors): ${da(a.utmSources)}.`:``,a.ai.visitors?`Visitors from AI assistants (referrers and utm_source tags, a visitor with both counted once): ${a.ai.visitors}. By tool: ${a.ai.tools.map(e=>`${e.tool} ${e.visitors}`).join(`, `)}.`:`Visitors from AI assistants: none among the referrers and utm_source tags listed.`,...fa(a),a.capped.pages?`Simple Analytics returned its ${Ti}-row limit of pages; pages past it are missing, not zero.`:``].filter(Boolean);return{text:Be({title:`Simple Analytics website ${a.hostname}: landing pages, ${i.startDate} to ${i.endDate}.`,rows:s,offset:o,limit:50,detail:e.detail??`summary`,notes:c,more:n.call}),data:{hostname:a.hostname,timezone:a.timezone,range:i,metric:`visitors`,visitors:a.visitors,pageviews:a.pageviews,referrers:a.referrers.slice(0,50),utmSources:a.utmSources.slice(0,50),aiAssistants:{visitors:a.ai.visitors,tools:a.ai.tools},capped:a.capped.pages,total:s.length,offset:o,rows:s.slice(o,o+50)}}}async function va(e,t){return(await oi(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 ya=e=>{try{return new URL(e.includes(`://`)?e:`https://${e.replace(/^sc-domain:/,``)}`).hostname.replace(/^www\./,``)}catch{return e}};async function ba(e){let t=e.accounts.length>1,n=ea(e.keys),[r,i]=await Promise.all([Promise.all(e.accounts.map(async t=>{let[n,r]=await Promise.all([va(t.google,e.signIn).catch(e=>e instanceof Error?e:Error(String(e))),ci(t.google,{signIn:e.signIn}).catch(()=>null)]);return{email:t.email,properties:n,analytics:r}})),e.bing?hi(e.bing).catch(e=>e instanceof Error?e:Error(String(e))):Promise.resolve(null)]),a=Array.isArray(i)?i.filter(e=>e.verified):[],o=new Map(a.map(e=>[ya(e.url),e])),s=r.flatMap(e=>e.properties instanceof Error?[]:e.properties.map(n=>({...n,...t?{account:e.email??``}:{},...Array.isArray(i)?{bing:o.get(ya(n.siteUrl))?.url??``}:{}}))),c=new Set(s.map(e=>ya(e.siteUrl))),l=a.filter(e=>!c.has(ya(e.url))),u=r.filter(e=>e.properties instanceof Error),d=r.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??``}:{}})))),f=[[`dataforseo`,`x-dataforseo-login`],[`ahrefs`,`x-ahrefs-key`]].filter(([,t])=>e.keys.get(t??``)).map(([e])=>e),p=[`siteUrl`,`permissionLevel`,...t?[`account`]:[],...Array.isArray(i)?[`bing`]:[]];return{text:[t?`Google accounts: ${e.accounts.map(e=>e.email).join(`, `)}.`:null,`Search Console properties (${s.length}):`,s.length?Ye(s,p,null):`None. These Google sign-ins have no Search Console access, so the reports cannot run.`,...u.map(e=>`${e.email??`Google`}: could not list properties. ${e.properties.message}`),d.length?`Google Analytics properties (${d.length}):\n${Ye(d,[`property`,`name`,`account`,...t?[`signIn`]:[]],null)}`:`Google Analytics: no properties readable with these sign-ins.`,e.bing===void 0?null:i===null?`Bing Webmaster: not connected.`:i instanceof Error?`Bing Webmaster: could not list sites. ${i.message}`:l.length?`Bing Webmaster sites with no Search Console property here (${l.length}): ${l.map(e=>e.url).join(`, `)}.`:`Bing Webmaster: ${a.length} verified sites; the bing column shows each one.`,`Research keys: ${f.length?f.join(`, `):`none`}.`,e.usage===void 0?null:ee(e.usage),e.clicky?.length?`Clicky sites (seo_data with source "clicky"): ${e.clicky.join(`, `)}.`:null,e.simpleAnalytics||n.length?`Simple Analytics (seo_data with source "simple_analytics" and the site's domain): ${[e.simpleAnalytics?`account key saved`:null,n.length?`sites with their own key: ${n.join(`, `)}`:null].filter(Boolean).join(`; `)}.`:null,`Add a Google account${e.bing===void 0?``:`, Bing`} or a key: ${e.connect}`,`Next: seo_report with a site.`].filter(Boolean).join(`
|
|
6
6
|
|
|
7
7
|
`),data:{searchConsole:s,googleAnalytics:d,bing:Array.isArray(i)?a:null,research:f,clicky:e.clicky??[],simpleAnalytics:!!e.simpleAnalytics,simpleAnalyticsSites:n,...e.usage===void 0?{}:{usage:e.usage}}}}const xa={siteOwner:0,siteFullUser:1,siteRestrictedUser:2};function Sa(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 Ca=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:ei(e.token)})),this.bing=Sa(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=va(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=xa[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 h(`NOT_CONNECTED`,`No Google account is connected. ${this.hint.signIn}`);let t=await this.properties(),n=Ht(t,e);if(n)return n;throw new h(`NO_ACCESS`,`None of the connected Google accounts (${this.google.map(e=>e.email).join(`, `)}) has a Search Console property for ${e}. ${ye(t,`they`)} ${this.hint.addGoogle}`)}async owner(e){let t=(await this.ownerMap()).get(await this.resolve(e));if(!t)throw new h(`NO_ACCESS`,`No access to ${e}.`);return t}searchAnalytics(){return async(e,t)=>ai((await this.owner(e)).google,e,{...t,maxRows:t.maxRows??t.rowLimit??1e5},{signIn:this.hint.signIn})}async inspect(e,t){return si((await this.owner(e)).google,e,t,{signIn:this.hint.signIn,languageCode:`en-US`})}};let wa;function Ta(e){return e.platform===`win32`?I(e.env.APPDATA??I(e.home,`AppData`,`Roaming`),`seo`,`Config`):I(e.env.XDG_CONFIG_HOME??I(e.home,`.config`),`seo`)}function Ea(e){return e.platform===`darwin`?I(e.home,`Library`,`Caches`,`seo`):e.platform===`win32`?I(e.env.LOCALAPPDATA??I(e.home,`AppData`,`Local`),`seo`,`Cache`):I(e.env.XDG_CACHE_HOME??I(e.home,`.cache`),`seo`)}function Da(e){return e.platform===`darwin`?I(e.home,`Library`,`Logs`,`seo`):e.platform===`win32`?I(e.env.LOCALAPPDATA??I(e.home,`AppData`,`Local`),`seo`,`Log`):I(e.env.XDG_STATE_HOME??I(e.home,`.local`,`state`),`seo`)}function Oa(e){return{env:e.env??process.env,home:e.home??un(),platform:e.platform??process.platform}}function ka(e={}){let t=Oa(e),n=t.env.SEO_CONFIG_DIR??Ta(t),r=t.env.SEO_CACHE_DIR??Ea(t);return{configDir:n,cacheDir:r,logDir:t.env.SEO_LOG_DIR??Da(t),providerPackagesDir:I(n,`providers`),installedProviderPackagesFile:I(n,`provider-packages.json`),configFile:I(n,`config.json`),tokensFile:I(n,`tokens.json`),oauthClientFile:I(n,`oauth-client.json`),providerSecretsFile:I(n,`provider-secrets.json`),telemetryStateFile:I(n,`telemetry.json`),cacheDbFile:I(r,`cache.db`)}}function Aa(e){let t=Oa(e);if(!(t.platform!==`darwin`||t.env.SEO_CONFIG_DIR||t.env.XDG_CONFIG_HOME))return I(t.home,`Library`,`Preferences`,`seo`)}function ja(e={}){let t=Aa(e);if(!t)return;let n=ka(e);if(Cn(t)&&!Cn(n.configDir))try{wn(hn(n.configDir),{recursive:!0,mode:448}),On(t,n.configDir)}catch(e){let t=e.code;if(t!==`EEXIST`&&t!==`ENOENT`)throw e}}function Ma(){return wa||(wa=ka(),wa)}function Na(){let e=Ma();return ja(),wn(e.configDir,{recursive:!0,mode:448}),wn(e.cacheDir,{recursive:!0,mode:448}),wn(e.logDir,{recursive:!0,mode:448}),wn(e.providerPackagesDir,{recursive:!0,mode:448}),e}function Pa(e){try{return An(e).size}catch{return 0}}function Fa(e,t=448){wn(hn(e),{recursive:!0,mode:t})}function Ia(e){try{return JSON.parse(Tn(e,`utf8`))}catch{return}}function La(e,t,n){Fa(e);let r=`${e}.${process.pid}.${Date.now()}.tmp`;jn(r,JSON.stringify(t,null,2),{encoding:`utf8`,mode:n}),xn(r,n),On(r,e),xn(e,n)}function Ra(e){try{return`0${(An(e).mode&511).toString(8)}`}catch{return`missing`}}function za(e){kn(e,{recursive:!0,force:!0})}const Ba=[`auth`,`crawl_timeout`,`network`,`config`,`data`,`database`,`filesystem`,`internal`,`unknown`],Va=[`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`],Ha=[`crawl_pages_run_id_url`],Ua=/* @__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(`.`),Wa={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`}},Ga=/* @__PURE__ */ new Set([`EAI_AGAIN`,`ENODATA`,`ENOTFOUND`]),Ka=/* @__PURE__ */ new Set([`ECONNREFUSED`,`ECONNRESET`,`ECONNABORTED`,`EPIPE`,`EHOSTUNREACH`,`ENETUNREACH`,`UND_ERR_SOCKET`,`UND_ERR_CONNECT`]),qa=/* @__PURE__ */ new Set([`ETIMEDOUT`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`]);function Ja(e,t){try{return e[t]}catch{return}}function Ya(e){if(typeof e!=`string`&&typeof e!=`number`)return;let t=String(e);return t.length>2048?t.slice(0,2048):t}function Xa(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:Ya(e)}):e&&typeof e==`object`&&!n.has(e)&&(n.add(e),r.push({code:Ya(Ja(e,`code`)),message:Ya(Ja(e,`message`)),name:Ya(Ja(e,`name`))}),t.push(Ja(e,`cause`),Ja(e,`error`)))}return r}function Za(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 Qa(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=>Ga.has(e)))return{errorCategory:`network`,failureReason:`network_dns`};if([...e].some(e=>qa.has(e)))return{errorCategory:`network`,failureReason:`network_timeout`};if([...e].some(e=>Ka.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 uee(e){let t=Xa(e),n=new Set(t.map(e=>e.code?.toUpperCase()).filter(e=>!!e)),r=Za(n,t.map(e=>e.message).filter(e=>!!e).join(`
|
|
8
|
-
`));if(r)return r;let i=Qa(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=kt[a?.code],s=o&&Wa[o];if(s)return s;for(let e of n){let t=Wa[e];if(t)return t}return t.some(e=>e.name===`CLIError`)?{errorCategory:`config`,failureReason:`invalid_input`}:{errorCategory:`unknown`,failureReason:`unknown`}}function $a(e){try{return uee(e)}catch{return{errorCategory:`unknown`,failureReason:`unknown`}}}function eo(e){return typeof e==`string`&&Ua.includes(e)}function dee(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 fee(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 to=`0.35.
|
|
8
|
+
`));if(r)return r;let i=Qa(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=kt[a?.code],s=o&&Wa[o];if(s)return s;for(let e of n){let t=Wa[e];if(t)return t}return t.some(e=>e.name===`CLIError`)?{errorCategory:`config`,failureReason:`invalid_input`}:{errorCategory:`unknown`,failureReason:`unknown`}}function $a(e){try{return uee(e)}catch{return{errorCategory:`unknown`,failureReason:`unknown`}}}function eo(e){return typeof e==`string`&&Ua.includes(e)}function dee(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 fee(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 to=`0.35.5`,no=/* @__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.next-step.copy-lint.ai-queries.image-search.bing-comparison.site-issues.google-updates.seo-progress.teardown.weekly-audit.link-gap.ai-answers.top-pages.pages-by-backlinks.keyword-ideas.serp-overlap.index-check.brand-mentions.serp-outlines.maps-grid.business-profile`.split(`.`),ro=[{days:1,event:`active_d1`},{days:7,event:`active_d7`},{days:30,event:`active_d30`}],io=[`GITHUB_ACTIONS`,`GITLAB_CI`,`CIRCLECI`,`TRAVIS`,`BUILDKITE`,`JENKINS_URL`,`TEAMCITY_VERSION`,`TF_BUILD`,`BITBUCKET_BUILD_NUMBER`,`CODEBUILD_BUILD_ID`];function ao(e){return e.env??process.env}function oo(e){return e.now??/* @__PURE__ */ new Date}function so(e){return e.stateFile??Ma().telemetryStateFile}function co(e){return e===`1`||e?.toLowerCase()===`true`}function lo(e=process.env){return e.NODE_ENV===`test`||!!e.NODE_TEST_CONTEXT||co(e.CI)||io.some(t=>!!e[t])}function uo(e){if(lo(e))return`ci`;if(co(e.DO_NOT_TRACK))return`do_not_track`;if(co(e.SEOSKILL_TELEMETRY_DISABLED)||co(e.SEO_TELEMETRY_DISABLED))return`environment`}function fo(e){return typeof e==`string`&&[`first_run`,`setup_complete`,`first_audit_complete`,`active_d1`,`active_d7`,`active_d30`].includes(e)}function po(e){return typeof e==`string`&&no.includes(e)}function mo(e){return typeof e==`string`&&/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/.test(e)}function ho(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))&&mo(t.cohort)&&Array.isArray(t.sentMilestones)&&t.sentMilestones.every(fo)}function go(e){if(!Cn(e))return{kind:`missing`};let t=Ia(e);return ho(t)?{kind:`valid`,state:t}:{kind:`invalid`}}function _o(e,t){La(e,t,384)}function vo(e,t=!0){let n=oo(e);return{telemetryEnabled:t,firstRunAt:n.toISOString(),cohort:dee(n),sentMilestones:[]}}function yo(e={}){let t=e.env??process.env;return fee(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 bo(e=process.env){let t=(e.AI_AGENT||e.AGENT)?.trim().toLowerCase();if(t)return t.slice(0,40);let n=yo({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 xo(e){return e.agent??yo({clientName:e.clientName,env:ao(e)})}function So(e){return e.replace(/^v/,``).split(`.`)[0]||`unknown`}function Co(e,t,n={},r={}){return{event:e,version:r.version??to,agent:xo(r),os:r.processPlatform??fn(),arch:r.processArch??ln(),node:So(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 wo(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 To(e){let t=so(e),n=uo(ao(e)),r=go(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 Eo(e={}){return To(e)}function Do(e,t={}){let n=so(t),r=go(n),i=r.kind===`valid`?r.state:vo(t,e);return i.telemetryEnabled=e,_o(n,i),To(t)}function Oo(e){let t=To(e);return t.enabled?t.state:void 0}function ko(e={}){let t=To(e);if(!t.enabled)return t;let n=t.stateFile,r=t.state??vo(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,
|
|
9
9
|
fixed report or command name, fixed failure classification, version, agent,
|
|
10
10
|
OS, architecture, Node major, and install week; never URLs, report data, error
|
|
11
11
|
messages, command arguments, or identifiers of any kind).
|
|
@@ -541,7 +541,7 @@ A check is due, once a month. Write up to 5 questions a buyer asks about this bu
|
|
|
541
541
|
`),data:{...d,...p?{analytics:p.data}:{},...m?{clicky:m.data}:{},...g?{simpleAnalytics:g.data}:{},..._?.data,googleUpdates:f}}}const $1=.2,e0=25e3;function t0(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(`
|
|
542
542
|
`),data:{inspected:n.length,indexed:r,notIndexed:a,byCoverage:c,homePage:t&&o!==null?{url:t.url,indexed:o}:null,siteWide:!!s}}}const n0=`Pages that had at least 3 clicks in the previous 28 days and kept ${$1*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.`,r0=`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 i0(e,t){let n=Et(e,28),r=_t(n),i=n=>t.searchAnalytics(e.site,{...n,dimensions:[`page`],type:`web`,maxRows:e0}),[a,o,s]=await Promise.all([i(n),i(r),v1(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*$1).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=HJ({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>=e0}),[m,h]=await Promise.all([t.checkPages(u.map(e=>e.url)),UJ(e.site,p,t,e.maxUrls)]),g=e=>e?h.statuses.get(e)??null:null,_=t0(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=Zt(e.site),S=h.rows.find(e=>e.label===`fix`),C=h.rows.filter(e=>e.label===`check`&&z1.test(e.reason)&&e.status===200&&!e.redirects&&(!e.page_canonical||e.page_canonical===e.url)).map(e=>e.url),w=KJ(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 ${$1*100}% or less of at least 3 clicks${l.length>20?`; the top 20 by clicks lost are shown`:``}.`,v.length?Ye(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.`,SJ(v)],E={rule:r0,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:BJ(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,B1(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.`],$e].filter(Boolean).join(`
|
|
543
543
|
|
|
544
|
-
`),data:{range:n,comparisonRange:r,rule:n0,lostPages:l.length,index:_.data,pages:v,indexing:E}}}const a0={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`},o0={keyword_metrics:`keyword-metrics`,ranked_keywords:`ranked-keywords`,serp:`serp-results`,competitors:`serp-competitors`,backlinks:`link-evidence`};function s0(e,t={}){return e===`report`?a0[t.section||`overview`]??null:e===`research`?o0[t.action??``]??null:{page:`page-opportunities`,compare:`measure-change`,index:`link-recovery`,crawl:`site-crawl`,"internal-links":`internal-links`}[e]??null}[...Ww];const c0={plan:F.union([F.literal(10),F.literal(50),F.literal(100),F.literal(200)]).optional().describe(`Optional. The usage plan to move to, in US dollars a month. Only after the person has said yes to that plan in this conversation: it charges their card.`),top_up:F.union([F.literal(10),F.literal(25),F.literal(50)]).optional().describe(`Optional. Buys a top-up of this many US dollars of usage, which never expires and is used after the plan's. Needs a plan. Only after the person has said yes: it charges their card.`),payment_token:F.string().regex(/^spt_\w+$/).optional().describe(`Optional, with top_up. A Stripe shared payment token (spt_...) from your wallet, such as Link's agent wallet, granted to the Stripe profile and amount a top-up result gave you. Pays the top-up with it instead of the saved card.`),auto_reload:F.object({amount:F.union([F.literal(10),F.literal(25),F.literal(50),F.null()]).describe(`The top-up to buy when top-ups run low, or null for off.`),cap:F.number().int().min(10).max(1e3).describe(`The most auto-reload may buy in a calendar month, in US dollars.`)}).optional().describe(`Optional. Turns auto-reload on or off. Only after the person has said yes to the amount and the monthly cap.`),cancel:F.boolean().optional().describe(`Optional. true cancels the plan at the end of this period; false undoes that, so it renews. Only when the person asks.`)};async function l0(e,t){let{topUp:n,autoReload:r,cancelPlan:i}=e,a=()=>new h(`INVALID_INPUT`,`Plans and usage change on the hosted server only. Connect https://seoskill.dev/mcp and call seo_sites there, or use https://seoskill.dev/account.`);if(t.top_up){if(!n)throw a();let e=await n(t.top_up,t.payment_token),r=t.payment_token?`your payment token`:`the saved card`;return{text:{added:`Added a $${t.top_up} top-up, paid with ${r}. It never expires and is used after the plan's usage.`,checkout:e.status===`checkout`?`Stripe needs the person to pay for this one. Give them this link for the $${t.top_up} top-up: ${e.url}${e.agentPay?`\nOr, if you have a Stripe wallet such as Link's agent wallet, ask it for a shared payment token for ${e.agentPay.amount} cents in USD, granted to Stripe profile ${e.agentPay.profile}, then call seo_sites with top_up ${t.top_up} and payment_token. The person approves it in their wallet.`:``}`:``,token_failed:e.status===`token_failed`?`Stripe refused the payment token, so no top-up was added (${e.reason}). Check it was granted for ${t.top_up*100} cents in USD and hasn't expired or been used, or give the person the top-up link instead.`:``}[e.status],data:e}}if(t.auto_reload){if(!r)throw a();let{amount:e,cap:n}=t.auto_reload;if(e!==null&&n<e)throw new h(`INVALID_INPUT`,`The monthly cap needs to be at least the $${e} top-up.`);return await r(e,n),{text:e===null?`Auto-reload is off.`:`Auto-reload is on: a $${e} top-up when top-ups run low, at most $${n} a month, on the saved card.`,data:t.auto_reload}}if(t.cancel!==void 0){if(!i)throw a();let e=await i(t.cancel);return{text:e?`The plan is cancelled. It and its usage last until ${e.slice(0,10)}, then nothing more is charged.`:`The plan renews as normal.`,data:{endsAt:e}}}if(t.plan){let n=e.choosePlan;if(!n)throw new h(`INVALID_INPUT`,`Plans change on the hosted server only. Connect https://seoskill.dev/mcp and call seo_sites with plan there, or pick a plan at https://seoskill.dev/account.`);let r=await n(t.plan),i={changed:`The account is on the $${t.plan} plan now. Stripe charged the saved card today, less what was left of the last plan, and this month's usage starts full.`,same:`The account is already on the $${t.plan} plan.`,scheduled:r.status===`scheduled`?`The account moves to the $${t.plan} plan on ${r.at.slice(0,10)}. It keeps its current plan and usage until then.`:``,checkout:r.status===`checkout`?`The first plan needs a card. Give the person this Stripe Checkout link for the $${t.plan} plan: ${r.url}\nLater plan changes need no link: call seo_sites with plan again and the saved card is charged.`:``,pending:`The payment went through and the plan is starting. Call seo_sites in a minute to see it.`,payment_failed:`Stripe couldn't take the payment, so the plan didn't change. The person can check their card under Manage billing at https://seoskill.dev/account.`},a=[`changed`,`same`,`scheduled`].includes(r.status);if(!t.add||!a){let e=t.add?`\nOnce the plan is on, call seo_sites with add ${t.add} again.`:``;return{text:`${i[r.status]}${e}`,data:r}}return`${i[r.status]}\n\n`}return``}const u0=864e5;function d0(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 f0=e=>(/* @__PURE__ */ new Date(`${e}T00:00:00Z`)).toLocaleString(`en-GB`,{day:`numeric`,month:`short`,timeZone:`UTC`}),p0=e=>`Your SEO Skill week${e.sites.length===1&&e.sites[0]?` for ${m0(e.sites[0].property)}`:``}, ${d0(e.start,e.end)}`,m0=e=>e.replace(/^sc-domain:|^https?:\/\//,``).replace(/\/$/,``),h0=e=>e.toLocaleString(`en-US`),g0=(e,t,n=`${t}s`)=>`${h0(e)} ${e===1?t:n}`,_0=e=>e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`,v0=e=>/[.!?]$/.test(e)?e:`${e}.`;function y0(e){try{let t=new URL(e);return`${t.pathname}${t.search}`}catch{return e}}function b0(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 x0=e=>{let t=e.clicks;return Math.round(Math.abs(t.clicks-t.previous)/t.previous*100)};function S0(e,t,n,r=!1){let i=[];e.index?.dropped&&i.push({rank:0,heading:`${g0(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`}):!a&&!e.unread&&n-e.added_at>u0&&i.push({rank:1,heading:`first crawl not finished`}),b0(e)===`fell`&&i.push({rank:2,heading:`clicks down ${x0(e)}%`}),o&&a.new_issues>0&&i.push({rank:3,heading:g0(a.new_issues,r?`open finding`:`new issue`)}),i}function C0(e,t,n,r=!1){if(e.unread)return[`Results: this site's checks could not be read for this summary, so its Google index, weekly crawl and search clicks are missing here, not zero. The next summary reads them again.`];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=>y0(e.url)),t=a.dropped-e.length,n=t>0?`${e.join(`, `)} and ${g0(t,`more`)}`:_0(e),r=new Set(a.dropped_pages.map(e=>e.coverage)),o=r.size===1?[...r][0]:null;i.push(`Google index: ${g0(a.dropped,`page`)} dropped out (${n}${o?`: ${o}`:``}).${a.returned?` ${g0(a.returned,`page`)} now indexed.`:``} ${g0(a.checked,`page`)} checked.`)}else i.push(`Google index: ${g0(a.checked,`page`)} checked, none dropped${a.returned?`, ${g0(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 ${g0(o.pages,`page`)}${o.error?`: ${v0(o.error)}`:`.`} It tries again next week.`);else if(s){let e=o.top_rule?OK[o.top_rule]:void 0;i.push(o.new_issues?`Weekly crawl: ${g0(o.pages,`page`)}, ${g0(o.new_issues,r?`open finding`:`new issue`)}${e?`, most of them ${e.charAt(0).toLowerCase()}${e.slice(1)}`:``}.`:`Weekly crawl: ${g0(o.pages,`page`)}, no new issues.`)}else e.added_at<t?i.push(`Weekly crawl: none finished this week${e.start_error?`: ${v0(e.start_error)}`:`.`} It tries again each hour.`):n-e.added_at>u0?i.push(`Weekly crawl: the first crawl has not finished, ${g0(Math.floor((n-e.added_at)/u0),`day`)} after the site was added.`):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 ${h0(c.previous)}`:e===0?`level with`:`${e>0?`up`:`down`} ${Math.abs(e)}% on`;i.push(`Search clicks: ${h0(c.clicks)} (${d0(c.start,c.end)}), ${t}${e===null?``:` ${h0(c.previous)}`} the 7 days before.`)}else i.push(`Search clicks: not available this week.`);let l=e.not_brand;return c&&l&&i.push(`Not brand: ${h0(l.clicks)} clicks, ${w0(l.clicks,l.previous)} the 7 days before (${Oq[l.by]}).`),i}function w0(e,t){if(t<=0)return`from ${h0(t)}`;let n=Math.round((e-t)/t*100);return n===0?`level with ${h0(t)}`:`${n>0?`up`:`down`} ${Math.abs(n)}% on ${h0(t)}`}function T0(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?`${h0(n.clicks)} clicks from ${h0(n.previous)}`:i===0?`clicks level at ${h0(n.clicks)}`:`clicks ${i>0?`up`:`down`} ${Math.abs(i)}% (${h0(n.clicks)} from ${h0(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],s=n.non_brand,c=s?`; not brand ${h0(s.clicks)} clicks, ${w0(s.clicks,s.previous)} (${Oq[s.by]})`:``;return`- Google update: the ${e.name}, ${a} over the ${n.days} days from its start against the ${n.days} before, ${o}${c} (timing only, not cause).`})}function E0(e){let t=e.opportunities;if(!t)return[];let n=t.competitors.length?` (${g0(t.competitors.length,`competitor`)} checked)`:``;if(t.blocked&&!t.items.length)return[`- Competitor opportunities: ${v0(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: ${g0(t.items.length,`keyword`)} cleared every check${n}.${r}`,...t.items.map(e=>{let t=_0(e.competitors.map(e=>`${e.domain} (#${e.position})`)),n=e.kind===`tool`;return` - "${e.keyword}"${n?`, a free tool`:``}: ${h0(e.search_volume)} searches a month, ${i(e.cpc)} CPC, ${e.intent} intent. Top 10 for ${t}.${n?` The best tool page ranks for ${g0(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 D0={chatgpt:`ChatGPT search`,gemini:`Gemini`,google_ai_mode:`Google AI Mode`,google_ai_overview:`AI Overviews`},O0=e=>{let t=e.replace(/\s+/g,` `).trim();return`"${t.length>100?`${t.slice(0,99).trimEnd()}…`:t}"`};function k0(e){let t=e;try{let{hostname:n,pathname:r,search:i}=new URL(e);t=r===`/`&&!i?n.replace(/^www\./,``):decodeURI(r+i)}catch{}return`[${(t.length>60?`${t.slice(0,59)}…`:t).replace(/[[\]]/g,``)}](${e.replace(/[()\s]/g,e=>`%${e.charCodeAt(0).toString(16).padStart(2,`0`)}`)})`}function A0(e){let t=e.ai_answers;if(!t)return[];if(t.blocked)return[`- AI answers: ${v0(t.blocked)}`];if(!t.checked_at)return[];let n=e=>f0(new Date(e).toISOString().slice(0,10)),{counts:r}=t,i=Object.values(r).reduce((e,t)=>e+t,0),a=[r.unavailable?`${h0(r.unavailable)} unavailable`:``,r.pending?`${h0(r.pending)} not ready yet`:``].filter(Boolean),o=_0(Object.values(D0)),s=[`- AI answers, checked ${n(t.checked_at)}: ${t.pinned?`${g0(t.questions.length,`pinned question`)} from the business context`:`${g0(t.questions.length,`Search Console question`)}${t.fixed_at?` (fixed on ${n(t.fixed_at)})`:``}`} asked in ${o}. Cited in ${h0(r.cited)} of ${g0(i,`answer`)}, mentioned by name in ${h0(r.mentioned)}, neither in ${h0(r.neither)}, no AI answer shown in ${h0(r.no_answer)}${a.length?`, ${_0(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=>` - ${O0(e.question)} in ${D0[e.engine]??e.engine}: ${i(e.from)}, now ${i(e.to)}${e.cited_url?` (${e.cited_url})`:``}.`),...t.changes.length>e.length?[` - And ${g0(t.changes.length-e.length,`more`)}.`]:[])}else s.push(` - The first check of these questions, so there is nothing to compare yet.`);if(t.share_of_voice?.length&&s.push(` - Share of voice (answers that cite or name each): ${t.share_of_voice.map(e=>`${e.domain} in ${h0(e.cited+e.mentioned)} of ${h0(e.read)} (cited ${h0(e.cited)})`).join(`, `)}.`),t.cited_sites.length){let e=t.cited_sites.slice(0,5);s.push(` - Sites cited instead, by how many answers cite each:`,...e.map(e=>{let t=e.urls??[],n=(e.pages??t.length)-t.length;return` - ${e.host} (${e.answers})${t.length?`: ${_0([...t.map(k0),...n>0?[g0(n,`more page`)]:[]])}`:``}.`}),...t.cited_sites.length>e.length?[` - And ${g0(t.cited_sites.length-e.length,`more site`)}.`]:[])}return 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 j0(e){let t=e.ai_visits;if(!t)return[];let n=t.by_source.filter(e=>e.sessions).slice(0,5).map(e=>`${e.source} ${h0(e.sessions)}`);return[`- Visits from AI assistants (Google Analytics sessions): ${h0(t.sessions)}, was ${h0(t.previous)} the week before${n.length?` (${n.join(`, `)})`:``}. Only visits that pass a referrer or utm_source count.`]}function M0(e){let t=e.work;if(!t?.live.total&&!t?.waiting.total)return[];let n=(e,t)=>{let n=e.subject.replace(/https?:\/\/[^\s/]+/g,``)||`/`,r=e.note?/^https?:\/\/\S+$/.test(e.note)?`, ${k0(e.note)}`:` (${e.note})`:``;return`${n}, ${t} ${f0(e.on)}${r}`},r=(e,t,r)=>e.total?[` - ${t}:`,...e.items.map(e=>` - ${n(e,r)}.`),...e.total>e.items.length?[` - And ${g0(e.total-e.items.length,`more`)} in the issues list.`]:[]]:[];return[`- Your agent's changes: ${g0(t.live.total,`fix`,`fixes`)} marked live this week, ${g0(t.waiting.total,`change`)} waiting for your review.`,...r(t.live,`Marked live`,`live`),...r(t.waiting,`Waiting for review`,`since`)]}function N0(e){let t=e.measured;if(!t?.total)return[];let n=t.total-t.items.length;return[`- After fixes: ${g0(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 ${f0(e.fixed_on)}: ${g0(e.after.clicks,`click`)} (${n>0?`up`:n<0?`down`:`level`}${n?` ${h0(Math.abs(n))}`:``} on ${h0(e.before.clicks)}), ${g0(e.after.impressions,`impression`)} (from ${h0(e.before.impressions)}).${e.updates?.length?` Google updates in these dates: ${_0(e.updates)}.`:``}`}),...n>0?[` - And ${g0(n,`more`)} in the issues list.`]:[]]}function P0(e){let t=Date.parse(`${e.start}T00:00:00Z`),n=Date.parse(`${e.end}T00:00:00Z`)+u0,r=`# ${p0(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)=>m0(e.property).localeCompare(m0(t.property))||e.property.localeCompare(t.property),a=e.sites.map(r=>({site:r,found:S0(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),c=a.filter(e=>e.site.unread);a.sort((e,t)=>(e.found[0]?.rank??1/0)-(t.found[0]?.rank??1/0)||i(e.site,t.site));let l=a.length,u=[r,``,o.length?l===1?`Your site had changes worth a look this week.`:`${o.length} of your ${l} sites had changes worth a look this week.`:s.length?l===1?`Your site had a quiet week.`:s.length===l?`All ${l} of your sites had a quiet week.`:`${s.length} of your ${l} sites had a quiet week.`:c.length?l===1?`Your site's results could not be read this week.`:`${c.length} of your ${l} sites could not be read this week.`:`Your sites are still on their first checks.`];for(let{site:r,found:i}of a)u.push(``,`## ${m0(r.property)}${i.length?`: ${_0(i.map(e=>e.heading))}`:``}`,``,...C0(r,t,n,e.first).map(e=>`- ${e}`),...E0(r),...A0(r),...j0(r),...M0(r),...N0(r),...T0(r),...r.link?[`- [View site](${r.link})`]:[]);return u.join(`
|
|
544
|
+
`),data:{range:n,comparisonRange:r,rule:n0,lostPages:l.length,index:_.data,pages:v,indexing:E}}}const a0={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`,"ai-queries":`ai-queries`,"image-search":`image-search`,bing:`bing-comparison`,issues:`site-issues`,"google-updates":`google-updates`,progress:`seo-progress`,teardown:`teardown`,"weekly-audit":`weekly-audit`},o0={keyword_metrics:`keyword-metrics`,ranked_keywords:`ranked-keywords`,serp:`serp-results`,competitors:`serp-competitors`,backlinks:`link-evidence`,link_gap:`link-gap`,ai_answers:`ai-answers`,top_pages:`top-pages`,pages_by_backlinks:`pages-by-backlinks`,keyword_ideas:`keyword-ideas`,serp_overlap:`serp-overlap`,index_check:`index-check`,mentions:`brand-mentions`,outlines:`serp-outlines`,maps_grid:`maps-grid`,business_profile:`business-profile`};function s0(e,t={}){return e===`report`?a0[t.section||`overview`]??null:e===`research`?o0[t.action??``]??null:{next:`next-step`,page:`page-opportunities`,compare:`measure-change`,index:`link-recovery`,crawl:`site-crawl`,"internal-links":`internal-links`,lint:`copy-lint`}[e]??null}[...Ww];const c0={plan:F.union([F.literal(10),F.literal(50),F.literal(100),F.literal(200)]).optional().describe(`Optional. The usage plan to move to, in US dollars a month. Only after the person has said yes to that plan in this conversation: it charges their card.`),top_up:F.union([F.literal(10),F.literal(25),F.literal(50)]).optional().describe(`Optional. Buys a top-up of this many US dollars of usage, which never expires and is used after the plan's. Needs a plan. Only after the person has said yes: it charges their card.`),payment_token:F.string().regex(/^spt_\w+$/).optional().describe(`Optional, with top_up. A Stripe shared payment token (spt_...) from your wallet, such as Link's agent wallet, granted to the Stripe profile and amount a top-up result gave you. Pays the top-up with it instead of the saved card.`),auto_reload:F.object({amount:F.union([F.literal(10),F.literal(25),F.literal(50),F.null()]).describe(`The top-up to buy when top-ups run low, or null for off.`),cap:F.number().int().min(10).max(1e3).describe(`The most auto-reload may buy in a calendar month, in US dollars.`)}).optional().describe(`Optional. Turns auto-reload on or off. Only after the person has said yes to the amount and the monthly cap.`),cancel:F.boolean().optional().describe(`Optional. true cancels the plan at the end of this period; false undoes that, so it renews. Only when the person asks.`)};async function l0(e,t){let{topUp:n,autoReload:r,cancelPlan:i}=e,a=()=>new h(`INVALID_INPUT`,`Plans and usage change on the hosted server only. Connect https://seoskill.dev/mcp and call seo_sites there, or use https://seoskill.dev/account.`);if(t.top_up){if(!n)throw a();let e=await n(t.top_up,t.payment_token),r=t.payment_token?`your payment token`:`the saved card`;return{text:{added:`Added a $${t.top_up} top-up, paid with ${r}. It never expires and is used after the plan's usage.`,checkout:e.status===`checkout`?`Stripe needs the person to pay for this one. Give them this link for the $${t.top_up} top-up: ${e.url}${e.agentPay?`\nOr, if you have a Stripe wallet such as Link's agent wallet, ask it for a shared payment token for ${e.agentPay.amount} cents in USD, granted to Stripe profile ${e.agentPay.profile}, then call seo_sites with top_up ${t.top_up} and payment_token. The person approves it in their wallet.`:``}`:``,token_failed:e.status===`token_failed`?`Stripe refused the payment token, so no top-up was added (${e.reason}). Check it was granted for ${t.top_up*100} cents in USD and hasn't expired or been used, or give the person the top-up link instead.`:``}[e.status],data:e}}if(t.auto_reload){if(!r)throw a();let{amount:e,cap:n}=t.auto_reload;if(e!==null&&n<e)throw new h(`INVALID_INPUT`,`The monthly cap needs to be at least the $${e} top-up.`);return await r(e,n),{text:e===null?`Auto-reload is off.`:`Auto-reload is on: a $${e} top-up when top-ups run low, at most $${n} a month, on the saved card.`,data:t.auto_reload}}if(t.cancel!==void 0){if(!i)throw a();let e=await i(t.cancel);return{text:e?`The plan is cancelled. It and its usage last until ${e.slice(0,10)}, then nothing more is charged.`:`The plan renews as normal.`,data:{endsAt:e}}}if(t.plan){let n=e.choosePlan;if(!n)throw new h(`INVALID_INPUT`,`Plans change on the hosted server only. Connect https://seoskill.dev/mcp and call seo_sites with plan there, or pick a plan at https://seoskill.dev/account.`);let r=await n(t.plan),i={changed:`The account is on the $${t.plan} plan now. Stripe charged the saved card today, less what was left of the last plan, and this month's usage starts full.`,same:`The account is already on the $${t.plan} plan.`,scheduled:r.status===`scheduled`?`The account moves to the $${t.plan} plan on ${r.at.slice(0,10)}. It keeps its current plan and usage until then.`:``,checkout:r.status===`checkout`?`The first plan needs a card. Give the person this Stripe Checkout link for the $${t.plan} plan: ${r.url}\nLater plan changes need no link: call seo_sites with plan again and the saved card is charged.`:``,pending:`The payment went through and the plan is starting. Call seo_sites in a minute to see it.`,payment_failed:`Stripe couldn't take the payment, so the plan didn't change. The person can check their card under Manage billing at https://seoskill.dev/account.`},a=[`changed`,`same`,`scheduled`].includes(r.status);if(!t.add||!a){let e=t.add?`\nOnce the plan is on, call seo_sites with add ${t.add} again.`:``;return{text:`${i[r.status]}${e}`,data:r}}return`${i[r.status]}\n\n`}return``}const u0=864e5;function d0(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 f0=e=>(/* @__PURE__ */ new Date(`${e}T00:00:00Z`)).toLocaleString(`en-GB`,{day:`numeric`,month:`short`,timeZone:`UTC`}),p0=e=>`Your SEO Skill week${e.sites.length===1&&e.sites[0]?` for ${m0(e.sites[0].property)}`:``}, ${d0(e.start,e.end)}`,m0=e=>e.replace(/^sc-domain:|^https?:\/\//,``).replace(/\/$/,``),h0=e=>e.toLocaleString(`en-US`),g0=(e,t,n=`${t}s`)=>`${h0(e)} ${e===1?t:n}`,_0=e=>e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`,v0=e=>/[.!?]$/.test(e)?e:`${e}.`;function y0(e){try{let t=new URL(e);return`${t.pathname}${t.search}`}catch{return e}}function b0(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 x0=e=>{let t=e.clicks;return Math.round(Math.abs(t.clicks-t.previous)/t.previous*100)};function S0(e,t,n,r=!1){let i=[];e.index?.dropped&&i.push({rank:0,heading:`${g0(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`}):!a&&!e.unread&&n-e.added_at>u0&&i.push({rank:1,heading:`first crawl not finished`}),b0(e)===`fell`&&i.push({rank:2,heading:`clicks down ${x0(e)}%`}),o&&a.new_issues>0&&i.push({rank:3,heading:g0(a.new_issues,r?`open finding`:`new issue`)}),i}function C0(e,t,n,r=!1){if(e.unread)return[`Results: this site's checks could not be read for this summary, so its Google index, weekly crawl and search clicks are missing here, not zero. The next summary reads them again.`];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=>y0(e.url)),t=a.dropped-e.length,n=t>0?`${e.join(`, `)} and ${g0(t,`more`)}`:_0(e),r=new Set(a.dropped_pages.map(e=>e.coverage)),o=r.size===1?[...r][0]:null;i.push(`Google index: ${g0(a.dropped,`page`)} dropped out (${n}${o?`: ${o}`:``}).${a.returned?` ${g0(a.returned,`page`)} now indexed.`:``} ${g0(a.checked,`page`)} checked.`)}else i.push(`Google index: ${g0(a.checked,`page`)} checked, none dropped${a.returned?`, ${g0(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 ${g0(o.pages,`page`)}${o.error?`: ${v0(o.error)}`:`.`} It tries again next week.`);else if(s){let e=o.top_rule?OK[o.top_rule]:void 0;i.push(o.new_issues?`Weekly crawl: ${g0(o.pages,`page`)}, ${g0(o.new_issues,r?`open finding`:`new issue`)}${e?`, most of them ${e.charAt(0).toLowerCase()}${e.slice(1)}`:``}.`:`Weekly crawl: ${g0(o.pages,`page`)}, no new issues.`)}else e.added_at<t?i.push(`Weekly crawl: none finished this week${e.start_error?`: ${v0(e.start_error)}`:`.`} It tries again each hour.`):n-e.added_at>u0?i.push(`Weekly crawl: the first crawl has not finished, ${g0(Math.floor((n-e.added_at)/u0),`day`)} after the site was added.`):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 ${h0(c.previous)}`:e===0?`level with`:`${e>0?`up`:`down`} ${Math.abs(e)}% on`;i.push(`Search clicks: ${h0(c.clicks)} (${d0(c.start,c.end)}), ${t}${e===null?``:` ${h0(c.previous)}`} the 7 days before.`)}else i.push(`Search clicks: not available this week.`);let l=e.not_brand;return c&&l&&i.push(`Not brand: ${h0(l.clicks)} clicks, ${w0(l.clicks,l.previous)} the 7 days before (${Oq[l.by]}).`),i}function w0(e,t){if(t<=0)return`from ${h0(t)}`;let n=Math.round((e-t)/t*100);return n===0?`level with ${h0(t)}`:`${n>0?`up`:`down`} ${Math.abs(n)}% on ${h0(t)}`}function T0(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?`${h0(n.clicks)} clicks from ${h0(n.previous)}`:i===0?`clicks level at ${h0(n.clicks)}`:`clicks ${i>0?`up`:`down`} ${Math.abs(i)}% (${h0(n.clicks)} from ${h0(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],s=n.non_brand,c=s?`; not brand ${h0(s.clicks)} clicks, ${w0(s.clicks,s.previous)} (${Oq[s.by]})`:``;return`- Google update: the ${e.name}, ${a} over the ${n.days} days from its start against the ${n.days} before, ${o}${c} (timing only, not cause).`})}function E0(e){let t=e.opportunities;if(!t)return[];let n=t.competitors.length?` (${g0(t.competitors.length,`competitor`)} checked)`:``;if(t.blocked&&!t.items.length)return[`- Competitor opportunities: ${v0(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: ${g0(t.items.length,`keyword`)} cleared every check${n}.${r}`,...t.items.map(e=>{let t=_0(e.competitors.map(e=>`${e.domain} (#${e.position})`)),n=e.kind===`tool`;return` - "${e.keyword}"${n?`, a free tool`:``}: ${h0(e.search_volume)} searches a month, ${i(e.cpc)} CPC, ${e.intent} intent. Top 10 for ${t}.${n?` The best tool page ranks for ${g0(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 D0={chatgpt:`ChatGPT search`,gemini:`Gemini`,google_ai_mode:`Google AI Mode`,google_ai_overview:`AI Overviews`},O0=e=>{let t=e.replace(/\s+/g,` `).trim();return`"${t.length>100?`${t.slice(0,99).trimEnd()}…`:t}"`};function k0(e){let t=e;try{let{hostname:n,pathname:r,search:i}=new URL(e);t=r===`/`&&!i?n.replace(/^www\./,``):decodeURI(r+i)}catch{}return`[${(t.length>60?`${t.slice(0,59)}…`:t).replace(/[[\]]/g,``)}](${e.replace(/[()\s]/g,e=>`%${e.charCodeAt(0).toString(16).padStart(2,`0`)}`)})`}function A0(e){let t=e.ai_answers;if(!t)return[];if(t.blocked)return[`- AI answers: ${v0(t.blocked)}`];if(!t.checked_at)return[];let n=e=>f0(new Date(e).toISOString().slice(0,10)),{counts:r}=t,i=Object.values(r).reduce((e,t)=>e+t,0),a=[r.unavailable?`${h0(r.unavailable)} unavailable`:``,r.pending?`${h0(r.pending)} not ready yet`:``].filter(Boolean),o=_0(Object.values(D0)),s=[`- AI answers, checked ${n(t.checked_at)}: ${t.pinned?`${g0(t.questions.length,`pinned question`)} from the business context`:`${g0(t.questions.length,`Search Console question`)}${t.fixed_at?` (fixed on ${n(t.fixed_at)})`:``}`} asked in ${o}. Cited in ${h0(r.cited)} of ${g0(i,`answer`)}, mentioned by name in ${h0(r.mentioned)}, neither in ${h0(r.neither)}, no AI answer shown in ${h0(r.no_answer)}${a.length?`, ${_0(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=>` - ${O0(e.question)} in ${D0[e.engine]??e.engine}: ${i(e.from)}, now ${i(e.to)}${e.cited_url?` (${e.cited_url})`:``}.`),...t.changes.length>e.length?[` - And ${g0(t.changes.length-e.length,`more`)}.`]:[])}else s.push(` - The first check of these questions, so there is nothing to compare yet.`);if(t.share_of_voice?.length&&s.push(` - Share of voice (answers that cite or name each): ${t.share_of_voice.map(e=>`${e.domain} in ${h0(e.cited+e.mentioned)} of ${h0(e.read)} (cited ${h0(e.cited)})`).join(`, `)}.`),t.cited_sites.length){let e=t.cited_sites.slice(0,5);s.push(` - Sites cited instead, by how many answers cite each:`,...e.map(e=>{let t=e.urls??[],n=(e.pages??t.length)-t.length;return` - ${e.host} (${e.answers})${t.length?`: ${_0([...t.map(k0),...n>0?[g0(n,`more page`)]:[]])}`:``}.`}),...t.cited_sites.length>e.length?[` - And ${g0(t.cited_sites.length-e.length,`more site`)}.`]:[])}return 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 j0(e){let t=e.ai_visits;if(!t)return[];let n=t.by_source.filter(e=>e.sessions).slice(0,5).map(e=>`${e.source} ${h0(e.sessions)}`);return[`- Visits from AI assistants (Google Analytics sessions): ${h0(t.sessions)}, was ${h0(t.previous)} the week before${n.length?` (${n.join(`, `)})`:``}. Only visits that pass a referrer or utm_source count.`]}function M0(e){let t=e.work;if(!t?.live.total&&!t?.waiting.total)return[];let n=(e,t)=>{let n=e.subject.replace(/https?:\/\/[^\s/]+/g,``)||`/`,r=e.note?/^https?:\/\/\S+$/.test(e.note)?`, ${k0(e.note)}`:` (${e.note})`:``;return`${n}, ${t} ${f0(e.on)}${r}`},r=(e,t,r)=>e.total?[` - ${t}:`,...e.items.map(e=>` - ${n(e,r)}.`),...e.total>e.items.length?[` - And ${g0(e.total-e.items.length,`more`)} in the issues list.`]:[]]:[];return[`- Your agent's changes: ${g0(t.live.total,`fix`,`fixes`)} marked live this week, ${g0(t.waiting.total,`change`)} waiting for your review.`,...r(t.live,`Marked live`,`live`),...r(t.waiting,`Waiting for review`,`since`)]}function N0(e){let t=e.measured;if(!t?.total)return[];let n=t.total-t.items.length;return[`- After fixes: ${g0(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 ${f0(e.fixed_on)}: ${g0(e.after.clicks,`click`)} (${n>0?`up`:n<0?`down`:`level`}${n?` ${h0(Math.abs(n))}`:``} on ${h0(e.before.clicks)}), ${g0(e.after.impressions,`impression`)} (from ${h0(e.before.impressions)}).${e.updates?.length?` Google updates in these dates: ${_0(e.updates)}.`:``}`}),...n>0?[` - And ${g0(n,`more`)} in the issues list.`]:[]]}function P0(e){let t=Date.parse(`${e.start}T00:00:00Z`),n=Date.parse(`${e.end}T00:00:00Z`)+u0,r=`# ${p0(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)=>m0(e.property).localeCompare(m0(t.property))||e.property.localeCompare(t.property),a=e.sites.map(r=>({site:r,found:S0(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),c=a.filter(e=>e.site.unread);a.sort((e,t)=>(e.found[0]?.rank??1/0)-(t.found[0]?.rank??1/0)||i(e.site,t.site));let l=a.length,u=[r,``,o.length?l===1?`Your site had changes worth a look this week.`:`${o.length} of your ${l} sites had changes worth a look this week.`:s.length?l===1?`Your site had a quiet week.`:s.length===l?`All ${l} of your sites had a quiet week.`:`${s.length} of your ${l} sites had a quiet week.`:c.length?l===1?`Your site's results could not be read this week.`:`${c.length} of your ${l} sites could not be read this week.`:`Your sites are still on their first checks.`];for(let{site:r,found:i}of a)u.push(``,`## ${m0(r.property)}${i.length?`: ${_0(i.map(e=>e.heading))}`:``}`,``,...C0(r,t,n,e.first).map(e=>`- ${e}`),...E0(r),...A0(r),...j0(r),...M0(r),...N0(r),...T0(r),...r.link?[`- [View site](${r.link})`]:[]);return u.join(`
|
|
545
545
|
`)}async function F0(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 h(`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`)+u0,a=e=>S0(e,r,i)[0]?.rank??1/0,o=[...n.sites].sort((e,t)=>a(e)-a(t)||m0(e.property).localeCompare(m0(t.property)))[0],s=o?m0(o.property):`<site>`;return{text:`${P0(n)}\n\nFull report on one site: ${e.call(`report`,{site:s})}`,data:n}}const I0=F.string().min(1).describe(`Search Console property or site, such as sc-domain:example.com, https://example.com/ or example.com.`),L0={start_date:F.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:F.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe(`YYYY-MM-DD. Optional.`)},R0={detail:F.enum([`summary`,`rows`,`full`]).default(`summary`).describe(`summary first. rows: the next page of rows. full: every field as JSON.`),offset:F.number().int().min(0).default(0).describe(`rows only: the first row to return.`)},z0={mark:F.enum(ZJ).optional().describe(`Optional, with site and issues or suggestion: started when a pull request with the change waits for review (note: its URL), fixed (or done) once the change is live, dismissed when the person decides against it or it conflicts with the project's own rules or plan documents, superseded when the person chose another way to do it, or open to undo. dismissed and superseded need note, and are not suggested again for the site. ignored is the old name for dismissed.`),issues:F.string().min(1).optional().describe(`With mark: issue ids from the issues section, comma-separated.`),suggestion:F.string().min(1).max(300).optional().describe(`Optional, with mark instead of issues. An idea of your own that has no issue id, such as a search for a new page, a competitor gap or a link target, to track or dismiss for this site. Use the same text each time, such as the search or the URL.`),note:F.string().max(300).optional().describe(`With mark dismissed or superseded, the reason in the person’s words, such as the project rule it breaks or what replaced it. Optional with the other marks, or the pull request URL for started.`),fixed_on:F.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe(`Optional, with mark fixed: the day the change went live, YYYY-MM-DD, such as the day its pull request merged, when that was before today. Results are measured from it.`),saved:F.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.`)};function B0(e){return{readOnlyHint:!e.writes,destructiveHint:e.writes===`destructive`,...e.writes?{idempotentHint:!1}:{},openWorldHint:!0}}function V0(e){return e}const H0=async e=>ba({accounts:await e.accounts(),keys:await e.keys(),clicky:Iq(await e.keys()).map(Lq),simpleAnalytics:!!$i(await e.keys()),signIn:e.signIn,bing:e.deps.bing?await e.deps.bing():void 0,connect:e.connect,usage:e.deps.usage?await e.deps.usage().catch(()=>null):void 0}),U0=[V0({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 link to give the person: a Stripe Checkout link, after which the audit starts once they pay, or their account page to pick a plan, after which you add the site again. With plan: moves the account to that usage plan. With a plan already and a saved card it's charged at once, with no link (a lower plan starts at the next reset); the first plan returns a Stripe Checkout link to give the person. With top_up, auto_reload or cancel: does what the account page's Plan tab does, on the saved card, so the person never needs the page.`,writes:`destructive`,input:F.object({add:I0.optional().describe(`Optional. A site to add to the weekly site audit. Only when the person asks for it: a site can cost money.`),...c0}),run:async(e,t)=>{let n=await l0(e.deps,t);if(typeof n!=`string`)return n;if(!t.add)return H0(e);let r=e.deps.startAudit;if(!r)throw new h(`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 i=await e.resolveSite(t.add),a=await r(i);return{text:`${n}${{added:`Added ${i} to the weekly site audit. Its first crawl and index checks have started; ask ${e.deps.call(`report`,{site:i,section:DK})} for the findings once the crawl is done.`,exists:`${i} 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:a.status===`checkout`?`${i} needs a plan: $${a.price} a month per site, cancel at any time. Give the person this Stripe Checkout link to open and pay: ${a.url}\nThe audit of ${i} starts once they pay. Call seo_sites with add again afterwards to confirm.`:``,plan:a.status===`plan`?`${i} needs a plan. Plans start at $${a.price} a month for the whole account, with unlimited sites and research usage included. Ask the person whether to start on the $${a.price} plan. If they say yes, call seo_sites with plan ${a.price} and add ${i}, and give them the Stripe link it returns. They can also pick a plan at ${a.url}.`:``,full:a.status===`full`?`This account already audits ${a.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 ${i} was not added. The person can check their card under Manage billing on the account page.`}[a.status]}`,data:{property:i,...a}}}}),V0({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, then comparison searches such as vs and alternatives) 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; jobs on a page changed in the last 28 days come last, with the day it changed), then find new pages for buying searches and earn links. 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.`,writes:`destructive`,input:F.object({site:I0,context:F.string().max(Ie).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:z0.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.`),autopilot:F.boolean().optional().describe(`Optional. true returns the steps to put the site on autopilot, a scheduled run of the agent, with the prompt each run starts with, instead of the due step. Only after the person has said yes.`)}),run:async(e,t)=>fQ({site:await e.resolveSite(t.site),context:t.context,saved:t.saved,autopilot:t.autopilot,researchKey:await e.keys().then(e=>!x(e)&&(e.has(`x-dataforseo-login`)||e.has(`x-ahrefs-key`)))},e.deps)}),V0({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(lZ).map(([e,t])=>`- ${e}: ${t}`).join(`
|
|
546
546
|
`)}\nWith site, mark and issues (or one suggestion of your own): records what happened to them (started, fixed, dismissed or superseded with the reason, or open to undo) and runs no checks. Dismissed and superseded ones are not suggested again for the site.`,writes:!0,input:F.object({site:I0.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:F.enum(cZ).optional().describe(`Optional, needs site. Leave it out first; then ask for one section.`),...L0,...R0,...z0}),run:async(e,t)=>{if(!t.site){if(t.section)throw new h(`INVALID_INPUT`,`section needs a site: ${e.deps.call(`report`,{site:`<site>`,section:t.section})}.`);if(t.mark||t.issues||t.suggestion)throw new h(`INVALID_INPUT`,`mark needs a site: ${e.deps.call(`report`,{site:`<site>`,mark:t.mark??`fixed`,issues:t.issues??`<id>`})}.`);return F0(e.deps,()=>H0(e))}let n=t.site;if(t.mark||t.issues||t.suggestion)return DZ({site:await e.resolveSite(n),section:t.section,mark:t.mark,issues:t.issues?.split(`,`),suggestion:t.suggestion,note:t.note,fixedOn:t.fixed_on,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 OZ({site:n,startDate:t.start_date,endDate:t.end_date},e.deps).catch(()=>{throw r});if(r instanceof Error&&t.section===`teardown`)return bX(n,r.message,e.deps.call);if(r instanceof Error&&t.section!==`bing`)throw r;return DZ({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)}}),V0({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, the page’s Search Console queries against the previous period, and Core Web Vitals from Chrome UX Report (real Chrome users on phones) where this server has a key.`,input:F.object({url:F.url(),...L0,...R0}),run:async(e,t)=>K1({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)}),V0({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, brand against not brand by the saved brand names and by Google’s own classification, each market group saved in the business context, and Google updates in the window. Optional pages narrows it to URLs that contain that text, such as /blog/.`,input:F.object({site:I0,date:F.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe(`YYYY-MM-DD: the first day after the change.`),pages:F.string().min(1).optional().describe(`Optional URL text, such as /blog/.`)}),run:async(e,t)=>Q1({site:await e.resolveSite(t.site),date:t.date,pages:t.pages},e.deps,await e.keys())}),V0({name:`seo_index`,command:`index`,title:`Google indexing reasons and pages that lost their clicks`,description:`${r0} Use it for a first baseline and then weekly: keep the full result and compare by URL and reason to find new reasons. Also: ${n0}`,input:F.object({site:I0,...L0,...R0}),localInput:F.object({site:I0,...L0,max_urls:F.number().int().min(1).max(DJ).optional().describe(`URLs to inspect with Google, 100 by default, up to the URL Inspection quota left today.`),...R0}),run:async(e,t)=>i0({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)}),V0({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: ${b1}`,input:F.object({action:F.enum(y1),site:F.string().min(1).max(300).optional().describe(`indexnow_key: the host or a URL on it, such as example.com.`),urls:F.array(F.string().min(1).max(2048)).max(2e3).optional().describe(`indexnow and indexmysite: full page URLs. indexnow takes one host per call.`),key:F.string().max(128).optional().describe(`indexnow_key and indexnow, optional: an IndexNow key the site already serves at /<key>.txt.`),fast:F.boolean().optional().describe(`indexmysite, optional: faster Google indexing, 1 more credit per URL, not returned. Only when the person asks.`),bing:F.boolean().optional().describe(`indexmysite, optional: also send each URL to Bing, 1 more credit per URL, not returned. Only when the person asks.`),name:F.string().max(120).optional().describe(`indexmysite, optional: a label for the job.`),job_id:F.string().min(1).max(100).optional().describe(`indexmysite_status and indexmysite_approve: the job id.`),url_ids:F.array(F.string().min(1).max(100)).max(2e3).optional().describe(`indexmysite_approve: the url_id of each URL the person chose.`),all:F.boolean().optional().describe(`indexmysite_approve: every URL waiting for approval, only when the person chose all of them.`),confirm:F.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)=>E1({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)}),V0({name:`seo_research`,command:`research`,title:`Keyword, competitor, backlink and AI answer data`,description:`Data from DataForSEO or Ahrefs. On the hosted server it runs on the account’s plan usage, or on the person’s own DataForSEO or Ahrefs key when they saved one on their seoskill.dev account; the CLI and the local MCP server use a key saved on this machine. Each call uses plan usage or the provider’s credits. serp or ai_answers with a site as target and no keywords checks the tracked searches or AI questions in the site's business context and keeps the result in its progress. 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; with related true, DataForSEO only, the searches Google shows as related to each seed, two steps out, instead: other words for the same need and rival product names that never contain the seed, at the same price), ranked_keywords (target: keywords a site, subfolder or page ranks for, with the provider's traffic total for the whole target; with ai_overview true, DataForSEO only, the searches whose Google AI Overview cites the target instead, each with the cited page, the passage Google shows, the target's place among the sources and search volume, at the same price; with history true, DataForSEO only, the target's estimated traffic and ranking searches for each of the last 24 months instead, about $0.14. result featured_snippet or local_pack, DataForSEO only, reads the searches where the target holds the featured snippet or sits in the local pack instead, at the same price. sort is traffic (default), volume or position. max_position and min_volume filter on DataForSEO's side, before the rows are paid for, and the totals follow the filters. Every row has brand true or false, matched on brand, else the business context's brand names, else the domain name; non_brand true leaves brand searches out on DataForSEO's side, so every row read and the totals are non-brand. The JSON's sections groups the rows read by subdomain and first folder, with pages, searches and traffic in each), 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, the People Also Ask questions and the local pack's businesses with their Google rating and reviews; 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), outlines (keywords, up to 5: the H1 to H3 headings and word count of each keyword's top 5 organic pages, read live, for a content brief. On DataForSEO each keyword is one Google search on its queue, about $0.0012 a keyword, which follows Google's redirect links to the real pages. That usually takes one to two minutes, so a call returns what is ready and says which searches are still waiting; call again with the same keywords to read the rest at no cost. With provider ahrefs the pages come from Ahrefs' last record of each results page and are read at once. device desktop or mobile, DataForSEO only), maps_grid (DataForSEO only; one keyword, location the grid's centre as "latitude,longitude", usually the business's address, and target the business's domain or "cid:<Google business ID>": one Google Maps search at each point of a grid, grid 3 (9 points, default) or 5 (25), spacing_km apart, default 2, on mobile unless device desktop. Returns the business's rank at each point as a map, how often it is in the top 3, and the businesses that rank most across the grid with their category, rating and reviews. The searches run on DataForSEO's queue, about $0.0006 each, so about $0.005 for 3 and $0.015 for 5, and take one to five minutes: call again with the same input to read the rest at no cost, also with another target), business_profile (DataForSEO only; target the business as "cid:<id>" from serp or maps_grid, "place_id:<id>", or its name as Google shows it with location its town, and up to 3 competitors the same way: each one's Google Business Profile, whether it is claimed, its primary and other categories, rating, reviews, photos, hours, website and description, then what the business's profile lacks next to the competitors in the order to fix it: claim, categories, reviews, then the rest. The owner makes these edits at business.google.com, not on the website. About $0.0054 a profile, kept for a day), 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. 11 to 1,000 keywords, DataForSEO only: groups them into clusters, each one page to build, from the real pages in each keyword's top 10 Google results; pass them by search volume, highest first, and add a site as target to judge each cluster against its business context. The searches run on DataForSEO's queue, about $0.0012 a keyword, and take a few minutes: call again with the same keywords to read the clusters at no cost. Each cluster gets Jev's intent and page type labels where TypeSafe is set up), 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; when the target is one of the person's sites, the competitors in its business context come first, with in_context true. With keywords instead, up to 20, DataForSEO only: the sites ranking across those searches, most visible first, with how many each ranks for and its best position in each, the real rivals for a topic where shared keywords also pull in sites that rank for everything; a target there is left out of the rows, and its business context's competitors still come first. About $0.025), backlinks (target: referring domains; with anchors true, DataForSEO only, the link text other sites use for it with referring domains and when each was first seen, link sellers' anchors marked, about $0.03; with history true, DataForSEO only, a domain's referring domains and backlinks at the end of each of the last 24 months instead, with the domains gained and lost each month, about $0.025), pages_by_backlinks (target: the pages with the most referring domains), link_gap (target and 2 to 5 competitors, or none to use the first 5 in the target's business context: 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). With pages true, backlinks and link_gap (DataForSEO only) return linking pages instead of domains: each page's title, the words around the link, how many competitors it links and a guessed context (listicle, review, directory, forum and so on), with spam left out, from one call of up to 1,000 pages, about $0.03 to $0.06; use them to find link and listicle targets. 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 30 questions in keywords it asks those instead (more than 10 only when the person chooses to pay for them; questions times samples at most 100), 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. Asking the same questions again the same day (UTC) reads that run back at no cost too; refresh true asks again and pays. samples (1 to 5) asks each question that many times and reports how often the answers cite or name the site, a rate instead of one sample; each sample costs a full run. It asks ChatGPT search, the Gemini app, Google AI Mode and Google AI Overviews each one and says whether the answer cites or mentions the site. When the target is one of the person's sites, the competitors in its business context are judged on the same answers at no extra cost: each row lists the ones it cites or names, and the notes give share of voice. 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. Gemini, AI Mode and AI Overviews do not report their searches. DataForSEO’s queue prices are about $0.0096 a question across the four engines, so about $0.10 a run of 10 and $0.29 a run of 30 (on SEO Skill's usage about $0.125 and $0.37): tell the person before running it. With up to 3 competitors and the site as target, it instead reads DataForSEO's LLM mentions database for ChatGPT and AI Overviews and ranks the pages cited by buyer answers that name a competitor, the pages to get the site onto; about $0.35 a site, tell the person first. With counts true and the site as target, it instead counts the answers in that database that cite the site and up to 4 competitors, default the business context's, on ChatGPT and AI Overviews, with each one's share and the sites cited beside each: database counts, never added to or compared with the live answers; about $0.20). Rows with a domain, and the target, get a free Ahrefs domain_rating column. Numbers are provider estimates, not Search Console data.`,input:F.object({provider:F.string().max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).optional().describe(`${X$.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:F.enum(Y$),keywords:F.array(F.string().min(1)).max(1e3).default([]),target:F.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:F.enum(j).optional().describe(`Optional: domain, prefix or exact, to read the target another way than its shape says.`),...NZ,tasks:F.array(F.string().regex(ae)).max(30*n*5).default([]).describe(`ai_answers only: the tasks an earlier run returned as not ready, to read back at no cost.`),also:F.array(F.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:F.array(F.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. ranked_keywords: the names that make a search a brand search, such as Hevy for hevyapp.com. Default: the business context's brand names, else the domain name.`),samples:F.number().int().min(1).max(5).optional().describe(`ai_answers only: how many times to ask each question, to report how often answers cite or name the site. Each sample costs a full run.`),refresh:F.boolean().default(!1).describe(`ai_answers only: ask again and pay, instead of reading back the run of the same questions from earlier today.`),country:F.string().regex(/^[a-z]{2}$/).default(`us`).describe(`Two-letter country code.`),...t1,...R0}),run:async(e,t)=>{let n=e=>`seo_research with the same input, detail "rows", offset ${e}`,r=await Ge(t,e);if(r)return r;if(Je(t)){if(t.provider&&t.provider!==`dataforseo`)throw new h(`INVALID_INPUT`,`ai_answers uses dataforseo.`);return de({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,store:e.researchStore,refresh:t.refresh,samples:t.samples,resolveSite:e.resolveSite},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 i=t.action===`keyword_metrics`&&!t.keywords.length&&t.target;return n1(i?{...t,target:await e.resolveSite(t.target)}:t,await e.keys(),{searchAnalytics:i?e.deps.searchAnalytics:void 0,drKey:e.drKey,...await RZ(t,e),store:e.researchStore,installedSerp:e.installedSerp,call:n,...await JQ(t,e)})}}),V0({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, Google News or multimodal (Google Lens and Circle to Search); brand narrows to Google’s own branded or non_branded searches, and the brandedClassification dimension splits by it; country and device take lists; 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; sort orders rows by impressions, ctr, position or a gain or loss instead of clicks, and min_impressions drops rows seen too rarely to judge. google_analytics: landing pages for visits from search, with Google Analytics’ own metric names. google_analytics_site_search: the terms people searched for on the site itself (view_search_results events), from every channel; terms with searches and no page that answers them are ideas for new pages. google_analytics_ai_referrals: sessions sent by AI assistants such as ChatGPT, Perplexity, Claude, Gemini and Copilot, by assistant and landing page with key events, as their own channel apart from Organic Search. 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:F.object({source:F.enum(Me).default(`search_console`),site:F.string().min(1).describe(`search_console and bing: the property or site. google_analytics, google_analytics_site_search and google_analytics_ai_referrals: numeric property id from seo_sites. clicky: the site or its Clicky site ID. simple_analytics: the site domain.`),dimensions:F.array(F.enum(he)).max(4).optional().describe(`search_console, default query (page for discover and google_news); bing uses the first, query or page.`),...ot,...L0,...R0}),run:async(e,t)=>t.source===`simple_analytics`?_a({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`?qq({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`?fq({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===`search_console`?Ct({site:await e.resolveSite(t.site),dimensions:t.dimensions,filters:jt({page:t.page,query:t.query,pageRegex:t.page_regex,queryRegex:t.query_regex,excludeQueryRegex:t.exclude_query_regex}),searchType:t.search_type,brand:t.brand,countries:t.country,devices:t.device,sort:t.sort,minImpressions:t.min_impressions,startDate:t.start_date,endDate:t.end_date,detail:t.detail,offset:t.offset},e.deps):CK({source:t.source,property:t.site,startDate:t.start_date,endDate:t.end_date,detail:t.detail,offset:t.offset},await SK(await e.accounts(),t.site,e.signIn),{signIn:e.signIn,call:e=>`seo_data with source "${t.source}", site "${t.site}", detail "rows", offset ${e}`})}),V0({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:F.object(ZY),localInput:F.object({...ZY,paths:F.array(F.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 $Y({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)))}}),sJ];function W0(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 GK({site:o,detail:s,offset:c,paged:t},u,n.deps.call)}}}U0.map(e=>e.name===`seo_index`?W0(e):e.name===`seo_report`?{...e,description:`${e.description}\n- ${DK}: What the weekly crawl of the site found (broken and redirected internal links, redirect chains and loops, missing, empty or duplicate titles and descriptions, missing H1s, slow pages, invalid JSON-LD, noindex for Google, canonicals to another page, sitemap URLs that do not return 200, thin pages, tags that JavaScript changes, a missing llms.txt, broken links in it and conversion pages it does not list, and broken Markdown copies of pages), with what is new, back or resolved since the crawl before. Only for sites in the weekly site audit.`,input:e.input.extend({section:F.enum([...cZ,DK]).optional().describe(`Optional. Leave it out first; then ask for one section.`)})}:e);async function G0(e,t,n,r=!1){let i=(r&&e.localInput||e.input).safeParse(n??{});if(!i.success)throw new h(`INVALID_INPUT`,i.error.issues.map(e=>`${e.path.join(`.`)||`input`}: ${e.message}`).join(`; `));return e.run(t,i.data)}const K0={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`]}]},q0=(e,t)=>{let n=`seo_${e.replace(`-`,`_`)}`;if(e===`submit`)return Y0(t??{});let r=Object.entries(t??{}).filter(([,e])=>e!==void 0);return r.length?`${n} with ${r.map(([e,t])=>`${e} ${typeof t==`string`?`"${t}"`:t}`).join(`, `)}`:n},J0={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 Y0(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 X0=6048e5;function Z0(e,t,n=Date.now()){let r=/* @__PURE__ */ new Map;try{let i=Cl().prepare(`SELECT status_json, fetched_at FROM url_inspection_cache
|
|
547
547
|
WHERE site_url = ? AND url = ? AND fetched_at > ?`);for(let a of t){let t=i.get(e,a,n-X0);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 Q0(e,t,n,r=Date.now()){let i=JSON.stringify(n);wl(n=>{n.prepare(`INSERT OR REPLACE INTO url_inspection_cache
|
|
@@ -584,4 +584,4 @@ if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid
|
|
|
584
584
|
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.
|
|
585
585
|
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});gie(t,{telemetry:e.telemetry===!1?void 0:n}),Lre(t);let r=_ie();if(r){let{name:e,uri:n,...i}=J0;t.registerResource(e,n,i,async e=>({contents:[{uri:e.href,mimeType:i.mimeType,text:r}]}))}return e.telemetry!==!1&&(t.server.oninitialized=()=>{ko(n())}),t}async function vie(e={}){let t=$9();if(e.test){process.stdout.write(`seo MCP server constructed successfully.
|
|
586
586
|
`);return}let n=new Ire;await t.connect(n),p6()}export{o2 as $,Zs as $n,uI as $t,g4 as A,Uw as An,Di as Ar,rK as At,V2 as B,Pl as Bn,rH as Bt,R4 as C,QO as Cn,Fo as Cr,oJ as Ct,x4 as D,WD as Dn,Na as Dr,SK as Dt,p4 as E,JD as En,eo as Er,fq as Et,q2 as F,zS as Fn,YH as Ft,D2 as G,Zc as Gn,Kz as Gt,R2 as H,Al as Hn,YB as Ht,G2 as I,RS as In,KH as It,S2 as J,$s as Jn,kL as Jt,E2 as K,Hc as Kn,Wz as Kt,K2 as L,KS as Ln,qH as Lt,l4 as M,bw as Mn,hi as Mr,nK as Mt,c4 as N,_w as Nn,Tr as Nr,tK as Nt,y4 as O,UE as On,Ma as Or,CK as Ot,H2 as P,LS as Pn,wr as Pr,GH as Pt,c2 as Q,Ys as Qn,NI as Qt,k2 as R,YS as Rn,WH as Rt,B4 as S,XO as Sn,jo as Sr,aJ as St,C4 as T,GO as Tn,$a as Tr,qq as Tt,C2 as U,Ol as Un,OB as Ut,B2 as V,Nl as Vn,RV as Vt,O2 as W,tl as Wn,Zz as Wt,b2 as X,ec as Xn,rL as Xt,x2 as Y,ic as Yn,AL as Yt,d2 as Z,Xs as Zn,tL as Zt,a3 as _,ZO as _n,po as _r,bX as _t,Y9 as a,hN as an,ps as ar,K1 as at,V4 as b,$O as bn,Mo as br,JJ as bt,u6 as c,bM as cn,Yo as cr,X$ as ct,G3 as d,eM as dn,vs as dr,MZ as dt,qF as en,tc as er,u2 as et,b3 as f,_j as fn,hs as fr,cZ as ft,i3 as g,Dj as gn,ko as gr,vX as gt,r3 as h,Ej as hn,Eo as hr,FX as ht,mie as i,aN as in,qo as ir,i0 as it,m4 as j,Dw as jn,di as jr,aK as jt,h4 as k,NE as kn,_a as kr,iK as kt,p6 as l,tM as ln,gs as lr,n1 as lt,u3 as m,xj as mn,yo as mr,DZ as mt,T9 as n,VN as nn,Ro as nr,s0 as nt,pie as o,iN as on,Ho as or,E1 as ot,p3 as p,Oj as pn,ms as pr,OZ as pt,_2 as q,Bc as qn,uz as qt,$9 as r,zN as rn,fs as rr,Q1 as rt,vie as s,TM as sn,_s as sr,Y$ as st,$re as t,lP as tn,rc as tr,F0 as tt,o6 as u,$j as un,ns as ur,fQ as ut,U4 as v,YO as vn,Do as vr,$Y as vt,M4 as w,KO as wn,to as wr,Fq as wt,z4 as x,tk as xn,No as xr,DJ as xt,H4 as y,ek as yn,Po as yr,ZJ as yt,A2 as z,iu as zn,DH as zt};
|
|
587
|
-
//# sourceMappingURL=dist-
|
|
587
|
+
//# sourceMappingURL=dist-BEpnqpvo.js.map
|