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

@@ -4,7 +4,7 @@ import path from 'path';
import fs from 'fs';
import FormData from 'form-data';
import { getBaseURL, query, storage } from '@/module/query.ts';
import inquirer from 'inquirer';
import { input, confirm } from '@inquirer/prompts';
import chalk from 'chalk';
import { upload } from '@/module/download/upload.ts';
import { getHash } from '@/uitls/hash.ts';
@@ -60,23 +60,15 @@ const command = new Command('deploy')
key = pkgInfo?.appKey || '';
}
logger.debug('start deploy');
if (!version || !key) {
const answers = await inquirer.prompt([
{
type: 'input',
name: 'version',
message: 'Enter your version:',
when: () => !version,
},
{
type: 'input',
name: 'key',
message: 'Enter your key:',
when: () => !key,
},
]);
version = answers.version || version;
key = answers.key || key;
if (!version) {
version = await input({
message: 'Enter your version:',
});
}
if (!key) {
key = await input({
message: 'Enter your key:',
});
}
const pwd = process.cwd();
const directory = path.join(pwd, filePath);
@@ -110,14 +102,10 @@ const command = new Command('deploy')
logger.debug('upload Files Key', key, version);
if (!yes) {
// 确认是否上传
const confirm = await inquirer.prompt([
{
type: 'confirm',
name: 'confirm',
message: 'Do you want to upload these files?',
},
]);
if (!confirm.confirm) {
const confirmed = await confirm({
message: 'Do you want to upload these files?',
});
if (!confirmed) {
return;
}
}