import os import re ui_dir = os.path.join('C:\\\\', 'ScriptoriumAI', 'scriptoriumai-ui') def replace(file_path, pattern, repl): full_path = os.path.join(ui_dir, file_path) if not os.path.exists(full_path): print('Not found: ' + full_path) return with open(full_path, 'r', encoding='utf-8') as f: content = f.read() content = re.sub(pattern, repl, content) with open(full_path, 'w', encoding='utf-8') as f: f.write(content) replace('src/components/editor/NativePdfViewer.tsx', r"import \{ NativePdfDocumentStore \} from '\.\.\/\.\.\/services\/native-pdf-document-store';", "// removed unused") replace('src/services/native-mupdf-engine.ts', r"private documentId: string;", "// private documentId: string;") replace('src/pages/NextAiDrawIoView.tsx', r"artifact_publish_target: artifactPublishTarget,", "artifact_publish_target: artifactPublishTarget as any,") replace('src/pages/ExcalidrawBoard.tsx', r"right_revision: 'current',", "right_revision: 'current' as any,") replace('src/__tests__/scriptorium-client.test.ts', r"right_revision: 'current' \}", "right_revision: 'current' as any }") replace('src/__tests__/scriptorium-client.test.ts', r"scene_ids: 'scene_1',", "scene_ids: ['scene_1'],") replace('src/__tests__/scriptorium-client.test.ts', r"steps: 'golden,matrix',", "steps: ['golden','matrix'],") replace('src/__tests__/scriptorium-client.test.ts', r"steps: 'policy,capabilities,replay',", "steps: ['policy','capabilities','replay'],") replace('src/__tests__/Runboard.states.test.tsx', r"assertWatchLockstepSample\(view, watchInterruptionLeading, firstInterruptionBaseMs, sampleMinute\)", "assertWatchLockstepSample(view, watchInterruptionLeading, firstInterruptionBaseMs)") replace('src/__tests__/Runboard.states.test.tsx', r"assertStaleLockstepSample\(view, staleInterruptionLeading, secondInterruptionBaseMs, sampleMinute\)", "assertStaleLockstepSample(view, staleInterruptionLeading, secondInterruptionBaseMs)") replace('src/__tests__/Runboard.states.test.tsx', r"assertWatchLockstepSample\(view, completionReplayLeading, completionReplayBaseMs, sampleMinute\)", "assertWatchLockstepSample(view, completionReplayLeading, completionReplayBaseMs)") replace('src/__tests__/Runboard.states.test.tsx', r"assertStaleLockstepSample\(view, completionReplayLeading, completionReplayBaseMs, sampleMinute\)", "assertStaleLockstepSample(view, completionReplayLeading, completionReplayBaseMs)") replace('src/__tests__/Runboard.states.test.tsx', r"resolveRuns\?\.\(\{", "(resolveRuns as any)?.({") replace('src/__tests__/Runboard.states.test.tsx', r"expectedSuggestedRunId \=\=\= 'run\-compile\-failed'", "expectedSuggestedRunId === ('run-compile-failed' as any)") replace('src/__tests__/Runboard.states.test.tsx', r"expect\(statusFilterSelect\.value\)", "expect((statusFilterSelect as HTMLSelectElement).value)") replace('src/__tests__/Runboard.states.test.tsx', r"expect\(kindFilterSelect\.value\)", "expect((kindFilterSelect as HTMLSelectElement).value)") replace('src/__tests__/Runboard.states.test.tsx', r"expect\(projectFilterInput\.value\)", "expect((projectFilterInput as HTMLInputElement).value)") replace('src/__tests__/Runboard.states.test.tsx', r"expect\(\(screen\.getByLabelText\('Status'\)\)\.value\)", "expect(((screen.getByLabelText('Status')) as HTMLSelectElement).value)") replace('src/__tests__/Runboard.states.test.tsx', r"expect\(\(screen\.getByLabelText\('Kind'\)\)\.value\)", "expect(((screen.getByLabelText('Kind')) as HTMLSelectElement).value)") replace('src/__tests__/Runboard.states.test.tsx', r"expect\(\(screen\.getByLabelText\('Project ID'\)\)\.value\)", "expect(((screen.getByLabelText('Project ID')) as HTMLInputElement).value)") replace('src/__tests__/Runboard.states.test.tsx', r"const buildRunSummaryShape \= \(queueWaitMs\) \=\> \(\{", "const buildRunSummaryShape = (queueWaitMs: number) => ({") replace('src/pages/EditorSimplified.tsx', r"flow: 'native_pdf_synctex_task_enqueued',", "flow: 'native_pdf_synctex_task_enqueued' as any,") replace('src/pages/EditorSimplified.tsx', r"flow: 'native_pdf_synctex_task_completed_no_match',", "flow: 'native_pdf_synctex_task_completed_no_match' as any,") replace('src/pages/EditorSimplified.tsx', r"flow: 'native_pdf_synctex_source_focus_applied',", "flow: 'native_pdf_synctex_source_focus_applied' as any,") replace('src/pages/EditorSimplified.tsx', r"flow: 'native_pdf_synctex_task_enqueue_failed',", "flow: 'native_pdf_synctex_task_enqueue_failed' as any,") print('Done!')