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
4 lines • 3.06 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{i as f,j as c,k as p}from"./chunk-572P46YW.js";import{c as a}from"./chunk-A65FQHKW.js";import{existsSync as F,mkdirSync as T,readFileSync as y,writeFileSync as C}from"fs";import{join as O}from"path";var o={enabled:!0,types:c(),showFiltered:!1,highlightFiltered:!1},u=class{#t;#e;#i;constructor(t={},e=!1){e?this.#t={...h(),...t}:this.#t={...o,...t},this.#i=[],this.#t.customPatterns&&(this.#i=this.#t.customPatterns.map((r,n)=>({type:`custom-${n}`,pattern:r,replacement:"[CUSTOM_FILTERED]",description:`Custom pattern ${n+1}`}))),this.#e=this.#r()}filterContent(t){if(!this.#t.enabled||!t)return{filteredText:t,filterCount:{},...this.#t.showFiltered?{originalText:t}:{},...this.#t.highlightFiltered?{highlightedText:t}:{}};let e=t,r={},n=t;for(let s of this.#e){let l=p(e,s);if(e=l.filteredText,l.count>0&&(r[s.type]=l.count,this.#t.highlightFiltered)){let m=s.pattern;n=n.replace(m,P=>`\x1B[43m\x1B[30m${P}\x1B[0m`)}}return{filteredText:e,filterCount:r,...this.#t.showFiltered?{originalText:t}:{},...this.#t.highlightFiltered?{highlightedText:n}:{}}}getAvailableFilterTypes(){return c()}enableFilterTypes(t){this.#t.types=t,this.#e=this.#r()}setEnabled(t){this.#t.enabled=t}setShowFiltered(t){this.#t.showFiltered=t}setHighlightFiltered(t){this.#t.highlightFiltered=t}addCustomPattern(t,e="[CUSTOM_FILTERED]",r="Custom pattern"){let n=`custom-${this.#i.length}`,s={type:n,pattern:t,replacement:e,description:r};return this.#i.push(s),this.#e=this.#r(),n}getOptions(){return{...this.#t}}loadConfiguration(){let t=h();return this.#t={...t,customPatterns:this.#t.customPatterns},this.#e=this.#r(),this.getOptions()}saveConfiguration(){return g(this.getOptions())}resetConfiguration(){let t=d();return t&&(this.#t={...o},this.#e=this.#r()),t}#r(){let t=[];for(let e of this.#t.types){let r=f(e);r&&t.push(r)}return t.push(...this.#i),t}};var b=()=>{let i=a();return O(i,"filter-config.json")},x=()=>{let i=a();F(i)||T(i,{recursive:!0})},h=()=>{let i=b();if(!F(i))return{...o};try{let t=y(i,"utf-8"),e=JSON.parse(t);return{...o,...e}}catch(t){return console.error(`Error loading filter configuration: ${t instanceof Error?t.message:String(t)}`),{...o}}},g=i=>{try{x();let t=b(),e=JSON.stringify(i,null,2);return C(t,e,"utf-8"),!0}catch(t){return console.error(`Error saving filter configuration: ${t instanceof Error?t.message:String(t)}`),!1}},d=()=>g({...o});export{b as a,h as b,g as c,d,o as e,u as f};
/* 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-XTEBLTG6.js.map