Add an entrypoint for workflow cli for dev
This commit is contained in:
parent
4196d902a4
commit
66da2dfc80
@ -686,6 +686,11 @@
|
||||
"title": "Install slash commands",
|
||||
"category": "DevChat"
|
||||
},
|
||||
{
|
||||
"command": "DevChat.TryWF",
|
||||
"title": "Run workflow cli",
|
||||
"category": "DevChat"
|
||||
},
|
||||
{
|
||||
"command": "DevChat.UpdataChatModels",
|
||||
"title": "Update Chat Models",
|
||||
|
@ -223,6 +223,21 @@ export function registerInstallCommandsCommand(
|
||||
context.subscriptions.push(disposable);
|
||||
}
|
||||
|
||||
export function registerTryWF(
|
||||
context: vscode.ExtensionContext
|
||||
) {
|
||||
let disposable = vscode.commands.registerCommand(
|
||||
"DevChat.TryWF",
|
||||
async () => {
|
||||
|
||||
const devchat = new DevChat();
|
||||
|
||||
await devchat.tryWF();
|
||||
}
|
||||
);
|
||||
|
||||
context.subscriptions.push(disposable);
|
||||
}
|
||||
|
||||
export function registerDevChatChatCommand(context: vscode.ExtensionContext) {
|
||||
let disposable = vscode.commands.registerCommand(
|
||||
|
@ -16,6 +16,8 @@ import {
|
||||
registerFixCommand,
|
||||
registerExplainCommand,
|
||||
registerQuickFixCommand,
|
||||
|
||||
registerTryWF,
|
||||
} from './contributes/commands';
|
||||
import { regLanguageContext } from './contributes/context';
|
||||
import { regDevChatView } from './contributes/views';
|
||||
@ -150,6 +152,7 @@ async function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
registerInstallCommandsCommand(context);
|
||||
|
||||
registerTryWF(context);
|
||||
createStatusBarItem(context);
|
||||
|
||||
regApplyDiffResultCommand(context);
|
||||
|
@ -516,6 +516,26 @@ class DevChat {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
async tryWF(): Promise<string> {
|
||||
try {
|
||||
const args = ["-m", "devchat", "workflow", "env", "remove", "--all"];
|
||||
// const args = ["-m", "mamba", "--version"];
|
||||
|
||||
const {code, stdout, stderr} = await this.runCommand(args);
|
||||
|
||||
assertValue(code !== 0, stderr || `Command exited with ${code}`);
|
||||
if (stderr.trim() !== "") {
|
||||
logger.channel()?.warn(`${stderr}`);
|
||||
}
|
||||
|
||||
logger.channel()?.info(`${stdout}`);
|
||||
return stdout;
|
||||
} catch (error: any) {
|
||||
logger.channel()?.error(`Error: ${error.message}`);
|
||||
logger.channel()?.show();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
async topics(): Promise<TopicEntry[]> {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user