MCPcopy Create free account
hub / github.com/altic-dev/Pilot / copyPickerScript

Method copyPickerScript

src/lib/direct-picker-injection.ts:68–85  ·  view source on GitHub ↗

* Copy picker script to repository's public folder

(sessionId: string)

Source from the content-addressed store, hash-verified

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

Callers 1

injectPickerMethod · 0.95

Calls 2

execCommandFunction · 0.90
writeFileFunction · 0.90

Tested by

no test coverage detected