feat: migrate from inquirer to @inquirer/prompts for interactive prompts

- Replaced inquirer with @inquirer/prompts in various command files for improved prompt handling.
- Updated confirmation and input prompts in commands such as app, config, deploy, login, and others.
- Added a new command 'cc' for switching between Claude code models with appropriate configurations.
- Enhanced user experience by ensuring prompts are more streamlined and consistent across the application.
This commit is contained in:
2026-01-15 09:17:07 +08:00
parent 4f541748da
commit 8549a4aa53
15 changed files with 585 additions and 309 deletions

View File

@@ -5,7 +5,7 @@ import { chalk } from '../chalk.ts';
import { Result } from '@kevisual/query';
import { fileIsExist } from '@/uitls/file.ts';
import { glob } from 'fast-glob';
import inquirer from 'inquirer';
import { confirm } from '@inquirer/prompts';
import { getEnvToken } from '../get-config.ts';
type DownloadTask = {
@@ -80,15 +80,11 @@ const checkDelete = async (opts?: { force?: boolean; dir?: string; yes?: boolean
try {
if (fileIsExist(dir)) {
const files = await glob(`${dir}/**/*`, { onlyFiles: true });
const answers = await inquirer.prompt([
{
type: 'confirm',
name: 'confirm',
message: `是否你需要删除 【${opts?.dir}】 目录下的文件. [${files.length}] 个?`,
when: () => files.length > 0 && !yes, // 当 username 为空时,提示用户输入
},
]);
if (answers?.confirm || yes) {
const shouldConfirm = files.length > 0 && !yes;
const confirmed = shouldConfirm ? await confirm({
message: `是否你需要删除 【${opts?.dir}】 目录下的文件. [${files.length}] 个?`,
}) : false;
if (confirmed || yes) {
fs.rmSync(dir, { recursive: true });
console.log(chalk.green('删除成功', dir));
} else {