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

19 lines 5.87 kB
#!/usr/bin/env node /* 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. */ import"./chunk-VJXMO5OS.js";import{a as u}from"./chunk-DVFBNTXS.js";import"./chunk-QNYKTJ4P.js";import"./chunk-GB62DDK2.js";import"./chunk-YL44MFU3.js";import{a as c}from"./chunk-OIOQX4NN.js";import"./chunk-UKR5S75L.js";import"./chunk-U7Q6KLAC.js";import"./chunk-KX2IDCHV.js";import"./chunk-KDA7O46M.js";import"./chunk-POTJGSRS.js";import"./chunk-OKQW3HE4.js";import"./chunk-WH3PC4CH.js";import"./chunk-RTS2YFQ6.js";import"./chunk-F5YGLJUR.js";import"./chunk-WODJRIHN.js";import"./chunk-O2V7PARJ.js";import"./chunk-Y3NLNGEE.js";import"./chunk-MPDXSLZB.js";import"./chunk-TXXQXILX.js";import"./chunk-C3TRDJRW.js";import"./chunk-SSJ4P3F5.js";import"./chunk-ULKST7AH.js";import"./chunk-LSO6QN77.js";import"./chunk-IXFX7RUN.js";import"./chunk-MRVNIX7F.js";import"./chunk-AZFH5WY6.js";import"./chunk-D5ICEXBJ.js";import"./chunk-74WQMBHW.js";import"./chunk-6SXKP6NI.js";import"./chunk-ZNEVPN2P.js";import"./chunk-ZHE2BGWL.js";import"./chunk-R3ZOCB6H.js";import"./chunk-XGV3I4XU.js";import"./chunk-PTY25BFJ.js";import"./chunk-47WZZKSY.js";import"./chunk-LDSHVY7O.js";import"./chunk-YZOPIDTP.js";import"./chunk-WUNLPX5A.js";import"./chunk-OVWIJHCT.js";import"./chunk-XKCX7BHW.js";import"./chunk-252WMUR5.js";import"./chunk-2QKNTKVX.js";import"./chunk-THAGAVS3.js";import"./chunk-7RWWSPM4.js";import"./chunk-FBDLJZSG.js";import"./chunk-LAIF7VXD.js";import"./chunk-JD3A5OXF.js";import"./chunk-4U2YKOTO.js";import"./chunk-TZJU2FLN.js";import"./chunk-ABWXKSWH.js";import"./chunk-GGXDDXXS.js";import"./chunk-S33HQEPX.js";import"./chunk-XYC2FEVK.js";import"./chunk-U7K37PAJ.js";import"./chunk-AT47K3US.js";import"./chunk-Y7XFV3CR.js";import"./chunk-3JCRW7ET.js";import C from"boxen";import e from"chalk";import I from"leven";import v from"update-notifier";var d=await v({pkg:c,updateCheckInterval:1e3*60*60*2,shouldNotifyInNpmScript:!0,distTag:"latest"});d.notify();function A(s,o){let r=Number.POSITIVE_INFINITY,n=null;for(let i of o){let t=I(s,i);t<r&&(r=t,n=i)}return r<=2?n:null}if(d.update){let{current:s,latest:o,type:r}=d.update,n=c.name,i=c?.repository?.url?`${c.repository.url.replace(/^git\+/,"").replace(/\.git$/,"")}/releases/latest`:null,t,l="",a="";switch(r){case"major":t=e.red.bold,l="Major ",a="\u{1F525}";break;case"minor":case"patch":t=e.yellow.bold,l="",a="\u2728";break;case"prerelease":case"build":t=e.cyan.italic,l="Pre-release ",a="\u{1F9EA}";break;default:t=e.gray,l="",a="\u2139\uFE0F"}let m=e.hex("#32CD32").bold(`${a} UPDATE AVAILABLE ${a}`),f=`${e.bold(l)}${t(r.toUpperCase())} Update`,g=`${e.dim("Current:")} ${e.white(s)} ${e.dim("\u2192")} ${e.green(o)} ${e.dim("(Latest)")}`,h=e.whiteBright(`Unlock the latest features and bug fixes for ${e.bold(n)}!`),$=e.yellow.bold("Upgrade by running one of these commands:"),y=[`npm install -g ${n} `,`pnpm install -g ${n}`,`yarn global add ${n}`,`bun add -g ${n} `].map(x=>e.blue.bold(` $ ${x}`)).join(` `),b=i?` ${e.underline.blue("See release notes:")} ${e.dim(i)} `:"",k=e.dim(` Tip: Restart your terminal or IDE after upgrade for changes to take effect.`),w=[m,"",f,"",g,"",h,"",$,y,b,k].join(` `);console.log(C(w,{padding:1,margin:1,borderColor:"#FF4500",borderStyle:"round",backgroundColor:"#1A1A1A",textAlignment:"center",title:e.bold.white(` ${n} Update `),titleAlignment:"center",float:"center"}))}process.on("uncaughtException",s=>{if(s instanceof Error&&s.name==="ExitPromptError"&&(console.log(` \u{1F44B} Exiting Rawi. Until next time!`),process.exit(0)),s instanceof Error){let o=s.message||"";if(o.includes("Unknown command")){let r=o.match(/Unknown command '([^']+)'/),n=r?r[1]:null,i=["ask","act","configure","provider","history","info"],t=null;if(n&&(t=A(n,i)),console.error(` ${e.red(`\u274C Unknown command: ${n||o}`)}`),t)console.info(e.yellowBright(`Did you mean '${t}'?`));else{let l=i.find(a=>n&&a.startsWith(n[0]));l&&console.info(e.yellowBright(`Did you mean '${l}'?`))}console.info(e.gray("Run `rawi --help` to see all available commands.")),process.exit(1)}o.includes("Missing required argument")&&(console.error(` ${e.red(`\u274C ${o}`)}`),console.info(e.gray("Use `--help` with the command for usage details.")),process.exit(1)),o.includes("Invalid option")&&(console.error(` ${e.red(`\u274C ${o}`)}`),console.info(e.gray("Check available options with `--help`.")),process.exit(1)),(o.includes("not configured")||o.includes("credentials"))&&(console.error(` ${e.red(`\u274C ${o}`)}`),console.info(e.yellow("Run `rawi configure` to set up your provider and credentials.")),process.exit(2)),(o.includes("network")||o.includes("timeout"))&&(console.error(` ${e.red(`\u274C ${o}`)}`),console.info(e.yellow("Check your internet connection or provider status.")),process.exit(3)),(o.includes("authentication")||o.includes("API key"))&&(console.error(` ${e.red(`\u274C ${o}`)}`),console.info(e.yellow("Check your API key and provider configuration.")),process.exit(4)),console.error(` ${e.red(`\u274C Unexpected error: ${o}`)}`),console.info(e.gray("If this issue persists, run `rawi info` for diagnostics or see the Troubleshooting guide.")),process.exit(1)}console.error(` \u274C An unknown error occurred.`),process.exit(1)});var p=u();process.argv.length<=2&&(p.outputHelp(),process.exit(0));p.parse(process.argv); /* 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=index.js.map