UNPKG

rawi

Version:

Rawi (راوي) is the developer-friendly AI CLI that brings the power of 12 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 4.1 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/* Rawi (راوي) is the developer-friendly AI CLI that brings the power of 12 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 _chunkA3AM4C5Jcjs = require('./chunk-A3AM4C5J.cjs');var _chunk57ISK4WTcjs = require('./chunk-57ISK4WT.cjs');var _chunkYMFDGLDPcjs = require('./chunk-YMFDGLDP.cjs');var _chunkAR2KIMCHcjs = require('./chunk-AR2KIMCH.cjs');var p=class{constructor(e={}){this.options={enableFallback:!0,...e},this.readers=new Map,this.initializeReaders(),this.batchProcessor=new (0, _chunkAR2KIMCHcjs.a)(this)}initializeReaders(){let e=new (0, _chunk57ISK4WTcjs.a)(this.options),r=["pdf","docx","pptx","xlsx","odt","odp","ods"];for(let a of r)this.readers.set(a,e);let t=new (0, _chunkYMFDGLDPcjs.a)(this.options),s=["txt","md","xml","html","htm","js","jsx","ts","tsx","css","json","py","java","cpp","c","h","go","rs","rb","kt","swift","dart","scala","r","m","pl","lua","php","yml","yaml","toml","env","ini","conf","cfg","sql","sh","bash","vim","dockerfile","makefile","gitignore","log"];for(let a of s)this.readers.set(a,t)}async readFile(e){try{let r=await this.determineFileType(e);if(!_chunkA3AM4C5Jcjs.d.call(void 0, r))return{success:!1,error:`Unsupported file type: ${_chunkA3AM4C5Jcjs.e.call(void 0, r)}. Supported formats include office documents (PDF, DOCX, PPTX, XLSX, ODT, ODP, ODS), programming languages (JS, TS, Python, Java, C/C++, Go, Rust, etc.), configuration files (YAML, JSON, TOML, etc.), and many more.`};let t=this.getReader(r);if(!t)return{success:!1,error:`No reader available for file type: ${_chunkA3AM4C5Jcjs.e.call(void 0, r)}`};this.logVerbose(`Using ${t.constructor.name} for ${_chunkA3AM4C5Jcjs.e.call(void 0, r)}`);let s=await t.read(e);return s.success&&s.content&&(s.content.metadata.additionalInfo={...s.content.metadata.additionalInfo,detectedFileType:r,readerUsed:t.constructor.name}),s}catch(r){return{success:!1,error:`File reading failed: ${r instanceof Error?r.message:String(r)}`}}}async readFiles(e){let r=[];for(let t of e){let s=await this.readFile(t);r.push(s)}return r}async readFilesParallel(e){let r=e.map(t=>this.readFile(t));return Promise.all(r)}async canReadFile(e){try{let r=await this.determineFileType(e);return _chunkA3AM4C5Jcjs.d.call(void 0, r)&&this.readers.has(r)}catch (e2){return!1}}async getFileInfo(e){let r=await this.determineFileType(e);return{filePath:e,fileType:r,description:_chunkA3AM4C5Jcjs.e.call(void 0, r),supported:_chunkA3AM4C5Jcjs.d.call(void 0, r),readerAvailable:this.readers.has(r)}}getSupportedFileTypes(){return Array.from(this.readers.keys())}registerReader(e,r){this.readers.set(e,r),this.logVerbose(`Registered custom reader for ${_chunkA3AM4C5Jcjs.e.call(void 0, e)}`)}updateOptions(e){this.options={...this.options,...e},this.initializeReaders(),this.batchProcessor=new (0, _chunkAR2KIMCHcjs.a)(this),this.logVerbose("Updated reader options and reinitialized readers")}async processMultipleFiles(e,r={}){return this.batchProcessor.processFiles(e,r)}async processGlobPatterns(e,r={}){return this.batchProcessor.processGlobPatterns(e,r)}async expandGlob(e,r={}){return this.batchProcessor.expandGlobPatterns(e,r)}async filterSupportedFiles(e){return this.batchProcessor.filterSupportedFiles(e)}async determineFileType(e){return this.options.forceFileType?this.options.forceFileType:(await _chunkA3AM4C5Jcjs.c.call(void 0, e)).fileType}getReader(e){return this.readers.get(e)}logVerbose(e){this.options.verbose&&console.log(`[FileReaderManager] ${e}`)}},T= exports.b =new p;exports.a = p; exports.b = T; /* Rawi (راوي) is the developer-friendly AI CLI that brings the power of 12 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-2VSUGZSR.cjs.map