* Copy picker script to repository's public folder
(sessionId: string)
| 66 | * Copy picker script to repository's public folder |
| 67 | */ |
| 68 | private static async copyPickerScript(sessionId: string): Promise<void> { |
| 69 | try { |
| 70 | // Read picker script from Pilot's public folder |
| 71 | const pickerPath = path.join(process.cwd(), 'public', 'picker', 'react-component-picker.js'); |
| 72 | const pickerContent = fs.readFileSync(pickerPath, 'utf-8'); |
| 73 | |
| 74 | // Ensure public/picker directory exists in container |
| 75 | await execCommand(sessionId, ['mkdir', '-p', `${this.REPO_PATH}/public/picker`]); |
| 76 | |
| 77 | // Write picker script to container |
| 78 | await writeFile(sessionId, `${this.REPO_PATH}/public/picker/react-component-picker.js`, pickerContent); |
| 79 | |
| 80 | logger.info('[DirectInjection] Picker script copied to repository', { sessionId }); |
| 81 | } catch (error) { |
| 82 | logger.error('[DirectInjection] Failed to copy picker script', { sessionId, error }); |
| 83 | throw new Error(`Failed to copy picker script: ${error}`); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Modify framework entry point to load picker |
no test coverage detected