@burtson-labs/bandit-stealth-cli 1.7.18 → 1.7.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -27,7 +27,7 @@ ${en.error}
|
|
|
27
27
|
|
|
28
28
|
The file was NOT written. Fix the \`find\`/\`replace\` values and retry.`,isError:!0}}try{await g.writeFile(ge,pt)}catch(en){return{output:`Error writing "${T}": ${en instanceof Error?en.message:String(en)}`,isError:!0}}let $e=pt.split(`
|
|
29
29
|
`).length-he.split(`
|
|
30
|
-
`).length,et=$e===0?"\xB10 lines":$e>0?`+${$e} lines`:`${$e} lines`;return{output:`Replaced ${ne&&De>1?`${De} occurrences`:"1 occurrence"} in ${T} (${et}). File saved. Do not restate the file contents \u2014 the user can see the diff. Move on to the next pending task or reply with a brief summary if the work is complete.`}}};gh.applyEditTool=lBe;function h2t(d,g){let T=g.split(`
|
|
30
|
+
`).length,et=$e===0?"\xB10 lines":$e>0?`+${$e} lines`:`${$e} lines`;return{output:`Replaced ${ne&&De>1?`${De} occurrences`:"1 occurrence"} in ${T} (${et}). File saved. Do not restate the file contents \u2014 the user can see the diff. Do not re-read this file just to make another edit \u2014 you already have the structure in context. Move on to the next pending task or reply with a brief summary if the work is complete.`}}};gh.applyEditTool=lBe;function h2t(d,g){let T=g.split(`
|
|
31
31
|
`,1)[0].trim();if(T.length<4)return"";let x=d.split(`
|
|
32
32
|
`).find(z=>z.trim()===T);if(!x||x===T)return"";let E=x.match(/^\s*/)?.[0]??"";return E?`Hint: the target line exists in the file but begins with "${E.replace(/\t/g,"\\t")}" whitespace \u2014 your \`find\` is missing that indent. `:""}t(h2t,"findIndentationHint");var uBe={name:"list_files",description:"List files matching a glob pattern. Searches the workspace root by default; pass an absolute `cwd` to list anywhere else on disk (user home, /tmp, etc). Returns a newline-separated list of file paths.",parameters:[{name:"pattern",description:'Glob pattern (e.g. "*.json", "src/**/*.ts", "**/*.md"). Use "*" to match everything in the target directory.',required:!0},{name:"cwd",description:'Directory to search in. Defaults to the workspace root. Accepts absolute paths like "/Users/name/Desktop" for listing folders outside the workspace (optional)'}],async execute(d,g){let T=d.pattern?.trim();if(!T)return{output:"Error: pattern parameter is required",isError:!0};let x=d.cwd?d.cwd.startsWith("/")?d.cwd:`${g.workspaceRoot}/${d.cwd}`:g.workspaceRoot;try{let E=await g.listFiles(T,x);if(!E.length)return{output:`No files matched pattern "${T}"`};let z=E.slice(0,200).join(`
|
|
33
33
|
`),Y=E.length>200?`
|
|
@@ -810,7 +810,7 @@ ${x}`;try{let he=await pe.run(x,d.chat,ge);_e("task:done",{goal:x,iterations:he.
|
|
|
810
810
|
`),x=g.split(`
|
|
811
811
|
`),E=T.length,z=x.length;if(E*z>4e4)return{plus:x.length,minus:T.length};let Y=Array.from({length:E+1},()=>new Array(z+1).fill(0));for(let De=1;De<=E;De++)for(let ne=1;ne<=z;ne++)Y[De][ne]=T[De-1]===x[ne-1]?Y[De-1][ne-1]+1:Math.max(Y[De-1][ne],Y[De][ne-1]);let _e=E,pe=z,ge=0,he=0;for(;_e>0&&pe>0;)T[_e-1]===x[pe-1]?(_e--,pe--):Y[_e][pe-1]>=Y[_e-1][pe]?(ge++,pe--):(he++,_e--);return ge+=pe,he+=_e,{plus:ge,minus:he}}t(cNt,"lineCountDiff");function lNt(d){if(d.isNewFile)return"(new file)";let g=d.after.split(`
|
|
812
812
|
`),T=d.before.split(`
|
|
813
|
-
`);for(let x=0;x<g.length;x++)if(g[x]!==T[x]){let E=(g[x]??"").trim();if(E)return E.length>80?E.slice(0,77)+"\u2026":E}return"(whitespace-only edit)"}t(lNt,"describeEdit");var ASe=class{static{t(this,"CheckpointStore")}constructor(g){this.counter=0,this.workspaceRoot=g.workspaceRoot,this.dir=RD.join(g.workspaceRoot,".bandit","checkpoints"),this.maxIndexEntries=g.maxIndexEntries??oNt}async create(g){await qw.promises.mkdir(RD.join(this.dir,g.turnId),{recursive:!0}),this.counter++;let T=`chk-${g.turnId.split("-").pop()??"x"}-${String(this.counter).padStart(3,"0")}`,x=RD.relative(this.workspaceRoot,g.absolutePath)||g.absolutePath,E=g.before.length===0,z={id:T,turnId:g.turnId,timestamp:Date.now(),tool:g.tool,path:g.absolutePath,relPath:x,before:g.before,after:g.after,isNewFile:E,iteration:g.iteration,description:lNt({before:g.before,after:g.after,isNewFile:E})},Y=RD.join(this.dir,g.turnId,`${T}.json`);return await qw.promises.writeFile(Y,JSON.stringify(z,null,2)),await this.appendToIndex(z),z}async list(g=20){return(await this.readIndex()).slice(0,g)}async get(g){let x=(await this.readIndex()).find(z=>z.id===g);if(!x)return null;let E=RD.join(this.dir,x.turnId,`${g}.json`);try{let z=await qw.promises.readFile(E,"utf-8");return JSON.parse(z)}catch{return null}}async rewind(g){let T=await this.get(g);if(!T)return null;try{return T.isNewFile?await qw.promises.unlink(T.path).catch(()=>{}):(await qw.promises.mkdir(RD.dirname(T.path),{recursive:!0}),await qw.promises.writeFile(T.path,T.before)),T}catch{return null}}async readIndex(){let g=RD.join(this.dir,EWe);try{let T=await qw.promises.readFile(g,"utf-8"),x=JSON.parse(T);return Array.isArray(x)?x:[]}catch{return[]}}async writeIndex(g){await qw.promises.mkdir(this.dir,{recursive:!0});let T=RD.join(this.dir,EWe);await qw.promises.writeFile(T,JSON.stringify(g,null,2))}async appendToIndex(g){let{plus:T,minus:x}=cNt(g.before,g.after),E={id:g.id,turnId:g.turnId,timestamp:g.timestamp,tool:g.tool,relPath:g.relPath,iteration:g.iteration,description:g.description,plus:T,minus:x},z=await this.readIndex();z.unshift(E);let Y=z.slice(0,this.maxIndexEntries);await this.writeIndex(Y)}};ek.CheckpointStore=ASe});var FSe=xi(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.CheckpointStore=Nl.isChatCapable=Nl.suggestOllamaMatch=Nl.listInstalledOllamaModels=Nl.previewText=Nl.openTurnLog=Nl.SessionPermissionStore=Nl.mergePolicies=Nl.emptyPolicy=Nl.evaluatePermission=Nl.buildTaskTool=Nl.buildWebFetchTool=Nl.buildTodoWriteTool=Nl.TodoStore=Nl.expandMentions=Nl.runHooks=Nl.persistAllowEntry=Nl.loadHookSettings=Nl.loadMemory=void 0;var uNt=cWe();Object.defineProperty(Nl,"loadMemory",{enumerable:!0,get:t(function(){return uNt.loadMemory},"get")});var NSe=uWe();Object.defineProperty(Nl,"loadHookSettings",{enumerable:!0,get:t(function(){return NSe.loadHookSettings},"get")});Object.defineProperty(Nl,"persistAllowEntry",{enumerable:!0,get:t(function(){return NSe.persistAllowEntry},"get")});Object.defineProperty(Nl,"runHooks",{enumerable:!0,get:t(function(){return NSe.runHooks},"get")});var _Nt=dWe();Object.defineProperty(Nl,"expandMentions",{enumerable:!0,get:t(function(){return _Nt.expandMentions},"get")});var ISe=gWe();Object.defineProperty(Nl,"TodoStore",{enumerable:!0,get:t(function(){return ISe.TodoStore},"get")});Object.defineProperty(Nl,"buildTodoWriteTool",{enumerable:!0,get:t(function(){return ISe.buildTodoWriteTool},"get")});Object.defineProperty(Nl,"buildWebFetchTool",{enumerable:!0,get:t(function(){return ISe.buildWebFetchTool},"get")});var fNt=vWe();Object.defineProperty(Nl,"buildTaskTool",{enumerable:!0,get:t(function(){return fNt.buildTaskTool},"get")});var EZ=bWe();Object.defineProperty(Nl,"evaluatePermission",{enumerable:!0,get:t(function(){return EZ.evaluatePermission},"get")});Object.defineProperty(Nl,"emptyPolicy",{enumerable:!0,get:t(function(){return EZ.emptyPolicy},"get")});Object.defineProperty(Nl,"mergePolicies",{enumerable:!0,get:t(function(){return EZ.mergePolicies},"get")});Object.defineProperty(Nl,"SessionPermissionStore",{enumerable:!0,get:t(function(){return EZ.SessionPermissionStore},"get")});var AWe=CWe();Object.defineProperty(Nl,"openTurnLog",{enumerable:!0,get:t(function(){return AWe.openTurnLog},"get")});Object.defineProperty(Nl,"previewText",{enumerable:!0,get:t(function(){return AWe.previewText},"get")});var OSe=wWe();Object.defineProperty(Nl,"listInstalledOllamaModels",{enumerable:!0,get:t(function(){return OSe.listInstalledOllamaModels},"get")});Object.defineProperty(Nl,"suggestOllamaMatch",{enumerable:!0,get:t(function(){return OSe.suggestOllamaMatch},"get")});Object.defineProperty(Nl,"isChatCapable",{enumerable:!0,get:t(function(){return OSe.isChatCapable},"get")});var pNt=DWe();Object.defineProperty(Nl,"CheckpointStore",{enumerable:!0,get:t(function(){return pNt.CheckpointStore},"get")})});var PZ=xi((mFt,dNt)=>{dNt.exports={name:"@burtson-labs/bandit-stealth-cli",version:"1.7.
|
|
813
|
+
`);for(let x=0;x<g.length;x++)if(g[x]!==T[x]){let E=(g[x]??"").trim();if(E)return E.length>80?E.slice(0,77)+"\u2026":E}return"(whitespace-only edit)"}t(lNt,"describeEdit");var ASe=class{static{t(this,"CheckpointStore")}constructor(g){this.counter=0,this.workspaceRoot=g.workspaceRoot,this.dir=RD.join(g.workspaceRoot,".bandit","checkpoints"),this.maxIndexEntries=g.maxIndexEntries??oNt}async create(g){await qw.promises.mkdir(RD.join(this.dir,g.turnId),{recursive:!0}),this.counter++;let T=`chk-${g.turnId.split("-").pop()??"x"}-${String(this.counter).padStart(3,"0")}`,x=RD.relative(this.workspaceRoot,g.absolutePath)||g.absolutePath,E=g.before.length===0,z={id:T,turnId:g.turnId,timestamp:Date.now(),tool:g.tool,path:g.absolutePath,relPath:x,before:g.before,after:g.after,isNewFile:E,iteration:g.iteration,description:lNt({before:g.before,after:g.after,isNewFile:E})},Y=RD.join(this.dir,g.turnId,`${T}.json`);return await qw.promises.writeFile(Y,JSON.stringify(z,null,2)),await this.appendToIndex(z),z}async list(g=20){return(await this.readIndex()).slice(0,g)}async get(g){let x=(await this.readIndex()).find(z=>z.id===g);if(!x)return null;let E=RD.join(this.dir,x.turnId,`${g}.json`);try{let z=await qw.promises.readFile(E,"utf-8");return JSON.parse(z)}catch{return null}}async rewind(g){let T=await this.get(g);if(!T)return null;try{return T.isNewFile?await qw.promises.unlink(T.path).catch(()=>{}):(await qw.promises.mkdir(RD.dirname(T.path),{recursive:!0}),await qw.promises.writeFile(T.path,T.before)),T}catch{return null}}async readIndex(){let g=RD.join(this.dir,EWe);try{let T=await qw.promises.readFile(g,"utf-8"),x=JSON.parse(T);return Array.isArray(x)?x:[]}catch{return[]}}async writeIndex(g){await qw.promises.mkdir(this.dir,{recursive:!0});let T=RD.join(this.dir,EWe);await qw.promises.writeFile(T,JSON.stringify(g,null,2))}async appendToIndex(g){let{plus:T,minus:x}=cNt(g.before,g.after),E={id:g.id,turnId:g.turnId,timestamp:g.timestamp,tool:g.tool,relPath:g.relPath,iteration:g.iteration,description:g.description,plus:T,minus:x},z=await this.readIndex();z.unshift(E);let Y=z.slice(0,this.maxIndexEntries);await this.writeIndex(Y)}};ek.CheckpointStore=ASe});var FSe=xi(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.CheckpointStore=Nl.isChatCapable=Nl.suggestOllamaMatch=Nl.listInstalledOllamaModels=Nl.previewText=Nl.openTurnLog=Nl.SessionPermissionStore=Nl.mergePolicies=Nl.emptyPolicy=Nl.evaluatePermission=Nl.buildTaskTool=Nl.buildWebFetchTool=Nl.buildTodoWriteTool=Nl.TodoStore=Nl.expandMentions=Nl.runHooks=Nl.persistAllowEntry=Nl.loadHookSettings=Nl.loadMemory=void 0;var uNt=cWe();Object.defineProperty(Nl,"loadMemory",{enumerable:!0,get:t(function(){return uNt.loadMemory},"get")});var NSe=uWe();Object.defineProperty(Nl,"loadHookSettings",{enumerable:!0,get:t(function(){return NSe.loadHookSettings},"get")});Object.defineProperty(Nl,"persistAllowEntry",{enumerable:!0,get:t(function(){return NSe.persistAllowEntry},"get")});Object.defineProperty(Nl,"runHooks",{enumerable:!0,get:t(function(){return NSe.runHooks},"get")});var _Nt=dWe();Object.defineProperty(Nl,"expandMentions",{enumerable:!0,get:t(function(){return _Nt.expandMentions},"get")});var ISe=gWe();Object.defineProperty(Nl,"TodoStore",{enumerable:!0,get:t(function(){return ISe.TodoStore},"get")});Object.defineProperty(Nl,"buildTodoWriteTool",{enumerable:!0,get:t(function(){return ISe.buildTodoWriteTool},"get")});Object.defineProperty(Nl,"buildWebFetchTool",{enumerable:!0,get:t(function(){return ISe.buildWebFetchTool},"get")});var fNt=vWe();Object.defineProperty(Nl,"buildTaskTool",{enumerable:!0,get:t(function(){return fNt.buildTaskTool},"get")});var EZ=bWe();Object.defineProperty(Nl,"evaluatePermission",{enumerable:!0,get:t(function(){return EZ.evaluatePermission},"get")});Object.defineProperty(Nl,"emptyPolicy",{enumerable:!0,get:t(function(){return EZ.emptyPolicy},"get")});Object.defineProperty(Nl,"mergePolicies",{enumerable:!0,get:t(function(){return EZ.mergePolicies},"get")});Object.defineProperty(Nl,"SessionPermissionStore",{enumerable:!0,get:t(function(){return EZ.SessionPermissionStore},"get")});var AWe=CWe();Object.defineProperty(Nl,"openTurnLog",{enumerable:!0,get:t(function(){return AWe.openTurnLog},"get")});Object.defineProperty(Nl,"previewText",{enumerable:!0,get:t(function(){return AWe.previewText},"get")});var OSe=wWe();Object.defineProperty(Nl,"listInstalledOllamaModels",{enumerable:!0,get:t(function(){return OSe.listInstalledOllamaModels},"get")});Object.defineProperty(Nl,"suggestOllamaMatch",{enumerable:!0,get:t(function(){return OSe.suggestOllamaMatch},"get")});Object.defineProperty(Nl,"isChatCapable",{enumerable:!0,get:t(function(){return OSe.isChatCapable},"get")});var pNt=DWe();Object.defineProperty(Nl,"CheckpointStore",{enumerable:!0,get:t(function(){return pNt.CheckpointStore},"get")})});var PZ=xi((mFt,dNt)=>{dNt.exports={name:"@burtson-labs/bandit-stealth-cli",version:"1.7.19",description:"Bandit \u2014 a local-first AI coding agent for your terminal. Same runtime as the Bandit Stealth VS Code / Cursor extension.",keywords:["ai","agent","cli","coding-agent","llm","ollama","local-first","bandit","burtson-labs","terminal","repl","developer-tools"],homepage:"https://burtson.ai",bugs:{email:"team@burtson.ai"},license:"MIT",author:{name:"Burtson Labs",email:"team@burtson.ai",url:"https://burtson.ai"},bin:{bandit:"./dist/cli.js"},main:"dist/cli.js",files:["dist/cli.js","README.md","LICENSE"],engines:{node:">=20"},publishConfig:{access:"public"},scripts:{typecheck:"tsc -p tsconfig.json --noEmit",build:"node build.mjs","build:publish":"node build.mjs --publish",dev:"node build.mjs --watch",start:"node dist/cli.js",smoke:"node build.mjs && node dist/__smoke__/smoke.js",integration:"node build.mjs && node dist/__integration__/ollama.js",eval:"node build.mjs && node dist/__eval__/eval.js",benchmark:"node build.mjs && node dist/__eval__/benchmark.js","gen-logo":"node scripts/gen-logo.mjs","preview-banner":"node scripts/preview-banner.mjs",clean:"rm -rf dist",prepack:"node scripts/prepack.mjs",postpack:"node scripts/postpack.mjs",prepublishOnly:"pnpm run clean && pnpm run typecheck && pnpm run build:publish"},dependencies:{"pdf-parse":"^2.4.5"},devDependencies:{"@burtson-labs/agent-core":"workspace:*","@burtson-labs/host-kit":"workspace:*","@burtson-labs/stealth-core-runtime":"workspace:*","@types/node":"^20.11.0","@types/pdf-parse":"^1.1.5","@types/pngjs":"^6.0.5",esbuild:"^0.28.0",pngjs:"^7.0.0",typescript:"^5.4.0"}}});var PNt={};module.exports=XSt(PNt);var ly=U_(require("fs")),Mg=U_(require("path")),GB=U_(require("readline")),pS=U_(LY()),EN=U_(lSe());var kN=U_(require("fs")),_Se=U_(require("os")),FD=U_(require("path")),yZ=U_(require("child_process"));function $B(d){return d==="~"?_Se.homedir():d.startsWith("~/")?FD.join(_Se.homedir(),d.slice(2)):d}t($B,"expandHome");var YO=16*1024,uSe=32*1024,Rze=1e4,Y4t=3e4,fSe=200,pSe=new Set(["node_modules",".git","dist","build","out",".next",".turbo","coverage","target","__pycache__",".venv","venv"]);function Z4t(d){let g=t(x=>{let E=x.match(/^(.*?)\{([^}]+)\}(.*)$/);if(!E)return[x];let[,z,Y,_e]=E;return Y.split(",").map(pe=>`${z}${pe.trim()}${_e}`)},"braceExpand"),T=d.match(/^([^*{}]+?)\/\*\*\/(.+)$/);if(T){let[,x,E]=T;return{includes:g(E),subDir:x}}return{includes:g(d),subDir:""}}t(Z4t,"expandGlobForGrep");var ZO=class{constructor(g,T,x={}){this.workspaceRoot=g;this.languageAdapters=T;this.options=x}static{t(this,"CliToolExecutionContext")}async readFile(g){return kN.promises.readFile($B(g),"utf-8")}async writeFile(g,T){let x=$B(g);if(this.options.approveWrite&&!await this.options.approveWrite(x,T))throw new Error(`Write to ${x} rejected by user`);await kN.promises.mkdir(FD.dirname(x),{recursive:!0}),await kN.promises.writeFile(x,T,"utf-8")}async listFiles(g,T){let x=$B(T??this.workspaceRoot),E=eAt(g),z=[];return await Lze(x,x,E,z),z.slice(0,fSe).sort()}async listDirectoryEntries(g){let T=$B(g),x=await kN.promises.readdir(T,{withFileTypes:!0}),E=[];for(let z of x){if(z.name.startsWith("."))continue;let Y=z.isDirectory();if(z.isSymbolicLink())try{Y=(await kN.promises.stat(FD.join(T,z.name))).isDirectory()}catch{Y=!1}E.push(Y?`${z.name}/`:z.name)}return E.sort()}async searchCode(g,T,x){let E=$B(T??this.workspaceRoot);return this.runRipgrep(g,E,x).catch(()=>this.runGrep(g,E,x))}async runCommand(g,T,x){return new Promise(E=>{let z="",Y="",_e=yZ.spawn(g,T,{cwd:x??this.workspaceRoot,shell:!1,env:{...process.env}}),pe=setTimeout(()=>{_e.kill("SIGTERM"),E({stdout:z.slice(0,uSe),stderr:Y+`
|
|
814
814
|
[process timed out]`,exitCode:124})},Y4t);_e.stdout?.on("data",ge=>{z+=ge.toString(),z.length>uSe&&_e.kill("SIGTERM")}),_e.stderr?.on("data",ge=>{Y+=ge.toString()}),_e.on("close",ge=>{clearTimeout(pe),E({stdout:z.slice(0,uSe),stderr:Y.slice(0,4*1024),exitCode:ge??0})}),_e.on("error",ge=>{clearTimeout(pe),E({stdout:"",stderr:ge.message,exitCode:1})})})}runRipgrep(g,T,x){return new Promise((E,z)=>{let Y=["--color=never","--line-number","--max-count=25","--max-filesize=1M",...[...pSe].map(he=>["--glob",`!${he}`]).flat()];x&&Y.push("--glob",x),Y.push(g,T);let _e="",pe=yZ.spawn("rg",Y,{shell:!1}),ge=setTimeout(()=>{pe.kill("SIGTERM"),E(_e.slice(0,YO))},Rze);pe.stdout?.on("data",he=>{_e+=he.toString(),_e.length>YO&&pe.kill("SIGTERM")}),pe.on("close",he=>{clearTimeout(ge),he!=null&&he>=2&&_e.length===0?z(new Error(`rg exited with code ${he}`)):E(_e.slice(0,YO))}),pe.on("error",z)})}runGrep(g,T,x){return new Promise((E,z)=>{let Y=[...pSe].map($e=>["--exclude-dir",$e]).flat(),_e=x?Z4t(x):{includes:[],subDir:""},pe=_e.includes.flatMap($e=>["--include",$e]),ge=_e.subDir?`${T}/${_e.subDir}`:T,he=["-rn","-E","--color=never",...Y,...pe,g,ge],De="",ne=yZ.spawn("grep",he,{shell:!1}),pt=setTimeout(()=>{ne.kill("SIGTERM"),E(De.slice(0,YO))},Rze);ne.stdout?.on("data",$e=>{De+=$e.toString(),De.length>YO&&ne.kill("SIGTERM")}),ne.on("close",$e=>{clearTimeout(pt),$e!=null&&$e>=2&&De.length===0?z(new Error(`grep exited with code ${$e}`)):E(De.slice(0,YO))}),ne.on("error",z)})}};function eAt(d){let g=tAt(d);return T=>g.test(T.replace(/\\/g,"/"))}t(eAt,"compileGlob");function tAt(d){let g="^";for(let T=0;T<d.length;T++){let x=d[T];if(x==="*")d[T+1]==="*"?(g+=".*",T++,d[T+1]==="/"&&T++):g+="[^/]*";else if(x==="?")g+="[^/]";else if(x==="{"){let E=d.indexOf("}",T);if(E===-1){g+="\\{";continue}let z=d.slice(T+1,E).split(",").map(nAt).join("|");g+=`(?:${z})`,T=E}else/[.+^$()|\\]/.test(x)?g+="\\"+x:g+=x}return g+="$",new RegExp(g)}t(tAt,"globToRegex");function nAt(d){return d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}t(nAt,"escapeRegex");async function Lze(d,g,T,x){if(x.length>=fSe)return;let E;try{E=await kN.promises.readdir(d,{withFileTypes:!0})}catch{return}for(let z of E){if(x.length>=fSe)return;if(pSe.has(z.name))continue;let Y=FD.join(d,z.name),_e=FD.relative(g,Y);z.isDirectory()?await Lze(Y,g,T,x):z.isFile()&&T(_e)&&x.push(Y)}}t(Lze,"walk");var Bze=U_(require("child_process")),Kx=U_(require("fs")),Jze=U_(require("os")),dSe=U_(require("path")),zze=U_(require("crypto"));function mSe(){let d=zze.randomBytes(4).toString("hex");return dSe.join(Jze.tmpdir(),`bandit-paste-${Date.now()}-${d}.png`)}t(mSe,"freshTempPath");function vZ(d,g,T={}){try{let x=Bze.spawnSync(d,g,{...T,encoding:void 0});return{stdout:Buffer.isBuffer(x.stdout)?x.stdout:Buffer.from(x.stdout??""),code:x.status}}catch{return{stdout:Buffer.alloc(0),code:null}}}t(vZ,"tryExec");async function bZ(){return process.platform==="darwin"?rAt():process.platform==="linux"?iAt():process.platform==="win32"?sAt():null}t(bZ,"readClipboardImage");function rAt(){let d=mSe(),g=`set pngData to (the clipboard as \xABclass PNGf\xBB)
|
|
815
815
|
set outFile to (open for access (POSIX file "${d}") with write permission)
|
|
816
816
|
write pngData to outFile
|
package/package.json
CHANGED