mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Tool result refactor (return an object instead of a string)
This commit is contained in:
40 files changed
+315
-276
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { Tool } from "./Tool";
|
||||
import type { Tool, ToolResult } from "./Tool";
|
||||
import type { JSRuntimeFS } from "../JSRuntime";
|
||||
import { buildProject } from "../build";
|
||||
|
||||
@@ -15,7 +15,7 @@ export class BuildProjectTool implements Tool<void> {
|
||||
this.esmUrl = esmUrl;
|
||||
}
|
||||
|
||||
async execute(): Promise<string> {
|
||||
async execute(): Promise<ToolResult> {
|
||||
try {
|
||||
// Build and write the project files
|
||||
const result = await buildProject({
|
||||
@@ -28,7 +28,9 @@ export class BuildProjectTool implements Tool<void> {
|
||||
const fileCount = Object.keys(result.files).length;
|
||||
const fileList = Object.keys(result.files).map(file => ` 📄 ${file}`).join('\n');
|
||||
|
||||
return `✅ Successfully built project!\n\n📁 Output: ${result.outputPath}\n📦 Files generated: ${fileCount}\n\n${fileList}\n\n🚀 Your project is ready for deployment!`;
|
||||
return {
|
||||
content: `✅ Successfully built project!\n\n📁 Output: ${result.outputPath}\n📦 Files generated: ${fileCount}\n\n${fileList}\n\n🚀 Your project is ready for deployment!`
|
||||
};
|
||||
} catch (error) {
|
||||
throw new Error(`❌ Build failed: ${String(error)}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user