Lines 1-56javascript
2import{Command as ef}from"commander";import{dirname as _o,relative as Mt}from"path";import{intro as tc,outro as nc,text as So,select as xn,spinner as rc,isCancel as je,cancel as Ne,confirm as oc}from"@clack/prompts";var Ee=[".env.local",".env.production",".env"],yr=["NEXT_PUBLIC_SITE_URL","SITE_URL","NEXT_PUBLIC_URL","NEXTAUTH_URL","VITE_SITE_URL"];var ne="@seoagent-official/seoagent",xt=`${ne}@latest`;import{homedir as $s}from"os";import{join as Re}from"path";var w=".seoagent",wr=["audit","strategy/clusters","briefs","content","content/images","performance"],ge={AGENTS:".agents/skills/seoagen ...
5!content/images/.gitkeep
9`,Ss=process.env.XDG_CONFIG_HOME&&process.env.XDG_CONFIG_HOME.trim().length>0?process.env.XDG_CONFIG_HOME:Re($s(),".config"),B=Re(Ss,"seoagent"),se=Re(B,"auth.json"),ln=Re(B,"state"),Et=Re(B,"update-check.json"),Rt=Re(B,"projects.json");var Ye="https://seoagent.com",Ae=process.env.SEOAGENT_API_BASE&&process.env.SEOAGENT_API_BASE.trim().length>0?process.env.SEOAGENT_API_BASE.replace(/\/$/,""):Ye,R={BASE:Ae,PRICING:`${Ae}/pricing`,LEAD_API:`${Ae}/api/cli/lead`,CLI_AUTH_PAGE:`${Ae}/cli/auth`,CLI_AUTH_POLL:`${Ae}/api/cli/auth/poll`,CLI_SYNC:`${Ae}/api/cli/sync`};import{readFileSync as vs}from"fs"; ...
10`),i=Ts(r),s=i.length>0?i[0].indent:0,[a]=vr(i,0,s);return{data:a,body:o}}function It(e){if(!As(e))return null;try{return ae(Is(e,"utf-8"))}catch{return null}}function Os(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 xr(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}:`),xr(i,t+1,n)):n.push(`${r}${o}: ${Os(i)}`))}function dn(e,t=""){let ...
15`)}var Ns=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function fn(){return Ls()}var Fs=new Set(["strapi","wordpress","sanity","contentful","ghost","webflow","shopify","payload","directus","mdx-local","none"]),Ds="project.md";function ze(e){return pn(e,w)}function Pt(e){return pn(ze(e),Ds)}function Rr(e){return _r(Pt(e))}function _(e){let t=It(Pt(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&&Fs.has(o)?o:void 0,s=typeof n.instal ...
16`)}function Ms(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 Ir(e,t){let n=ze(e);Cr(n,{recursive:!0});let r=dn(Ms(t),Us(t));Er(Pt(e),r,"utf-8")}function z(e,t){let n=Pt(e);if(!_r(n))return!1;let r=ae(js(n,"utf-8")),o={...r.data,...t};return Er(n,dn(o,r.body),"utf-8"),!0}function Pr(e ...
17`,"utf-8"),{file:t,added:o||s}}function Br(e){let t=Pe(e,_t);if(!jt(t))return!1;let n=gn(t).hooks;return n?Mr.some(r=>{let o=n[r];return Array.isArray(o)&&o.some(i=>i.hooks?.some(hn))}):!1}function Gr(e){let t=Pe(e,_t);if(!jt(t))return{file:t,removed:!1};let n=gn(t),r=n.hooks;if(!r)return{file:t,removed:!1};let o=!1;for(let i of Mr){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=>!hn(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,Lt(t,J ...
18`,"utf-8"),{file:t,removed:!0}):{file:t,removed:!1}}import{existsSync as Wr,mkdirSync as Qs,readFileSync as Zs,writeFileSync as ea}from"fs";import{join as ta}from"path";function Hr(e){return Wr(ta(e,w,"project.md"))}function Kr(){try{if(!Wr(Rt))return[];let e=JSON.parse(Zs(Rt,"utf-8"));return Array.isArray(e.projects)?e.projects.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function qr(e){try{Qs(B,{recursive:!0}),ea(Rt,JSON.stringify({projects:e},null,2)+`
19`,"utf-8")}catch{}}function ye(e){try{if(!Hr(e))return;let t=Kr();if(t.includes(e))return;t.push(e),qr(t)}catch{}}function Yr(){let e=Kr(),t=e.filter(Hr);return t.length!==e.length&&qr(t),t}import{readFileSync as ia,writeFileSync as sa,existsSync as aa}from"fs";import{join as Xr}from"path";function Jr(e){let t={business:{},writingInstructions:[],referenceUrls:[],topicsToAvoid:[],contentTone:null,additionalNotes:null},n=na(e);for(let[r,o]of n){let i=r.toLowerCase().trim();i==="business context"?t.business=ra(o):i==="writing instructions"?t.writingInstructions=zr(o):i==="reference urls"?t.refere ...
20`)}function na(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 ra(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 zr(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 oa(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 Zr(e){let t=Xr(e,".seoagent",Qr);if(!aa(t))return null;let n=ia(t,"utf-8");return Jr(n)}function ca(e,t){let n=Xr(e,".seoagent",Qr),r=Vr(t);sa(n,r,"utf-8")}function eo(e,t){ca(e,{business:{type:t||""},writingInstructions:[],referenceUrls:[],topicsToAvoid:[],contentTone:null,additionalNotes:null})}import{existsSync as Ve,readFileSync as to,readdirSync as la,statSync as no}from"fs";import{join as we}from"path";var ua=[{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 Za(e){let t=new Map,n;try{n=Va(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 Ao}from"fs";import{intro as cc,outro as lc,confirm as uc,isCancel as dc,cancel as pc}from"@clack/prompts";import{existsSync as Bt,rmSync as ac}from"fs";import{join as Gt}from"path";function Eo(e,t={}){let n=[],r=Gt(e,w);Bt(r)&&n.push({label:".seoagent/ \u2014 project state + all generated work",path:r,kind:"dir"});let o=Gt(e,ge.CLAUDE);Bt(o)&&n.push({label:".claude/skills/seoagent/ \u2014 installed skill bundle",path:o,kind:"dir"});let i=Gt(e,ge.AGENTS);return Bt(i)&&n.push({label:".agents/skills/seoagent/ \u2014 installed skill bundle",path:i,kind:"dir"}),Br(e)&&n.pus ...
31`);if(!r){cc("SEOAgent \u2014 uninstall"),l.message(`This will remove:
32${o}`);let s=await uc({message:"Remove these and start fresh?"});if(dc(s)||!s){pc("Cancelled \u2014 nothing was removed.");return}}Ro(t,n);let i=n.map(s=>` \u2713 ${s.label}`).join(`
33`);r?l.success(`Removed:
35${i}`),!e.global&&Ao(B)&&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 Po,mkdirSync as Io,readFileSync as fc,writeFileSync as
36`,"utf-8");try{gc(se,384)}catch{}}function Oo(){if(!Po(se))return!1;try{return hc(se),!0}catch{return!1}}import{existsSync as tt,readdirSync as _n,statSync as wc,readFileSync as Lo}from"fs";import{join as Fe}from"path";function kc(e){let t=(e.match(/^\s*-\s+\[\s\]/gm)??[]).length,n=(e.match(/^\s*-\s+\[x\]/gim)??[]).length;return{open:t,done:n}}function bc(e){let t=Fe(e,"audit","latest.md");if(!tt(t))return null;let n=It(t);if(!n)return null;let r=Lo(t,"utf-8"),o=kc(r);return{exists:!0,date:typeof n.data.audited_at=="string"?n.data.audited_at:void 0,issueCount:o.open}}function $c(e){try{let n=L ...
37`)}function Ec(e,t){if(!t)return le.dim(`\u250C${"\u2500".repeat(e-2)}\u2510`);let n=No(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 Wo(e,t){let n=Ue(e,w,"content"),r=Rn(n),o=new Set;for(let c of r)c.source==="repo"&&c.repo_path&&o.add(ol(c.repo_path));if(o.size===0)return{tracked:[]};let i=[...o].flatMap(c=>En(e,c)),s=An(i,r,In(e));if(s.toTrack.length===0)return{tracked:[]};nl(n,{recursive:!0});let a=[];for(let c of s.toTrack){let u=lt({slug:c.slug,title:c.title,canonical:ct(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()});rl(Ue(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.