rawi
Version:
Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into
6 lines • 2.71 kB
JavaScript
/* Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into an intelligent development workspace. */
import{a as D}from"./chunk-NVUM2MT4.js";import{a as q}from"./chunk-CRE6AUZZ.js";import{a as k}from"./chunk-RLDN5XX3.js";import{b as A}from"./chunk-KBNGSILU.js";import{a as I}from"./chunk-QRNZMVTN.js";import{a as v,b as S,c as x,d as E}from"./chunk-XEKY7EQQ.js";import{a as Q}from"./chunk-COMPMKDH.js";import{a as h,b as C,c as w,d as b,e as F,f as T}from"./chunk-PIMZJ5PA.js";import{a as y}from"./chunk-74BMVZGU.js";import{d as g}from"./chunk-YGEDZIJR.js";import{input as M}from"@inquirer/prompts";import i from"chalk";import{Command as P}from"commander";var W=()=>{let a=new P("ask");return a.description([i.bold("Ask AI a question and get a response."),"",i.gray("Supports piped input from stdin and file processing."),i.gray("Use --act <template> for expert prompt templates."),i.gray('See all templates with "rawi act --list".'),"\u2500".repeat(80)].join(`
`)).argument("[query]",i.white("The question or prompt to send to the AI (can be combined with piped input or file content)")),D.forEach(r=>{"defaultValue"in r&&r.defaultValue!==void 0?a.option(r.flags,r.description,r.defaultValue):a.option(r.flags,r.description)}),a.addHelpText("after",q).action(async(r,e)=>{let s=null;try{let l="";(e.file||e.files||e.batch)&&(l=(await k(e)).fileContent);let t;try{t=await A(r,l)}catch{if(!r&&!l&&process.stdin.isTTY)t=await M({message:"What would you like to ask?",required:!0});else{a.help();return}}if(!t||t.trim()===""){a.help();return}if(e.resetFilterConfig&&(T(e),!t||t.trim()===""))return;let n=e.filterSensitive||e.filterTypes&&e.filterTypes.trim()!=="",u=C(n,e),m=h(n,u,e),p=w(m,t,n,e);if(b(m,t,n,e),e.saveFilterConfig&&(F(m,e),!t||t.trim()===""))return;let o=p;if(e.act)try{o=await Q(e.act,p,e)}catch{return}let c=e.profile||g;v(c,e),s=new y;let d=await S(s,c,e),R=x(c,e);if(E(c,o,e),await I(R,d,o,s,n,u,e),e.verbose){let f=await s.getSession(d);f&&console.log(i.dim(`
\u{1F4AC} Session: ${d} (${f.messageCount} messages)`))}}catch(l){e.verbose&&console.error("Error processing query:",l),process.exit(1)}finally{s&&s.close()}}),a};export{W as a};
/* Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into an intelligent development workspace. */
//# sourceMappingURL=chunk-GYWK3T7M.js.map