#!/usr/bin/env node
"use strict";var h=Object.defineProperty;var a=(e,n)=>h(e,"name",{value:n,configurable:!0});var index=require("./chunks/index2.cjs"),getPackageManager=require("./chunks/getPackageManager.cjs");require("node:url");require("node:fs");require("node:fs/promises");require("node:util");require("node:path");require("fs");require("path");require("os");require("node:os");require("tty");require("util");require("node:perf_hooks");require("url");require("node:readline");require("node:process");require("node:tty");require("node:child_process");require("constants");require("stream");require("assert");require("events");require("http");require("./chunks/index6.cjs");var _documentCurrentScript=typeof document<"u"?document.currentScript:null,i$1=Object.defineProperty,t$1=a((e,n)=>i$1(e,"name",{value:n,configurable:!0}),"t$1");process.env.NODE_NO_WARNINGS="1";process.env.OCLIF_SKIP_TYPESCRIPT="1";process.env.OCLIF_COMPILATION="false";const l=console.warn,c=console.error,u=console.log;function suppressWarnings(){console.warn=(...r)=>{const o=r.join(" ");o.includes("Could not find typescript")||o.includes("punycode")||o.includes("DEP0040")||l.apply(console,r)},console.error=(...r)=>{const o=r.join(" ");o.includes("Could not find typescript")||o.includes("punycode")||o.includes("DEP0040")||c.apply(console,r)},console.log=(...r)=>{const o=r.join(" ");o.includes("Could not find typescript")||o.includes("punycode")||o.includes("DEP0040")||u.apply(console,r)};const e=process.stdout.write;process.stdout.write=function(r,o,s){return typeof r=="string"&&r.includes("Could not find typescript")?!0:e.call(this,r,o,s)};const n=process.stderr.write;process.stderr.write=function(r,o,s){return typeof r=="string"&&(r.includes("punycode")||r.includes("DEP0040"))?!0:n.call(this,r,o,s)}}a(suppressWarnings,"suppressWarnings");t$1(suppressWarnings,"suppressWarnings");var i=Object.defineProperty,t=a((e,n)=>i(e,"name",{value:n,configurable:!0}),"t");suppressWarnings();(async()=>{try{await index.libExports.run(process.argv.slice(2),typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("index.cjs",document.baseURI).href),await y()}catch(e){e.oclif?.exit!==void 0?(e.message&&console.error(index.chalk.red("\u274C Error:"),index.chalk.gray(e.message)),e.message?.includes("Missing")&&e.message?.includes("required arg")?(console.error(""),console.error(index.chalk.yellow("\u{1F4A1} Tip:"),index.chalk.gray("Make sure to provide all required arguments")),console.error(index.chalk.blue("   Example:"),index.chalk.cyan("sre agent ./myagent.smyth --chat"))):e.message?.includes("not found")&&(console.error(""),console.error(index.chalk.yellow("\u{1F4A1} Available commands:")),console.error(index.chalk.cyan("   sre agent <path> <mode>")),console.error(index.chalk.cyan("   sre create")),console.error(index.chalk.cyan("   sre update"))),console.error(""),console.error(index.chalk.blue("\u{1F4D6} For detailed help, run:")),console.error(index.chalk.cyan("   sre --help")),console.error(index.chalk.cyan("   sre <command> --help")),process.exit(e.oclif.exit)):(console.error(index.chalk.red("\u274C Unexpected error:")),console.error(index.chalk.gray(e.message||String(e))),console.error(""),console.error(index.chalk.blue("\u{1F4A1} For help, run:")),console.error(index.chalk.cyan("   sre --help")),process.exit(1))}})();function y(){try{const e=getPackageManager.updateNotifier({pkg:{name:"@smythos/cli",version:getPackageManager.version},updateCheckInterval:864e5,shouldNotifyInNpmScript:!1});if(e.update){const{latest:n,current:r}=e.update,o=getPackageManager.getPackageManager(),s=getPackageManager.u.name;let d=`npm i -g ${s}`;o==="pnpm"?d=`pnpm i -g ${s}`:o==="yarn"&&(d=`yarn global add ${s}`);const p=index.chalk.bold("Update available ")+index.chalk.dim(r)+index.chalk.reset(" \u2192 ")+index.chalk.green(n)+` 
Run `+index.chalk.cyan(d)+" to update";e.notify({isGlobal:!0,defer:!0,message:p,boxenOptions:{padding:1,margin:1,textAlignment:"center",borderColor:"green",borderStyle:"round"}})}}catch{}}a(y,"y");t(y,"checkForUpdates");
