diff --git a/src/lib/tools/BuildProjectTool.ts b/src/lib/tools/BuildProjectTool.ts index 3f58102c..9d43f776 100644 --- a/src/lib/tools/BuildProjectTool.ts +++ b/src/lib/tools/BuildProjectTool.ts @@ -57,6 +57,18 @@ export class BuildProjectTool implements Tool { const fileCount = Object.keys(dist).length; const fileList = Object.keys(dist).map(file => ` šŸ“„ ${file}`).join('\n'); + // Extract project ID from the current working directory path + // Expected format: /projects/{projectId} + const projectId = this.cwd.split('/').pop(); + + // Emit build completion event for PreviewPane to listen to + if (projectId && typeof window !== 'undefined') { + const buildCompleteEvent = new CustomEvent('buildComplete', { + detail: { projectId } + }); + window.dispatchEvent(buildCompleteEvent); + } + return `āœ… Successfully built project!\n\nšŸ“ Output: ${this.cwd}/dist\nšŸ“¦ Files generated: ${fileCount}\n\n${fileList}\n\nšŸš€ Your project is ready for deployment!`; } catch (error) { throw new Error(`āŒ Build failed: ${String(error)}`);