-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(cmdk): added knowledgebases to the cmdk modal, added envvar to enforce SSL for db connections #1530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This PR introduces two key enhancements to the Sim platform: expanding the command palette (Cmd+K) functionality and improving database SSL configuration flexibility.Command Palette Enhancement: The PR adds knowledge bases as searchable items in the Cmd+K modal, allowing users to quickly navigate to different knowledge bases within their workspace. The implementation follows the existing pattern used for workflows and workspaces by leveraging the useKnowledgeBasesList hook, formatting knowledge base data with proper URLs, and integrating it into the SearchModal component. The search functionality supports filtering by both name and description, and maintains proper keyboard navigation with global index calculations. The change also cleans up the interface by separating triggers from blocks into their own section and removing unused template functionality.
Database SSL Configuration: The PR introduces a new DATABASE_SSL environment variable that provides explicit control over SSL connections to PostgreSQL databases across all connection points in the codebase. This replaces the previous approach of hardcoding or environment-based SSL defaults. The implementation includes a consistent isTruthy() helper function to parse boolean environment variables and defaults to false to ensure backward compatibility. The SSL configuration is applied consistently across the main database connection, socket server, migration scripts, and SSO provider registration.
Both changes enhance user experience and deployment flexibility while maintaining backward compatibility with existing self-hosted installations.
Changed Files
| Filename | Score | Overview |
|---|---|---|
apps/sim/.env.example |
5/5 | Adds DATABASE_SSL environment variable documentation with clear usage instructions |
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx |
4/5 | Integrates knowledge bases into search modal by adding data fetching and formatting logic |
packages/db/scripts/register-sso-provider.ts |
4/5 | Implements configurable SSL support for SSO provider database connections |
packages/db/scripts/migrate-deployment-versions.ts |
4/5 | Adds SSL configuration control to database migration script connections |
apps/sim/socket-server/database/operations.ts |
4/5 | Replaces hardcoded SSL requirement with configurable DATABASE_SSL environment variable |
apps/sim/app/workspace/[workspaceId]/w/components/search-modal/search-modal.tsx |
4/5 | Major refactor adding knowledge bases, reorganizing triggers, and removing templates |
apps/sim/lib/env.ts |
5/5 | Adds DATABASE_SSL boolean environment variable to server configuration schema |
packages/db/index.ts |
4/5 | Implements configurable SSL and updates connection pool settings for main database client |
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it maintains backward compatibility and follows established patterns
- Score reflects well-structured changes with consistent implementation across the codebase and proper fallback defaults
- Pay close attention to the search modal refactoring and ensure knowledge bases display correctly in the UI
Sequence Diagram
sequenceDiagram
participant User
participant SearchModal
participant NavigationHook
participant Router
participant WorkflowComponent
participant ExternalBrowser
User->>SearchModal: "Opens search modal (Cmd+K)"
SearchModal->>SearchModal: "Initialize filters and navigation sections"
SearchModal->>SearchModal: "Load workflows, workspaces, knowledge bases"
SearchModal-->>User: "Display search interface"
User->>SearchModal: "Types search query"
SearchModal->>SearchModal: "Filter blocks, workflows, workspaces, pages, docs"
SearchModal->>NavigationHook: "Update navigation sections"
SearchModal-->>User: "Show filtered results"
User->>SearchModal: "Uses arrow keys for navigation"
SearchModal->>NavigationHook: "navigate('down'|'up'|'left'|'right')"
NavigationHook->>NavigationHook: "Update current position"
NavigationHook->>SearchModal: "Scroll selected item into view"
SearchModal-->>User: "Highlight selected item"
alt User selects a block/trigger/tool
User->>SearchModal: "Presses Enter on block item"
SearchModal->>SearchModal: "handleBlockClick(blockType)"
SearchModal->>WorkflowComponent: "Dispatch 'add-block-from-toolbar' event"
WorkflowComponent->>WorkflowComponent: "Add block to workflow"
SearchModal->>SearchModal: "Close modal"
else User selects a workflow/workspace/knowledge base
User->>SearchModal: "Presses Enter on navigation item"
SearchModal->>SearchModal: "handleNavigationClick(href)"
SearchModal->>Router: "router.push(href)"
Router->>Router: "Navigate to new page"
SearchModal->>SearchModal: "Close modal"
else User selects a page (internal)
User->>SearchModal: "Presses Enter on page item"
SearchModal->>SearchModal: "handlePageClick(href)"
SearchModal->>Router: "router.push(href)"
Router->>Router: "Navigate to internal page"
SearchModal->>SearchModal: "Close modal"
else User selects docs/external link
User->>SearchModal: "Presses Enter on docs item"
SearchModal->>SearchModal: "handleDocsClick(href)"
SearchModal->>ExternalBrowser: "window.open(href, '_blank')"
ExternalBrowser->>ExternalBrowser: "Open documentation"
SearchModal->>SearchModal: "Close modal"
else User uses keyboard shortcuts
User->>SearchModal: "Presses Cmd+Shift+L or Cmd+Shift+K"
SearchModal->>SearchModal: "handlePageClick(shortcut path)"
SearchModal->>Router: "router.push(logs/knowledge path)"
Router->>Router: "Navigate to specific page"
SearchModal->>SearchModal: "Close modal"
end
User->>SearchModal: "Presses Escape or clicks outside"
SearchModal->>SearchModal: "Close modal and clear search"
8 files reviewed, 1 comment
| function isTruthy(value: string | undefined): boolean { | ||
| if (!value) return false | ||
| return value.toLowerCase() === 'true' || value === '1' | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider extracting this helper function to a shared utility module since it's duplicated across multiple database scripts (packages/db/index.ts, register-sso-provider.ts). This would improve maintainability.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/db/scripts/migrate-deployment-versions.ts
Line: 120:123
Comment:
**style:** Consider extracting this helper function to a shared utility module since it's duplicated across multiple database scripts (packages/db/index.ts, register-sso-provider.ts). This would improve maintainability.
How can I resolve this? If you propose a fix, please make it concise.
Summary
Type of Change
Testing
Tested manually.
Checklist