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

@@ -1,7 +1,7 @@
import { program as app, Command } from '@/program.ts';
import { getConfig, getEnvToken, writeConfig } from '@/module/index.ts';
import { queryLogin, storage } from '@/module/query.ts';
import inquirer from 'inquirer';
import { input } from '@inquirer/prompts';
import util from 'util';
function isNumeric(str: string) {
return /^-?\d+\.?\d*$/.test(str);
@@ -136,14 +136,9 @@ const setBaseURL = new Command('set')
const config = getConfig();
let baseURL = opt.baseURL;
if (!baseURL) {
const answers = await inquirer.prompt([
{
type: 'input',
name: 'baseURL',
message: `Enter your baseURL:(current: ${config.baseURL})`,
},
]);
baseURL = answers.baseURL;
baseURL = await input({
message: `Enter your baseURL:(current: ${config.baseURL})`,
});
if (!baseURL) {
console.log('baseURL is required');
return;