UNPKG

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 2.31 kB
/* 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 n}from"./chunk-RUQO26UY.js";import{parseOfficeAsync as l}from"officeparser";var i=class extends n{constructor(e={}){super(e)}canRead(e){return["pdf","docx","pptx","xlsx","odt","odp","ods"].includes(e)}async read(e){let t=Date.now();try{await this.validateFile(e),this.logVerbose(`Starting office file extraction for: ${e}`);let o=await this.#e(e),{size:a}=await this.getFileStats(e),r=Date.now()-t;this.logVerbose(`Office file extraction completed in ${r}ms`);let s=this.#t(e),p=this.#o(s),c=this.createMetadata(e,a,s.toLowerCase(),r,p,{wordCount:o.split(/\s+/).filter(d=>d.length>0).length,characterCount:o.length});return{success:!0,content:{text:o.trim(),metadata:c}}}catch(o){return this.logVerbose(`Office file extraction failed: ${o}`),{success:!1,error:o instanceof Error?o.message:String(o)}}}async#e(e){try{let t=await l(e);if(!t||typeof t!="string")throw new Error("No readable text found in office document");return t}catch(t){throw new Error(`Office file parsing error: ${t instanceof Error?t.message:String(t)}`)}}#t(e){let t=e.toLowerCase().split(".").pop()||"";return{pdf:"pdf",docx:"docx",pptx:"pptx",xlsx:"xlsx",odt:"odt",odp:"odp",ods:"ods"}[t]||"unknown"}#o(e){return{pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",odt:"application/vnd.oasis.opendocument.text",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet"}[e]||"application/octet-stream"}};export{i 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-I53R2YNN.js.map