From 4d3222ee960a5e57b56854691272cce12984d4de Mon Sep 17 00:00:00 2001 From: KevIsDev Date: Mon, 16 Jun 2025 15:33:59 +0100 Subject: [PATCH] refactor: reorganize project structure by moving files to a more dev friendly setup - Move stores/utils/types to their relative directories (i.e chat stores in chat directory) - Move utility files to shared/utils - Move component files to shared/components - Move type definitions to shared/types - Move stores to shared/stores - Update import paths across the project --- .../components}/BaseChat.module.scss | 0 .../chat => chat/components}/BaseChat.tsx | 42 +-- .../chat => chat/components}/Chat.client.tsx | 36 +-- .../components}/ExamplePrompts.tsx | 0 .../components}/Messages.client.tsx | 12 +- .../components}/ProgressCompilation.tsx | 6 +- .../components}/StarterTemplates.tsx | 4 +- .../chat => chat/components}/ThoughtBox.tsx | 0 .../components/alerts}/ChatAlert.tsx | 4 +- .../components/alerts}/DeployAlert.tsx | 4 +- .../components/alerts}/SupabaseAlert.tsx | 6 +- .../components/chatBox}/APIKeyManager.tsx | 4 +- .../components/chatBox}/ChatBox.tsx | 24 +- .../components/chatBox}/DicussMode.tsx | 4 +- .../components/chatBox}/FilePreview.tsx | 0 .../components/chatBox}/ModelSelector.tsx | 6 +- .../chatBox}/ScreenshotStateManager.tsx | 0 .../components/chatBox}/SendButton.client.tsx | 0 .../components/chatBox}/SpeechRecognition.tsx | 4 +- .../chatBox}/SupabaseConnection.tsx | 10 +- .../chatExportAndImport/ExportChatButton.tsx | 4 +- .../chatExportAndImport/ImportButtons.tsx | 6 +- .../ImportFolderButton.tsx | 10 +- .../components/markdown}/Markdown.module.scss | 0 .../components/markdown}/Markdown.spec.ts | 0 .../components/markdown}/Markdown.tsx | 12 +- .../components/messages}/Artifact.tsx | 10 +- .../components/messages}/AssistantMessage.tsx | 12 +- .../messages}/CodeBlock.module.scss | 0 .../components/messages}/CodeBlock.tsx | 4 +- .../components/messages}/UserMessage.tsx | 6 +- app/{lib => chat}/hooks/StickToBottom.tsx | 0 app/{lib => chat}/hooks/usePromptEnhancer.ts | 4 +- app/{lib => chat}/hooks/useStickToBottom.tsx | 0 .../services/importExportService.ts | 2 +- app/{lib => chat}/stores/chat.ts | 0 app/entry.server.tsx | 2 +- .../header/components}/DeployButton.tsx | 18 +- .../header/components}/Header.tsx | 6 +- .../HeaderActionButtons.client.tsx | 10 +- .../NetlifyDeploymentLink.client.tsx | 4 +- .../VercelDeploymentLink.client.tsx | 4 +- .../header}/hooks/useEditChatDescription.ts | 2 +- .../header/hooks/useNetlifyDeploy.tsx} | 12 +- .../header/hooks/useVercelDeploy.tsx} | 12 +- .../sidebar/HistoryItem.tsx | 10 +- .../sidebar/Menu.client.tsx | 20 +- .../sidebar/date-binning.ts | 2 +- app/lib/.server/llm/stream-text.ts | 207 ------------- app/lib/modules/llm/registry.ts | 39 --- app/root.tsx | 6 +- app/routes/_index.tsx | 8 +- app/routes/api.chat.ts | 24 +- app/routes/api.check-env-key.ts | 4 +- app/routes/api.enhancer.ts | 10 +- app/routes/api.export-api-keys.ts | 4 +- app/routes/api.llmcall.ts | 16 +- app/routes/api.models.ts | 8 +- app/routes/api.netlify-deploy.ts | 2 +- app/routes/api.supabase.query.ts | 2 +- app/routes/api.supabase.ts | 2 +- app/routes/api.vercel-deploy.ts | 2 +- app/routes/git.tsx | 8 +- .../core/AvatarDropdown.tsx | 4 +- .../core/ControlPanel.tsx | 50 ++-- .../@settings => settings}/core/constants.ts | 0 .../@settings => settings}/core/types.ts | 0 .../@settings => settings}/index.ts | 0 .../shared/components/DraggableTabList.tsx | 8 +- .../shared/components/TabManagement.tsx | 12 +- .../shared/components/TabTile.tsx | 6 +- app/{lib => settings}/stores/settings.ts | 15 +- .../stores/tabConfigurationStore.ts | 0 .../connections/ConnectionDiagnostics.tsx | 8 +- .../tabs/connections/ConnectionsTab.tsx | 4 +- .../tabs/connections/GithubConnection.tsx | 8 +- .../tabs/connections/NetlifyConnection.tsx | 12 +- .../tabs/connections/VercelConnection.tsx | 6 +- .../connections/components/ConnectionForm.tsx | 6 +- .../components/CreateBranchDialog.tsx | 4 +- .../components/GitHubAuthDialog.tsx | 2 +- .../components/PushToGitHubDialog.tsx | 18 +- .../connections/components/RepositoryCard.tsx | 2 +- .../components/RepositoryDialogContext.tsx | 0 .../connections/components/RepositoryList.tsx | 4 +- .../components/RepositorySelectionDialog.tsx | 13 +- .../connections/components/StatsDialog.tsx | 6 +- .../tabs/connections/types/GitHub.ts | 0 .../tabs/data/DataTab.tsx | 14 +- .../tabs/data/DataVisualization.tsx | 4 +- .../tabs/debug/DebugTab.tsx | 16 +- .../tabs/event-logs/EventLogsTab.tsx | 8 +- .../tabs/features/FeaturesTab.tsx | 8 +- .../tabs/notifications/NotificationsTab.tsx | 4 +- .../tabs/profile/ProfileTab.tsx | 6 +- .../providers/cloud/CloudProvidersTab.tsx | 14 +- .../providers/local/LocalProvidersTab.tsx | 18 +- .../providers/local/OllamaModelInstaller.tsx | 8 +- .../service-status/ServiceStatusTab.tsx | 0 .../providers/service-status/base-provider.ts | 0 .../service-status/provider-factory.ts | 0 .../providers/amazon-bedrock.ts | 4 +- .../service-status/providers/anthropic.ts | 4 +- .../service-status/providers/cohere.ts | 4 +- .../service-status/providers/deepseek.ts | 4 +- .../service-status/providers/google.ts | 4 +- .../service-status/providers/groq.ts | 4 +- .../service-status/providers/huggingface.ts | 4 +- .../service-status/providers/hyperbolic.ts | 4 +- .../service-status/providers/mistral.ts | 4 +- .../service-status/providers/openai.ts | 4 +- .../service-status/providers/openrouter.ts | 4 +- .../service-status/providers/perplexity.ts | 4 +- .../service-status/providers/together.ts | 4 +- .../providers/service-status/providers/xai.ts | 4 +- .../tabs/providers/service-status/types.ts | 0 .../providers/status/ServiceStatusTab.tsx | 6 +- .../tabs/settings/SettingsTab.tsx | 8 +- .../tabs/task-manager/TaskManagerTab.tsx | 6 +- .../tabs/update/UpdateTab.tsx | 10 +- .../utils/animations.ts | 0 .../utils/tab-helpers.ts | 4 +- .../github/components}/GitCloneButton.tsx | 16 +- .../components}/GitUrlImport.client.tsx | 12 +- .../components/github}/types/GitHub.ts | 0 .../components/ui/BackgroundRays/index.tsx | 0 .../ui/BackgroundRays/styles.module.scss | 0 app/{ => shared}/components/ui/Badge.tsx | 2 +- .../components/ui/Breadcrumbs.tsx | 2 +- app/{ => shared}/components/ui/Button.tsx | 2 +- app/{ => shared}/components/ui/Card.tsx | 2 +- app/{ => shared}/components/ui/Checkbox.tsx | 2 +- .../components/ui/CloseButton.tsx | 2 +- app/{ => shared}/components/ui/CodeBlock.tsx | 2 +- .../components/ui/Collapsible.tsx | 0 .../components/ui/ColorSchemeDialog.tsx | 4 +- app/{ => shared}/components/ui/Dialog.tsx | 4 +- app/{ => shared}/components/ui/Dropdown.tsx | 2 +- app/{ => shared}/components/ui/EmptyState.tsx | 2 +- app/{ => shared}/components/ui/FileIcon.tsx | 2 +- app/{ => shared}/components/ui/FilterChip.tsx | 2 +- .../components/ui/GradientCard.tsx | 2 +- app/{ => shared}/components/ui/IconButton.tsx | 2 +- app/{ => shared}/components/ui/Input.tsx | 2 +- app/{ => shared}/components/ui/Label.tsx | 2 +- .../components/ui/LoadingDots.tsx | 0 .../components/ui/LoadingOverlay.tsx | 0 .../components/ui/PanelHeader.tsx | 2 +- .../components/ui/PanelHeaderButton.tsx | 2 +- app/{ => shared}/components/ui/Popover.tsx | 0 app/{ => shared}/components/ui/Progress.tsx | 2 +- .../components/ui/RepositoryStats.tsx | 4 +- app/{ => shared}/components/ui/ScrollArea.tsx | 2 +- .../components/ui/SearchInput.tsx | 2 +- .../components/ui/SearchResultItem.tsx | 2 +- app/{ => shared}/components/ui/Separator.tsx | 2 +- .../components/ui/SettingsButton.tsx | 2 +- app/{ => shared}/components/ui/Slider.tsx | 6 +- .../components/ui/StatusIndicator.tsx | 2 +- app/{ => shared}/components/ui/Switch.tsx | 2 +- app/{ => shared}/components/ui/Tabs.tsx | 2 +- .../components/ui/TabsWithSlider.tsx | 2 +- .../components/ui/ThemeSwitch.tsx | 2 +- app/{ => shared}/components/ui/Tooltip.tsx | 2 +- app/{ => shared}/components/ui/index.ts | 0 app/{ => shared}/components/ui/use-toast.ts | 0 app/{lib => shared}/hooks/index.ts | 6 +- .../hooks/useConnectionStatus.ts | 2 +- .../hooks/useDataOperations.ts | 4 +- app/{lib => shared}/hooks/useDebugStatus.ts | 2 +- app/{lib => shared}/hooks/useFeatures.ts | 2 +- app/{lib => shared}/hooks/useGit.ts | 2 +- app/{lib => shared}/hooks/useIndexedDB.ts | 0 .../hooks/useLocalProviders.ts | 2 +- app/{lib => shared}/hooks/useMessageParser.ts | 6 +- app/{lib => shared}/hooks/useNotifications.ts | 4 +- app/{lib => shared}/hooks/useSearchFilter.ts | 4 +- app/{lib => shared}/hooks/useSettings.ts | 10 +- app/{lib => shared}/hooks/useShortcuts.ts | 4 +- .../hooks/useSupabaseConnection.ts | 4 +- app/{lib => shared}/hooks/useUpdateCheck.ts | 2 +- app/{lib => shared}/hooks/useViewport.ts | 0 app/{ => shared}/lib/.server/llm/constants.ts | 0 .../lib/.server/llm/create-summary.ts | 8 +- .../lib/.server/llm/select-context.ts | 8 +- app/shared/lib/.server/llm/stream-text.ts | 276 ++++++++++++++++++ .../lib/.server/llm/switchable-stream.ts | 0 app/{ => shared}/lib/.server/llm/utils.ts | 4 +- app/{ => shared}/lib/api/connection.ts | 0 app/{ => shared}/lib/api/cookies.ts | 0 app/{ => shared}/lib/api/debug.ts | 0 app/{ => shared}/lib/api/features.ts | 0 app/{ => shared}/lib/api/notifications.ts | 4 +- app/{ => shared}/lib/api/updates.ts | 0 app/{ => shared}/lib/crypto.ts | 0 app/{ => shared}/lib/fetch.ts | 0 .../persistence/ChatDescription.client.tsx | 6 +- app/{ => shared}/lib/persistence/chats.ts | 0 app/{ => shared}/lib/persistence/db.ts | 2 +- app/{ => shared}/lib/persistence/index.ts | 0 .../lib/persistence/localStorage.ts | 0 .../lib/persistence/lockedFiles.ts | 2 +- app/{ => shared}/lib/persistence/types.ts | 2 +- .../lib/persistence/useChatHistory.ts | 12 +- .../lib/prompts}/prompt-library.ts | 8 +- .../prompt-variants}/discuss-prompt.ts | 0 .../prompts/prompt-variants}/new-prompt.ts | 8 +- .../lib/prompts/prompt-variants}/optimized.ts | 2 +- .../lib/prompts/prompt-variants}/prompts.ts | 8 +- .../lib/providers/adapters}/amazon-bedrock.ts | 6 +- .../lib/providers/adapters}/anthropic.ts | 6 +- .../lib/providers/adapters}/cohere.ts | 6 +- .../lib/providers/adapters}/deepseek.ts | 6 +- .../lib/providers/adapters}/github.ts | 6 +- .../lib/providers/adapters}/google.ts | 6 +- .../lib/providers/adapters}/groq.ts | 6 +- .../lib/providers/adapters}/huggingface.ts | 6 +- .../lib/providers/adapters}/hyperbolic.ts | 6 +- .../lib/providers/adapters}/lmstudio.ts | 8 +- .../lib/providers/adapters}/mistral.ts | 6 +- .../lib/providers/adapters}/ollama.ts | 8 +- .../lib/providers/adapters}/open-router.ts | 6 +- .../lib/providers/adapters}/openai-like.ts | 6 +- .../lib/providers/adapters}/openai.ts | 6 +- .../lib/providers/adapters}/perplexity.ts | 6 +- .../lib/providers/adapters}/together.ts | 6 +- .../lib/providers/adapters}/xai.ts | 6 +- .../lib/providers}/base-provider.ts | 2 +- .../llm => shared/lib/providers}/manager.ts | 4 +- app/shared/lib/providers/registry.ts | 39 +++ .../llm => shared/lib/providers}/types.ts | 2 +- .../__snapshots__/message-parser.spec.ts.snap | 0 app/{ => shared}/lib/runtime/action-runner.ts | 17 +- .../lib/runtime/message-parser.spec.ts | 0 .../lib/runtime/message-parser.ts | 15 +- .../lib/webcontainer/auth.client.ts | 0 app/{ => shared}/lib/webcontainer/index.ts | 6 +- app/{lib => shared}/stores/logs.ts | 2 +- app/{lib => shared}/stores/netlify.ts | 2 +- app/{lib => shared}/stores/profile.ts | 0 app/{lib => shared}/stores/streaming.ts | 0 app/{lib => shared}/stores/supabase.ts | 2 +- app/{lib => shared}/stores/theme.ts | 0 app/{lib => shared}/stores/vercel.ts | 2 +- app/{ => shared}/types/actions.ts | 0 app/{ => shared}/types/artifact.ts | 0 app/{ => shared}/types/context.ts | 0 app/{ => shared}/types/design-scheme.ts | 0 app/{ => shared}/types/global.d.ts | 0 app/{ => shared}/types/model.ts | 2 +- app/{ => shared}/types/netlify.ts | 0 app/{ => shared}/types/supabase.ts | 0 app/{ => shared}/types/template.ts | 0 app/{ => shared}/types/theme.ts | 0 app/{ => shared}/types/vercel.ts | 0 app/{ => shared}/utils/buffer.ts | 0 app/{ => shared}/utils/classNames.ts | 0 app/{ => shared}/utils/constants.ts | 4 +- app/{ => shared}/utils/debounce.ts | 0 app/{ => shared}/utils/diff.spec.ts | 0 app/{ => shared}/utils/diff.ts | 2 +- app/{ => shared}/utils/easings.ts | 0 app/{ => shared}/utils/file-watcher.ts | 0 app/{ => shared}/utils/fileLocks.ts | 2 +- app/{ => shared}/utils/fileUtils.ts | 0 app/{ => shared}/utils/folderImport.ts | 0 app/{ => shared}/utils/formatSize.ts | 0 .../utils/getLanguageFromExtension.ts | 0 app/{ => shared}/utils/logger.ts | 0 app/{ => shared}/utils/markdown.ts | 0 app/{ => shared}/utils/mobile.ts | 0 app/{ => shared}/utils/os.ts | 0 app/{ => shared}/utils/path.ts | 0 app/{ => shared}/utils/projectCommands.ts | 0 app/{ => shared}/utils/promises.ts | 0 app/{ => shared}/utils/react.ts | 0 app/{ => shared}/utils/sampler.ts | 0 .../utils/selectStarterTemplate.ts | 4 +- app/{ => shared}/utils/shell.ts | 4 +- app/{ => shared}/utils/stacktrace.ts | 0 app/{ => shared}/utils/stripIndent.ts | 0 app/{ => shared}/utils/terminal.ts | 0 app/{ => shared}/utils/types.ts | 0 app/{ => shared}/utils/unreachable.ts | 0 .../workbench/components}/EditorPanel.tsx | 30 +- .../workbench/components}/Preview.tsx | 14 +- .../components}/Workbench.client.tsx | 34 +-- .../editor/codemirror/BinaryContent.tsx | 0 .../editor/codemirror/CodeMirrorEditor.tsx | 10 +- .../editor/codemirror/EnvMasking.ts | 0 .../components/editor/codemirror/cm-theme.ts | 2 +- .../components/editor/codemirror/indent.ts | 0 .../components/editor/codemirror/languages.ts | 0 .../components}/terminal/Terminal.tsx | 4 +- .../components}/terminal/TerminalTabs.tsx | 12 +- .../workbench/components}/terminal/theme.ts | 0 .../components/terminal}/types/terminal.ts | 0 .../workbench/components/ui}/DiffView.tsx | 16 +- .../workbench/components/ui}/ExpoQrModal.tsx | 4 +- .../components/ui}/FileBreadcrumb.tsx | 10 +- .../workbench/components/ui}/FileTree.tsx | 12 +- .../workbench/components/ui}/Inspector.tsx | 0 .../components/ui}/InspectorPanel.tsx | 0 .../workbench/components/ui}/LockManager.tsx | 8 +- .../workbench/components/ui}/PortDropdown.tsx | 2 +- .../components/ui}/ScreenshotSelector.tsx | 0 .../workbench/components/ui}/Search.tsx | 8 +- .../workbench}/stores/editor.ts | 4 +- app/{lib => shared/workbench}/stores/files.ts | 16 +- .../workbench}/stores/previews.ts | 0 .../workbench}/stores/qrCodeStore.ts | 0 .../workbench}/stores/terminal.ts | 6 +- .../workbench}/stores/workbench.ts | 22 +- scripts/update-imports.sh | 4 +- 314 files changed, 1045 insertions(+), 962 deletions(-) rename app/{components/chat => chat/components}/BaseChat.module.scss (100%) rename app/{components/chat => chat/components}/BaseChat.tsx (92%) rename app/{components/chat => chat/components}/Chat.client.tsx (94%) rename app/{components/chat => chat/components}/ExamplePrompts.tsx (100%) rename app/{components/chat => chat/components}/Messages.client.tsx (89%) rename app/{components/chat => chat/components}/ProgressCompilation.tsx (94%) rename app/{components/chat => chat/components}/StarterTemplates.tsx (90%) rename app/{components/chat => chat/components}/ThoughtBox.tsx (100%) rename app/{components/chat => chat/components/alerts}/ChatAlert.tsx (97%) rename app/{components/deploy => chat/components/alerts}/DeployAlert.tsx (98%) rename app/{components/chat => chat/components/alerts}/SupabaseAlert.tsx (97%) rename app/{components/chat => chat/components/chatBox}/APIKeyManager.tsx (97%) rename app/{components/chat => chat/components/chatBox}/ChatBox.tsx (94%) rename app/{components/chat => chat/components/chatBox}/DicussMode.tsx (76%) rename app/{components/chat => chat/components/chatBox}/FilePreview.tsx (100%) rename app/{components/chat => chat/components/chatBox}/ModelSelector.tsx (99%) rename app/{components/chat => chat/components/chatBox}/ScreenshotStateManager.tsx (100%) rename app/{components/chat => chat/components/chatBox}/SendButton.client.tsx (100%) rename app/{components/chat => chat/components/chatBox}/SpeechRecognition.tsx (84%) rename app/{components/chat => chat/components/chatBox}/SupabaseConnection.tsx (97%) rename app/{components/chat => chat/components}/chatExportAndImport/ExportChatButton.tsx (94%) rename app/{components/chat => chat/components}/chatExportAndImport/ImportButtons.tsx (94%) rename app/{components/chat => chat/components/chatExportAndImport}/ImportFolderButton.tsx (92%) rename app/{components/chat => chat/components/markdown}/Markdown.module.scss (100%) rename app/{components/chat => chat/components/markdown}/Markdown.spec.ts (100%) rename app/{components/chat => chat/components/markdown}/Markdown.tsx (96%) rename app/{components/chat => chat/components/messages}/Artifact.tsx (97%) rename app/{components/chat => chat/components/messages}/AssistantMessage.tsx (94%) rename app/{components/chat => chat/components/messages}/CodeBlock.module.scss (100%) rename app/{components/chat => chat/components/messages}/CodeBlock.tsx (95%) rename app/{components/chat => chat/components/messages}/UserMessage.tsx (92%) rename app/{lib => chat}/hooks/StickToBottom.tsx (100%) rename app/{lib => chat}/hooks/usePromptEnhancer.ts (93%) rename app/{lib => chat}/hooks/useStickToBottom.tsx (100%) rename app/{lib => chat}/services/importExportService.ts (99%) rename app/{lib => chat}/stores/chat.ts (100%) rename app/{components/deploy => layout/header/components}/DeployButton.tsx (89%) rename app/{components/header => layout/header/components}/Header.tsx (89%) rename app/{components/header => layout/header/components}/HeaderActionButtons.client.tsx (70%) rename app/{components/chat => layout/header/components}/NetlifyDeploymentLink.client.tsx (91%) rename app/{components/chat => layout/header/components}/VercelDeploymentLink.client.tsx (97%) rename app/{lib => layout/header}/hooks/useEditChatDescription.ts (99%) rename app/{components/deploy/NetlifyDeploy.client.tsx => layout/header/hooks/useNetlifyDeploy.tsx} (95%) rename app/{components/deploy/VercelDeploy.client.tsx => layout/header/hooks/useVercelDeploy.tsx} (93%) rename app/{components => layout}/sidebar/HistoryItem.tsx (95%) rename app/{components => layout}/sidebar/Menu.client.tsx (97%) rename app/{components => layout}/sidebar/date-binning.ts (95%) delete mode 100644 app/lib/.server/llm/stream-text.ts delete mode 100644 app/lib/modules/llm/registry.ts rename app/{components/@settings => settings}/core/AvatarDropdown.tsx (98%) rename app/{components/@settings => settings}/core/ControlPanel.tsx (91%) rename app/{components/@settings => settings}/core/constants.ts (100%) rename app/{components/@settings => settings}/core/types.ts (100%) rename app/{components/@settings => settings}/index.ts (100%) rename app/{components/@settings => settings}/shared/components/DraggableTabList.tsx (95%) rename app/{components/@settings => settings}/shared/components/TabManagement.tsx (97%) rename app/{components/@settings => settings}/shared/components/TabTile.tsx (95%) rename app/{lib => settings}/stores/settings.ts (96%) rename app/{lib => settings}/stores/tabConfigurationStore.ts (100%) rename app/{components/@settings => settings}/tabs/connections/ConnectionDiagnostics.tsx (99%) rename app/{components/@settings => settings}/tabs/connections/ConnectionsTab.tsx (98%) rename app/{components/@settings => settings}/tabs/connections/GithubConnection.tsx (99%) rename app/{components/@settings => settings}/tabs/connections/NetlifyConnection.tsx (99%) rename app/{components/@settings => settings}/tabs/connections/VercelConnection.tsx (98%) rename app/{components/@settings => settings}/tabs/connections/components/ConnectionForm.tsx (97%) rename app/{components/@settings => settings}/tabs/connections/components/CreateBranchDialog.tsx (97%) rename app/{components/@settings => settings}/tabs/connections/components/GitHubAuthDialog.tsx (99%) rename app/{components/@settings => settings}/tabs/connections/components/PushToGitHubDialog.tsx (98%) rename app/{components/@settings => settings}/tabs/connections/components/RepositoryCard.tsx (98%) rename app/{components/@settings => settings}/tabs/connections/components/RepositoryDialogContext.tsx (100%) rename app/{components/@settings => settings}/tabs/connections/components/RepositoryList.tsx (92%) rename app/{components/@settings => settings}/tabs/connections/components/RepositorySelectionDialog.tsx (99%) rename app/{components/@settings => settings}/tabs/connections/components/StatsDialog.tsx (95%) rename app/{components/@settings => settings}/tabs/connections/types/GitHub.ts (100%) rename app/{components/@settings => settings}/tabs/data/DataTab.tsx (98%) rename app/{components/@settings => settings}/tabs/data/DataVisualization.tsx (99%) rename app/{components/@settings => settings}/tabs/debug/DebugTab.tsx (99%) rename app/{components/@settings => settings}/tabs/event-logs/EventLogsTab.tsx (99%) rename app/{components/@settings => settings}/tabs/features/FeaturesTab.tsx (97%) rename app/{components/@settings => settings}/tabs/notifications/NotificationsTab.tsx (99%) rename app/{components/@settings => settings}/tabs/profile/ProfileTab.tsx (97%) rename app/{components/@settings => settings}/tabs/providers/cloud/CloudProvidersTab.tsx (96%) rename app/{components/@settings => settings}/tabs/providers/local/LocalProvidersTab.tsx (98%) rename app/{components/@settings => settings}/tabs/providers/local/OllamaModelInstaller.tsx (98%) rename app/{components/@settings => settings}/tabs/providers/service-status/ServiceStatusTab.tsx (100%) rename app/{components/@settings => settings}/tabs/providers/service-status/base-provider.ts (100%) rename app/{components/@settings => settings}/tabs/providers/service-status/provider-factory.ts (100%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/amazon-bedrock.ts (93%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/anthropic.ts (93%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/cohere.ts (94%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/deepseek.ts (86%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/google.ts (93%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/groq.ts (92%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/huggingface.ts (95%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/hyperbolic.ts (86%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/mistral.ts (92%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/openai.ts (94%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/openrouter.ts (94%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/perplexity.ts (94%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/together.ts (94%) rename app/{components/@settings => settings}/tabs/providers/service-status/providers/xai.ts (85%) rename app/{components/@settings => settings}/tabs/providers/service-status/types.ts (100%) rename app/{components/@settings => settings}/tabs/providers/status/ServiceStatusTab.tsx (99%) rename app/{components/@settings => settings}/tabs/settings/SettingsTab.tsx (97%) rename app/{components/@settings => settings}/tabs/task-manager/TaskManagerTab.tsx (99%) rename app/{components/@settings => settings}/tabs/update/UpdateTab.tsx (98%) rename app/{components/@settings => settings}/utils/animations.ts (100%) rename app/{components/@settings => settings}/utils/tab-helpers.ts (94%) rename app/{components/chat => shared/components/github/components}/GitCloneButton.tsx (90%) rename app/{components/git => shared/components/github/components}/GitUrlImport.client.tsx (92%) rename app/{ => shared/components/github}/types/GitHub.ts (100%) rename app/{ => shared}/components/ui/BackgroundRays/index.tsx (100%) rename app/{ => shared}/components/ui/BackgroundRays/styles.module.scss (100%) rename app/{ => shared}/components/ui/Badge.tsx (97%) rename app/{ => shared}/components/ui/Breadcrumbs.tsx (98%) rename app/{ => shared}/components/ui/Button.tsx (97%) rename app/{ => shared}/components/ui/Card.tsx (97%) rename app/{ => shared}/components/ui/Checkbox.tsx (95%) rename app/{ => shared}/components/ui/CloseButton.tsx (96%) rename app/{ => shared}/components/ui/CodeBlock.tsx (98%) rename app/{ => shared}/components/ui/Collapsible.tsx (100%) rename app/{ => shared}/components/ui/ColorSchemeDialog.tsx (99%) rename app/{ => shared}/components/ui/Dialog.tsx (99%) rename app/{ => shared}/components/ui/Dropdown.tsx (97%) rename app/{ => shared}/components/ui/EmptyState.tsx (98%) rename app/{ => shared}/components/ui/FileIcon.tsx (99%) rename app/{ => shared}/components/ui/FilterChip.tsx (98%) rename app/{ => shared}/components/ui/GradientCard.tsx (97%) rename app/{ => shared}/components/ui/IconButton.tsx (97%) rename app/{ => shared}/components/ui/Input.tsx (93%) rename app/{ => shared}/components/ui/Label.tsx (90%) rename app/{ => shared}/components/ui/LoadingDots.tsx (100%) rename app/{ => shared}/components/ui/LoadingOverlay.tsx (100%) rename app/{ => shared}/components/ui/PanelHeader.tsx (89%) rename app/{ => shared}/components/ui/PanelHeaderButton.tsx (95%) rename app/{ => shared}/components/ui/Popover.tsx (100%) rename app/{ => shared}/components/ui/Progress.tsx (91%) rename app/{ => shared}/components/ui/RepositoryStats.tsx (96%) rename app/{ => shared}/components/ui/ScrollArea.tsx (96%) rename app/{ => shared}/components/ui/SearchInput.tsx (97%) rename app/{ => shared}/components/ui/SearchResultItem.tsx (98%) rename app/{ => shared}/components/ui/Separator.tsx (90%) rename app/{ => shared}/components/ui/SettingsButton.tsx (87%) rename app/{ => shared}/components/ui/Slider.tsx (93%) rename app/{ => shared}/components/ui/StatusIndicator.tsx (97%) rename app/{ => shared}/components/ui/Switch.tsx (95%) rename app/{ => shared}/components/ui/Tabs.tsx (97%) rename app/{ => shared}/components/ui/TabsWithSlider.tsx (98%) rename app/{ => shared}/components/ui/ThemeSwitch.tsx (91%) rename app/{ => shared}/components/ui/Tooltip.tsx (98%) rename app/{ => shared}/components/ui/index.ts (100%) rename app/{ => shared}/components/ui/use-toast.ts (100%) rename app/{lib => shared}/hooks/index.ts (70%) rename app/{lib => shared}/hooks/useConnectionStatus.ts (96%) rename app/{lib => shared}/hooks/useDataOperations.ts (99%) rename app/{lib => shared}/hooks/useDebugStatus.ts (98%) rename app/{lib => shared}/hooks/useFeatures.ts (98%) rename app/{lib => shared}/hooks/useGit.ts (99%) rename app/{lib => shared}/hooks/useIndexedDB.ts (100%) rename app/{lib => shared}/hooks/useLocalProviders.ts (91%) rename app/{lib => shared}/hooks/useMessageParser.ts (91%) rename app/{lib => shared}/hooks/useNotifications.ts (94%) rename app/{lib => shared}/hooks/useSearchFilter.ts (90%) rename app/{lib => shared}/hooks/useSettings.ts (95%) rename app/{lib => shared}/hooks/useShortcuts.ts (95%) rename app/{lib => shared}/hooks/useSupabaseConnection.ts (98%) rename app/{lib => shared}/hooks/useUpdateCheck.ts (95%) rename app/{lib => shared}/hooks/useViewport.ts (100%) rename app/{ => shared}/lib/.server/llm/constants.ts (100%) rename app/{ => shared}/lib/.server/llm/create-summary.ts (96%) rename app/{ => shared}/lib/.server/llm/select-context.ts (97%) create mode 100644 app/shared/lib/.server/llm/stream-text.ts rename app/{ => shared}/lib/.server/llm/switchable-stream.ts (100%) rename app/{ => shared}/lib/.server/llm/utils.ts (97%) rename app/{ => shared}/lib/api/connection.ts (100%) rename app/{ => shared}/lib/api/cookies.ts (100%) rename app/{ => shared}/lib/api/debug.ts (100%) rename app/{ => shared}/lib/api/features.ts (100%) rename app/{ => shared}/lib/api/notifications.ts (93%) rename app/{ => shared}/lib/api/updates.ts (100%) rename app/{ => shared}/lib/crypto.ts (100%) rename app/{ => shared}/lib/fetch.ts (100%) rename app/{ => shared}/lib/persistence/ChatDescription.client.tsx (91%) rename app/{ => shared}/lib/persistence/chats.ts (100%) rename app/{ => shared}/lib/persistence/db.ts (99%) rename app/{ => shared}/lib/persistence/index.ts (100%) rename app/{ => shared}/lib/persistence/localStorage.ts (100%) rename app/{ => shared}/lib/persistence/lockedFiles.ts (99%) rename app/{ => shared}/lib/persistence/types.ts (58%) rename app/{ => shared}/lib/persistence/useChatHistory.ts (97%) rename app/{lib/common => shared/lib/prompts}/prompt-library.ts (86%) rename app/{lib/common/prompts => shared/lib/prompts/prompt-variants}/discuss-prompt.ts (100%) rename app/{lib/common/prompts => shared/lib/prompts/prompt-variants}/new-prompt.ts (98%) rename app/{lib/common/prompts => shared/lib/prompts/prompt-variants}/optimized.ts (99%) rename app/{lib/common/prompts => shared/lib/prompts/prompt-variants}/prompts.ts (99%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/amazon-bedrock.ts (94%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/anthropic.ts (93%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/cohere.ts (91%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/deepseek.ts (87%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/github.ts (90%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/google.ts (94%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/groq.ts (93%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/huggingface.ts (93%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/hyperbolic.ts (93%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/lmstudio.ts (91%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/mistral.ts (90%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/ollama.ts (94%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/open-router.ts (94%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/openai-like.ts (89%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/openai.ts (93%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/perplexity.ts (88%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/together.ts (92%) rename app/{lib/modules/llm/providers => shared/lib/providers/adapters}/xai.ts (87%) rename app/{lib/modules/llm => shared/lib/providers}/base-provider.ts (98%) rename app/{lib/modules/llm => shared/lib/providers}/manager.ts (98%) create mode 100644 app/shared/lib/providers/registry.ts rename app/{lib/modules/llm => shared/lib/providers}/types.ts (92%) rename app/{ => shared}/lib/runtime/__snapshots__/message-parser.spec.ts.snap (100%) rename app/{ => shared}/lib/runtime/action-runner.ts (97%) rename app/{ => shared}/lib/runtime/message-parser.spec.ts (100%) rename app/{ => shared}/lib/runtime/message-parser.ts (97%) rename app/{ => shared}/lib/webcontainer/auth.client.ts (100%) rename app/{ => shared}/lib/webcontainer/index.ts (90%) rename app/{lib => shared}/stores/logs.ts (99%) rename app/{lib => shared}/stores/netlify.ts (97%) rename app/{lib => shared}/stores/profile.ts (100%) rename app/{lib => shared}/stores/streaming.ts (100%) rename app/{lib => shared}/stores/supabase.ts (99%) rename app/{lib => shared}/stores/theme.ts (100%) rename app/{lib => shared}/stores/vercel.ts (97%) rename app/{ => shared}/types/actions.ts (100%) rename app/{ => shared}/types/artifact.ts (100%) rename app/{ => shared}/types/context.ts (100%) rename app/{ => shared}/types/design-scheme.ts (100%) rename app/{ => shared}/types/global.d.ts (100%) rename app/{ => shared}/types/model.ts (88%) rename app/{ => shared}/types/netlify.ts (100%) rename app/{ => shared}/types/supabase.ts (100%) rename app/{ => shared}/types/template.ts (100%) rename app/{ => shared}/types/theme.ts (100%) rename app/{ => shared}/types/vercel.ts (100%) rename app/{ => shared}/utils/buffer.ts (100%) rename app/{ => shared}/utils/classNames.ts (100%) rename app/{ => shared}/utils/constants.ts (97%) rename app/{ => shared}/utils/debounce.ts (100%) rename app/{ => shared}/utils/diff.spec.ts (100%) rename app/{ => shared}/utils/diff.ts (98%) rename app/{ => shared}/utils/easings.ts (100%) rename app/{ => shared}/utils/file-watcher.ts (100%) rename app/{ => shared}/utils/fileLocks.ts (98%) rename app/{ => shared}/utils/fileUtils.ts (100%) rename app/{ => shared}/utils/folderImport.ts (100%) rename app/{ => shared}/utils/formatSize.ts (100%) rename app/{ => shared}/utils/getLanguageFromExtension.ts (100%) rename app/{ => shared}/utils/logger.ts (100%) rename app/{ => shared}/utils/markdown.ts (100%) rename app/{ => shared}/utils/mobile.ts (100%) rename app/{ => shared}/utils/os.ts (100%) rename app/{ => shared}/utils/path.ts (100%) rename app/{ => shared}/utils/projectCommands.ts (100%) rename app/{ => shared}/utils/promises.ts (100%) rename app/{ => shared}/utils/react.ts (100%) rename app/{ => shared}/utils/sampler.ts (100%) rename app/{ => shared}/utils/selectStarterTemplate.ts (98%) rename app/{ => shared}/utils/shell.ts (98%) rename app/{ => shared}/utils/stacktrace.ts (100%) rename app/{ => shared}/utils/stripIndent.ts (100%) rename app/{ => shared}/utils/terminal.ts (100%) rename app/{ => shared}/utils/types.ts (100%) rename app/{ => shared}/utils/unreachable.ts (100%) rename app/{components/workbench => shared/workbench/components}/EditorPanel.tsx (87%) rename app/{components/workbench => shared/workbench/components}/Preview.tsx (98%) rename app/{components/workbench => shared/workbench/components}/Workbench.client.tsx (95%) rename app/{ => shared/workbench}/components/editor/codemirror/BinaryContent.tsx (100%) rename app/{ => shared/workbench}/components/editor/codemirror/CodeMirrorEditor.tsx (98%) rename app/{ => shared/workbench}/components/editor/codemirror/EnvMasking.ts (100%) rename app/{ => shared/workbench}/components/editor/codemirror/cm-theme.ts (99%) rename app/{ => shared/workbench}/components/editor/codemirror/indent.ts (100%) rename app/{ => shared/workbench}/components/editor/codemirror/languages.ts (100%) rename app/{components/workbench => shared/workbench/components}/terminal/Terminal.tsx (95%) rename app/{components/workbench => shared/workbench/components}/terminal/TerminalTabs.tsx (94%) rename app/{components/workbench => shared/workbench/components}/terminal/theme.ts (100%) rename app/{ => shared/workbench/components/terminal}/types/terminal.ts (100%) rename app/{components/workbench => shared/workbench/components/ui}/DiffView.tsx (97%) rename app/{components/workbench => shared/workbench/components/ui}/ExpoQrModal.tsx (95%) rename app/{components/workbench => shared/workbench/components/ui}/FileBreadcrumb.tsx (94%) rename app/{components/workbench => shared/workbench/components/ui}/FileTree.tsx (98%) rename app/{components/workbench => shared/workbench/components/ui}/Inspector.tsx (100%) rename app/{components/workbench => shared/workbench/components/ui}/InspectorPanel.tsx (100%) rename app/{components/workbench => shared/workbench/components/ui}/LockManager.tsx (97%) rename app/{components/workbench => shared/workbench/components/ui}/PortDropdown.tsx (97%) rename app/{components/workbench => shared/workbench/components/ui}/ScreenshotSelector.tsx (100%) rename app/{components/workbench => shared/workbench/components/ui}/Search.tsx (97%) rename app/{lib => shared/workbench}/stores/editor.ts (94%) rename app/{lib => shared/workbench}/stores/files.ts (98%) rename app/{lib => shared/workbench}/stores/previews.ts (100%) rename app/{lib => shared/workbench}/stores/qrCodeStore.ts (100%) rename app/{lib => shared/workbench}/stores/terminal.ts (87%) rename app/{lib => shared/workbench}/stores/workbench.ts (97%) diff --git a/app/components/chat/BaseChat.module.scss b/app/chat/components/BaseChat.module.scss similarity index 100% rename from app/components/chat/BaseChat.module.scss rename to app/chat/components/BaseChat.module.scss diff --git a/app/components/chat/BaseChat.tsx b/app/chat/components/BaseChat.tsx similarity index 92% rename from app/components/chat/BaseChat.tsx rename to app/chat/components/BaseChat.tsx index 1d1803fd..05fc56e3 100644 --- a/app/components/chat/BaseChat.tsx +++ b/app/chat/components/BaseChat.tsx @@ -5,34 +5,34 @@ import type { JSONValue, Message } from 'ai'; import React, { type RefCallback, useEffect, useState } from 'react'; import { ClientOnly } from 'remix-utils/client-only'; -import { Menu } from '~/components/sidebar/Menu.client'; -import { Workbench } from '~/components/workbench/Workbench.client'; -import { classNames } from '~/utils/classNames'; -import { PROVIDER_LIST } from '~/utils/constants'; +import { Menu } from '~/layout/sidebar/Menu.client'; +import { Workbench } from '~/shared/workbench/components/Workbench.client'; +import { classNames } from '~/shared/utils/classNames'; +import { PROVIDER_LIST } from '~/shared/utils/constants'; import { Messages } from './Messages.client'; -import { getApiKeysFromCookies } from './APIKeyManager'; +import { getApiKeysFromCookies } from './chatBox/APIKeyManager'; import Cookies from 'js-cookie'; import * as Tooltip from '@radix-ui/react-tooltip'; import styles from './BaseChat.module.scss'; -import { ImportButtons } from '~/components/chat/chatExportAndImport/ImportButtons'; -import { ExamplePrompts } from '~/components/chat/ExamplePrompts'; -import GitCloneButton from './GitCloneButton'; -import type { ProviderInfo } from '~/types/model'; +import { ImportButtons } from '~/chat/components/chatExportAndImport/ImportButtons'; +import { ExamplePrompts } from '~/chat/components/ExamplePrompts'; +import GitCloneButton from '~/shared/components/github/components/GitCloneButton'; +import type { ProviderInfo } from '~/shared/types/model'; import StarterTemplates from './StarterTemplates'; -import type { ActionAlert, SupabaseAlert, DeployAlert } from '~/types/actions'; -import DeployChatAlert from '~/components/deploy/DeployAlert'; -import ChatAlert from './ChatAlert'; -import type { ModelInfo } from '~/lib/modules/llm/types'; +import type { ActionAlert, SupabaseAlert, DeployAlert } from '~/shared/types/actions'; +import DeployChatAlert from '~/chat/components/alerts/DeployAlert'; +import ChatAlert from './alerts/ChatAlert'; +import type { ModelInfo } from '~/shared/lib/providers/types'; import ProgressCompilation from './ProgressCompilation'; -import type { ProgressAnnotation } from '~/types/context'; -import type { ActionRunner } from '~/lib/runtime/action-runner'; -import { SupabaseChatAlert } from '~/components/chat/SupabaseAlert'; -import { expoUrlAtom } from '~/lib/stores/qrCodeStore'; +import type { ProgressAnnotation } from '~/shared/types/context'; +import type { ActionRunner } from '~/shared/lib/runtime/action-runner'; +import { SupabaseChatAlert } from '~/chat/components/alerts/SupabaseAlert'; +import { expoUrlAtom } from '~/shared/workbench/stores/qrCodeStore'; import { useStore } from '@nanostores/react'; -import { StickToBottom, useStickToBottomContext } from '~/lib/hooks'; -import { ChatBox } from './ChatBox'; -import type { DesignScheme } from '~/types/design-scheme'; -import type { ElementInfo } from '~/components/workbench/Inspector'; +import { StickToBottom, useStickToBottomContext } from '~/chat/hooks/StickToBottom'; +import { ChatBox } from './chatBox/ChatBox'; +import type { DesignScheme } from '~/shared/types/design-scheme'; +import type { ElementInfo } from '~/shared/workbench/components/ui/Inspector'; const TEXTAREA_MIN_HEIGHT = 76; diff --git a/app/components/chat/Chat.client.tsx b/app/chat/components/Chat.client.tsx similarity index 94% rename from app/components/chat/Chat.client.tsx rename to app/chat/components/Chat.client.tsx index be5ff421..88b55d99 100644 --- a/app/components/chat/Chat.client.tsx +++ b/app/chat/components/Chat.client.tsx @@ -8,27 +8,27 @@ import { useChat } from 'ai/react'; import { useAnimate } from 'framer-motion'; import { memo, useCallback, useEffect, useRef, useState } from 'react'; import { cssTransition, toast, ToastContainer } from 'react-toastify'; -import { useMessageParser, usePromptEnhancer, useShortcuts } from '~/lib/hooks'; -import { description, useChatHistory } from '~/lib/persistence'; -import { chatStore } from '~/lib/stores/chat'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { DEFAULT_MODEL, DEFAULT_PROVIDER, PROMPT_COOKIE_KEY, PROVIDER_LIST } from '~/utils/constants'; -import { cubicEasingFn } from '~/utils/easings'; -import { createScopedLogger, renderLogger } from '~/utils/logger'; +import { useMessageParser, usePromptEnhancer, useShortcuts } from '~/shared/hooks'; +import { description, useChatHistory } from '~/shared/lib/persistence'; +import { chatStore } from '~/chat/stores/chat'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { DEFAULT_MODEL, DEFAULT_PROVIDER, PROMPT_COOKIE_KEY, PROVIDER_LIST } from '~/shared/utils/constants'; +import { cubicEasingFn } from '~/shared/utils/easings'; +import { createScopedLogger, renderLogger } from '~/shared/utils/logger'; import { BaseChat } from './BaseChat'; import Cookies from 'js-cookie'; -import { debounce } from '~/utils/debounce'; -import { useSettings } from '~/lib/hooks/useSettings'; -import type { ProviderInfo } from '~/types/model'; +import { debounce } from '~/shared/utils/debounce'; +import { useSettings } from '~/shared/hooks/useSettings'; +import type { ProviderInfo } from '~/shared/types/model'; import { useSearchParams } from '@remix-run/react'; -import { createSampler } from '~/utils/sampler'; -import { getTemplates, selectStarterTemplate } from '~/utils/selectStarterTemplate'; -import { logStore } from '~/lib/stores/logs'; -import { streamingState } from '~/lib/stores/streaming'; -import { filesToArtifacts } from '~/utils/fileUtils'; -import { supabaseConnection } from '~/lib/stores/supabase'; -import { defaultDesignScheme, type DesignScheme } from '~/types/design-scheme'; -import type { ElementInfo } from '~/components/workbench/Inspector'; +import { createSampler } from '~/shared/utils/sampler'; +import { getTemplates, selectStarterTemplate } from '~/shared/utils/selectStarterTemplate'; +import { logStore } from '~/shared/stores/logs'; +import { streamingState } from '~/shared/stores/streaming'; +import { filesToArtifacts } from '~/shared/utils/fileUtils'; +import { supabaseConnection } from '~/shared/stores/supabase'; +import { defaultDesignScheme, type DesignScheme } from '~/shared/types/design-scheme'; +import type { ElementInfo } from '~/shared/workbench/components/ui/Inspector'; const toastAnimation = cssTransition({ enter: 'animated fadeInRight', diff --git a/app/components/chat/ExamplePrompts.tsx b/app/chat/components/ExamplePrompts.tsx similarity index 100% rename from app/components/chat/ExamplePrompts.tsx rename to app/chat/components/ExamplePrompts.tsx diff --git a/app/components/chat/Messages.client.tsx b/app/chat/components/Messages.client.tsx similarity index 89% rename from app/components/chat/Messages.client.tsx rename to app/chat/components/Messages.client.tsx index c98aa4df..bfe1f551 100644 --- a/app/components/chat/Messages.client.tsx +++ b/app/chat/components/Messages.client.tsx @@ -1,15 +1,15 @@ import type { Message } from 'ai'; import { Fragment } from 'react'; -import { classNames } from '~/utils/classNames'; -import { AssistantMessage } from './AssistantMessage'; -import { UserMessage } from './UserMessage'; +import { classNames } from '~/shared/utils/classNames'; +import { AssistantMessage } from './messages/AssistantMessage'; +import { UserMessage } from './messages/UserMessage'; import { useLocation } from '@remix-run/react'; -import { db, chatId } from '~/lib/persistence/useChatHistory'; -import { forkChat } from '~/lib/persistence/db'; +import { db, chatId } from '~/shared/lib/persistence/useChatHistory'; +import { forkChat } from '~/shared/lib/persistence/db'; import { toast } from 'react-toastify'; import { forwardRef } from 'react'; import type { ForwardedRef } from 'react'; -import type { ProviderInfo } from '~/types/model'; +import type { ProviderInfo } from '~/shared/types/model'; interface MessagesProps { id?: string; diff --git a/app/components/chat/ProgressCompilation.tsx b/app/chat/components/ProgressCompilation.tsx similarity index 94% rename from app/components/chat/ProgressCompilation.tsx rename to app/chat/components/ProgressCompilation.tsx index 68ae3388..9e04ff50 100644 --- a/app/components/chat/ProgressCompilation.tsx +++ b/app/chat/components/ProgressCompilation.tsx @@ -1,8 +1,8 @@ import { AnimatePresence, motion } from 'framer-motion'; import React, { useState } from 'react'; -import type { ProgressAnnotation } from '~/types/context'; -import { classNames } from '~/utils/classNames'; -import { cubicEasingFn } from '~/utils/easings'; +import type { ProgressAnnotation } from '~/shared/types/context'; +import { classNames } from '~/shared/utils/classNames'; +import { cubicEasingFn } from '~/shared/utils/easings'; export default function ProgressCompilation({ data }: { data?: ProgressAnnotation[] }) { const [progressList, setProgressList] = React.useState([]); diff --git a/app/components/chat/StarterTemplates.tsx b/app/chat/components/StarterTemplates.tsx similarity index 90% rename from app/components/chat/StarterTemplates.tsx rename to app/chat/components/StarterTemplates.tsx index 20b666e3..6192845d 100644 --- a/app/components/chat/StarterTemplates.tsx +++ b/app/chat/components/StarterTemplates.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import type { Template } from '~/types/template'; -import { STARTER_TEMPLATES } from '~/utils/constants'; +import type { Template } from '~/shared/types/template'; +import { STARTER_TEMPLATES } from '~/shared/utils/constants'; interface FrameworkLinkProps { template: Template; diff --git a/app/components/chat/ThoughtBox.tsx b/app/chat/components/ThoughtBox.tsx similarity index 100% rename from app/components/chat/ThoughtBox.tsx rename to app/chat/components/ThoughtBox.tsx diff --git a/app/components/chat/ChatAlert.tsx b/app/chat/components/alerts/ChatAlert.tsx similarity index 97% rename from app/components/chat/ChatAlert.tsx rename to app/chat/components/alerts/ChatAlert.tsx index 5aeb08c7..c00b245f 100644 --- a/app/components/chat/ChatAlert.tsx +++ b/app/chat/components/alerts/ChatAlert.tsx @@ -1,6 +1,6 @@ import { AnimatePresence, motion } from 'framer-motion'; -import type { ActionAlert } from '~/types/actions'; -import { classNames } from '~/utils/classNames'; +import type { ActionAlert } from '~/shared/types/actions'; +import { classNames } from '~/shared/utils/classNames'; interface Props { alert: ActionAlert; diff --git a/app/components/deploy/DeployAlert.tsx b/app/chat/components/alerts/DeployAlert.tsx similarity index 98% rename from app/components/deploy/DeployAlert.tsx rename to app/chat/components/alerts/DeployAlert.tsx index adedb77b..0fbef717 100644 --- a/app/components/deploy/DeployAlert.tsx +++ b/app/chat/components/alerts/DeployAlert.tsx @@ -1,6 +1,6 @@ import { AnimatePresence, motion } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; -import type { DeployAlert } from '~/types/actions'; +import { classNames } from '~/shared/utils/classNames'; +import type { DeployAlert } from '~/shared/types/actions'; interface DeployAlertProps { alert: DeployAlert; diff --git a/app/components/chat/SupabaseAlert.tsx b/app/chat/components/alerts/SupabaseAlert.tsx similarity index 97% rename from app/components/chat/SupabaseAlert.tsx rename to app/chat/components/alerts/SupabaseAlert.tsx index 414a6e51..d1c6b725 100644 --- a/app/components/chat/SupabaseAlert.tsx +++ b/app/chat/components/alerts/SupabaseAlert.tsx @@ -1,7 +1,7 @@ import { AnimatePresence, motion } from 'framer-motion'; -import type { SupabaseAlert } from '~/types/actions'; -import { classNames } from '~/utils/classNames'; -import { supabaseConnection } from '~/lib/stores/supabase'; +import type { SupabaseAlert } from '~/shared/types/actions'; +import { classNames } from '~/shared/utils/classNames'; +import { supabaseConnection } from '~/shared/stores/supabase'; import { useStore } from '@nanostores/react'; import { useState } from 'react'; diff --git a/app/components/chat/APIKeyManager.tsx b/app/chat/components/chatBox/APIKeyManager.tsx similarity index 97% rename from app/components/chat/APIKeyManager.tsx rename to app/chat/components/chatBox/APIKeyManager.tsx index 92263363..433b78db 100644 --- a/app/components/chat/APIKeyManager.tsx +++ b/app/chat/components/chatBox/APIKeyManager.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, useCallback } from 'react'; -import { IconButton } from '~/components/ui/IconButton'; -import type { ProviderInfo } from '~/types/model'; +import { IconButton } from '~/shared/components/ui/IconButton'; +import type { ProviderInfo } from '~/shared/types/model'; import Cookies from 'js-cookie'; interface APIKeyManagerProps { diff --git a/app/components/chat/ChatBox.tsx b/app/chat/components/chatBox/ChatBox.tsx similarity index 94% rename from app/components/chat/ChatBox.tsx rename to app/chat/components/chatBox/ChatBox.tsx index 99aa8355..9ab5cbb5 100644 --- a/app/components/chat/ChatBox.tsx +++ b/app/chat/components/chatBox/ChatBox.tsx @@ -1,23 +1,23 @@ import React from 'react'; import { ClientOnly } from 'remix-utils/client-only'; -import { classNames } from '~/utils/classNames'; -import { PROVIDER_LIST } from '~/utils/constants'; -import { ModelSelector } from '~/components/chat/ModelSelector'; +import { classNames } from '~/shared/utils/classNames'; +import { PROVIDER_LIST } from '~/shared/utils/constants'; +import { ModelSelector } from '~/chat/components/chatBox/ModelSelector'; import { APIKeyManager } from './APIKeyManager'; -import { LOCAL_PROVIDERS } from '~/lib/stores/settings'; +import { LOCAL_PROVIDERS } from '~/settings/stores/settings'; import FilePreview from './FilePreview'; import { ScreenshotStateManager } from './ScreenshotStateManager'; import { SendButton } from './SendButton.client'; -import { IconButton } from '~/components/ui/IconButton'; +import { IconButton } from '~/shared/components/ui/IconButton'; import { toast } from 'react-toastify'; -import { SpeechRecognitionButton } from '~/components/chat/SpeechRecognition'; +import { SpeechRecognitionButton } from '~/chat/components/chatBox/SpeechRecognition'; import { SupabaseConnection } from './SupabaseConnection'; -import { ExpoQrModal } from '~/components/workbench/ExpoQrModal'; -import styles from './BaseChat.module.scss'; -import type { ProviderInfo } from '~/types/model'; -import { ColorSchemeDialog } from '~/components/ui/ColorSchemeDialog'; -import type { DesignScheme } from '~/types/design-scheme'; -import type { ElementInfo } from '~/components/workbench/Inspector'; +import { ExpoQrModal } from '~/shared/workbench/components/ui/ExpoQrModal'; +import styles from '~/chat/BaseChat.module.scss'; +import type { ProviderInfo } from '~/shared/types/model'; +import { ColorSchemeDialog } from '~/shared/components/ui/ColorSchemeDialog'; +import type { DesignScheme } from '~/shared/types/design-scheme'; +import type { ElementInfo } from '~/shared/workbench/components/ui/Inspector'; interface ChatBoxProps { isModelSettingsCollapsed: boolean; diff --git a/app/components/chat/DicussMode.tsx b/app/chat/components/chatBox/DicussMode.tsx similarity index 76% rename from app/components/chat/DicussMode.tsx rename to app/chat/components/chatBox/DicussMode.tsx index 2ee1c26e..c14f36fc 100644 --- a/app/components/chat/DicussMode.tsx +++ b/app/chat/components/chatBox/DicussMode.tsx @@ -1,5 +1,5 @@ -import { classNames } from '~/utils/classNames'; -import { IconButton } from '~/components/ui'; +import { classNames } from '~/shared/utils/classNames'; +import { IconButton } from '~/shared/components/ui'; export function DiscussMode() { return ( diff --git a/app/components/chat/FilePreview.tsx b/app/chat/components/chatBox/FilePreview.tsx similarity index 100% rename from app/components/chat/FilePreview.tsx rename to app/chat/components/chatBox/FilePreview.tsx diff --git a/app/components/chat/ModelSelector.tsx b/app/chat/components/chatBox/ModelSelector.tsx similarity index 99% rename from app/components/chat/ModelSelector.tsx rename to app/chat/components/chatBox/ModelSelector.tsx index 8d38b256..56ce7d92 100644 --- a/app/components/chat/ModelSelector.tsx +++ b/app/chat/components/chatBox/ModelSelector.tsx @@ -1,8 +1,8 @@ -import type { ProviderInfo } from '~/types/model'; +import type { ProviderInfo } from '~/shared/types/model'; import { useEffect, useState, useRef } from 'react'; import type { KeyboardEvent } from 'react'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import { classNames } from '~/utils/classNames'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import { classNames } from '~/shared/utils/classNames'; interface ModelSelectorProps { model?: string; diff --git a/app/components/chat/ScreenshotStateManager.tsx b/app/chat/components/chatBox/ScreenshotStateManager.tsx similarity index 100% rename from app/components/chat/ScreenshotStateManager.tsx rename to app/chat/components/chatBox/ScreenshotStateManager.tsx diff --git a/app/components/chat/SendButton.client.tsx b/app/chat/components/chatBox/SendButton.client.tsx similarity index 100% rename from app/components/chat/SendButton.client.tsx rename to app/chat/components/chatBox/SendButton.client.tsx diff --git a/app/components/chat/SpeechRecognition.tsx b/app/chat/components/chatBox/SpeechRecognition.tsx similarity index 84% rename from app/components/chat/SpeechRecognition.tsx rename to app/chat/components/chatBox/SpeechRecognition.tsx index 18c66c76..0322b661 100644 --- a/app/components/chat/SpeechRecognition.tsx +++ b/app/chat/components/chatBox/SpeechRecognition.tsx @@ -1,5 +1,5 @@ -import { IconButton } from '~/components/ui/IconButton'; -import { classNames } from '~/utils/classNames'; +import { IconButton } from '~/shared/components/ui/IconButton'; +import { classNames } from '~/shared/utils/classNames'; import React from 'react'; export const SpeechRecognitionButton = ({ diff --git a/app/components/chat/SupabaseConnection.tsx b/app/chat/components/chatBox/SupabaseConnection.tsx similarity index 97% rename from app/components/chat/SupabaseConnection.tsx rename to app/chat/components/chatBox/SupabaseConnection.tsx index 64d46ef5..d9bfc65b 100644 --- a/app/components/chat/SupabaseConnection.tsx +++ b/app/chat/components/chatBox/SupabaseConnection.tsx @@ -1,10 +1,10 @@ import { useEffect } from 'react'; -import { useSupabaseConnection } from '~/lib/hooks/useSupabaseConnection'; -import { classNames } from '~/utils/classNames'; +import { useSupabaseConnection } from '~/shared/hooks/useSupabaseConnection'; +import { classNames } from '~/shared/utils/classNames'; import { useStore } from '@nanostores/react'; -import { chatId } from '~/lib/persistence/useChatHistory'; -import { fetchSupabaseStats } from '~/lib/stores/supabase'; -import { Dialog, DialogRoot, DialogClose, DialogTitle, DialogButton } from '~/components/ui/Dialog'; +import { chatId } from '~/shared/lib/persistence/useChatHistory'; +import { fetchSupabaseStats } from '~/shared/stores/supabase'; +import { Dialog, DialogRoot, DialogClose, DialogTitle, DialogButton } from '~/shared/components/ui/Dialog'; export function SupabaseConnection() { const { diff --git a/app/components/chat/chatExportAndImport/ExportChatButton.tsx b/app/chat/components/chatExportAndImport/ExportChatButton.tsx similarity index 94% rename from app/components/chat/chatExportAndImport/ExportChatButton.tsx rename to app/chat/components/chatExportAndImport/ExportChatButton.tsx index 53665d98..62880da1 100644 --- a/app/components/chat/chatExportAndImport/ExportChatButton.tsx +++ b/app/chat/components/chatExportAndImport/ExportChatButton.tsx @@ -1,6 +1,6 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { classNames } from '~/utils/classNames'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { classNames } from '~/shared/utils/classNames'; export const ExportChatButton = ({ exportChat }: { exportChat?: () => void }) => { return ( diff --git a/app/components/chat/chatExportAndImport/ImportButtons.tsx b/app/chat/components/chatExportAndImport/ImportButtons.tsx similarity index 94% rename from app/components/chat/chatExportAndImport/ImportButtons.tsx rename to app/chat/components/chatExportAndImport/ImportButtons.tsx index c1835587..d8b2618e 100644 --- a/app/components/chat/chatExportAndImport/ImportButtons.tsx +++ b/app/chat/components/chatExportAndImport/ImportButtons.tsx @@ -1,8 +1,8 @@ import type { Message } from 'ai'; import { toast } from 'react-toastify'; -import { ImportFolderButton } from '~/components/chat/ImportFolderButton'; -import { Button } from '~/components/ui/Button'; -import { classNames } from '~/utils/classNames'; +import { ImportFolderButton } from '~/chat/components/chatExportAndImport/ImportFolderButton'; +import { Button } from '~/shared/components/ui/Button'; +import { classNames } from '~/shared/utils/classNames'; type ChatData = { messages?: Message[]; // Standard Bolt format diff --git a/app/components/chat/ImportFolderButton.tsx b/app/chat/components/chatExportAndImport/ImportFolderButton.tsx similarity index 92% rename from app/components/chat/ImportFolderButton.tsx rename to app/chat/components/chatExportAndImport/ImportFolderButton.tsx index e0c2d266..d19e70b6 100644 --- a/app/components/chat/ImportFolderButton.tsx +++ b/app/chat/components/chatExportAndImport/ImportFolderButton.tsx @@ -1,11 +1,11 @@ import React, { useState } from 'react'; import type { Message } from 'ai'; import { toast } from 'react-toastify'; -import { MAX_FILES, isBinaryFile, shouldIncludeFile } from '~/utils/fileUtils'; -import { createChatFromFolder } from '~/utils/folderImport'; -import { logStore } from '~/lib/stores/logs'; // Assuming logStore is imported from this location -import { Button } from '~/components/ui/Button'; -import { classNames } from '~/utils/classNames'; +import { MAX_FILES, isBinaryFile, shouldIncludeFile } from '~/shared/utils/fileUtils'; +import { createChatFromFolder } from '~/shared/utils/folderImport'; +import { logStore } from '~/shared/stores/logs'; // Assuming logStore is imported from this location +import { Button } from '~/shared/components/ui/Button'; +import { classNames } from '~/shared/utils/classNames'; interface ImportFolderButtonProps { className?: string; diff --git a/app/components/chat/Markdown.module.scss b/app/chat/components/markdown/Markdown.module.scss similarity index 100% rename from app/components/chat/Markdown.module.scss rename to app/chat/components/markdown/Markdown.module.scss diff --git a/app/components/chat/Markdown.spec.ts b/app/chat/components/markdown/Markdown.spec.ts similarity index 100% rename from app/components/chat/Markdown.spec.ts rename to app/chat/components/markdown/Markdown.spec.ts diff --git a/app/components/chat/Markdown.tsx b/app/chat/components/markdown/Markdown.tsx similarity index 96% rename from app/components/chat/Markdown.tsx rename to app/chat/components/markdown/Markdown.tsx index 3471c733..b036b8b9 100644 --- a/app/components/chat/Markdown.tsx +++ b/app/chat/components/markdown/Markdown.tsx @@ -1,14 +1,14 @@ import { memo, useMemo } from 'react'; import ReactMarkdown, { type Components } from 'react-markdown'; import type { BundledLanguage } from 'shiki'; -import { createScopedLogger } from '~/utils/logger'; -import { rehypePlugins, remarkPlugins, allowedHTMLElements } from '~/utils/markdown'; -import { Artifact, openArtifactInWorkbench } from './Artifact'; -import { CodeBlock } from './CodeBlock'; +import { createScopedLogger } from '~/shared/utils/logger'; +import { rehypePlugins, remarkPlugins, allowedHTMLElements } from '~/shared/utils/markdown'; +import { Artifact, openArtifactInWorkbench } from '~/chat/components/messages/Artifact'; +import { CodeBlock } from '~/chat/components/messages/CodeBlock'; import type { Message } from 'ai'; import styles from './Markdown.module.scss'; -import ThoughtBox from './ThoughtBox'; -import type { ProviderInfo } from '~/types/model'; +import ThoughtBox from '~/chat/components/ThoughtBox'; +import type { ProviderInfo } from '~/shared/types/model'; const logger = createScopedLogger('MarkdownComponent'); diff --git a/app/components/chat/Artifact.tsx b/app/chat/components/messages/Artifact.tsx similarity index 97% rename from app/components/chat/Artifact.tsx rename to app/chat/components/messages/Artifact.tsx index cef5a397..6b37c95b 100644 --- a/app/components/chat/Artifact.tsx +++ b/app/chat/components/messages/Artifact.tsx @@ -3,11 +3,11 @@ import { AnimatePresence, motion } from 'framer-motion'; import { computed } from 'nanostores'; import { memo, useEffect, useRef, useState } from 'react'; import { createHighlighter, type BundledLanguage, type BundledTheme, type HighlighterGeneric } from 'shiki'; -import type { ActionState } from '~/lib/runtime/action-runner'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { classNames } from '~/utils/classNames'; -import { cubicEasingFn } from '~/utils/easings'; -import { WORK_DIR } from '~/utils/constants'; +import type { ActionState } from '~/shared/lib/runtime/action-runner'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { classNames } from '~/shared/utils/classNames'; +import { cubicEasingFn } from '~/shared/utils/easings'; +import { WORK_DIR } from '~/shared/utils/constants'; const highlighterOptions = { langs: ['shell'], diff --git a/app/components/chat/AssistantMessage.tsx b/app/chat/components/messages/AssistantMessage.tsx similarity index 94% rename from app/components/chat/AssistantMessage.tsx rename to app/chat/components/messages/AssistantMessage.tsx index 022b4fbe..de46e9eb 100644 --- a/app/components/chat/AssistantMessage.tsx +++ b/app/chat/components/messages/AssistantMessage.tsx @@ -1,12 +1,12 @@ import { memo, Fragment } from 'react'; -import { Markdown } from './Markdown'; +import { Markdown } from '~/chat/components/markdown/Markdown'; import type { JSONValue } from 'ai'; -import Popover from '~/components/ui/Popover'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { WORK_DIR } from '~/utils/constants'; -import WithTooltip from '~/components/ui/Tooltip'; +import Popover from '~/shared/components/ui/Popover'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { WORK_DIR } from '~/shared/utils/constants'; +import WithTooltip from '~/shared/components/ui/Tooltip'; import type { Message } from 'ai'; -import type { ProviderInfo } from '~/types/model'; +import type { ProviderInfo } from '~/shared/types/model'; interface AssistantMessageProps { content: string; diff --git a/app/components/chat/CodeBlock.module.scss b/app/chat/components/messages/CodeBlock.module.scss similarity index 100% rename from app/components/chat/CodeBlock.module.scss rename to app/chat/components/messages/CodeBlock.module.scss diff --git a/app/components/chat/CodeBlock.tsx b/app/chat/components/messages/CodeBlock.tsx similarity index 95% rename from app/components/chat/CodeBlock.tsx rename to app/chat/components/messages/CodeBlock.tsx index e6b09f06..23324531 100644 --- a/app/components/chat/CodeBlock.tsx +++ b/app/chat/components/messages/CodeBlock.tsx @@ -1,7 +1,7 @@ import { memo, useEffect, useState } from 'react'; import { bundledLanguages, codeToHtml, isSpecialLang, type BundledLanguage, type SpecialLanguage } from 'shiki'; -import { classNames } from '~/utils/classNames'; -import { createScopedLogger } from '~/utils/logger'; +import { classNames } from '~/shared/utils/classNames'; +import { createScopedLogger } from '~/shared/utils/logger'; import styles from './CodeBlock.module.scss'; diff --git a/app/components/chat/UserMessage.tsx b/app/chat/components/messages/UserMessage.tsx similarity index 92% rename from app/components/chat/UserMessage.tsx rename to app/chat/components/messages/UserMessage.tsx index 56ee3fa7..c41ef1f7 100644 --- a/app/components/chat/UserMessage.tsx +++ b/app/chat/components/messages/UserMessage.tsx @@ -2,10 +2,10 @@ * @ts-nocheck * Preventing TS checks with files presented in the video for a better presentation. */ -import { MODEL_REGEX, PROVIDER_REGEX } from '~/utils/constants'; -import { Markdown } from './Markdown'; +import { MODEL_REGEX, PROVIDER_REGEX } from '~/shared/utils/constants'; +import { Markdown } from '~/chat/components/markdown/Markdown'; import { useStore } from '@nanostores/react'; -import { profileStore } from '~/lib/stores/profile'; +import { profileStore } from '~/shared/stores/profile'; interface UserMessageProps { content: string | Array<{ type: string; text?: string; image?: string }>; diff --git a/app/lib/hooks/StickToBottom.tsx b/app/chat/hooks/StickToBottom.tsx similarity index 100% rename from app/lib/hooks/StickToBottom.tsx rename to app/chat/hooks/StickToBottom.tsx diff --git a/app/lib/hooks/usePromptEnhancer.ts b/app/chat/hooks/usePromptEnhancer.ts similarity index 93% rename from app/lib/hooks/usePromptEnhancer.ts rename to app/chat/hooks/usePromptEnhancer.ts index 6275ef37..7dd09281 100644 --- a/app/lib/hooks/usePromptEnhancer.ts +++ b/app/chat/hooks/usePromptEnhancer.ts @@ -1,6 +1,6 @@ import { useState } from 'react'; -import type { ProviderInfo } from '~/types/model'; -import { createScopedLogger } from '~/utils/logger'; +import type { ProviderInfo } from '~/shared/types/model'; +import { createScopedLogger } from '~/shared/utils/logger'; const logger = createScopedLogger('usePromptEnhancement'); diff --git a/app/lib/hooks/useStickToBottom.tsx b/app/chat/hooks/useStickToBottom.tsx similarity index 100% rename from app/lib/hooks/useStickToBottom.tsx rename to app/chat/hooks/useStickToBottom.tsx diff --git a/app/lib/services/importExportService.ts b/app/chat/services/importExportService.ts similarity index 99% rename from app/lib/services/importExportService.ts rename to app/chat/services/importExportService.ts index cdebe4e7..09e09902 100644 --- a/app/lib/services/importExportService.ts +++ b/app/chat/services/importExportService.ts @@ -1,6 +1,6 @@ import Cookies from 'js-cookie'; import { type Message } from 'ai'; -import { getAllChats, deleteChat } from '~/lib/persistence/chats'; +import { getAllChats, deleteChat } from '~/shared/lib/persistence/chats'; interface ExtendedMessage extends Message { name?: string; diff --git a/app/lib/stores/chat.ts b/app/chat/stores/chat.ts similarity index 100% rename from app/lib/stores/chat.ts rename to app/chat/stores/chat.ts diff --git a/app/entry.server.tsx b/app/entry.server.tsx index af399c14..3e38fd9c 100644 --- a/app/entry.server.tsx +++ b/app/entry.server.tsx @@ -4,7 +4,7 @@ import { isbot } from 'isbot'; import { renderToReadableStream } from 'react-dom/server'; import { renderHeadToString } from 'remix-island'; import { Head } from './root'; -import { themeStore } from '~/lib/stores/theme'; +import { themeStore } from '~/shared/stores/theme'; export default async function handleRequest( request: Request, diff --git a/app/components/deploy/DeployButton.tsx b/app/layout/header/components/DeployButton.tsx similarity index 89% rename from app/components/deploy/DeployButton.tsx rename to app/layout/header/components/DeployButton.tsx index 50c06d37..544fc155 100644 --- a/app/components/deploy/DeployButton.tsx +++ b/app/layout/header/components/DeployButton.tsx @@ -1,15 +1,15 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; import { useStore } from '@nanostores/react'; -import { netlifyConnection } from '~/lib/stores/netlify'; -import { vercelConnection } from '~/lib/stores/vercel'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { streamingState } from '~/lib/stores/streaming'; -import { classNames } from '~/utils/classNames'; +import { netlifyConnection } from '~/shared/stores/netlify'; +import { vercelConnection } from '~/shared/stores/vercel'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { streamingState } from '~/shared/stores/streaming'; +import { classNames } from '~/shared/utils/classNames'; import { useState } from 'react'; -import { NetlifyDeploymentLink } from '~/components/chat/NetlifyDeploymentLink.client'; -import { VercelDeploymentLink } from '~/components/chat/VercelDeploymentLink.client'; -import { useVercelDeploy } from '~/components/deploy/VercelDeploy.client'; -import { useNetlifyDeploy } from '~/components/deploy/NetlifyDeploy.client'; +import { NetlifyDeploymentLink } from '~/layout/header/components/NetlifyDeploymentLink.client'; +import { VercelDeploymentLink } from '~/layout/header/components/VercelDeploymentLink.client'; +import { useVercelDeploy } from '~/layout/header/hooks/useVercelDeploy'; +import { useNetlifyDeploy } from '~/layout/header/hooks/useNetlifyDeploy'; interface DeployButtonProps { onVercelDeploy?: () => Promise; diff --git a/app/components/header/Header.tsx b/app/layout/header/components/Header.tsx similarity index 89% rename from app/components/header/Header.tsx rename to app/layout/header/components/Header.tsx index 1d509ce8..3608155c 100644 --- a/app/components/header/Header.tsx +++ b/app/layout/header/components/Header.tsx @@ -1,9 +1,9 @@ import { useStore } from '@nanostores/react'; import { ClientOnly } from 'remix-utils/client-only'; -import { chatStore } from '~/lib/stores/chat'; -import { classNames } from '~/utils/classNames'; +import { chatStore } from '~/chat/stores/chat'; +import { classNames } from '~/shared/utils/classNames'; import { HeaderActionButtons } from './HeaderActionButtons.client'; -import { ChatDescription } from '~/lib/persistence/ChatDescription.client'; +import { ChatDescription } from '~/shared/lib/persistence/ChatDescription.client'; export function Header() { const chat = useStore(chatStore); diff --git a/app/components/header/HeaderActionButtons.client.tsx b/app/layout/header/components/HeaderActionButtons.client.tsx similarity index 70% rename from app/components/header/HeaderActionButtons.client.tsx rename to app/layout/header/components/HeaderActionButtons.client.tsx index 5fe19a51..da4b328d 100644 --- a/app/components/header/HeaderActionButtons.client.tsx +++ b/app/layout/header/components/HeaderActionButtons.client.tsx @@ -1,10 +1,10 @@ import { useStore } from '@nanostores/react'; -import { workbenchStore } from '~/lib/stores/workbench'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; import { useState } from 'react'; -import { streamingState } from '~/lib/stores/streaming'; -import { ExportChatButton } from '~/components/chat/chatExportAndImport/ExportChatButton'; -import { useChatHistory } from '~/lib/persistence'; -import { DeployButton } from '~/components/deploy/DeployButton'; +import { streamingState } from '~/shared/stores/streaming'; +import { ExportChatButton } from '~/chat/components/chatExportAndImport/ExportChatButton'; +import { useChatHistory } from '~/shared/lib/persistence'; +import { DeployButton } from '~/layout/header/components/DeployButton'; interface HeaderActionButtonsProps { chatStarted: boolean; diff --git a/app/components/chat/NetlifyDeploymentLink.client.tsx b/app/layout/header/components/NetlifyDeploymentLink.client.tsx similarity index 91% rename from app/components/chat/NetlifyDeploymentLink.client.tsx rename to app/layout/header/components/NetlifyDeploymentLink.client.tsx index 4e60793f..aecbe472 100644 --- a/app/components/chat/NetlifyDeploymentLink.client.tsx +++ b/app/layout/header/components/NetlifyDeploymentLink.client.tsx @@ -1,6 +1,6 @@ import { useStore } from '@nanostores/react'; -import { netlifyConnection, fetchNetlifyStats } from '~/lib/stores/netlify'; -import { chatId } from '~/lib/persistence/useChatHistory'; +import { netlifyConnection, fetchNetlifyStats } from '~/shared/stores/netlify'; +import { chatId } from '~/shared/lib/persistence/useChatHistory'; import * as Tooltip from '@radix-ui/react-tooltip'; import { useEffect } from 'react'; diff --git a/app/components/chat/VercelDeploymentLink.client.tsx b/app/layout/header/components/VercelDeploymentLink.client.tsx similarity index 97% rename from app/components/chat/VercelDeploymentLink.client.tsx rename to app/layout/header/components/VercelDeploymentLink.client.tsx index ecb5a587..a0c63894 100644 --- a/app/components/chat/VercelDeploymentLink.client.tsx +++ b/app/layout/header/components/VercelDeploymentLink.client.tsx @@ -1,6 +1,6 @@ import { useStore } from '@nanostores/react'; -import { vercelConnection } from '~/lib/stores/vercel'; -import { chatId } from '~/lib/persistence/useChatHistory'; +import { vercelConnection } from '~/shared/stores/vercel'; +import { chatId } from '~/shared/lib/persistence/useChatHistory'; import * as Tooltip from '@radix-ui/react-tooltip'; import { useEffect, useState } from 'react'; diff --git a/app/lib/hooks/useEditChatDescription.ts b/app/layout/header/hooks/useEditChatDescription.ts similarity index 99% rename from app/lib/hooks/useEditChatDescription.ts rename to app/layout/header/hooks/useEditChatDescription.ts index bb1e8dcc..4e8f3708 100644 --- a/app/lib/hooks/useEditChatDescription.ts +++ b/app/layout/header/hooks/useEditChatDescription.ts @@ -7,7 +7,7 @@ import { description as descriptionStore, getMessages, updateChatDescription, -} from '~/lib/persistence'; +} from '~/shared/lib/persistence'; interface EditChatDescriptionOptions { initialDescription?: string; diff --git a/app/components/deploy/NetlifyDeploy.client.tsx b/app/layout/header/hooks/useNetlifyDeploy.tsx similarity index 95% rename from app/components/deploy/NetlifyDeploy.client.tsx rename to app/layout/header/hooks/useNetlifyDeploy.tsx index 62b95f44..4febb250 100644 --- a/app/components/deploy/NetlifyDeploy.client.tsx +++ b/app/layout/header/hooks/useNetlifyDeploy.tsx @@ -1,12 +1,12 @@ import { toast } from 'react-toastify'; import { useStore } from '@nanostores/react'; -import { netlifyConnection } from '~/lib/stores/netlify'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { webcontainer } from '~/lib/webcontainer'; -import { path } from '~/utils/path'; +import { netlifyConnection } from '~/shared/stores/netlify'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { webcontainer } from '~/shared/lib/webcontainer'; +import { path } from '~/shared/utils/path'; import { useState } from 'react'; -import type { ActionCallbackData } from '~/lib/runtime/message-parser'; -import { chatId } from '~/lib/persistence/useChatHistory'; +import type { ActionCallbackData } from '~/shared/lib/runtime/message-parser'; +import { chatId } from '~/shared/lib/persistence/useChatHistory'; export function useNetlifyDeploy() { const [isDeploying, setIsDeploying] = useState(false); diff --git a/app/components/deploy/VercelDeploy.client.tsx b/app/layout/header/hooks/useVercelDeploy.tsx similarity index 93% rename from app/components/deploy/VercelDeploy.client.tsx rename to app/layout/header/hooks/useVercelDeploy.tsx index 22ceb393..739002d1 100644 --- a/app/components/deploy/VercelDeploy.client.tsx +++ b/app/layout/header/hooks/useVercelDeploy.tsx @@ -1,12 +1,12 @@ import { toast } from 'react-toastify'; import { useStore } from '@nanostores/react'; -import { vercelConnection } from '~/lib/stores/vercel'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { webcontainer } from '~/lib/webcontainer'; -import { path } from '~/utils/path'; +import { vercelConnection } from '~/shared/stores/vercel'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { webcontainer } from '~/shared/lib/webcontainer'; +import { path } from '~/shared/utils/path'; import { useState } from 'react'; -import type { ActionCallbackData } from '~/lib/runtime/message-parser'; -import { chatId } from '~/lib/persistence/useChatHistory'; +import type { ActionCallbackData } from '~/shared/lib/runtime/message-parser'; +import { chatId } from '~/shared/lib/persistence/useChatHistory'; export function useVercelDeploy() { const [isDeploying, setIsDeploying] = useState(false); diff --git a/app/components/sidebar/HistoryItem.tsx b/app/layout/sidebar/HistoryItem.tsx similarity index 95% rename from app/components/sidebar/HistoryItem.tsx rename to app/layout/sidebar/HistoryItem.tsx index 422faaa7..b1b307a7 100644 --- a/app/components/sidebar/HistoryItem.tsx +++ b/app/layout/sidebar/HistoryItem.tsx @@ -1,10 +1,10 @@ import { useParams } from '@remix-run/react'; -import { classNames } from '~/utils/classNames'; -import { type ChatHistoryItem } from '~/lib/persistence'; -import WithTooltip from '~/components/ui/Tooltip'; -import { useEditChatDescription } from '~/lib/hooks'; +import { classNames } from '~/shared/utils/classNames'; +import { type ChatHistoryItem } from '~/shared/lib/persistence'; +import WithTooltip from '~/shared/components/ui/Tooltip'; +import { useEditChatDescription } from '~/shared/hooks'; import { forwardRef, type ForwardedRef, useCallback } from 'react'; -import { Checkbox } from '~/components/ui/Checkbox'; +import { Checkbox } from '~/shared/components/ui/Checkbox'; interface HistoryItemProps { item: ChatHistoryItem; diff --git a/app/components/sidebar/Menu.client.tsx b/app/layout/sidebar/Menu.client.tsx similarity index 97% rename from app/components/sidebar/Menu.client.tsx rename to app/layout/sidebar/Menu.client.tsx index f0e975eb..c3b7b391 100644 --- a/app/components/sidebar/Menu.client.tsx +++ b/app/layout/sidebar/Menu.client.tsx @@ -1,19 +1,19 @@ import { motion, type Variants } from 'framer-motion'; import { useCallback, useEffect, useRef, useState } from 'react'; import { toast } from 'react-toastify'; -import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/components/ui/Dialog'; -import { ThemeSwitch } from '~/components/ui/ThemeSwitch'; -import { ControlPanel } from '~/components/@settings/core/ControlPanel'; -import { SettingsButton } from '~/components/ui/SettingsButton'; -import { Button } from '~/components/ui/Button'; -import { db, deleteById, getAll, chatId, type ChatHistoryItem, useChatHistory } from '~/lib/persistence'; -import { cubicEasingFn } from '~/utils/easings'; +import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/shared/components/ui/Dialog'; +import { ThemeSwitch } from '~/shared/components/ui/ThemeSwitch'; +import { ControlPanel } from '~/settings/core/ControlPanel'; +import { SettingsButton } from '~/shared/components/ui/SettingsButton'; +import { Button } from '~/shared/components/ui/Button'; +import { db, deleteById, getAll, chatId, type ChatHistoryItem, useChatHistory } from '~/shared/lib/persistence'; +import { cubicEasingFn } from '~/shared/utils/easings'; import { HistoryItem } from './HistoryItem'; import { binDates } from './date-binning'; -import { useSearchFilter } from '~/lib/hooks/useSearchFilter'; -import { classNames } from '~/utils/classNames'; +import { useSearchFilter } from '~/shared/hooks/useSearchFilter'; +import { classNames } from '~/shared/utils/classNames'; import { useStore } from '@nanostores/react'; -import { profileStore } from '~/lib/stores/profile'; +import { profileStore } from '~/shared/stores/profile'; const menuVariants = { closed: { diff --git a/app/components/sidebar/date-binning.ts b/app/layout/sidebar/date-binning.ts similarity index 95% rename from app/components/sidebar/date-binning.ts rename to app/layout/sidebar/date-binning.ts index 693f1a36..5a21423e 100644 --- a/app/components/sidebar/date-binning.ts +++ b/app/layout/sidebar/date-binning.ts @@ -1,5 +1,5 @@ import { format, isAfter, isThisWeek, isThisYear, isToday, isYesterday, subDays } from 'date-fns'; -import type { ChatHistoryItem } from '~/lib/persistence'; +import type { ChatHistoryItem } from '~/shared/lib/persistence'; type Bin = { category: string; items: ChatHistoryItem[] }; diff --git a/app/lib/.server/llm/stream-text.ts b/app/lib/.server/llm/stream-text.ts deleted file mode 100644 index a2c44b11..00000000 --- a/app/lib/.server/llm/stream-text.ts +++ /dev/null @@ -1,207 +0,0 @@ -import { convertToCoreMessages, streamText as _streamText, type Message } from 'ai'; -import { MAX_TOKENS, type FileMap } from './constants'; -import { getSystemPrompt } from '~/lib/common/prompts/prompts'; -import { DEFAULT_MODEL, DEFAULT_PROVIDER, MODIFICATIONS_TAG_NAME, PROVIDER_LIST, WORK_DIR } from '~/utils/constants'; -import type { IProviderSetting } from '~/types/model'; -import { PromptLibrary } from '~/lib/common/prompt-library'; -import { allowedHTMLElements } from '~/utils/markdown'; -import { LLMManager } from '~/lib/modules/llm/manager'; -import { createScopedLogger } from '~/utils/logger'; -import { createFilesContext, extractPropertiesFromMessage } from './utils'; -import { discussPrompt } from '~/lib/common/prompts/discuss-prompt'; -import type { DesignScheme } from '~/types/design-scheme'; - -export type Messages = Message[]; - -export interface StreamingOptions extends Omit[0], 'model'> { - supabaseConnection?: { - isConnected: boolean; - hasSelectedProject: boolean; - credentials?: { - anonKey?: string; - supabaseUrl?: string; - }; - }; -} - -const logger = createScopedLogger('stream-text'); - -export async function streamText(props: { - messages: Omit[]; - env?: Env; - options?: StreamingOptions; - apiKeys?: Record; - files?: FileMap; - providerSettings?: Record; - promptId?: string; - contextOptimization?: boolean; - contextFiles?: FileMap; - summary?: string; - messageSliceId?: number; - chatMode?: 'discuss' | 'build'; - designScheme?: DesignScheme; -}) { - const { - messages, - env: serverEnv, - options, - apiKeys, - files, - providerSettings, - promptId, - contextOptimization, - contextFiles, - summary, - chatMode, - designScheme, - } = props; - let currentModel = DEFAULT_MODEL; - let currentProvider = DEFAULT_PROVIDER.name; - let processedMessages = messages.map((message) => { - if (message.role === 'user') { - const { model, provider, content } = extractPropertiesFromMessage(message); - currentModel = model; - currentProvider = provider; - - return { ...message, content }; - } else if (message.role == 'assistant') { - let content = message.content; - content = content.replace(/
.*?<\/div>/s, ''); - content = content.replace(/.*?<\/think>/s, ''); - - // Remove package-lock.json content specifically keeping token usage MUCH lower - content = content.replace( - /[\s\S]*?<\/boltAction>/g, - '[package-lock.json content removed]', - ); - - // Trim whitespace potentially left after removals - content = content.trim(); - - return { ...message, content }; - } - - return message; - }); - - const provider = PROVIDER_LIST.find((p) => p.name === currentProvider) || DEFAULT_PROVIDER; - const staticModels = LLMManager.getInstance().getStaticModelListFromProvider(provider); - let modelDetails = staticModels.find((m) => m.name === currentModel); - - if (!modelDetails) { - const modelsList = [ - ...(provider.staticModels || []), - ...(await LLMManager.getInstance().getModelListFromProvider(provider, { - apiKeys, - providerSettings, - serverEnv: serverEnv as any, - })), - ]; - - if (!modelsList.length) { - throw new Error(`No models found for provider ${provider.name}`); - } - - modelDetails = modelsList.find((m) => m.name === currentModel); - - if (!modelDetails) { - // Fallback to first model - logger.warn( - `MODEL [${currentModel}] not found in provider [${provider.name}]. Falling back to first model. ${modelsList[0].name}`, - ); - modelDetails = modelsList[0]; - } - } - - const dynamicMaxTokens = modelDetails && modelDetails.maxTokenAllowed ? modelDetails.maxTokenAllowed : MAX_TOKENS; - logger.info( - `Max tokens for model ${modelDetails.name} is ${dynamicMaxTokens} based on ${modelDetails.maxTokenAllowed} or ${MAX_TOKENS}`, - ); - - let systemPrompt = - PromptLibrary.getPropmtFromLibrary(promptId || 'default', { - cwd: WORK_DIR, - allowedHtmlElements: allowedHTMLElements, - modificationTagName: MODIFICATIONS_TAG_NAME, - designScheme, - supabase: { - isConnected: options?.supabaseConnection?.isConnected || false, - hasSelectedProject: options?.supabaseConnection?.hasSelectedProject || false, - credentials: options?.supabaseConnection?.credentials || undefined, - }, - }) ?? getSystemPrompt(); - - if (chatMode === 'build' && contextFiles && contextOptimization) { - const codeContext = createFilesContext(contextFiles, true); - - systemPrompt = `${systemPrompt} - - Below is the artifact containing the context loaded into context buffer for you to have knowledge of and might need changes to fullfill current user request. - CONTEXT BUFFER: - --- - ${codeContext} - --- - `; - - if (summary) { - systemPrompt = `${systemPrompt} - below is the chat history till now - CHAT SUMMARY: - --- - ${props.summary} - --- - `; - - if (props.messageSliceId) { - processedMessages = processedMessages.slice(props.messageSliceId); - } else { - const lastMessage = processedMessages.pop(); - - if (lastMessage) { - processedMessages = [lastMessage]; - } - } - } - } - - const effectiveLockedFilePaths = new Set(); - - if (files) { - for (const [filePath, fileDetails] of Object.entries(files)) { - if (fileDetails?.isLocked) { - effectiveLockedFilePaths.add(filePath); - } - } - } - - if (effectiveLockedFilePaths.size > 0) { - const lockedFilesListString = Array.from(effectiveLockedFilePaths) - .map((filePath) => `- ${filePath}`) - .join('\n'); - systemPrompt = `${systemPrompt} - - IMPORTANT: The following files are locked and MUST NOT be modified in any way. Do not suggest or make any changes to these files. You can proceed with the request but DO NOT make any changes to these files specifically: - ${lockedFilesListString} - --- - `; - } else { - console.log('No locked files found from any source for prompt.'); - } - - logger.info(`Sending llm call to ${provider.name} with model ${modelDetails.name}`); - - // console.log(systemPrompt, processedMessages); - - return await _streamText({ - model: provider.getModelInstance({ - model: modelDetails.name, - serverEnv, - apiKeys, - providerSettings, - }), - system: chatMode === 'build' ? systemPrompt : discussPrompt(), - maxTokens: dynamicMaxTokens, - messages: convertToCoreMessages(processedMessages as any), - ...options, - }); -} diff --git a/app/lib/modules/llm/registry.ts b/app/lib/modules/llm/registry.ts deleted file mode 100644 index 6edba6d8..00000000 --- a/app/lib/modules/llm/registry.ts +++ /dev/null @@ -1,39 +0,0 @@ -import AnthropicProvider from './providers/anthropic'; -import CohereProvider from './providers/cohere'; -import DeepseekProvider from './providers/deepseek'; -import GoogleProvider from './providers/google'; -import GroqProvider from './providers/groq'; -import HuggingFaceProvider from './providers/huggingface'; -import LMStudioProvider from './providers/lmstudio'; -import MistralProvider from './providers/mistral'; -import OllamaProvider from './providers/ollama'; -import OpenRouterProvider from './providers/open-router'; -import OpenAILikeProvider from './providers/openai-like'; -import OpenAIProvider from './providers/openai'; -import PerplexityProvider from './providers/perplexity'; -import TogetherProvider from './providers/together'; -import XAIProvider from './providers/xai'; -import HyperbolicProvider from './providers/hyperbolic'; -import AmazonBedrockProvider from './providers/amazon-bedrock'; -import GithubProvider from './providers/github'; - -export { - AnthropicProvider, - CohereProvider, - DeepseekProvider, - GoogleProvider, - GroqProvider, - HuggingFaceProvider, - HyperbolicProvider, - MistralProvider, - OllamaProvider, - OpenAIProvider, - OpenRouterProvider, - OpenAILikeProvider, - PerplexityProvider, - XAIProvider, - TogetherProvider, - LMStudioProvider, - AmazonBedrockProvider, - GithubProvider, -}; diff --git a/app/root.tsx b/app/root.tsx index a7ccb285..f5f6b4ed 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -2,8 +2,8 @@ import { useStore } from '@nanostores/react'; import type { LinksFunction } from '@remix-run/cloudflare'; import { Links, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react'; import tailwindReset from '@unocss/reset/tailwind-compat.css?url'; -import { themeStore } from './lib/stores/theme'; -import { stripIndents } from './utils/stripIndent'; +import { themeStore } from './shared/stores/theme'; +import { stripIndents } from './shared/utils/stripIndent'; import { createHead } from 'remix-island'; import { useEffect } from 'react'; import { DndProvider } from 'react-dnd'; @@ -81,7 +81,7 @@ export function Layout({ children }: { children: React.ReactNode }) { ); } -import { logStore } from './lib/stores/logs'; +import { logStore } from './shared/stores/logs'; export default function App() { const theme = useStore(themeStore); diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 65df404a..7be6e259 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -1,9 +1,9 @@ import { json, type MetaFunction } from '@remix-run/cloudflare'; import { ClientOnly } from 'remix-utils/client-only'; -import { BaseChat } from '~/components/chat/BaseChat'; -import { Chat } from '~/components/chat/Chat.client'; -import { Header } from '~/components/header/Header'; -import BackgroundRays from '~/components/ui/BackgroundRays'; +import { BaseChat } from '~/chat/components/BaseChat'; +import { Chat } from '~/chat/components/Chat.client'; +import { Header } from '~/layout/header/components/Header'; +import BackgroundRays from '~/shared/components/ui/BackgroundRays'; export const meta: MetaFunction = () => { return [{ title: 'Bolt' }, { name: 'description', content: 'Talk with Bolt, an AI assistant from StackBlitz' }]; diff --git a/app/routes/api.chat.ts b/app/routes/api.chat.ts index d375a1ad..ce4d184d 100644 --- a/app/routes/api.chat.ts +++ b/app/routes/api.chat.ts @@ -1,17 +1,17 @@ import { type ActionFunctionArgs } from '@remix-run/cloudflare'; import { createDataStream, generateId } from 'ai'; -import { MAX_RESPONSE_SEGMENTS, MAX_TOKENS, type FileMap } from '~/lib/.server/llm/constants'; -import { CONTINUE_PROMPT } from '~/lib/common/prompts/prompts'; -import { streamText, type Messages, type StreamingOptions } from '~/lib/.server/llm/stream-text'; -import SwitchableStream from '~/lib/.server/llm/switchable-stream'; -import type { IProviderSetting } from '~/types/model'; -import { createScopedLogger } from '~/utils/logger'; -import { getFilePaths, selectContext } from '~/lib/.server/llm/select-context'; -import type { ContextAnnotation, ProgressAnnotation } from '~/types/context'; -import { WORK_DIR } from '~/utils/constants'; -import { createSummary } from '~/lib/.server/llm/create-summary'; -import { extractPropertiesFromMessage } from '~/lib/.server/llm/utils'; -import type { DesignScheme } from '~/types/design-scheme'; +import { MAX_RESPONSE_SEGMENTS, MAX_TOKENS, type FileMap } from '~/shared/lib/.server/llm/constants'; +import { CONTINUE_PROMPT } from '~/shared/lib/prompts/prompt-variants/prompts'; +import { streamText, type Messages, type StreamingOptions } from '~/shared/lib/.server/llm/stream-text'; +import SwitchableStream from '~/shared/lib/.server/llm/switchable-stream'; +import type { IProviderSetting } from '~/shared/types/model'; +import { createScopedLogger } from '~/shared/utils/logger'; +import { getFilePaths, selectContext } from '~/shared/lib/.server/llm/select-context'; +import type { ContextAnnotation, ProgressAnnotation } from '~/shared/types/context'; +import { WORK_DIR } from '~/shared/utils/constants'; +import { createSummary } from '~/shared/lib/.server/llm/create-summary'; +import { extractPropertiesFromMessage } from '~/shared/lib/.server/llm/utils'; +import type { DesignScheme } from '~/shared/types/design-scheme'; export async function action(args: ActionFunctionArgs) { return chatAction(args); diff --git a/app/routes/api.check-env-key.ts b/app/routes/api.check-env-key.ts index 70f65bf0..b9f94452 100644 --- a/app/routes/api.check-env-key.ts +++ b/app/routes/api.check-env-key.ts @@ -1,6 +1,6 @@ import type { LoaderFunction } from '@remix-run/cloudflare'; -import { LLMManager } from '~/lib/modules/llm/manager'; -import { getApiKeysFromCookie } from '~/lib/api/cookies'; +import { LLMManager } from '~/shared/lib/providers/manager'; +import { getApiKeysFromCookie } from '~/shared/lib/api/cookies'; export const loader: LoaderFunction = async ({ context, request }) => { const url = new URL(request.url); diff --git a/app/routes/api.enhancer.ts b/app/routes/api.enhancer.ts index 1e7bad5f..41c1d488 100644 --- a/app/routes/api.enhancer.ts +++ b/app/routes/api.enhancer.ts @@ -1,9 +1,9 @@ import { type ActionFunctionArgs } from '@remix-run/cloudflare'; -import { streamText } from '~/lib/.server/llm/stream-text'; -import { stripIndents } from '~/utils/stripIndent'; -import type { ProviderInfo } from '~/types/model'; -import { getApiKeysFromCookie, getProviderSettingsFromCookie } from '~/lib/api/cookies'; -import { createScopedLogger } from '~/utils/logger'; +import { streamText } from '~/shared/lib/.server/llm/stream-text'; +import { stripIndents } from '~/shared/utils/stripIndent'; +import type { ProviderInfo } from '~/shared/types/model'; +import { getApiKeysFromCookie, getProviderSettingsFromCookie } from '~/shared/lib/api/cookies'; +import { createScopedLogger } from '~/shared/utils/logger'; export async function action(args: ActionFunctionArgs) { return enhancerAction(args); diff --git a/app/routes/api.export-api-keys.ts b/app/routes/api.export-api-keys.ts index aa8ee1f7..32c05acd 100644 --- a/app/routes/api.export-api-keys.ts +++ b/app/routes/api.export-api-keys.ts @@ -1,6 +1,6 @@ import type { LoaderFunction } from '@remix-run/cloudflare'; -import { LLMManager } from '~/lib/modules/llm/manager'; -import { getApiKeysFromCookie } from '~/lib/api/cookies'; +import { LLMManager } from '~/shared/lib/providers/manager'; +import { getApiKeysFromCookie } from '~/shared/lib/api/cookies'; export const loader: LoaderFunction = async ({ context, request }) => { // Get API keys from cookie diff --git a/app/routes/api.llmcall.ts b/app/routes/api.llmcall.ts index cf75e499..b9386317 100644 --- a/app/routes/api.llmcall.ts +++ b/app/routes/api.llmcall.ts @@ -1,13 +1,13 @@ import { type ActionFunctionArgs } from '@remix-run/cloudflare'; -import { streamText } from '~/lib/.server/llm/stream-text'; -import type { IProviderSetting, ProviderInfo } from '~/types/model'; +import { streamText } from '~/shared/lib/.server/llm/stream-text'; +import type { IProviderSetting, ProviderInfo } from '~/shared/types/model'; import { generateText } from 'ai'; -import { PROVIDER_LIST } from '~/utils/constants'; -import { MAX_TOKENS } from '~/lib/.server/llm/constants'; -import { LLMManager } from '~/lib/modules/llm/manager'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import { getApiKeysFromCookie, getProviderSettingsFromCookie } from '~/lib/api/cookies'; -import { createScopedLogger } from '~/utils/logger'; +import { PROVIDER_LIST } from '~/shared/utils/constants'; +import { MAX_TOKENS } from '~/shared/lib/.server/llm/constants'; +import { LLMManager } from '~/shared/lib/providers/manager'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import { getApiKeysFromCookie, getProviderSettingsFromCookie } from '~/shared/lib/api/cookies'; +import { createScopedLogger } from '~/shared/utils/logger'; export async function action(args: ActionFunctionArgs) { return llmCallAction(args); diff --git a/app/routes/api.models.ts b/app/routes/api.models.ts index 5fad834d..dd9d6726 100644 --- a/app/routes/api.models.ts +++ b/app/routes/api.models.ts @@ -1,8 +1,8 @@ import { json } from '@remix-run/cloudflare'; -import { LLMManager } from '~/lib/modules/llm/manager'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { ProviderInfo } from '~/types/model'; -import { getApiKeysFromCookie, getProviderSettingsFromCookie } from '~/lib/api/cookies'; +import { LLMManager } from '~/shared/lib/providers/manager'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { ProviderInfo } from '~/shared/types/model'; +import { getApiKeysFromCookie, getProviderSettingsFromCookie } from '~/shared/lib/api/cookies'; interface ModelsResponse { modelList: ModelInfo[]; diff --git a/app/routes/api.netlify-deploy.ts b/app/routes/api.netlify-deploy.ts index 48543e97..7008b037 100644 --- a/app/routes/api.netlify-deploy.ts +++ b/app/routes/api.netlify-deploy.ts @@ -1,6 +1,6 @@ import { type ActionFunctionArgs, json } from '@remix-run/cloudflare'; import crypto from 'crypto'; -import type { NetlifySiteInfo } from '~/types/netlify'; +import type { NetlifySiteInfo } from '~/shared/types/netlify'; interface DeployRequestBody { siteId?: string; diff --git a/app/routes/api.supabase.query.ts b/app/routes/api.supabase.query.ts index 0b810754..c171c5e5 100644 --- a/app/routes/api.supabase.query.ts +++ b/app/routes/api.supabase.query.ts @@ -1,5 +1,5 @@ import { type ActionFunctionArgs } from '@remix-run/cloudflare'; -import { createScopedLogger } from '~/utils/logger'; +import { createScopedLogger } from '~/shared/utils/logger'; const logger = createScopedLogger('api.supabase.query'); diff --git a/app/routes/api.supabase.ts b/app/routes/api.supabase.ts index 804d3b7a..2a1f2954 100644 --- a/app/routes/api.supabase.ts +++ b/app/routes/api.supabase.ts @@ -1,5 +1,5 @@ import { json, type ActionFunction } from '@remix-run/cloudflare'; -import type { SupabaseProject } from '~/types/supabase'; +import type { SupabaseProject } from '~/shared/types/supabase'; export const action: ActionFunction = async ({ request }) => { if (request.method !== 'POST') { diff --git a/app/routes/api.vercel-deploy.ts b/app/routes/api.vercel-deploy.ts index 7d45b241..df60111b 100644 --- a/app/routes/api.vercel-deploy.ts +++ b/app/routes/api.vercel-deploy.ts @@ -1,5 +1,5 @@ import { type ActionFunctionArgs, type LoaderFunctionArgs, json } from '@remix-run/cloudflare'; -import type { VercelProjectInfo } from '~/types/vercel'; +import type { VercelProjectInfo } from '~/shared/types/vercel'; // Add loader function to handle GET requests export async function loader({ request }: LoaderFunctionArgs) { diff --git a/app/routes/git.tsx b/app/routes/git.tsx index 5793e221..8828ffed 100644 --- a/app/routes/git.tsx +++ b/app/routes/git.tsx @@ -1,10 +1,10 @@ import type { LoaderFunctionArgs } from '@remix-run/cloudflare'; import { json, type MetaFunction } from '@remix-run/cloudflare'; import { ClientOnly } from 'remix-utils/client-only'; -import { BaseChat } from '~/components/chat/BaseChat'; -import { GitUrlImport } from '~/components/git/GitUrlImport.client'; -import { Header } from '~/components/header/Header'; -import BackgroundRays from '~/components/ui/BackgroundRays'; +import { BaseChat } from '~/chat/components/BaseChat'; +import { GitUrlImport } from '~/shared/components/github/components/GitUrlImport.client'; +import { Header } from '~/layout/header/components/Header'; +import BackgroundRays from '~/shared/components/ui/BackgroundRays'; export const meta: MetaFunction = () => { return [{ title: 'Bolt' }, { name: 'description', content: 'Talk with Bolt, an AI assistant from StackBlitz' }]; diff --git a/app/components/@settings/core/AvatarDropdown.tsx b/app/settings/core/AvatarDropdown.tsx similarity index 98% rename from app/components/@settings/core/AvatarDropdown.tsx rename to app/settings/core/AvatarDropdown.tsx index 6adfd31d..3376ccb0 100644 --- a/app/components/@settings/core/AvatarDropdown.tsx +++ b/app/settings/core/AvatarDropdown.tsx @@ -1,8 +1,8 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; import { motion } from 'framer-motion'; import { useStore } from '@nanostores/react'; -import { classNames } from '~/utils/classNames'; -import { profileStore } from '~/lib/stores/profile'; +import { classNames } from '~/shared/utils/classNames'; +import { profileStore } from '~/shared/stores/profile'; import type { TabType, Profile } from './types'; const BetaLabel = () => ( diff --git a/app/components/@settings/core/ControlPanel.tsx b/app/settings/core/ControlPanel.tsx similarity index 91% rename from app/components/@settings/core/ControlPanel.tsx rename to app/settings/core/ControlPanel.tsx index df327551..26164463 100644 --- a/app/components/@settings/core/ControlPanel.tsx +++ b/app/settings/core/ControlPanel.tsx @@ -3,41 +3,41 @@ import { motion, AnimatePresence } from 'framer-motion'; import { useStore } from '@nanostores/react'; import { Switch } from '@radix-ui/react-switch'; import * as RadixDialog from '@radix-ui/react-dialog'; -import { classNames } from '~/utils/classNames'; -import { TabManagement } from '~/components/@settings/shared/components/TabManagement'; -import { TabTile } from '~/components/@settings/shared/components/TabTile'; -import { useUpdateCheck } from '~/lib/hooks/useUpdateCheck'; -import { useFeatures } from '~/lib/hooks/useFeatures'; -import { useNotifications } from '~/lib/hooks/useNotifications'; -import { useConnectionStatus } from '~/lib/hooks/useConnectionStatus'; -import { useDebugStatus } from '~/lib/hooks/useDebugStatus'; +import { classNames } from '~/shared/utils/classNames'; +import { TabManagement } from '~/settings/shared/components/TabManagement'; +import { TabTile } from '~/settings/shared/components/TabTile'; +import { useUpdateCheck } from '~/shared/hooks/useUpdateCheck'; +import { useFeatures } from '~/shared/hooks/useFeatures'; +import { useNotifications } from '~/shared/hooks/useNotifications'; +import { useConnectionStatus } from '~/shared/hooks/useConnectionStatus'; +import { useDebugStatus } from '~/shared/hooks/useDebugStatus'; import { tabConfigurationStore, developerModeStore, setDeveloperMode, resetTabConfiguration, -} from '~/lib/stores/settings'; -import { profileStore } from '~/lib/stores/profile'; +} from '~/settings/stores/settings'; +import { profileStore } from '~/shared/stores/profile'; import type { TabType, TabVisibilityConfig, Profile } from './types'; import { TAB_LABELS, DEFAULT_TAB_CONFIG } from './constants'; -import { DialogTitle } from '~/components/ui/Dialog'; +import { DialogTitle } from '~/shared/components/ui/Dialog'; import { AvatarDropdown } from './AvatarDropdown'; -import BackgroundRays from '~/components/ui/BackgroundRays'; +import BackgroundRays from '~/shared/components/ui/BackgroundRays'; // Import all tab components -import ProfileTab from '~/components/@settings/tabs/profile/ProfileTab'; -import SettingsTab from '~/components/@settings/tabs/settings/SettingsTab'; -import NotificationsTab from '~/components/@settings/tabs/notifications/NotificationsTab'; -import FeaturesTab from '~/components/@settings/tabs/features/FeaturesTab'; -import { DataTab } from '~/components/@settings/tabs/data/DataTab'; -import DebugTab from '~/components/@settings/tabs/debug/DebugTab'; -import { EventLogsTab } from '~/components/@settings/tabs/event-logs/EventLogsTab'; -import UpdateTab from '~/components/@settings/tabs/update/UpdateTab'; -import ConnectionsTab from '~/components/@settings/tabs/connections/ConnectionsTab'; -import CloudProvidersTab from '~/components/@settings/tabs/providers/cloud/CloudProvidersTab'; -import ServiceStatusTab from '~/components/@settings/tabs/providers/status/ServiceStatusTab'; -import LocalProvidersTab from '~/components/@settings/tabs/providers/local/LocalProvidersTab'; -import TaskManagerTab from '~/components/@settings/tabs/task-manager/TaskManagerTab'; +import ProfileTab from '~/settings/tabs/profile/ProfileTab'; +import SettingsTab from '~/settings/tabs/settings/SettingsTab'; +import NotificationsTab from '~/settings/tabs/notifications/NotificationsTab'; +import FeaturesTab from '~/settings/tabs/features/FeaturesTab'; +import { DataTab } from '~/settings/tabs/data/DataTab'; +import DebugTab from '~/settings/tabs/debug/DebugTab'; +import { EventLogsTab } from '~/settings/tabs/event-logs/EventLogsTab'; +import UpdateTab from '~/settings/tabs/update/UpdateTab'; +import ConnectionsTab from '~/settings/tabs/connections/ConnectionsTab'; +import CloudProvidersTab from '~/settings/tabs/providers/cloud/CloudProvidersTab'; +import ServiceStatusTab from '~/settings/tabs/providers/status/ServiceStatusTab'; +import LocalProvidersTab from '~/settings/tabs/providers/local/LocalProvidersTab'; +import TaskManagerTab from '~/settings/tabs/task-manager/TaskManagerTab'; interface ControlPanelProps { open: boolean; diff --git a/app/components/@settings/core/constants.ts b/app/settings/core/constants.ts similarity index 100% rename from app/components/@settings/core/constants.ts rename to app/settings/core/constants.ts diff --git a/app/components/@settings/core/types.ts b/app/settings/core/types.ts similarity index 100% rename from app/components/@settings/core/types.ts rename to app/settings/core/types.ts diff --git a/app/components/@settings/index.ts b/app/settings/index.ts similarity index 100% rename from app/components/@settings/index.ts rename to app/settings/index.ts diff --git a/app/components/@settings/shared/components/DraggableTabList.tsx b/app/settings/shared/components/DraggableTabList.tsx similarity index 95% rename from app/components/@settings/shared/components/DraggableTabList.tsx rename to app/settings/shared/components/DraggableTabList.tsx index a8681835..ae7bbbba 100644 --- a/app/components/@settings/shared/components/DraggableTabList.tsx +++ b/app/settings/shared/components/DraggableTabList.tsx @@ -1,9 +1,9 @@ import { useDrag, useDrop } from 'react-dnd'; import { motion } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; -import type { TabVisibilityConfig } from '~/components/@settings/core/types'; -import { TAB_LABELS } from '~/components/@settings/core/types'; -import { Switch } from '~/components/ui/Switch'; +import { classNames } from '~/shared/utils/classNames'; +import type { TabVisibilityConfig } from '~/settings/core/types'; +import { TAB_LABELS } from '~/settings/core/types'; +import { Switch } from '~/shared/components/ui/Switch'; interface DraggableTabListProps { tabs: TabVisibilityConfig[]; diff --git a/app/components/@settings/shared/components/TabManagement.tsx b/app/settings/shared/components/TabManagement.tsx similarity index 97% rename from app/components/@settings/shared/components/TabManagement.tsx rename to app/settings/shared/components/TabManagement.tsx index 9ae16017..5ca5eb0e 100644 --- a/app/components/@settings/shared/components/TabManagement.tsx +++ b/app/settings/shared/components/TabManagement.tsx @@ -1,14 +1,14 @@ import { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; import { useStore } from '@nanostores/react'; -import { Switch } from '~/components/ui/Switch'; -import { classNames } from '~/utils/classNames'; -import { tabConfigurationStore } from '~/lib/stores/settings'; -import { TAB_LABELS } from '~/components/@settings/core/constants'; -import type { TabType } from '~/components/@settings/core/types'; +import { Switch } from '~/shared/components/ui/Switch'; +import { classNames } from '~/shared/utils/classNames'; +import { tabConfigurationStore } from '~/settings/stores/settings'; +import { TAB_LABELS } from '~/settings/core/constants'; +import type { TabType } from '~/settings/core/types'; import { toast } from 'react-toastify'; import { TbLayoutGrid } from 'react-icons/tb'; -import { useSettingsStore } from '~/lib/stores/settings'; +import { useSettingsStore } from '~/settings/stores/settings'; // Define tab icons mapping const TAB_ICONS: Record = { diff --git a/app/components/@settings/shared/components/TabTile.tsx b/app/settings/shared/components/TabTile.tsx similarity index 95% rename from app/components/@settings/shared/components/TabTile.tsx rename to app/settings/shared/components/TabTile.tsx index ea409d69..618fa5dd 100644 --- a/app/components/@settings/shared/components/TabTile.tsx +++ b/app/settings/shared/components/TabTile.tsx @@ -1,8 +1,8 @@ import { motion } from 'framer-motion'; import * as Tooltip from '@radix-ui/react-tooltip'; -import { classNames } from '~/utils/classNames'; -import type { TabVisibilityConfig } from '~/components/@settings/core/types'; -import { TAB_LABELS, TAB_ICONS } from '~/components/@settings/core/constants'; +import { classNames } from '~/shared/utils/classNames'; +import type { TabVisibilityConfig } from '~/settings/core/types'; +import { TAB_LABELS, TAB_ICONS } from '~/settings/core/constants'; interface TabTileProps { tab: TabVisibilityConfig; diff --git a/app/lib/stores/settings.ts b/app/settings/stores/settings.ts similarity index 96% rename from app/lib/stores/settings.ts rename to app/settings/stores/settings.ts index 917f6e0a..830fd272 100644 --- a/app/lib/stores/settings.ts +++ b/app/settings/stores/settings.ts @@ -1,15 +1,10 @@ import { atom, map } from 'nanostores'; -import { PROVIDER_LIST } from '~/utils/constants'; -import type { IProviderConfig } from '~/types/model'; -import type { - TabVisibilityConfig, - TabWindowConfig, - UserTabConfig, - DevTabConfig, -} from '~/components/@settings/core/types'; -import { DEFAULT_TAB_CONFIG } from '~/components/@settings/core/constants'; +import { PROVIDER_LIST } from '~/shared/utils/constants'; +import type { IProviderConfig } from '~/shared/types/model'; +import type { TabVisibilityConfig, TabWindowConfig, UserTabConfig, DevTabConfig } from '~/settings/core/types'; +import { DEFAULT_TAB_CONFIG } from '~/settings/core/constants'; import Cookies from 'js-cookie'; -import { toggleTheme } from './theme'; +import { toggleTheme } from '~/shared/stores/theme'; import { create } from 'zustand'; export interface Shortcut { diff --git a/app/lib/stores/tabConfigurationStore.ts b/app/settings/stores/tabConfigurationStore.ts similarity index 100% rename from app/lib/stores/tabConfigurationStore.ts rename to app/settings/stores/tabConfigurationStore.ts diff --git a/app/components/@settings/tabs/connections/ConnectionDiagnostics.tsx b/app/settings/tabs/connections/ConnectionDiagnostics.tsx similarity index 99% rename from app/components/@settings/tabs/connections/ConnectionDiagnostics.tsx rename to app/settings/tabs/connections/ConnectionDiagnostics.tsx index c14d4f96..30bb6c61 100644 --- a/app/components/@settings/tabs/connections/ConnectionDiagnostics.tsx +++ b/app/settings/tabs/connections/ConnectionDiagnostics.tsx @@ -1,9 +1,9 @@ import React, { useState } from 'react'; import { toast } from 'react-toastify'; -import { Button } from '~/components/ui/Button'; -import { Badge } from '~/components/ui/Badge'; -import { classNames } from '~/utils/classNames'; -import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '~/components/ui/Collapsible'; +import { Button } from '~/shared/components/ui/Button'; +import { Badge } from '~/shared/components/ui/Badge'; +import { classNames } from '~/shared/utils/classNames'; +import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '~/shared/components/ui/Collapsible'; import { CodeBracketIcon, ChevronDownIcon } from '@heroicons/react/24/outline'; // Helper function to safely parse JSON diff --git a/app/components/@settings/tabs/connections/ConnectionsTab.tsx b/app/settings/tabs/connections/ConnectionsTab.tsx similarity index 98% rename from app/components/@settings/tabs/connections/ConnectionsTab.tsx rename to app/settings/tabs/connections/ConnectionsTab.tsx index d61b6fdc..fb228653 100644 --- a/app/components/@settings/tabs/connections/ConnectionsTab.tsx +++ b/app/settings/tabs/connections/ConnectionsTab.tsx @@ -1,8 +1,8 @@ import { motion } from 'framer-motion'; import React, { Suspense, useState } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import ConnectionDiagnostics from './ConnectionDiagnostics'; -import { Button } from '~/components/ui/Button'; +import { Button } from '~/shared/components/ui/Button'; import VercelConnection from './VercelConnection'; // Use React.lazy for dynamic imports diff --git a/app/components/@settings/tabs/connections/GithubConnection.tsx b/app/settings/tabs/connections/GithubConnection.tsx similarity index 99% rename from app/components/@settings/tabs/connections/GithubConnection.tsx rename to app/settings/tabs/connections/GithubConnection.tsx index f57c4d16..e8631227 100644 --- a/app/components/@settings/tabs/connections/GithubConnection.tsx +++ b/app/settings/tabs/connections/GithubConnection.tsx @@ -1,11 +1,11 @@ import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; import { toast } from 'react-toastify'; -import { logStore } from '~/lib/stores/logs'; -import { classNames } from '~/utils/classNames'; +import { logStore } from '~/shared/stores/logs'; +import { classNames } from '~/shared/utils/classNames'; import Cookies from 'js-cookie'; -import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '~/components/ui/Collapsible'; -import { Button } from '~/components/ui/Button'; +import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '~/shared/components/ui/Collapsible'; +import { Button } from '~/shared/components/ui/Button'; interface GitHubUserResponse { login: string; diff --git a/app/components/@settings/tabs/connections/NetlifyConnection.tsx b/app/settings/tabs/connections/NetlifyConnection.tsx similarity index 99% rename from app/components/@settings/tabs/connections/NetlifyConnection.tsx rename to app/settings/tabs/connections/NetlifyConnection.tsx index 2bd95f4f..aa937fd9 100644 --- a/app/components/@settings/tabs/connections/NetlifyConnection.tsx +++ b/app/settings/tabs/connections/NetlifyConnection.tsx @@ -1,9 +1,9 @@ import React, { useState, useEffect } from 'react'; import { toast } from 'react-toastify'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { useStore } from '@nanostores/react'; -import { netlifyConnection, updateNetlifyConnection, initializeNetlifyConnection } from '~/lib/stores/netlify'; -import type { NetlifySite, NetlifyDeploy, NetlifyBuild, NetlifyUser } from '~/types/netlify'; +import { netlifyConnection, updateNetlifyConnection, initializeNetlifyConnection } from '~/shared/stores/netlify'; +import type { NetlifySite, NetlifyDeploy, NetlifyBuild, NetlifyUser } from '~/shared/types/netlify'; import { CloudIcon, BuildingLibraryIcon, @@ -17,10 +17,10 @@ import { LockOpenIcon, RocketLaunchIcon, } from '@heroicons/react/24/outline'; -import { Button } from '~/components/ui/Button'; -import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '~/components/ui/Collapsible'; +import { Button } from '~/shared/components/ui/Button'; +import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '~/shared/components/ui/Collapsible'; import { formatDistanceToNow } from 'date-fns'; -import { Badge } from '~/components/ui/Badge'; +import { Badge } from '~/shared/components/ui/Badge'; // Add the Netlify logo SVG component at the top of the file const NetlifyLogo = () => ( diff --git a/app/components/@settings/tabs/connections/VercelConnection.tsx b/app/settings/tabs/connections/VercelConnection.tsx similarity index 98% rename from app/components/@settings/tabs/connections/VercelConnection.tsx rename to app/settings/tabs/connections/VercelConnection.tsx index 85278223..75f39905 100644 --- a/app/components/@settings/tabs/connections/VercelConnection.tsx +++ b/app/settings/tabs/connections/VercelConnection.tsx @@ -2,15 +2,15 @@ import React, { useEffect, useState } from 'react'; import { motion } from 'framer-motion'; import { toast } from 'react-toastify'; import { useStore } from '@nanostores/react'; -import { logStore } from '~/lib/stores/logs'; -import { classNames } from '~/utils/classNames'; +import { logStore } from '~/shared/stores/logs'; +import { classNames } from '~/shared/utils/classNames'; import { vercelConnection, isConnecting, isFetchingStats, updateVercelConnection, fetchVercelStats, -} from '~/lib/stores/vercel'; +} from '~/shared/stores/vercel'; export default function VercelConnection() { const connection = useStore(vercelConnection); diff --git a/app/components/@settings/tabs/connections/components/ConnectionForm.tsx b/app/settings/tabs/connections/components/ConnectionForm.tsx similarity index 97% rename from app/components/@settings/tabs/connections/components/ConnectionForm.tsx rename to app/settings/tabs/connections/components/ConnectionForm.tsx index 2c9876b6..8bbdb7a9 100644 --- a/app/components/@settings/tabs/connections/components/ConnectionForm.tsx +++ b/app/settings/tabs/connections/components/ConnectionForm.tsx @@ -1,8 +1,8 @@ import React, { useEffect } from 'react'; -import { classNames } from '~/utils/classNames'; -import type { GitHubAuthState } from '~/components/@settings/tabs/connections/types/GitHub'; +import { classNames } from '~/shared/utils/classNames'; +import type { GitHubAuthState } from '~/settings/tabs/connections/types/GitHub'; import Cookies from 'js-cookie'; -import { getLocalStorage } from '~/lib/persistence'; +import { getLocalStorage } from '~/shared/lib/persistence'; const GITHUB_TOKEN_KEY = 'github_token'; diff --git a/app/components/@settings/tabs/connections/components/CreateBranchDialog.tsx b/app/settings/tabs/connections/components/CreateBranchDialog.tsx similarity index 97% rename from app/components/@settings/tabs/connections/components/CreateBranchDialog.tsx rename to app/settings/tabs/connections/components/CreateBranchDialog.tsx index 3fd32ff2..2ab88ef6 100644 --- a/app/components/@settings/tabs/connections/components/CreateBranchDialog.tsx +++ b/app/settings/tabs/connections/components/CreateBranchDialog.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import * as Dialog from '@radix-ui/react-dialog'; -import { classNames } from '~/utils/classNames'; -import type { GitHubRepoInfo } from '~/components/@settings/tabs/connections/types/GitHub'; +import { classNames } from '~/shared/utils/classNames'; +import type { GitHubRepoInfo } from '~/settings/tabs/connections/types/GitHub'; import { GitBranch } from '@phosphor-icons/react'; interface GitHubBranch { diff --git a/app/components/@settings/tabs/connections/components/GitHubAuthDialog.tsx b/app/settings/tabs/connections/components/GitHubAuthDialog.tsx similarity index 99% rename from app/components/@settings/tabs/connections/components/GitHubAuthDialog.tsx rename to app/settings/tabs/connections/components/GitHubAuthDialog.tsx index b53a64d4..8c19258e 100644 --- a/app/components/@settings/tabs/connections/components/GitHubAuthDialog.tsx +++ b/app/settings/tabs/connections/components/GitHubAuthDialog.tsx @@ -3,7 +3,7 @@ import * as Dialog from '@radix-ui/react-dialog'; import { motion } from 'framer-motion'; import { toast } from 'react-toastify'; import Cookies from 'js-cookie'; -import type { GitHubUserResponse } from '~/types/GitHub'; +import type { GitHubUserResponse } from '~/shared/components/github/types/GitHub'; interface GitHubAuthDialogProps { isOpen: boolean; diff --git a/app/components/@settings/tabs/connections/components/PushToGitHubDialog.tsx b/app/settings/tabs/connections/components/PushToGitHubDialog.tsx similarity index 98% rename from app/components/@settings/tabs/connections/components/PushToGitHubDialog.tsx rename to app/settings/tabs/connections/components/PushToGitHubDialog.tsx index 1f8adb95..85ff7816 100644 --- a/app/components/@settings/tabs/connections/components/PushToGitHubDialog.tsx +++ b/app/settings/tabs/connections/components/PushToGitHubDialog.tsx @@ -5,17 +5,17 @@ import { motion } from 'framer-motion'; import { Octokit } from '@octokit/rest'; // Internal imports -import { getLocalStorage } from '~/lib/persistence'; -import { classNames } from '~/utils/classNames'; -import type { GitHubUserResponse } from '~/types/GitHub'; -import { logStore } from '~/lib/stores/logs'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { extractRelativePath } from '~/utils/diff'; -import { formatSize } from '~/utils/formatSize'; -import type { FileMap, File } from '~/lib/stores/files'; +import { getLocalStorage } from '~/shared/lib/persistence'; +import { classNames } from '~/shared/utils/classNames'; +import type { GitHubUserResponse } from '~/shared/components/github/types/GitHub'; +import { logStore } from '~/shared/stores/logs'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { extractRelativePath } from '~/shared/utils/diff'; +import { formatSize } from '~/shared/utils/formatSize'; +import type { FileMap, File } from '~/shared/workbench/stores/files'; // UI Components -import { Badge, EmptyState, StatusIndicator, SearchInput } from '~/components/ui'; +import { Badge, EmptyState, StatusIndicator, SearchInput } from '~/shared/components/ui'; interface PushToGitHubDialogProps { isOpen: boolean; diff --git a/app/components/@settings/tabs/connections/components/RepositoryCard.tsx b/app/settings/tabs/connections/components/RepositoryCard.tsx similarity index 98% rename from app/components/@settings/tabs/connections/components/RepositoryCard.tsx rename to app/settings/tabs/connections/components/RepositoryCard.tsx index 0d63277c..b10c69a0 100644 --- a/app/components/@settings/tabs/connections/components/RepositoryCard.tsx +++ b/app/settings/tabs/connections/components/RepositoryCard.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { motion } from 'framer-motion'; -import type { GitHubRepoInfo } from '~/types/GitHub'; +import type { GitHubRepoInfo } from '~/shared/components/github/types/GitHub'; interface RepositoryCardProps { repo: GitHubRepoInfo; diff --git a/app/components/@settings/tabs/connections/components/RepositoryDialogContext.tsx b/app/settings/tabs/connections/components/RepositoryDialogContext.tsx similarity index 100% rename from app/components/@settings/tabs/connections/components/RepositoryDialogContext.tsx rename to app/settings/tabs/connections/components/RepositoryDialogContext.tsx diff --git a/app/components/@settings/tabs/connections/components/RepositoryList.tsx b/app/settings/tabs/connections/components/RepositoryList.tsx similarity index 92% rename from app/components/@settings/tabs/connections/components/RepositoryList.tsx rename to app/settings/tabs/connections/components/RepositoryList.tsx index d6f0abda..91740994 100644 --- a/app/components/@settings/tabs/connections/components/RepositoryList.tsx +++ b/app/settings/tabs/connections/components/RepositoryList.tsx @@ -1,6 +1,6 @@ import React, { useContext } from 'react'; -import type { GitHubRepoInfo } from '~/types/GitHub'; -import { EmptyState, StatusIndicator } from '~/components/ui'; +import type { GitHubRepoInfo } from '~/shared/components/github/types/GitHub'; +import { EmptyState, StatusIndicator } from '~/shared/components/ui'; import { RepositoryCard } from './RepositoryCard'; import { RepositoryDialogContext } from './RepositoryDialogContext'; diff --git a/app/components/@settings/tabs/connections/components/RepositorySelectionDialog.tsx b/app/settings/tabs/connections/components/RepositorySelectionDialog.tsx similarity index 99% rename from app/components/@settings/tabs/connections/components/RepositorySelectionDialog.tsx rename to app/settings/tabs/connections/components/RepositorySelectionDialog.tsx index 82e1fbc4..a0e98007 100644 --- a/app/components/@settings/tabs/connections/components/RepositorySelectionDialog.tsx +++ b/app/settings/tabs/connections/components/RepositorySelectionDialog.tsx @@ -1,14 +1,19 @@ -import type { GitHubRepoInfo, GitHubContent, RepositoryStats, GitHubUserResponse } from '~/types/GitHub'; +import type { + GitHubRepoInfo, + GitHubContent, + RepositoryStats, + GitHubUserResponse, +} from '~/shared/components/github/types/GitHub'; import { useState, useEffect } from 'react'; import { toast } from 'react-toastify'; import * as Dialog from '@radix-ui/react-dialog'; -import { classNames } from '~/utils/classNames'; -import { getLocalStorage } from '~/lib/persistence'; +import { classNames } from '~/shared/utils/classNames'; +import { getLocalStorage } from '~/shared/lib/persistence'; import { motion, AnimatePresence } from 'framer-motion'; import Cookies from 'js-cookie'; // Import UI components -import { Input, SearchInput, Badge, FilterChip } from '~/components/ui'; +import { Input, SearchInput, Badge, FilterChip } from '~/shared/components/ui'; // Import the components we've extracted import { RepositoryList } from './RepositoryList'; diff --git a/app/components/@settings/tabs/connections/components/StatsDialog.tsx b/app/settings/tabs/connections/components/StatsDialog.tsx similarity index 95% rename from app/components/@settings/tabs/connections/components/StatsDialog.tsx rename to app/settings/tabs/connections/components/StatsDialog.tsx index 933ae225..481099f3 100644 --- a/app/components/@settings/tabs/connections/components/StatsDialog.tsx +++ b/app/settings/tabs/connections/components/StatsDialog.tsx @@ -1,9 +1,9 @@ import React from 'react'; import * as Dialog from '@radix-ui/react-dialog'; import { motion } from 'framer-motion'; -import type { RepositoryStats } from '~/types/GitHub'; -import { formatSize } from '~/utils/formatSize'; -import { RepositoryStats as RepoStats } from '~/components/ui'; +import type { RepositoryStats } from '~/shared/components/github/types/GitHub'; +import { formatSize } from '~/shared/utils/formatSize'; +import { RepositoryStats as RepoStats } from '~/shared/components/ui'; interface StatsDialogProps { isOpen: boolean; diff --git a/app/components/@settings/tabs/connections/types/GitHub.ts b/app/settings/tabs/connections/types/GitHub.ts similarity index 100% rename from app/components/@settings/tabs/connections/types/GitHub.ts rename to app/settings/tabs/connections/types/GitHub.ts diff --git a/app/components/@settings/tabs/data/DataTab.tsx b/app/settings/tabs/data/DataTab.tsx similarity index 98% rename from app/components/@settings/tabs/data/DataTab.tsx rename to app/settings/tabs/data/DataTab.tsx index df42c1da..63ea4e77 100644 --- a/app/components/@settings/tabs/data/DataTab.tsx +++ b/app/settings/tabs/data/DataTab.tsx @@ -1,13 +1,13 @@ import { useState, useRef, useCallback, useEffect } from 'react'; -import { Button } from '~/components/ui/Button'; -import { ConfirmationDialog, SelectionDialog } from '~/components/ui/Dialog'; -import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '~/components/ui/Card'; +import { Button } from '~/shared/components/ui/Button'; +import { ConfirmationDialog, SelectionDialog } from '~/shared/components/ui/Dialog'; +import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '~/shared/components/ui/Card'; import { motion } from 'framer-motion'; -import { useDataOperations } from '~/lib/hooks/useDataOperations'; -import { openDatabase } from '~/lib/persistence/db'; -import { getAllChats, type Chat } from '~/lib/persistence/chats'; +import { useDataOperations } from '~/shared/hooks/useDataOperations'; +import { openDatabase } from '~/shared/lib/persistence/db'; +import { getAllChats, type Chat } from '~/shared/lib/persistence/chats'; import { DataVisualization } from './DataVisualization'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { toast } from 'react-toastify'; // Create a custom hook to connect to the boltHistory database diff --git a/app/components/@settings/tabs/data/DataVisualization.tsx b/app/settings/tabs/data/DataVisualization.tsx similarity index 99% rename from app/components/@settings/tabs/data/DataVisualization.tsx rename to app/settings/tabs/data/DataVisualization.tsx index 27d27388..8c09bfa0 100644 --- a/app/components/@settings/tabs/data/DataVisualization.tsx +++ b/app/settings/tabs/data/DataVisualization.tsx @@ -12,8 +12,8 @@ import { LineElement, } from 'chart.js'; import { Bar, Pie } from 'react-chartjs-2'; -import type { Chat } from '~/lib/persistence/chats'; -import { classNames } from '~/utils/classNames'; +import type { Chat } from '~/shared/lib/persistence/chats'; +import { classNames } from '~/shared/utils/classNames'; // Register ChartJS components ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement, PointElement, LineElement); diff --git a/app/components/@settings/tabs/debug/DebugTab.tsx b/app/settings/tabs/debug/DebugTab.tsx similarity index 99% rename from app/components/@settings/tabs/debug/DebugTab.tsx rename to app/settings/tabs/debug/DebugTab.tsx index 24931aaf..a0d74a2b 100644 --- a/app/components/@settings/tabs/debug/DebugTab.tsx +++ b/app/settings/tabs/debug/DebugTab.tsx @@ -1,15 +1,15 @@ import React, { useEffect, useState, useMemo, useCallback } from 'react'; import { toast } from 'react-toastify'; -import { classNames } from '~/utils/classNames'; -import { logStore, type LogEntry } from '~/lib/stores/logs'; +import { classNames } from '~/shared/utils/classNames'; +import { logStore, type LogEntry } from '~/shared/stores/logs'; import { useStore } from '@nanostores/react'; -import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '~/components/ui/Collapsible'; -import { Progress } from '~/components/ui/Progress'; -import { ScrollArea } from '~/components/ui/ScrollArea'; -import { Badge } from '~/components/ui/Badge'; -import { Dialog, DialogRoot, DialogTitle } from '~/components/ui/Dialog'; +import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '~/shared/components/ui/Collapsible'; +import { Progress } from '~/shared/components/ui/Progress'; +import { ScrollArea } from '~/shared/components/ui/ScrollArea'; +import { Badge } from '~/shared/components/ui/Badge'; +import { Dialog, DialogRoot, DialogTitle } from '~/shared/components/ui/Dialog'; import { jsPDF } from 'jspdf'; -import { useSettings } from '~/lib/hooks/useSettings'; +import { useSettings } from '~/shared/hooks/useSettings'; interface SystemInfo { os: string; diff --git a/app/components/@settings/tabs/event-logs/EventLogsTab.tsx b/app/settings/tabs/event-logs/EventLogsTab.tsx similarity index 99% rename from app/components/@settings/tabs/event-logs/EventLogsTab.tsx rename to app/settings/tabs/event-logs/EventLogsTab.tsx index f3983dfc..94439541 100644 --- a/app/components/@settings/tabs/event-logs/EventLogsTab.tsx +++ b/app/settings/tabs/event-logs/EventLogsTab.tsx @@ -1,11 +1,11 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { motion } from 'framer-motion'; -import { Switch } from '~/components/ui/Switch'; -import { logStore, type LogEntry } from '~/lib/stores/logs'; +import { Switch } from '~/shared/components/ui/Switch'; +import { logStore, type LogEntry } from '~/shared/stores/logs'; import { useStore } from '@nanostores/react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; -import { Dialog, DialogRoot, DialogTitle } from '~/components/ui/Dialog'; +import { Dialog, DialogRoot, DialogTitle } from '~/shared/components/ui/Dialog'; import { jsPDF } from 'jspdf'; import { toast } from 'react-toastify'; diff --git a/app/components/@settings/tabs/features/FeaturesTab.tsx b/app/settings/tabs/features/FeaturesTab.tsx similarity index 97% rename from app/components/@settings/tabs/features/FeaturesTab.tsx rename to app/settings/tabs/features/FeaturesTab.tsx index 3b14a756..d3d53e33 100644 --- a/app/components/@settings/tabs/features/FeaturesTab.tsx +++ b/app/settings/tabs/features/FeaturesTab.tsx @@ -1,11 +1,11 @@ // Remove unused imports import React, { memo, useCallback } from 'react'; import { motion } from 'framer-motion'; -import { Switch } from '~/components/ui/Switch'; -import { useSettings } from '~/lib/hooks/useSettings'; -import { classNames } from '~/utils/classNames'; +import { Switch } from '~/shared/components/ui/Switch'; +import { useSettings } from '~/shared/hooks/useSettings'; +import { classNames } from '~/shared/utils/classNames'; import { toast } from 'react-toastify'; -import { PromptLibrary } from '~/lib/common/prompt-library'; +import { PromptLibrary } from '~/shared/lib/prompts/prompt-library'; interface FeatureToggle { id: string; diff --git a/app/components/@settings/tabs/notifications/NotificationsTab.tsx b/app/settings/tabs/notifications/NotificationsTab.tsx similarity index 99% rename from app/components/@settings/tabs/notifications/NotificationsTab.tsx rename to app/settings/tabs/notifications/NotificationsTab.tsx index cb5f3da1..2d388a67 100644 --- a/app/components/@settings/tabs/notifications/NotificationsTab.tsx +++ b/app/settings/tabs/notifications/NotificationsTab.tsx @@ -1,9 +1,9 @@ import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; -import { logStore } from '~/lib/stores/logs'; +import { logStore } from '~/shared/stores/logs'; import { useStore } from '@nanostores/react'; import { formatDistanceToNow } from 'date-fns'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; interface NotificationDetails { diff --git a/app/components/@settings/tabs/profile/ProfileTab.tsx b/app/settings/tabs/profile/ProfileTab.tsx similarity index 97% rename from app/components/@settings/tabs/profile/ProfileTab.tsx rename to app/settings/tabs/profile/ProfileTab.tsx index 6783a907..37d38636 100644 --- a/app/components/@settings/tabs/profile/ProfileTab.tsx +++ b/app/settings/tabs/profile/ProfileTab.tsx @@ -1,9 +1,9 @@ import { useState, useCallback } from 'react'; import { useStore } from '@nanostores/react'; -import { classNames } from '~/utils/classNames'; -import { profileStore, updateProfile } from '~/lib/stores/profile'; +import { classNames } from '~/shared/utils/classNames'; +import { profileStore, updateProfile } from '~/shared/stores/profile'; import { toast } from 'react-toastify'; -import { debounce } from '~/utils/debounce'; +import { debounce } from '~/shared/utils/debounce'; export default function ProfileTab() { const profile = useStore(profileStore); diff --git a/app/components/@settings/tabs/providers/cloud/CloudProvidersTab.tsx b/app/settings/tabs/providers/cloud/CloudProvidersTab.tsx similarity index 96% rename from app/components/@settings/tabs/providers/cloud/CloudProvidersTab.tsx rename to app/settings/tabs/providers/cloud/CloudProvidersTab.tsx index 9f85b766..12a99c54 100644 --- a/app/components/@settings/tabs/providers/cloud/CloudProvidersTab.tsx +++ b/app/settings/tabs/providers/cloud/CloudProvidersTab.tsx @@ -1,13 +1,13 @@ import React, { useEffect, useState, useCallback } from 'react'; -import { Switch } from '~/components/ui/Switch'; -import { useSettings } from '~/lib/hooks/useSettings'; -import { URL_CONFIGURABLE_PROVIDERS } from '~/lib/stores/settings'; -import type { IProviderConfig } from '~/types/model'; -import { logStore } from '~/lib/stores/logs'; +import { Switch } from '~/shared/components/ui/Switch'; +import { useSettings } from '~/shared/hooks/useSettings'; +import { URL_CONFIGURABLE_PROVIDERS } from '~/settings/stores/settings'; +import type { IProviderConfig } from '~/shared/types/model'; +import { logStore } from '~/shared/stores/logs'; import { motion } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { toast } from 'react-toastify'; -import { providerBaseUrlEnvKeys } from '~/utils/constants'; +import { providerBaseUrlEnvKeys } from '~/shared/utils/constants'; import { SiAmazon, SiGoogle, SiHuggingface, SiPerplexity, SiOpenai } from 'react-icons/si'; import { BsRobot, BsCloud } from 'react-icons/bs'; import { TbBrain, TbCloudComputing } from 'react-icons/tb'; diff --git a/app/components/@settings/tabs/providers/local/LocalProvidersTab.tsx b/app/settings/tabs/providers/local/LocalProvidersTab.tsx similarity index 98% rename from app/components/@settings/tabs/providers/local/LocalProvidersTab.tsx rename to app/settings/tabs/providers/local/LocalProvidersTab.tsx index 70e8d2f5..25541e67 100644 --- a/app/components/@settings/tabs/providers/local/LocalProvidersTab.tsx +++ b/app/settings/tabs/providers/local/LocalProvidersTab.tsx @@ -1,18 +1,18 @@ import React, { useEffect, useState, useCallback } from 'react'; -import { Switch } from '~/components/ui/Switch'; -import { useSettings } from '~/lib/hooks/useSettings'; -import { LOCAL_PROVIDERS, URL_CONFIGURABLE_PROVIDERS } from '~/lib/stores/settings'; -import type { IProviderConfig } from '~/types/model'; -import { logStore } from '~/lib/stores/logs'; +import { Switch } from '~/shared/components/ui/Switch'; +import { useSettings } from '~/shared/hooks/useSettings'; +import { LOCAL_PROVIDERS, URL_CONFIGURABLE_PROVIDERS } from '~/settings/stores/settings'; +import type { IProviderConfig } from '~/shared/types/model'; +import { logStore } from '~/shared/stores/logs'; import { motion, AnimatePresence } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { BsRobot } from 'react-icons/bs'; import type { IconType } from 'react-icons'; import { BiChip } from 'react-icons/bi'; import { TbBrandOpenai } from 'react-icons/tb'; -import { providerBaseUrlEnvKeys } from '~/utils/constants'; -import { useToast } from '~/components/ui/use-toast'; -import { Progress } from '~/components/ui/Progress'; +import { providerBaseUrlEnvKeys } from '~/shared/utils/constants'; +import { useToast } from '~/shared/components/ui/use-toast'; +import { Progress } from '~/shared/components/ui/Progress'; import OllamaModelInstaller from './OllamaModelInstaller'; // Add type for provider names to ensure type safety diff --git a/app/components/@settings/tabs/providers/local/OllamaModelInstaller.tsx b/app/settings/tabs/providers/local/OllamaModelInstaller.tsx similarity index 98% rename from app/components/@settings/tabs/providers/local/OllamaModelInstaller.tsx rename to app/settings/tabs/providers/local/OllamaModelInstaller.tsx index 9568076f..99ff982f 100644 --- a/app/components/@settings/tabs/providers/local/OllamaModelInstaller.tsx +++ b/app/settings/tabs/providers/local/OllamaModelInstaller.tsx @@ -1,9 +1,9 @@ import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; -import { Progress } from '~/components/ui/Progress'; -import { useToast } from '~/components/ui/use-toast'; -import { useSettings } from '~/lib/hooks/useSettings'; +import { classNames } from '~/shared/utils/classNames'; +import { Progress } from '~/shared/components/ui/Progress'; +import { useToast } from '~/shared/components/ui/use-toast'; +import { useSettings } from '~/shared/hooks/useSettings'; interface OllamaModelInstallerProps { onModelInstalled: () => void; diff --git a/app/components/@settings/tabs/providers/service-status/ServiceStatusTab.tsx b/app/settings/tabs/providers/service-status/ServiceStatusTab.tsx similarity index 100% rename from app/components/@settings/tabs/providers/service-status/ServiceStatusTab.tsx rename to app/settings/tabs/providers/service-status/ServiceStatusTab.tsx diff --git a/app/components/@settings/tabs/providers/service-status/base-provider.ts b/app/settings/tabs/providers/service-status/base-provider.ts similarity index 100% rename from app/components/@settings/tabs/providers/service-status/base-provider.ts rename to app/settings/tabs/providers/service-status/base-provider.ts diff --git a/app/components/@settings/tabs/providers/service-status/provider-factory.ts b/app/settings/tabs/providers/service-status/provider-factory.ts similarity index 100% rename from app/components/@settings/tabs/providers/service-status/provider-factory.ts rename to app/settings/tabs/providers/service-status/provider-factory.ts diff --git a/app/components/@settings/tabs/providers/service-status/providers/amazon-bedrock.ts b/app/settings/tabs/providers/service-status/providers/amazon-bedrock.ts similarity index 93% rename from app/components/@settings/tabs/providers/service-status/providers/amazon-bedrock.ts rename to app/settings/tabs/providers/service-status/providers/amazon-bedrock.ts index dff9d9a1..c41d28fb 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/amazon-bedrock.ts +++ b/app/settings/tabs/providers/service-status/providers/amazon-bedrock.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class AmazonBedrockStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/anthropic.ts b/app/settings/tabs/providers/service-status/providers/anthropic.ts similarity index 93% rename from app/components/@settings/tabs/providers/service-status/providers/anthropic.ts rename to app/settings/tabs/providers/service-status/providers/anthropic.ts index dccbf66b..af334ade 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/anthropic.ts +++ b/app/settings/tabs/providers/service-status/providers/anthropic.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class AnthropicStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/cohere.ts b/app/settings/tabs/providers/service-status/providers/cohere.ts similarity index 94% rename from app/components/@settings/tabs/providers/service-status/providers/cohere.ts rename to app/settings/tabs/providers/service-status/providers/cohere.ts index 7707f737..f5c7c563 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/cohere.ts +++ b/app/settings/tabs/providers/service-status/providers/cohere.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class CohereStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/deepseek.ts b/app/settings/tabs/providers/service-status/providers/deepseek.ts similarity index 86% rename from app/components/@settings/tabs/providers/service-status/providers/deepseek.ts rename to app/settings/tabs/providers/service-status/providers/deepseek.ts index 7aa88bac..3eb41d6b 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/deepseek.ts +++ b/app/settings/tabs/providers/service-status/providers/deepseek.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class DeepseekStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/google.ts b/app/settings/tabs/providers/service-status/providers/google.ts similarity index 93% rename from app/components/@settings/tabs/providers/service-status/providers/google.ts rename to app/settings/tabs/providers/service-status/providers/google.ts index 80b5ecf8..d5b2a873 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/google.ts +++ b/app/settings/tabs/providers/service-status/providers/google.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class GoogleStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/groq.ts b/app/settings/tabs/providers/service-status/providers/groq.ts similarity index 92% rename from app/components/@settings/tabs/providers/service-status/providers/groq.ts rename to app/settings/tabs/providers/service-status/providers/groq.ts index c465cedd..f0489753 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/groq.ts +++ b/app/settings/tabs/providers/service-status/providers/groq.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class GroqStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/huggingface.ts b/app/settings/tabs/providers/service-status/providers/huggingface.ts similarity index 95% rename from app/components/@settings/tabs/providers/service-status/providers/huggingface.ts rename to app/settings/tabs/providers/service-status/providers/huggingface.ts index 80dcfe84..ff6dd0bb 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/huggingface.ts +++ b/app/settings/tabs/providers/service-status/providers/huggingface.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class HuggingFaceStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/hyperbolic.ts b/app/settings/tabs/providers/service-status/providers/hyperbolic.ts similarity index 86% rename from app/components/@settings/tabs/providers/service-status/providers/hyperbolic.ts rename to app/settings/tabs/providers/service-status/providers/hyperbolic.ts index 6dca268f..e3bf6515 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/hyperbolic.ts +++ b/app/settings/tabs/providers/service-status/providers/hyperbolic.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class HyperbolicStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/mistral.ts b/app/settings/tabs/providers/service-status/providers/mistral.ts similarity index 92% rename from app/components/@settings/tabs/providers/service-status/providers/mistral.ts rename to app/settings/tabs/providers/service-status/providers/mistral.ts index 5966682c..42a9225f 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/mistral.ts +++ b/app/settings/tabs/providers/service-status/providers/mistral.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class MistralStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/openai.ts b/app/settings/tabs/providers/service-status/providers/openai.ts similarity index 94% rename from app/components/@settings/tabs/providers/service-status/providers/openai.ts rename to app/settings/tabs/providers/service-status/providers/openai.ts index 252c16ea..9056726c 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/openai.ts +++ b/app/settings/tabs/providers/service-status/providers/openai.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class OpenAIStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/openrouter.ts b/app/settings/tabs/providers/service-status/providers/openrouter.ts similarity index 94% rename from app/components/@settings/tabs/providers/service-status/providers/openrouter.ts rename to app/settings/tabs/providers/service-status/providers/openrouter.ts index f05edb98..a5d517de 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/openrouter.ts +++ b/app/settings/tabs/providers/service-status/providers/openrouter.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class OpenRouterStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/perplexity.ts b/app/settings/tabs/providers/service-status/providers/perplexity.ts similarity index 94% rename from app/components/@settings/tabs/providers/service-status/providers/perplexity.ts rename to app/settings/tabs/providers/service-status/providers/perplexity.ts index 31a8088e..965235d8 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/perplexity.ts +++ b/app/settings/tabs/providers/service-status/providers/perplexity.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class PerplexityStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/together.ts b/app/settings/tabs/providers/service-status/providers/together.ts similarity index 94% rename from app/components/@settings/tabs/providers/service-status/providers/together.ts rename to app/settings/tabs/providers/service-status/providers/together.ts index 77abce98..a7b6d652 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/together.ts +++ b/app/settings/tabs/providers/service-status/providers/together.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class TogetherStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/providers/xai.ts b/app/settings/tabs/providers/service-status/providers/xai.ts similarity index 85% rename from app/components/@settings/tabs/providers/service-status/providers/xai.ts rename to app/settings/tabs/providers/service-status/providers/xai.ts index 7b98c6a3..d7b994b7 100644 --- a/app/components/@settings/tabs/providers/service-status/providers/xai.ts +++ b/app/settings/tabs/providers/service-status/providers/xai.ts @@ -1,5 +1,5 @@ -import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider'; -import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types'; +import { BaseProviderChecker } from '~/settings/tabs/providers/service-status/base-provider'; +import type { StatusCheckResult } from '~/settings/tabs/providers/service-status/types'; export class XAIStatusChecker extends BaseProviderChecker { async checkStatus(): Promise { diff --git a/app/components/@settings/tabs/providers/service-status/types.ts b/app/settings/tabs/providers/service-status/types.ts similarity index 100% rename from app/components/@settings/tabs/providers/service-status/types.ts rename to app/settings/tabs/providers/service-status/types.ts diff --git a/app/components/@settings/tabs/providers/status/ServiceStatusTab.tsx b/app/settings/tabs/providers/status/ServiceStatusTab.tsx similarity index 99% rename from app/components/@settings/tabs/providers/status/ServiceStatusTab.tsx rename to app/settings/tabs/providers/status/ServiceStatusTab.tsx index b61ed043..b7260092 100644 --- a/app/components/@settings/tabs/providers/status/ServiceStatusTab.tsx +++ b/app/settings/tabs/providers/status/ServiceStatusTab.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState, useCallback } from 'react'; import { motion } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { TbActivityHeartbeat } from 'react-icons/tb'; import { BsCheckCircleFill, BsXCircleFill, BsExclamationCircleFill } from 'react-icons/bs'; import { SiAmazon, SiGoogle, SiHuggingface, SiPerplexity, SiOpenai } from 'react-icons/si'; @@ -9,8 +9,8 @@ import { TbBrain } from 'react-icons/tb'; import { BiChip, BiCodeBlock } from 'react-icons/bi'; import { FaCloud, FaBrain } from 'react-icons/fa'; import type { IconType } from 'react-icons'; -import { useSettings } from '~/lib/hooks/useSettings'; -import { useToast } from '~/components/ui/use-toast'; +import { useSettings } from '~/shared/hooks/useSettings'; +import { useToast } from '~/shared/components/ui/use-toast'; // Types type ProviderName = diff --git a/app/components/@settings/tabs/settings/SettingsTab.tsx b/app/settings/tabs/settings/SettingsTab.tsx similarity index 97% rename from app/components/@settings/tabs/settings/SettingsTab.tsx rename to app/settings/tabs/settings/SettingsTab.tsx index 2079840a..03cd1c47 100644 --- a/app/components/@settings/tabs/settings/SettingsTab.tsx +++ b/app/settings/tabs/settings/SettingsTab.tsx @@ -1,10 +1,10 @@ import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; import { toast } from 'react-toastify'; -import { classNames } from '~/utils/classNames'; -import { Switch } from '~/components/ui/Switch'; -import type { UserProfile } from '~/components/@settings/core/types'; -import { isMac } from '~/utils/os'; +import { classNames } from '~/shared/utils/classNames'; +import { Switch } from '~/shared/components/ui/Switch'; +import type { UserProfile } from '~/settings/core/types'; +import { isMac } from '~/shared/utils/os'; // Helper to get modifier key symbols/text const getModifierSymbol = (modifier: string): string => { diff --git a/app/components/@settings/tabs/task-manager/TaskManagerTab.tsx b/app/settings/tabs/task-manager/TaskManagerTab.tsx similarity index 99% rename from app/components/@settings/tabs/task-manager/TaskManagerTab.tsx rename to app/settings/tabs/task-manager/TaskManagerTab.tsx index 9d5de529..f54de64d 100644 --- a/app/components/@settings/tabs/task-manager/TaskManagerTab.tsx +++ b/app/settings/tabs/task-manager/TaskManagerTab.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { useEffect, useState, useCallback } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { Line } from 'react-chartjs-2'; import { Chart as ChartJS, @@ -14,8 +14,8 @@ import { type Chart, } from 'chart.js'; import { toast } from 'react-toastify'; // Import toast -import { useUpdateCheck } from '~/lib/hooks/useUpdateCheck'; -import { tabConfigurationStore, type TabConfig } from '~/lib/stores/tabConfigurationStore'; +import { useUpdateCheck } from '~/shared/hooks/useUpdateCheck'; +import { tabConfigurationStore, type TabConfig } from '~/settings/stores/tabConfigurationStore'; import { useStore } from 'zustand'; // Register ChartJS components diff --git a/app/components/@settings/tabs/update/UpdateTab.tsx b/app/settings/tabs/update/UpdateTab.tsx similarity index 98% rename from app/components/@settings/tabs/update/UpdateTab.tsx rename to app/settings/tabs/update/UpdateTab.tsx index 53c05d0f..e39fa605 100644 --- a/app/components/@settings/tabs/update/UpdateTab.tsx +++ b/app/settings/tabs/update/UpdateTab.tsx @@ -1,11 +1,11 @@ import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; -import { useSettings } from '~/lib/hooks/useSettings'; -import { logStore } from '~/lib/stores/logs'; +import { useSettings } from '~/shared/hooks/useSettings'; +import { logStore } from '~/shared/stores/logs'; import { toast } from 'react-toastify'; -import { Dialog, DialogRoot, DialogTitle, DialogDescription, DialogButton } from '~/components/ui/Dialog'; -import { classNames } from '~/utils/classNames'; -import { Markdown } from '~/components/chat/Markdown'; +import { Dialog, DialogRoot, DialogTitle, DialogDescription, DialogButton } from '~/shared/components/ui/Dialog'; +import { classNames } from '~/shared/utils/classNames'; +import { Markdown } from '~/chat/components/markdown/Markdown'; interface UpdateProgress { stage: 'fetch' | 'pull' | 'install' | 'build' | 'complete'; diff --git a/app/components/@settings/utils/animations.ts b/app/settings/utils/animations.ts similarity index 100% rename from app/components/@settings/utils/animations.ts rename to app/settings/utils/animations.ts diff --git a/app/components/@settings/utils/tab-helpers.ts b/app/settings/utils/tab-helpers.ts similarity index 94% rename from app/components/@settings/utils/tab-helpers.ts rename to app/settings/utils/tab-helpers.ts index 7a55eca7..5c5961c5 100644 --- a/app/components/@settings/utils/tab-helpers.ts +++ b/app/settings/utils/tab-helpers.ts @@ -1,5 +1,5 @@ -import type { TabType, TabVisibilityConfig } from '~/components/@settings/core/types'; -import { DEFAULT_TAB_CONFIG } from '~/components/@settings/core/constants'; +import type { TabType, TabVisibilityConfig } from '~/settings/core/types'; +import { DEFAULT_TAB_CONFIG } from '~/settings/core/constants'; export const getVisibleTabs = ( tabConfiguration: { userTabs: TabVisibilityConfig[]; developerTabs?: TabVisibilityConfig[] }, diff --git a/app/components/chat/GitCloneButton.tsx b/app/shared/components/github/components/GitCloneButton.tsx similarity index 90% rename from app/components/chat/GitCloneButton.tsx rename to app/shared/components/github/components/GitCloneButton.tsx index aa0182f6..1b51cbec 100644 --- a/app/components/chat/GitCloneButton.tsx +++ b/app/shared/components/github/components/GitCloneButton.tsx @@ -1,15 +1,15 @@ import ignore from 'ignore'; -import { useGit } from '~/lib/hooks/useGit'; +import { useGit } from '~/shared/hooks/useGit'; import type { Message } from 'ai'; -import { detectProjectCommands, createCommandsMessage, escapeBoltTags } from '~/utils/projectCommands'; -import { generateId } from '~/utils/fileUtils'; +import { detectProjectCommands, createCommandsMessage, escapeBoltTags } from '~/shared/utils/projectCommands'; +import { generateId } from '~/shared/utils/fileUtils'; import { useState } from 'react'; import { toast } from 'react-toastify'; -import { LoadingOverlay } from '~/components/ui/LoadingOverlay'; -import { RepositorySelectionDialog } from '~/components/@settings/tabs/connections/components/RepositorySelectionDialog'; -import { classNames } from '~/utils/classNames'; -import { Button } from '~/components/ui/Button'; -import type { IChatMetadata } from '~/lib/persistence/db'; +import { LoadingOverlay } from '~/shared/components/ui/LoadingOverlay'; +import { RepositorySelectionDialog } from '~/settings/tabs/connections/components/RepositorySelectionDialog'; +import { classNames } from '~/shared/utils/classNames'; +import { Button } from '~/shared/components/ui/Button'; +import type { IChatMetadata } from '~/shared/lib/persistence/db'; const IGNORE_PATTERNS = [ 'node_modules/**', diff --git a/app/components/git/GitUrlImport.client.tsx b/app/shared/components/github/components/GitUrlImport.client.tsx similarity index 92% rename from app/components/git/GitUrlImport.client.tsx rename to app/shared/components/github/components/GitUrlImport.client.tsx index eb1bfbbe..5e2604e7 100644 --- a/app/components/git/GitUrlImport.client.tsx +++ b/app/shared/components/github/components/GitUrlImport.client.tsx @@ -3,12 +3,12 @@ import { generateId, type Message } from 'ai'; import ignore from 'ignore'; import { useEffect, useState } from 'react'; import { ClientOnly } from 'remix-utils/client-only'; -import { BaseChat } from '~/components/chat/BaseChat'; -import { Chat } from '~/components/chat/Chat.client'; -import { useGit } from '~/lib/hooks/useGit'; -import { useChatHistory } from '~/lib/persistence'; -import { createCommandsMessage, detectProjectCommands, escapeBoltTags } from '~/utils/projectCommands'; -import { LoadingOverlay } from '~/components/ui/LoadingOverlay'; +import { BaseChat } from '~/chat/components/BaseChat'; +import { Chat } from '~/chat/components/Chat.client'; +import { useGit } from '~/shared/hooks/useGit'; +import { useChatHistory } from '~/shared/lib/persistence'; +import { createCommandsMessage, detectProjectCommands, escapeBoltTags } from '~/shared/utils/projectCommands'; +import { LoadingOverlay } from '~/shared/components/ui/LoadingOverlay'; import { toast } from 'react-toastify'; const IGNORE_PATTERNS = [ diff --git a/app/types/GitHub.ts b/app/shared/components/github/types/GitHub.ts similarity index 100% rename from app/types/GitHub.ts rename to app/shared/components/github/types/GitHub.ts diff --git a/app/components/ui/BackgroundRays/index.tsx b/app/shared/components/ui/BackgroundRays/index.tsx similarity index 100% rename from app/components/ui/BackgroundRays/index.tsx rename to app/shared/components/ui/BackgroundRays/index.tsx diff --git a/app/components/ui/BackgroundRays/styles.module.scss b/app/shared/components/ui/BackgroundRays/styles.module.scss similarity index 100% rename from app/components/ui/BackgroundRays/styles.module.scss rename to app/shared/components/ui/BackgroundRays/styles.module.scss diff --git a/app/components/ui/Badge.tsx b/app/shared/components/ui/Badge.tsx similarity index 97% rename from app/components/ui/Badge.tsx rename to app/shared/components/ui/Badge.tsx index 14729e6b..1a975f1b 100644 --- a/app/components/ui/Badge.tsx +++ b/app/shared/components/ui/Badge.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { cva, type VariantProps } from 'class-variance-authority'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; const badgeVariants = cva( 'inline-flex items-center gap-1 transition-colors focus:outline-none focus:ring-2 focus:ring-bolt-elements-ring focus:ring-offset-2', diff --git a/app/components/ui/Breadcrumbs.tsx b/app/shared/components/ui/Breadcrumbs.tsx similarity index 98% rename from app/components/ui/Breadcrumbs.tsx rename to app/shared/components/ui/Breadcrumbs.tsx index 1ba2b935..643040e6 100644 --- a/app/components/ui/Breadcrumbs.tsx +++ b/app/shared/components/ui/Breadcrumbs.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { motion } from 'framer-motion'; interface BreadcrumbItem { diff --git a/app/components/ui/Button.tsx b/app/shared/components/ui/Button.tsx similarity index 97% rename from app/components/ui/Button.tsx rename to app/shared/components/ui/Button.tsx index a2f9e3bc..8f1970ac 100644 --- a/app/components/ui/Button.tsx +++ b/app/shared/components/ui/Button.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { cva, type VariantProps } from 'class-variance-authority'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; const buttonVariants = cva( 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-bolt-elements-borderColor disabled:pointer-events-none disabled:opacity-50', diff --git a/app/components/ui/Card.tsx b/app/shared/components/ui/Card.tsx similarity index 97% rename from app/components/ui/Card.tsx rename to app/shared/components/ui/Card.tsx index 512647e4..b85f17f6 100644 --- a/app/components/ui/Card.tsx +++ b/app/shared/components/ui/Card.tsx @@ -1,5 +1,5 @@ import { forwardRef } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; export interface CardProps extends React.HTMLAttributes {} diff --git a/app/components/ui/Checkbox.tsx b/app/shared/components/ui/Checkbox.tsx similarity index 95% rename from app/components/ui/Checkbox.tsx rename to app/shared/components/ui/Checkbox.tsx index e21e9e25..763e85e9 100644 --- a/app/components/ui/Checkbox.tsx +++ b/app/shared/components/ui/Checkbox.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import * as CheckboxPrimitive from '@radix-ui/react-checkbox'; import { Check } from 'lucide-react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; const Checkbox = React.forwardRef< React.ElementRef, diff --git a/app/components/ui/CloseButton.tsx b/app/shared/components/ui/CloseButton.tsx similarity index 96% rename from app/components/ui/CloseButton.tsx rename to app/shared/components/ui/CloseButton.tsx index 5c8fff5e..685ba22e 100644 --- a/app/components/ui/CloseButton.tsx +++ b/app/shared/components/ui/CloseButton.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { motion } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; interface CloseButtonProps { onClick?: () => void; diff --git a/app/components/ui/CodeBlock.tsx b/app/shared/components/ui/CodeBlock.tsx similarity index 98% rename from app/components/ui/CodeBlock.tsx rename to app/shared/components/ui/CodeBlock.tsx index 71dfbc29..77b0b43f 100644 --- a/app/components/ui/CodeBlock.tsx +++ b/app/shared/components/ui/CodeBlock.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { motion } from 'framer-motion'; import { FileIcon } from './FileIcon'; import { Tooltip } from './Tooltip'; diff --git a/app/components/ui/Collapsible.tsx b/app/shared/components/ui/Collapsible.tsx similarity index 100% rename from app/components/ui/Collapsible.tsx rename to app/shared/components/ui/Collapsible.tsx diff --git a/app/components/ui/ColorSchemeDialog.tsx b/app/shared/components/ui/ColorSchemeDialog.tsx similarity index 99% rename from app/components/ui/ColorSchemeDialog.tsx rename to app/shared/components/ui/ColorSchemeDialog.tsx index 674edc57..6900c7a4 100644 --- a/app/components/ui/ColorSchemeDialog.tsx +++ b/app/shared/components/ui/ColorSchemeDialog.tsx @@ -2,8 +2,8 @@ import React, { useState, useEffect } from 'react'; import { Dialog, DialogTitle, DialogDescription, DialogRoot } from './Dialog'; import { Button } from './Button'; import { IconButton } from './IconButton'; -import type { DesignScheme } from '~/types/design-scheme'; -import { defaultDesignScheme, designFeatures, designFonts, paletteRoles } from '~/types/design-scheme'; +import type { DesignScheme } from '~/shared/types/design-scheme'; +import { defaultDesignScheme, designFeatures, designFonts, paletteRoles } from '~/shared/types/design-scheme'; export interface ColorSchemeDialogProps { designScheme?: DesignScheme; diff --git a/app/components/ui/Dialog.tsx b/app/shared/components/ui/Dialog.tsx similarity index 99% rename from app/components/ui/Dialog.tsx rename to app/shared/components/ui/Dialog.tsx index ed072ddb..dac8a275 100644 --- a/app/components/ui/Dialog.tsx +++ b/app/shared/components/ui/Dialog.tsx @@ -1,8 +1,8 @@ import * as RadixDialog from '@radix-ui/react-dialog'; import { motion, type Variants } from 'framer-motion'; import React, { memo, type ReactNode, useState, useEffect } from 'react'; -import { classNames } from '~/utils/classNames'; -import { cubicEasingFn } from '~/utils/easings'; +import { classNames } from '~/shared/utils/classNames'; +import { cubicEasingFn } from '~/shared/utils/easings'; import { IconButton } from './IconButton'; import { Button } from './Button'; import { FixedSizeList } from 'react-window'; diff --git a/app/components/ui/Dropdown.tsx b/app/shared/components/ui/Dropdown.tsx similarity index 97% rename from app/components/ui/Dropdown.tsx rename to app/shared/components/ui/Dropdown.tsx index 89e97761..2d596da5 100644 --- a/app/components/ui/Dropdown.tsx +++ b/app/shared/components/ui/Dropdown.tsx @@ -1,6 +1,6 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; import { type ReactNode } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; interface DropdownProps { trigger: ReactNode; diff --git a/app/components/ui/EmptyState.tsx b/app/shared/components/ui/EmptyState.tsx similarity index 98% rename from app/components/ui/EmptyState.tsx rename to app/shared/components/ui/EmptyState.tsx index 22375f06..b52a628c 100644 --- a/app/components/ui/EmptyState.tsx +++ b/app/shared/components/ui/EmptyState.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { Button } from './Button'; import { motion } from 'framer-motion'; diff --git a/app/components/ui/FileIcon.tsx b/app/shared/components/ui/FileIcon.tsx similarity index 99% rename from app/components/ui/FileIcon.tsx rename to app/shared/components/ui/FileIcon.tsx index 00d96715..a4ef4f9e 100644 --- a/app/components/ui/FileIcon.tsx +++ b/app/shared/components/ui/FileIcon.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; interface FileIconProps { filename: string; diff --git a/app/components/ui/FilterChip.tsx b/app/shared/components/ui/FilterChip.tsx similarity index 98% rename from app/components/ui/FilterChip.tsx rename to app/shared/components/ui/FilterChip.tsx index 705cec20..b9072e71 100644 --- a/app/components/ui/FilterChip.tsx +++ b/app/shared/components/ui/FilterChip.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { motion } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; interface FilterChipProps { /** The label text to display */ diff --git a/app/components/ui/GradientCard.tsx b/app/shared/components/ui/GradientCard.tsx similarity index 97% rename from app/components/ui/GradientCard.tsx rename to app/shared/components/ui/GradientCard.tsx index 154bf97f..6d55ca62 100644 --- a/app/components/ui/GradientCard.tsx +++ b/app/shared/components/ui/GradientCard.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { motion } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; // Predefined gradient colors const GRADIENT_COLORS = [ diff --git a/app/components/ui/IconButton.tsx b/app/shared/components/ui/IconButton.tsx similarity index 97% rename from app/components/ui/IconButton.tsx rename to app/shared/components/ui/IconButton.tsx index cda32e25..a94b4eee 100644 --- a/app/components/ui/IconButton.tsx +++ b/app/shared/components/ui/IconButton.tsx @@ -1,5 +1,5 @@ import { memo, forwardRef, type ForwardedRef } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; type IconSize = 'sm' | 'md' | 'lg' | 'xl' | 'xxl'; diff --git a/app/components/ui/Input.tsx b/app/shared/components/ui/Input.tsx similarity index 93% rename from app/components/ui/Input.tsx rename to app/shared/components/ui/Input.tsx index 64762502..30f19683 100644 --- a/app/components/ui/Input.tsx +++ b/app/shared/components/ui/Input.tsx @@ -1,5 +1,5 @@ import { forwardRef } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; export interface InputProps extends React.InputHTMLAttributes {} diff --git a/app/components/ui/Label.tsx b/app/shared/components/ui/Label.tsx similarity index 90% rename from app/components/ui/Label.tsx rename to app/shared/components/ui/Label.tsx index 1fb33fd6..12f96e4c 100644 --- a/app/components/ui/Label.tsx +++ b/app/shared/components/ui/Label.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as LabelPrimitive from '@radix-ui/react-label'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; const Label = React.forwardRef< React.ElementRef, diff --git a/app/components/ui/LoadingDots.tsx b/app/shared/components/ui/LoadingDots.tsx similarity index 100% rename from app/components/ui/LoadingDots.tsx rename to app/shared/components/ui/LoadingDots.tsx diff --git a/app/components/ui/LoadingOverlay.tsx b/app/shared/components/ui/LoadingOverlay.tsx similarity index 100% rename from app/components/ui/LoadingOverlay.tsx rename to app/shared/components/ui/LoadingOverlay.tsx diff --git a/app/components/ui/PanelHeader.tsx b/app/shared/components/ui/PanelHeader.tsx similarity index 89% rename from app/components/ui/PanelHeader.tsx rename to app/shared/components/ui/PanelHeader.tsx index 78ab3082..92f29058 100644 --- a/app/components/ui/PanelHeader.tsx +++ b/app/shared/components/ui/PanelHeader.tsx @@ -1,5 +1,5 @@ import { memo } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; interface PanelHeaderProps { className?: string; diff --git a/app/components/ui/PanelHeaderButton.tsx b/app/shared/components/ui/PanelHeaderButton.tsx similarity index 95% rename from app/components/ui/PanelHeaderButton.tsx rename to app/shared/components/ui/PanelHeaderButton.tsx index 9faea1cc..1d3deed5 100644 --- a/app/components/ui/PanelHeaderButton.tsx +++ b/app/shared/components/ui/PanelHeaderButton.tsx @@ -1,5 +1,5 @@ import { memo } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; interface PanelHeaderButtonProps { className?: string; diff --git a/app/components/ui/Popover.tsx b/app/shared/components/ui/Popover.tsx similarity index 100% rename from app/components/ui/Popover.tsx rename to app/shared/components/ui/Popover.tsx diff --git a/app/components/ui/Progress.tsx b/app/shared/components/ui/Progress.tsx similarity index 91% rename from app/components/ui/Progress.tsx rename to app/shared/components/ui/Progress.tsx index f50b39e6..bc33e1f7 100644 --- a/app/components/ui/Progress.tsx +++ b/app/shared/components/ui/Progress.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; interface ProgressProps extends React.HTMLAttributes { value?: number; diff --git a/app/components/ui/RepositoryStats.tsx b/app/shared/components/ui/RepositoryStats.tsx similarity index 96% rename from app/components/ui/RepositoryStats.tsx rename to app/shared/components/ui/RepositoryStats.tsx index 98d2bf6a..f04437b9 100644 --- a/app/components/ui/RepositoryStats.tsx +++ b/app/shared/components/ui/RepositoryStats.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Badge } from './Badge'; -import { classNames } from '~/utils/classNames'; -import { formatSize } from '~/utils/formatSize'; +import { classNames } from '~/shared/utils/classNames'; +import { formatSize } from '~/shared/utils/formatSize'; interface RepositoryStatsProps { stats: { diff --git a/app/components/ui/ScrollArea.tsx b/app/shared/components/ui/ScrollArea.tsx similarity index 96% rename from app/components/ui/ScrollArea.tsx rename to app/shared/components/ui/ScrollArea.tsx index 38176a28..3129bd3d 100644 --- a/app/components/ui/ScrollArea.tsx +++ b/app/shared/components/ui/ScrollArea.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; const ScrollArea = React.forwardRef< React.ElementRef, diff --git a/app/components/ui/SearchInput.tsx b/app/shared/components/ui/SearchInput.tsx similarity index 97% rename from app/components/ui/SearchInput.tsx rename to app/shared/components/ui/SearchInput.tsx index c3209218..e6f88a3a 100644 --- a/app/components/ui/SearchInput.tsx +++ b/app/shared/components/ui/SearchInput.tsx @@ -1,5 +1,5 @@ import React, { forwardRef } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { Input } from './Input'; import { motion, AnimatePresence } from 'framer-motion'; diff --git a/app/components/ui/SearchResultItem.tsx b/app/shared/components/ui/SearchResultItem.tsx similarity index 98% rename from app/components/ui/SearchResultItem.tsx rename to app/shared/components/ui/SearchResultItem.tsx index b2dddccc..8895cac9 100644 --- a/app/components/ui/SearchResultItem.tsx +++ b/app/shared/components/ui/SearchResultItem.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { motion } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; import { Badge } from './Badge'; interface SearchResultItemProps { diff --git a/app/components/ui/Separator.tsx b/app/shared/components/ui/Separator.tsx similarity index 90% rename from app/components/ui/Separator.tsx rename to app/shared/components/ui/Separator.tsx index 8ea43a5e..aa4e5ea5 100644 --- a/app/components/ui/Separator.tsx +++ b/app/shared/components/ui/Separator.tsx @@ -1,5 +1,5 @@ import * as SeparatorPrimitive from '@radix-ui/react-separator'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; interface SeparatorProps { className?: string; diff --git a/app/components/ui/SettingsButton.tsx b/app/shared/components/ui/SettingsButton.tsx similarity index 87% rename from app/components/ui/SettingsButton.tsx rename to app/shared/components/ui/SettingsButton.tsx index 0c2bde00..19d48d5e 100644 --- a/app/components/ui/SettingsButton.tsx +++ b/app/shared/components/ui/SettingsButton.tsx @@ -1,5 +1,5 @@ import { memo } from 'react'; -import { IconButton } from '~/components/ui/IconButton'; +import { IconButton } from '~/shared/components/ui/IconButton'; interface SettingsButtonProps { onClick: () => void; } diff --git a/app/components/ui/Slider.tsx b/app/shared/components/ui/Slider.tsx similarity index 93% rename from app/components/ui/Slider.tsx rename to app/shared/components/ui/Slider.tsx index 70ec9539..55fdce9a 100644 --- a/app/components/ui/Slider.tsx +++ b/app/shared/components/ui/Slider.tsx @@ -1,8 +1,8 @@ import { motion } from 'framer-motion'; import { memo } from 'react'; -import { classNames } from '~/utils/classNames'; -import { cubicEasingFn } from '~/utils/easings'; -import { genericMemo } from '~/utils/react'; +import { classNames } from '~/shared/utils/classNames'; +import { cubicEasingFn } from '~/shared/utils/easings'; +import { genericMemo } from '~/shared/utils/react'; export type SliderOptions = { left: { value: T; text: string }; diff --git a/app/components/ui/StatusIndicator.tsx b/app/shared/components/ui/StatusIndicator.tsx similarity index 97% rename from app/components/ui/StatusIndicator.tsx rename to app/shared/components/ui/StatusIndicator.tsx index 6466dfbe..4c5fd1ff 100644 --- a/app/components/ui/StatusIndicator.tsx +++ b/app/shared/components/ui/StatusIndicator.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; // Status types supported by the component type StatusType = 'online' | 'offline' | 'away' | 'busy' | 'success' | 'warning' | 'error' | 'info' | 'loading'; diff --git a/app/components/ui/Switch.tsx b/app/shared/components/ui/Switch.tsx similarity index 95% rename from app/components/ui/Switch.tsx rename to app/shared/components/ui/Switch.tsx index 55d2745b..7ab67e17 100644 --- a/app/components/ui/Switch.tsx +++ b/app/shared/components/ui/Switch.tsx @@ -1,6 +1,6 @@ import { memo } from 'react'; import * as SwitchPrimitive from '@radix-ui/react-switch'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; interface SwitchProps { className?: string; diff --git a/app/components/ui/Tabs.tsx b/app/shared/components/ui/Tabs.tsx similarity index 97% rename from app/components/ui/Tabs.tsx rename to app/shared/components/ui/Tabs.tsx index 34ae64e5..b815ed33 100644 --- a/app/components/ui/Tabs.tsx +++ b/app/shared/components/ui/Tabs.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as TabsPrimitive from '@radix-ui/react-tabs'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; const Tabs = TabsPrimitive.Root; diff --git a/app/components/ui/TabsWithSlider.tsx b/app/shared/components/ui/TabsWithSlider.tsx similarity index 98% rename from app/components/ui/TabsWithSlider.tsx rename to app/shared/components/ui/TabsWithSlider.tsx index 8dee0f4b..5154825d 100644 --- a/app/components/ui/TabsWithSlider.tsx +++ b/app/shared/components/ui/TabsWithSlider.tsx @@ -1,6 +1,6 @@ import React, { useState, useRef, useEffect } from 'react'; import { motion } from 'framer-motion'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; interface Tab { /** Unique identifier for the tab */ diff --git a/app/components/ui/ThemeSwitch.tsx b/app/shared/components/ui/ThemeSwitch.tsx similarity index 91% rename from app/components/ui/ThemeSwitch.tsx rename to app/shared/components/ui/ThemeSwitch.tsx index a46da2b2..9347addf 100644 --- a/app/components/ui/ThemeSwitch.tsx +++ b/app/shared/components/ui/ThemeSwitch.tsx @@ -1,6 +1,6 @@ import { useStore } from '@nanostores/react'; import { memo, useEffect, useState } from 'react'; -import { themeStore, toggleTheme } from '~/lib/stores/theme'; +import { themeStore, toggleTheme } from '~/shared/stores/theme'; import { IconButton } from './IconButton'; interface ThemeSwitchProps { diff --git a/app/components/ui/Tooltip.tsx b/app/shared/components/ui/Tooltip.tsx similarity index 98% rename from app/components/ui/Tooltip.tsx rename to app/shared/components/ui/Tooltip.tsx index 74f0e0e9..aeb629f1 100644 --- a/app/components/ui/Tooltip.tsx +++ b/app/shared/components/ui/Tooltip.tsx @@ -1,6 +1,6 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip'; import { forwardRef, type ForwardedRef, type ReactElement } from 'react'; -import { classNames } from '~/utils/classNames'; +import { classNames } from '~/shared/utils/classNames'; // Original WithTooltip component interface WithTooltipProps { diff --git a/app/components/ui/index.ts b/app/shared/components/ui/index.ts similarity index 100% rename from app/components/ui/index.ts rename to app/shared/components/ui/index.ts diff --git a/app/components/ui/use-toast.ts b/app/shared/components/ui/use-toast.ts similarity index 100% rename from app/components/ui/use-toast.ts rename to app/shared/components/ui/use-toast.ts diff --git a/app/lib/hooks/index.ts b/app/shared/hooks/index.ts similarity index 70% rename from app/lib/hooks/index.ts rename to app/shared/hooks/index.ts index e2f61334..83fe4ae3 100644 --- a/app/lib/hooks/index.ts +++ b/app/shared/hooks/index.ts @@ -1,8 +1,8 @@ export * from './useMessageParser'; -export * from './usePromptEnhancer'; +export * from '~/chat/hooks/usePromptEnhancer'; export * from './useShortcuts'; -export * from './StickToBottom'; -export * from './useEditChatDescription'; +export * from '~/chat/hooks/StickToBottom'; +export * from '~/layout/header/hooks/useEditChatDescription'; export { default } from './useViewport'; export { useUpdateCheck } from './useUpdateCheck'; export { useFeatures } from './useFeatures'; diff --git a/app/lib/hooks/useConnectionStatus.ts b/app/shared/hooks/useConnectionStatus.ts similarity index 96% rename from app/lib/hooks/useConnectionStatus.ts rename to app/shared/hooks/useConnectionStatus.ts index 1f3effde..c8579d0f 100644 --- a/app/lib/hooks/useConnectionStatus.ts +++ b/app/shared/hooks/useConnectionStatus.ts @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { checkConnection } from '~/lib/api/connection'; +import { checkConnection } from '~/shared/lib/api/connection'; const ACKNOWLEDGED_CONNECTION_ISSUE_KEY = 'bolt_acknowledged_connection_issue'; diff --git a/app/lib/hooks/useDataOperations.ts b/app/shared/hooks/useDataOperations.ts similarity index 99% rename from app/lib/hooks/useDataOperations.ts rename to app/shared/hooks/useDataOperations.ts index afc6ad7e..ecfc2ba5 100644 --- a/app/lib/hooks/useDataOperations.ts +++ b/app/shared/hooks/useDataOperations.ts @@ -1,7 +1,7 @@ import { useState, useCallback } from 'react'; import { toast } from 'react-toastify'; -import { ImportExportService } from '~/lib/services/importExportService'; -import { useIndexedDB } from '~/lib/hooks/useIndexedDB'; +import { ImportExportService } from '~/chat/services/importExportService'; +import { useIndexedDB } from '~/shared/hooks/useIndexedDB'; import { generateId } from 'ai'; interface UseDataOperationsProps { diff --git a/app/lib/hooks/useDebugStatus.ts b/app/shared/hooks/useDebugStatus.ts similarity index 98% rename from app/lib/hooks/useDebugStatus.ts rename to app/shared/hooks/useDebugStatus.ts index 64612f0e..922e22af 100644 --- a/app/lib/hooks/useDebugStatus.ts +++ b/app/shared/hooks/useDebugStatus.ts @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { getDebugStatus, acknowledgeWarning, acknowledgeError, type DebugIssue } from '~/lib/api/debug'; +import { getDebugStatus, acknowledgeWarning, acknowledgeError, type DebugIssue } from '~/shared/lib/api/debug'; const ACKNOWLEDGED_DEBUG_ISSUES_KEY = 'bolt_acknowledged_debug_issues'; diff --git a/app/lib/hooks/useFeatures.ts b/app/shared/hooks/useFeatures.ts similarity index 98% rename from app/lib/hooks/useFeatures.ts rename to app/shared/hooks/useFeatures.ts index 42109cdd..b58b6a3a 100644 --- a/app/lib/hooks/useFeatures.ts +++ b/app/shared/hooks/useFeatures.ts @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { getFeatureFlags, markFeatureViewed, type Feature } from '~/lib/api/features'; +import { getFeatureFlags, markFeatureViewed, type Feature } from '~/shared/lib/api/features'; const VIEWED_FEATURES_KEY = 'bolt_viewed_features'; diff --git a/app/lib/hooks/useGit.ts b/app/shared/hooks/useGit.ts similarity index 99% rename from app/lib/hooks/useGit.ts rename to app/shared/hooks/useGit.ts index 387f794f..187a1038 100644 --- a/app/lib/hooks/useGit.ts +++ b/app/shared/hooks/useGit.ts @@ -1,6 +1,6 @@ import type { WebContainer } from '@webcontainer/api'; import { useCallback, useEffect, useRef, useState, type MutableRefObject } from 'react'; -import { webcontainer as webcontainerPromise } from '~/lib/webcontainer'; +import { webcontainer as webcontainerPromise } from '~/shared/lib/webcontainer'; import git, { type GitAuth, type PromiseFsClient } from 'isomorphic-git'; import http from 'isomorphic-git/http/web'; import Cookies from 'js-cookie'; diff --git a/app/lib/hooks/useIndexedDB.ts b/app/shared/hooks/useIndexedDB.ts similarity index 100% rename from app/lib/hooks/useIndexedDB.ts rename to app/shared/hooks/useIndexedDB.ts diff --git a/app/lib/hooks/useLocalProviders.ts b/app/shared/hooks/useLocalProviders.ts similarity index 91% rename from app/lib/hooks/useLocalProviders.ts rename to app/shared/hooks/useLocalProviders.ts index 78014f00..df8db625 100644 --- a/app/lib/hooks/useLocalProviders.ts +++ b/app/shared/hooks/useLocalProviders.ts @@ -1,5 +1,5 @@ import { useCallback, useState } from 'react'; -import type { IProviderConfig } from '~/types/model'; +import type { IProviderConfig } from '~/shared/types/model'; export interface UseLocalProvidersReturn { localProviders: IProviderConfig[]; diff --git a/app/lib/hooks/useMessageParser.ts b/app/shared/hooks/useMessageParser.ts similarity index 91% rename from app/lib/hooks/useMessageParser.ts rename to app/shared/hooks/useMessageParser.ts index e08e77e9..1a4a8ee8 100644 --- a/app/lib/hooks/useMessageParser.ts +++ b/app/shared/hooks/useMessageParser.ts @@ -1,8 +1,8 @@ import type { Message } from 'ai'; import { useCallback, useState } from 'react'; -import { StreamingMessageParser } from '~/lib/runtime/message-parser'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { createScopedLogger } from '~/utils/logger'; +import { StreamingMessageParser } from '~/shared/lib/runtime/message-parser'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { createScopedLogger } from '~/shared/utils/logger'; const logger = createScopedLogger('useMessageParser'); diff --git a/app/lib/hooks/useNotifications.ts b/app/shared/hooks/useNotifications.ts similarity index 94% rename from app/lib/hooks/useNotifications.ts rename to app/shared/hooks/useNotifications.ts index 151dd39e..e39f7fcc 100644 --- a/app/lib/hooks/useNotifications.ts +++ b/app/shared/hooks/useNotifications.ts @@ -1,6 +1,6 @@ import { useState, useEffect } from 'react'; -import { getNotifications, markNotificationRead, type Notification } from '~/lib/api/notifications'; -import { logStore } from '~/lib/stores/logs'; +import { getNotifications, markNotificationRead, type Notification } from '~/shared/lib/api/notifications'; +import { logStore } from '~/shared/stores/logs'; import { useStore } from '@nanostores/react'; export const useNotifications = () => { diff --git a/app/lib/hooks/useSearchFilter.ts b/app/shared/hooks/useSearchFilter.ts similarity index 90% rename from app/lib/hooks/useSearchFilter.ts rename to app/shared/hooks/useSearchFilter.ts index ec576cbe..1696f179 100644 --- a/app/lib/hooks/useSearchFilter.ts +++ b/app/shared/hooks/useSearchFilter.ts @@ -1,6 +1,6 @@ import { useState, useMemo, useCallback } from 'react'; -import { debounce } from '~/utils/debounce'; -import type { ChatHistoryItem } from '~/lib/persistence'; +import { debounce } from '~/shared/utils/debounce'; +import type { ChatHistoryItem } from '~/shared/lib/persistence'; interface UseSearchFilterOptions { items: ChatHistoryItem[]; diff --git a/app/lib/hooks/useSettings.ts b/app/shared/hooks/useSettings.ts similarity index 95% rename from app/lib/hooks/useSettings.ts rename to app/shared/hooks/useSettings.ts index 69e06bdf..d6069e06 100644 --- a/app/lib/hooks/useSettings.ts +++ b/app/shared/hooks/useSettings.ts @@ -16,13 +16,13 @@ import { updateContextOptimization, updateEventLogs, updatePromptId, -} from '~/lib/stores/settings'; +} from '~/settings/stores/settings'; import { useCallback, useEffect, useState } from 'react'; import Cookies from 'js-cookie'; -import type { IProviderSetting, ProviderInfo, IProviderConfig } from '~/types/model'; -import type { TabWindowConfig, TabVisibilityConfig } from '~/components/@settings/core/types'; -import { logStore } from '~/lib/stores/logs'; -import { getLocalStorage, setLocalStorage } from '~/lib/persistence'; +import type { IProviderSetting, ProviderInfo, IProviderConfig } from '~/shared/types/model'; +import type { TabWindowConfig, TabVisibilityConfig } from '~/settings/core/types'; +import { logStore } from '~/shared/stores/logs'; +import { getLocalStorage, setLocalStorage } from '~/shared/lib/persistence'; export interface Settings { theme: 'light' | 'dark' | 'system'; diff --git a/app/lib/hooks/useShortcuts.ts b/app/shared/hooks/useShortcuts.ts similarity index 95% rename from app/lib/hooks/useShortcuts.ts rename to app/shared/hooks/useShortcuts.ts index 468cf0d8..23751bd6 100644 --- a/app/lib/hooks/useShortcuts.ts +++ b/app/shared/hooks/useShortcuts.ts @@ -1,7 +1,7 @@ import { useStore } from '@nanostores/react'; import { useEffect } from 'react'; -import { shortcutsStore, type Shortcuts } from '~/lib/stores/settings'; -import { isMac } from '~/utils/os'; +import { shortcutsStore, type Shortcuts } from '~/settings/stores/settings'; +import { isMac } from '~/shared/utils/os'; // List of keys that should not trigger shortcuts when typing in input/textarea const INPUT_ELEMENTS = ['input', 'textarea']; diff --git a/app/lib/hooks/useSupabaseConnection.ts b/app/shared/hooks/useSupabaseConnection.ts similarity index 98% rename from app/lib/hooks/useSupabaseConnection.ts rename to app/shared/hooks/useSupabaseConnection.ts index 8a2f8118..996a718b 100644 --- a/app/lib/hooks/useSupabaseConnection.ts +++ b/app/shared/hooks/useSupabaseConnection.ts @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; import { toast } from 'react-toastify'; import { useStore } from '@nanostores/react'; -import { logStore } from '~/lib/stores/logs'; +import { logStore } from '~/shared/stores/logs'; import { supabaseConnection, isConnecting, @@ -9,7 +9,7 @@ import { isFetchingApiKeys, updateSupabaseConnection, fetchProjectApiKeys, -} from '~/lib/stores/supabase'; +} from '~/shared/stores/supabase'; export function useSupabaseConnection() { const connection = useStore(supabaseConnection); diff --git a/app/lib/hooks/useUpdateCheck.ts b/app/shared/hooks/useUpdateCheck.ts similarity index 95% rename from app/lib/hooks/useUpdateCheck.ts rename to app/shared/hooks/useUpdateCheck.ts index f53a7943..830ad930 100644 --- a/app/lib/hooks/useUpdateCheck.ts +++ b/app/shared/hooks/useUpdateCheck.ts @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { checkForUpdates, acknowledgeUpdate } from '~/lib/api/updates'; +import { checkForUpdates, acknowledgeUpdate } from '~/shared/lib/api/updates'; const LAST_ACKNOWLEDGED_VERSION_KEY = 'bolt_last_acknowledged_version'; diff --git a/app/lib/hooks/useViewport.ts b/app/shared/hooks/useViewport.ts similarity index 100% rename from app/lib/hooks/useViewport.ts rename to app/shared/hooks/useViewport.ts diff --git a/app/lib/.server/llm/constants.ts b/app/shared/lib/.server/llm/constants.ts similarity index 100% rename from app/lib/.server/llm/constants.ts rename to app/shared/lib/.server/llm/constants.ts diff --git a/app/lib/.server/llm/create-summary.ts b/app/shared/lib/.server/llm/create-summary.ts similarity index 96% rename from app/lib/.server/llm/create-summary.ts rename to app/shared/lib/.server/llm/create-summary.ts index e21abd81..dd42dc66 100644 --- a/app/lib/.server/llm/create-summary.ts +++ b/app/shared/lib/.server/llm/create-summary.ts @@ -1,9 +1,9 @@ import { generateText, type CoreTool, type GenerateTextResult, type Message } from 'ai'; -import type { IProviderSetting } from '~/types/model'; -import { DEFAULT_MODEL, DEFAULT_PROVIDER, PROVIDER_LIST } from '~/utils/constants'; +import type { IProviderSetting } from '~/shared/types/model'; +import { DEFAULT_MODEL, DEFAULT_PROVIDER, PROVIDER_LIST } from '~/shared/utils/constants'; import { extractCurrentContext, extractPropertiesFromMessage, simplifyBoltActions } from './utils'; -import { createScopedLogger } from '~/utils/logger'; -import { LLMManager } from '~/lib/modules/llm/manager'; +import { createScopedLogger } from '~/shared/utils/logger'; +import { LLMManager } from '~/shared/lib/providers/manager'; const logger = createScopedLogger('create-summary'); diff --git a/app/lib/.server/llm/select-context.ts b/app/shared/lib/.server/llm/select-context.ts similarity index 97% rename from app/lib/.server/llm/select-context.ts rename to app/shared/lib/.server/llm/select-context.ts index 17afffd6..ac69e587 100644 --- a/app/lib/.server/llm/select-context.ts +++ b/app/shared/lib/.server/llm/select-context.ts @@ -1,11 +1,11 @@ import { generateText, type CoreTool, type GenerateTextResult, type Message } from 'ai'; import ignore from 'ignore'; -import type { IProviderSetting } from '~/types/model'; +import type { IProviderSetting } from '~/shared/types/model'; import { IGNORE_PATTERNS, type FileMap } from './constants'; -import { DEFAULT_MODEL, DEFAULT_PROVIDER, PROVIDER_LIST } from '~/utils/constants'; +import { DEFAULT_MODEL, DEFAULT_PROVIDER, PROVIDER_LIST } from '~/shared/utils/constants'; import { createFilesContext, extractCurrentContext, extractPropertiesFromMessage, simplifyBoltActions } from './utils'; -import { createScopedLogger } from '~/utils/logger'; -import { LLMManager } from '~/lib/modules/llm/manager'; +import { createScopedLogger } from '~/shared/utils/logger'; +import { LLMManager } from '~/shared/lib/providers/manager'; // Common patterns to ignore, similar to .gitignore diff --git a/app/shared/lib/.server/llm/stream-text.ts b/app/shared/lib/.server/llm/stream-text.ts new file mode 100644 index 00000000..8843c08c --- /dev/null +++ b/app/shared/lib/.server/llm/stream-text.ts @@ -0,0 +1,276 @@ +import { convertToCoreMessages, streamText as _streamText, type Message } from 'ai'; +import { MAX_TOKENS, type FileMap } from './constants'; +import { getSystemPrompt } from '~/shared/lib/prompts/prompt-variants/prompts'; +import { + DEFAULT_MODEL, + DEFAULT_PROVIDER, + MODIFICATIONS_TAG_NAME, + PROVIDER_LIST, + WORK_DIR, +} from '~/shared/utils/constants'; +import type { IProviderSetting } from '~/shared/types/model'; +import { PromptLibrary } from '~/shared/lib/prompts/prompt-library'; +import { allowedHTMLElements } from '~/shared/utils/markdown'; +import { LLMManager } from '~/shared/lib/providers/manager'; +import { createScopedLogger } from '~/shared/utils/logger'; +import { createFilesContext, extractPropertiesFromMessage } from './utils'; +import { discussPrompt } from '~/shared/lib/prompts/prompt-variants/discuss-prompt'; +import type { DesignScheme } from '~/shared/types/design-scheme'; + +export type Messages = Message[]; + +export interface StreamingOptions extends Omit[0], 'model'> { + supabaseConnection?: { + isConnected: boolean; + hasSelectedProject: boolean; + credentials?: { + anonKey?: string; + supabaseUrl?: string; + }; + }; +} + +interface StreamTextProps { + messages: Omit[]; + env?: Env; + options?: StreamingOptions; + apiKeys?: Record; + files?: FileMap; + providerSettings?: Record; + promptId?: string; + contextOptimization?: boolean; + contextFiles?: FileMap; + summary?: string; + messageSliceId?: number; + chatMode?: 'discuss' | 'build'; + designScheme?: DesignScheme; +} + +interface ProcessedMessage extends Omit { + content: string; +} + +interface ModelInfo { + details: any; + maxTokens: number; + provider: any; +} + +const logger = createScopedLogger('stream-text'); + +// Helper functions for better organization +function processMessages(messages: Omit[]): { + processedMessages: ProcessedMessage[]; + currentModel: string; + currentProvider: string; +} { + let currentModel = DEFAULT_MODEL; + let currentProvider = DEFAULT_PROVIDER.name; + + const processedMessages = messages.map((message) => { + if (message.role === 'user') { + const { model, provider, content } = extractPropertiesFromMessage(message); + currentModel = model; + currentProvider = provider; + + return { ...message, content }; + } else if (message.role === 'assistant') { + let content = message.content; + + // Remove thought tags + content = content.replace(/
.*?<\/div>/s, ''); + content = content.replace(/.*?<\/think>/s, ''); + + // Remove package-lock.json content + content = content.replace( + /[\s\S]*?<\/boltAction>/g, + '[package-lock.json content removed]', + ); + content = content.trim(); + + return { ...message, content }; + } + + return message; + }); + + return { processedMessages, currentModel, currentProvider }; +} + +async function resolveModelInfo( + currentProvider: string, + currentModel: string, + apiKeys?: Record, + providerSettings?: Record, + serverEnv?: any, +): Promise { + const provider = PROVIDER_LIST.find((p) => p.name === currentProvider) || DEFAULT_PROVIDER; + const staticModels = LLMManager.getInstance().getStaticModelListFromProvider(provider); + let modelDetails = staticModels.find((m) => m.name === currentModel); + + if (!modelDetails) { + const modelsList = [ + ...(provider.staticModels || []), + ...(await LLMManager.getInstance().getModelListFromProvider(provider, { + apiKeys, + providerSettings, + serverEnv: serverEnv as any, + })), + ]; + + if (!modelsList.length) { + throw new Error(`No models found for provider ${provider.name}`); + } + + modelDetails = modelsList.find((m) => m.name === currentModel); + + if (!modelDetails) { + logger.warn( + `MODEL [${currentModel}] not found in provider [${provider.name}]. Falling back to first model. ${modelsList[0].name}`, + ); + modelDetails = modelsList[0]; + } + } + + const maxTokens = modelDetails && modelDetails.maxTokenAllowed ? modelDetails.maxTokenAllowed : MAX_TOKENS; + logger.info( + `Max tokens for model ${modelDetails.name} is ${maxTokens} based on ${modelDetails.maxTokenAllowed} or ${MAX_TOKENS}`, + ); + + return { + details: modelDetails, + maxTokens, + provider, + }; +} + +function buildSystemPrompt(props: { + promptId?: string; + chatMode?: 'discuss' | 'build'; + contextFiles?: FileMap; + contextOptimization?: boolean; + summary?: string; + files?: FileMap; + designScheme?: DesignScheme; + supabaseConnection?: StreamingOptions['supabaseConnection']; + messageSliceId?: number; + processedMessages: ProcessedMessage[]; +}): { systemPrompt: string; finalMessages: ProcessedMessage[] } { + const { + promptId, + chatMode, + contextFiles, + contextOptimization, + summary, + files, + designScheme, + supabaseConnection, + messageSliceId, + processedMessages, + } = props; + + let systemPrompt = + PromptLibrary.getPropmtFromLibrary(promptId || 'default', { + cwd: WORK_DIR, + allowedHtmlElements: allowedHTMLElements, + modificationTagName: MODIFICATIONS_TAG_NAME, + designScheme, + supabase: { + isConnected: supabaseConnection?.isConnected || false, + hasSelectedProject: supabaseConnection?.hasSelectedProject || false, + credentials: supabaseConnection?.credentials || undefined, + }, + }) ?? getSystemPrompt(); + + let finalMessages = [...processedMessages]; + + // Add context buffer for build mode + if (chatMode === 'build' && contextFiles && contextOptimization) { + const codeContext = createFilesContext(contextFiles, true); + systemPrompt += `\n\nBelow is the artifact containing the context loaded into context buffer for you to have knowledge of and might need changes to fullfill current user request.\nCONTEXT BUFFER:\n---\n${codeContext}\n---\n`; + + // Add chat summary if available + if (summary) { + systemPrompt += `\nbelow is the chat history till now\nCHAT SUMMARY:\n---\n${summary}\n---\n`; + + // Slice messages if needed + if (messageSliceId) { + finalMessages = processedMessages.slice(messageSliceId); + } else { + const lastMessage = processedMessages.pop(); + + if (lastMessage) { + finalMessages = [lastMessage]; + } + } + } + } + + // Add locked files warning + if (files) { + const lockedFiles = Object.entries(files) + .filter(([, fileDetails]) => fileDetails?.isLocked) + .map(([filePath]) => filePath); + + if (lockedFiles.length > 0) { + const lockedFilesListString = lockedFiles.map((filePath) => `- ${filePath}`).join('\n'); + systemPrompt += `\n\nIMPORTANT: The following files are locked and MUST NOT be modified in any way. Do not suggest or make any changes to these files. You can proceed with the request but DO NOT make any changes to these files specifically:\n${lockedFilesListString}\n---\n`; + } + } + + return { systemPrompt, finalMessages }; +} + +export async function streamText(props: StreamTextProps) { + const { + messages, + env: serverEnv, + options, + apiKeys, + files, + providerSettings, + promptId, + contextOptimization, + contextFiles, + summary, + chatMode, + designScheme, + messageSliceId, + } = props; + + // 1. Process messages and extract model info + const { processedMessages, currentModel, currentProvider } = processMessages(messages); + + // 2. Resolve model information + const modelInfo = await resolveModelInfo(currentProvider, currentModel, apiKeys, providerSettings, serverEnv); + + // 3. Build system prompt + const { systemPrompt, finalMessages } = buildSystemPrompt({ + promptId, + chatMode, + contextFiles, + contextOptimization, + summary, + files, + designScheme, + supabaseConnection: options?.supabaseConnection, + messageSliceId, + processedMessages, + }); + + // 4. Make the LLM call + logger.info(`Sending llm call to ${modelInfo.provider.name} with model ${modelInfo.details.name}`); + + return await _streamText({ + model: modelInfo.provider.getModelInstance({ + model: modelInfo.details.name, + serverEnv, + apiKeys, + providerSettings, + }), + system: chatMode === 'build' ? systemPrompt : discussPrompt(), + maxTokens: modelInfo.maxTokens, + messages: convertToCoreMessages(finalMessages as any), + ...options, + }); +} diff --git a/app/lib/.server/llm/switchable-stream.ts b/app/shared/lib/.server/llm/switchable-stream.ts similarity index 100% rename from app/lib/.server/llm/switchable-stream.ts rename to app/shared/lib/.server/llm/switchable-stream.ts diff --git a/app/lib/.server/llm/utils.ts b/app/shared/lib/.server/llm/utils.ts similarity index 97% rename from app/lib/.server/llm/utils.ts rename to app/shared/lib/.server/llm/utils.ts index e019a929..7bfdc362 100644 --- a/app/lib/.server/llm/utils.ts +++ b/app/shared/lib/.server/llm/utils.ts @@ -1,8 +1,8 @@ import { type Message } from 'ai'; -import { DEFAULT_MODEL, DEFAULT_PROVIDER, MODEL_REGEX, PROVIDER_REGEX } from '~/utils/constants'; +import { DEFAULT_MODEL, DEFAULT_PROVIDER, MODEL_REGEX, PROVIDER_REGEX } from '~/shared/utils/constants'; import { IGNORE_PATTERNS, type FileMap } from './constants'; import ignore from 'ignore'; -import type { ContextAnnotation } from '~/types/context'; +import type { ContextAnnotation } from '~/shared/types/context'; export function extractPropertiesFromMessage(message: Omit): { model: string; diff --git a/app/lib/api/connection.ts b/app/shared/lib/api/connection.ts similarity index 100% rename from app/lib/api/connection.ts rename to app/shared/lib/api/connection.ts diff --git a/app/lib/api/cookies.ts b/app/shared/lib/api/cookies.ts similarity index 100% rename from app/lib/api/cookies.ts rename to app/shared/lib/api/cookies.ts diff --git a/app/lib/api/debug.ts b/app/shared/lib/api/debug.ts similarity index 100% rename from app/lib/api/debug.ts rename to app/shared/lib/api/debug.ts diff --git a/app/lib/api/features.ts b/app/shared/lib/api/features.ts similarity index 100% rename from app/lib/api/features.ts rename to app/shared/lib/api/features.ts diff --git a/app/lib/api/notifications.ts b/app/shared/lib/api/notifications.ts similarity index 93% rename from app/lib/api/notifications.ts rename to app/shared/lib/api/notifications.ts index fd439207..c4dafa87 100644 --- a/app/lib/api/notifications.ts +++ b/app/shared/lib/api/notifications.ts @@ -1,5 +1,5 @@ -import { logStore } from '~/lib/stores/logs'; -import type { LogEntry } from '~/lib/stores/logs'; +import { logStore } from '~/shared/stores/logs'; +import type { LogEntry } from '~/shared/stores/logs'; export interface Notification { id: string; diff --git a/app/lib/api/updates.ts b/app/shared/lib/api/updates.ts similarity index 100% rename from app/lib/api/updates.ts rename to app/shared/lib/api/updates.ts diff --git a/app/lib/crypto.ts b/app/shared/lib/crypto.ts similarity index 100% rename from app/lib/crypto.ts rename to app/shared/lib/crypto.ts diff --git a/app/lib/fetch.ts b/app/shared/lib/fetch.ts similarity index 100% rename from app/lib/fetch.ts rename to app/shared/lib/fetch.ts diff --git a/app/lib/persistence/ChatDescription.client.tsx b/app/shared/lib/persistence/ChatDescription.client.tsx similarity index 91% rename from app/lib/persistence/ChatDescription.client.tsx rename to app/shared/lib/persistence/ChatDescription.client.tsx index b5484675..8aa8bc4b 100644 --- a/app/lib/persistence/ChatDescription.client.tsx +++ b/app/shared/lib/persistence/ChatDescription.client.tsx @@ -1,8 +1,8 @@ import { useStore } from '@nanostores/react'; import { TooltipProvider } from '@radix-ui/react-tooltip'; -import WithTooltip from '~/components/ui/Tooltip'; -import { useEditChatDescription } from '~/lib/hooks'; -import { description as descriptionStore } from '~/lib/persistence'; +import WithTooltip from '~/shared/components/ui/Tooltip'; +import { useEditChatDescription } from '~/shared/hooks'; +import { description as descriptionStore } from '~/shared/lib/persistence'; export function ChatDescription() { const initialDescription = useStore(descriptionStore)!; diff --git a/app/lib/persistence/chats.ts b/app/shared/lib/persistence/chats.ts similarity index 100% rename from app/lib/persistence/chats.ts rename to app/shared/lib/persistence/chats.ts diff --git a/app/lib/persistence/db.ts b/app/shared/lib/persistence/db.ts similarity index 99% rename from app/lib/persistence/db.ts rename to app/shared/lib/persistence/db.ts index 86425fda..bc71543c 100644 --- a/app/lib/persistence/db.ts +++ b/app/shared/lib/persistence/db.ts @@ -1,5 +1,5 @@ import type { Message } from 'ai'; -import { createScopedLogger } from '~/utils/logger'; +import { createScopedLogger } from '~/shared/utils/logger'; import type { ChatHistoryItem } from './useChatHistory'; import type { Snapshot } from './types'; // Import Snapshot type diff --git a/app/lib/persistence/index.ts b/app/shared/lib/persistence/index.ts similarity index 100% rename from app/lib/persistence/index.ts rename to app/shared/lib/persistence/index.ts diff --git a/app/lib/persistence/localStorage.ts b/app/shared/lib/persistence/localStorage.ts similarity index 100% rename from app/lib/persistence/localStorage.ts rename to app/shared/lib/persistence/localStorage.ts diff --git a/app/lib/persistence/lockedFiles.ts b/app/shared/lib/persistence/lockedFiles.ts similarity index 99% rename from app/lib/persistence/lockedFiles.ts rename to app/shared/lib/persistence/lockedFiles.ts index 6d6a6a4f..95300c45 100644 --- a/app/lib/persistence/lockedFiles.ts +++ b/app/shared/lib/persistence/lockedFiles.ts @@ -1,4 +1,4 @@ -import { createScopedLogger } from '~/utils/logger'; +import { createScopedLogger } from '~/shared/utils/logger'; const logger = createScopedLogger('LockedFiles'); diff --git a/app/lib/persistence/types.ts b/app/shared/lib/persistence/types.ts similarity index 58% rename from app/lib/persistence/types.ts rename to app/shared/lib/persistence/types.ts index 56dacd61..0ff04215 100644 --- a/app/lib/persistence/types.ts +++ b/app/shared/lib/persistence/types.ts @@ -1,4 +1,4 @@ -import type { FileMap } from '~/lib/stores/files'; +import type { FileMap } from '~/shared/workbench/stores/files'; export interface Snapshot { chatIndex: string; diff --git a/app/lib/persistence/useChatHistory.ts b/app/shared/lib/persistence/useChatHistory.ts similarity index 97% rename from app/lib/persistence/useChatHistory.ts rename to app/shared/lib/persistence/useChatHistory.ts index 618659b5..5cc24029 100644 --- a/app/lib/persistence/useChatHistory.ts +++ b/app/shared/lib/persistence/useChatHistory.ts @@ -3,8 +3,8 @@ import { useState, useEffect, useCallback } from 'react'; import { atom } from 'nanostores'; import { generateId, type JSONValue, type Message } from 'ai'; import { toast } from 'react-toastify'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { logStore } from '~/lib/stores/logs'; // Import logStore +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { logStore } from '~/shared/stores/logs'; // Import logStore import { getMessages, getNextId, @@ -17,11 +17,11 @@ import { setSnapshot, type IChatMetadata, } from './db'; -import type { FileMap } from '~/lib/stores/files'; +import type { FileMap } from '~/shared/workbench/stores/files'; import type { Snapshot } from './types'; -import { webcontainer } from '~/lib/webcontainer'; -import { detectProjectCommands, createCommandActionsString } from '~/utils/projectCommands'; -import type { ContextAnnotation } from '~/types/context'; +import { webcontainer } from '~/shared/lib/webcontainer'; +import { detectProjectCommands, createCommandActionsString } from '~/shared/utils/projectCommands'; +import type { ContextAnnotation } from '~/shared/types/context'; export interface ChatHistoryItem { id: string; diff --git a/app/lib/common/prompt-library.ts b/app/shared/lib/prompts/prompt-library.ts similarity index 86% rename from app/lib/common/prompt-library.ts rename to app/shared/lib/prompts/prompt-library.ts index 0054f20a..b255e5e1 100644 --- a/app/lib/common/prompt-library.ts +++ b/app/shared/lib/prompts/prompt-library.ts @@ -1,7 +1,7 @@ -import { getSystemPrompt } from './prompts/prompts'; -import optimized from './prompts/optimized'; -import { getFineTunedPrompt } from './prompts/new-prompt'; -import type { DesignScheme } from '~/types/design-scheme'; +import { getSystemPrompt } from './prompt-variants/prompts'; +import optimized from './prompt-variants/optimized'; +import { getFineTunedPrompt } from './prompt-variants/new-prompt'; +import type { DesignScheme } from '~/shared/types/design-scheme'; export interface PromptOptions { cwd: string; diff --git a/app/lib/common/prompts/discuss-prompt.ts b/app/shared/lib/prompts/prompt-variants/discuss-prompt.ts similarity index 100% rename from app/lib/common/prompts/discuss-prompt.ts rename to app/shared/lib/prompts/prompt-variants/discuss-prompt.ts diff --git a/app/lib/common/prompts/new-prompt.ts b/app/shared/lib/prompts/prompt-variants/new-prompt.ts similarity index 98% rename from app/lib/common/prompts/new-prompt.ts rename to app/shared/lib/prompts/prompt-variants/new-prompt.ts index 60d97e7a..f5313430 100644 --- a/app/lib/common/prompts/new-prompt.ts +++ b/app/shared/lib/prompts/prompt-variants/new-prompt.ts @@ -1,7 +1,7 @@ -import type { DesignScheme } from '~/types/design-scheme'; -import { WORK_DIR } from '~/utils/constants'; -import { allowedHTMLElements } from '~/utils/markdown'; -import { stripIndents } from '~/utils/stripIndent'; +import type { DesignScheme } from '~/shared/types/design-scheme'; +import { WORK_DIR } from '~/shared/utils/constants'; +import { allowedHTMLElements } from '~/shared/utils/markdown'; +import { stripIndents } from '~/shared/utils/stripIndent'; export const getFineTunedPrompt = ( cwd: string = WORK_DIR, diff --git a/app/lib/common/prompts/optimized.ts b/app/shared/lib/prompts/prompt-variants/optimized.ts similarity index 99% rename from app/lib/common/prompts/optimized.ts rename to app/shared/lib/prompts/prompt-variants/optimized.ts index 9523b0ba..d5133639 100644 --- a/app/lib/common/prompts/optimized.ts +++ b/app/shared/lib/prompts/prompt-variants/optimized.ts @@ -1,4 +1,4 @@ -import type { PromptOptions } from '~/lib/common/prompt-library'; +import type { PromptOptions } from '~/shared/lib/prompts/prompt-library'; export default (options: PromptOptions) => { const { cwd, allowedHtmlElements, supabase } = options; diff --git a/app/lib/common/prompts/prompts.ts b/app/shared/lib/prompts/prompt-variants/prompts.ts similarity index 99% rename from app/lib/common/prompts/prompts.ts rename to app/shared/lib/prompts/prompt-variants/prompts.ts index ef1a83d8..e395586e 100644 --- a/app/lib/common/prompts/prompts.ts +++ b/app/shared/lib/prompts/prompt-variants/prompts.ts @@ -1,7 +1,7 @@ -import type { DesignScheme } from '~/types/design-scheme'; -import { WORK_DIR } from '~/utils/constants'; -import { allowedHTMLElements } from '~/utils/markdown'; -import { stripIndents } from '~/utils/stripIndent'; +import type { DesignScheme } from '~/shared/types/design-scheme'; +import { WORK_DIR } from '~/shared/utils/constants'; +import { allowedHTMLElements } from '~/shared/utils/markdown'; +import { stripIndents } from '~/shared/utils/stripIndent'; export const getSystemPrompt = ( cwd: string = WORK_DIR, diff --git a/app/lib/modules/llm/providers/amazon-bedrock.ts b/app/shared/lib/providers/adapters/amazon-bedrock.ts similarity index 94% rename from app/lib/modules/llm/providers/amazon-bedrock.ts rename to app/shared/lib/providers/adapters/amazon-bedrock.ts index 6a4cbc96..e81aa4b9 100644 --- a/app/lib/modules/llm/providers/amazon-bedrock.ts +++ b/app/shared/lib/providers/adapters/amazon-bedrock.ts @@ -1,7 +1,7 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; import type { LanguageModelV1 } from 'ai'; -import type { IProviderSetting } from '~/types/model'; +import type { IProviderSetting } from '~/shared/types/model'; import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock'; interface AWSBedRockConfig { diff --git a/app/lib/modules/llm/providers/anthropic.ts b/app/shared/lib/providers/adapters/anthropic.ts similarity index 93% rename from app/lib/modules/llm/providers/anthropic.ts rename to app/shared/lib/providers/adapters/anthropic.ts index b67d695c..809e71c5 100644 --- a/app/lib/modules/llm/providers/anthropic.ts +++ b/app/shared/lib/providers/adapters/anthropic.ts @@ -1,7 +1,7 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; import type { LanguageModelV1 } from 'ai'; -import type { IProviderSetting } from '~/types/model'; +import type { IProviderSetting } from '~/shared/types/model'; import { createAnthropic } from '@ai-sdk/anthropic'; export default class AnthropicProvider extends BaseProvider { diff --git a/app/lib/modules/llm/providers/cohere.ts b/app/shared/lib/providers/adapters/cohere.ts similarity index 91% rename from app/lib/modules/llm/providers/cohere.ts rename to app/shared/lib/providers/adapters/cohere.ts index 9233b966..e7576345 100644 --- a/app/lib/modules/llm/providers/cohere.ts +++ b/app/shared/lib/providers/adapters/cohere.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createCohere } from '@ai-sdk/cohere'; diff --git a/app/lib/modules/llm/providers/deepseek.ts b/app/shared/lib/providers/adapters/deepseek.ts similarity index 87% rename from app/lib/modules/llm/providers/deepseek.ts rename to app/shared/lib/providers/adapters/deepseek.ts index e0e72571..35561484 100644 --- a/app/lib/modules/llm/providers/deepseek.ts +++ b/app/shared/lib/providers/adapters/deepseek.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createDeepSeek } from '@ai-sdk/deepseek'; diff --git a/app/lib/modules/llm/providers/github.ts b/app/shared/lib/providers/adapters/github.ts similarity index 90% rename from app/lib/modules/llm/providers/github.ts rename to app/shared/lib/providers/adapters/github.ts index 56745fde..3b1baa1d 100644 --- a/app/lib/modules/llm/providers/github.ts +++ b/app/shared/lib/providers/adapters/github.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createOpenAI } from '@ai-sdk/openai'; diff --git a/app/lib/modules/llm/providers/google.ts b/app/shared/lib/providers/adapters/google.ts similarity index 94% rename from app/lib/modules/llm/providers/google.ts rename to app/shared/lib/providers/adapters/google.ts index 67043bad..f9cbd361 100644 --- a/app/lib/modules/llm/providers/google.ts +++ b/app/shared/lib/providers/adapters/google.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createGoogleGenerativeAI } from '@ai-sdk/google'; diff --git a/app/lib/modules/llm/providers/groq.ts b/app/shared/lib/providers/adapters/groq.ts similarity index 93% rename from app/lib/modules/llm/providers/groq.ts rename to app/shared/lib/providers/adapters/groq.ts index e9d2b0bd..5b035ab6 100644 --- a/app/lib/modules/llm/providers/groq.ts +++ b/app/shared/lib/providers/adapters/groq.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createOpenAI } from '@ai-sdk/openai'; diff --git a/app/lib/modules/llm/providers/huggingface.ts b/app/shared/lib/providers/adapters/huggingface.ts similarity index 93% rename from app/lib/modules/llm/providers/huggingface.ts rename to app/shared/lib/providers/adapters/huggingface.ts index 996dbfce..4d69e0fa 100644 --- a/app/lib/modules/llm/providers/huggingface.ts +++ b/app/shared/lib/providers/adapters/huggingface.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createOpenAI } from '@ai-sdk/openai'; diff --git a/app/lib/modules/llm/providers/hyperbolic.ts b/app/shared/lib/providers/adapters/hyperbolic.ts similarity index 93% rename from app/lib/modules/llm/providers/hyperbolic.ts rename to app/shared/lib/providers/adapters/hyperbolic.ts index b91a81bc..020afae8 100644 --- a/app/lib/modules/llm/providers/hyperbolic.ts +++ b/app/shared/lib/providers/adapters/hyperbolic.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createOpenAI } from '@ai-sdk/openai'; diff --git a/app/lib/modules/llm/providers/lmstudio.ts b/app/shared/lib/providers/adapters/lmstudio.ts similarity index 91% rename from app/lib/modules/llm/providers/lmstudio.ts rename to app/shared/lib/providers/adapters/lmstudio.ts index fe5b27cd..d483c513 100644 --- a/app/lib/modules/llm/providers/lmstudio.ts +++ b/app/shared/lib/providers/adapters/lmstudio.ts @@ -1,9 +1,9 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import { createOpenAI } from '@ai-sdk/openai'; import type { LanguageModelV1 } from 'ai'; -import { logger } from '~/utils/logger'; +import { logger } from '~/shared/utils/logger'; export default class LMStudioProvider extends BaseProvider { name = 'LMStudio'; diff --git a/app/lib/modules/llm/providers/mistral.ts b/app/shared/lib/providers/adapters/mistral.ts similarity index 90% rename from app/lib/modules/llm/providers/mistral.ts rename to app/shared/lib/providers/adapters/mistral.ts index c5becee0..5a8334c0 100644 --- a/app/lib/modules/llm/providers/mistral.ts +++ b/app/shared/lib/providers/adapters/mistral.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createMistral } from '@ai-sdk/mistral'; diff --git a/app/lib/modules/llm/providers/ollama.ts b/app/shared/lib/providers/adapters/ollama.ts similarity index 94% rename from app/lib/modules/llm/providers/ollama.ts rename to app/shared/lib/providers/adapters/ollama.ts index e50ecae5..d63b8612 100644 --- a/app/lib/modules/llm/providers/ollama.ts +++ b/app/shared/lib/providers/adapters/ollama.ts @@ -1,9 +1,9 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { ollama } from 'ollama-ai-provider'; -import { logger } from '~/utils/logger'; +import { logger } from '~/shared/utils/logger'; interface OllamaModelDetails { parent_model: string; diff --git a/app/lib/modules/llm/providers/open-router.ts b/app/shared/lib/providers/adapters/open-router.ts similarity index 94% rename from app/lib/modules/llm/providers/open-router.ts rename to app/shared/lib/providers/adapters/open-router.ts index 242f8f7d..1a3cc59f 100644 --- a/app/lib/modules/llm/providers/open-router.ts +++ b/app/shared/lib/providers/adapters/open-router.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createOpenRouter } from '@openrouter/ai-sdk-provider'; diff --git a/app/lib/modules/llm/providers/openai-like.ts b/app/shared/lib/providers/adapters/openai-like.ts similarity index 89% rename from app/lib/modules/llm/providers/openai-like.ts rename to app/shared/lib/providers/adapters/openai-like.ts index f33f21ed..8f7d171f 100644 --- a/app/lib/modules/llm/providers/openai-like.ts +++ b/app/shared/lib/providers/adapters/openai-like.ts @@ -1,6 +1,6 @@ -import { BaseProvider, getOpenAILikeModel } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider, getOpenAILikeModel } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; export default class OpenAILikeProvider extends BaseProvider { diff --git a/app/lib/modules/llm/providers/openai.ts b/app/shared/lib/providers/adapters/openai.ts similarity index 93% rename from app/lib/modules/llm/providers/openai.ts rename to app/shared/lib/providers/adapters/openai.ts index b6193b91..aa9ece67 100644 --- a/app/lib/modules/llm/providers/openai.ts +++ b/app/shared/lib/providers/adapters/openai.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createOpenAI } from '@ai-sdk/openai'; diff --git a/app/lib/modules/llm/providers/perplexity.ts b/app/shared/lib/providers/adapters/perplexity.ts similarity index 88% rename from app/lib/modules/llm/providers/perplexity.ts rename to app/shared/lib/providers/adapters/perplexity.ts index eb58d745..b7d9f798 100644 --- a/app/lib/modules/llm/providers/perplexity.ts +++ b/app/shared/lib/providers/adapters/perplexity.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createOpenAI } from '@ai-sdk/openai'; diff --git a/app/lib/modules/llm/providers/together.ts b/app/shared/lib/providers/adapters/together.ts similarity index 92% rename from app/lib/modules/llm/providers/together.ts rename to app/shared/lib/providers/adapters/together.ts index 2e11f64b..4a16a564 100644 --- a/app/lib/modules/llm/providers/together.ts +++ b/app/shared/lib/providers/adapters/together.ts @@ -1,6 +1,6 @@ -import { BaseProvider, getOpenAILikeModel } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider, getOpenAILikeModel } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; export default class TogetherProvider extends BaseProvider { diff --git a/app/lib/modules/llm/providers/xai.ts b/app/shared/lib/providers/adapters/xai.ts similarity index 87% rename from app/lib/modules/llm/providers/xai.ts rename to app/shared/lib/providers/adapters/xai.ts index 64191d2e..0f58efbd 100644 --- a/app/lib/modules/llm/providers/xai.ts +++ b/app/shared/lib/providers/adapters/xai.ts @@ -1,6 +1,6 @@ -import { BaseProvider } from '~/lib/modules/llm/base-provider'; -import type { ModelInfo } from '~/lib/modules/llm/types'; -import type { IProviderSetting } from '~/types/model'; +import { BaseProvider } from '~/shared/lib/providers/base-provider'; +import type { ModelInfo } from '~/shared/lib/providers/types'; +import type { IProviderSetting } from '~/shared/types/model'; import type { LanguageModelV1 } from 'ai'; import { createOpenAI } from '@ai-sdk/openai'; diff --git a/app/lib/modules/llm/base-provider.ts b/app/shared/lib/providers/base-provider.ts similarity index 98% rename from app/lib/modules/llm/base-provider.ts rename to app/shared/lib/providers/base-provider.ts index 9cb23403..6eb48e66 100644 --- a/app/lib/modules/llm/base-provider.ts +++ b/app/shared/lib/providers/base-provider.ts @@ -1,6 +1,6 @@ import type { LanguageModelV1 } from 'ai'; import type { ProviderInfo, ProviderConfig, ModelInfo } from './types'; -import type { IProviderSetting } from '~/types/model'; +import type { IProviderSetting } from '~/shared/types/model'; import { createOpenAI } from '@ai-sdk/openai'; import { LLMManager } from './manager'; diff --git a/app/lib/modules/llm/manager.ts b/app/shared/lib/providers/manager.ts similarity index 98% rename from app/lib/modules/llm/manager.ts rename to app/shared/lib/providers/manager.ts index aec91905..fc515009 100644 --- a/app/lib/modules/llm/manager.ts +++ b/app/shared/lib/providers/manager.ts @@ -1,8 +1,8 @@ -import type { IProviderSetting } from '~/types/model'; +import type { IProviderSetting } from '~/shared/types/model'; import { BaseProvider } from './base-provider'; import type { ModelInfo, ProviderInfo } from './types'; import * as providers from './registry'; -import { createScopedLogger } from '~/utils/logger'; +import { createScopedLogger } from '~/shared/utils/logger'; const logger = createScopedLogger('LLMManager'); export class LLMManager { diff --git a/app/shared/lib/providers/registry.ts b/app/shared/lib/providers/registry.ts new file mode 100644 index 00000000..5a669c88 --- /dev/null +++ b/app/shared/lib/providers/registry.ts @@ -0,0 +1,39 @@ +import AnthropicProvider from './adapters/anthropic'; +import CohereProvider from './adapters/cohere'; +import DeepseekProvider from './adapters/deepseek'; +import GoogleProvider from './adapters/google'; +import GroqProvider from './adapters/groq'; +import HuggingFaceProvider from './adapters/huggingface'; +import LMStudioProvider from './adapters/lmstudio'; +import MistralProvider from './adapters/mistral'; +import OllamaProvider from './adapters/ollama'; +import OpenRouterProvider from './adapters/open-router'; +import OpenAILikeProvider from './adapters/openai-like'; +import OpenAIProvider from './adapters/openai'; +import PerplexityProvider from './adapters/perplexity'; +import TogetherProvider from './adapters/together'; +import XAIProvider from './adapters/xai'; +import HyperbolicProvider from './adapters/hyperbolic'; +import AmazonBedrockProvider from './adapters/amazon-bedrock'; +import GithubProvider from './adapters/github'; + +export { + AnthropicProvider, + CohereProvider, + DeepseekProvider, + GoogleProvider, + GroqProvider, + HuggingFaceProvider, + HyperbolicProvider, + MistralProvider, + OllamaProvider, + OpenAIProvider, + OpenRouterProvider, + OpenAILikeProvider, + PerplexityProvider, + XAIProvider, + TogetherProvider, + LMStudioProvider, + AmazonBedrockProvider, + GithubProvider, +}; diff --git a/app/lib/modules/llm/types.ts b/app/shared/lib/providers/types.ts similarity index 92% rename from app/lib/modules/llm/types.ts rename to app/shared/lib/providers/types.ts index 421d6dfc..f18201fd 100644 --- a/app/lib/modules/llm/types.ts +++ b/app/shared/lib/providers/types.ts @@ -1,5 +1,5 @@ import type { LanguageModelV1 } from 'ai'; -import type { IProviderSetting } from '~/types/model'; +import type { IProviderSetting } from '~/shared/types/model'; export interface ModelInfo { name: string; diff --git a/app/lib/runtime/__snapshots__/message-parser.spec.ts.snap b/app/shared/lib/runtime/__snapshots__/message-parser.spec.ts.snap similarity index 100% rename from app/lib/runtime/__snapshots__/message-parser.spec.ts.snap rename to app/shared/lib/runtime/__snapshots__/message-parser.spec.ts.snap diff --git a/app/lib/runtime/action-runner.ts b/app/shared/lib/runtime/action-runner.ts similarity index 97% rename from app/lib/runtime/action-runner.ts rename to app/shared/lib/runtime/action-runner.ts index a3436a9f..af9f4578 100644 --- a/app/lib/runtime/action-runner.ts +++ b/app/shared/lib/runtime/action-runner.ts @@ -1,11 +1,18 @@ import type { WebContainer } from '@webcontainer/api'; -import { path as nodePath } from '~/utils/path'; +import { path as nodePath } from '~/shared/utils/path'; import { atom, map, type MapStore } from 'nanostores'; -import type { ActionAlert, BoltAction, DeployAlert, FileHistory, SupabaseAction, SupabaseAlert } from '~/types/actions'; -import { createScopedLogger } from '~/utils/logger'; -import { unreachable } from '~/utils/unreachable'; +import type { + ActionAlert, + BoltAction, + DeployAlert, + FileHistory, + SupabaseAction, + SupabaseAlert, +} from '~/shared/types/actions'; +import { createScopedLogger } from '~/shared/utils/logger'; +import { unreachable } from '~/shared/utils/unreachable'; import type { ActionCallbackData } from './message-parser'; -import type { BoltShell } from '~/utils/shell'; +import type { BoltShell } from '~/shared/utils/shell'; const logger = createScopedLogger('ActionRunner'); diff --git a/app/lib/runtime/message-parser.spec.ts b/app/shared/lib/runtime/message-parser.spec.ts similarity index 100% rename from app/lib/runtime/message-parser.spec.ts rename to app/shared/lib/runtime/message-parser.spec.ts diff --git a/app/lib/runtime/message-parser.ts b/app/shared/lib/runtime/message-parser.ts similarity index 97% rename from app/lib/runtime/message-parser.ts rename to app/shared/lib/runtime/message-parser.ts index cfe65268..d57bf108 100644 --- a/app/lib/runtime/message-parser.ts +++ b/app/shared/lib/runtime/message-parser.ts @@ -1,7 +1,14 @@ -import type { ActionType, BoltAction, BoltActionData, FileAction, ShellAction, SupabaseAction } from '~/types/actions'; -import type { BoltArtifactData } from '~/types/artifact'; -import { createScopedLogger } from '~/utils/logger'; -import { unreachable } from '~/utils/unreachable'; +import type { + ActionType, + BoltAction, + BoltActionData, + FileAction, + ShellAction, + SupabaseAction, +} from '~/shared/types/actions'; +import type { BoltArtifactData } from '~/shared/types/artifact'; +import { createScopedLogger } from '~/shared/utils/logger'; +import { unreachable } from '~/shared/utils/unreachable'; const ARTIFACT_TAG_OPEN = ' { webcontainerContext.loaded = true; - const { workbenchStore } = await import('~/lib/stores/workbench'); + const { workbenchStore } = await import('~/shared/workbench/stores/workbench'); const response = await fetch('/inspector-script.js'); const inspectorScript = await response.text(); diff --git a/app/lib/stores/logs.ts b/app/shared/stores/logs.ts similarity index 99% rename from app/lib/stores/logs.ts rename to app/shared/stores/logs.ts index a86a2bb3..0f4e66ef 100644 --- a/app/lib/stores/logs.ts +++ b/app/shared/stores/logs.ts @@ -1,6 +1,6 @@ import { atom, map } from 'nanostores'; import Cookies from 'js-cookie'; -import { createScopedLogger } from '~/utils/logger'; +import { createScopedLogger } from '~/shared/utils/logger'; const logger = createScopedLogger('LogStore'); diff --git a/app/lib/stores/netlify.ts b/app/shared/stores/netlify.ts similarity index 97% rename from app/lib/stores/netlify.ts rename to app/shared/stores/netlify.ts index e9383fba..87419566 100644 --- a/app/lib/stores/netlify.ts +++ b/app/shared/stores/netlify.ts @@ -1,5 +1,5 @@ import { atom } from 'nanostores'; -import type { NetlifyConnection, NetlifyUser } from '~/types/netlify'; +import type { NetlifyConnection, NetlifyUser } from '~/shared/types/netlify'; import { logStore } from './logs'; import { toast } from 'react-toastify'; diff --git a/app/lib/stores/profile.ts b/app/shared/stores/profile.ts similarity index 100% rename from app/lib/stores/profile.ts rename to app/shared/stores/profile.ts diff --git a/app/lib/stores/streaming.ts b/app/shared/stores/streaming.ts similarity index 100% rename from app/lib/stores/streaming.ts rename to app/shared/stores/streaming.ts diff --git a/app/lib/stores/supabase.ts b/app/shared/stores/supabase.ts similarity index 99% rename from app/lib/stores/supabase.ts rename to app/shared/stores/supabase.ts index 72540914..979003db 100644 --- a/app/lib/stores/supabase.ts +++ b/app/shared/stores/supabase.ts @@ -1,5 +1,5 @@ import { atom } from 'nanostores'; -import type { SupabaseUser, SupabaseStats, SupabaseApiKey, SupabaseCredentials } from '~/types/supabase'; +import type { SupabaseUser, SupabaseStats, SupabaseApiKey, SupabaseCredentials } from '~/shared/types/supabase'; export interface SupabaseProject { id: string; diff --git a/app/lib/stores/theme.ts b/app/shared/stores/theme.ts similarity index 100% rename from app/lib/stores/theme.ts rename to app/shared/stores/theme.ts diff --git a/app/lib/stores/vercel.ts b/app/shared/stores/vercel.ts similarity index 97% rename from app/lib/stores/vercel.ts rename to app/shared/stores/vercel.ts index 3258642c..723c2385 100644 --- a/app/lib/stores/vercel.ts +++ b/app/shared/stores/vercel.ts @@ -1,5 +1,5 @@ import { atom } from 'nanostores'; -import type { VercelConnection } from '~/types/vercel'; +import type { VercelConnection } from '~/shared/types/vercel'; import { logStore } from './logs'; import { toast } from 'react-toastify'; diff --git a/app/types/actions.ts b/app/shared/types/actions.ts similarity index 100% rename from app/types/actions.ts rename to app/shared/types/actions.ts diff --git a/app/types/artifact.ts b/app/shared/types/artifact.ts similarity index 100% rename from app/types/artifact.ts rename to app/shared/types/artifact.ts diff --git a/app/types/context.ts b/app/shared/types/context.ts similarity index 100% rename from app/types/context.ts rename to app/shared/types/context.ts diff --git a/app/types/design-scheme.ts b/app/shared/types/design-scheme.ts similarity index 100% rename from app/types/design-scheme.ts rename to app/shared/types/design-scheme.ts diff --git a/app/types/global.d.ts b/app/shared/types/global.d.ts similarity index 100% rename from app/types/global.d.ts rename to app/shared/types/global.d.ts diff --git a/app/types/model.ts b/app/shared/types/model.ts similarity index 88% rename from app/types/model.ts rename to app/shared/types/model.ts index d16b10ae..a8f28381 100644 --- a/app/types/model.ts +++ b/app/shared/types/model.ts @@ -1,4 +1,4 @@ -import type { ModelInfo } from '~/lib/modules/llm/types'; +import type { ModelInfo } from '~/shared/lib/providers/types'; export type ProviderInfo = { staticModels: ModelInfo[]; diff --git a/app/types/netlify.ts b/app/shared/types/netlify.ts similarity index 100% rename from app/types/netlify.ts rename to app/shared/types/netlify.ts diff --git a/app/types/supabase.ts b/app/shared/types/supabase.ts similarity index 100% rename from app/types/supabase.ts rename to app/shared/types/supabase.ts diff --git a/app/types/template.ts b/app/shared/types/template.ts similarity index 100% rename from app/types/template.ts rename to app/shared/types/template.ts diff --git a/app/types/theme.ts b/app/shared/types/theme.ts similarity index 100% rename from app/types/theme.ts rename to app/shared/types/theme.ts diff --git a/app/types/vercel.ts b/app/shared/types/vercel.ts similarity index 100% rename from app/types/vercel.ts rename to app/shared/types/vercel.ts diff --git a/app/utils/buffer.ts b/app/shared/utils/buffer.ts similarity index 100% rename from app/utils/buffer.ts rename to app/shared/utils/buffer.ts diff --git a/app/utils/classNames.ts b/app/shared/utils/classNames.ts similarity index 100% rename from app/utils/classNames.ts rename to app/shared/utils/classNames.ts diff --git a/app/utils/constants.ts b/app/shared/utils/constants.ts similarity index 97% rename from app/utils/constants.ts rename to app/shared/utils/constants.ts index df610404..7ce64081 100644 --- a/app/utils/constants.ts +++ b/app/shared/utils/constants.ts @@ -1,5 +1,5 @@ -import { LLMManager } from '~/lib/modules/llm/manager'; -import type { Template } from '~/types/template'; +import { LLMManager } from '~/shared/lib/providers/manager'; +import type { Template } from '~/shared/types/template'; export const WORK_DIR_NAME = 'project'; export const WORK_DIR = `/home/${WORK_DIR_NAME}`; diff --git a/app/utils/debounce.ts b/app/shared/utils/debounce.ts similarity index 100% rename from app/utils/debounce.ts rename to app/shared/utils/debounce.ts diff --git a/app/utils/diff.spec.ts b/app/shared/utils/diff.spec.ts similarity index 100% rename from app/utils/diff.spec.ts rename to app/shared/utils/diff.spec.ts diff --git a/app/utils/diff.ts b/app/shared/utils/diff.ts similarity index 98% rename from app/utils/diff.ts rename to app/shared/utils/diff.ts index 25cde26f..9119b37f 100644 --- a/app/utils/diff.ts +++ b/app/shared/utils/diff.ts @@ -1,5 +1,5 @@ import { createTwoFilesPatch } from 'diff'; -import type { FileMap } from '~/lib/stores/files'; +import type { FileMap } from '~/shared/workbench/stores/files'; import { MODIFICATIONS_TAG_NAME, WORK_DIR } from './constants'; export const modificationsRegex = new RegExp( diff --git a/app/utils/easings.ts b/app/shared/utils/easings.ts similarity index 100% rename from app/utils/easings.ts rename to app/shared/utils/easings.ts diff --git a/app/utils/file-watcher.ts b/app/shared/utils/file-watcher.ts similarity index 100% rename from app/utils/file-watcher.ts rename to app/shared/utils/file-watcher.ts diff --git a/app/utils/fileLocks.ts b/app/shared/utils/fileLocks.ts similarity index 98% rename from app/utils/fileLocks.ts rename to app/shared/utils/fileLocks.ts index 4a28a30a..b140fa46 100644 --- a/app/utils/fileLocks.ts +++ b/app/shared/utils/fileLocks.ts @@ -3,7 +3,7 @@ import { isFileLocked as isFileLockedInternal, isFolderLocked as isFolderLockedInternal, isPathInLockedFolder, -} from '~/lib/persistence/lockedFiles'; +} from '~/shared/lib/persistence/lockedFiles'; import { createScopedLogger } from './logger'; const logger = createScopedLogger('FileLocks'); diff --git a/app/utils/fileUtils.ts b/app/shared/utils/fileUtils.ts similarity index 100% rename from app/utils/fileUtils.ts rename to app/shared/utils/fileUtils.ts diff --git a/app/utils/folderImport.ts b/app/shared/utils/folderImport.ts similarity index 100% rename from app/utils/folderImport.ts rename to app/shared/utils/folderImport.ts diff --git a/app/utils/formatSize.ts b/app/shared/utils/formatSize.ts similarity index 100% rename from app/utils/formatSize.ts rename to app/shared/utils/formatSize.ts diff --git a/app/utils/getLanguageFromExtension.ts b/app/shared/utils/getLanguageFromExtension.ts similarity index 100% rename from app/utils/getLanguageFromExtension.ts rename to app/shared/utils/getLanguageFromExtension.ts diff --git a/app/utils/logger.ts b/app/shared/utils/logger.ts similarity index 100% rename from app/utils/logger.ts rename to app/shared/utils/logger.ts diff --git a/app/utils/markdown.ts b/app/shared/utils/markdown.ts similarity index 100% rename from app/utils/markdown.ts rename to app/shared/utils/markdown.ts diff --git a/app/utils/mobile.ts b/app/shared/utils/mobile.ts similarity index 100% rename from app/utils/mobile.ts rename to app/shared/utils/mobile.ts diff --git a/app/utils/os.ts b/app/shared/utils/os.ts similarity index 100% rename from app/utils/os.ts rename to app/shared/utils/os.ts diff --git a/app/utils/path.ts b/app/shared/utils/path.ts similarity index 100% rename from app/utils/path.ts rename to app/shared/utils/path.ts diff --git a/app/utils/projectCommands.ts b/app/shared/utils/projectCommands.ts similarity index 100% rename from app/utils/projectCommands.ts rename to app/shared/utils/projectCommands.ts diff --git a/app/utils/promises.ts b/app/shared/utils/promises.ts similarity index 100% rename from app/utils/promises.ts rename to app/shared/utils/promises.ts diff --git a/app/utils/react.ts b/app/shared/utils/react.ts similarity index 100% rename from app/utils/react.ts rename to app/shared/utils/react.ts diff --git a/app/utils/sampler.ts b/app/shared/utils/sampler.ts similarity index 100% rename from app/utils/sampler.ts rename to app/shared/utils/sampler.ts diff --git a/app/utils/selectStarterTemplate.ts b/app/shared/utils/selectStarterTemplate.ts similarity index 98% rename from app/utils/selectStarterTemplate.ts rename to app/shared/utils/selectStarterTemplate.ts index 2e725e4a..2bc8b472 100644 --- a/app/utils/selectStarterTemplate.ts +++ b/app/shared/utils/selectStarterTemplate.ts @@ -1,6 +1,6 @@ import ignore from 'ignore'; -import type { ProviderInfo } from '~/types/model'; -import type { Template } from '~/types/template'; +import type { ProviderInfo } from '~/shared/types/model'; +import type { Template } from '~/shared/types/template'; import { STARTER_TEMPLATES } from './constants'; const starterTemplateSelectionPrompt = (templates: Template[]) => ` diff --git a/app/utils/shell.ts b/app/shared/utils/shell.ts similarity index 98% rename from app/utils/shell.ts rename to app/shared/utils/shell.ts index 9b9d02e4..aadfc276 100644 --- a/app/utils/shell.ts +++ b/app/shared/utils/shell.ts @@ -1,8 +1,8 @@ import type { WebContainer, WebContainerProcess } from '@webcontainer/api'; -import type { ITerminal } from '~/types/terminal'; +import type { ITerminal } from '~/shared/workbench/components/terminal/types/terminal'; import { withResolvers } from './promises'; import { atom } from 'nanostores'; -import { expoUrlAtom } from '~/lib/stores/qrCodeStore'; +import { expoUrlAtom } from '~/shared/workbench/stores/qrCodeStore'; export async function newShellProcess(webcontainer: WebContainer, terminal: ITerminal) { const args: string[] = []; diff --git a/app/utils/stacktrace.ts b/app/shared/utils/stacktrace.ts similarity index 100% rename from app/utils/stacktrace.ts rename to app/shared/utils/stacktrace.ts diff --git a/app/utils/stripIndent.ts b/app/shared/utils/stripIndent.ts similarity index 100% rename from app/utils/stripIndent.ts rename to app/shared/utils/stripIndent.ts diff --git a/app/utils/terminal.ts b/app/shared/utils/terminal.ts similarity index 100% rename from app/utils/terminal.ts rename to app/shared/utils/terminal.ts diff --git a/app/utils/types.ts b/app/shared/utils/types.ts similarity index 100% rename from app/utils/types.ts rename to app/shared/utils/types.ts diff --git a/app/utils/unreachable.ts b/app/shared/utils/unreachable.ts similarity index 100% rename from app/utils/unreachable.ts rename to app/shared/utils/unreachable.ts diff --git a/app/components/workbench/EditorPanel.tsx b/app/shared/workbench/components/EditorPanel.tsx similarity index 87% rename from app/components/workbench/EditorPanel.tsx rename to app/shared/workbench/components/EditorPanel.tsx index 48c1c0cc..3bed831a 100644 --- a/app/components/workbench/EditorPanel.tsx +++ b/app/shared/workbench/components/EditorPanel.tsx @@ -9,22 +9,22 @@ import { type OnChangeCallback as OnEditorChange, type OnSaveCallback as OnEditorSave, type OnScrollCallback as OnEditorScroll, -} from '~/components/editor/codemirror/CodeMirrorEditor'; -import { PanelHeader } from '~/components/ui/PanelHeader'; -import { PanelHeaderButton } from '~/components/ui/PanelHeaderButton'; -import type { FileMap } from '~/lib/stores/files'; -import type { FileHistory } from '~/types/actions'; -import { themeStore } from '~/lib/stores/theme'; -import { WORK_DIR } from '~/utils/constants'; -import { renderLogger } from '~/utils/logger'; -import { isMobile } from '~/utils/mobile'; -import { FileBreadcrumb } from './FileBreadcrumb'; -import { FileTree } from './FileTree'; +} from '~/shared/workbench/components/editor/codemirror/CodeMirrorEditor'; +import { PanelHeader } from '~/shared/components/ui/PanelHeader'; +import { PanelHeaderButton } from '~/shared/components/ui/PanelHeaderButton'; +import type { FileMap } from '~/shared/workbench/stores/files'; +import type { FileHistory } from '~/shared/types/actions'; +import { themeStore } from '~/shared/stores/theme'; +import { WORK_DIR } from '~/shared/utils/constants'; +import { renderLogger } from '~/shared/utils/logger'; +import { isMobile } from '~/shared/utils/mobile'; +import { FileBreadcrumb } from './ui/FileBreadcrumb'; +import { FileTree } from './ui/FileTree'; import { DEFAULT_TERMINAL_SIZE, TerminalTabs } from './terminal/TerminalTabs'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { Search } from './Search'; // <-- Ensure Search is imported -import { classNames } from '~/utils/classNames'; // <-- Import classNames if not already present -import { LockManager } from './LockManager'; // <-- Import LockManager +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { Search } from './ui/Search'; // <-- Ensure Search is imported +import { classNames } from '~/shared/utils/classNames'; // <-- Import classNames if not already present +import { LockManager } from './ui/LockManager'; // <-- Import LockManager interface EditorPanelProps { files?: FileMap; diff --git a/app/components/workbench/Preview.tsx b/app/shared/workbench/components/Preview.tsx similarity index 98% rename from app/components/workbench/Preview.tsx rename to app/shared/workbench/components/Preview.tsx index a9917de9..ae30b219 100644 --- a/app/components/workbench/Preview.tsx +++ b/app/shared/workbench/components/Preview.tsx @@ -1,12 +1,12 @@ import { memo, useCallback, useEffect, useRef, useState } from 'react'; import { useStore } from '@nanostores/react'; -import { IconButton } from '~/components/ui/IconButton'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { PortDropdown } from './PortDropdown'; -import { ScreenshotSelector } from './ScreenshotSelector'; -import { expoUrlAtom } from '~/lib/stores/qrCodeStore'; -import { ExpoQrModal } from '~/components/workbench/ExpoQrModal'; -import type { ElementInfo } from './Inspector'; +import { IconButton } from '~/shared/components/ui/IconButton'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { PortDropdown } from './ui/PortDropdown'; +import { ScreenshotSelector } from './ui/ScreenshotSelector'; +import { expoUrlAtom } from '~/shared/workbench/stores/qrCodeStore'; +import { ExpoQrModal } from '~/shared/workbench/components/ui/ExpoQrModal'; +import type { ElementInfo } from './ui/Inspector'; type ResizeSide = 'left' | 'right' | null; diff --git a/app/components/workbench/Workbench.client.tsx b/app/shared/workbench/components/Workbench.client.tsx similarity index 95% rename from app/components/workbench/Workbench.client.tsx rename to app/shared/workbench/components/Workbench.client.tsx index 084611d6..e2468e34 100644 --- a/app/components/workbench/Workbench.client.tsx +++ b/app/shared/workbench/components/Workbench.client.tsx @@ -5,29 +5,29 @@ import { memo, useCallback, useEffect, useState, useMemo } from 'react'; import { toast } from 'react-toastify'; import { Popover, Transition } from '@headlessui/react'; import { diffLines, type Change } from 'diff'; -import { ActionRunner } from '~/lib/runtime/action-runner'; -import { getLanguageFromExtension } from '~/utils/getLanguageFromExtension'; -import type { FileHistory } from '~/types/actions'; -import { DiffView } from './DiffView'; +import { ActionRunner } from '~/shared/lib/runtime/action-runner'; +import { getLanguageFromExtension } from '~/shared/utils/getLanguageFromExtension'; +import type { FileHistory } from '~/shared/types/actions'; +import { DiffView } from './ui/DiffView'; import { type OnChangeCallback as OnEditorChange, type OnScrollCallback as OnEditorScroll, -} from '~/components/editor/codemirror/CodeMirrorEditor'; -import { IconButton } from '~/components/ui/IconButton'; -import { PanelHeaderButton } from '~/components/ui/PanelHeaderButton'; -import { Slider, type SliderOptions } from '~/components/ui/Slider'; -import { workbenchStore, type WorkbenchViewType } from '~/lib/stores/workbench'; -import { classNames } from '~/utils/classNames'; -import { cubicEasingFn } from '~/utils/easings'; -import { renderLogger } from '~/utils/logger'; +} from '~/shared/workbench/components/editor/codemirror/CodeMirrorEditor'; +import { IconButton } from '~/shared/components/ui/IconButton'; +import { PanelHeaderButton } from '~/shared/components/ui/PanelHeaderButton'; +import { Slider, type SliderOptions } from '~/shared/components/ui/Slider'; +import { workbenchStore, type WorkbenchViewType } from '~/shared/workbench/stores/workbench'; +import { classNames } from '~/shared/utils/classNames'; +import { cubicEasingFn } from '~/shared/utils/easings'; +import { renderLogger } from '~/shared/utils/logger'; import { EditorPanel } from './EditorPanel'; import { Preview } from './Preview'; -import useViewport from '~/lib/hooks'; -import { PushToGitHubDialog } from '~/components/@settings/tabs/connections/components/PushToGitHubDialog'; +import useViewport from '~/shared/hooks'; +import { PushToGitHubDialog } from '~/settings/tabs/connections/components/PushToGitHubDialog'; import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; -import { usePreviewStore } from '~/lib/stores/previews'; -import { chatStore } from '~/lib/stores/chat'; -import type { ElementInfo } from './Inspector'; +import { usePreviewStore } from '~/shared/workbench/stores/previews'; +import { chatStore } from '~/chat/stores/chat'; +import type { ElementInfo } from './ui/Inspector'; interface WorkspaceProps { chatStarted?: boolean; diff --git a/app/components/editor/codemirror/BinaryContent.tsx b/app/shared/workbench/components/editor/codemirror/BinaryContent.tsx similarity index 100% rename from app/components/editor/codemirror/BinaryContent.tsx rename to app/shared/workbench/components/editor/codemirror/BinaryContent.tsx diff --git a/app/components/editor/codemirror/CodeMirrorEditor.tsx b/app/shared/workbench/components/editor/codemirror/CodeMirrorEditor.tsx similarity index 98% rename from app/components/editor/codemirror/CodeMirrorEditor.tsx rename to app/shared/workbench/components/editor/codemirror/CodeMirrorEditor.tsx index 0a557c19..d6f56b5d 100644 --- a/app/components/editor/codemirror/CodeMirrorEditor.tsx +++ b/app/shared/workbench/components/editor/codemirror/CodeMirrorEditor.tsx @@ -17,11 +17,11 @@ import { type Tooltip, } from '@codemirror/view'; import { memo, useEffect, useRef, useState, type MutableRefObject } from 'react'; -import type { Theme } from '~/types/theme'; -import { classNames } from '~/utils/classNames'; -import { debounce } from '~/utils/debounce'; -import { createScopedLogger, renderLogger } from '~/utils/logger'; -import { isFileLocked, getCurrentChatId } from '~/utils/fileLocks'; +import type { Theme } from '~/shared/types/theme'; +import { classNames } from '~/shared/utils/classNames'; +import { debounce } from '~/shared/utils/debounce'; +import { createScopedLogger, renderLogger } from '~/shared/utils/logger'; +import { isFileLocked, getCurrentChatId } from '~/shared/utils/fileLocks'; import { BinaryContent } from './BinaryContent'; import { getTheme, reconfigureTheme } from './cm-theme'; import { indentKeyBinding } from './indent'; diff --git a/app/components/editor/codemirror/EnvMasking.ts b/app/shared/workbench/components/editor/codemirror/EnvMasking.ts similarity index 100% rename from app/components/editor/codemirror/EnvMasking.ts rename to app/shared/workbench/components/editor/codemirror/EnvMasking.ts diff --git a/app/components/editor/codemirror/cm-theme.ts b/app/shared/workbench/components/editor/codemirror/cm-theme.ts similarity index 99% rename from app/components/editor/codemirror/cm-theme.ts rename to app/shared/workbench/components/editor/codemirror/cm-theme.ts index 6f3f3639..6de29eea 100644 --- a/app/components/editor/codemirror/cm-theme.ts +++ b/app/shared/workbench/components/editor/codemirror/cm-theme.ts @@ -1,7 +1,7 @@ import { Compartment, type Extension } from '@codemirror/state'; import { EditorView } from '@codemirror/view'; import { vscodeDark, vscodeLight } from '@uiw/codemirror-theme-vscode'; -import type { Theme } from '~/types/theme.js'; +import type { Theme } from '~/shared/types/theme.js'; import type { EditorSettings } from './CodeMirrorEditor.js'; export const darkTheme = EditorView.theme({}, { dark: true }); diff --git a/app/components/editor/codemirror/indent.ts b/app/shared/workbench/components/editor/codemirror/indent.ts similarity index 100% rename from app/components/editor/codemirror/indent.ts rename to app/shared/workbench/components/editor/codemirror/indent.ts diff --git a/app/components/editor/codemirror/languages.ts b/app/shared/workbench/components/editor/codemirror/languages.ts similarity index 100% rename from app/components/editor/codemirror/languages.ts rename to app/shared/workbench/components/editor/codemirror/languages.ts diff --git a/app/components/workbench/terminal/Terminal.tsx b/app/shared/workbench/components/terminal/Terminal.tsx similarity index 95% rename from app/components/workbench/terminal/Terminal.tsx rename to app/shared/workbench/components/terminal/Terminal.tsx index 337a72a6..e1da7b85 100644 --- a/app/components/workbench/terminal/Terminal.tsx +++ b/app/shared/workbench/components/terminal/Terminal.tsx @@ -2,8 +2,8 @@ import { FitAddon } from '@xterm/addon-fit'; import { WebLinksAddon } from '@xterm/addon-web-links'; import { Terminal as XTerm } from '@xterm/xterm'; import { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react'; -import type { Theme } from '~/lib/stores/theme'; -import { createScopedLogger } from '~/utils/logger'; +import type { Theme } from '~/shared/stores/theme'; +import { createScopedLogger } from '~/shared/utils/logger'; import { getTerminalTheme } from './theme'; const logger = createScopedLogger('Terminal'); diff --git a/app/components/workbench/terminal/TerminalTabs.tsx b/app/shared/workbench/components/terminal/TerminalTabs.tsx similarity index 94% rename from app/components/workbench/terminal/TerminalTabs.tsx rename to app/shared/workbench/components/terminal/TerminalTabs.tsx index 79988745..5221b3d9 100644 --- a/app/components/workbench/terminal/TerminalTabs.tsx +++ b/app/shared/workbench/components/terminal/TerminalTabs.tsx @@ -1,13 +1,13 @@ import { useStore } from '@nanostores/react'; import React, { memo, useEffect, useRef, useState } from 'react'; import { Panel, type ImperativePanelHandle } from 'react-resizable-panels'; -import { IconButton } from '~/components/ui/IconButton'; -import { shortcutEventEmitter } from '~/lib/hooks'; -import { themeStore } from '~/lib/stores/theme'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { classNames } from '~/utils/classNames'; +import { IconButton } from '~/shared/components/ui/IconButton'; +import { shortcutEventEmitter } from '~/shared/hooks'; +import { themeStore } from '~/shared/stores/theme'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { classNames } from '~/shared/utils/classNames'; import { Terminal, type TerminalRef } from './Terminal'; -import { createScopedLogger } from '~/utils/logger'; +import { createScopedLogger } from '~/shared/utils/logger'; const logger = createScopedLogger('Terminal'); diff --git a/app/components/workbench/terminal/theme.ts b/app/shared/workbench/components/terminal/theme.ts similarity index 100% rename from app/components/workbench/terminal/theme.ts rename to app/shared/workbench/components/terminal/theme.ts diff --git a/app/types/terminal.ts b/app/shared/workbench/components/terminal/types/terminal.ts similarity index 100% rename from app/types/terminal.ts rename to app/shared/workbench/components/terminal/types/terminal.ts diff --git a/app/components/workbench/DiffView.tsx b/app/shared/workbench/components/ui/DiffView.tsx similarity index 97% rename from app/components/workbench/DiffView.tsx rename to app/shared/workbench/components/ui/DiffView.tsx index 7747c4a8..8f2caf9e 100644 --- a/app/components/workbench/DiffView.tsx +++ b/app/shared/workbench/components/ui/DiffView.tsx @@ -1,16 +1,16 @@ import { memo, useMemo, useState, useEffect, useCallback } from 'react'; import { useStore } from '@nanostores/react'; -import { workbenchStore } from '~/lib/stores/workbench'; -import type { FileMap } from '~/lib/stores/files'; -import type { EditorDocument } from '~/components/editor/codemirror/CodeMirrorEditor'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import type { FileMap } from '~/shared/workbench/stores/files'; +import type { EditorDocument } from '~/shared/workbench/components/editor/codemirror/CodeMirrorEditor'; import { diffLines, type Change } from 'diff'; import { getHighlighter } from 'shiki'; import '~/styles/diff-view.css'; -import { diffFiles, extractRelativePath } from '~/utils/diff'; -import { ActionRunner } from '~/lib/runtime/action-runner'; -import type { FileHistory } from '~/types/actions'; -import { getLanguageFromExtension } from '~/utils/getLanguageFromExtension'; -import { themeStore } from '~/lib/stores/theme'; +import { diffFiles, extractRelativePath } from '~/shared/utils/diff'; +import { ActionRunner } from '~/shared/lib/runtime/action-runner'; +import type { FileHistory } from '~/shared/types/actions'; +import { getLanguageFromExtension } from '~/shared/utils/getLanguageFromExtension'; +import { themeStore } from '~/shared/stores/theme'; interface CodeComparisonProps { beforeCode: string; diff --git a/app/components/workbench/ExpoQrModal.tsx b/app/shared/workbench/components/ui/ExpoQrModal.tsx similarity index 95% rename from app/components/workbench/ExpoQrModal.tsx rename to app/shared/workbench/components/ui/ExpoQrModal.tsx index 4a4474d2..b23a9736 100644 --- a/app/components/workbench/ExpoQrModal.tsx +++ b/app/shared/workbench/components/ui/ExpoQrModal.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Dialog, DialogTitle, DialogDescription, DialogRoot } from '~/components/ui/Dialog'; +import { Dialog, DialogTitle, DialogDescription, DialogRoot } from '~/shared/components/ui/Dialog'; import { useStore } from '@nanostores/react'; -import { expoUrlAtom } from '~/lib/stores/qrCodeStore'; +import { expoUrlAtom } from '~/shared/workbench/stores/qrCodeStore'; import { QRCode } from 'react-qrcode-logo'; interface ExpoQrModalProps { diff --git a/app/components/workbench/FileBreadcrumb.tsx b/app/shared/workbench/components/ui/FileBreadcrumb.tsx similarity index 94% rename from app/components/workbench/FileBreadcrumb.tsx rename to app/shared/workbench/components/ui/FileBreadcrumb.tsx index 46a39485..f7af1db7 100644 --- a/app/components/workbench/FileBreadcrumb.tsx +++ b/app/shared/workbench/components/ui/FileBreadcrumb.tsx @@ -1,11 +1,11 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; import { AnimatePresence, motion, type Variants } from 'framer-motion'; import { memo, useEffect, useRef, useState } from 'react'; -import type { FileMap } from '~/lib/stores/files'; -import { classNames } from '~/utils/classNames'; -import { WORK_DIR } from '~/utils/constants'; -import { cubicEasingFn } from '~/utils/easings'; -import { renderLogger } from '~/utils/logger'; +import type { FileMap } from '~/shared/workbench/stores/files'; +import { classNames } from '~/shared/utils/classNames'; +import { WORK_DIR } from '~/shared/utils/constants'; +import { cubicEasingFn } from '~/shared/utils/easings'; +import { renderLogger } from '~/shared/utils/logger'; import FileTree from './FileTree'; const WORK_DIR_REGEX = new RegExp(`^${WORK_DIR.split('/').slice(0, -1).join('/').replaceAll('/', '\\/')}/`); diff --git a/app/components/workbench/FileTree.tsx b/app/shared/workbench/components/ui/FileTree.tsx similarity index 98% rename from app/components/workbench/FileTree.tsx rename to app/shared/workbench/components/ui/FileTree.tsx index f762ab7d..b9b7067f 100644 --- a/app/components/workbench/FileTree.tsx +++ b/app/shared/workbench/components/ui/FileTree.tsx @@ -1,13 +1,13 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'; -import type { FileMap } from '~/lib/stores/files'; -import { classNames } from '~/utils/classNames'; -import { createScopedLogger, renderLogger } from '~/utils/logger'; +import type { FileMap } from '~/shared/workbench/stores/files'; +import { classNames } from '~/shared/utils/classNames'; +import { createScopedLogger, renderLogger } from '~/shared/utils/logger'; import * as ContextMenu from '@radix-ui/react-context-menu'; -import type { FileHistory } from '~/types/actions'; +import type { FileHistory } from '~/shared/types/actions'; import { diffLines, type Change } from 'diff'; -import { workbenchStore } from '~/lib/stores/workbench'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; import { toast } from 'react-toastify'; -import { path } from '~/utils/path'; +import { path } from '~/shared/utils/path'; const logger = createScopedLogger('FileTree'); diff --git a/app/components/workbench/Inspector.tsx b/app/shared/workbench/components/ui/Inspector.tsx similarity index 100% rename from app/components/workbench/Inspector.tsx rename to app/shared/workbench/components/ui/Inspector.tsx diff --git a/app/components/workbench/InspectorPanel.tsx b/app/shared/workbench/components/ui/InspectorPanel.tsx similarity index 100% rename from app/components/workbench/InspectorPanel.tsx rename to app/shared/workbench/components/ui/InspectorPanel.tsx diff --git a/app/components/workbench/LockManager.tsx b/app/shared/workbench/components/ui/LockManager.tsx similarity index 97% rename from app/components/workbench/LockManager.tsx rename to app/shared/workbench/components/ui/LockManager.tsx index d4c5b814..0ff17180 100644 --- a/app/components/workbench/LockManager.tsx +++ b/app/shared/workbench/components/ui/LockManager.tsx @@ -1,8 +1,8 @@ import { useState, useEffect } from 'react'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { classNames } from '~/utils/classNames'; -import { Checkbox } from '~/components/ui/Checkbox'; -import { toast } from '~/components/ui/use-toast'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { classNames } from '~/shared/utils/classNames'; +import { Checkbox } from '~/shared/components/ui/Checkbox'; +import { toast } from '~/shared/components/ui/use-toast'; interface LockedItem { path: string; diff --git a/app/components/workbench/PortDropdown.tsx b/app/shared/workbench/components/ui/PortDropdown.tsx similarity index 97% rename from app/components/workbench/PortDropdown.tsx rename to app/shared/workbench/components/ui/PortDropdown.tsx index d84f940a..f8d17ddc 100644 --- a/app/components/workbench/PortDropdown.tsx +++ b/app/shared/workbench/components/ui/PortDropdown.tsx @@ -1,5 +1,5 @@ import { memo, useEffect, useRef } from 'react'; -import type { PreviewInfo } from '~/lib/stores/previews'; +import type { PreviewInfo } from '~/shared/workbench/stores/previews'; interface PortDropdownProps { activePreviewIndex: number; diff --git a/app/components/workbench/ScreenshotSelector.tsx b/app/shared/workbench/components/ui/ScreenshotSelector.tsx similarity index 100% rename from app/components/workbench/ScreenshotSelector.tsx rename to app/shared/workbench/components/ui/ScreenshotSelector.tsx diff --git a/app/components/workbench/Search.tsx b/app/shared/workbench/components/ui/Search.tsx similarity index 97% rename from app/components/workbench/Search.tsx rename to app/shared/workbench/components/ui/Search.tsx index 7bce5b08..6dab4b5a 100644 --- a/app/components/workbench/Search.tsx +++ b/app/shared/workbench/components/ui/Search.tsx @@ -1,9 +1,9 @@ import { useState, useMemo, useCallback, useEffect } from 'react'; import type { TextSearchOptions, TextSearchOnProgressCallback, WebContainer } from '@webcontainer/api'; -import { workbenchStore } from '~/lib/stores/workbench'; -import { webcontainer } from '~/lib/webcontainer'; -import { WORK_DIR } from '~/utils/constants'; -import { debounce } from '~/utils/debounce'; +import { workbenchStore } from '~/shared/workbench/stores/workbench'; +import { webcontainer } from '~/shared/lib/webcontainer'; +import { WORK_DIR } from '~/shared/utils/constants'; +import { debounce } from '~/shared/utils/debounce'; interface DisplayMatch { path: string; diff --git a/app/lib/stores/editor.ts b/app/shared/workbench/stores/editor.ts similarity index 94% rename from app/lib/stores/editor.ts rename to app/shared/workbench/stores/editor.ts index 5d483232..2c474f42 100644 --- a/app/lib/stores/editor.ts +++ b/app/shared/workbench/stores/editor.ts @@ -1,7 +1,7 @@ import { atom, computed, map, type MapStore, type WritableAtom } from 'nanostores'; -import type { EditorDocument, ScrollPosition } from '~/components/editor/codemirror/CodeMirrorEditor'; +import type { EditorDocument, ScrollPosition } from '~/shared/workbench/components/editor/codemirror/CodeMirrorEditor'; import type { FileMap, FilesStore } from './files'; -import { createScopedLogger } from '~/utils/logger'; +import { createScopedLogger } from '~/shared/utils/logger'; export type EditorDocuments = Record; diff --git a/app/lib/stores/files.ts b/app/shared/workbench/stores/files.ts similarity index 98% rename from app/lib/stores/files.ts rename to app/shared/workbench/stores/files.ts index e2d8e40f..619dbd58 100644 --- a/app/lib/stores/files.ts +++ b/app/shared/workbench/stores/files.ts @@ -2,12 +2,12 @@ import type { PathWatcherEvent, WebContainer } from '@webcontainer/api'; import { getEncoding } from 'istextorbinary'; import { map, type MapStore } from 'nanostores'; import { Buffer } from 'node:buffer'; -import { path } from '~/utils/path'; -import { bufferWatchEvents } from '~/utils/buffer'; -import { WORK_DIR } from '~/utils/constants'; -import { computeFileModifications } from '~/utils/diff'; -import { createScopedLogger } from '~/utils/logger'; -import { unreachable } from '~/utils/unreachable'; +import { path } from '~/shared/utils/path'; +import { bufferWatchEvents } from '~/shared/utils/buffer'; +import { WORK_DIR } from '~/shared/utils/constants'; +import { computeFileModifications } from '~/shared/utils/diff'; +import { createScopedLogger } from '~/shared/utils/logger'; +import { unreachable } from '~/shared/utils/unreachable'; import { addLockedFile, removeLockedFile, @@ -19,8 +19,8 @@ import { isPathInLockedFolder, migrateLegacyLocks, clearCache, -} from '~/lib/persistence/lockedFiles'; -import { getCurrentChatId } from '~/utils/fileLocks'; +} from '~/shared/lib/persistence/lockedFiles'; +import { getCurrentChatId } from '~/shared/utils/fileLocks'; const logger = createScopedLogger('FilesStore'); diff --git a/app/lib/stores/previews.ts b/app/shared/workbench/stores/previews.ts similarity index 100% rename from app/lib/stores/previews.ts rename to app/shared/workbench/stores/previews.ts diff --git a/app/lib/stores/qrCodeStore.ts b/app/shared/workbench/stores/qrCodeStore.ts similarity index 100% rename from app/lib/stores/qrCodeStore.ts rename to app/shared/workbench/stores/qrCodeStore.ts diff --git a/app/lib/stores/terminal.ts b/app/shared/workbench/stores/terminal.ts similarity index 87% rename from app/lib/stores/terminal.ts rename to app/shared/workbench/stores/terminal.ts index 9de9f4e5..8fb3b071 100644 --- a/app/lib/stores/terminal.ts +++ b/app/shared/workbench/stores/terminal.ts @@ -1,8 +1,8 @@ import type { WebContainer, WebContainerProcess } from '@webcontainer/api'; import { atom, type WritableAtom } from 'nanostores'; -import type { ITerminal } from '~/types/terminal'; -import { newBoltShellProcess, newShellProcess } from '~/utils/shell'; -import { coloredText } from '~/utils/terminal'; +import type { ITerminal } from '~/shared/workbench/components/terminal/types/terminal'; +import { newBoltShellProcess, newShellProcess } from '~/shared/utils/shell'; +import { coloredText } from '~/shared/utils/terminal'; export class TerminalStore { #webcontainer: Promise; diff --git a/app/lib/stores/workbench.ts b/app/shared/workbench/stores/workbench.ts similarity index 97% rename from app/lib/stores/workbench.ts rename to app/shared/workbench/stores/workbench.ts index e90114cd..aba205b7 100644 --- a/app/lib/stores/workbench.ts +++ b/app/shared/workbench/stores/workbench.ts @@ -1,10 +1,10 @@ import { atom, map, type MapStore, type ReadableAtom, type WritableAtom } from 'nanostores'; -import type { EditorDocument, ScrollPosition } from '~/components/editor/codemirror/CodeMirrorEditor'; -import { ActionRunner } from '~/lib/runtime/action-runner'; -import type { ActionCallbackData, ArtifactCallbackData } from '~/lib/runtime/message-parser'; -import { webcontainer } from '~/lib/webcontainer'; -import type { ITerminal } from '~/types/terminal'; -import { unreachable } from '~/utils/unreachable'; +import type { EditorDocument, ScrollPosition } from '~/shared/workbench/components/editor/codemirror/CodeMirrorEditor'; +import { ActionRunner } from '~/shared/lib/runtime/action-runner'; +import type { ActionCallbackData, ArtifactCallbackData } from '~/shared/lib/runtime/message-parser'; +import { webcontainer } from '~/shared/lib/webcontainer'; +import type { ITerminal } from '~/shared/workbench/components/terminal/types/terminal'; +import { unreachable } from '~/shared/utils/unreachable'; import { EditorStore } from './editor'; import { FilesStore, type FileMap } from './files'; import { PreviewsStore } from './previews'; @@ -12,12 +12,12 @@ import { TerminalStore } from './terminal'; import JSZip from 'jszip'; import fileSaver from 'file-saver'; import { Octokit, type RestEndpointMethodTypes } from '@octokit/rest'; -import { path } from '~/utils/path'; -import { extractRelativePath } from '~/utils/diff'; -import { description } from '~/lib/persistence'; +import { path } from '~/shared/utils/path'; +import { extractRelativePath } from '~/shared/utils/diff'; +import { description } from '~/shared/lib/persistence'; import Cookies from 'js-cookie'; -import { createSampler } from '~/utils/sampler'; -import type { ActionAlert, DeployAlert, SupabaseAlert } from '~/types/actions'; +import { createSampler } from '~/shared/utils/sampler'; +import type { ActionAlert, DeployAlert, SupabaseAlert } from '~/shared/types/actions'; const { saveAs } = fileSaver; diff --git a/scripts/update-imports.sh b/scripts/update-imports.sh index 0d64317e..3fa57b85 100755 --- a/scripts/update-imports.sh +++ b/scripts/update-imports.sh @@ -1,7 +1,7 @@ #!/bin/bash # Update imports in TypeScript files -find app -type f -name "*.ts" -o -name "*.tsx" | xargs sed -i '' 's|~/components/settings/settings.types|~/components/@settings/core/types|g' +find app -type f -name "*.ts" -o -name "*.tsx" | xargs sed -i '' 's|~/components/settings/settings.types|~/settings/core/types|g' # Update imports for specific components -find app -type f -name "*.ts" -o -name "*.tsx" | xargs sed -i '' 's|~/components/settings/|~/components/@settings/tabs/|g' \ No newline at end of file +find app -type f -name "*.ts" -o -name "*.tsx" | xargs sed -i '' 's|~/components/settings/|~/settings/tabs/|g' \ No newline at end of file