- Update @kevisual/query to 0.0.32 and @kevisual/router to 0.0.37 - Restructure AI command interface with run and deploy subcommands - Add comprehensive logging throughout cmd-execution flow - Improve sync module with better configuration handling - Add clickable link functionality in logger - Enhance error handling and debugging capabilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { program, Command } from '@/program.ts';
|
|
import { app } from '../ai/index.ts';
|
|
import util from 'util';
|
|
import { chalk } from '@/module/chalk.ts';
|
|
import { logger } from '@/module/logger.ts';
|
|
const aiCmd = new Command('ai')
|
|
.description('AI 相关命令')
|
|
.action(async (opts) => {
|
|
});
|
|
|
|
const runCmd = async (cmd: string) => {
|
|
const res = await app.router.call({ path: 'cmd-run', payload: { cmd } });
|
|
const { body } = res;
|
|
const steps = body?.steps || [];
|
|
for (const step of steps) {
|
|
logger.debug(chalk.blue(`\n==== 步骤: ${step.cmd || '结束'} ====`));
|
|
logger.debug(step.result || 'No result');
|
|
}
|
|
}
|
|
const aiRun = new Command('run')
|
|
.description('执行 AI 命令')
|
|
.option('-c, --cmd <cmd>', '要执行的 CMD 命令')
|
|
.action(async (opts) => {
|
|
if (opts.cmd) {
|
|
await runCmd(opts.cmd);
|
|
} else {
|
|
console.log('请提供要执行的 CMD 命令');
|
|
}
|
|
});
|
|
|
|
const aiRunDeploy = new Command('deploy')
|
|
.description('部署 AI 后端应用')
|
|
.action(async (opts) => {
|
|
const cmd = 'ev pack -p -u';
|
|
const res = await runCmd(cmd);
|
|
});
|
|
|
|
aiCmd.addCommand(aiRun);
|
|
aiCmd.addCommand(aiRunDeploy);
|
|
|
|
program.addCommand(aiCmd); |