package workflows as submodule

This commit is contained in:
bobo.yang 2023-12-20 12:57:55 +08:00
parent 32036192e8
commit c8df8917d9
5 changed files with 38 additions and 6 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "gui"] [submodule "gui"]
path = gui path = gui
url = https://github.com/devchat-ai/devchat-gui.git url = https://github.com/devchat-ai/devchat-gui.git
[submodule "workflowsCommands"]
path = workflowsCommands
url = https://github.com/devchat-ai/workflows.git

View File

@ -66,6 +66,7 @@
"assets/*", "assets/*",
"tools/*", "tools/*",
"workflows/*", "workflows/*",
"workflowsCommands/*",
"LICENSE", "LICENSE",
"README.md" "README.md"
], ],
@ -797,7 +798,7 @@
} }
}, },
"scripts": { "scripts": {
"build:gui":"cd ./gui && yarn && yarn vscode", "build:gui": "cd ./gui && yarn && yarn vscode",
"vscode:uninstall": "node ./dist/uninstall", "vscode:uninstall": "node ./dist/uninstall",
"vscode:prepublish": "npm run package", "vscode:prepublish": "npm run package",
"compile": "webpack", "compile": "webpack",

View File

@ -1,6 +1,8 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as fs from 'fs'; import * as fs from 'fs';
import * as os from 'os'; import * as os from 'os';
import * as path from 'path';
import * as util from 'util';
import { sendFileSelectMessage, sendCodeSelectMessage } from './util'; import { sendFileSelectMessage, sendCodeSelectMessage } from './util';
import { ExtensionContextHolder } from '../util/extensionContext'; import { ExtensionContextHolder } from '../util/extensionContext';
import { TopicManager } from '../topic/topicManager'; import { TopicManager } from '../topic/topicManager';
@ -12,14 +14,32 @@ import { isValidApiKey } from '../handler/historyMessagesBase';
import { logger } from '../util/logger'; import { logger } from '../util/logger';
import path from 'path';
import { sendCommandListByDevChatRun, updateChatModels } from '../handler/workflowCommandHandler'; import { sendCommandListByDevChatRun, updateChatModels } from '../handler/workflowCommandHandler';
import DevChat from "../toolwrapper/devchat"; import DevChat from "../toolwrapper/devchat";
import { createEnvByConda, createEnvByMamba } from '../util/python_installer/app_install'; import { createEnvByConda, createEnvByMamba } from '../util/python_installer/app_install';
import { installRequirements } from '../util/python_installer/package_install'; import { installRequirements } from '../util/python_installer/package_install';
import { chatWithDevChat } from '../handler/chatHandler'; import { chatWithDevChat } from '../handler/chatHandler';
const readdir = util.promisify(fs.readdir);
const stat = util.promisify(fs.stat);
const mkdir = util.promisify(fs.mkdir);
const copyFile = util.promisify(fs.copyFile);
async function copyDirectory(src: string, dest: string): Promise<void> {
await mkdir(dest, { recursive: true });
const entries = await readdir(src, { withFileTypes: true });
for (let entry of entries) {
const srcPath = path.join(src, entry.name);
const destPath = path.join(dest, entry.name);
if (entry.isDirectory()) {
await copyDirectory(srcPath, destPath);
} else {
await copyFile(srcPath, destPath);
}
}
}
function registerOpenChatPanelCommand(context: vscode.ExtensionContext) { function registerOpenChatPanelCommand(context: vscode.ExtensionContext) {
let disposable = vscode.commands.registerCommand('devchat.openChatPanel', async () => { let disposable = vscode.commands.registerCommand('devchat.openChatPanel', async () => {
@ -251,8 +271,15 @@ export function regApplyDiffResultCommand(context: vscode.ExtensionContext) {
export function registerInstallCommandsCommand(context: vscode.ExtensionContext) { export function registerInstallCommandsCommand(context: vscode.ExtensionContext) {
let disposable = vscode.commands.registerCommand('DevChat.InstallCommands', async () => { let disposable = vscode.commands.registerCommand('DevChat.InstallCommands', async () => {
const sysDirPath = path.join(process.env.HOME || process.env.USERPROFILE || '', '.chat', 'workflows', 'sys'); const homePath = process.env.HOME || process.env.USERPROFILE || '';
const devchat = new DevChat(); const sysDirPath = path.join(homePath, '.chat', 'workflows', 'sys');
const pluginDirPath = path.join(UiUtilWrapper.extensionPath(), 'workflowsCommands'); // Adjust this path as needed
const devchat = new DevChat();
if (!fs.existsSync(sysDirPath)) {
await copyDirectory(pluginDirPath, sysDirPath);
}
// Check if ~/.chat/workflows/sys directory exists // Check if ~/.chat/workflows/sys directory exists
if (!fs.existsSync(sysDirPath)) { if (!fs.existsSync(sysDirPath)) {

2
tools

@ -1 +1 @@
Subproject commit 8ceeeea147daee9ff0cd5b927d258710431d5ac0 Subproject commit 0b5e2ad24f6186ac836f8d1850b54793769dedc5

1
workflowsCommands Submodule

@ -0,0 +1 @@
Subproject commit 94c73fe51809981cf5ba50763ec23964d50fdc60