/**
 * Minified by jsDelivr using Terser v5.48.0.
 * Original file: /npm/@jianghujs/jianghu-init@3.2.36/lib/entry.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";const inquirer=require("inquirer"),CommandInitProject=require("./init_project"),CommandInitPage=require("./init_page"),CommandInitComponent=require("./init_component"),CommandInitByJson=require("./init_by_json"),CommandInitScript=require("./init_script"),CommandInitLint=require("./init_lint"),CommandInitDevRules=require("./init_dev_rules"),CommandInitVSCode=require("./init_vscode"),path=require("path"),fs=require("fs"),{execSync:execSync}=require("child_process"),initTypes=[{value:"json",name:"json - init by json text"},{value:"project",name:"project - Create a project and init table."},{value:"page",name:"page - Generate manage or test page from database table."},{value:"component",name:"component - Add some components to manage your app."},{value:"script",name:"script - Add some scripts to manage your app."},{value:"dev-rules",name:"dev-rules - Initialize AI dev rules (Codex / Cursor / Claude / Kiro)."},{value:"lint",name:"lint - Initialize lint configuration (ESLint, Prettier, Husky)."},{value:"vscode",name:"vscode - Install VSCode extension for jianghu-init."}];function checkVscodeExtension(){try{execSync("command -v code",{stdio:"ignore"});return execSync("code --list-extensions",{stdio:["ignore","pipe","ignore"]}).toString().includes("jianghu-init-vscode")}catch(e){return!1}}function showVscodeExtensionTip(){const e=require("chalk"),n=require("boxen"),i=`\n${e.blue("提示：")} 检测到您正在使用 jianghu-init\n\n${e.yellow("推荐安装 VSCode 扩展以获得更好的开发体验：")}\n1. 支持 init-json 模板文件的代码补全和悬停提示\n2. 支持 init-json 数据结构化定义检查\n3. 支持查看属性文档\n4. 支持快速创建和生成页面\n\n\n${e.green("安装方式：")}\n${e.cyan("jianghu-init vscode")}\n`;console.log(n(i,{padding:1,margin:1,borderStyle:"round",borderColor:"blue"}))}module.exports=class{async run(){let e=process.argv.slice(2),n=e[0],i=!1;if("-v"!==n&&"--version"!==n)if("-h"!==n&&"--help"!==n){if(["project","page","component","json","script","vscode","lint","dev-rules","rules"].includes(n))e=e.slice(1);else{n=(await inquirer.prompt({name:"initType",type:"list",message:"Please select an init type",choices:initTypes,pageSize:initTypes.length+1})).initType,i=!0}switch(checkVscodeExtension()||showVscodeExtensionTip(),n){case"project":await(new CommandInitProject).run(process.cwd(),e);break;case"page":await(new CommandInitPage).run(process.cwd(),e);break;case"component":await(new CommandInitComponent).run(process.cwd(),e);break;case"json":await(new CommandInitByJson).run(process.cwd(),e);break;case"script":await(new CommandInitScript).run(process.cwd(),e);break;case"lint":await(new CommandInitLint).run(process.cwd(),e);break;case"dev-rules":case"rules":await(new CommandInitDevRules).run(process.cwd(),i?["--interactive",...e]:e);break;case"vscode":await(new CommandInitVSCode).run(process.cwd(),e);break;default:console.log("未知的命令类型。显示帮助信息：\n"),this.showHelp()}process.exit()}else this.showHelp();else this.showVersion()}showVersion(){const e=path.join(__dirname,"..","package.json"),n=JSON.parse(fs.readFileSync(e,"utf8"));console.log(`当前版本: ${n.version}`)}showHelp(){console.log("\n使用方法: jianghu-init <命令> [选项]\n\n选项:\n  -V, --version                输出版本号\n  -h, --help                   显示帮助信息\n\n命令:\n  project [选项]               创建一个新项目并初始化表\n  page [选项]                  从数据库表生成管理或测试页面\n  component [选项]             添加一些组件来管理你的应用\n  json [选项]                  通过 JSON 文本初始化\n  script [选项]                添加一些脚本来管理你的应用\n  dev-rules [选项]             初始化 AI 开发规范（Codex / Cursor / Claude / Kiro）\n  lint [选项]                  初始化 lint 配置 (ESLint, Prettier, Husky)\n  vscode                       安装VSCode扩展，辅助使用jianghu-init\n\n  运行 jianghu-init <命令> --help 以获取指定命令的详细用法。\n  ")}};
//# sourceMappingURL=/sm/f91d5805927fe36dd1f2a7bca805835bd872188e4d356d3fe10bb15b18025e3c.map