Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • added knowledgebases to the cmdk modal
  • added envvar to specify whether or not SSL is enabled instead of defaulting based on environment, defaults to false so won't disrupt existing self-hosters

Type of Change

  • New feature

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Oct 2, 2025 4:15am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 2, 2025 4:15am

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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"
Loading

8 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +120 to +123
function isTruthy(value: string | undefined): boolean {
if (!value) return false
return value.toLowerCase() === 'true' || value === '1'
}
Copy link
Contributor

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.

@waleedlatif1 waleedlatif1 merged commit ace83eb into staging Oct 2, 2025
10 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/cmd-k branch October 2, 2025 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants