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 4.3 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 n=class extends Error{constructor(r,s){super(r);this.code=s;this.name="FileReaderError"}},i= exports.b =class extends n{constructor(t){super(`File not found: ${t}`,"FILE_NOT_FOUND"),this.name="FileNotFoundError"}},o= exports.c =class extends n{constructor(t,r,s){let g=Math.round(r/1024/1024),E=Math.round(s/1024/1024);super(`File size (${g}MB) exceeds maximum allowed size (${E}MB): ${t}`,"FILE_SIZE_EXCEEDED"),this.name="FileSizeError"}},a= exports.d =class extends n{constructor(t,r){super(`Unsupported file type "${t}": ${r}`,"UNSUPPORTED_FILE_TYPE"),this.name="UnsupportedFileTypeError"}},c= exports.e =class extends n{constructor(t,r){super(`Failed to parse file "${t}": ${r}`,"FILE_PARSING_ERROR"),this.name="FileParsingError"}},l= exports.f =class extends n{constructor(t,r){let s=r?`Corrupted or invalid file "${t}": ${r}`:`Corrupted or invalid file: ${t}`;super(s,"CORRUPTED_FILE"),this.name="CorruptedFileError"}},d= exports.g =class extends n{constructor(t){super(`Encrypted or password-protected file not supported: ${t}`,"ENCRYPTED_FILE"),this.name="EncryptedFileError"}},p= exports.h =class extends n{constructor(t){super(`Insufficient permissions to read file: ${t}`,"PERMISSION_DENIED"),this.name="FilePermissionError"}},u= exports.i =class extends n{constructor(t){super(`No reader available for file type: ${t}`,"NO_READER_AVAILABLE"),this.name="NoReaderAvailableError"}},f=260,m=[/\.\./,/^[/\\]/,/[<>:"|?*]/];function $(e){if(!e||typeof e!="string")throw new n("Invalid file path: must be a non-empty string","INVALID_PATH");if(e.length>f)throw new n(`File path too long (${e.length} characters, max ${f})`,"PATH_TOO_LONG");for(let t of m)if(t.test(e))throw new n(`Potentially unsafe file path detected: ${e}`,"UNSAFE_PATH");if(e.includes("\0"))throw new n("File path contains null bytes","INVALID_PATH")}function x(e,t,r){if(e<0)throw new n(`Invalid file size: ${e}`,"INVALID_SIZE");if(e===0)throw new n(`File is empty: ${r}`,"EMPTY_FILE");if(e>t)throw new o(r,e,t)}function F(e,t){let r=e.toLowerCase().split(".").pop()||"";return t.some(s=>s.toLowerCase()===r)}function h(e){return e.replace(/[<>:"|?*]/g,"_").replace(/\.\./g,"_").replace(/^\./,"_").substring(0,255)}function I(e,t){return e instanceof i?`The file "${t}" could not be found. Please check the file path and try again.`:e instanceof o?`The file "${t}" is too large. Please use a smaller file or increase the size limit.`:e instanceof a?"The file type is not supported. Supported formats: PDF, DOCX, XLSX, and text-based files.":e instanceof c?`The file "${t}" could not be parsed. It may be corrupted or in an unsupported format.`:e instanceof l?`The file "${t}" appears to be corrupted or damaged. Please try with a different file.`:e instanceof d?`The file "${t}" is password-protected or encrypted. Please use an unprotected version.`:e instanceof p?`Permission denied when trying to read "${t}". Please check file permissions.`:e instanceof u?"No reader is available for this file type. Supported formats: PDF, DOCX, XLSX, and text-based files.":`An error occurred while reading "${t}": ${e.message}`}function _(e,t,r=!1){r?(console.error(`[FileReader Error] ${e.name}: ${e.message}`),console.error(`[FileReader Error] File: ${t}`),e.stack&&console.error(`[FileReader Error] Stack: ${e.stack}`)):console.error(`Failed to read file "${t}": ${e.message}`)}exports.a = n; exports.b = i; exports.c = o; exports.d = a; exports.e = c; exports.f = l; exports.g = d; exports.h = p; exports.i = u; exports.j = $; exports.k = x; exports.l = F; exports.m = h; exports.n = I; exports.o = _; /* 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-KKTV3DG4.cjs.map