seo 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/dist/{dist-CzkHnL0G.js → dist-DbD33M0Y.js} +1 -1
- package/dist/{dist-B-aQj-Q6.js → dist-X-66Zivw.js} +2 -2
- package/dist/{dist-B-aQj-Q6.js.map → dist-X-66Zivw.js.map} +1 -1
- package/dist/{esm-X4uq3k2w.js → esm-BVLLXPWR.js} +2 -2
- package/dist/{esm-X4uq3k2w.js.map → esm-BVLLXPWR.js.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/mcp.js +1 -1
- package/package.json +2 -30
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 ee,D as p,Dn as te,Dr as m,Dt as h,E as ne,En as re,Er as ie,Et as ae,F as oe,Fn as se,Ft as ce,G as le,Gn as ue,Gt as de,H as fe,Hn as pe,Ht as me,I as he,In as ge,It as _e,J as ve,Jn as ye,Jt as be,K as xe,Kn as Se,Kt as Ce,L as we,Ln as Te,Lt as Ee,M as De,Mn as Oe,Mr as ke,Mt as Ae,N as je,Nn as Me,Nt as Ne,O as Pe,On as Fe,Or as g,P as Ie,Pn as Le,Pt as Re,Q as ze,Qn as Be,Qt as Ve,R as He,Rn as Ue,Rt as We,S as Ge,Sn as Ke,Sr as qe,St as Je,T as Ye,Tn as Xe,Tr as Ze,Tt as Qe,U as $e,Un as et,Ut as tt,V as nt,Vn as rt,Vt as it,W as at,Wn as ot,Wt as st,X as ct,Xn as lt,Xt as ut,Y as dt,Yn as ft,Yt as pt,Z as mt,Zn as ht,Zt as gt,_ as _t,_n as vt,_r as yt,_t as bt,a as xt,an as St,ar as Ct,at as wt,b as Tt,bn as Et,br as Dt,bt as Ot,c as kt,cn as At,cr as jt,ct as Mt,d as Nt,dn as Pt,dr as Ft,dt as It,en as Lt,er as Rt,et as zt,f as Bt,fn as Vt,fr as Ht,ft as Ut,g as Wt,gn as Gt,gr as Kt,gt as qt,h as Jt,hn as Yt,hr as Xt,ht as Zt,i as Qt,in as $t,ir as en,it as tn,j as nn,jn as rn,jr as an,jt as on,k as sn,kn as cn,kr as ln,kt as un,l as dn,ln as fn,lr as pn,lt as mn,m as hn,mn as gn,mr as _n,mt as vn,nn as yn,nr as bn,nt as xn,o as Sn,on as Cn,or as wn,ot as Tn,p as En,pn as Dn,pr as On,pt as kn,q as An,qn as jn,qt as Mn,rn as Nn,rr as Pn,rt as Fn,sn as In,sr as Ln,st as Rn,t as zn,tn as Bn,tr as Vn,tt as Hn,u as Un,un as Wn,ur as Gn,ut as Kn,v as qn,vn as Jn,vr as Yn,vt as Xn,w as Zn,wn as Qn,wr as $n,wt as er,x as tr,xn as nr,xr as rr,xt as ir,y as ar,yn as or,yr as sr,yt as cr,z as lr,zn as ur,zt as dr}from"./dist-B-aQj-Q6.js";import{randomBytes as fr}from"node:crypto";import{arch as pr,homedir as mr,platform as hr}from"node:os";import{basename as gr,dirname as _r,join as _,posix as vr,relative as yr,resolve as br,sep as xr,win32 as Sr}from"node:path";import{constants as Cr,copyFileSync as wr,createWriteStream as Tr,existsSync as v,mkdirSync as Er,readFileSync as Dr,readdirSync as Or,realpathSync as kr,renameSync as Ar,rmSync as jr,statSync as Mr,writeFileSync as Nr}from"node:fs";import{fileURLToPath as Pr}from"node:url";import{cp as Fr,mkdir as Ir,open as Lr,readFile as y,readdir as Rr,rename as zr,stat as Br,writeFile as Vr}from"node:fs/promises";import{isDeepStrictEqual as Hr,stripVTControlCharacters as Ur}from"node:util";import{spawn as Wr,spawnSync as Gr}from"node:child_process";import{defineCommand as b,runCommand as Kr,runMain as qr}from"citty";import{cancel as Jr,confirm as Yr,intro as Xr,isCancel as Zr,log as Qr,multiselect as $r,note as x,outro as S,password as ei,select as ti,text as ni}from"@clack/prompts";import ri from"picocolors";import ii from"string-width";import ai from"cli-table3";import{finished as oi}from"node:stream/promises";import{applyEdits as si,modify as ci,parse as li,printParseErrorCode as ui}from"jsonc-parser";import di from"update-notifier";const C={summary:/* @__PURE__ */ `workflow.site.generated_at.summary.attribution.confidence.classification.updates_matched.known_confounders.page_segment_status.page_segment_eligible_rows.page_segment_returned_rows.page_segment_limited_rows.page_segment_result_limit.page_segment_source_row_limit.page_segment_source_possibly_truncated.page_segment_warnings.query_segment_status.query_segment_eligible_rows.query_segment_returned_rows.query_segment_limited_rows.query_segment_result_limit.query_segment_source_row_limit.query_segment_source_possibly_truncated.query_segment_warnings.device_segment_status.device_segment_eligible_rows.device_segment_returned_rows.device_segment_limited_rows.device_segment_result_limit.device_segment_source_row_limit.device_segment_source_possibly_truncated.device_segment_warnings.country_segment_status.country_segment_eligible_rows.country_segment_returned_rows.country_segment_limited_rows.country_segment_result_limit.country_segment_source_row_limit.country_segment_source_possibly_truncated.country_segment_warnings`.split(`.`),steps:[`rank`,`tool`,`status`,`summary`],actions:[`rank`,`title`,`confidence`,`action`],findings:[`dimension`,`data_status`,`eligible_rows`,`returned_rows`,`limited_rows`,`result_limit`,`unmatched_rows`,`summary`,`winner_key`,`winner_click_delta`,`winner_impression_delta`,`winner_position_delta`,`loser_key`,`loser_click_delta`,`loser_impression_delta`,`loser_position_delta`],templates:[`rank`,`direction`,`template`,`confidence`,`url_count`,`click_delta`,`impression_delta`,`movement_share`,`movement_share_scope`,`confidence_scope`,`eligible_rows`,`returned_rows`,`limited_rows`,`result_limit`,`source_possibly_truncated`,`common_terms`,`sample_urls`,`summary`],evidence:[`rank`,`evidence`],confounders:[`rank`,`source`,`title`,`date`,`scope`,`target`,`description`],segment:[`rank`,`dimension`,`data_status`,`evidence_scope`,`key`,`before_clicks`,`after_clicks`,`click_delta`,`before_impressions`,`after_impressions`,`impression_delta`,`before_position`,`after_position`,`position_delta`],unmatchedSegment:[`rank`,`dimension`,`data_status`,`key`,`retained_in`,`clicks`,`impressions`,`position`,`reason`]};function fi(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 pi(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 mi(e){return[{filename:`postmortem-summary.csv`,headers:[...C.summary],rows:[{workflow:e.workflow,site:e.site,generated_at:e.generatedAt,summary:e.summary,attribution:e.output.update.attribution,confidence:e.output.update.confidence,classification:e.output.update.classification,updates_matched:e.output.update.overlappingUpdates.length,known_confounders:e.output.update.confounders.length,page_segment_status:e.output.segments.page.dataStatus,page_segment_eligible_rows:e.output.segments.page.coverage.eligibleRows,page_segment_returned_rows:e.output.segments.page.coverage.returnedRows,page_segment_limited_rows:e.output.segments.page.coverage.limitedRows,page_segment_result_limit:e.output.segments.page.coverage.resultLimit,page_segment_source_row_limit:e.output.segments.page.coverage.sourceRowLimit,page_segment_source_possibly_truncated:e.output.segments.page.coverage.sourcePossiblyTruncated,page_segment_warnings:e.output.segments.page.warnings.join(`; `),query_segment_status:e.output.segments.query.dataStatus,query_segment_eligible_rows:e.output.segments.query.coverage.eligibleRows,query_segment_returned_rows:e.output.segments.query.coverage.returnedRows,query_segment_limited_rows:e.output.segments.query.coverage.limitedRows,query_segment_result_limit:e.output.segments.query.coverage.resultLimit,query_segment_source_row_limit:e.output.segments.query.coverage.sourceRowLimit,query_segment_source_possibly_truncated:e.output.segments.query.coverage.sourcePossiblyTruncated,query_segment_warnings:e.output.segments.query.warnings.join(`; `),device_segment_status:e.output.segments.device.dataStatus,device_segment_eligible_rows:e.output.segments.device.coverage.eligibleRows,device_segment_returned_rows:e.output.segments.device.coverage.returnedRows,device_segment_limited_rows:e.output.segments.device.coverage.limitedRows,device_segment_result_limit:e.output.segments.device.coverage.resultLimit,device_segment_source_row_limit:e.output.segments.device.coverage.sourceRowLimit,device_segment_source_possibly_truncated:e.output.segments.device.coverage.sourcePossiblyTruncated,device_segment_warnings:e.output.segments.device.warnings.join(`; `),country_segment_status:e.output.segments.country.dataStatus,country_segment_eligible_rows:e.output.segments.country.coverage.eligibleRows,country_segment_returned_rows:e.output.segments.country.coverage.returnedRows,country_segment_limited_rows:e.output.segments.country.coverage.limitedRows,country_segment_result_limit:e.output.segments.country.coverage.resultLimit,country_segment_source_row_limit:e.output.segments.country.coverage.sourceRowLimit,country_segment_source_possibly_truncated:e.output.segments.country.coverage.sourcePossiblyTruncated,country_segment_warnings:e.output.segments.country.warnings.join(`; `)}]},{filename:`workflow-steps.csv`,headers:[...C.steps],rows:e.steps.map((e,t)=>({rank:t+1,tool:e.tool,status:e.status,summary:e.summary}))},{filename:`workflow-actions.csv`,headers:[...C.actions],rows:e.actions.map((e,t)=>({rank:t+1,title:e.title,confidence:e.confidence,action:e.action}))},{filename:`postmortem-findings.csv`,headers:[...C.findings],rows:e.output.insights.map(e=>({dimension:e.dimension,data_status:e.dataStatus,eligible_rows:e.coverage.eligibleRows,returned_rows:e.coverage.returnedRows,limited_rows:e.coverage.limitedRows,result_limit:e.coverage.resultLimit,unmatched_rows:e.unmatchedRows,summary:e.summary,winner_key:e.winner?.key,winner_click_delta:e.winner?.clickDelta,winner_impression_delta:e.winner?.impressionDelta,winner_position_delta:e.winner?.positionDelta,loser_key:e.loser?.key,loser_click_delta:e.loser?.clickDelta,loser_impression_delta:e.loser?.impressionDelta,loser_position_delta:e.loser?.positionDelta}))},{filename:`postmortem-template-movement.csv`,headers:[...C.templates],rows:e.output.templateMovement.map((e,t)=>({rank:t+1,direction:e.direction,template:e.signature,confidence:e.confidence,url_count:e.urlCount,click_delta:e.clickDelta,impression_delta:e.impressionDelta,movement_share:e.movementShare,movement_share_scope:e.movementShareScope,confidence_scope:e.confidenceScope,eligible_rows:e.segmentCoverage.eligibleRows,returned_rows:e.segmentCoverage.returnedRows,limited_rows:e.segmentCoverage.limitedRows,result_limit:e.segmentCoverage.resultLimit,source_possibly_truncated:e.segmentCoverage.sourcePossiblyTruncated,common_terms:e.commonTerms.join(`; `),sample_urls:e.sampleUrls.join(`; `),summary:e.summary}))},{filename:`postmortem-update-evidence.csv`,headers:[...C.evidence],rows:e.output.update.evidence.map((e,t)=>({rank:t+1,evidence:e}))},{filename:`postmortem-confounders.csv`,headers:[...C.confounders],rows:e.output.update.confounders.map((e,t)=>({rank:t+1,source:e.source,title:e.title,date:e.date,scope:e.scope,target:e.target,description:e.description}))},...[`page`,`query`,`device`,`country`].map(t=>({filename:`postmortem-segment-${t}.csv`,headers:[...C.segment],rows:fi(e,t)})),...[`page`,`query`,`device`,`country`].map(t=>({filename:`postmortem-segment-${t}-unmatched.csv`,headers:[...C.unmatchedSegment],rows:pi(e,t)}))]}function hi(e){return v(e)?Or(e,{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(`.log`)).map(t=>{let n=_(e,t.name),r=Mr(n);return{path:n,size:r.size,modifiedAt:r.mtimeMs}}):[]}function gi(e,t){let n=_r(e),r=gr(e,`.log`),i=0;for(;;){let e=_(n,`${r}.${t}${i?`-${i}`:``}.log`);if(!v(e))return e;i+=1}}function _i(e={}){let t=e.directory??qe().logDir,n=e.now??Date.now(),r=e.maxFileBytes??8388608,i=e.maxTotalBytes??67108864,a=e.maxAgeMs??12096e5;Er(t,{recursive:!0,mode:448});let o=0,s=0;for(let e of hi(t))e.size<=r||(Ar(e.path,gi(e.path,n)),o+=1);for(let e of hi(t))e.modifiedAt>=n-a||(jr(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;jr(e.path,{force:!0}),l-=e.size,s+=1}return{rotated:o,removed:s,sizeBytes:l}}function vi(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 yi(e,t){return{type:`boolean`,default:!0,description:e,negativeDescription:t}}function w(e){return typeof e==`string`?e:void 0}function T(e){return typeof e==`boolean`?e:void 0}function bi(e){let t=w(e.rendering);if(t!==void 0&&t!==`auto`&&t!==`on`&&t!==`off`)throw new g(`INVALID_INPUT`,`--rendering must be auto, on, or off.`);if(T(e.js)===!0&&t&&t!==`on`)throw new g(`INVALID_INPUT`,`Use either --js or --rendering on, not both with different modes.`);return t??(T(e.js)?`on`:`auto`)}function E(e,t){let n=T(e[t]);if(n===!1)return!0;if(n===!0)return!1;let r=T(e[xi(t)]);if(r===!1)return!0;if(r===!0)return!1;if(T(e[`no-${t}`])===!0||T(e[`no${Si(t)}`])===!0)return!0}function xi(e){return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Si(e){let t=xi(e);return t?`${t[0]?.toUpperCase()}${t.slice(1)}`:``}function D(e){if(typeof e==`number`)return e;if(typeof e!=`string`||!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function O(e,t){if(e===void 0||e===``)return;let n=D(e);if(n===void 0)throw new g(`INVALID_INPUT`,`${t} must be a number.`);return n}function k(e){if(typeof e!=`string`)return;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length?t:void 0}function Ci(e){return k(e)??[]}function wi(e){let t={concurrency:D(e[`fetch-concurrency`]),intervalCap:D(e[`fetch-interval-cap`]),intervalMs:D(e[`fetch-interval-ms`])};return Object.values(t).some(e=>e!==void 0)?t:void 0}function A(e){return e.json===!0}async function Ti(e,t){let n=w(e),r=w(t);if(n&&r)throw Error(`Use either --body or --body-file, not both.`);if(!n&&!r)return;let i=n??await y(r??``,`utf8`),a=JSON.parse(i);if(!a||typeof a!=`object`||Array.isArray(a))throw Error(`JSON body must be an object.`);return a}function j(e){if(e)return e;throw new g(`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 Ei(e,t={}){let n=j(e),r=(await Fe(t.refresh,t.account)).map(e=>e.siteUrl),i=$n(r,n);if(!i)throw new g(`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 Di(e){if(e)return e;throw new g(`INVALID_INPUT`,"No Google Analytics property given. Pass --property with the numeric property id. Run `seo analytics google properties` to list them.")}function Oi(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 ki(e={}){let t=e.env??process.env,n=Oi(e.columns)??Oi(e.streamColumns)??Oi(t.COLUMNS)??80;return Math.min(200,Math.max(40,n))}function M(e={}){let t=e.env??process.env,n=e.isTTY??!!process.stdout.isTTY,r=e.color??!!(n&&t.NO_COLOR===void 0);return{columns:ki({...e,env:t,streamColumns:e.streamColumns??process.stdout.columns}),colors:ri.createColors(r),hasColor:r,isInteractive:n&&!t.CI}}function N(e){return ii(Ur(e))}function Ai(e,t){let n=[],r=``;for(let i of e)r&&N(`${r}${i}`)>t?(n.push(r),r=i):r+=i;return r&&n.push(r),n}function ji(e,t){if(!e)return[``];let n=e.trim().split(/\s+/u),r=[],i=``;for(let e of n){let n=N(e)>t?Ai(e,t):[e];for(let e of n)i?N(`${i} ${e}`)<=t?i+=` ${e}`:(r.push(i),i=e):i=e}return i&&r.push(i),r.length>0?r:[``]}function P(e,t){let n=Math.max(1,t);return e.replaceAll(`\r
|
|
3
|
+
import{$ as e,$n as t,$t as n,A as r,An as i,Ar as a,At as o,B as s,Bn as c,Bt as l,C as u,Cn as d,Cr as f,Ct as ee,D as p,Dn as te,Dr as m,Dt as h,E as ne,En as re,Er as ie,Et as ae,F as oe,Fn as se,Ft as ce,G as le,Gn as ue,Gt as de,H as fe,Hn as pe,Ht as me,I as he,In as ge,It as _e,J as ve,Jn as ye,Jt as be,K as xe,Kn as Se,Kt as Ce,L as we,Ln as Te,Lt as Ee,M as De,Mn as Oe,Mr as ke,Mt as Ae,N as je,Nn as Me,Nt as Ne,O as Pe,On as Fe,Or as g,P as Ie,Pn as Le,Pt as Re,Q as ze,Qn as Be,Qt as Ve,R as He,Rn as Ue,Rt as We,S as Ge,Sn as Ke,Sr as qe,St as Je,T as Ye,Tn as Xe,Tr as Ze,Tt as Qe,U as $e,Un as et,Ut as tt,V as nt,Vn as rt,Vt as it,W as at,Wn as ot,Wt as st,X as ct,Xn as lt,Xt as ut,Y as dt,Yn as ft,Yt as pt,Z as mt,Zn as ht,Zt as gt,_ as _t,_n as vt,_r as yt,_t as bt,a as xt,an as St,ar as Ct,at as wt,b as Tt,bn as Et,br as Dt,bt as Ot,c as kt,cn as At,cr as jt,ct as Mt,d as Nt,dn as Pt,dr as Ft,dt as It,en as Lt,er as Rt,et as zt,f as Bt,fn as Vt,fr as Ht,ft as Ut,g as Wt,gn as Gt,gr as Kt,gt as qt,h as Jt,hn as Yt,hr as Xt,ht as Zt,i as Qt,in as $t,ir as en,it as tn,j as nn,jn as rn,jr as an,jt as on,k as sn,kn as cn,kr as ln,kt as un,l as dn,ln as fn,lr as pn,lt as mn,m as hn,mn as gn,mr as _n,mt as vn,nn as yn,nr as bn,nt as xn,o as Sn,on as Cn,or as wn,ot as Tn,p as En,pn as Dn,pr as On,pt as kn,q as An,qn as jn,qt as Mn,rn as Nn,rr as Pn,rt as Fn,sn as In,sr as Ln,st as Rn,t as zn,tn as Bn,tr as Vn,tt as Hn,u as Un,un as Wn,ur as Gn,ut as Kn,v as qn,vn as Jn,vr as Yn,vt as Xn,w as Zn,wn as Qn,wr as $n,wt as er,x as tr,xn as nr,xr as rr,xt as ir,y as ar,yn as or,yr as sr,yt as cr,z as lr,zn as ur,zt as dr}from"./dist-X-66Zivw.js";import{randomBytes as fr}from"node:crypto";import{arch as pr,homedir as mr,platform as hr}from"node:os";import{basename as gr,dirname as _r,join as _,posix as vr,relative as yr,resolve as br,sep as xr,win32 as Sr}from"node:path";import{constants as Cr,copyFileSync as wr,createWriteStream as Tr,existsSync as v,mkdirSync as Er,readFileSync as Dr,readdirSync as Or,realpathSync as kr,renameSync as Ar,rmSync as jr,statSync as Mr,writeFileSync as Nr}from"node:fs";import{fileURLToPath as Pr}from"node:url";import{cp as Fr,mkdir as Ir,open as Lr,readFile as y,readdir as Rr,rename as zr,stat as Br,writeFile as Vr}from"node:fs/promises";import{isDeepStrictEqual as Hr,stripVTControlCharacters as Ur}from"node:util";import{spawn as Wr,spawnSync as Gr}from"node:child_process";import{defineCommand as b,runCommand as Kr,runMain as qr}from"citty";import{cancel as Jr,confirm as Yr,intro as Xr,isCancel as Zr,log as Qr,multiselect as $r,note as x,outro as S,password as ei,select as ti,text as ni}from"@clack/prompts";import ri from"picocolors";import ii from"string-width";import ai from"cli-table3";import{finished as oi}from"node:stream/promises";import{applyEdits as si,modify as ci,parse as li,printParseErrorCode as ui}from"jsonc-parser";import di from"update-notifier";const C={summary:/* @__PURE__ */ `workflow.site.generated_at.summary.attribution.confidence.classification.updates_matched.known_confounders.page_segment_status.page_segment_eligible_rows.page_segment_returned_rows.page_segment_limited_rows.page_segment_result_limit.page_segment_source_row_limit.page_segment_source_possibly_truncated.page_segment_warnings.query_segment_status.query_segment_eligible_rows.query_segment_returned_rows.query_segment_limited_rows.query_segment_result_limit.query_segment_source_row_limit.query_segment_source_possibly_truncated.query_segment_warnings.device_segment_status.device_segment_eligible_rows.device_segment_returned_rows.device_segment_limited_rows.device_segment_result_limit.device_segment_source_row_limit.device_segment_source_possibly_truncated.device_segment_warnings.country_segment_status.country_segment_eligible_rows.country_segment_returned_rows.country_segment_limited_rows.country_segment_result_limit.country_segment_source_row_limit.country_segment_source_possibly_truncated.country_segment_warnings`.split(`.`),steps:[`rank`,`tool`,`status`,`summary`],actions:[`rank`,`title`,`confidence`,`action`],findings:[`dimension`,`data_status`,`eligible_rows`,`returned_rows`,`limited_rows`,`result_limit`,`unmatched_rows`,`summary`,`winner_key`,`winner_click_delta`,`winner_impression_delta`,`winner_position_delta`,`loser_key`,`loser_click_delta`,`loser_impression_delta`,`loser_position_delta`],templates:[`rank`,`direction`,`template`,`confidence`,`url_count`,`click_delta`,`impression_delta`,`movement_share`,`movement_share_scope`,`confidence_scope`,`eligible_rows`,`returned_rows`,`limited_rows`,`result_limit`,`source_possibly_truncated`,`common_terms`,`sample_urls`,`summary`],evidence:[`rank`,`evidence`],confounders:[`rank`,`source`,`title`,`date`,`scope`,`target`,`description`],segment:[`rank`,`dimension`,`data_status`,`evidence_scope`,`key`,`before_clicks`,`after_clicks`,`click_delta`,`before_impressions`,`after_impressions`,`impression_delta`,`before_position`,`after_position`,`position_delta`],unmatchedSegment:[`rank`,`dimension`,`data_status`,`key`,`retained_in`,`clicks`,`impressions`,`position`,`reason`]};function fi(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 pi(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 mi(e){return[{filename:`postmortem-summary.csv`,headers:[...C.summary],rows:[{workflow:e.workflow,site:e.site,generated_at:e.generatedAt,summary:e.summary,attribution:e.output.update.attribution,confidence:e.output.update.confidence,classification:e.output.update.classification,updates_matched:e.output.update.overlappingUpdates.length,known_confounders:e.output.update.confounders.length,page_segment_status:e.output.segments.page.dataStatus,page_segment_eligible_rows:e.output.segments.page.coverage.eligibleRows,page_segment_returned_rows:e.output.segments.page.coverage.returnedRows,page_segment_limited_rows:e.output.segments.page.coverage.limitedRows,page_segment_result_limit:e.output.segments.page.coverage.resultLimit,page_segment_source_row_limit:e.output.segments.page.coverage.sourceRowLimit,page_segment_source_possibly_truncated:e.output.segments.page.coverage.sourcePossiblyTruncated,page_segment_warnings:e.output.segments.page.warnings.join(`; `),query_segment_status:e.output.segments.query.dataStatus,query_segment_eligible_rows:e.output.segments.query.coverage.eligibleRows,query_segment_returned_rows:e.output.segments.query.coverage.returnedRows,query_segment_limited_rows:e.output.segments.query.coverage.limitedRows,query_segment_result_limit:e.output.segments.query.coverage.resultLimit,query_segment_source_row_limit:e.output.segments.query.coverage.sourceRowLimit,query_segment_source_possibly_truncated:e.output.segments.query.coverage.sourcePossiblyTruncated,query_segment_warnings:e.output.segments.query.warnings.join(`; `),device_segment_status:e.output.segments.device.dataStatus,device_segment_eligible_rows:e.output.segments.device.coverage.eligibleRows,device_segment_returned_rows:e.output.segments.device.coverage.returnedRows,device_segment_limited_rows:e.output.segments.device.coverage.limitedRows,device_segment_result_limit:e.output.segments.device.coverage.resultLimit,device_segment_source_row_limit:e.output.segments.device.coverage.sourceRowLimit,device_segment_source_possibly_truncated:e.output.segments.device.coverage.sourcePossiblyTruncated,device_segment_warnings:e.output.segments.device.warnings.join(`; `),country_segment_status:e.output.segments.country.dataStatus,country_segment_eligible_rows:e.output.segments.country.coverage.eligibleRows,country_segment_returned_rows:e.output.segments.country.coverage.returnedRows,country_segment_limited_rows:e.output.segments.country.coverage.limitedRows,country_segment_result_limit:e.output.segments.country.coverage.resultLimit,country_segment_source_row_limit:e.output.segments.country.coverage.sourceRowLimit,country_segment_source_possibly_truncated:e.output.segments.country.coverage.sourcePossiblyTruncated,country_segment_warnings:e.output.segments.country.warnings.join(`; `)}]},{filename:`workflow-steps.csv`,headers:[...C.steps],rows:e.steps.map((e,t)=>({rank:t+1,tool:e.tool,status:e.status,summary:e.summary}))},{filename:`workflow-actions.csv`,headers:[...C.actions],rows:e.actions.map((e,t)=>({rank:t+1,title:e.title,confidence:e.confidence,action:e.action}))},{filename:`postmortem-findings.csv`,headers:[...C.findings],rows:e.output.insights.map(e=>({dimension:e.dimension,data_status:e.dataStatus,eligible_rows:e.coverage.eligibleRows,returned_rows:e.coverage.returnedRows,limited_rows:e.coverage.limitedRows,result_limit:e.coverage.resultLimit,unmatched_rows:e.unmatchedRows,summary:e.summary,winner_key:e.winner?.key,winner_click_delta:e.winner?.clickDelta,winner_impression_delta:e.winner?.impressionDelta,winner_position_delta:e.winner?.positionDelta,loser_key:e.loser?.key,loser_click_delta:e.loser?.clickDelta,loser_impression_delta:e.loser?.impressionDelta,loser_position_delta:e.loser?.positionDelta}))},{filename:`postmortem-template-movement.csv`,headers:[...C.templates],rows:e.output.templateMovement.map((e,t)=>({rank:t+1,direction:e.direction,template:e.signature,confidence:e.confidence,url_count:e.urlCount,click_delta:e.clickDelta,impression_delta:e.impressionDelta,movement_share:e.movementShare,movement_share_scope:e.movementShareScope,confidence_scope:e.confidenceScope,eligible_rows:e.segmentCoverage.eligibleRows,returned_rows:e.segmentCoverage.returnedRows,limited_rows:e.segmentCoverage.limitedRows,result_limit:e.segmentCoverage.resultLimit,source_possibly_truncated:e.segmentCoverage.sourcePossiblyTruncated,common_terms:e.commonTerms.join(`; `),sample_urls:e.sampleUrls.join(`; `),summary:e.summary}))},{filename:`postmortem-update-evidence.csv`,headers:[...C.evidence],rows:e.output.update.evidence.map((e,t)=>({rank:t+1,evidence:e}))},{filename:`postmortem-confounders.csv`,headers:[...C.confounders],rows:e.output.update.confounders.map((e,t)=>({rank:t+1,source:e.source,title:e.title,date:e.date,scope:e.scope,target:e.target,description:e.description}))},...[`page`,`query`,`device`,`country`].map(t=>({filename:`postmortem-segment-${t}.csv`,headers:[...C.segment],rows:fi(e,t)})),...[`page`,`query`,`device`,`country`].map(t=>({filename:`postmortem-segment-${t}-unmatched.csv`,headers:[...C.unmatchedSegment],rows:pi(e,t)}))]}function hi(e){return v(e)?Or(e,{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(`.log`)).map(t=>{let n=_(e,t.name),r=Mr(n);return{path:n,size:r.size,modifiedAt:r.mtimeMs}}):[]}function gi(e,t){let n=_r(e),r=gr(e,`.log`),i=0;for(;;){let e=_(n,`${r}.${t}${i?`-${i}`:``}.log`);if(!v(e))return e;i+=1}}function _i(e={}){let t=e.directory??qe().logDir,n=e.now??Date.now(),r=e.maxFileBytes??8388608,i=e.maxTotalBytes??67108864,a=e.maxAgeMs??12096e5;Er(t,{recursive:!0,mode:448});let o=0,s=0;for(let e of hi(t))e.size<=r||(Ar(e.path,gi(e.path,n)),o+=1);for(let e of hi(t))e.modifiedAt>=n-a||(jr(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;jr(e.path,{force:!0}),l-=e.size,s+=1}return{rotated:o,removed:s,sizeBytes:l}}function vi(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 yi(e,t){return{type:`boolean`,default:!0,description:e,negativeDescription:t}}function w(e){return typeof e==`string`?e:void 0}function T(e){return typeof e==`boolean`?e:void 0}function bi(e){let t=w(e.rendering);if(t!==void 0&&t!==`auto`&&t!==`on`&&t!==`off`)throw new g(`INVALID_INPUT`,`--rendering must be auto, on, or off.`);if(T(e.js)===!0&&t&&t!==`on`)throw new g(`INVALID_INPUT`,`Use either --js or --rendering on, not both with different modes.`);return t??(T(e.js)?`on`:`auto`)}function E(e,t){let n=T(e[t]);if(n===!1)return!0;if(n===!0)return!1;let r=T(e[xi(t)]);if(r===!1)return!0;if(r===!0)return!1;if(T(e[`no-${t}`])===!0||T(e[`no${Si(t)}`])===!0)return!0}function xi(e){return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Si(e){let t=xi(e);return t?`${t[0]?.toUpperCase()}${t.slice(1)}`:``}function D(e){if(typeof e==`number`)return e;if(typeof e!=`string`||!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function O(e,t){if(e===void 0||e===``)return;let n=D(e);if(n===void 0)throw new g(`INVALID_INPUT`,`${t} must be a number.`);return n}function k(e){if(typeof e!=`string`)return;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length?t:void 0}function Ci(e){return k(e)??[]}function wi(e){let t={concurrency:D(e[`fetch-concurrency`]),intervalCap:D(e[`fetch-interval-cap`]),intervalMs:D(e[`fetch-interval-ms`])};return Object.values(t).some(e=>e!==void 0)?t:void 0}function A(e){return e.json===!0}async function Ti(e,t){let n=w(e),r=w(t);if(n&&r)throw Error(`Use either --body or --body-file, not both.`);if(!n&&!r)return;let i=n??await y(r??``,`utf8`),a=JSON.parse(i);if(!a||typeof a!=`object`||Array.isArray(a))throw Error(`JSON body must be an object.`);return a}function j(e){if(e)return e;throw new g(`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 Ei(e,t={}){let n=j(e),r=(await Fe(t.refresh,t.account)).map(e=>e.siteUrl),i=$n(r,n);if(!i)throw new g(`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 Di(e){if(e)return e;throw new g(`INVALID_INPUT`,"No Google Analytics property given. Pass --property with the numeric property id. Run `seo analytics google properties` to list them.")}function Oi(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 ki(e={}){let t=e.env??process.env,n=Oi(e.columns)??Oi(e.streamColumns)??Oi(t.COLUMNS)??80;return Math.min(200,Math.max(40,n))}function M(e={}){let t=e.env??process.env,n=e.isTTY??!!process.stdout.isTTY,r=e.color??!!(n&&t.NO_COLOR===void 0);return{columns:ki({...e,env:t,streamColumns:e.streamColumns??process.stdout.columns}),colors:ri.createColors(r),hasColor:r,isInteractive:n&&!t.CI}}function N(e){return ii(Ur(e))}function Ai(e,t){let n=[],r=``;for(let i of e)r&&N(`${r}${i}`)>t?(n.push(r),r=i):r+=i;return r&&n.push(r),n}function ji(e,t){if(!e)return[``];let n=e.trim().split(/\s+/u),r=[],i=``;for(let e of n){let n=N(e)>t?Ai(e,t):[e];for(let e of n)i?N(`${i} ${e}`)<=t?i+=` ${e}`:(r.push(i),i=e):i=e}return i&&r.push(i),r.length>0?r:[``]}function P(e,t){let n=Math.max(1,t);return e.replaceAll(`\r
|
|
4
4
|
`,`
|
|
5
5
|
`).split(`
|
|
6
6
|
`).flatMap(e=>ji(e,n))}function Mi(e,t){if(N(e)<=t)return e;let n=Math.max(1,t-N(`...`)),r=``;for(let t of e){if(N(`${r}${t}`)>n)break;r+=t}return`${r}...`}const Ni={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 Pi(e){return e===void 0?``:String(e)}function Fi(e,t){return e.map((e,n)=>{let r=t.map(e=>Pi(e[n]));return Math.min(42,Math.max(N(e),...r.map(N),4))})}function Ii(e,t,n){return e.length===0||e.length>4||!e.map((e,n)=>t.every(e=>/^-?(?:\d+(?:\.\d+)?|\d+(?:\.\d+)?%)$/u.test(Pi(e[n]).trim()))).some(Boolean)?!1:Fi(e,t).reduce((e,t)=>e+t+2,0)<=n.columns}function Li(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 Ri(e,t,n){let r=Fi(e,t).map(e=>e+2),i=new ai({chars:Ni,colWidths:r,head:e.map(e=>n.colors.bold(e)),style:{border:[],head:[],"padding-left":0,"padding-right":2},wordWrap:!1});for(let a of t)i.push(e.map((e,t)=>P(Li(e,Pi(a[t]),n),Math.max(1,(r[t]??3)-2)).join(`
|
|
@@ -62,7 +62,7 @@ Updates
|
|
|
62
62
|
`),`Setup will`),x(ic.join(`
|
|
63
63
|
`),`Then run`),S(`Dry run complete. Nothing was changed.`));return}rr();let n=F({json:t}),r=await Qs({interactive:n})??await tc({interactive:n}),i=n?await rc():[],a=n?await nc():{status:`skipped`};if(t){I({auth:r,mcp:i,skill:a,next:ic});return}L([[`Sign-in`,oc(r)],[`MCP server`,cc(i)],[`SEO skill`,sc(a)]]);let o=i.filter(e=>e.error);o.length&&x(o.map(e=>`${e.client}: ${e.error}`).join(`
|
|
64
64
|
`),`MCP setup skipped`),a.error&&x(a.error,`SEO skill install failed`),x(`seo sites list your Search Console properties
|
|
65
|
-
seo report --site <site> run the main report for one of them`,`Try next`),S(`Setup complete.`),lc()}const dc=b({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)}),fc=b({...dc,meta:{name:`start`,description:`Start here: sign in with Google, then add the MCP server and skill to your agents`}}),pc=b({...fc,meta:{name:`init`,description:"Legacy alias for `seo start`."}}),mc=b({meta:{name:`logs`,description:`Manage local log retention`},subCommands:{prune:b({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=_i();A(e)?I(t):e.quiet||process.stdout.write(`Rotated ${t.rotated} and removed ${t.removed} log files. ${_a(t.sizeBytes)} retained.\n`)}})}}),hc=[{client:`claude-desktop`,flag:`claude-desktop`},{client:`claude-code`,flag:`claude-code`},{client:`codex`,flag:`codex`},{client:`cursor`,flag:`cursor`}];function gc(e,t){return T(e.all)?t:hc.filter(({flag:t})=>T(e[t])).map(({client:e})=>e)}const _c=b({meta:{name:`mcp`,description:`MCP server helpers`},subCommands:{serve:b({meta:{name:`serve`,description:`Run the SEO MCP server`},args:{test:{type:`boolean`,default:!1,description:`Start in test mode`}},run:async({args:e})=>{let{startMcpServer:t}=await import(`./dist-
|
|
65
|
+
seo report --site <site> run the main report for one of them`,`Try next`),S(`Setup complete.`),lc()}const dc=b({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)}),fc=b({...dc,meta:{name:`start`,description:`Start here: sign in with Google, then add the MCP server and skill to your agents`}}),pc=b({...fc,meta:{name:`init`,description:"Legacy alias for `seo start`."}}),mc=b({meta:{name:`logs`,description:`Manage local log retention`},subCommands:{prune:b({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=_i();A(e)?I(t):e.quiet||process.stdout.write(`Rotated ${t.rotated} and removed ${t.removed} log files. ${_a(t.sizeBytes)} retained.\n`)}})}}),hc=[{client:`claude-desktop`,flag:`claude-desktop`},{client:`claude-code`,flag:`claude-code`},{client:`codex`,flag:`codex`},{client:`cursor`,flag:`cursor`}];function gc(e,t){return T(e.all)?t:hc.filter(({flag:t})=>T(e[t])).map(({client:e})=>e)}const _c=b({meta:{name:`mcp`,description:`MCP server helpers`},subCommands:{serve:b({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-DbD33M0Y.js`);await t({test:T(e.test)})}}),install:b({meta:{name:`install`,description:`Install or remove SEO MCP config for local clients`},args:{uninstall:{type:`boolean`,default:!1,description:`Remove the SEO MCP config instead of adding it`},reinstall:{type:`boolean`,default:!1,description:`Rewrite an existing managed SEO MCP config`},"claude-desktop":{type:`boolean`,default:!1,description:`Update Claude Desktop`},"claude-code":{type:`boolean`,default:!1,description:`Update Claude Code`},codex:{type:`boolean`,default:!1,description:`Update Codex CLI, app, and IDE extension`},cursor:{type:`boolean`,default:!1,description:`Update Cursor`},all:{type:`boolean`,default:!1,description:`Update every detected MCP client`},json:{type:`boolean`,default:!1,description:`Print structured JSON output`}},run:async({args:e})=>{if(T(e.uninstall)&&T(e.reinstall))throw new g(`INVALID_INPUT`,`Use either --uninstall or --reinstall, not both.`);let t=hs(),n=vs({targets:t}),r=A(e),i=gc(e,n.map(e=>e.client));if(i.length===0){if(!F({json:r}))throw new g(`INVALID_INPUT`,`Choose an MCP client with --claude-desktop, --claude-code, --codex, --cursor, or --all.`);let a=n.length>0?n:t;i=z(await $r({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 g(`INVALID_INPUT`,`MCP setup is not supported for ${a.join(`, `)} on ${process.platform}.`);let o=t.filter(e=>i.includes(e.client)).map(t=>T(e.uninstall)?Ls(t):Is(t,{reinstall:T(e.reinstall)}));if(r)I({operation:T(e.uninstall)?`uninstall`:`install`,results:o});else for(let e of o)process.stdout.write(`${e.changed?`updated`:`skipped`} ${e.client} · ${e.path}\n`)}})}}),vc=b({meta:{name:`index-coverage`,description:`Find crawlable pages that deserve a closer Google index check`},args:{site:{type:`string`,description:`GSC property URL, for example sc-domain:example.com.`},url:{type:`string`,description:`Start URL to crawl. Defaults to the home page.`},sitemaps:{type:`string`,description:`Comma-separated XML sitemap URLs. Defaults to declarations captured by the crawl.`},days:{type:`string`,description:`Finalized Search Console date range. Defaults to 90 days.`},"row-limit":{type:`string`,description:`Maximum Search Console page rows. Defaults to 100000.`},"max-sitemap-urls":{type:`string`,description:`Maximum sitemap inventory URLs. Defaults to 100000.`},limit:{type:`string`,description:`Maximum URLs returned in each evidence group. Defaults to 100.`},refresh:{type:`boolean`,default:!1,description:`Bypass the local Search Console cache.`},json:{type:`boolean`,default:!1,description:`Print machine-readable JSON.`}},run:async({args:e})=>{let t=A(e),n=j(w(e.site)),r=Ci(e.sitemaps),i=await tt({site:n,url:w(e.url),sitemaps:r.length?r:void 0,days:D(e.days),rowLimit:D(e[`row-limit`]),maxSitemapUrls:D(e[`max-sitemap-urls`]),itemsPerSection:D(e.limit),refresh:T(e.refresh)});t?I(i):(K({title:`Index coverage`,target:i.site,status:i.sources.crawl.completeness===`complete`&&i.sources.searchConsole.completeness===`complete`?i.summary.crawlableCandidatesWithoutRetainedSearchVisibility>0?`warning`:`pass`:`unknown`,summary:`${i.summary.crawlableCandidatesWithoutRetainedSearchVisibility} crawlable pages need URL Inspection review.`,metrics:[{label:`Crawl report`,value:i.input.crawlReport.id},{label:`Crawl evidence`,value:i.sources.crawl.completeness},{label:`Sitemap evidence`,value:i.sources.sitemap.completeness},{label:`Search evidence`,value:i.sources.searchConsole.completeness},{label:`Search window`,value:`${i.sources.searchConsole.startDate} to ${i.sources.searchConsole.endDate}`},{label:`Search-visible pages`,value:i.summary.retainedSearchVisibleUrls},{label:`Blocked/non-indexable`,value:i.summary.blockedOrNonIndexableCrawlUrls},{label:`Sitemap only`,value:i.summary.sitemapOnlyUrls},{label:`Search Console only`,value:i.summary.searchConsoleOnlyUrls}]}),i.crawlableWithoutRetainedSearchVisibility.items.length&&(process.stdout.write(`
|
|
66
66
|
Representative URL Inspection candidates
|
|
67
67
|
`),R([`URL`,`Status`,`In sitemap`],i.crawlableWithoutRetainedSearchVisibility.items.map(e=>[G(e.url,80),e.status,e.inSitemap?`yes`:`no`]))),Y(`How to read this report`,i.caveats))}}),yc=b({meta:{name:`link-recover`,description:`Find search-value URLs that are now broken, blocked, or poorly redirected`},args:{site:{type:`string`},...X([`days`,`limit`,`minImpressions`,`refresh`,`js`],{days:{description:`GSC lookback window. Defaults to 90.`},limit:{description:`Maximum GSC pages to check. Defaults to 50.`},minImpressions:{description:`Minimum impressions to check a page. Defaults to 100.`},refresh:{description:`Bypass local GSC and HTTP caches.`},js:{description:`Force JavaScript rendering for final page extraction.`}}),"min-clicks":{type:`string`,description:`Minimum clicks to check a page. Defaults to 1.`},json:{type:`boolean`,default:!1,description:`Print machine-readable JSON.`}},run:async({args:e})=>{let t=A(e),n=await it({site:j(w(e.site)),days:D(e.days),limit:D(e.limit),minClicks:D(e[`min-clicks`]),minImpressions:D(e[`min-impressions`]),refresh:T(e.refresh),js:T(e.js)?!0:`auto`});t?I(n):(K({title:`Link recovery`,target:n.site,status:n.warnings.length>0?`unknown`:n.summary.recoverable>0?`warning`:`pass`,summary:n.summary.recoverable>0?`${U(n.summary.recoverable)} previously visible URLs need recovery review.`:`No recoverable URLs were found in the retained evidence.`,metrics:[{label:`Range`,value:`${n.range.startDate} to ${n.range.endDate}`},{label:`Checked`,value:U(n.summary.checked)},{label:`Recoverable`,value:U(n.summary.recoverable)},{label:`High severity`,value:U(n.summary.high)},{label:`Clicks at risk`,value:U(n.summary.clicksAtRisk)},{label:`Impressions at risk`,value:U(n.summary.impressionsAtRisk)}]}),n.items.length&&(q([`Severity`,`Issue`,`Clicks`,`Impr`,`URL`,`Action`],n.items.map(e=>[e.severity,e.issue,U(e.clicks),U(e.impressions),G(e.url,56),G(e.recommendation.action,72)])),J(`Top recovery actions`,n.items.map(e=>({label:G(e.url,96),context:`${e.severity}, ${U(e.clicks)} clicks at risk`,action:e.recommendation.action})))),Y(`Warnings`,n.warnings.slice(0,10)))}}),bc=b({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 ${Me.toLocaleString(`en-US`)} rows, 5 at a time.`},"max-hops":{type:`string`,description:`Maximum redirect hops to follow, up to 10. Defaults to 10.`},refresh:{type:`boolean`,default:!1,description:`Bypass local HTTP cache for final page extraction.`},js:{type:`boolean`,default:!1,description:`Force JavaScript rendering for final page extraction.`},json:{type:`boolean`,default:!1,description:`Print machine-readable JSON.`}},run:async({args:e})=>{let t=w(e.map);if(t){await wc(e,t);return}let n=w(e.url);if(!n)throw new g(`INVALID_INPUT`,`Pass --url to trace one URL, or --map with a CSV of old and expected URLs.`);let r=await me({url:n,maxHops:D(e[`max-hops`]),refresh:T(e.refresh),js:T(e.js)?!0:`auto`});A(e)?I(r):(K({title:`Redirect trace`,target:r.url,status:r.summary.issues.length>0||r.summary.error?`warning`:r.summary.finalIndexable===void 0?`unknown`:`pass`,summary:[r.summary.error?`${r.summary.outcome===`timeout`?`Timed out`:`Failed`} at ${r.finalUrl}: ${r.summary.error}`:r.summary.issues.length>0?``:`${r.summary.hops} redirect ${r.summary.hops===1?`hop`:`hops`} ended at HTTP ${r.summary.finalStatus}.`,r.summary.issues.join(`, `)].filter(Boolean).join(` `),metrics:[{label:`Final URL`,value:r.finalUrl},{label:`Final status`,value:r.summary.finalStatus??`No response`},{label:`Indexable`,value:r.summary.finalIndexable===void 0?`Unknown`:r.summary.finalIndexable?`Yes`:`No`},{label:`Hops`,value:r.summary.hops}]}),R([`#`,`Status`,`URL`,`Next`],r.chain.map((e,t)=>[t+1,e.status,G(e.url,72),G(e.nextUrl??`-`,72)])),r.finalPage&&(process.stdout.write(`
|
|
68
68
|
Final page
|
|
@@ -10,7 +10,7 @@ import{createRequire as e}from"node:module";import t,{createHash as n,randomUUID
|
|
|
10
10
|
`),data:{summary:Qn(t.summary)?t.summary:null,path:i?.path??null,total:a.length,columns:u,rows:l,limits:c}}}function fr(e,t,n){let r=er(e);if(!r)return{total:0,text:``};let i=r.rows.map(tr);return{total:i.length,text:ir(i.slice(0,n),nr(i,6),t)}}async function pr(e,t){return(await Gt(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 mr=e=>{try{return new URL(e.includes(`://`)?e:`https://${e.replace(/^sc-domain:/,``)}`).hostname.replace(/^www\./,``)}catch{return e}};async function hr(e){let t=e.accounts.length>1,[n,r]=await Promise.all([Promise.all(e.accounts.map(async t=>{let[n,r]=await Promise.all([pr(t.google,e.signIn).catch(e=>e instanceof Error?e:Error(String(e))),qt(t.google,{signIn:e.signIn}).catch(()=>null)]);return{email:t.email,properties:n,analytics:r}})),e.bing?en(e.bing).catch(e=>e instanceof Error?e:Error(String(e))):Promise.resolve(null)]),i=Array.isArray(r)?r.filter(e=>e.verified):[],a=new Map(i.map(e=>[mr(e.url),e])),o=n.flatMap(e=>e.properties instanceof Error?[]:e.properties.map(n=>({...n,...t?{account:e.email??``}:{},...Array.isArray(r)?{bing:a.get(mr(n.siteUrl))?.url??``}:{}}))),s=new Set(o.map(e=>mr(e.siteUrl))),c=i.filter(e=>!s.has(mr(e.url))),l=n.filter(e=>e.properties instanceof Error),u=n.flatMap(e=>(e.analytics??[]).flatMap(n=>n.propertySummaries.map(r=>({property:r.property.replace(`properties/`,``),name:r.displayName??``,account:n.displayName??``,...t?{signIn:e.email??``}:{}})))),d=[[`dataforseo`,`x-dataforseo-login`],[`ahrefs`,`x-ahrefs-key`]].filter(([,t])=>e.keys.get(t??``)).map(([e])=>e),f=[`siteUrl`,`permissionLevel`,...t?[`account`]:[],...Array.isArray(r)?[`bing`]:[]];return{text:[t?`Google accounts: ${e.accounts.map(e=>e.email).join(`, `)}.`:null,`Search Console properties (${o.length}):`,o.length?ir(o,f,null):`None. These Google sign-ins have no Search Console access, so the reports cannot run.`,...l.map(e=>`${e.email??`Google`}: could not list properties. ${e.properties.message}`),u.length?`Google Analytics properties (${u.length}):\n${ir(u,[`property`,`name`,`account`,...t?[`signIn`]:[]],null)}`:`Google Analytics: no properties readable with these sign-ins.`,e.bing===void 0?null:r===null?`Bing Webmaster: not connected.`:r instanceof Error?`Bing Webmaster: could not list sites. ${r.message}`:c.length?`Bing Webmaster sites with no Search Console property here (${c.length}): ${c.map(e=>e.url).join(`, `)}.`:`Bing Webmaster: ${i.length} verified sites; the bing column shows each one.`,`Research keys: ${d.length?d.join(`, `):`none`}.`,e.clicky?.length?`Clicky sites (seo_data with source "clicky"): ${e.clicky.join(`, `)}.`:null,e.simpleAnalytics?`Simple Analytics: API key saved; seo_data with source "simple_analytics" and the site's domain.`:null,`Add a Google account${e.bing===void 0?``:`, Bing`} or a key: ${e.connect}`,`Next: seo_report with a site.`].filter(Boolean).join(`
|
|
11
11
|
|
|
12
12
|
`),data:{searchConsole:o,googleAnalytics:u,bing:Array.isArray(r)?i:null,research:d,clicky:e.clicky??[],simpleAnalytics:!!e.simpleAnalytics}}}const gr={siteOwner:0,siteFullUser:1,siteRestrictedUser:2};function _r(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 vr=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:zt(e.token)})),this.bing=_r(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=pr(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=gr[e.permissionLevel]??3,i=t.get(e.siteUrl);(!i||r<i.rank)&&t.set(e.siteUrl,{linked:n,rank:r})}return new Map([...t].map(([e,{linked:t}])=>[e,t]))})(),this.owners}async properties(){return[...(await this.ownerMap()).keys()].sort()}async resolve(e){if(this.google.length===0)throw new I(`NOT_CONNECTED`,`No Google account is connected. ${this.hint.signIn}`);let t=await this.properties(),n=qn(t,e);if(n)return n;throw new I(`NO_ACCESS`,`None of the connected Google accounts (${this.google.map(e=>e.email).join(`, `)}) has a Search Console property for ${e}. ${Kn(t,`they`)} ${this.hint.addGoogle}`)}async owner(e){let t=(await this.ownerMap()).get(await this.resolve(e));if(!t)throw new I(`NO_ACCESS`,`No access to ${e}.`);return t}searchAnalytics(){return async(e,t)=>Wt((await this.owner(e)).google,e,{...t,maxRows:t.maxRows??t.rowLimit??1e5},{signIn:this.hint.signIn})}async inspect(e,t){return Kt((await this.owner(e)).google,e,t,{signIn:this.hint.signIn,languageCode:`en-US`})}};let yr;function br(e){return e.platform===`win32`?g(e.env.APPDATA??g(e.home,`AppData`,`Roaming`),`seo`,`Config`):g(e.env.XDG_CONFIG_HOME??g(e.home,`.config`),`seo`)}function xr(e){return e.platform===`darwin`?g(e.home,`Library`,`Caches`,`seo`):e.platform===`win32`?g(e.env.LOCALAPPDATA??g(e.home,`AppData`,`Local`),`seo`,`Cache`):g(e.env.XDG_CACHE_HOME??g(e.home,`.cache`),`seo`)}function Sr(e){return e.platform===`darwin`?g(e.home,`Library`,`Logs`,`seo`):e.platform===`win32`?g(e.env.LOCALAPPDATA??g(e.home,`AppData`,`Local`),`seo`,`Log`):g(e.env.XDG_STATE_HOME??g(e.home,`.local`,`state`),`seo`)}function Cr(e){return{env:e.env??process.env,home:e.home??c(),platform:e.platform??process.platform}}function wr(e={}){let t=Cr(e),n=t.env.SEO_CONFIG_DIR??br(t),r=t.env.SEO_CACHE_DIR??xr(t);return{configDir:n,cacheDir:r,logDir:t.env.SEO_LOG_DIR??Sr(t),providerPackagesDir:g(n,`providers`),installedProviderPackagesFile:g(n,`provider-packages.json`),configFile:g(n,`config.json`),tokensFile:g(n,`tokens.json`),oauthClientFile:g(n,`oauth-client.json`),providerSecretsFile:g(n,`provider-secrets.json`),telemetryStateFile:g(n,`telemetry.json`),cacheDbFile:g(r,`cache.db`)}}function Tr(e){let t=Cr(e);if(!(t.platform!==`darwin`||t.env.SEO_CONFIG_DIR||t.env.XDG_CONFIG_HOME))return g(t.home,`Library`,`Preferences`,`seo`)}function Er(e={}){let t=Tr(e);if(!t)return;let n=wr(e);if(S(t)&&!S(n.configDir))try{C(p(n.configDir),{recursive:!0,mode:448}),D(t,n.configDir)}catch(e){let t=e.code;if(t!==`EEXIST`&&t!==`ENOENT`)throw e}}function Dr(){return yr||(yr=wr(),yr)}function Or(){let e=Dr();return Er(),C(e.configDir,{recursive:!0,mode:448}),C(e.cacheDir,{recursive:!0,mode:448}),C(e.logDir,{recursive:!0,mode:448}),C(e.providerPackagesDir,{recursive:!0,mode:448}),e}function kr(e){try{return k(e).size}catch{return 0}}function Ar(e,t=448){C(p(e),{recursive:!0,mode:t})}function jr(e){try{return JSON.parse(w(e,`utf8`))}catch{return}}function Mr(e,t,n){Ar(e);let r=`${e}.${process.pid}.${Date.now()}.tmp`;A(r,JSON.stringify(t,null,2),{encoding:`utf8`,mode:n}),b(r,n),D(r,e),b(e,n)}function Nr(e){try{return`0${(k(e).mode&511).toString(8)}`}catch{return`missing`}}function Pr(e){O(e,{recursive:!0,force:!0})}const Fr=[`auth`,`crawl_timeout`,`network`,`config`,`data`,`database`,`filesystem`,`internal`,`unknown`],Ir=[`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`],Lr=[`crawl_pages_run_id_url`],Rr=/* @__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(`.`),zr={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`}},Br=/* @__PURE__ */ new Set([`EAI_AGAIN`,`ENODATA`,`ENOTFOUND`]),Vr=/* @__PURE__ */ new Set([`ECONNREFUSED`,`ECONNRESET`,`ECONNABORTED`,`EPIPE`,`EHOSTUNREACH`,`ENETUNREACH`,`UND_ERR_SOCKET`,`UND_ERR_CONNECT`]),Hr=/* @__PURE__ */ new Set([`ETIMEDOUT`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`]);function Ur(e,t){try{return e[t]}catch{return}}function Wr(e){if(typeof e!=`string`&&typeof e!=`number`)return;let t=String(e);return t.length>2048?t.slice(0,2048):t}function Gr(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:Wr(e)}):e&&typeof e==`object`&&!n.has(e)&&(n.add(e),r.push({code:Wr(Ur(e,`code`)),message:Wr(Ur(e,`message`)),name:Wr(Ur(e,`name`))}),t.push(Ur(e,`cause`),Ur(e,`error`)))}return r}function Kr(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 qr(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=>Br.has(e)))return{errorCategory:`network`,failureReason:`network_dns`};if([...e].some(e=>Hr.has(e)))return{errorCategory:`network`,failureReason:`network_timeout`};if([...e].some(e=>Vr.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 Jr(e){let t=Gr(e),n=new Set(t.map(e=>e.code?.toUpperCase()).filter(e=>!!e)),r=Kr(n,t.map(e=>e.message).filter(e=>!!e).join(`
|
|
13
|
-
`));if(r)return r;let i=qr(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=bt[a?.code],s=o&&zr[o];if(s)return s;for(let e of n){let t=zr[e];if(t)return t}return t.some(e=>e.name===`CLIError`)?{errorCategory:`config`,failureReason:`invalid_input`}:{errorCategory:`unknown`,failureReason:`unknown`}}function Yr(e){try{return Jr(e)}catch{return{errorCategory:`unknown`,failureReason:`unknown`}}}function Xr(e){return typeof e==`string`&&Rr.includes(e)}function Zr(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 Qr(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 $r=`0.18.
|
|
13
|
+
`));if(r)return r;let i=qr(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=bt[a?.code],s=o&&zr[o];if(s)return s;for(let e of n){let t=zr[e];if(t)return t}return t.some(e=>e.name===`CLIError`)?{errorCategory:`config`,failureReason:`invalid_input`}:{errorCategory:`unknown`,failureReason:`unknown`}}function Yr(e){try{return Jr(e)}catch{return{errorCategory:`unknown`,failureReason:`unknown`}}}function Xr(e){return typeof e==`string`&&Rr.includes(e)}function Zr(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 Qr(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 $r=`0.18.1`,ei=/* @__PURE__ */ `affected-urls.ai-referrals.audit-page.audit-urls.cannibalisation.compare-crawls.content-optimization.crawl-diff.site-crawl.ctr-underperformers.decaying-pages.setup-check.explain-crawl-issue.crawl-report.index-coverage.index-coverage-plan.index-monitor.index-watch.internal-links.keyword-metrics.link-evidence.link-recovery.crawl-history.crawler-rules.measure-change.page-opportunities.performance-audit.query-clusters.quick-wins.ranked-keywords.redirect-trace.second-page.segment-impact.serp-results.serp-competitors.striking-distance.top-fixes.traffic-anomaly.update-correlation.search-performance-overview.refresh-priorities.technical-watch.update-postmortem`.split(`.`),ti=[{days:1,event:`active_d1`},{days:7,event:`active_d7`},{days:30,event:`active_d30`}],ni=[`GITHUB_ACTIONS`,`GITLAB_CI`,`CIRCLECI`,`TRAVIS`,`BUILDKITE`,`JENKINS_URL`,`TEAMCITY_VERSION`,`TF_BUILD`,`BITBUCKET_BUILD_NUMBER`,`CODEBUILD_BUILD_ID`];function ri(e){return e.env??process.env}function ii(e){return e.now??/* @__PURE__ */ new Date}function ai(e){return e.stateFile??Dr().telemetryStateFile}function oi(e){return e===`1`||e?.toLowerCase()===`true`}function si(e=process.env){return e.NODE_ENV===`test`||!!e.NODE_TEST_CONTEXT||oi(e.CI)||ni.some(t=>!!e[t])}function ci(e){if(si(e))return`ci`;if(oi(e.DO_NOT_TRACK))return`do_not_track`;if(oi(e.SEOSKILL_TELEMETRY_DISABLED)||oi(e.SEO_TELEMETRY_DISABLED))return`environment`}function li(e){return typeof e==`string`&&[`first_run`,`setup_complete`,`first_audit_complete`,`active_d1`,`active_d7`,`active_d30`].includes(e)}function ui(e){return typeof e==`string`&&ei.includes(e)}function di(e){return typeof e==`string`&&/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/.test(e)}function fi(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))&&di(t.cohort)&&Array.isArray(t.sentMilestones)&&t.sentMilestones.every(li)}function pi(e){if(!S(e))return{kind:`missing`};let t=jr(e);return fi(t)?{kind:`valid`,state:t}:{kind:`invalid`}}function mi(e,t){Mr(e,t,384)}function hi(e,t=!0){let n=ii(e);return{telemetryEnabled:t,firstRunAt:n.toISOString(),cohort:Zr(n),sentMilestones:[]}}function gi(e={}){let t=e.env??process.env;return Qr(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 _i(e=process.env){let t=(e.AI_AGENT||e.AGENT)?.trim().toLowerCase();if(t)return t.slice(0,40);let n=gi({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 vi(e){return e.agent??gi({clientName:e.clientName,env:ri(e)})}function yi(e){return e.replace(/^v/,``).split(`.`)[0]||`unknown`}function bi(e,t,n={},r={}){return{event:e,version:r.version??$r,agent:vi(r),os:r.processPlatform??u(),arch:r.processArch??s(),node:yi(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 xi(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 Si(e){let t=ai(e),n=ci(ri(e)),r=pi(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 Ci(e={}){return Si(e)}function wi(e,t={}){let n=ai(t),r=pi(n),i=r.kind===`valid`?r.state:hi(t,e);return i.telemetryEnabled=e,mi(n,i),Si(t)}function Ti(e){let t=Si(e);return t.enabled?t.state:void 0}function Ei(e={}){let t=Si(e);if(!t.enabled)return t;let n=t.stateFile,r=t.state??hi(e),i=[];if(!r.sentMilestones.includes(`first_run`)){try{(e.notice??(e=>process.stderr.write(e)))(`SEO Skill collects anonymous usage data to improve the tool (event name,
|
|
14
14
|
fixed report or command name, fixed failure classification, version, agent,
|
|
15
15
|
OS, architecture, Node major, and install week; never URLs, report data, error
|
|
16
16
|
messages, command arguments, or identifiers of any kind).
|
|
@@ -452,4 +452,4 @@ if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid
|
|
|
452
452
|
4. 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.
|
|
453
453
|
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});N9(t,{telemetry:e.telemetry===!1?void 0:n}),k7(t);let r=P9();if(r){let{name:e,uri:n,...i}=S$;t.registerResource(e,n,i,async e=>({contents:[{uri:e.href,mimeType:i.mimeType,text:r}]}))}return e.telemetry!==!1&&(t.server.oninitialized=()=>{Ei(n())}),t}async function I9(e={}){let t=F9();if(e.test){process.stdout.write(`seo MCP server constructed successfully.
|
|
454
454
|
`);return}let n=new S7;await t.connect(n),d2()}export{RQ as $,Fi as $n,Y as $t,p1 as A,HS as An,wt as Ar,wG as At,X$ as B,ys as Bn,jB as Bt,I1 as C,gD as Cn,Fn as Cr,rK as Ct,v1 as D,mC as Dn,en as Dr,EG as Dt,f1 as E,yT as En,Xt as Er,DG as Et,t1 as F,bx as Fn,qH as Ft,I$ as G,za as Gn,PL as Gt,N$ as H,Ro as Hn,Yz as Ht,n1 as I,$s as In,AH as It,j$ as J,Ia as Jn,oL as Jt,D$ as K,Wa as Kn,FL as Kt,z$ as L,Ts as Ln,oH as Lt,s1 as M,ux as Mn,Ye as Mr,QH as Mt,Q$ as N,lx as Nn,YH as Nt,m1 as O,QS as On,F as Or,OG as Ot,r1 as P,_x as Pn,XH as Pt,MQ as Q,Ua as Qn,mP as Qt,B$ as R,ws as Rn,VV as Rt,R1 as S,pO as Sn,Dr as Sr,rq as St,x1 as T,fE as Tn,On as Tr,qG as Tt,R$ as U,ko as Un,qz as Ut,J$ as V,Ho as Vn,eB as Vt,L$ as W,Do as Wn,pz as Wt,c$ as X,La as Xn,hI as Xt,A$ as Y,Fa as Yn,RI as Yt,VQ as Z,Va as Zn,QF as Zt,r0 as _,xO as _n,Mi as _r,Eq as _t,O9 as a,SM as an,ia as ar,YX as at,z1 as b,bO as bn,Xr as br,QK as bt,c2 as c,nM as cn,gi as cr,OX as ct,U0 as d,Cj as dn,ui as dr,EY as dt,GN as en,Wi as er,EQ as et,v0 as f,Oj as fn,wi as fr,wY as ft,n0 as g,SO as gn,Oi as gr,AJ as gt,t0 as h,_O as hn,Ai as hr,KJ as ht,D9 as i,DM as in,Ki as ir,VZ as it,c1 as j,cx as jn,Xe as jr,JH as jt,h1 as k,GS as kn,Et as kr,TG as kt,d2 as l,yj as ln,Ci as lr,_X as lt,c0 as m,yO as mn,ki as mr,PJ as mt,E7 as n,_N as nn,ra as nr,jZ as nt,E9 as o,rM as on,ta as or,mZ as ot,d0 as p,kj as pn,ji as pr,rY as pt,M$ as q,Ba as qn,cL as qt,F9 as r,oN as rn,na as rr,MZ as rt,I9 as s,tM as sn,ea as sr,pZ as st,s9 as t,sN as tn,zi as tr,gQ as tt,i2 as u,Aj as un,Ei as ur,TY as ut,V1 as v,CO as vn,$r as vr,Dq as vt,A1 as w,fD as wn,qn as wr,iK as wt,L1 as x,mO as xn,Or as xr,eq as xt,B1 as y,vO as yn,Yr as yr,Tq as yt,Z$ as z,xs as zn,QB as zt};
|
|
455
|
-
//# sourceMappingURL=dist-
|
|
455
|
+
//# sourceMappingURL=dist-X-66Zivw.js.map
|