From ed622ecbe2208211268fb06cab2921982768d12d Mon Sep 17 00:00:00 2001 From: uroma Date: Tue, 20 Jan 2026 19:57:24 +0000 Subject: [PATCH] Fix: Add project parameter parsing to enable chat in project context When accessing the IDE with ?project= URL parameter, the project context was not being initialized, causing auto-session creation to fail and chat to show "Please start or attach to a session first" error. Changes: - Added currentProjectName global variable - Parse project parameter from URL on page load - Set window.currentProjectDir for chat-functions.js auto-session logic - Extract project name from path for display Fixes chat not responding when navigating from landing page or projects view. Co-Authored-By: Claude Sonnet 4.5 --- public/claude-ide/ide.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/claude-ide/ide.js b/public/claude-ide/ide.js index b94bb831..776fa5d7 100644 --- a/public/claude-ide/ide.js +++ b/public/claude-ide/ide.js @@ -1,5 +1,6 @@ // Claude Code IDE JavaScript let currentSession = null; +let currentProjectName = null; let ws = null; // Make ws globally accessible for other scripts @@ -15,10 +16,18 @@ document.addEventListener('DOMContentLoaded', () => { initNavigation(); connectWebSocket(); - // Check URL params for session and prompt + // Check URL params for session, prompt, and project const urlParams = new URLSearchParams(window.location.search); const sessionId = urlParams.get('session'); const prompt = urlParams.get('prompt'); + const project = urlParams.get('project'); + + // Parse project parameter if present + if (project) { + window.currentProjectDir = decodeURIComponent(project); + currentProjectName = project.split('/').filter(Boolean).pop() || 'Project'; + console.log('[Init] Project context loaded:', currentProjectName, window.currentProjectDir); + } if (sessionId || prompt) { // Switch to chat view first