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
8 lines • 3.89 kB
JavaScript
Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/* 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 _chunk6ISJWM6Jcjs = require('./chunk-6ISJWM6J.cjs');var _chunkWWDFLDG4cjs = require('./chunk-WWDFLDG4.cjs');var _chunkOWJR5FYZcjs = require('./chunk-OWJR5FYZ.cjs');var _fs = require('fs');var _os = require('os');var _path = require('path');var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);function $(){return _path.join.call(void 0, _os.homedir.call(void 0, ),".rawi","completion")}function h(t){try{let o=_chunkWWDFLDG4cjs.a[t];if(!o)throw new Error(`Template not found for shell: ${t}`);let e=$();_fs.mkdirSync.call(void 0, e,{recursive:!0});let n=_path.join.call(void 0, e,`rawi-completion.${t}`);return _fs.writeFileSync.call(void 0, n,o),n}catch(o){throw new Error(`Failed to copy completion template: ${o instanceof Error?o.message:String(o)}`)}}function C(t){try{let o=_chunkOWJR5FYZcjs.b.call(void 0, t);if(!o||!_fs.existsSync.call(void 0, o))return!1;let e=_fs.readFileSync.call(void 0, o,"utf8");return e.includes("# rawi completion")||e.includes("source")&&e.includes(".rawi/completion")}catch (e2){return!1}}async function S(t,o){let e=_chunkOWJR5FYZcjs.b.call(void 0, o);if(!e)throw new Error(`Cannot determine profile file for shell: ${o}`);if(C(o)){console.log(_chalk2.default.yellow(`Completion already installed for ${o}`));return}let i=`
# rawi completion
${o==="fish"?`source ${t}`:`[ -f "${t}" ] && source "${t}"`}
`,{appendFileSync:m}=await Promise.resolve().then(() => _interopRequireWildcard(require("fs")));m(e,i),console.log(_chalk2.default.green(`\u2713 Installed completion to: ${e}`)),console.log(_chalk2.default.gray("Restart your shell or run:")),console.log(_chalk2.default.cyan(` source ${e}`))}async function v(t){try{let o=t.shell;o==="auto"&&(o=_chunkOWJR5FYZcjs.a.call(void 0, ),console.log(_chalk2.default.gray(`Detected shell: ${o}`))),(!_chunk6ISJWM6Jcjs.a.includes(o)||o==="auto")&&(console.error(_chalk2.default.red(`Unsupported shell: ${o}`)),console.log(_chalk2.default.gray(`Supported shells: ${_chunk6ISJWM6Jcjs.a.filter(n=>n!=="auto").join(", ")}`)),process.exit(1)),console.log(_chalk2.default.gray("Copying completion template..."));let e=h(o);if(t.install)await S(e,o);else{console.log(_chalk2.default.green(`\u2713 Completion script copied to: ${e}`)),console.log(_chalk2.default.gray(`
To install manually:`));let n=_chunkOWJR5FYZcjs.b.call(void 0, o);if(n){let i=o==="fish"?`echo 'source ${e}' >> ${n}`:`echo '[ -f "${e}" ] && source "${e}"' >> ${n}`;console.log(_chalk2.default.cyan(` ${i}`)),console.log(_chalk2.default.cyan(` source ${n}`))}console.log(_chalk2.default.gray("Or use --install to install automatically"))}}catch(o){console.error(_chalk2.default.red("Failed to setup completion:")),console.error(_chalk2.default.red(o instanceof Error?o.message:String(o))),process.exit(1)}}exports.a = v;
/* 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-DHWMJITY.cjs.map
;