@ag-bash/bash
Advanced tools
| #!/usr/bin/env node | ||
| import{a as r}from"./chunk-FKNRDXJH.js";import{a as o}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var s={name:"about",summary:"show ag-bash features, architecture, and quick-start guide",usage:"about [OPTIONS]",options:["--version print version only","--features list all features with status","--architecture show architecture diagram"]},i=["113+ Commands (Core I/O, Text, Data, Search, Agentic, Network)","Multi-Runtime (Bash + Python3 WASM + JavaScript QuickJS)","Agent RunLoop (autonomous LLM execution with budget control)","Tagged Template API (createShell with injection-safe escaping)","Self-Healing (typo correction with exponential backoff retry)","MCP Server (40+ tools exposed via Model Context Protocol)","OpenTelemetry (optional zero-overhead distributed tracing)","Trap Handlers (EXIT/ERR/DEBUG/RETURN fire correctly)","Streaming Execution (AsyncGenerator output chunks)","Copy-on-Write Filesystem (multi-agent isolation)","Observation Summarizer (structured turn context for LLMs)","Multi-Framework AI Adapters (Vercel/OpenAI/Anthropic/LangChain)","Defense-in-Depth Security (sandboxed, no real OS access)","Tiered Exports (slim, advanced, browser-core, testing, ai, agent-runtime)"],u=` Input Script | ||
| | | ||
| v | ||
| Parser (Tree-sitter + Recursive Descent) | ||
| | | ||
| v | ||
| AST (Abstract Syntax Tree with ASTCache) | ||
| | | ||
| v | ||
| Interpreter (Expansion -> Resolution -> Execution) | ||
| | | ||
| v | ||
| ExecResult { stdout, stderr, exitCode } | ||
| Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite | CowFs) | ||
| Security: Defense-in-Depth + AsyncLocalStorage scoping | ||
| Runtimes: Bash + CPython (WASM) + QuickJS (WASM)`,p={name:"about",execute:async(n,c)=>{if(n.includes("--help")||n.includes("-h"))return o(s);if(n.includes("--version")||n.includes("-v"))return{stdout:`${r} | ||
| `,stderr:"",exitCode:0};if(n.includes("--features")){let t=`ag-bash v${r} \u2014 Features: | ||
| `;for(let a of i)t+=` * ${a} | ||
| `;return{stdout:t,stderr:"",exitCode:0}}if(n.includes("--architecture")){let t=`ag-bash v${r} \u2014 Architecture: | ||
| `;return t+=`${u} | ||
| `,{stdout:t,stderr:"",exitCode:0}}let e="";e+=`ag-bash v${r} \u2014 AI-Native Sandboxed Bash Runtime | ||
| `,e+=`${"=".repeat(52)} | ||
| `,e+=`ARCHITECTURE | ||
| `,e+=` Input -> Parser (Tree-sitter) -> AST -> Interpreter -> ExecResult | ||
| `,e+=` Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite) | ||
| `,e+=` Security: Defense-in-Depth + Sandboxed Execution | ||
| `,e+=`FEATURES | ||
| `;for(let t of i)e+=` * ${t} | ||
| `;return e+=` | ||
| `,e+=`QUICK START | ||
| `,e+=` Run: commands - Browse all available commands | ||
| `,e+=` Run: doctor - Verify your environment | ||
| `,e+=` Run: help <builtin> - Shell builtin help | ||
| `,e+=` Run: <command> --help - Command-specific help | ||
| `,e+=`LINKS | ||
| `,e+=` GitHub: https://github.com/sairam0424/ag-bash | ||
| `,e+=` Docs: See docs/user-guide.md | ||
| `,{stdout:e,stderr:"",exitCode:0}}};export{p as aboutCommand}; |
| #!/usr/bin/env node | ||
| var o="6.0.2";export{o as a}; |
| #!/usr/bin/env node | ||
| import{a as k}from"./chunk-FKNRDXJH.js";import{a as f}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var E={name:"doctor",summary:"verify ag-bash environment health",usage:"doctor [OPTIONS]",options:["--quick only run essential checks (fast)","--verbose show detailed output for each check"],examples:["doctor # run all checks","doctor --quick # fast essential checks only"]};async function d(i,a,l,r){if(!i.exec)return{name:a,passed:!1,detail:"exec not available"};try{let t=await i.exec(l,{cwd:i.cwd});return t.exitCode!==0?{name:a,passed:!1,detail:t.stderr.trim()||`exit code ${t.exitCode}`}:r!==void 0&&!t.stdout.includes(r)?{name:a,passed:!1,detail:`expected "${r}", got "${t.stdout.trim()}"`}:{name:a,passed:!0,detail:t.stdout.trim()}}catch(t){let e=t instanceof Error?t.message:String(t);return{name:a,passed:!1,detail:e}}}var S={name:"doctor",execute:async(i,a)=>{if(i.includes("--help")||i.includes("-h"))return f(E);let l=i.includes("--quick"),r=i.includes("--verbose"),t=[],e=`ag-bash doctor v${k} \u2014 Environment Health Check | ||
| `;e+=`CORE ENGINE | ||
| `;let $=[{name:"Interpreter operational",script:"echo hello",expected:"hello"},{name:"Variable expansion",script:"x=42; echo $x",expected:"42"},{name:"Pipe execution",script:"echo test | cat",expected:"test"},{name:"Command substitution",script:"echo $(echo nested)",expected:"nested"},{name:"Arithmetic expansion",script:"echo $((2 + 3))",expected:"5"}];for(let n of $){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}e+=` | ||
| `,e+=`FILESYSTEM | ||
| `;let x=[{name:"File write/read",script:"echo content > /tmp/doctor_test && cat /tmp/doctor_test",expected:"content"},{name:"Directory creation",script:"mkdir -p /tmp/doctor_dir && ls -d /tmp/doctor_dir",expected:"/tmp/doctor_dir"},{name:"File deletion",script:"rm /tmp/doctor_test && test ! -f /tmp/doctor_test && echo ok",expected:"ok"}];for(let n of x){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}if(e+=` | ||
| `,!l){let n=a.getRegisteredCommands?a.getRegisteredCommands():[];e+=`COMMANDS (${n.length} registered) | ||
| `;let c=[{name:"Core I/O (echo, cat, ls)",script:"echo ok && cat /dev/null && ls / > /dev/null && echo pass",expected:"pass"},{name:"Text processing (grep, sort)",script:"echo hello | grep hello && echo a | sort && echo pass",expected:"pass"},{name:"Data (jq, base64)",script:`echo '{"a":1}' | jq .a && echo pass`,expected:"pass"}];for(let o of c){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`FEATURES | ||
| `;let g=[{name:"Brace expansion",script:"echo {1..3}",expected:"1 2 3"},{name:"Parameter default",script:"echo ${UNSET_VAR:-fallback}",expected:"fallback"},{name:"Glob expansion",script:"mkdir -p /tmp/dglob && touch /tmp/dglob/a.txt /tmp/dglob/b.txt && ls /tmp/dglob/*.txt | wc -l",expected:"2"},{name:"Conditional execution",script:"true && echo yes || echo no",expected:"yes"}];for(let o of g){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`OPTIONAL RUNTIMES | ||
| `;let b=[{name:"Python3 (WASM)",script:"python3 -c 'print(1+1)'",flag:"--python"},{name:"JavaScript (QuickJS)",script:"js-exec -e 'console.log(1+1)'",flag:"--javascript"},{name:"Network (curl)",script:"echo network-check",flag:"--allow-network"}];for(let o of b){if(!a.exec){t.push({name:o.name,passed:!1,skipped:!0}),e+=` - ${o.name} (not available) | ||
| `;continue}let s=await d(a,o.name,o.script);s.passed?(e+=` * ${o.name} | ||
| `,t.push(s)):(e+=` - ${o.name} (not enabled \u2014 use ${o.flag}) | ||
| `,t.push({...s,skipped:!0}))}e+=` | ||
| `}let m=t.filter(n=>n.passed).length,p=t.filter(n=>!n.passed&&!n.skipped).length,h=t.filter(n=>n.skipped).length,u=m+p;return p===0?e+=`RESULT: ${m}/${u} checks passed * | ||
| `:e+=`RESULT: ${m}/${u} checks passed, ${p} FAILED | ||
| `,h>0&&(e+=` (${h} optional checks skipped) | ||
| `),{stdout:e,stderr:"",exitCode:p>0?1:0}}};export{S as doctorCommand}; |
| #!/usr/bin/env node | ||
| import{a as r}from"./chunk-FKNRDXJH.js";import{a as o}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var s={name:"about",summary:"show ag-bash features, architecture, and quick-start guide",usage:"about [OPTIONS]",options:["--version print version only","--features list all features with status","--architecture show architecture diagram"]},i=["113+ Commands (Core I/O, Text, Data, Search, Agentic, Network)","Multi-Runtime (Bash + Python3 WASM + JavaScript QuickJS)","Agent RunLoop (autonomous LLM execution with budget control)","Tagged Template API (createShell with injection-safe escaping)","Self-Healing (typo correction with exponential backoff retry)","MCP Server (40+ tools exposed via Model Context Protocol)","OpenTelemetry (optional zero-overhead distributed tracing)","Trap Handlers (EXIT/ERR/DEBUG/RETURN fire correctly)","Streaming Execution (AsyncGenerator output chunks)","Copy-on-Write Filesystem (multi-agent isolation)","Observation Summarizer (structured turn context for LLMs)","Multi-Framework AI Adapters (Vercel/OpenAI/Anthropic/LangChain)","Defense-in-Depth Security (sandboxed, no real OS access)","Tiered Exports (slim, advanced, browser-core, testing, ai, agent-runtime)"],u=` Input Script | ||
| | | ||
| v | ||
| Parser (Tree-sitter + Recursive Descent) | ||
| | | ||
| v | ||
| AST (Abstract Syntax Tree with ASTCache) | ||
| | | ||
| v | ||
| Interpreter (Expansion -> Resolution -> Execution) | ||
| | | ||
| v | ||
| ExecResult { stdout, stderr, exitCode } | ||
| Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite | CowFs) | ||
| Security: Defense-in-Depth + AsyncLocalStorage scoping | ||
| Runtimes: Bash + CPython (WASM) + QuickJS (WASM)`,p={name:"about",execute:async(n,c)=>{if(n.includes("--help")||n.includes("-h"))return o(s);if(n.includes("--version")||n.includes("-v"))return{stdout:`${r} | ||
| `,stderr:"",exitCode:0};if(n.includes("--features")){let t=`ag-bash v${r} \u2014 Features: | ||
| `;for(let a of i)t+=` * ${a} | ||
| `;return{stdout:t,stderr:"",exitCode:0}}if(n.includes("--architecture")){let t=`ag-bash v${r} \u2014 Architecture: | ||
| `;return t+=`${u} | ||
| `,{stdout:t,stderr:"",exitCode:0}}let e="";e+=`ag-bash v${r} \u2014 AI-Native Sandboxed Bash Runtime | ||
| `,e+=`${"=".repeat(52)} | ||
| `,e+=`ARCHITECTURE | ||
| `,e+=` Input -> Parser (Tree-sitter) -> AST -> Interpreter -> ExecResult | ||
| `,e+=` Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite) | ||
| `,e+=` Security: Defense-in-Depth + Sandboxed Execution | ||
| `,e+=`FEATURES | ||
| `;for(let t of i)e+=` * ${t} | ||
| `;return e+=` | ||
| `,e+=`QUICK START | ||
| `,e+=` Run: commands - Browse all available commands | ||
| `,e+=` Run: doctor - Verify your environment | ||
| `,e+=` Run: help <builtin> - Shell builtin help | ||
| `,e+=` Run: <command> --help - Command-specific help | ||
| `,e+=`LINKS | ||
| `,e+=` GitHub: https://github.com/sairam0424/ag-bash | ||
| `,e+=` Docs: See docs/user-guide.md | ||
| `,{stdout:e,stderr:"",exitCode:0}}};export{p as aboutCommand}; |
| #!/usr/bin/env node | ||
| var o="6.0.2";export{o as a}; |
| #!/usr/bin/env node | ||
| import{a as k}from"./chunk-FKNRDXJH.js";import{a as f}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var E={name:"doctor",summary:"verify ag-bash environment health",usage:"doctor [OPTIONS]",options:["--quick only run essential checks (fast)","--verbose show detailed output for each check"],examples:["doctor # run all checks","doctor --quick # fast essential checks only"]};async function d(i,a,l,r){if(!i.exec)return{name:a,passed:!1,detail:"exec not available"};try{let t=await i.exec(l,{cwd:i.cwd});return t.exitCode!==0?{name:a,passed:!1,detail:t.stderr.trim()||`exit code ${t.exitCode}`}:r!==void 0&&!t.stdout.includes(r)?{name:a,passed:!1,detail:`expected "${r}", got "${t.stdout.trim()}"`}:{name:a,passed:!0,detail:t.stdout.trim()}}catch(t){let e=t instanceof Error?t.message:String(t);return{name:a,passed:!1,detail:e}}}var S={name:"doctor",execute:async(i,a)=>{if(i.includes("--help")||i.includes("-h"))return f(E);let l=i.includes("--quick"),r=i.includes("--verbose"),t=[],e=`ag-bash doctor v${k} \u2014 Environment Health Check | ||
| `;e+=`CORE ENGINE | ||
| `;let $=[{name:"Interpreter operational",script:"echo hello",expected:"hello"},{name:"Variable expansion",script:"x=42; echo $x",expected:"42"},{name:"Pipe execution",script:"echo test | cat",expected:"test"},{name:"Command substitution",script:"echo $(echo nested)",expected:"nested"},{name:"Arithmetic expansion",script:"echo $((2 + 3))",expected:"5"}];for(let n of $){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}e+=` | ||
| `,e+=`FILESYSTEM | ||
| `;let x=[{name:"File write/read",script:"echo content > /tmp/doctor_test && cat /tmp/doctor_test",expected:"content"},{name:"Directory creation",script:"mkdir -p /tmp/doctor_dir && ls -d /tmp/doctor_dir",expected:"/tmp/doctor_dir"},{name:"File deletion",script:"rm /tmp/doctor_test && test ! -f /tmp/doctor_test && echo ok",expected:"ok"}];for(let n of x){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}if(e+=` | ||
| `,!l){let n=a.getRegisteredCommands?a.getRegisteredCommands():[];e+=`COMMANDS (${n.length} registered) | ||
| `;let c=[{name:"Core I/O (echo, cat, ls)",script:"echo ok && cat /dev/null && ls / > /dev/null && echo pass",expected:"pass"},{name:"Text processing (grep, sort)",script:"echo hello | grep hello && echo a | sort && echo pass",expected:"pass"},{name:"Data (jq, base64)",script:`echo '{"a":1}' | jq .a && echo pass`,expected:"pass"}];for(let o of c){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`FEATURES | ||
| `;let g=[{name:"Brace expansion",script:"echo {1..3}",expected:"1 2 3"},{name:"Parameter default",script:"echo ${UNSET_VAR:-fallback}",expected:"fallback"},{name:"Glob expansion",script:"mkdir -p /tmp/dglob && touch /tmp/dglob/a.txt /tmp/dglob/b.txt && ls /tmp/dglob/*.txt | wc -l",expected:"2"},{name:"Conditional execution",script:"true && echo yes || echo no",expected:"yes"}];for(let o of g){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`OPTIONAL RUNTIMES | ||
| `;let b=[{name:"Python3 (WASM)",script:"python3 -c 'print(1+1)'",flag:"--python"},{name:"JavaScript (QuickJS)",script:"js-exec -e 'console.log(1+1)'",flag:"--javascript"},{name:"Network (curl)",script:"echo network-check",flag:"--allow-network"}];for(let o of b){if(!a.exec){t.push({name:o.name,passed:!1,skipped:!0}),e+=` - ${o.name} (not available) | ||
| `;continue}let s=await d(a,o.name,o.script);s.passed?(e+=` * ${o.name} | ||
| `,t.push(s)):(e+=` - ${o.name} (not enabled \u2014 use ${o.flag}) | ||
| `,t.push({...s,skipped:!0}))}e+=` | ||
| `}let m=t.filter(n=>n.passed).length,p=t.filter(n=>!n.passed&&!n.skipped).length,h=t.filter(n=>n.skipped).length,u=m+p;return p===0?e+=`RESULT: ${m}/${u} checks passed * | ||
| `:e+=`RESULT: ${m}/${u} checks passed, ${p} FAILED | ||
| `,h>0&&(e+=` (${h} optional checks skipped) | ||
| `),{stdout:e,stderr:"",exitCode:p>0?1:0}}};export{S as doctorCommand}; |
| import{a as r}from"./chunk-3OYDEY6T.js";import{a as o}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var s={name:"about",summary:"show ag-bash features, architecture, and quick-start guide",usage:"about [OPTIONS]",options:["--version print version only","--features list all features with status","--architecture show architecture diagram"]},i=["113+ Commands (Core I/O, Text, Data, Search, Agentic, Network)","Multi-Runtime (Bash + Python3 WASM + JavaScript QuickJS)","Agent RunLoop (autonomous LLM execution with budget control)","Tagged Template API (createShell with injection-safe escaping)","Self-Healing (typo correction with exponential backoff retry)","MCP Server (40+ tools exposed via Model Context Protocol)","OpenTelemetry (optional zero-overhead distributed tracing)","Trap Handlers (EXIT/ERR/DEBUG/RETURN fire correctly)","Streaming Execution (AsyncGenerator output chunks)","Copy-on-Write Filesystem (multi-agent isolation)","Observation Summarizer (structured turn context for LLMs)","Multi-Framework AI Adapters (Vercel/OpenAI/Anthropic/LangChain)","Defense-in-Depth Security (sandboxed, no real OS access)","Tiered Exports (slim, advanced, browser-core, testing, ai, agent-runtime)"],u=` Input Script | ||
| | | ||
| v | ||
| Parser (Tree-sitter + Recursive Descent) | ||
| | | ||
| v | ||
| AST (Abstract Syntax Tree with ASTCache) | ||
| | | ||
| v | ||
| Interpreter (Expansion -> Resolution -> Execution) | ||
| | | ||
| v | ||
| ExecResult { stdout, stderr, exitCode } | ||
| Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite | CowFs) | ||
| Security: Defense-in-Depth + AsyncLocalStorage scoping | ||
| Runtimes: Bash + CPython (WASM) + QuickJS (WASM)`,p={name:"about",execute:async(n,c)=>{if(n.includes("--help")||n.includes("-h"))return o(s);if(n.includes("--version")||n.includes("-v"))return{stdout:`${r} | ||
| `,stderr:"",exitCode:0};if(n.includes("--features")){let t=`ag-bash v${r} \u2014 Features: | ||
| `;for(let a of i)t+=` * ${a} | ||
| `;return{stdout:t,stderr:"",exitCode:0}}if(n.includes("--architecture")){let t=`ag-bash v${r} \u2014 Architecture: | ||
| `;return t+=`${u} | ||
| `,{stdout:t,stderr:"",exitCode:0}}let e="";e+=`ag-bash v${r} \u2014 AI-Native Sandboxed Bash Runtime | ||
| `,e+=`${"=".repeat(52)} | ||
| `,e+=`ARCHITECTURE | ||
| `,e+=` Input -> Parser (Tree-sitter) -> AST -> Interpreter -> ExecResult | ||
| `,e+=` Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite) | ||
| `,e+=` Security: Defense-in-Depth + Sandboxed Execution | ||
| `,e+=`FEATURES | ||
| `;for(let t of i)e+=` * ${t} | ||
| `;return e+=` | ||
| `,e+=`QUICK START | ||
| `,e+=` Run: commands - Browse all available commands | ||
| `,e+=` Run: doctor - Verify your environment | ||
| `,e+=` Run: help <builtin> - Shell builtin help | ||
| `,e+=` Run: <command> --help - Command-specific help | ||
| `,e+=`LINKS | ||
| `,e+=` GitHub: https://github.com/sairam0424/ag-bash | ||
| `,e+=` Docs: See docs/user-guide.md | ||
| `,{stdout:e,stderr:"",exitCode:0}}};export{p as aboutCommand}; |
| var o="6.0.2";export{o as a}; |
| import{a as k}from"./chunk-3OYDEY6T.js";import{a as f}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var E={name:"doctor",summary:"verify ag-bash environment health",usage:"doctor [OPTIONS]",options:["--quick only run essential checks (fast)","--verbose show detailed output for each check"],examples:["doctor # run all checks","doctor --quick # fast essential checks only"]};async function d(i,a,l,r){if(!i.exec)return{name:a,passed:!1,detail:"exec not available"};try{let t=await i.exec(l,{cwd:i.cwd});return t.exitCode!==0?{name:a,passed:!1,detail:t.stderr.trim()||`exit code ${t.exitCode}`}:r!==void 0&&!t.stdout.includes(r)?{name:a,passed:!1,detail:`expected "${r}", got "${t.stdout.trim()}"`}:{name:a,passed:!0,detail:t.stdout.trim()}}catch(t){let e=t instanceof Error?t.message:String(t);return{name:a,passed:!1,detail:e}}}var S={name:"doctor",execute:async(i,a)=>{if(i.includes("--help")||i.includes("-h"))return f(E);let l=i.includes("--quick"),r=i.includes("--verbose"),t=[],e=`ag-bash doctor v${k} \u2014 Environment Health Check | ||
| `;e+=`CORE ENGINE | ||
| `;let $=[{name:"Interpreter operational",script:"echo hello",expected:"hello"},{name:"Variable expansion",script:"x=42; echo $x",expected:"42"},{name:"Pipe execution",script:"echo test | cat",expected:"test"},{name:"Command substitution",script:"echo $(echo nested)",expected:"nested"},{name:"Arithmetic expansion",script:"echo $((2 + 3))",expected:"5"}];for(let n of $){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}e+=` | ||
| `,e+=`FILESYSTEM | ||
| `;let x=[{name:"File write/read",script:"echo content > /tmp/doctor_test && cat /tmp/doctor_test",expected:"content"},{name:"Directory creation",script:"mkdir -p /tmp/doctor_dir && ls -d /tmp/doctor_dir",expected:"/tmp/doctor_dir"},{name:"File deletion",script:"rm /tmp/doctor_test && test ! -f /tmp/doctor_test && echo ok",expected:"ok"}];for(let n of x){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}if(e+=` | ||
| `,!l){let n=a.getRegisteredCommands?a.getRegisteredCommands():[];e+=`COMMANDS (${n.length} registered) | ||
| `;let c=[{name:"Core I/O (echo, cat, ls)",script:"echo ok && cat /dev/null && ls / > /dev/null && echo pass",expected:"pass"},{name:"Text processing (grep, sort)",script:"echo hello | grep hello && echo a | sort && echo pass",expected:"pass"},{name:"Data (jq, base64)",script:`echo '{"a":1}' | jq .a && echo pass`,expected:"pass"}];for(let o of c){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`FEATURES | ||
| `;let g=[{name:"Brace expansion",script:"echo {1..3}",expected:"1 2 3"},{name:"Parameter default",script:"echo ${UNSET_VAR:-fallback}",expected:"fallback"},{name:"Glob expansion",script:"mkdir -p /tmp/dglob && touch /tmp/dglob/a.txt /tmp/dglob/b.txt && ls /tmp/dglob/*.txt | wc -l",expected:"2"},{name:"Conditional execution",script:"true && echo yes || echo no",expected:"yes"}];for(let o of g){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`OPTIONAL RUNTIMES | ||
| `;let b=[{name:"Python3 (WASM)",script:"python3 -c 'print(1+1)'",flag:"--python"},{name:"JavaScript (QuickJS)",script:"js-exec -e 'console.log(1+1)'",flag:"--javascript"},{name:"Network (curl)",script:"echo network-check",flag:"--allow-network"}];for(let o of b){if(!a.exec){t.push({name:o.name,passed:!1,skipped:!0}),e+=` - ${o.name} (not available) | ||
| `;continue}let s=await d(a,o.name,o.script);s.passed?(e+=` * ${o.name} | ||
| `,t.push(s)):(e+=` - ${o.name} (not enabled \u2014 use ${o.flag}) | ||
| `,t.push({...s,skipped:!0}))}e+=` | ||
| `}let m=t.filter(n=>n.passed).length,p=t.filter(n=>!n.passed&&!n.skipped).length,h=t.filter(n=>n.skipped).length,u=m+p;return p===0?e+=`RESULT: ${m}/${u} checks passed * | ||
| `:e+=`RESULT: ${m}/${u} checks passed, ${p} FAILED | ||
| `,h>0&&(e+=` (${h} optional checks skipped) | ||
| `),{stdout:e,stderr:"",exitCode:p>0?1:0}}};export{S as doctorCommand}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
@@ -7,2 +7,2 @@ /** | ||
| */ | ||
| export declare const VERSION = "6.0.1"; | ||
| export declare const VERSION = "6.0.2"; |
+1
-1
@@ -7,2 +7,2 @@ /** | ||
| */ | ||
| export const VERSION = "6.0.1"; | ||
| export const VERSION = "6.0.2"; |
+1
-1
| { | ||
| "name": "@ag-bash/bash", | ||
| "version": "6.0.1", | ||
| "version": "6.0.2", | ||
| "description": "Unified Agentic Bash for Ag-Bash", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -54,3 +54,7 @@ import fs from "node:fs"; | ||
| copyFile(bashGrammar, path.join(ROOT_VENDOR, "tree-sitter-bash.wasm")); | ||
| // Also place into src/parser/vendor so the build's `cp src/parser/vendor/*` | ||
| // carries it into dist/parser/vendor — the dir the bundled bin reads at runtime | ||
| // (mirrors how web-tree-sitter.wasm is provisioned to both vendor dirs above). | ||
| copyFile(bashGrammar, path.join(SRC_VENDOR, "tree-sitter-bash.wasm")); | ||
| console.log("[setup-vendor] Binary synchronization COMPLETE."); |
| #!/usr/bin/env node | ||
| import{a as r}from"./chunk-SRHWVTRU.js";import{a as o}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var s={name:"about",summary:"show ag-bash features, architecture, and quick-start guide",usage:"about [OPTIONS]",options:["--version print version only","--features list all features with status","--architecture show architecture diagram"]},i=["113+ Commands (Core I/O, Text, Data, Search, Agentic, Network)","Multi-Runtime (Bash + Python3 WASM + JavaScript QuickJS)","Agent RunLoop (autonomous LLM execution with budget control)","Tagged Template API (createShell with injection-safe escaping)","Self-Healing (typo correction with exponential backoff retry)","MCP Server (40+ tools exposed via Model Context Protocol)","OpenTelemetry (optional zero-overhead distributed tracing)","Trap Handlers (EXIT/ERR/DEBUG/RETURN fire correctly)","Streaming Execution (AsyncGenerator output chunks)","Copy-on-Write Filesystem (multi-agent isolation)","Observation Summarizer (structured turn context for LLMs)","Multi-Framework AI Adapters (Vercel/OpenAI/Anthropic/LangChain)","Defense-in-Depth Security (sandboxed, no real OS access)","Tiered Exports (slim, advanced, browser-core, testing, ai, agent-runtime)"],u=` Input Script | ||
| | | ||
| v | ||
| Parser (Tree-sitter + Recursive Descent) | ||
| | | ||
| v | ||
| AST (Abstract Syntax Tree with ASTCache) | ||
| | | ||
| v | ||
| Interpreter (Expansion -> Resolution -> Execution) | ||
| | | ||
| v | ||
| ExecResult { stdout, stderr, exitCode } | ||
| Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite | CowFs) | ||
| Security: Defense-in-Depth + AsyncLocalStorage scoping | ||
| Runtimes: Bash + CPython (WASM) + QuickJS (WASM)`,p={name:"about",execute:async(n,c)=>{if(n.includes("--help")||n.includes("-h"))return o(s);if(n.includes("--version")||n.includes("-v"))return{stdout:`${r} | ||
| `,stderr:"",exitCode:0};if(n.includes("--features")){let t=`ag-bash v${r} \u2014 Features: | ||
| `;for(let a of i)t+=` * ${a} | ||
| `;return{stdout:t,stderr:"",exitCode:0}}if(n.includes("--architecture")){let t=`ag-bash v${r} \u2014 Architecture: | ||
| `;return t+=`${u} | ||
| `,{stdout:t,stderr:"",exitCode:0}}let e="";e+=`ag-bash v${r} \u2014 AI-Native Sandboxed Bash Runtime | ||
| `,e+=`${"=".repeat(52)} | ||
| `,e+=`ARCHITECTURE | ||
| `,e+=` Input -> Parser (Tree-sitter) -> AST -> Interpreter -> ExecResult | ||
| `,e+=` Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite) | ||
| `,e+=` Security: Defense-in-Depth + Sandboxed Execution | ||
| `,e+=`FEATURES | ||
| `;for(let t of i)e+=` * ${t} | ||
| `;return e+=` | ||
| `,e+=`QUICK START | ||
| `,e+=` Run: commands - Browse all available commands | ||
| `,e+=` Run: doctor - Verify your environment | ||
| `,e+=` Run: help <builtin> - Shell builtin help | ||
| `,e+=` Run: <command> --help - Command-specific help | ||
| `,e+=`LINKS | ||
| `,e+=` GitHub: https://github.com/sairam0424/ag-bash | ||
| `,e+=` Docs: See docs/user-guide.md | ||
| `,{stdout:e,stderr:"",exitCode:0}}};export{p as aboutCommand}; |
| #!/usr/bin/env node | ||
| var o="6.0.1";export{o as a}; |
| #!/usr/bin/env node | ||
| import{a as k}from"./chunk-SRHWVTRU.js";import{a as f}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var E={name:"doctor",summary:"verify ag-bash environment health",usage:"doctor [OPTIONS]",options:["--quick only run essential checks (fast)","--verbose show detailed output for each check"],examples:["doctor # run all checks","doctor --quick # fast essential checks only"]};async function d(i,a,l,r){if(!i.exec)return{name:a,passed:!1,detail:"exec not available"};try{let t=await i.exec(l,{cwd:i.cwd});return t.exitCode!==0?{name:a,passed:!1,detail:t.stderr.trim()||`exit code ${t.exitCode}`}:r!==void 0&&!t.stdout.includes(r)?{name:a,passed:!1,detail:`expected "${r}", got "${t.stdout.trim()}"`}:{name:a,passed:!0,detail:t.stdout.trim()}}catch(t){let e=t instanceof Error?t.message:String(t);return{name:a,passed:!1,detail:e}}}var S={name:"doctor",execute:async(i,a)=>{if(i.includes("--help")||i.includes("-h"))return f(E);let l=i.includes("--quick"),r=i.includes("--verbose"),t=[],e=`ag-bash doctor v${k} \u2014 Environment Health Check | ||
| `;e+=`CORE ENGINE | ||
| `;let $=[{name:"Interpreter operational",script:"echo hello",expected:"hello"},{name:"Variable expansion",script:"x=42; echo $x",expected:"42"},{name:"Pipe execution",script:"echo test | cat",expected:"test"},{name:"Command substitution",script:"echo $(echo nested)",expected:"nested"},{name:"Arithmetic expansion",script:"echo $((2 + 3))",expected:"5"}];for(let n of $){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}e+=` | ||
| `,e+=`FILESYSTEM | ||
| `;let x=[{name:"File write/read",script:"echo content > /tmp/doctor_test && cat /tmp/doctor_test",expected:"content"},{name:"Directory creation",script:"mkdir -p /tmp/doctor_dir && ls -d /tmp/doctor_dir",expected:"/tmp/doctor_dir"},{name:"File deletion",script:"rm /tmp/doctor_test && test ! -f /tmp/doctor_test && echo ok",expected:"ok"}];for(let n of x){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}if(e+=` | ||
| `,!l){let n=a.getRegisteredCommands?a.getRegisteredCommands():[];e+=`COMMANDS (${n.length} registered) | ||
| `;let c=[{name:"Core I/O (echo, cat, ls)",script:"echo ok && cat /dev/null && ls / > /dev/null && echo pass",expected:"pass"},{name:"Text processing (grep, sort)",script:"echo hello | grep hello && echo a | sort && echo pass",expected:"pass"},{name:"Data (jq, base64)",script:`echo '{"a":1}' | jq .a && echo pass`,expected:"pass"}];for(let o of c){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`FEATURES | ||
| `;let g=[{name:"Brace expansion",script:"echo {1..3}",expected:"1 2 3"},{name:"Parameter default",script:"echo ${UNSET_VAR:-fallback}",expected:"fallback"},{name:"Glob expansion",script:"mkdir -p /tmp/dglob && touch /tmp/dglob/a.txt /tmp/dglob/b.txt && ls /tmp/dglob/*.txt | wc -l",expected:"2"},{name:"Conditional execution",script:"true && echo yes || echo no",expected:"yes"}];for(let o of g){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`OPTIONAL RUNTIMES | ||
| `;let b=[{name:"Python3 (WASM)",script:"python3 -c 'print(1+1)'",flag:"--python"},{name:"JavaScript (QuickJS)",script:"js-exec -e 'console.log(1+1)'",flag:"--javascript"},{name:"Network (curl)",script:"echo network-check",flag:"--allow-network"}];for(let o of b){if(!a.exec){t.push({name:o.name,passed:!1,skipped:!0}),e+=` - ${o.name} (not available) | ||
| `;continue}let s=await d(a,o.name,o.script);s.passed?(e+=` * ${o.name} | ||
| `,t.push(s)):(e+=` - ${o.name} (not enabled \u2014 use ${o.flag}) | ||
| `,t.push({...s,skipped:!0}))}e+=` | ||
| `}let m=t.filter(n=>n.passed).length,p=t.filter(n=>!n.passed&&!n.skipped).length,h=t.filter(n=>n.skipped).length,u=m+p;return p===0?e+=`RESULT: ${m}/${u} checks passed * | ||
| `:e+=`RESULT: ${m}/${u} checks passed, ${p} FAILED | ||
| `,h>0&&(e+=` (${h} optional checks skipped) | ||
| `),{stdout:e,stderr:"",exitCode:p>0?1:0}}};export{S as doctorCommand}; |
| #!/usr/bin/env node | ||
| import{a as r}from"./chunk-SRHWVTRU.js";import{a as o}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var s={name:"about",summary:"show ag-bash features, architecture, and quick-start guide",usage:"about [OPTIONS]",options:["--version print version only","--features list all features with status","--architecture show architecture diagram"]},i=["113+ Commands (Core I/O, Text, Data, Search, Agentic, Network)","Multi-Runtime (Bash + Python3 WASM + JavaScript QuickJS)","Agent RunLoop (autonomous LLM execution with budget control)","Tagged Template API (createShell with injection-safe escaping)","Self-Healing (typo correction with exponential backoff retry)","MCP Server (40+ tools exposed via Model Context Protocol)","OpenTelemetry (optional zero-overhead distributed tracing)","Trap Handlers (EXIT/ERR/DEBUG/RETURN fire correctly)","Streaming Execution (AsyncGenerator output chunks)","Copy-on-Write Filesystem (multi-agent isolation)","Observation Summarizer (structured turn context for LLMs)","Multi-Framework AI Adapters (Vercel/OpenAI/Anthropic/LangChain)","Defense-in-Depth Security (sandboxed, no real OS access)","Tiered Exports (slim, advanced, browser-core, testing, ai, agent-runtime)"],u=` Input Script | ||
| | | ||
| v | ||
| Parser (Tree-sitter + Recursive Descent) | ||
| | | ||
| v | ||
| AST (Abstract Syntax Tree with ASTCache) | ||
| | | ||
| v | ||
| Interpreter (Expansion -> Resolution -> Execution) | ||
| | | ||
| v | ||
| ExecResult { stdout, stderr, exitCode } | ||
| Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite | CowFs) | ||
| Security: Defense-in-Depth + AsyncLocalStorage scoping | ||
| Runtimes: Bash + CPython (WASM) + QuickJS (WASM)`,p={name:"about",execute:async(n,c)=>{if(n.includes("--help")||n.includes("-h"))return o(s);if(n.includes("--version")||n.includes("-v"))return{stdout:`${r} | ||
| `,stderr:"",exitCode:0};if(n.includes("--features")){let t=`ag-bash v${r} \u2014 Features: | ||
| `;for(let a of i)t+=` * ${a} | ||
| `;return{stdout:t,stderr:"",exitCode:0}}if(n.includes("--architecture")){let t=`ag-bash v${r} \u2014 Architecture: | ||
| `;return t+=`${u} | ||
| `,{stdout:t,stderr:"",exitCode:0}}let e="";e+=`ag-bash v${r} \u2014 AI-Native Sandboxed Bash Runtime | ||
| `,e+=`${"=".repeat(52)} | ||
| `,e+=`ARCHITECTURE | ||
| `,e+=` Input -> Parser (Tree-sitter) -> AST -> Interpreter -> ExecResult | ||
| `,e+=` Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite) | ||
| `,e+=` Security: Defense-in-Depth + Sandboxed Execution | ||
| `,e+=`FEATURES | ||
| `;for(let t of i)e+=` * ${t} | ||
| `;return e+=` | ||
| `,e+=`QUICK START | ||
| `,e+=` Run: commands - Browse all available commands | ||
| `,e+=` Run: doctor - Verify your environment | ||
| `,e+=` Run: help <builtin> - Shell builtin help | ||
| `,e+=` Run: <command> --help - Command-specific help | ||
| `,e+=`LINKS | ||
| `,e+=` GitHub: https://github.com/sairam0424/ag-bash | ||
| `,e+=` Docs: See docs/user-guide.md | ||
| `,{stdout:e,stderr:"",exitCode:0}}};export{p as aboutCommand}; |
| #!/usr/bin/env node | ||
| var o="6.0.1";export{o as a}; |
| #!/usr/bin/env node | ||
| import{a as k}from"./chunk-SRHWVTRU.js";import{a as f}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var E={name:"doctor",summary:"verify ag-bash environment health",usage:"doctor [OPTIONS]",options:["--quick only run essential checks (fast)","--verbose show detailed output for each check"],examples:["doctor # run all checks","doctor --quick # fast essential checks only"]};async function d(i,a,l,r){if(!i.exec)return{name:a,passed:!1,detail:"exec not available"};try{let t=await i.exec(l,{cwd:i.cwd});return t.exitCode!==0?{name:a,passed:!1,detail:t.stderr.trim()||`exit code ${t.exitCode}`}:r!==void 0&&!t.stdout.includes(r)?{name:a,passed:!1,detail:`expected "${r}", got "${t.stdout.trim()}"`}:{name:a,passed:!0,detail:t.stdout.trim()}}catch(t){let e=t instanceof Error?t.message:String(t);return{name:a,passed:!1,detail:e}}}var S={name:"doctor",execute:async(i,a)=>{if(i.includes("--help")||i.includes("-h"))return f(E);let l=i.includes("--quick"),r=i.includes("--verbose"),t=[],e=`ag-bash doctor v${k} \u2014 Environment Health Check | ||
| `;e+=`CORE ENGINE | ||
| `;let $=[{name:"Interpreter operational",script:"echo hello",expected:"hello"},{name:"Variable expansion",script:"x=42; echo $x",expected:"42"},{name:"Pipe execution",script:"echo test | cat",expected:"test"},{name:"Command substitution",script:"echo $(echo nested)",expected:"nested"},{name:"Arithmetic expansion",script:"echo $((2 + 3))",expected:"5"}];for(let n of $){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}e+=` | ||
| `,e+=`FILESYSTEM | ||
| `;let x=[{name:"File write/read",script:"echo content > /tmp/doctor_test && cat /tmp/doctor_test",expected:"content"},{name:"Directory creation",script:"mkdir -p /tmp/doctor_dir && ls -d /tmp/doctor_dir",expected:"/tmp/doctor_dir"},{name:"File deletion",script:"rm /tmp/doctor_test && test ! -f /tmp/doctor_test && echo ok",expected:"ok"}];for(let n of x){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}if(e+=` | ||
| `,!l){let n=a.getRegisteredCommands?a.getRegisteredCommands():[];e+=`COMMANDS (${n.length} registered) | ||
| `;let c=[{name:"Core I/O (echo, cat, ls)",script:"echo ok && cat /dev/null && ls / > /dev/null && echo pass",expected:"pass"},{name:"Text processing (grep, sort)",script:"echo hello | grep hello && echo a | sort && echo pass",expected:"pass"},{name:"Data (jq, base64)",script:`echo '{"a":1}' | jq .a && echo pass`,expected:"pass"}];for(let o of c){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`FEATURES | ||
| `;let g=[{name:"Brace expansion",script:"echo {1..3}",expected:"1 2 3"},{name:"Parameter default",script:"echo ${UNSET_VAR:-fallback}",expected:"fallback"},{name:"Glob expansion",script:"mkdir -p /tmp/dglob && touch /tmp/dglob/a.txt /tmp/dglob/b.txt && ls /tmp/dglob/*.txt | wc -l",expected:"2"},{name:"Conditional execution",script:"true && echo yes || echo no",expected:"yes"}];for(let o of g){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`OPTIONAL RUNTIMES | ||
| `;let b=[{name:"Python3 (WASM)",script:"python3 -c 'print(1+1)'",flag:"--python"},{name:"JavaScript (QuickJS)",script:"js-exec -e 'console.log(1+1)'",flag:"--javascript"},{name:"Network (curl)",script:"echo network-check",flag:"--allow-network"}];for(let o of b){if(!a.exec){t.push({name:o.name,passed:!1,skipped:!0}),e+=` - ${o.name} (not available) | ||
| `;continue}let s=await d(a,o.name,o.script);s.passed?(e+=` * ${o.name} | ||
| `,t.push(s)):(e+=` - ${o.name} (not enabled \u2014 use ${o.flag}) | ||
| `,t.push({...s,skipped:!0}))}e+=` | ||
| `}let m=t.filter(n=>n.passed).length,p=t.filter(n=>!n.passed&&!n.skipped).length,h=t.filter(n=>n.skipped).length,u=m+p;return p===0?e+=`RESULT: ${m}/${u} checks passed * | ||
| `:e+=`RESULT: ${m}/${u} checks passed, ${p} FAILED | ||
| `,h>0&&(e+=` (${h} optional checks skipped) | ||
| `),{stdout:e,stderr:"",exitCode:p>0?1:0}}};export{S as doctorCommand}; |
| import{a as r}from"./chunk-X7IHY42O.js";import{a as o}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var s={name:"about",summary:"show ag-bash features, architecture, and quick-start guide",usage:"about [OPTIONS]",options:["--version print version only","--features list all features with status","--architecture show architecture diagram"]},i=["113+ Commands (Core I/O, Text, Data, Search, Agentic, Network)","Multi-Runtime (Bash + Python3 WASM + JavaScript QuickJS)","Agent RunLoop (autonomous LLM execution with budget control)","Tagged Template API (createShell with injection-safe escaping)","Self-Healing (typo correction with exponential backoff retry)","MCP Server (40+ tools exposed via Model Context Protocol)","OpenTelemetry (optional zero-overhead distributed tracing)","Trap Handlers (EXIT/ERR/DEBUG/RETURN fire correctly)","Streaming Execution (AsyncGenerator output chunks)","Copy-on-Write Filesystem (multi-agent isolation)","Observation Summarizer (structured turn context for LLMs)","Multi-Framework AI Adapters (Vercel/OpenAI/Anthropic/LangChain)","Defense-in-Depth Security (sandboxed, no real OS access)","Tiered Exports (slim, advanced, browser-core, testing, ai, agent-runtime)"],u=` Input Script | ||
| | | ||
| v | ||
| Parser (Tree-sitter + Recursive Descent) | ||
| | | ||
| v | ||
| AST (Abstract Syntax Tree with ASTCache) | ||
| | | ||
| v | ||
| Interpreter (Expansion -> Resolution -> Execution) | ||
| | | ||
| v | ||
| ExecResult { stdout, stderr, exitCode } | ||
| Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite | CowFs) | ||
| Security: Defense-in-Depth + AsyncLocalStorage scoping | ||
| Runtimes: Bash + CPython (WASM) + QuickJS (WASM)`,p={name:"about",execute:async(n,c)=>{if(n.includes("--help")||n.includes("-h"))return o(s);if(n.includes("--version")||n.includes("-v"))return{stdout:`${r} | ||
| `,stderr:"",exitCode:0};if(n.includes("--features")){let t=`ag-bash v${r} \u2014 Features: | ||
| `;for(let a of i)t+=` * ${a} | ||
| `;return{stdout:t,stderr:"",exitCode:0}}if(n.includes("--architecture")){let t=`ag-bash v${r} \u2014 Architecture: | ||
| `;return t+=`${u} | ||
| `,{stdout:t,stderr:"",exitCode:0}}let e="";e+=`ag-bash v${r} \u2014 AI-Native Sandboxed Bash Runtime | ||
| `,e+=`${"=".repeat(52)} | ||
| `,e+=`ARCHITECTURE | ||
| `,e+=` Input -> Parser (Tree-sitter) -> AST -> Interpreter -> ExecResult | ||
| `,e+=` Filesystem: Pluggable VFS (InMemory | Overlay | ReadWrite) | ||
| `,e+=` Security: Defense-in-Depth + Sandboxed Execution | ||
| `,e+=`FEATURES | ||
| `;for(let t of i)e+=` * ${t} | ||
| `;return e+=` | ||
| `,e+=`QUICK START | ||
| `,e+=` Run: commands - Browse all available commands | ||
| `,e+=` Run: doctor - Verify your environment | ||
| `,e+=` Run: help <builtin> - Shell builtin help | ||
| `,e+=` Run: <command> --help - Command-specific help | ||
| `,e+=`LINKS | ||
| `,e+=` GitHub: https://github.com/sairam0424/ag-bash | ||
| `,e+=` Docs: See docs/user-guide.md | ||
| `,{stdout:e,stderr:"",exitCode:0}}};export{p as aboutCommand}; |
| var o="6.0.1";export{o as a}; |
| import{a as k}from"./chunk-X7IHY42O.js";import{a as f}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var E={name:"doctor",summary:"verify ag-bash environment health",usage:"doctor [OPTIONS]",options:["--quick only run essential checks (fast)","--verbose show detailed output for each check"],examples:["doctor # run all checks","doctor --quick # fast essential checks only"]};async function d(i,a,l,r){if(!i.exec)return{name:a,passed:!1,detail:"exec not available"};try{let t=await i.exec(l,{cwd:i.cwd});return t.exitCode!==0?{name:a,passed:!1,detail:t.stderr.trim()||`exit code ${t.exitCode}`}:r!==void 0&&!t.stdout.includes(r)?{name:a,passed:!1,detail:`expected "${r}", got "${t.stdout.trim()}"`}:{name:a,passed:!0,detail:t.stdout.trim()}}catch(t){let e=t instanceof Error?t.message:String(t);return{name:a,passed:!1,detail:e}}}var S={name:"doctor",execute:async(i,a)=>{if(i.includes("--help")||i.includes("-h"))return f(E);let l=i.includes("--quick"),r=i.includes("--verbose"),t=[],e=`ag-bash doctor v${k} \u2014 Environment Health Check | ||
| `;e+=`CORE ENGINE | ||
| `;let $=[{name:"Interpreter operational",script:"echo hello",expected:"hello"},{name:"Variable expansion",script:"x=42; echo $x",expected:"42"},{name:"Pipe execution",script:"echo test | cat",expected:"test"},{name:"Command substitution",script:"echo $(echo nested)",expected:"nested"},{name:"Arithmetic expansion",script:"echo $((2 + 3))",expected:"5"}];for(let n of $){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}e+=` | ||
| `,e+=`FILESYSTEM | ||
| `;let x=[{name:"File write/read",script:"echo content > /tmp/doctor_test && cat /tmp/doctor_test",expected:"content"},{name:"Directory creation",script:"mkdir -p /tmp/doctor_dir && ls -d /tmp/doctor_dir",expected:"/tmp/doctor_dir"},{name:"File deletion",script:"rm /tmp/doctor_test && test ! -f /tmp/doctor_test && echo ok",expected:"ok"}];for(let n of x){let c=await d(a,n.name,n.script,n.expected);t.push(c),e+=c.passed?` * ${c.name} | ||
| `:` x ${c.name} \u2014 FAILED${c.detail?`: ${c.detail}`:""} | ||
| `,r&&c.detail&&(e+=` ${c.detail} | ||
| `)}if(e+=` | ||
| `,!l){let n=a.getRegisteredCommands?a.getRegisteredCommands():[];e+=`COMMANDS (${n.length} registered) | ||
| `;let c=[{name:"Core I/O (echo, cat, ls)",script:"echo ok && cat /dev/null && ls / > /dev/null && echo pass",expected:"pass"},{name:"Text processing (grep, sort)",script:"echo hello | grep hello && echo a | sort && echo pass",expected:"pass"},{name:"Data (jq, base64)",script:`echo '{"a":1}' | jq .a && echo pass`,expected:"pass"}];for(let o of c){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`FEATURES | ||
| `;let g=[{name:"Brace expansion",script:"echo {1..3}",expected:"1 2 3"},{name:"Parameter default",script:"echo ${UNSET_VAR:-fallback}",expected:"fallback"},{name:"Glob expansion",script:"mkdir -p /tmp/dglob && touch /tmp/dglob/a.txt /tmp/dglob/b.txt && ls /tmp/dglob/*.txt | wc -l",expected:"2"},{name:"Conditional execution",script:"true && echo yes || echo no",expected:"yes"}];for(let o of g){let s=await d(a,o.name,o.script,o.expected);t.push(s),e+=s.passed?` * ${s.name} | ||
| `:` x ${s.name} \u2014 FAILED${s.detail?`: ${s.detail}`:""} | ||
| `,r&&s.detail&&(e+=` ${s.detail} | ||
| `)}e+=` | ||
| `,e+=`OPTIONAL RUNTIMES | ||
| `;let b=[{name:"Python3 (WASM)",script:"python3 -c 'print(1+1)'",flag:"--python"},{name:"JavaScript (QuickJS)",script:"js-exec -e 'console.log(1+1)'",flag:"--javascript"},{name:"Network (curl)",script:"echo network-check",flag:"--allow-network"}];for(let o of b){if(!a.exec){t.push({name:o.name,passed:!1,skipped:!0}),e+=` - ${o.name} (not available) | ||
| `;continue}let s=await d(a,o.name,o.script);s.passed?(e+=` * ${o.name} | ||
| `,t.push(s)):(e+=` - ${o.name} (not enabled \u2014 use ${o.flag}) | ||
| `,t.push({...s,skipped:!0}))}e+=` | ||
| `}let m=t.filter(n=>n.passed).length,p=t.filter(n=>!n.passed&&!n.skipped).length,h=t.filter(n=>n.skipped).length,u=m+p;return p===0?e+=`RESULT: ${m}/${u} checks passed * | ||
| `:e+=`RESULT: ${m}/${u} checks passed, ${p} FAILED | ||
| `,h>0&&(e+=` (${h} optional checks skipped) | ||
| `),{stdout:e,stderr:"",exitCode:p>0?1:0}}};export{S as doctorCommand}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 4 instances
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 3 instances
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
25554831
18.97%1785
0.17%233053
0181
1.69%