diff --git a/packages/cli/package.json b/packages/cli/package.json index 7d1b79b..264eacf 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@done-coding/cli", - "version": "0.15.23", + "version": "0.15.24-alpha.0", "description": "done-coding命令行工具", "private": false, "module": "es/cli.mjs", @@ -57,7 +57,7 @@ "@done-coding/cli-publish": "workspace:0.7.16", "@done-coding/cli-template": "workspace:0.8.10", "@done-coding/cli-utils": "workspace:0.8.4", - "create-done-coding": "workspace:0.11.26" + "create-done-coding": "workspace:0.11.27-alpha.0" }, "engines": { "node": ">=18.0.0" diff --git a/packages/cli/src/main.ts b/packages/cli/src/main.ts index 3833ade..7d5258c 100644 --- a/packages/cli/src/main.ts +++ b/packages/cli/src/main.ts @@ -1,3 +1,10 @@ +/* + * @Description : + * @Author : JustSoSu + * @Date : 2025-06-18 20:46:25 + * @LastEditors : JustSoSu + * @LastEditTime : 2026-04-15 13:46:21 + */ import { crateAsSubcommand as createInjectCommand } from "@done-coding/cli-inject"; import { crateAsSubcommand as createExtractCommand } from "@done-coding/cli-extract"; import { crateAsSubcommand as createGitCommand } from "@done-coding/cli-git"; @@ -8,10 +15,53 @@ import { crateAsSubcommand as createComponentCommand } from "@done-coding/cli-co import { crateAsSubcommand as createConfigCommand } from "@done-coding/cli-config"; import injectInfo from "@/injectInfo.json"; import type { CliInfo } from "@done-coding/cli-utils"; -import { createMainCommand, getRootScriptName } from "@done-coding/cli-utils"; +import { + createMainCommand, + getRootScriptName, + outputConsole, + xPrompts, + chalk, +} from "@done-coding/cli-utils"; const { version, description: describe } = injectInfo; +const createChat = async ({ + currentCount = 1, + maxCount, +}: { + currentCount?: number; + maxCount: number; +}) => { + const v = ( + await xPrompts( + { + type: "text", + name: "value", + message: "", + validate: (value) => value?.trim().length > 0 || " ", + }, + { + onCancel() { + return process.exit(0); + }, + }, + ) + ).value; + + outputConsole.stage(`[${currentCount}]大脑接入中`, chalk.gray(`你问了:${v}`)); + outputConsole.skip(`---------------`); + + if (currentCount >= maxCount) { + outputConsole.stage(`${maxCount}轮对话结束`); + return; + } + + createChat({ + currentCount: currentCount + 1, + maxCount, + }); +}; + const commandCliInfo: CliInfo = { usage: `$0 [options]`, describe, @@ -26,8 +76,17 @@ const commandCliInfo: CliInfo = { createComponentCommand(), createConfigCommand(), ], - demandCommandCount: 1, + demandCommandCount: 0, rootScriptName: getRootScriptName({ packageJson: injectInfo }), + async handler() { + // execSyncHijack(`node ${process.argv[1]} -h`, { + // stdio: 'inherit' + // }) + + createChat({ + maxCount: 3, + }); + }, }; /** 作为主命令创建 */ diff --git a/packages/create/package.json b/packages/create/package.json index c60b758..106d7e3 100644 --- a/packages/create/package.json +++ b/packages/create/package.json @@ -1,6 +1,6 @@ { "name": "create-done-coding", - "version": "0.11.26", + "version": "0.11.27-alpha.0", "description": "项目创建命令行工具", "module": "es/index.mjs", "type": "module", diff --git a/packages/create/src/main.ts b/packages/create/src/main.ts index 3b2898d..e347b3d 100644 --- a/packages/create/src/main.ts +++ b/packages/create/src/main.ts @@ -1,3 +1,10 @@ +/* + * @Description : + * @Author : JustSoSu + * @Date : 2026-02-07 20:24:02 + * @LastEditors : JustSoSu + * @LastEditTime : 2026-04-15 12:03:23 + */ import { commandCliInfo } from "@/handlers"; import injectInfo from "@/injectInfo.json"; import type { SubCliInfo } from "@done-coding/cli-utils"; @@ -9,7 +16,8 @@ const { /** 分发命令&步骤 */ const dispatchCommandAndUsage = (asSubcommand = false) => { - const command = `${asSubcommand ? `${moduleName} ` : ""}[projectName]`; + // const command = `${asSubcommand ? `${moduleName} ` : ""}[projectName]`; + const command = `${asSubcommand ? `${moduleName} ` : ""}`; const usage = `$0 ${command.trim()}`; return { command, usage }; }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5c5d6f5..2e94c55 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,7 +86,7 @@ importers: specifier: workspace:0.8.4 version: link:../utils create-done-coding: - specifier: workspace:0.11.26 + specifier: workspace:0.11.27-alpha.0 version: link:../create devDependencies: "@types/node":