update install commands logs

This commit is contained in:
bobo.yang 2024-11-05 11:28:51 +08:00
parent a998b11f1e
commit dab5b2a530

View File

@ -191,6 +191,7 @@ export function registerInstallCommandsCommand(
let disposable = vscode.commands.registerCommand( let disposable = vscode.commands.registerCommand(
"DevChat.InstallCommands", "DevChat.InstallCommands",
async () => { async () => {
logger.channel()?.debug("InstallCommands command triggered.");
const homePath = process.env.HOME || process.env.USERPROFILE || ""; const homePath = process.env.HOME || process.env.USERPROFILE || "";
const sysDirPath = path.join(homePath, ".chat", "scripts"); const sysDirPath = path.join(homePath, ".chat", "scripts");
const sysMericoDirPath = path.join(homePath, ".chat", "scripts", "merico"); const sysMericoDirPath = path.join(homePath, ".chat", "scripts", "merico");
@ -202,17 +203,20 @@ export function registerInstallCommandsCommand(
const dcClient = new DevChatClient(); const dcClient = new DevChatClient();
if (!fs.existsSync(sysMericoDirPath)) { if (!fs.existsSync(sysMericoDirPath)) {
logger.channel()?.debug("Creating directory: " + sysMericoDirPath);
await copyDirectory(pluginDirPath, sysDirPath); await copyDirectory(pluginDirPath, sysDirPath);
} }
// Check if ~/.chat/scripts directory exists // Check if ~/.chat/scripts directory exists
if (!fs.existsSync(sysDirPath)) { if (!fs.existsSync(sysMericoDirPath)) {
// Directory does not exist, wait for updateWorkflows to finish // Directory does not exist, wait for updateWorkflows to finish
logger.channel()?.debug("Update workflows...");
await dcClient.updateWorkflows(); await dcClient.updateWorkflows();
await dcClient.updateCustomWorkflows(); await dcClient.updateCustomWorkflows();
sendCommandListByDevChatRun(); sendCommandListByDevChatRun();
} else { } else {
// Directory exists, execute sendCommandListByDevChatRun immediately // Directory exists, execute sendCommandListByDevChatRun immediately
logger.channel()?.debug("Sending and updating workflows...");
await sendCommandListByDevChatRun(); await sendCommandListByDevChatRun();
// Then asynchronously execute updateWorkflows // Then asynchronously execute updateWorkflows