Lines 1-56javascript
2import{Command as Ym}from"commander";import{dirname as oi,relative as en}from"path";import{intro as pl,outro as fl,text as ti,select as Hn,spinner as ml,isCancel as Ge,cancel as We,confirm as gl}from"@clack/prompts";var Ie=[".env.local",".env.production",".env"],qr=["NEXT_PUBLIC_SITE_URL","SITE_URL","NEXT_PUBLIC_URL","NEXTAUTH_URL","VITE_SITE_URL"];var se="@seoagent-official/seoagent",jt=`${se}@latest`;import{homedir as Sa}from"os";import{join as Te}from"path";var b=".seoagent",zr=["audit","strategy/clusters","briefs","content","content/images","performance"],ke={AGENTS:".agents/skills/seoagen ...
5!content/images/.gitkeep
9`,xa=process.env.XDG_CONFIG_HOME&&process.env.XDG_CONFIG_HOME.trim().length>0?process.env.XDG_CONFIG_HOME:Te(Sa(),".config"),W=Te(xa,"seoagent"),de=Te(W,"auth.json"),Cn=Te(W,"state"),Ft=Te(W,"update-check.json"),Ut=Te(W,"projects.json");var ot="https://seoagent.com",Oe=process.env.SEOAGENT_API_BASE&&process.env.SEOAGENT_API_BASE.trim().length>0?process.env.SEOAGENT_API_BASE.replace(/\/$/,""):ot,O={BASE:Oe,PRICING:`${Oe}/pricing`,LEAD_API:`${Oe}/api/cli/lead`,CLI_AUTH_PAGE:`${Oe}/cli/auth`,CLI_AUTH_POLL:`${Oe}/api/cli/auth/poll`,CLI_SYNC:`${Oe}/api/cli/sync`};function ee(e,t){let n=t&&t!=="unkn ...
10`),i=La(r),s=i.length>0?i[0].indent:0,[a]=Qr(i,0,s);return{data:a,body:o}}function Bt(e){if(!Ia(e))return null;try{return pe(Ta(e,"utf-8"))}catch{return null}}function ja(e){if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return String(e);let t=String(e);return t===""||/[:#\[\]{}&*!|>'"%@`,]/.test(t)||/^\s|\s$/.test(t)?`"${t.replace(/"/g,'\\"')}"`:t}function Zr(e,t,n){let r=" ".repeat(t);for(let[o,i]of Object.entries(e))i!==void 0&&(i!==null&&typeof i=="object"?(n.push(`${r}${o}:`),Zr(i,t+1,n)):n.push(`${r}${o}: ${ja(i)}`))}function Rn(e,t=""){let ...
15`)}var Fa=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Pn(){return Na()}var Ua=new Set(["strapi","wordpress","sanity","contentful","ghost","webflow","shopify","payload","directus","mdx-local","none"]),Ma="project.md";function it(e){return An(e,b)}function Gt(e){return An(it(e),Ma)}function ro(e){return eo(Gt(e))}function R(e){let t=Bt(Gt(e));if(!t)return null;let n=t.data;if(typeof n.domain!="string"||!n.domain)return null;let r=typeof n.image_provider=="string"?n.image_provider:void 0,o=typeof n.cms=="string"?n.cms:void 0,i=o&&Ua.has(o)?o:void 0,s=typeof n.instal ...
16`)}function Ga(e){let t={domain:e.domain,site_type:e.site_type,language:e.language,initialized_at:e.initialized_at,seoagent_version:e.seoagent_version};return e.skill_version&&(t.skill_version=e.skill_version),e.install_id&&(t.install_id=e.install_id),e.image_provider&&(t.image_provider=e.image_provider),e.cms&&(t.cms=e.cms),e.blog_path&&(t.blog_path=e.blog_path),t}function oo(e,t){let n=it(e);to(n,{recursive:!0});let r=Rn(Ga(t),Ba(t));no(Gt(e),r,"utf-8")}function J(e,t){let n=Gt(e);if(!eo(n))return!1;let r=pe(Da(n,"utf-8")),o={...r.data,...t};return no(n,Rn(o,r.body),"utf-8"),!0}function io(e ...
17`,"utf-8");try{qa(de,384)}catch{}}function lo(){if(!ao(de))return!1;try{return za(de),!0}catch{return!1}}var Ya=new Set([502,503,504]),Ja=1e4;async function P(e,t,n={}){let r=Math.max(1,n.attempts??3),o=Math.max(0,n.baseDelayMs??500),i=n.timeoutMs??Ja,s=n.fetchImpl??fetch,a=n.sleep??Xa,c=n.transientStatuses??Ya,u=null;for(let d=0;d<r;d++){let{init:p,cleanup:f}=Qa(t,i);try{let g=await s(e,p);if(c.has(g.status)&&d<r-1){await a(uo(o,d));continue}return g}catch(g){if(u=g,d<r-1){await a(uo(o,d));continue}}finally{f()}}throw u instanceof Error?u:new Error(String(u))}function uo(e,t){return e*Math.po ...
18`,"utf-8"),{file:t,added:o||s}}function So(e){let t=De(e,Nt);if(!Vt(t))return!1;let n=jn(t).hooks;return n?vo.some(r=>{let o=n[r];return Array.isArray(o)&&o.some(i=>i.hooks?.some(Nn))}):!1}function xo(e){let t=De(e,Nt);if(!Vt(t))return{file:t,removed:!1};let n=jn(t),r=n.hooks;if(!r)return{file:t,removed:!1};let o=!1;for(let i of vo){let s=r[i];if(!Array.isArray(s))continue;for(let c of s){let u=c.hooks.length;c.hooks=c.hooks.filter(d=>!Nn(d)),c.hooks.length!==u&&(o=!0)}let a=s.filter(c=>c.hooks.length>0);a.length===0?delete r[i]:r[i]=a}return o?(Object.keys(r).length===0&&delete n.hooks,zt(t,J ...
19`,"utf-8"),{file:t,removed:!0}):{file:t,removed:!1}}import{existsSync as _o,mkdirSync as fc,readFileSync as mc,writeFileSync as gc}from"fs";import{join as hc}from"path";function Co(e){return _o(hc(e,b,"project.md"))}function Eo(){try{if(!_o(Ut))return[];let e=JSON.parse(mc(Ut,"utf-8"));return Array.isArray(e.projects)?e.projects.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function Ro(e){try{fc(W,{recursive:!0}),gc(Ut,JSON.stringify({projects:e},null,2)+`
20`,"utf-8")}catch{}}function ve(e){try{if(!Co(e))return;let t=Eo();if(t.includes(e))return;t.push(e),Ro(t)}catch{}}function Ao(){let e=Eo(),t=e.filter(Co);return t.length!==e.length&&Ro(t),t}import{readFileSync as kc,writeFileSync as $c,existsSync as vc}from"fs";import{join as Oo}from"path";function Io(e){let t={business:{},writingInstructions:[],referenceUrls:[],topicsToAvoid:[],contentTone:null,additionalNotes:null},n=yc(e);for(let[r,o]of n){let i=r.toLowerCase().trim();i==="business context"?t.business=wc(o):i==="writing instructions"?t.writingInstructions=Po(o):i==="reference urls"?t.refere ...
21`)}function yc(e){let t=e.split(`
22`),n=[],r="",o=[];for(let i of t){let s=i.match(/^#\s+(.+)$/);s?(r&&n.push([r,o.join(`
23`)]),r=s[1],o=[]):o.push(i)}return r&&n.push([r,o.join(`
24`)]),n}function wc(e){let t={},n=e.split(`
25`);for(let r of n){let o=r.match(/^[-*]\s+\*\*(.+?):\*\*\s*(.*)$/);if(o){let i=o[1].toLowerCase().trim(),s=o[2].trim();s&&(t[i]=s)}}return t}function Po(e){let t=[],n=e.split(`
26`);for(let r of n){let o=r.match(/^[-*]\s+(.+)$/);if(o){let i=o[1].trim();(!i.startsWith("(")||!i.endsWith(")"))&&t.push(i)}}return t}function bc(e){let t=[],n=e.split(`
27`);for(let r of n){let o=r.match(/^[-*]\s+(https?:\/\/\S+)(?:\s+[—–-]\s+(.+))?$/);o&&t.push({url:o[1].trim(),description:o[2]?.trim()||""})}return t}var Lo="context.md";function Yt(e){let t=Oo(e,".seoagent",Lo);if(!vc(t))return null;let n=kc(t,"utf-8");return Io(n)}function Sc(e,t){let n=Oo(e,".seoagent",Lo),r=To(t);$c(n,r,"utf-8")}function jo(e,t){Sc(e,{business:{type:t||""},writingInstructions:[],referenceUrls:[],topicsToAvoid:[],contentTone:null,additionalNotes:null})}import{existsSync as at,readFileSync as No,readdirSync as xc,statSync as Do}from"fs";import{join as Se}from"path";var _c=[{c ...
HighSandbox Evasion Gated Capability
Source gates dangerous network, credential, or execution behavior behind CI, host, platform, time, or geo fingerprint checks.
index.jsView on unpkg · L8 28`),n=["# Pages","","Inventory of pages discovered in your codebase. Re-running `seoagent init`","or `seoagent refresh` re-scans and merges in newly-added pages without","touching rows you or the audit have edited. `In sitemap` is refreshed from","the live sitemap; `Status` / `Rendered` / `Word count` are filled by","`seoagent refresh --crawl` (a live fetch of each page). This file syncs to","the cloud on login."].join(`
29`),r="| URL | In sitemap | In nav | Status | Rendered | Word count | Notes |",o="|---|---|---|---|---|---|---|",i=e.map(s=>`| ${s.url} | ${s.in_sitemap} | ${s.in_nav} | ${s.status} | ${s.rendered} | ${s.word_count} | ${s.notes} |`);return[t,"",n,"",r,o,...i,""].join(`
30`)}function ul(e){let t=new Map,n;try{n=al(e,"utf-8")}catch{return t}let r=n.split(/\r?\n/);for(let o=0;o<r.length-1;o++){if(!Wn(r[o])||!dl(r[o+1]))continue;let i=Zo(r[o]).map(a=>a.toLowerCase()),s={url:i.findIndex(a=>a.includes("url")),in_sitemap:i.findIndex(a=>a.includes("sitemap")),in_nav:i.findIndex(a=>a.includes("nav")),status:i.findIndex(a=>a.includes("status")||a.includes("http")),rendered:i.findIndex(a=>a.includes("render")),word_count:i.findIndex(a=>a.includes("word")),notes:i.findIndex(a=>a.includes("note"))};if(s.url===-1)return t;for(let a=o+2;a<r.length&&Wn(r[a]);a++){let c=Zo(r[a ...
31`))}import{existsSync as ai}from"fs";import{intro as bl,outro as kl,confirm as $l,isCancel as vl,cancel as Sl}from"@clack/prompts";import{existsSync as tn,rmSync as wl}from"fs";import{join as nn}from"path";function ii(
32`);if(!r){bl("SEOAgent \u2014 uninstall"),l.message(`This will remove:
33${o}`);let s=await $l({message:"Remove these and start fresh?"});if(vl(s)||!s){Sl("Cancelled \u2014 nothing was removed.");return}}si(t,n);let i=n.map(s=>` \u2713 ${s.label}`).join(`
34`);r?l.success(`Removed:
36${i}`),!e.global&&ai(W)&&l.info("Your seoagent.com login (~/.config/seoagent/) was kept \u2014 it is shared across projects. Run `uninstall --global` to wipe it too."),l.info(`Re-install any time with \`${m("init")}\`.`)}import C from"picocolors";import{existsSync as pt,readdirSync as Kn,statSync as xl,readFileSync as ci}from"fs";import{join as He}from
37`)}function Ol(e,t){if(!t)return me.dim(`\u250C${"\u2500".repeat(e-2)}\u2510`);let n=ui(t),r=e-5-n;return r<1?me.dim(`\u250C${"\u2500".repeat(e-2)}\u2510`):`${me.dim("\u250C\u2500 ")}${t}${me.dim(` ${"\u2500".repeat(r)}\u2510`)}`}function Ll(e,t){let n=ui(e),r;return n<=t?r=e+" ".repeat(t-n):r=e,`${me.dim("\u2502")} ${r} ${me.dim("\u2502")}`}function qn(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<60)return`${n} minutes ago`;let r=Math.floor(n/60);return r<24?`
38
CriticalSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution with blocking evidence.
index.jsView on unpkg · L26 CriticalTrigger Reachable Dangerous Capability
A package entrypoint or install-time lifecycle script reaches a source file with blocking dangerous behavior.
index.jsView on unpkg · L26 HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
index.jsView on unpkg · L26 39Live: ${e.canonical}`:"",o=[`# ${e.title}`,"",`Tracked record \u2014 this article is **${e.status}** and ${n}.`,"This is a pointer so the cloud dashboard can track it without duplicating","the body. Edit the source file to change the article."+r,""].join(`
44`}function yi(e,t){let n=qe(e,b,"content"),r=Vn(n),o=new Set;for(let c of r)c.source==="repo"&&c.repo_path&&o.add(uu(c.repo_path));if(o.size===0)return{tracked:[]};let i=[...o].
46action_type: ${e.action_type}
50created_at: ${e.created_at}
53# Prune action \u2014 ${o??`article ${n}`}
55SEOAgent's auto-prune determined that this article should be removed from
56your repo. The cloud has already marked it pruned in your dashboard and
Long lines were clipped for display.