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
1 lines • 2.33 kB
Source Map (JSON)
{"version":3,"sources":["/home/mkabumattar/withrawi/rawi/dist/chunk-YW2ECH45.cjs","../src/core/file-readers/readers/base.reader.ts"],"names":["AbstractFileReader","BaseFileReader","options","filePath","fs","stat","exists","size"],"mappings":"AAAA;AACA,wDAAwC,ICElBA,CAAAA,CAAf,MAAA,QAA0CC,mBAAe,CAC9D,WAAA,CAAYC,CAAAA,CAA6B,CAAC,CAAA,CAAG,CAC3C,KAAA,CAAMA,CAAO,CACf,CAEA,MAAgB,YAAA,CACdC,CAAAA,CAC0C,CAC1C,GAAM,CAAC,QAAA,CAAUC,CAAE,CAAA,CAAI,MAAM,4DAAA,CAAO,IAAS,GAAA,CACvC,CAAC,IAAA,CAAAC,CAAI,CAAA,CAAID,CAAAA,CAEf,GAAI,CAEF,MAAO,CACL,IAAA,CAAA,CAFY,MAAMC,CAAAA,CAAKF,CAAQ,CAAA,CAAA,CAEnB,IAAA,CACZ,MAAA,CAAQ,CAAA,CACV,CACF,CAAA,UAAQ,CACN,MAAO,CACL,IAAA,CAAM,CAAA,CACN,MAAA,CAAQ,CAAA,CACV,CACF,CACF,CAEA,MAAgB,YAAA,CAAaA,CAAAA,CAAiC,CAC5D,GAAM,CAAC,MAAA,CAAAG,CAAAA,CAAQ,IAAA,CAAAC,CAAI,CAAA,CAAI,MAAM,IAAA,CAAK,YAAA,CAAaJ,CAAQ,CAAA,CAEvD,EAAA,CAAI,CAACG,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,CAAA,gBAAA,EAAmBH,CAAQ,CAAA,CAAA;AD9B2S","file":"/home/mkabumattar/withrawi/rawi/dist/chunk-YW2ECH45.cjs","sourcesContent":[null,"import type {FileReaderOptions} from '../interfaces/types.js';\nimport {BaseFileReader} from '../interfaces/types.js';\n\nexport abstract class AbstractFileReader extends BaseFileReader {\n constructor(options: FileReaderOptions = {}) {\n super(options);\n }\n\n protected async getFileStats(\n filePath: string,\n ): Promise<{size: number; exists: boolean}> {\n const {promises: fs} = await import('node:fs');\n const {stat} = fs;\n\n try {\n const stats = await stat(filePath);\n return {\n size: stats.size,\n exists: true,\n };\n } catch {\n return {\n size: 0,\n exists: false,\n };\n }\n }\n\n protected async validateFile(filePath: string): Promise<void> {\n const {exists, size} = await this.getFileStats(filePath);\n\n if (!exists) {\n throw new Error(`File not found: ${filePath}`);\n }\n\n this.validateFileSize(size);\n }\n\n protected logVerbose(message: string): void {\n if (this.options.verbose) {\n console.log(`[FileReader] ${message}`);\n }\n }\n\n protected handleError(error: unknown, filePath: string): never {\n const errorMessage = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to read file \"${filePath}\": ${errorMessage}`);\n }\n}\n"]}