Lines 1-30javascript
1import {Flags,Args,Command,run,execute}from'@oclif/core';import fe,{Chalk}from'chalk';import*as G from'fs';import G__default,{readFileSync,writeFileSync,existsSync,mkdirSync,readdirSync,cpSync}from'fs';import*as Z from'path';import Z__default,{dirname,resolve,join,basename,isAbsolute}from'path';import*as He from'os';import He__default,{homedir}from'os';import {spawnSync,spawn,execFileSync}from'child_process';import*as Bs from'crypto';import {createHash,randomBytes}from'crypto';import*as Bi from'readline';import {createInterface}from'readline';import {findModel,Models,catalog,Model,createClient ...
3`}let l=r.enabled?r.hex(s):T=>T,c=t.reduce((T,L)=>Math.max(T,j(L)),0),d=o?j(o)+4:0,u=Math.max(c+n*2,d),p;e.width!==void 0?p=Math.min(e.width,a):p=Math.min(u+2,a);let m=p-2,f;if(o){let T=`${qo} ${o} `,L=j(T),ee=Math.max(0,m-L);f=l(_s+T+qo.repeat(ee)+Ss);}else f=l(_s+qo.repeat(m)+Ss);let h=l(Cu+qo.repeat(m)+Ru),g=m-n*2,w=[f];function S(T){let L=j(T),ee=Math.max(0,g-L);return l(Cs)+" ".repeat(n)+T+" ".repeat(ee)+" ".repeat(n)+l(Cs)}let N=S("");w.push(N);for(let T of t){let L=j(T)>g?qe(T,g):T;w.push(S(L));}return w.push(N),w.push(h),`${w.join(`
5`}var Eu="\u2500",$u="-",Rs=4;function Vo(t){let{color:e,label:r,plain:o=false}=t,n=t.width??zo(),i=o?$u:Eu;if(!r)return e.dim(i.repeat(n));let s=`${i.repeat(Rs)} `,a=" ",l=Rs+1+r.length+1,c=Math.max(0,n-l),d=i.repeat(c);return e.dim(s)+r+e.dim(a+d)}function Es(t,e,r){let o=j(t),n=Math.max(0,e-o);if(r==="right")return " ".repeat(n)+t;if(r==="center"){let i=Math.floor(n/2),s=n-i;return " ".repeat(i)+t+" ".repeat(s)}return t+" ".repeat(n)}function $s(t,e){let{columns:r,color:o,plain:n=false}=e,i=" ",s=r.map(h=>h.label??h.key),a=r.map((h,g)=>{let w=j(s[g]);for(let S of t){let N=String(S[h.key]?? ...
7`}let m=[c,u,...p],f=e.maxWidth??zo();return D(m,{color:o,padding:1,borderColor:e.borderColor,maxWidth:f})}function Pe(t){process.stdout.write(`${t}
8`);}function mt(t){process.stderr.write(`${t}
9`);}function Fu(t){let{color:e,quiet:r,debug:o,plainMode:n}=t;return {result(i){Pe(i);},info(i){if(r)return;let s=e.blue("i");mt(`${s} ${i}`);},success(i){if(r)return;let s=e.green("\u2713");mt(`${s} ${i}`);},error(i){let s=e.red("\u2717");mt(`${s} ${i}`);},debug(i){if(!o)return;let s=e.magenta("d");mt(`${s} ${i}`);},warn(i){if(r)return;let s=e.yellow("!");mt(`${s} ${i}`);},json(i){Pe(JSON.stringify(i,null,2));},table(i,s){if(n){s&&s.length>0&&Pe(s.join(" "));for(let u of i)Pe(u.join(" "));return}let a=s?[s,...i]:i,l=a.reduce((u,p)=>Math.max(u,p.length),0),c=Array(l).fill(0);for(let u of a)for ...
10`).find(m=>m.includes(`gen-ai-${n}${i}`))?.trim().split(/\s+/)[0];if(!d)return G.unlinkSync(a),{updated:false,oldVersion:t,newVersion:o,message:`Could not find checksum for ${n} in checksums.txt`};let u=Nu(a);if(u!==d)return G.unlinkSync(a),{updated:false,oldVersion:t,newVersion:o,message:`Checksum mismatch. Expected ${d}, got ${u}.`};G.chmodSync(a,493);try{process.platform==="win32"?Lu(a):G.renameSync(a,process.execPath);}catch(m){let f=m instanceof Error?m.message:String(m);return G.existsSync(a)&&G.unlinkSync(a),{updated:false,oldVersion:t,newVersion:o,message:`Could not replace binary at $ ...
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
cli.jsView on unpkg · L1 HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
cli.jsView on unpkg · L1 11`);G.writeFileSync(e,r),spawn("cmd.exe",["/c",e],{detached:true,stdio:"ignore",windowsHide:true}).unref();}async function ju(){let t=await li(Pu);if(!t)return null;try{return JSON.parse(t).version??null}catch{return null}}function Gu(){try{let t=execFileSync("npm",["prefix","-g"],{encoding:"utf-8"}).trim();return G.accessSync(t,G.constants.W_OK),!0}catch{return false}}function Bu(){try{let t=execFileSync("npm",["ls","-g","@picsart/gen-ai","--json","--depth=0"],{encoding:"utf-8",timeout:1e4});return JSON.parse(t).dependencies?.["@picsart/gen-ai"]?.version??null}catch{return null}}async functio ...
12`);}var zu="https://registry.npmjs.org/@picsart/gen-ai/latest",qu=`${process.env.GEN_AI_BASE_URL??"https://picsart.com/gen-ai-cli/releases"}/latest.txt`,Vu="update-check.json",Ku=1440*60*1e3,zs=3e3,Hu=500,Mr="",en=null;function Vs(){return Z.join(ie(),Vu)}function Ju(){try{let t=G.readFileSync(Vs(),"utf-8"),e=JSON.parse(t);return e.lastCheck&&e.latestVersion?e:null}catch{return null}}function Zu(t){try{Te(),G.writeFileSync(Vs(),JSON.stringify({lastCheck:new Date().toISOString(),latestVersion:t},null,2));}catch{}}function Yu(t,e){let r=c=>c.split("-")[0].split(".").map(Number),[o,n,i]=r(t),[s,a ...
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
cli.jsView on unpkg · L10 MediumInstall Persistence
Source writes installer persistence such as shell profile or service configuration.
cli.jsView on unpkg · L1 LowWeak Crypto
Package source references weak cryptographic algorithms.
cli.jsView on unpkg · L1 13${this.fieldErrors.map(({field:r,message:o})=>` - ${r}: ${o}`).join(`
14`)}`}};var nn="#E859B4",Qu="#BD99F8";var gt={prefix:fe.hex(nn)("?"),style:{highlight:t=>fe.hex(Qu)(t),help:t=>fe.hex("#7A7A7A")(t),description:t=>fe.hex("#7A7A7A")(t),keysHelpTip:t=>{let e=t.map(([o,n])=>`${fe.bold(o)} ${fe.dim(n)}`).join(fe.dim(" \xB7 ")),r=`${fe.bold("esc")} ${fe.dim("back")} \xB7 ${fe.bold("\u2303C")} ${fe.dim("cancel")}`;return `${e} ${fe.dim("\xB7")} ${r}`}}};async function zt(t){try{return await t()}catch(e){throw e!=null&&typeof e=="object"&&"name"in e&&e.name==="ExitPromptError"?new b("USER_CANCEL"):e}}var Js=["
15`);}function Ys(t,e=false){if(e)return;let r=Ie(),o=Models.list().filter(g=>!g.disabled),n=new Set(o.map(g=>g.provider)).size;if((process.stdout.columns||80)<60){ae(),ae(` ${r.brand("Picsart gen-ai")} ${r.dim(`v${t}`)}`),ae(` ${r.dim(`${o.length} models \xB7 ${n} providers`)}`),ae();return}let s=r.hex(nn),a=r.hex(nn),l=[...Js,"",...Zs],c=Math.max(...l.map(g=>g.length)),d=[` v${t}`,` ${o.length} models \xB7 ${n} providers`],u=Math.max(c,...d.map(g=>g.length))+2,p=a(`\u250C${"\u2500".repeat(u)}\u2510`),m=a(`\u2514${"\u2500".repeat(u)}\u2518`),f=a("\u2502")+" ".repeat(u)+a("\u2502"),h=(g,w)=> ...
16<html><head><meta charset="utf-8"><title>gen-ai \u2014 Login Successful</title>
18 body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
19 background: #0d1117; color: #e1e4ed; display: flex; align-items: center; justify-content: center;
20 min-height: 100vh; margin: 0; }
21 .card { text-align: center; padding: 48px; border-radius: 16px; background: #1a1d27;
22 border: 1px solid #2d3148; max-width: 420px; }
23 .check { font-size: 48px; margin-bottom: 16px; }
24 h1 { font-size: 22px; margin: 0 0 8px; background: linear-gradient(135deg, #E859B4, #BD99F8, #9A1A89);
25 -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
26 p { color: #8b8fa7; font-size: 14px; line-height: 1.6; margin: 0; }
27 .hint { margin-top: 20px; font-size: 12px; color: #555; }
29<script>setTimeout(() => window.close(), 3000)</script>
Long lines were clipped for display.