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
1 lines • 6.14 kB
Source Map (JSON)
{"version":3,"sources":["/home/mkabumattar/work/withrawi/rawi/dist/chunk-7IP424ND.cjs","../src/cli/commands/info.command.ts"],"names":["createInfoCommand","command","Command","chalk","options","showProfilesInfo","showGeneralInfo","error"],"mappings":"AAAA;AACA,wDAAwC,wDAAoC,wDAAyC,wDAAyC,4ECD5I,sCACI,IAMTA,CAAAA,CAAoB,CAAA,CAAA,EAAe,CAC9C,IAAMC,CAAAA,CAAU,IAAIC,uBAAAA,CAAQ,MAAM,CAAA,CAElC,OAAAD,CAAAA,CACG,WAAA,CACC,CACEE,eAAAA,CAAM,IAAA,CAAK,sDAAsD,CAAA,CACjE,EAAA,CACAA,eAAAA,CAAM,IAAA,CACJ,gEACF,CAAA,CACA,QAAA,CAAI,MAAA,CAAO,EAAE,CACf,CAAA,CAAE,IAAA,CAAK,CAAA;AAAA,CAAI,CACb,CAAA,CACC,MAAA,CAAO,YAAA,CAAcA,eAAAA,CAAM,KAAA,CAAM,0BAA0B,CAAC,CAAA,CAC5D,MAAA,CAAO,MAAOC,CAAAA,EAAY,CACzB,GAAI,CACF,EAAA,CAAIA,CAAAA,CAAQ,QAAA,CAAU,CACpB,MAAMC,CAAAA,CAAiB,CAAA,CACvB,MACF,CAEA,MAAMC,CAAAA,CAAgB,CACxB,CAAA,KAAA,CAASC,CAAAA,CAAO,CACd,OAAA,CAAQ,KAAA,CAAMJ,eAAAA,CAAM,GAAA,CAAI,CAAA,8BAAA,EAAiCI,CAAK,CAAA,CAAA;AAsB9D,+CAAA;AAkBqE;AAWvE;AA+BF;AAkBQ,8BAAA;AAMmB,+BAAA;AASqB,CAAA;AAYpD,sDAAA;ADnJ4L","file":"/home/mkabumattar/work/withrawi/rawi/dist/chunk-7IP424ND.cjs","sourcesContent":[null,"import chalk from 'chalk';\nimport {Command} from 'commander';\nimport {ConfigManager} from '../../core/configs/managers/config.manager.js';\nimport {packageInfo} from '../../core/index.js';\nimport {getAllProviders} from '../../core/providers/index.js';\nimport {spinnerManager} from '../../core/shared/spinner.js';\n\nexport const createInfoCommand = (): Command => {\n const command = new Command('info');\n\n command\n .description(\n [\n chalk.bold('Display information about Rawi and its capabilities.'),\n '',\n chalk.gray(\n 'Show version, author, license, configuration status, and more.',\n ),\n '─'.repeat(80),\n ].join('\\n'),\n )\n .option('--profiles', chalk.white('Show configured profiles'))\n .action(async (options) => {\n try {\n if (options.profiles) {\n await showProfilesInfo();\n return;\n }\n\n await showGeneralInfo();\n } catch (error) {\n console.error(chalk.red(`Error displaying information: ${error}`));\n }\n });\n\n return command;\n};\n\nconst showGeneralInfo = async (): Promise<void> => {\n spinnerManager.start('info-load', 'Loading system information...');\n\n try {\n const configManager = new ConfigManager();\n const profiles = configManager.listProfiles();\n const providers = getAllProviders();\n\n spinnerManager.succeed('info-load', 'System information loaded');\n\n console.log(\n `${chalk.bold.blue('\\n🚀 About Rawi (راوي)')} ${chalk.gray('https://rawi.mkabumattar.com')}`,\n );\n console.log(\n chalk.whiteBright(\n 'A developer-friendly AI-powered CLI tool for clear answers, summaries, and analyses.',\n ),\n );\n console.log(\n chalk.gray('Supports OpenAI, Google, Amazon Bedrock, and more.'),\n );\n\n if (packageInfo.homepage) {\n console.log(\n chalk.bold('📚 Docs: ') + chalk.underline.cyan(packageInfo.homepage),\n );\n }\n\n console.log(`\\n${chalk.bold.blue('📋 System Information')}`);\n console.log(\n `${chalk.blue(' Version:')} ${chalk.whiteBright(packageInfo.version)}`,\n );\n console.log(\n `${chalk.blue(' Author: ')} ${chalk.whiteBright(packageInfo.author?.name || 'Mohammad Abu Mattar')}`,\n );\n console.log(\n `${chalk.blue(' License:')} ${chalk.whiteBright(packageInfo.license || 'MIT')}`,\n );\n\n console.log(`\\n${chalk.bold.blue('⚙️ Configuration Status')}`);\n console.log(\n `${chalk.blue(' Profiles:')} ${chalk.whiteBright(profiles.length > 0 ? `${profiles.length} configured` : 'No profiles configured')}`,\n );\n console.log(\n `${chalk.blue(' Providers:')} ${chalk.whiteBright(`${providers.length} supported`)}`,\n );\n\n if (profiles.length > 0) {\n console.log(\n chalk.gray(' • Run ') +\n chalk.cyan('rawi info --profiles') +\n chalk.gray(' to see profile details'),\n );\n } else {\n console.log(\n chalk.yellow(' • Run \"rawi configure\" to set up your first profile'),\n );\n }\n\n console.log(\n chalk.gray(' • Run ') +\n chalk.cyan('rawi provider --list') +\n chalk.gray(' to see supported providers'),\n );\n console.log(`\\n${chalk.bold.blue('─'.repeat(50))}`);\n } catch (error) {\n spinnerManager.fail('info-load', 'Failed to load system information');\n throw error;\n }\n};\n\nconst showProfilesInfo = async (): Promise<void> => {\n spinnerManager.start('profiles-load', 'Loading profile information...');\n\n try {\n const configManager = new ConfigManager();\n const profiles = configManager.listProfiles();\n\n if (profiles.length === 0) {\n spinnerManager.succeed('profiles-load', 'No profiles found');\n console.log(chalk.yellow('\\n❌ No profiles configured.'));\n console.log(\n chalk.gray('Run \"rawi configure\" to set up your first profile.'),\n );\n return;\n }\n\n spinnerManager.succeed(\n 'profiles-load',\n `Found ${profiles.length} profile(s)`,\n );\n\n console.log(\n chalk.bold.blue(`\\n👤 Configured Profiles (${profiles.length})`),\n );\n\n for (const profile of profiles) {\n const credentials = configManager.getCredentials(profile);\n if (credentials) {\n console.log(chalk.bold(`\\n[${profile}]`));\n console.log(\n chalk.blue(' Provider:') + chalk.white(` ${credentials.provider}`),\n );\n console.log(\n chalk.blue(' Model:') + chalk.white(` ${credentials.model}`),\n );\n console.log(\n chalk.blue(' Language:') +\n chalk.white(` ${credentials.language || 'english'}`),\n );\n }\n }\n\n console.log(\n chalk.gray('\\nRun \"rawi configure --show\" for detailed configuration'),\n );\n } catch (error) {\n spinnerManager.fail('profiles-load', 'Failed to load profile information');\n throw error;\n }\n};\n"]}