fluxflow-cli 5.0.0 → 5.1.0

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.
@@ -1,6 +1,6 @@
1
- import{a as k,c as d}from"./chunk-56EJGQU3.js";import{a as b}from"./chunk-Y5JU726N.js";var I=async(w,s={})=>{let{runSubagent:U}=await import("./ai-WBRHU7IH.js"),l=b(w),c=l.task||l.instruction||l.prompt,E=l.model||null,C=l.title||null,m=l.tools||null;if(!c)return'ERROR: Missing "task" argument for invoke.';let f=null;if(m)try{let t=m.trim();t.startsWith("[")&&t.endsWith("]")&&(t=t.substring(1,t.length-1)),f=t.split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let i=`subagent-${Date.now()}-${Math.floor(Math.random()*1e3)}`,h=null,S=null,$=new Promise((t,n)=>{h=t,S=n}),e={id:i,title:C||c.substring(0,30),task:c,status:"running",startedAt:Date.now(),lastChunkTime:Date.now(),wps:0,questions:[],pendingSteerMessages:[],steer:t=>{t&&e.pendingSteerMessages.push(t)},completionPromise:$,_resolveCompletion:h,_rejectCompletion:S,progress:[]},r={chunks:[],totalWords:0};k.push(e),s.onSubagentUpdate&&s.onSubagentUpdate();let a=[],A={...s,taskId:i,onAskMain:async t=>{let n=`q-${Date.now()}-${Math.floor(Math.random()*1e3)}`,o=null,p=new Promise(g=>{o=g}),u={id:n,question:t,answered:!1,answer:null,askedAt:Date.now(),_resolve:o};return e.questions.push(u),e.status="waiting",s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" is WAITING FOR YOUR INPUT: "${t}"
1
+ import{a as k,c as d}from"./chunk-56EJGQU3.js";import{a as b}from"./chunk-Y5JU726N.js";var I=async(w,s={})=>{let{runSubagent:U}=await import("./ai-ZMBQQ3QP.js"),l=b(w),c=l.task||l.instruction||l.prompt,E=l.model||null,C=l.title||null,m=l.tools||null;if(!c)return'ERROR: Missing "task" argument for invoke.';let f=null;if(m)try{let t=m.trim();t.startsWith("[")&&t.endsWith("]")&&(t=t.substring(1,t.length-1)),f=t.split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let i=`subagent-${Date.now()}-${Math.floor(Math.random()*1e3)}`,h=null,S=null,$=new Promise((t,n)=>{h=t,S=n}),e={id:i,title:C||c.substring(0,30),task:c,status:"running",startedAt:Date.now(),lastChunkTime:Date.now(),wps:0,questions:[],pendingSteerMessages:[],steer:t=>{t&&e.pendingSteerMessages.push(t)},completionPromise:$,_resolveCompletion:h,_rejectCompletion:S,progress:[]},r={chunks:[],totalWords:0};k.push(e),s.onSubagentUpdate&&s.onSubagentUpdate();let a=[],A={...s,taskId:i,onAskMain:async t=>{let n=`q-${Date.now()}-${Math.floor(Math.random()*1e3)}`,o=null,p=new Promise(g=>{o=g}),u={id:n,question:t,answered:!1,answer:null,askedAt:Date.now(),_resolve:o};return e.questions.push(u),e.status="waiting",s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" is WAITING FOR YOUR INPUT: "${t}"
2
2
  Respond using tool: [action:Answer(id="${i}", answer="...")]
3
3
  [/SYSTEM]`),await p},onVisualFeedback:t=>{e.lastChunkTime=Date.now();let n=t.replace(/\x1b\[[0-9;]*m/g,""),o=n.match(/[✔✘✗✖🔍📖→➕↻•]\s*([A-Za-z0-9\s-]+)/);o?e.currentTool=o[1].trim():e.currentTool=n,s.onSubagentUpdate&&s.onSubagentUpdate()},onTokenChunk:(t,n)=>{let o=Date.now();if(e.lastChunkTime=o,e.currentTool="Thinking",typeof n=="number"&&n>0){r.totalWords+=n,r.chunks.push({time:o,words:n});let p=o-400;if(r.chunks=r.chunks.filter(u=>u.time>=p),r.chunks.length>0){let u=r.chunks.reduce((M,_)=>M+_.words,0),T=r.chunks[0].time,g=Math.max(.4,(o-T)/1e3);e.wps=Math.round(u/g)}}s.onSubagentUpdate&&s.onSubagentUpdate()}};return U(c,A,E,f,null,t=>{if(e.status==="cancelled")return;if(t.startsWith("[Subagent Turn")&&a.length>0&&(e.progress.push([...a]),a=[]),t.includes("[Executing Tool]")){let o=t.match(/\[Executing Tool\]\s*([a-zA-Z0-9_]+)/);o&&(!e.currentTool||e.currentTool==="Thinking")&&(e.currentTool=o[1])}let n=t;if(n.startsWith("[Tool Result]")||n.startsWith("[Action Result]")){let o=n.split(`
4
4
  `);o.length>5&&(n=o.slice(0,4).join(`
5
5
  `)+`
6
- ... [Content/Diff Truncated from Logs] ...`)}a.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0).then(t=>{if(e.status==="cancelled"){e._resolveCompletion&&e._resolveCompletion(t);return}a.length>0&&(e.progress.push([...a]),a=[]),e.status="completed",e.finalAnswer=t,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) has FINISHED. Call GetProgress(id="${i}") to see the final result. [/SYSTEM]`),e._resolveCompletion&&e._resolveCompletion(t)}).catch(async t=>{let{isTerminationSignaled:n}=await import("./ai-WBRHU7IH.js");if(t.message==="Subagent task was cancelled."||e.status==="cancelled"||n()){e.status="cancelled",a.push("[SUBAGENT CANCELLED] Task was cancelled."),e.progress.push([...a]),s.onSubagentUpdate&&s.onSubagentUpdate(),e._resolveCompletion&&e._resolveCompletion(null);return}a.push(`[SUBAGENT FAILURE] Error: ${t.message}`),e.progress.push([...a]),e.status="failed",e.error=t.message,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) FAILED with error: ${t.message}. [/SYSTEM]`),e._rejectCompletion&&e._rejectCompletion(t)}),`Background subagent started. Task ID: ${i}`};export{I as invoke};
6
+ ... [Content/Diff Truncated from Logs] ...`)}a.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0).then(t=>{if(e.status==="cancelled"){e._resolveCompletion&&e._resolveCompletion(t);return}a.length>0&&(e.progress.push([...a]),a=[]),e.status="completed",e.finalAnswer=t,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) has FINISHED. Call GetProgress(id="${i}") to see the final result. [/SYSTEM]`),e._resolveCompletion&&e._resolveCompletion(t)}).catch(async t=>{let{isTerminationSignaled:n}=await import("./ai-ZMBQQ3QP.js");if(t.message==="Subagent task was cancelled."||e.status==="cancelled"||n()){e.status="cancelled",a.push("[SUBAGENT CANCELLED] Task was cancelled."),e.progress.push([...a]),s.onSubagentUpdate&&s.onSubagentUpdate(),e._resolveCompletion&&e._resolveCompletion(null);return}a.push(`[SUBAGENT FAILURE] Error: ${t.message}`),e.progress.push([...a]),e.status="failed",e.error=t.message,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) FAILED with error: ${t.message}. [/SYSTEM]`),e._rejectCompletion&&e._rejectCompletion(t)}),`Background subagent started. Task ID: ${i}`};export{I as invoke};
@@ -1,3 +1,3 @@
1
- import{a as o}from"./chunk-Y5JU726N.js";var k=async(b,t={})=>{let{runSubagent:u}=await import("./ai-WBRHU7IH.js"),s=o(b),a=s.task||s.instruction||s.prompt,m=s.model||null,l=s.tools||null;if(!a)return'ERROR: Missing "task" argument for invokeSync.';let r=null;if(l)try{let e=l.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.substring(1,e.length-1)),r=e.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let n=s.title||a.substring(0,30);try{t.onVisualFeedback&&t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n}`);let e=await u(a,t,m,r,null);return t.onVisualFeedback&&t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n} [COMPLETED]
2
- `),e}catch(e){let{isTerminationSignaled:i}=await import("./ai-WBRHU7IH.js"),c=e.message==="Subagent task was cancelled by user."||i();if(t.onVisualFeedback){let d=c?"[CANCELLED]":"[FAILED]";t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n} ${d}
1
+ import{a as o}from"./chunk-Y5JU726N.js";var k=async(b,t={})=>{let{runSubagent:u}=await import("./ai-ZMBQQ3QP.js"),s=o(b),a=s.task||s.instruction||s.prompt,m=s.model||null,l=s.tools||null;if(!a)return'ERROR: Missing "task" argument for invokeSync.';let r=null;if(l)try{let e=l.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.substring(1,e.length-1)),r=e.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let n=s.title||a.substring(0,30);try{t.onVisualFeedback&&t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n}`);let e=await u(a,t,m,r,null);return t.onVisualFeedback&&t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n} [COMPLETED]
2
+ `),e}catch(e){let{isTerminationSignaled:i}=await import("./ai-ZMBQQ3QP.js"),c=e.message==="Subagent task was cancelled by user."||i();if(t.onVisualFeedback){let d=c?"[CANCELLED]":"[FAILED]";t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n} ${d}
3
3
  `)}return`ERROR: Subagent execution failed: ${e.message}`}};export{k as invokeSync};
@@ -0,0 +1,17 @@
1
+ import{a as M}from"./chunk-Y5JU726N.js";import h from"fs";import A from"path";var j=new Set([".git","node_modules",".gemini","dist","build",".next","out",".cache","bin","obj","vendor","venv",".idea",".gradle",".terraform","target","coverage",".vscode",".svn",".hg",".fslckout",".github",".gitlab",".circleci",".gitea",".gitee",".lerna",".changeset",".nx",".npm",".yarn",".pnpm-store",".expo",".nuxt",".svelte-kit",".docusaurus",".turbo",".vercel","bower_components",".netlify",".vuepress",".quasar",".output",".angular","jspm_packages",".parcel-cache",".rollup.cache",".rspack",".vitepress","__pycache__",".pytest_cache",".mypy_cache",".tox",".poetry","env","vhdl",".ipynb_checkpoints",".jupyter",".conda",".pdm-build",".bundle",".yardoc",".metadata","App_Data","ClientBin",".cargo",".rustc_info",".go","Godeps","_vendor",".rake_tasks","CMakefiles",".wakatime",".dart_tool",".fvm",".cocoapods","Pods",".pub-cache",".symlinks","DerivedData",".xcworkspace",".serverless",".aws",".gcloud",".azure",".kube",".vagrant",".docker","postgres-data","redis-data","mongo-data",".Spotlight-V100",".Trashes","$RECYCLE.BIN","System Volume Information",".DocumentRevisions-V100",".fseventsd","AppData","Application Data","Local","LocalLow","Roaming","$WinREAgent","$WINDOWS.~BT","$WINDOWS.~WS","scw","System32","SysWOW64",".AppleDouble",".AppleDB",".AppleDesktop","_CodeSignature",".cmio",".LSOverride",".localized",".TemporaryItems",".Trash",".Trash-0",".Trash-1000",".gvfs",".local",".config",".dbus",".fontconfig",".snap",".var",".lost+found","lost+found",".thumb",".thumbnails","EFI","boot","grub","logs","log",".nyc_output",".sonar",".ruff_cache",".VSCodeCounter",".skills","skills"]),z=(r,a=!1)=>a&&(r.includes("skills")||r.includes(".skills")||r.includes("skill")||r.includes(".skill"))?!1:j.has(r)||r.startsWith(".pnpm"),N=r=>{try{let a=String(r.getMonth()+1).padStart(2,"0"),S=String(r.getDate()).padStart(2,"0"),i=String(r.getHours()).padStart(2,"0"),n=String(r.getMinutes()).padStart(2,"0");return`${a}-${S} ${i}:${n}`}catch{return"N/A"}},q=async r=>{let a=M(r),S=a.path||null;if(!S)return"ERROR: No directory path provided.";if(S.trim().toLowerCase().startsWith("#skills"))return"ERROR: '#skill' is reserved VFS namespace, not folder. Use 'ReadFile' to read specific skills.";let i=0,n=S.trim(),T=n.match(/[/\\]\+(\d+)$/);T&&(i=parseInt(T[1],10),n=n.slice(0,T.index).trim()||".");let l=1;if(a.recurse!==void 0&&a.recurse!==null)if(typeof a.recurse=="number")l=a.recurse;else if(typeof a.recurse=="boolean")l=a.recurse?2:1;else{let o=parseInt(String(a.recurse).trim(),10);l=isNaN(o)?1:o}l=Math.max(1,Math.min(3,l));try{let o=A.resolve(process.cwd(),n);if(!h.existsSync(o))return`ERROR: Path [${n}] does not exist.`;if(!h.statSync(o).isDirectory())return`ERROR: Path [${n}] is a file, not a directory. Use ReadFile instead.`;if(l===1){let g=[];try{g=h.readdirSync(o)}catch{return`ERROR: Inaccessible Directory [${n}].`}let u=[],m=[];for(let s of g){let f=A.join(o,s),x=!1,C="N/A",w="N/A";try{let _=h.statSync(f);x=_.isDirectory(),C=(_.size/1024).toFixed(1)+"KB",w=N(_.mtime)}catch{}x?u.push({name:s,type:"directory",size:C,mtime:w}):m.push({name:s,type:"file",size:C,mtime:w})}u.sort((s,f)=>s.name.localeCompare(f.name)),m.sort((s,f)=>s.name.localeCompare(f.name));let $=[...u,...m],d=$.length,c=$.slice(i,i+150),y=c.map(s=>s.type==="directory"?`${s.name}/`:`${s.name} (${s.size}, ${s.mtime})`).join(`
2
+ `),p=`
3
+
4
+ (Total items in folder: ${d})`,e=i+c.length,t=n.replace(/\\/g,"/");if(i>0||e<d){let s=d===0?0:i+1,f=i+c.length;if(p=`
5
+
6
+ (Showing items ${s}\u2013${f} of ${d})`,e<d){let x=t.endsWith("/")?"+":"/+";p+=`
7
+ TRUNCATED: More items remain. Pass path as '${t}${x}${e}' to view next page`}}return g.length=0,u.length=0,m.length=0,$.length=0,c.length=0,`Detailed folder stats for [${i>0?`${t}/+${i}`:t}]:
8
+
9
+ ${y}${p}`}let E=0,I=0,D=0,b=500,k=!1,O=n.toLowerCase().includes("skill"),L=(g,u,m=1)=>{if(u>l||k)return[];let $=[];try{$=h.readdirSync(g)}catch{return[`${" ".repeat(m-1)}[Inaccessible Directory]`]}let d=[],R=[];for(let e of $){let t=A.join(g,e),v=!1;try{v=h.statSync(t).isDirectory()}catch{}v?d.push({name:e,fullPath:t}):R.push({name:e,fullPath:t})}d.sort((e,t)=>e.name.localeCompare(t.name)),R.sort((e,t)=>e.name.localeCompare(t.name));let c=[],y=" ".repeat(m-1);for(let e of d){if(D>=b){k=!0,c.push(`${y}[Truncated - Maximum item limit reached (${b})]`);break}if(D++,E++,c.push(`${y}${e.name}/`),u<l&&!z(e.name,O)){let t=L(e.fullPath,u+1,m+1);c.push(...t)}}let p=[];for(let e of R){if(D>=b){k=!0,c.push(`${y}[Truncated - Maximum item limit reached (${b})]`);break}D++,I++;let t="N/A";try{t=(h.statSync(e.fullPath).size/1024).toFixed(1)+"KB"}catch{}p.push(`${e.name} (${t})`)}return p.length>0&&c.push(`${y}${p.join("; ")}`),c},W=L(o,1,1).join(`
10
+ `),F=`
11
+
12
+ (Total items scanned: ${D}, Directories: ${E}, Files: ${I})`;return k&&(F=`
13
+
14
+ TRUNCATED: Scan capped at ${b} items. (Directories: ${E}, Files: ${I})
15
+ TIP: Targeted folders exceeded recursive limit. Use read_folder with recurse=1 on specific subdirectories to inspect them in full detail.`),`Detailed directory tree for [${n}] (recursive depth: ${l}):
16
+
17
+ ${W}${F}`}catch(o){let P=o instanceof Error?o.message:String(o);return`ERROR: Failed to read folder [${n}]: ${P}`}};export{q as read_folder};
@@ -0,0 +1,8 @@
1
+ import{a as Y}from"./chunk-Y5JU726N.js";import{b as Q}from"./chunk-B4UKMX5E.js";import"./chunk-LQM3JK7N.js";import"./chunk-P5HBJA23.js";import{w as V,x as q,y as J}from"./chunk-26BQ45XP.js";import K from"fs/promises";import E from"path";import j from"fast-glob";import{Minimatch as tt}from"minimatch";async function A(f,o,n=f,p=1){if(p>12)return[];let h=[],s;try{s=await K.readdir(f,{withFileTypes:!0})}catch{return[]}for(let t of s){let a=E.join(f,t.name),y=E.relative(n,a),L=y.split(E.sep).map(w=>w.toLowerCase()),O=t.name.toLowerCase();if(!o.some(w=>{let F=w.toLowerCase();return F.startsWith(".")&&O.endsWith(F)?!0:L.some(M=>M===F||M.startsWith(".pnpm"))}))if(t.isDirectory()){let w=await A(a,o,n,p+1);h=h.concat(w)}else t.isFile()&&h.push({fullPath:a,relativePath:y})}return h}function rt(f,o,n=1/0){if(f===o)return 0;if(f.length===0)return o.length;if(o.length===0)return f.length;if(Math.abs(f.length-o.length)>n)return n+1;let p=Array.from({length:o.length+1},(h,s)=>s);for(let h=1;h<=f.length;h++){let s=[h],t=h;for(let a=1;a<=o.length;a++){let y=f[h-1]===o[a-1]?0:1,L=Math.min(s[a-1]+1,p[a]+1,p[a-1]+y);s.push(L),L<t&&(t=L)}if(p=s,t>n)return n+1}return p[o.length]}function nt(f,o){if(!f||!o)return!1;let n=f.toLowerCase(),p=o.toLowerCase();if(n.includes(p))return!0;let h=n.split(/[^a-z0-9]+/).filter(t=>t.length>0),s=p.split(/[^a-z0-9]+/).filter(t=>t.length>1||p.length===1&&t.length>0);return s.length===0?!1:s.every(t=>{let a=t.length<=2?0:t.length<=5?1:2;for(let y of h)if(y.includes(t)||t.length>=3&&y.length>=3&&Math.abs(y.length-t.length)<=a&&rt(t,y,a)<=a)return!0;return!1})}var gt=async f=>{let{keyword:o,path:n,fuzzy:p,subString:h,regex:s}=Y(f);if(o==null)return'ERROR: Missing "keyword" argument.';let t=String(o);if(n){let e=n.trim().toLowerCase();if(e==="#docs"||e==="#doc"||e==="#documentation"||e.includes("#skill/global/fluxflow")||e.startsWith("#skill"))return"ERROR: Cannot search in reserved VFS '#skill' namespace. Use 'ReadFile' to read specific skills."}let a=e=>e===!0||e==="true"||e===1||e==="1"||e==="yes",y=s===!1||s==="false"||s===0||s==="0"||s==="no",L=s===!0||s==="true"||s===1||s==="1"||s==="yes",O=a(p)||a(h),G=null,w=null;if(y)O||(w=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i"));else{try{let e=t;G=new RegExp(e,"i")}catch(e){if(L)return`ERROR: Invalid regex pattern "${t}": ${e.message}`}w=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i")}let F=Array.from(new Set([...V,...q(process.cwd())])),M=150;try{let e=[],P=process.cwd(),u=null;if(n){let i=r=>r.startsWith("!")||!r.startsWith("-")?r:"!"+r.replace(/^-+/,""),g=n.split(";").map(r=>r.trim()).filter(Boolean).map(i).filter(r=>r!=="!"),c=g.some(r=>r.startsWith("!"));if(g.some(r=>j.isDynamicPattern(r)||/[*?{}[\]()|+]/.test(r))){u="glob";let r=n.replace(/\\/g,"/"),l=g.map(m=>m.replace(/\\/g,"/")),z=F.map(m=>m.startsWith(".")?`**/*${m}`:`**/${m}/**`);if(c&&!g.some(m=>!m.startsWith("!"))){let m=await A(P,F,P),R=$=>$.endsWith("/")?$+"**":$,d=l.filter($=>$.startsWith("!")).map($=>R($.slice(1))),v=l.filter($=>!$.startsWith("!")).map(R);e=m.filter($=>{let x=$.relativePath.replace(/\\/g,"/"),_=v.length===0||v.some(b=>{try{return new tt(b).match(x)}catch{return!1}}),Z=d.some(b=>{try{return new tt(b).match(x)}catch{return!1}});return _&&!Z})}else{let m=l.some(d=>/[\(\)\|]|\.\*/.test(d)),R=[];if(!m)try{R=await j(l,{cwd:P,ignore:z,dot:!0,onlyFiles:!0,absolute:!1})}catch{R=[]}if(R.length===0&&(m||j.isDynamicPattern(r))){let d=r.match(/^([^\*\?\(\)\|\[\]\s]+)\//),v=d&&!/[\*\?\(\)\|\[\]]/.test(d[1])?E.resolve(P,d[1]):P,$=await A(v,F,P);try{let x=r.replace(/^\.\//,"");x=x.replace(/\.\*\/(\\.|[^\/])/g,".*$1"),!x.startsWith("^")&&!x.startsWith(".*")&&(x=`.*${x}`);let _=new RegExp(x.endsWith("$")?x:`${x}$`,"i");e=$.filter(Z=>{let b=Z.relativePath.replace(/\\/g,"/");return _.test(b)})}catch{e=[]}}else e=R.map(d=>({fullPath:E.resolve(P,d),relativePath:d}))}}else{let r=[],l=!1,z=!1;for(let k of g){let m=k.replace(/[\/\\]+$/,""),R=E.resolve(P,m);try{let d=await K.stat(R);if(d.isDirectory()){z=!0;let v=await A(R,F,P);r.push(...v)}else if(d.isFile())l=!0,r.push({fullPath:R,relativePath:E.relative(P,R)});else return`ERROR: Path is neither a file nor a directory: ${k}`}catch{return`ERROR: Path not found: ${k}`}}e=r,l&&!z?u="file":u="dir"}}else e=await A(P,F);let et=e.map(async i=>{try{let g=await K.readFile(i.fullPath,"utf-8");if(g.includes("\0"))return[];let c=g.split(/\r?\n/),W=[];for(let l=0;l<c.length;l++)(O?c[l].toLowerCase().includes(t.toLowerCase())||nt(c[l],t):y?w&&w.test(c[l]):G&&G.test(c[l])||w&&w.test(c[l]))&&W.push({line:l+1,content:c[l].trim()});return W.length===0?null:{path:i.relativePath.replace(/\\/g,"/"),matches:W}}catch{return[]}}),st=await Promise.all(et),S=[],D=0;for(let i of st){if(!i||!i.matches)continue;if(D>=M)break;let g=M-D,c=i.matches.slice(0,g);S.push({path:i.path,matches:c}),D+=c.length}typeof global.gc=="function"&&global.gc();let I=null;if(S.length===0){let i=u==="file"?` in '${n}'`:u==="dir"||u==="glob"?` in '${n}'`:". Try to specify files",g=u==="dir"?"[DIR]":u==="glob"?"[GLOB]":"";return`${g}${g?" ":""}Found 0 matches of '${t}'${i}${I?` ${I}`:""}`}let B=I?` ${I}`:"",T=`${S.length} file${S.length===1?"":"s"}`,U=`${D} match${D===1?"":"es"}`,N;u==="file"?N=`Found ${U} of '${t}' in '${n}'${B}:`:u==="dir"||u==="glob"?N=`Found ${U} of '${t}' in '${n}' across ${T}${B}:`:N=`Found ${U} of '${t}' across ${T}${B}:`;let X=u==="dir"?"[DIR]":u==="glob"?"[GLOB]":"",C=`${X}${X?" ":""}${N}
2
+
3
+ `,H="";try{let i=await Q();i?.systemSettings?.alwaysAskFiles&&(H=i.systemSettings.alwaysAskFiles)}catch{}for(let i of S)if(C+=`${i.path}:
4
+ `,J(i.path,H)){let c=i.matches.map(W=>`Line ${W.line}`).join(", ");C+=` ${c}. Line snapshot not available due to file restriction policy. ReadFile if needed
5
+
6
+ `}else{for(let c of i.matches)C+=` Line ${c.line}: ${c.content}
7
+ `;C+=`
8
+ `}return C.trimEnd()}catch(e){return`ERROR: ${e.message}`}};export{gt as search_keyword};
package/dist/cli.js CHANGED
@@ -65,7 +65,7 @@ Usage: fluxflow --export error`),process.exit(1)}if(oe&&(console.log(`v${i}`),pr
65
65
  /docs View documentation
66
66
  /fluxflow init Create FluxFlow.md template
67
67
  /update check Check for new version
68
- /update latest Install latest release`),process.exit(0)),se){let C=t[1]||"latest";if(C==="check"){let x=t[2]==="latest";try{let y=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;y||(console.error("Error: Could not retrieve latest version."),process.exit(1)),console.log(x?`Latest version: v${y}`:y!==i?`A new version of FluxFlow is available: v${y} (current: v${i}). Run "fluxflow --update latest" to upgrade.`:`FluxFlow is up to date (v${i}).`)}catch(c){console.error("Error checking for updates:",c.message),process.exit(1)}process.exit(0)}else if(C==="latest"){console.log("Checking latest version and settings...");try{let m=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;m||(console.error("Error: Could not retrieve latest version."),process.exit(1)),m===i&&(console.log(`FluxFlow is already up to date (v${i}).`),process.exit(0));let y=async()=>{let r=(await import("react")).default,{useState:w}=r,{render:U,Box:h,Text:S}=await import("ink"),ie=(await import("ink-select-input")).default,_=(await import("ink-text-input")).default;return new Promise(D=>{let P=[{label:"NPM",value:"npm"},{label:"PNPM",value:"pnpm"},{label:"Yarn",value:"yarn"},{label:"Bun",value:"bun"},{label:"Custom Command",value:"custom"}],H=({label:E,isSelected:F})=>r.createElement(h,{width:"100%"},r.createElement(S,{bold:F},"\u2514\u2500 ",F?"\x1B[32m\u25CF\x1B[0m":"\u25CB"," ",E)),b,X=()=>{let[E,F]=w("select"),[J,j]=w(""),z=R=>{R.value==="custom"?F("custom"):B({manager:R.value})},K=R=>{B({manager:"custom",customCommand:R})};return E==="custom"?r.createElement(h,{flexDirection:"column",marginY:1},r.createElement(h,{marginBottom:1},r.createElement(S,{color:"magenta",bold:!0},"\u{1F527} Enter custom update command:")),r.createElement(h,{flexDirection:"row"},r.createElement(S,{color:"cyan",bold:!0}," \u276F "),r.createElement(_,{value:J,onChange:j,onSubmit:K})),r.createElement(h,{marginTop:1},r.createElement(S,{color:"gray",dimColor:!0,italic:!0}," (Press Enter to confirm)"))):r.createElement(h,{flexDirection:"column",marginY:1},r.createElement(h,{marginBottom:1},r.createElement(S,{color:"magenta",bold:!0},"\u{1F4E6} Select a package manager for the update:")),r.createElement(ie,{items:P,onSelect:z,itemComponent:H,indicatorComponent:()=>null}))},B=E=>{b&&b(),D(E)},{unmount:V}=U(r.createElement(X,null));b=V})},n,k="",A;try{let{loadSettings:r}=await import("./chunks/settings-PUFSRWT3.js");A=await r(),n=A?.systemSettings?.updateManager||A?.updateManager}catch{}if(!n){let r=await y();n=r.manager,k=r.customCommand}let p="";n==="pnpm"?p=`pnpm add -g fluxflow-cli@${m}`:n==="bun"?p=`bun add -g fluxflow-cli@${m}`:n==="yarn"?p=`yarn global add fluxflow-cli@${m}`:n==="custom"?p=k||A?.customUpdateCommand||`npm install -g fluxflow-cli@${m}`:p=`npm install -g fluxflow-cli@${m}`,console.log(`Updating FluxFlow to v${m} using ${n}...`),console.log(`Running: ${p}`);let{execSync:L}=await import("child_process");L(p,{stdio:"inherit"}),console.log(`\x1B[32m\u2705 Update successful! FluxFlow updated to v${m}.\x1B[0m`)}catch(x){console.error("\x1B[31m\u274C Update failed:\x1B[0m",x.message),process.exit(1)}process.exit(0)}else console.error("Unknown update command. Available options: --update, --update check, --update check latest, --update latest"),process.exit(1)}}let{default:pe}=await import("react"),{render:de}=await import("ink"),{default:ue}=await import("./chunks/app-ML5GKD3A.js");process.env.NODE_NO_WARNINGS="1";let ge=["cuimp","Found existing binary","Binary verified","curl.exe not found","Falling back to .bat file","DeprecationWarning"],fe=console.log,xe=console.warn,we=console.error,W=o=>{let d=o.map(String).join(" ");return ge.some(s=>d.includes(s))};console.log=(...o)=>!W(o)&&fe(...o),console.warn=(...o)=>!W(o)&&xe(...o),console.error=(...o)=>!W(o)&&we(...o);let Y=t.findIndex(o=>o==="--cwd"||o==="--path");if(Y!==-1&&Y+1<t.length){let o=t[Y+1],d=await import("path"),s=await import("fs-extra"),u=d.default.resolve(o);try{s.default.existsSync(u)&&s.default.statSync(u).isDirectory()?process.chdir(u):(console.error(`[ERROR] Directory not found: "${o}"`),process.exit(0))}catch(v){console.error(`[ERROR] Failed to change directory to "${o}": ${v.message}`),process.exit(0)}}let M=t.includes("--commit_8f4a2b9c"),q=t.findIndex(o=>o==="-p"||o==="--prompt");if(q!==-1||M){let o=t.includes("--new")||t.includes("-n"),s=(q!==-1?t.slice(q+1).filter(e=>e!=="-n"&&e!=="--new"):[])[0];if(M)try{let{execSync:e}=await import("child_process"),a=e("git diff --cached",{encoding:"utf8",stdio:["ignore","pipe","pipe"]}).trim();a||process.exit(0);let l="";if(s&&s.trim()){let I=s.trim();I.startsWith("={")&&I.endsWith("}")?l=`
68
+ /update latest Install latest release`),process.exit(0)),se){let C=t[1]||"latest";if(C==="check"){let x=t[2]==="latest";try{let y=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;y||(console.error("Error: Could not retrieve latest version."),process.exit(1)),console.log(x?`Latest version: v${y}`:y!==i?`A new version of FluxFlow is available: v${y} (current: v${i}). Run "fluxflow --update latest" to upgrade.`:`FluxFlow is up to date (v${i}).`)}catch(c){console.error("Error checking for updates:",c.message),process.exit(1)}process.exit(0)}else if(C==="latest"){console.log("Checking latest version and settings...");try{let m=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;m||(console.error("Error: Could not retrieve latest version."),process.exit(1)),m===i&&(console.log(`FluxFlow is already up to date (v${i}).`),process.exit(0));let y=async()=>{let r=(await import("react")).default,{useState:w}=r,{render:U,Box:h,Text:S}=await import("ink"),ie=(await import("ink-select-input")).default,_=(await import("ink-text-input")).default;return new Promise(D=>{let P=[{label:"NPM",value:"npm"},{label:"PNPM",value:"pnpm"},{label:"Yarn",value:"yarn"},{label:"Bun",value:"bun"},{label:"Custom Command",value:"custom"}],H=({label:E,isSelected:F})=>r.createElement(h,{width:"100%"},r.createElement(S,{bold:F},"\u2514\u2500 ",F?"\x1B[32m\u25CF\x1B[0m":"\u25CB"," ",E)),b,X=()=>{let[E,F]=w("select"),[J,j]=w(""),z=R=>{R.value==="custom"?F("custom"):B({manager:R.value})},K=R=>{B({manager:"custom",customCommand:R})};return E==="custom"?r.createElement(h,{flexDirection:"column",marginY:1},r.createElement(h,{marginBottom:1},r.createElement(S,{color:"magenta",bold:!0},"\u{1F527} Enter custom update command:")),r.createElement(h,{flexDirection:"row"},r.createElement(S,{color:"cyan",bold:!0}," \u276F "),r.createElement(_,{value:J,onChange:j,onSubmit:K})),r.createElement(h,{marginTop:1},r.createElement(S,{color:"gray",dimColor:!0,italic:!0}," (Press Enter to confirm)"))):r.createElement(h,{flexDirection:"column",marginY:1},r.createElement(h,{marginBottom:1},r.createElement(S,{color:"magenta",bold:!0},"\u{1F4E6} Select a package manager for the update:")),r.createElement(ie,{items:P,onSelect:z,itemComponent:H,indicatorComponent:()=>null}))},B=E=>{b&&b(),D(E)},{unmount:V}=U(r.createElement(X,null));b=V})},n,k="",A;try{let{loadSettings:r}=await import("./chunks/settings-PUFSRWT3.js");A=await r(),n=A?.systemSettings?.updateManager||A?.updateManager}catch{}if(!n){let r=await y();n=r.manager,k=r.customCommand}let p="";n==="pnpm"?p=`pnpm add -g fluxflow-cli@${m}`:n==="bun"?p=`bun add -g fluxflow-cli@${m}`:n==="yarn"?p=`yarn global add fluxflow-cli@${m}`:n==="custom"?p=k||A?.customUpdateCommand||`npm install -g fluxflow-cli@${m}`:p=`npm install -g fluxflow-cli@${m}`,console.log(`Updating FluxFlow to v${m} using ${n}...`),console.log(`Running: ${p}`);let{execSync:L}=await import("child_process");L(p,{stdio:"inherit"}),console.log(`\x1B[32m\u2705 Update successful! FluxFlow updated to v${m}.\x1B[0m`)}catch(x){console.error("\x1B[31m\u274C Update failed:\x1B[0m",x.message),process.exit(1)}process.exit(0)}else console.error("Unknown update command. Available options: --update, --update check, --update check latest, --update latest"),process.exit(1)}}let{default:pe}=await import("react"),{render:de}=await import("ink"),{default:ue}=await import("./chunks/app-DJV7SIS6.js");process.env.NODE_NO_WARNINGS="1";let ge=["cuimp","Found existing binary","Binary verified","curl.exe not found","Falling back to .bat file","DeprecationWarning"],fe=console.log,xe=console.warn,we=console.error,W=o=>{let d=o.map(String).join(" ");return ge.some(s=>d.includes(s))};console.log=(...o)=>!W(o)&&fe(...o),console.warn=(...o)=>!W(o)&&xe(...o),console.error=(...o)=>!W(o)&&we(...o);let Y=t.findIndex(o=>o==="--cwd"||o==="--path");if(Y!==-1&&Y+1<t.length){let o=t[Y+1],d=await import("path"),s=await import("fs-extra"),u=d.default.resolve(o);try{s.default.existsSync(u)&&s.default.statSync(u).isDirectory()?process.chdir(u):(console.error(`[ERROR] Directory not found: "${o}"`),process.exit(0))}catch(v){console.error(`[ERROR] Failed to change directory to "${o}": ${v.message}`),process.exit(0)}}let M=t.includes("--commit_8f4a2b9c"),q=t.findIndex(o=>o==="-p"||o==="--prompt");if(q!==-1||M){let o=t.includes("--new")||t.includes("-n"),s=(q!==-1?t.slice(q+1).filter(e=>e!=="-n"&&e!=="--new"):[])[0];if(M)try{let{execSync:e}=await import("child_process"),a=e("git diff --cached",{encoding:"utf8",stdio:["ignore","pipe","pipe"]}).trim();a||process.exit(0);let l="";if(s&&s.trim()){let I=s.trim();I.startsWith("={")&&I.endsWith("}")?l=`
69
69
 
70
70
  Instruction: ${I.slice(2,-1).trim()}`:l=`
71
71
 
@@ -81,7 +81,7 @@ ${s}`:s=i}if(!M&&!process.stdin.isTTY){let e=[];for await(let l of process.stdin
81
81
  ${a}
82
82
  ---
83
83
 
84
- ${s}`:s=a}}s||(console.error("[ERROR] -p/--prompt requires a prompt string (or piped stdin input)."),process.exit(1));let{loadSettings:C}=await import("./chunks/settings-PUFSRWT3.js"),{getProviderAPIKey:x}=await import("./chunks/secrets-TNMLVMST.js"),{getDefaultModel:c}=await import("./chunks/model_config-QRYAVWHF.js"),{generateSimpleContent:m}=await import("./chunks/ai-WBRHU7IH.js"),{checkQuotaDetailed:y}=await import("./chunks/usage-EBE2OVES.js"),n=await C(),k=t.filter(e=>e!=="-p"&&e!=="--prompt"&&e!==s&&e!=="-n"&&e!=="--new"),A=M||k.includes("--raw")||t.includes("--raw"),p=e=>{for(let a of e){let l=k.indexOf(a);if(l!==-1&&l+1<k.length)return k[l+1]}return null},L=M&&n.systemSettings?.commitMessageModel&&n.systemSettings.commitMessageModel!=="Default"?n.systemSettings.commitMessageModel:null,r=M&&L&&n.systemSettings?.commitMessageProvider?n.systemSettings.commitMessageProvider:null,w=p(["--provider"])||r||n.aiProvider||"Google",U=p(["--model"])||L||n.activeModel||c(w,n.apiTier)||c(w,"paid"),h=p(["--key"])||await x(w);!h&&!(w==="c_openai"&&n.systemSettings?.customOpenAIBaseUrl)&&(console.error(`[ERROR] No API key resolved for provider "${w}".`),process.exit(1));let S=await y("agent",{aiProvider:w});S.allowed||(console.error(`[ERROR] ${S.reason||"Budget Exhausted"} - adjust with /budget set.`),process.exit(1));let{name:ie="",nickname:_="",instructions:D=""}=n?.profileData??{},P={aiProvider:w,apiKey:h,model:U,mode:"flow",thinkingLevel:p(["--thinking"])||"Fast",systemSettings:n.systemSettings||{}},H=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",b=new Date,X=b.getFullYear(),B=b.toLocaleString("en-US",{month:"short"}).toUpperCase(),V=String(b.getDate()).padStart(2,"0"),E=b.toLocaleTimeString([],{hour:"2-digit",hour12:!0}),F=`${X}-${B}-${V}, ${E}`,J=(P.model||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),j=ee.basename(J).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase().trim()),z=`Identity: FluxFlow. Sassy, CLI Assistant
84
+ ${s}`:s=a}}s||(console.error("[ERROR] -p/--prompt requires a prompt string (or piped stdin input)."),process.exit(1));let{loadSettings:C}=await import("./chunks/settings-PUFSRWT3.js"),{getProviderAPIKey:x}=await import("./chunks/secrets-TNMLVMST.js"),{getDefaultModel:c}=await import("./chunks/model_config-QRYAVWHF.js"),{generateSimpleContent:m}=await import("./chunks/ai-ZMBQQ3QP.js"),{checkQuotaDetailed:y}=await import("./chunks/usage-EBE2OVES.js"),n=await C(),k=t.filter(e=>e!=="-p"&&e!=="--prompt"&&e!==s&&e!=="-n"&&e!=="--new"),A=M||k.includes("--raw")||t.includes("--raw"),p=e=>{for(let a of e){let l=k.indexOf(a);if(l!==-1&&l+1<k.length)return k[l+1]}return null},L=M&&n.systemSettings?.commitMessageModel&&n.systemSettings.commitMessageModel!=="Default"?n.systemSettings.commitMessageModel:null,r=M&&L&&n.systemSettings?.commitMessageProvider?n.systemSettings.commitMessageProvider:null,w=p(["--provider"])||r||n.aiProvider||"Google",U=p(["--model"])||L||n.activeModel||c(w,n.apiTier)||c(w,"paid"),h=p(["--key"])||await x(w);!h&&!(w==="c_openai"&&n.systemSettings?.customOpenAIBaseUrl)&&(console.error(`[ERROR] No API key resolved for provider "${w}".`),process.exit(1));let S=await y("agent",{aiProvider:w});S.allowed||(console.error(`[ERROR] ${S.reason||"Budget Exhausted"} - adjust with /budget set.`),process.exit(1));let{name:ie="",nickname:_="",instructions:D=""}=n?.profileData??{},P={aiProvider:w,apiKey:h,model:U,mode:"flow",thinkingLevel:p(["--thinking"])||"Fast",systemSettings:n.systemSettings||{}},H=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",b=new Date,X=b.getFullYear(),B=b.toLocaleString("en-US",{month:"short"}).toUpperCase(),V=String(b.getDate()).padStart(2,"0"),E=b.toLocaleTimeString([],{hour:"2-digit",hour12:!0}),F=`${X}-${B}-${V}, ${E}`,J=(P.model||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),j=ee.basename(J).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase().trim()),z=`Identity: FluxFlow. Sassy, CLI Assistant
85
85
  Use NO markdown, only plain text
86
86
  Context:
87
87
  - OS: ${H}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxflow-cli",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "date": "2026-11-07",
5
5
  "description": "One of the lightest, fastest, high-fidelity agentic CLI with sub-agents & advance computer use.",
6
6
  "keywords": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxflow-cli",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "date": "2026-11-07",
5
5
  "description": "One of the lightest, fastest, high-fidelity agentic CLI with sub-agents & advance computer use.",
6
6
  "keywords": [
@@ -1,15 +0,0 @@
1
- import{a as T}from"./chunk-Y5JU726N.js";import m from"fs";import R from"path";var A=new Set([".git","node_modules",".gemini","dist","build",".next","out",".cache","bin","obj","vendor","venv",".idea",".gradle",".terraform","target","coverage",".vscode",".svn",".hg",".fslckout",".github",".gitlab",".circleci",".gitea",".gitee",".lerna",".changeset",".nx",".npm",".yarn",".pnpm-store",".expo",".nuxt",".svelte-kit",".docusaurus",".turbo",".vercel","bower_components",".netlify",".vuepress",".quasar",".output",".angular","jspm_packages",".parcel-cache",".rollup.cache",".rspack",".vitepress","__pycache__",".pytest_cache",".mypy_cache",".tox",".poetry","env","vhdl",".ipynb_checkpoints",".jupyter",".conda",".pdm-build",".bundle",".yardoc",".metadata","App_Data","ClientBin",".cargo",".rustc_info",".go","Godeps","_vendor",".rake_tasks","CMakefiles",".wakatime",".dart_tool",".fvm",".cocoapods","Pods",".pub-cache",".symlinks","DerivedData",".xcworkspace",".serverless",".aws",".gcloud",".azure",".kube",".vagrant",".docker","postgres-data","redis-data","mongo-data",".Spotlight-V100",".Trashes","$RECYCLE.BIN","System Volume Information",".DocumentRevisions-V100",".fseventsd","AppData","Application Data","Local","LocalLow","Roaming","$WinREAgent","$WINDOWS.~BT","$WINDOWS.~WS","scw","System32","SysWOW64",".AppleDouble",".AppleDB",".AppleDesktop","_CodeSignature",".cmio",".LSOverride",".localized",".TemporaryItems",".Trash",".Trash-0",".Trash-1000",".gvfs",".local",".config",".dbus",".fontconfig",".snap",".var",".lost+found","lost+found",".thumb",".thumbnails","EFI","boot","grub","logs","log",".nyc_output",".sonar",".ruff_cache",".VSCodeCounter",".skills","skills"]),C=i=>A.has(i)||i.startsWith(".pnpm"),I=i=>{try{let n=String(i.getMonth()+1).padStart(2,"0"),a=String(i.getDate()).padStart(2,"0"),o=String(i.getHours()).padStart(2,"0"),s=String(i.getMinutes()).padStart(2,"0");return`${n}-${a} ${o}:${s}`}catch{return"N/A"}},M=async i=>{let n=T(i),a=n.path||null;if(!a)return"ERROR: No directory path provided.";if(a.trim().toLowerCase().startsWith("#skills"))return"ERROR: '#skill' is reserved VFS namespace, not folder. Use 'ReadFile' to read specific skills.";let o=1;if(n.recurse!==void 0&&n.recurse!==null)if(typeof n.recurse=="number")o=n.recurse;else if(typeof n.recurse=="boolean")o=n.recurse?2:1;else{let s=parseInt(String(n.recurse).trim(),10);o=isNaN(s)?1:s}o=Math.max(1,Math.min(3,o));try{let s=R.resolve(process.cwd(),a);if(!m.existsSync(s))return`ERROR: Path [${a}] does not exist.`;if(!m.statSync(s).isDirectory())return`ERROR: Path [${a}] is a file, not a directory. Use ReadFile instead.`;if(o===1){let p=m.readdirSync(s),l=p.length,u=150,g=p.slice(0,u),d=[];for(let r of g){let $=R.join(s,r),e={name:r,type:"unknown",size:"N/A",mtime:"N/A"};try{let t=m.statSync($);e={name:r,type:t.isDirectory()?"directory":"file",size:(t.size/1024).toFixed(1)+"KB",mtime:I(t.mtime)}}catch{e.type="inaccessible"}d.push(e)}let y=d.map(r=>r.type==="directory"?`${r.name}/`:`${r.name} (${r.size}, ${r.mtime})`).join(`
2
- `),c=`
3
-
4
- (Total items in folder: ${l})`;return l>u&&(c=`
5
-
6
- TRUNCATED: Showing first ${u} of ${l} items.`),p.length=0,g.length=0,d.length=0,`Detailed folder stats for [${a}]:
7
-
8
- ${y}${c}`}let b=0,v=0,f=0,h=500,S=!1,_=(p,l,u=1)=>{if(l>o||S)return[];let g=[];try{g=m.readdirSync(p)}catch{return[`${" ".repeat(u-1)}[Inaccessible Directory]`]}let d=[],y=[];for(let e of g){let t=R.join(p,e),D=!1;try{D=m.statSync(t).isDirectory()}catch{}D?d.push({name:e,fullPath:t}):y.push({name:e,fullPath:t})}d.sort((e,t)=>e.name.localeCompare(t.name)),y.sort((e,t)=>e.name.localeCompare(t.name));let c=[],r=" ".repeat(u-1);for(let e of d){if(f>=h){S=!0,c.push(`${r}[Truncated - Maximum item limit reached (${h})]`);break}if(f++,b++,c.push(`${r}${e.name}/`),l<o&&!C(e.name)){let t=_(e.fullPath,l+1,u+1);c.push(...t)}}let $=[];for(let e of y){if(f>=h){S=!0,c.push(`${r}[Truncated - Maximum item limit reached (${h})]`);break}f++,v++;let t="N/A";try{t=(m.statSync(e.fullPath).size/1024).toFixed(1)+"KB"}catch{}$.push(`${e.name} (${t})`)}return $.length>0&&c.push(`${r}${$.join("; ")}`),c},E=_(s,1,1).join(`
9
- `),x=`
10
-
11
- (Total items scanned: ${f}, Directories: ${b}, Files: ${v})`;return S&&(x=`
12
-
13
- TRUNCATED: Scan capped at ${h} items. (Directories: ${b}, Files: ${v})`),`Detailed directory tree for [${a}] (recursive depth: ${o}):
14
-
15
- ${E}${x}`}catch(s){let k=s instanceof Error?s.message:String(s);return`ERROR: Failed to read folder [${a}]: ${k}`}};export{M as read_folder};
@@ -1,8 +0,0 @@
1
- import{a as Y}from"./chunk-Y5JU726N.js";import{b as Q}from"./chunk-B4UKMX5E.js";import"./chunk-LQM3JK7N.js";import"./chunk-P5HBJA23.js";import{w as V,x as q,y as J}from"./chunk-26BQ45XP.js";import K from"fs/promises";import E from"path";import j from"fast-glob";import{Minimatch as tt}from"minimatch";async function A(f,o,n=f,p=1){if(p>12)return[];let h=[],s;try{s=await K.readdir(f,{withFileTypes:!0})}catch{return[]}for(let t of s){let a=E.join(f,t.name),y=E.relative(n,a),L=y.split(E.sep).map(w=>w.toLowerCase()),O=t.name.toLowerCase();if(!o.some(w=>{let F=w.toLowerCase();return F.startsWith(".")&&O.endsWith(F)?!0:L.some(M=>M===F||M.startsWith(".pnpm"))}))if(t.isDirectory()){let w=await A(a,o,n,p+1);h=h.concat(w)}else t.isFile()&&h.push({fullPath:a,relativePath:y})}return h}function rt(f,o,n=1/0){if(f===o)return 0;if(f.length===0)return o.length;if(o.length===0)return f.length;if(Math.abs(f.length-o.length)>n)return n+1;let p=Array.from({length:o.length+1},(h,s)=>s);for(let h=1;h<=f.length;h++){let s=[h],t=h;for(let a=1;a<=o.length;a++){let y=f[h-1]===o[a-1]?0:1,L=Math.min(s[a-1]+1,p[a]+1,p[a-1]+y);s.push(L),L<t&&(t=L)}if(p=s,t>n)return n+1}return p[o.length]}function nt(f,o){if(!f||!o)return!1;let n=f.toLowerCase(),p=o.toLowerCase();if(n.includes(p))return!0;let h=n.split(/[^a-z0-9]+/).filter(t=>t.length>0),s=p.split(/[^a-z0-9]+/).filter(t=>t.length>1||p.length===1&&t.length>0);return s.length===0?!1:s.every(t=>{let a=t.length<=2?0:t.length<=5?1:2;for(let y of h)if(y.includes(t)||t.length>=3&&y.length>=3&&Math.abs(y.length-t.length)<=a&&rt(t,y,a)<=a)return!0;return!1})}var gt=async f=>{let{keyword:o,path:n,fuzzy:p,subString:h,regex:s}=Y(f);if(o==null)return'ERROR: Missing "keyword" argument.';let t=String(o);if(n){let e=n.trim().toLowerCase();if(e==="#docs"||e==="#doc"||e==="#documentation"||e.includes("#skill/global/fluxflow")||e.startsWith("#skill"))return"ERROR: Cannot search in reserved VFS '#skill' namespace. Use 'ReadFile' to read specific skills."}let a=e=>e===!0||e==="true"||e===1||e==="1"||e==="yes",y=s===!1||s==="false"||s===0||s==="0"||s==="no",L=s===!0||s==="true"||s===1||s==="1"||s==="yes",O=a(p)||a(h),G=null,w=null;if(y)O||(w=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i"));else{try{let e=L?t:t.replace(/\|\|/g,"|");G=new RegExp(e,"i")}catch(e){if(L)return`ERROR: Invalid regex pattern "${t}": ${e.message}`}w=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i")}let F=Array.from(new Set([...V,...q(process.cwd())])),M=150;try{let e=[],P=process.cwd(),u=null;if(n){let i=r=>r.startsWith("!")||!r.startsWith("-")?r:"!"+r.replace(/^-+/,""),g=n.split(";").map(r=>r.trim()).filter(Boolean).map(i).filter(r=>r!=="!"),c=g.some(r=>r.startsWith("!"));if(g.some(r=>j.isDynamicPattern(r)||/[*?{}[\]()|+]/.test(r))){u="glob";let r=n.replace(/\\/g,"/"),l=g.map(m=>m.replace(/\\/g,"/")),z=F.map(m=>m.startsWith(".")?`**/*${m}`:`**/${m}/**`);if(c&&!g.some(m=>!m.startsWith("!"))){let m=await A(P,F,P),R=$=>$.endsWith("/")?$+"**":$,d=l.filter($=>$.startsWith("!")).map($=>R($.slice(1))),v=l.filter($=>!$.startsWith("!")).map(R);e=m.filter($=>{let x=$.relativePath.replace(/\\/g,"/"),_=v.length===0||v.some(b=>{try{return new tt(b).match(x)}catch{return!1}}),Z=d.some(b=>{try{return new tt(b).match(x)}catch{return!1}});return _&&!Z})}else{let m=l.some(d=>/[\(\)\|]|\.\*/.test(d)),R=[];if(!m)try{R=await j(l,{cwd:P,ignore:z,dot:!0,onlyFiles:!0,absolute:!1})}catch{R=[]}if(R.length===0&&(m||j.isDynamicPattern(r))){let d=r.match(/^([^\*\?\(\)\|\[\]\s]+)\//),v=d&&!/[\*\?\(\)\|\[\]]/.test(d[1])?E.resolve(P,d[1]):P,$=await A(v,F,P);try{let x=r.replace(/^\.\//,"");x=x.replace(/\.\*\/(\\.|[^\/])/g,".*$1"),!x.startsWith("^")&&!x.startsWith(".*")&&(x=`.*${x}`);let _=new RegExp(x.endsWith("$")?x:`${x}$`,"i");e=$.filter(Z=>{let b=Z.relativePath.replace(/\\/g,"/");return _.test(b)})}catch{e=[]}}else e=R.map(d=>({fullPath:E.resolve(P,d),relativePath:d}))}}else{let r=[],l=!1,z=!1;for(let k of g){let m=k.replace(/[\/\\]+$/,""),R=E.resolve(P,m);try{let d=await K.stat(R);if(d.isDirectory()){z=!0;let v=await A(R,F,P);r.push(...v)}else if(d.isFile())l=!0,r.push({fullPath:R,relativePath:E.relative(P,R)});else return`ERROR: Path is neither a file nor a directory: ${k}`}catch{return`ERROR: Path not found: ${k}`}}e=r,l&&!z?u="file":u="dir"}}else e=await A(P,F);let et=e.map(async i=>{try{let g=await K.readFile(i.fullPath,"utf-8");if(g.includes("\0"))return[];let c=g.split(/\r?\n/),W=[];for(let l=0;l<c.length;l++)(O?c[l].toLowerCase().includes(t.toLowerCase())||nt(c[l],t):y?w&&w.test(c[l]):G&&G.test(c[l])||w&&w.test(c[l]))&&W.push({line:l+1,content:c[l].trim()});return W.length===0?null:{path:i.relativePath.replace(/\\/g,"/"),matches:W}}catch{return[]}}),st=await Promise.all(et),S=[],D=0;for(let i of st){if(!i||!i.matches)continue;if(D>=M)break;let g=M-D,c=i.matches.slice(0,g);S.push({path:i.path,matches:c}),D+=c.length}typeof global.gc=="function"&&global.gc();let I=null;if(S.length===0){let i=u==="file"?` in '${n}'`:u==="dir"||u==="glob"?` in '${n}'`:". Try to specify files",g=u==="dir"?"[DIR]":u==="glob"?"[GLOB]":"";return`${g}${g?" ":""}Found 0 matches of '${t}'${i}${I?` ${I}`:""}`}let B=I?` ${I}`:"",T=`${S.length} file${S.length===1?"":"s"}`,U=`${D} match${D===1?"":"es"}`,N;u==="file"?N=`Found ${U} of '${t}' in '${n}'${B}:`:u==="dir"||u==="glob"?N=`Found ${U} of '${t}' in '${n}' across ${T}${B}:`:N=`Found ${U} of '${t}' across ${T}${B}:`;let X=u==="dir"?"[DIR]":u==="glob"?"[GLOB]":"",C=`${X}${X?" ":""}${N}
2
-
3
- `,H="";try{let i=await Q();i?.systemSettings?.alwaysAskFiles&&(H=i.systemSettings.alwaysAskFiles)}catch{}for(let i of S)if(C+=`${i.path}:
4
- `,J(i.path,H)){let c=i.matches.map(W=>`Line ${W.line}`).join(", ");C+=` ${c}. Line snapshot not available due to file restriction policy. ReadFile if needed
5
-
6
- `}else{for(let c of i.matches)C+=` Line ${c.line}: ${c.content}
7
- `;C+=`
8
- `}return C.trimEnd()}catch(e){return`ERROR: ${e.message}`}};export{gt as search_keyword};