Lines 1-56javascript
2import{Command as wp}from"commander";import{dirname as wo,relative as Nt}from"path";import{intro as Fa,outro as Da,text as go,select as bn,spinner as Ua,isCancel as Te,cancel as je,confirm as Ma}from"@clack/prompts";var _e=[".env.local",".env.production",".env"],ur=["NEXT_PUBLIC_SITE_URL","SITE_URL","NEXT_PUBLIC_URL","NEXTAUTH_URL","VITE_SITE_URL"];var te="@seoagent-official/seoagent",bt=`${te}@latest`;import{homedir as rs}from"os";import{join as Ce}from"path";var w=".seoagent",dr=["audit","strategy/clusters","briefs","content","content/images","performance"],ge={AGENTS:".agents/skills/seoagen ...
5!content/images/.gitkeep
9`,os=process.env.XDG_CONFIG_HOME&&process.env.XDG_CONFIG_HOME.trim().length>0?process.env.XDG_CONFIG_HOME:Ce(rs(),".config"),M=Ce(os,"seoagent"),ie=Ce(M,"auth.json"),rn=Ce(M,"state"),vt=Ce(M,"update-check.json"),xt=Ce(M,"projects.json");var qe="https://seoagent.com",Ee=process.env.SEOAGENT_API_BASE&&process.env.SEOAGENT_API_BASE.trim().length>0?process.env.SEOAGENT_API_BASE.replace(/\/$/,""):qe,A={BASE:Ee,PRICING:`${Ee}/pricing`,LEAD_API:`${Ee}/api/cli/lead`,CLI_AUTH_PAGE:`${Ee}/cli/auth`,CLI_AUTH_POLL:`${Ee}/api/cli/auth/poll`,CLI_SYNC:`${Ee}/api/cli/sync`};import{readFileSync as is}from"fs"; ...
10`),i=ms(r),s=i.length>0?i[0].indent:0,[a]=hr(i,0,s);return{data:a,body:o}}function Ct(e){if(!ds(e))return null;try{return se(ps(e,"utf-8"))}catch{return null}}function gs(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 yr(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}:`),yr(i,t+1,n)):n.push(`${r}${o}: ${gs(i)}`))}function sn(e,t=""){let ...
15`)}var ws=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function cn(){return hs()}var ks=new Set(["strapi","wordpress","sanity","contentful","ghost","webflow","shopify","payload","directus","mdx-local","none"]),bs="project.md";function He(e){return an(e,w)}function Et(e){return an(He(e),bs)}function $r(e){return wr(Et(e))}function _(e){let t=Ct(Et(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&&ks.has(o)?o:void 0,s=typeof n.instal ...
16`)}function Ss(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 vr(e,t){let n=He(e);kr(n,{recursive:!0});let r=sn(Ss(t),$s(t));br(Et(e),r,"utf-8")}function z(e,t){let n=Et(e);if(!wr(n))return!1;let r=se(ys(n,"utf-8")),o={...r.data,...t};return br(n,sn(o,r.body),"utf-8"),!0}function xr(e ...
17`,"utf-8"),{file:t,added:o||s}}function jr(e){let t=Re(e,$t);if(!Pt(t))return!1;let n=un(t).hooks;return n?Tr.some(r=>{let o=n[r];return Array.isArray(o)&&o.some(i=>i.hooks?.some(dn))}):!1}function Lr(e){let t=Re(e,$t);if(!Pt(t))return{file:t,removed:!1};let n=un(t),r=n.hooks;if(!r)return{file:t,removed:!1};let o=!1;for(let i of Tr){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=>!dn(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,It(t,J ...
18`,"utf-8"),{file:t,removed:!0}):{file:t,removed:!1}}import{existsSync as Nr,mkdirSync as js,readFileSync as Ls,writeFileSync as Ns}from"fs";import{join as Fs}from"path";function Fr(e){return Nr(Fs(e,w,"project.md"))}function Dr(){try{if(!Nr(xt))return[];let e=JSON.parse(Ls(xt,"utf-8"));return Array.isArray(e.projects)?e.projects.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function Ur(e){try{js(M,{recursive:!0}),Ns(xt,JSON.stringify({projects:e},null,2)+`
19`,"utf-8")}catch{}}function ye(e){try{if(!Fr(e))return;let t=Dr();if(t.includes(e))return;t.push(e),Ur(t)}catch{}}function Mr(){let e=Dr(),t=e.filter(Fr);return t.length!==e.length&&Ur(t),t}import{readFileSync as Bs,writeFileSync as Ws,existsSync as Gs}from"fs";import{join as Kr}from"path";function Wr(e){let t={business:{},writingInstructions:[],referenceUrls:[],topicsToAvoid:[],contentTone:null,additionalNotes:null},n=Ds(e);for(let[r,o]of n){let i=r.toLowerCase().trim();i==="business context"?t.business=Us(o):i==="writing instructions"?t.writingInstructions=Br(o):i==="reference urls"?t.refere ...
20`)}function Ds(e){let t=e.split(`
21`),n=[],r="",o=[];for(let i of t){let s=i.match(/^#\s+(.+)$/);s?(r&&n.push([r,o.join(`
22`)]),r=s[1],o=[]):o.push(i)}return r&&n.push([r,o.join(`
23`)]),n}function Us(e){let t={},n=e.split(`
24`);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 Br(e){let t=[],n=e.split(`
25`);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 Ms(e){let t=[],n=e.split(`
26`);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 qr="context.md";function Hr(e){let t=Kr(e,".seoagent",qr);if(!Gs(t))return null;let n=Bs(t,"utf-8");return Wr(n)}function Ks(e,t){let n=Kr(e,".seoagent",qr),r=Gr(t);Ws(n,r,"utf-8")}function Yr(e,t){Ks(e,{business:{type:t||""},writingInstructions:[],referenceUrls:[],topicsToAvoid:[],contentTone:null,additionalNotes:null})}import{existsSync as ze,readFileSync as zr,readdirSync as qs,statSync as Vr}from"fs";import{join as we}from"path";var Hs=[{c ...
27`),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(`
28`),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(`
29`)}function La(e){let t=new Map,n;try{n=Oa(e,"utf-8")}catch{return t}let r=n.split(/\r?\n/);for(let o=0;o<r.length-1;o++){if(
30`))}import{existsSync as So}from"fs";import{intro as Ka,outro as qa,confirm as Ha,isCancel as Ya,cancel as za}from"@clack/prompts";import{existsSync as Ft,rmSync as Ga}from"fs";import{join as Dt}from"path";function bo(e,t={}){let n=[],r=Dt(e,w);Ft(r)&&n.push({label:".seoagent/ \u2014 project state + all generated work",path:r,kind:"dir"});let o=Dt(e,ge.CLAUDE);Ft(o)&&n.push({label:".claude/skills/seoagent/ \u2014 installed skill bundle",path:o,kind:"dir"});let i=Dt(e,ge.AGENTS);return Ft(i)&&n.push({label:".agents/skills/seoagent/ \u2014 installed skill bundle",path:i,kind:"dir"}),jr(e)&&n.pus ...
31`);if(!r){Ka("SEOAgent \u2014 uninstall"),l.message(`This will remove:
32${o}`);let s=await Ha({message:"Remove these and start fresh?"});if(Ya(s)||!s){za("Cancelled \u2014 nothing was removed.");return}}$o(t,n);let i=n.map(s=>` \u2713 ${s.label}`).join(`
33`);r?l.success(`Removed:
35${i}`),!e.global&&So(M)&&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 \`${f("init")}\`.`)}import v from"picocolors";import{existsSync as xo,mkdirSync as vo,readFileSync as Va,writeFileSync as
36`,"utf-8");try{Xa(ie,384)}catch{}}function Co(){if(!xo(ie))return!1;try{return Qa(ie),!0}catch{return!1}}import{existsSync as Qe,readdirSync as $n,statSync as ec,readFileSync as Eo}from"fs";import{join as Le}from"path";function tc(e){let t=(e.match(/^\s*-\s+\[\s\]/gm)??[]).length,n=(e.match(/^\s*-\s+\[x\]/gim)??[]).length;return{open:t,done:n}}function nc(e){let t=Le(e,"audit","latest.md");if(!Qe(t))return null;let n=Ct(t);if(!n)return null;let r=Eo(t,"utf-8"),o=tc(r);return{exists:!0,date:typeof n.data.audited_at=="string"?n.data.audited_at:void 0,issueCount:o.open}}function rc(e){try{let n=E ...
37`)}function lc(e,t){if(!t)return le.dim(`\u250C${"\u2500".repeat(e-2)}\u2510`);let n=Ro(t),r=e-5-n;return r<1?le.dim
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 · L25 CriticalTrigger Reachable Dangerous Capability
A package entrypoint or install-time lifecycle script reaches a source file with blocking dangerous behavior.
index.jsView on unpkg · L25 HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
index.jsView on unpkg · L25 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 No(e,t){let n=Fe(e,w,"content"),r=xn(n),o=new Set;for(let c of r)c.source==="repo"&&c.repo_path&&o.add(Mc(c.repo_path));if(o.size===0)return{tracked:[]};let i=[...o].flatMap(c=>vn(e,c)),s=_n(i,r,Cn(e));if(s.toTrack.length===0)return{tracked:[]};Dc(n,{recursive:!0});let a=[];for(let c of s.toTrack){let u=st({slug:c.slug,title:c.title,canonical:it(c.slug,{domain:t.domain,blogPath:t.blog_path}),status:"published",page_type:c.page_type,source:"repo",repo_path:c.path,tracked_at:new Date().toISOString()});Uc(Fe(n,`${c.slug}.md`),u,"utf-8"),a.push(c.slug)}return{tracked:a}}import{existsSyn ...
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.