Lines 1-56javascript
2import{Command as If}from"commander";import{dirname as Ao,relative as Gt}from"path";import{intro as hc,outro as yc,text as Co,select as En,spinner as wc,isCancel as je,cancel as Ne,confirm as kc}from"@clack/prompts";var Ee=[".env.local",".env.production",".env"],Sr=["NEXT_PUBLIC_SITE_URL","SITE_URL","NEXT_PUBLIC_URL","NEXTAUTH_URL","VITE_SITE_URL"];var ne="@seoagent-official/seoagent",_t=`${ne}@latest`;import{homedir as Ns}from"os";import{join as Re}from"path";var k=".seoagent",vr=["audit","strategy/clusters","briefs","content","content/images","performance"],ge={AGENTS:".agents/skills/seoagen ...
5!content/images/.gitkeep
9`,Ds=process.env.XDG_CONFIG_HOME&&process.env.XDG_CONFIG_HOME.trim().length>0?process.env.XDG_CONFIG_HOME:Re(Ns(),".config"),B=Re(Ds,"seoagent"),se=Re(B,"auth.json"),pn=Re(B,"state"),Rt=Re(B,"update-check.json"),At=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,A={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 Fs}from"fs"; ...
10`),i=Ys(r),s=i.length>0?i[0].indent:0,[a]=Rr(i,0,s);return{data:a,body:o}}function It(e){if(!Hs(e))return null;try{return ae(Ks(e,"utf-8"))}catch{return null}}function zs(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 Ar(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}:`),Ar(i,t+1,n)):n.push(`${r}${o}: ${zs(i)}`))}function mn(e,t=""){let ...
15`)}var Qs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function hn(){return Js()}var Xs=new Set(["strapi","wordpress","sanity","contentful","ghost","webflow","shopify","payload","directus","mdx-local","none"]),Zs="project.md";function ze(e){return gn(e,k)}function Tt(e){return gn(ze(e),Zs)}function Or(e){return Pr(Tt(e))}function _(e){let t=It(Tt(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&&Xs.has(o)?o:void 0,s=typeof n.instal ...
16`)}function ta(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 jr(e,t){let n=ze(e);Ir(n,{recursive:!0});let r=mn(ta(t),ea(t));Tr(Tt(e),r,"utf-8")}function z(e,t){let n=Tt(e);if(!Pr(n))return!1;let r=ae(Vs(n,"utf-8")),o={...r.data,...t};return Tr(n,mn(o,r.body),"utf-8"),!0}function Nr(e ...
17`,"utf-8"),{file:t,added:o||s}}function qr(e){let t=Ie(e,Ct);if(!Nt(t))return!1;let n=wn(t).hooks;return n?Kr.some(r=>{let o=n[r];return Array.isArray(o)&&o.some(i=>i.hooks?.some(kn))}):!1}function Yr(e){let t=Ie(e,Ct);if(!Nt(t))return{file:t,removed:!1};let n=wn(t),r=n.hooks;if(!r)return{file:t,removed:!1};let o=!1;for(let i of Kr){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=>!kn(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,jt(t,J ...
18`,"utf-8"),{file:t,removed:!0}):{file:t,removed:!1}}import{existsSync as zr,mkdirSync as fa,readFileSync as ma,writeFileSync as ga}from"fs";import{join as ha}from"path";function Jr(e){return zr(ha(e,k,"project.md"))}function Vr(){try{if(!zr(At))return[];let e=JSON.parse(ma(At,"utf-8"));return Array.isArray(e.projects)?e.projects.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function Qr(e){try{fa(B,{recursive:!0}),ga(At,JSON.stringify({projects:e},null,2)+`
19`,"utf-8")}catch{}}function ye(e){try{if(!Jr(e))return;let t=Vr();if(t.includes(e))return;t.push(e),Qr(t)}catch{}}function Xr(){let e=Vr(),t=e.filter(Jr);return t.length!==e.length&&Qr(t),t}import{readFileSync as ba,writeFileSync as $a,existsSync as Sa}from"fs";import{join as no}from"path";function eo(e){let t={business:{},writingInstructions:[],referenceUrls:[],topicsToAvoid:[],contentTone:null,additionalNotes:null},n=ya(e);for(let[r,o]of n){let i=r.toLowerCase().trim();i==="business context"?t.business=wa(o):i==="writing instructions"?t.writingInstructions=Zr(o):i==="reference urls"?t.refere ...
20`)}function ya(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 wa(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 ka(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 ro="context.md";function Dt(e){let t=no(e,".seoagent",ro);if(!Sa(t))return null;let n=ba(t,"utf-8");return eo(n)}function va(e,t){let n=no(e,".seoagent",ro),r=to(t);$a(n,r,"utf-8")}function oo(e,t){va(e,{business:{type:t||""},writingInstructions:[],referenceUrls:[],topicsToAvoid:[],contentTone:null,additionalNotes:null})}import{existsSync as Ve,readFileSync as io,readdirSync as xa,statSync as so}from"fs";import{join as we}from"path";var _a=[{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 mc(e){let t=new Map,n;try{n=dc(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 Oo}from"fs";import{intro as vc,outro as xc,confirm as _c,isCancel as Cc,cancel as Ec}from"@clack/prompts";import{existsSync as Wt,rmSync as Sc}from"fs";import{join as Ht}from"path";function Io(e,t={}){let n=[],r=Ht(e,k);Wt(r)&&n.push({label:".seoagent/ \u2014 project state + all generated work",path:r,kind:"dir"});let o=Ht(e,ge.CLAUDE);Wt(o)&&n.push({label:".claude/skills/seoagent/ \u2014 installed skill bundle",path:o,kind:"dir"});let i=Ht(e,ge.AGENTS);return Wt(i)&&n.push({label:".agents/skills/seoagent/ \u2014 installed skill bundle",path:i,kind:"dir"}),qr(e)&&n.pus ...
31`);if(!r){vc("SEOAgent \u2014 uninstall"),l.message(`This will remove:
32${o}`);let s=await _c({message:"Remove these and start fresh?"});if(Cc(s)||!s){Ec("Cancelled \u2014 nothing was removed.");return}}To(t,n);let i=n.map(s=>` \u2713 ${s.label}`).join(`
33`);r?l.success(`Removed:
35${i}`),!e.global&&Oo(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 \`${m("init")}\`.`)}import v from"picocolors";import{existsSync as jo,mkdirSync as Lo,readFileSync as Rc,writeFileSync as
36`,"utf-8");try{Pc(se,384)}catch{}}function Do(){if(!jo(se))return!1;try{return Ic(se),!0}catch{return!1}}import{existsSync as tt,readdirSync as Rn,statSync as Oc,readFileSync as Fo}from"fs";import{join as De}from"path";function Lc(e){let t=(e.match(/^\s*-\s+\[\s\]/gm)??[]).length,n=(e.match(/^\s*-\s+\[x\]/gim)??[]).length;return{open:t,done:n}}function jc(e){let t=De(e,"audit","latest.md");if(!tt(t))return null;let n=It(t);if(!n)return null;let r=Fo(t,"utf-8"),o=Lc(r);return{exists:!0,date:typeof n.data.audited_at=="string"?n.data.audited_at:void 0,issueCount:o.open}}function Nc(e){try{let n=F ...
37`)}function Gc(e,t){if(!t)return le.dim(`\u250C${"\u2500".repeat(e-2)}\u2510`);let n=Mo(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 Yo(e,t){let n=Ue(e,k,"content"),r=In(n),o=new Set;for(let c of r)c.source==="repo"&&c.repo_path&&o.add(kl(c.repo_path));if(o.size===0)return{tracked:[]};let i=[...o].flatMap(c=>Pn(e,c)),s=Tn(i,r,On(e));if(s.toTrack.length===0)return{tracked:[]};yl(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()});wl(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.