Starting to modularize into separate cli / server packages. (#55)

* Starting to move a lot of code into packages/server

* More of the massive refactor, builds and runs, some issues though.

* Fixing outstanding issue with double messages.

* Fixing a minor UI issue.

* Fixing the build post-merge.

* Running formatting.

* Addressing comments.
This commit is contained in:
Evan Senter
2025-04-19 19:45:42 +01:00
committed by GitHub
parent 0c9e1ef61b
commit 3fce6cea27
46 changed files with 3946 additions and 3403 deletions

View File

@@ -16,20 +16,19 @@ import { EditTool } from './tools/edit.tool.js';
import { TerminalTool } from './tools/terminal.tool.js';
import { WriteFileTool } from './tools/write-file.tool.js';
import { WebFetchTool } from './tools/web-fetch.tool.js';
import { globalConfig } from './config/config.js';
// TODO(b/411707095): remove. left here as an example of how to pull in inter-package deps
import { helloServer } from '@gemini-code/server';
helloServer();
import { loadCliConfig } from './config/config.js';
async function main() {
// Configure tools
registerTools(globalConfig.getTargetDir());
// Load configuration
const config = loadCliConfig();
// Render UI
// Configure tools using the loaded config
registerTools(config.getTargetDir());
// Render UI, passing necessary config values
render(
React.createElement(App, {
directory: globalConfig.getTargetDir(),
config,
}),
);
}
@@ -81,12 +80,13 @@ main().catch((error) => {
});
function registerTools(targetDir: string) {
const config = loadCliConfig();
const lsTool = new LSTool(targetDir);
const readFileTool = new ReadFileTool(targetDir);
const grepTool = new GrepTool(targetDir);
const globTool = new GlobTool(targetDir);
const editTool = new EditTool(targetDir);
const terminalTool = new TerminalTool(targetDir);
const terminalTool = new TerminalTool(targetDir, config);
const writeFileTool = new WriteFileTool(targetDir);
const webFetchTool = new WebFetchTool();