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 • 3.28 kB
Source Map (JSON)
{"version":3,"sources":["/home/mkabumattar/withrawi/rawi/dist/chunk-5GCADSBN.cjs","../src/core/shared/utils.ts"],"names":["DEBUG_MODE","debugLog","args","getConfigDir","join","homedir","CONFIG_DIR_NAME","getCredentialsFilePath","CREDENTIALS_FILE_NAME","maskApiKey","apiKey","visibleLength","maskedLength"],"mappings":"AAAA;AACA,wDAA+C,wBCDzB,4BACH,IAGNA,CAAAA,CAAa,CAAA,CAAA,CAEbC,CAAAA,aAAW,CAAA,GAAIC,CAAAA,CAAAA,EAAsB,CAC5CF,CAAAA,EACF,OAAA,CAAQ,GAAA,CAAI,GAAGE,CAAI,CAEvB,CAAA,CAEaC,CAAAA,aAAe,CAAA,CAAA,EACnBC,wBAAAA,yBAAKC,CAAQ,CAAGC,mBAAe,CAAA,CAG3BC,CAAAA,aAAyB,CAAA,CAAA,EAC7BH,wBAAAA,CAAKD,CAAa,CAAA,CAAGK,mBAAqB,CAAA,CAGtCC,CAAAA,aAAcC,CAAAA,EAA2B,CACpD,EAAA,CAAI,CAACA,CAAAA,CAAQ,MAAO,EAAA,CACpB,IAAMC,CAAAA,CAAgB,IAAA,CAAK,GAAA,CAAI,CAAA,CAAGD,CAAAA,CAAO,MAAM,CAAA,CACzCE,CAAAA,CAAe,IAAA,CAAK,GAAA,CAAI,CAAA,CAAGF,CAAAA,CAAO,MAAA,CAASC,CAAa,CAAA,CAC9D,MAAO,CAAA,EAAA;ADtBwP","file":"/home/mkabumattar/withrawi/rawi/dist/chunk-5GCADSBN.cjs","sourcesContent":[null,"import {homedir} from 'node:os';\nimport {join} from 'node:path';\nimport {CONFIG_DIR_NAME, CREDENTIALS_FILE_NAME} from './constants.js';\n\nexport const DEBUG_MODE = false;\n\nexport const debugLog = (...args: any[]): void => {\n if (DEBUG_MODE) {\n console.log(...args);\n }\n};\n\nexport const getConfigDir = (): string => {\n return join(homedir(), CONFIG_DIR_NAME);\n};\n\nexport const getCredentialsFilePath = (): string => {\n return join(getConfigDir(), CREDENTIALS_FILE_NAME);\n};\n\nexport const maskApiKey = (apiKey: string): string => {\n if (!apiKey) return '';\n const visibleLength = Math.min(8, apiKey.length);\n const maskedLength = Math.max(0, apiKey.length - visibleLength);\n return `${apiKey.slice(0, visibleLength)}${'*'.repeat(maskedLength)}`;\n};\n\nexport const validateTemperature = (temperature: number): boolean => {\n return temperature >= 0 && temperature <= 2;\n};\n\nexport const validateMaxTokens = (maxTokens: number): boolean => {\n return maxTokens >= 1 && maxTokens <= 100000;\n};\n\nexport const validateApiKey = (apiKey: string): boolean => {\n return Boolean(apiKey && apiKey.trim().length > 0);\n};\n\nexport const validateLanguage = (language: string): boolean => {\n return ['english', 'arabic'].includes(language);\n};\n\nexport const truncateText = (text: string, maxLength: number): string => {\n if (text.length <= maxLength) return text;\n return `${text.slice(0, maxLength - 3)}...`;\n};\n\nexport const formatDate = (dateString: string): string => {\n const date = new Date(dateString);\n return date.toLocaleDateString('en-US', {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n};\n\nexport const formatRelativeTime = (dateString: string): string => {\n const date = new Date(dateString);\n const now = new Date();\n const diffMs = now.getTime() - date.getTime();\n const diffMinutes = Math.floor(diffMs / (1000 * 60));\n const diffHours = Math.floor(diffMinutes / 60);\n const diffDays = Math.floor(diffHours / 24);\n\n if (diffMinutes < 1) return 'just now';\n if (diffMinutes < 60) return `${diffMinutes}m ago`;\n if (diffHours < 24) return `${diffHours}h ago`;\n if (diffDays < 7) return `${diffDays}d ago`;\n return formatDate(dateString);\n};\n"]}