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.45 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/* 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. */ var _chunk3ZXX3ML2cjs = require('./chunk-3ZXX3ML2.cjs');var _officeparser = require('officeparser');var i=class extends _chunk3ZXX3ML2cjs.a{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 _officeparser.parseOfficeAsync.call(void 0, 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"}};exports.a = i; /* 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-XYGAEXAR.cjs.map