Skip to content

feat(desktop): add description to presets#380

Merged
AviPeltz merged 4 commits intomainfrom
critical-magpie-474782
Dec 16, 2025
Merged

feat(desktop): add description to presets#380
AviPeltz merged 4 commits intomainfrom
critical-magpie-474782

Conversation

@AviPeltz
Copy link
Copy Markdown
Collaborator

@AviPeltz AviPeltz commented Dec 16, 2025

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

  • New Features
    • Presets now support optional descriptions for creation and editing.
    • App seeds default terminal presets on first run so users see useful presets immediately.
    • Preset icons are theme-aware (light/dark) and display across Settings and Workspace.
    • Tooltips and preset rows now show descriptions or working directories for clearer context.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 16, 2025

Walkthrough

Adds optional descriptions to terminal presets, seeds default presets on first run via async getTerminalPresets, and introduces theme-aware preset icon utilities; updates presets data shape and UI components to render icons and descriptions.

Changes

Cohort / File(s) Summary
Backend Preset Management
apps/desktop/src/lib/trpc/routers/settings/index.ts, apps/desktop/src/main/lib/db/schemas.ts
Added optional description to TerminalPreset and terminalPresetsInitialized to Settings. Made getTerminalPresets async and added first-run initialization that seeds terminalPresets with DEFAULT_PRESETS (generated ids). Extended createTerminalPreset and updateTerminalPreset inputs to accept description.
Icon Infrastructure
apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts
New module providing getPresetIcon(presetName, isDark), usePresetIcon(presetName) and useIsDarkTheme() to resolve theme-aware preset icons.
Preset Templates & Types
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx, apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
Moved template-level description into preset.description (restructured PresetTemplate), updated PRESET_TEMPLATES, added a "description" column entry in PRESET_COLUMNS, and switched to theme-aware icons via getPresetIcon / useIsDarkTheme.
Preset UI Components
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx
UI now renders dynamic preset icons and shows preset.description when present (fallbacks to cwd), uses useIsDarkTheme() for icon selection, wraps buttons in tooltips when appropriate, and fixes input value handling via nullish coalescing in PresetRow.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Renderer
  participant ThemeStore
  participant TRPC as TRPC Router
  participant DB

  Renderer->>ThemeStore: read theme (useIsDarkTheme)
  Renderer->>TRPC: call getTerminalPresets()
  TRPC->>DB: read Settings.terminalPresets & terminalPresetsInitialized
  alt not initialized
    DB-->>TRPC: no presets / not initialized
    TRPC->>DB: insert DEFAULT_PRESETS (generate ids)
    DB-->>TRPC: persist confirmation
    TRPC->>DB: set terminalPresetsInitialized = true
  end
  DB-->>TRPC: return terminalPresets
  TRPC-->>Renderer: return presets (with descriptions and ids)
  Renderer->>Renderer: getPresetIcon(preset.name, isDark) for each preset
  Renderer-->>User: render preset buttons with icon + description/cwd
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Review backend initialization path and flag handling in settings router.
  • Validate schema change propagation for description and terminalPresetsInitialized.
  • Confirm consistent icon selection and tooltip behavior across modified UI components.
  • Check controlled input behavior change in PresetRow to avoid regressions.

Possibly related PRs

Poem

🐰 Hops in the code where presets align,

Icons that shimmer in dark and in shine.
Descriptions tucked neatly, seeded by start,
Default presets planted — a fresh little art.
I nibble a carrot and applaud every part. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is entirely blank except for the template structure; no actual details about changes, related issues, testing steps, or additional context were provided. Only the 'New feature' checkbox was marked. Fill in the Description section with what the feature does and why. Add any related issue links, describe testing performed, and provide additional context about the changes made.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and specifically describes the main change: adding a description field to presets. It is concise, directly related to the changeset, and accurately summarizes the primary feature addition.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch critical-magpie-474782

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 16, 2025

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

Service Status
Neon Database (Neon)

Thank you for your contribution! 🎉


Preview resources have been processed for cleanup

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts (1)

36-39: Consider consolidating theme detection logic.

The useIsDarkTheme hook duplicates theme detection logic that's already in usePresetIcon. Consider if both hooks are necessary, or if consumers could use usePresetIcon directly.

Example consolidation:

-export function useIsDarkTheme(): boolean {
-	const activeTheme = useThemeStore((state) => state.activeTheme);
-	return activeTheme?.type === "dark";
-}

If useIsDarkTheme is used independently in multiple places, this is fine to keep. Otherwise, components could just use usePresetIcon directly.

apps/desktop/src/lib/trpc/routers/settings/index.ts (1)

11-27: Consider extracting long command strings to constants.

The command strings in DEFAULT_PRESETS are quite long (especially codex on line 18). Consider extracting them to named constants for better readability.

Example:

const CODEX_DANGER_COMMAND = 
  'codex -c model_reasoning_effort="high" --ask-for-approval never ' +
  '--sandbox danger-full-access -c model_reasoning_summary="detailed" ' +
  '-c model_supports_reasoning_summaries=true';

const DEFAULT_PRESETS: Omit<TerminalPreset, "id">[] = [
  {
    name: "codex",
    description: "Danger mode: All permissions auto-approved",
    cwd: "",
    commands: [CODEX_DANGER_COMMAND],
  },
  // ...
];
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx (1)

26-65: Consider varying the preset descriptions.

Three of the four presets use the identical description: "Danger mode: All permissions auto-approved". Consider making these more distinctive to better differentiate the presets for users.

Example:

{
  name: "codex",
  description: "Codex with high reasoning effort and full sandbox access",
  // ...
},
{
  name: "claude",
  description: "Claude with permissions auto-approved",
  // ...
},
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5943ef3 and 331dc36.

⛔ Files ignored due to path filters (5)
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/claude.svg is excluded by !**/*.svg
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/codex-white.svg is excluded by !**/*.svg
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/codex.svg is excluded by !**/*.svg
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/cursor.svg is excluded by !**/*.svg
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/gemini.svg is excluded by !**/*.svg
📒 Files selected for processing (8)
  • apps/desktop/src/lib/trpc/routers/settings/index.ts (4 hunks)
  • apps/desktop/src/main/lib/db/schemas.ts (2 hunks)
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts (1 hunks)
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx (1 hunks)
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx (4 hunks)
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts (1 hunks)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx (3 hunks)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
apps/desktop/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/main/lib/db/schemas.ts
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: Please use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/main/lib/db/schemas.ts
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for code formatting and linting, running at root level for speed

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/main/lib/db/schemas.ts
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Avoid any type and prioritize type safety in TypeScript code

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/main/lib/db/schemas.ts
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
**/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/components/**/*.{ts,tsx}: Structure project folders as one folder per component with PascalCase naming (ComponentName/ComponentName.tsx + index.ts barrel export)
Co-locate component dependencies (utils, hooks, constants, config, tests, stories) next to the file using them
Use one component per file (no multi-component files)

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Call IPC methods from renderer process using window.ipcRenderer.invoke with type-safe object parameters

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
🧠 Learnings (2)
📚 Learning: 2025-12-12T05:45:09.686Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.686Z
Learning: Applies to packages/ui/**/*.{ts,tsx} : Use React + TailwindCSS v4 + shadcn/ui for UI components in `packages/ui`

Applied to files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
📚 Learning: 2025-11-24T21:33:13.267Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.267Z
Learning: Applies to apps/desktop/**/*.{ts,tsx} : Please use alias as defined in `tsconfig.json` when possible

Applied to files:

  • apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx
🧬 Code graph analysis (3)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (3)
apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts (2)
  • useIsDarkTheme (36-39)
  • getPresetIcon (20-28)
packages/ui/src/components/ui/button.tsx (1)
  • Button (60-60)
packages/ui/src/components/ui/tooltip.tsx (3)
  • Tooltip (76-76)
  • TooltipTrigger (76-76)
  • TooltipContent (76-76)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx (1)
apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts (2)
  • useIsDarkTheme (36-39)
  • getPresetIcon (20-28)
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx (1)
apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts (2)
  • useIsDarkTheme (36-39)
  • getPresetIcon (20-28)
🪛 GitHub Actions: CI
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx

[error] 3-7: Formatter would have printed different content for the Tooltip import block. Run the formatter to apply the changes.

apps/desktop/src/lib/trpc/routers/settings/index.ts

[error] 1-1: Imports and exports are not sorted. Safe fix: Organize Imports (Biome).

apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx

[error] 198-201: Prettier formatting would have rearranged content. Run the formatter to apply the suggested changes (e.g., fix title prop formatting).

🔇 Additional comments (10)
apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts (1)

1-39: LGTM: Clean theme-aware icon resolution.

The icon lookup system is well-structured with proper normalization, type safety, and undefined handling for missing presets.

apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx (1)

47-47: LGTM: Proper null handling for Input value.

The nullish coalescing operator ensures the Input always receives a string value, preventing uncontrolled component issues when the value is null or undefined.

apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts (1)

16-20: LGTM: Description column addition.

The new description column integrates cleanly with existing column definitions and appropriately indicates the optional nature in the placeholder text.

apps/desktop/src/main/lib/db/schemas.ts (2)

102-102: LGTM: Clean schema extension for descriptions.

The optional description field enables richer preset metadata without breaking existing data.


111-111: LGTM: Initialization flag for first-run seeding.

The terminalPresetsInitialized flag enables proper first-run detection for seeding default presets while preserving any pre-existing user presets.

apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (1)

167-202: LGTM: Enhanced preset rendering with tooltips and dynamic icons.

The reworked preset rendering properly integrates theme-aware icons and helpful tooltips showing descriptions or working directories. The conditional wrapping pattern is clean and avoids unnecessary tooltip elements when no context is available.

apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabsCommandDialog/index.tsx (1)

15-18: LGTM: Consistent theme-aware preset rendering.

The command dialog now properly displays preset icons, descriptions, and working directories with appropriate theming and truncation. The logic prioritizes description over cwd, providing a better user experience.

Also applies to: 37-37, 52-84

apps/desktop/src/lib/trpc/routers/settings/index.ts (2)

35-65: LGTM: Safe first-run initialization logic.

The initialization logic properly handles:

  • Preserving existing user presets (backward compatibility)
  • Seeding defaults only when needed
  • Atomic updates with proper flag management

71-71: LGTM: Proper description field integration.

The description field is correctly added to input schemas as optional and properly propagated in update logic with undefined checks.

Also applies to: 98-98, 114-115

apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx (1)

4-7: LGTM: Theme-aware icon integration.

The preset templates now properly integrate with the theme-aware icon system, displaying appropriate icons based on the active theme and showing helpful descriptions in tooltips.

Also applies to: 77-77, 192-212

Comment thread apps/desktop/src/lib/trpc/routers/settings/index.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (1)

3-3: Verify Biome formatting compliance for imports.

A previous review flagged that Biome would format the Tooltip imports differently. Please ensure you've run the Biome formatter on this file.

#!/bin/bash
# Check if Biome would make changes to this file
npx @biomejs/biome format apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx 2>&1 | head -20
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx (1)

200-202: Verify Biome formatting compliance for title prop.

A previous review flagged that Biome would format this section differently. Please ensure you've run the Biome formatter on this file.

#!/bin/bash
# Check if Biome would make changes to this file
npx @biomejs/biome format apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx 2>&1 | head -20
apps/desktop/src/lib/trpc/routers/settings/index.ts (1)

1-6: Fix: Organize imports as required by Biome.

The import ordering issue has already been flagged. Ensure you run Biome to auto-fix the import organization before merging.

Based on past review feedback.

🧹 Nitpick comments (3)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (1)

163-198: Consider simplifying the non-tooltip case by avoiding the wrapper div.

The tooltip-wrapped button and non-tooltip button are rendered differently: one uses <Tooltip> as the keyed element, the other wraps in <div>. This adds an unnecessary DOM node when no tooltip is present.

Apply this diff to simplify:

-								return <div key={preset.id}>{button}</div>;
+								return <Fragment key={preset.id}>{button}</Fragment>;

Or extract the key prop to the button itself:

+								const buttonWithKey = (
+									<Button
+										key={preset.id}
+										variant="ghost"
...
-								return <div key={preset.id}>{button}</div>;
+								return buttonWithKey;
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx (2)

16-24: Consider documenting or simplifying the dual name fields.

The interface has name at the top level and preset.name nested. While this separation allows for icon lookup (template.name) vs preset data (template.preset.name), all current templates use identical values for both fields. Consider either:

  1. Adding a comment explaining why both are needed
  2. Deriving one from the other if they should always match

192-213: Minor optimization: conditionally compute presetIcon only when needed.

presetIcon is computed for every template but only used when !alreadyAdded. Consider computing it conditionally to avoid unnecessary function calls.

-						const presetIcon = getPresetIcon(template.name, isDark);
 						return (
 							<Button
 								key={template.name}
 								variant="outline"
 								size="sm"
 								className="gap-1.5 text-xs h-7"
 								onClick={() => handleAddTemplate(template)}
 								title={
 									alreadyAdded ? "Already added" : template.preset.description
 								}
 								disabled={alreadyAdded || createPreset.isPending}
 							>
-								{alreadyAdded ? (
-									<HiOutlineCheck className="h-3 w-3" />
-								) : presetIcon ? (
-									<img
-										src={presetIcon}
-										alt=""
-										className="h-3 w-3 object-contain"
-									/>
-								) : null}
+								{alreadyAdded ? (
+									<HiOutlineCheck className="h-3 w-3" />
+								) : (
+									(() => {
+										const icon = getPresetIcon(template.name, isDark);
+										return icon ? (
+											<img src={icon} alt="" className="h-3 w-3 object-contain" />
+										) : null;
+									})()
+								)}
 								{template.name}
 							</Button>
 						);

Alternatively, keep the current approach for readability—the performance gain is negligible.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 331dc36 and fc9d2a2.

📒 Files selected for processing (3)
  • apps/desktop/src/lib/trpc/routers/settings/index.ts (4 hunks)
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx (4 hunks)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
apps/desktop/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: Please use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for code formatting and linting, running at root level for speed

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Avoid any type and prioritize type safety in TypeScript code

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
**/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/components/**/*.{ts,tsx}: Structure project folders as one folder per component with PascalCase naming (ComponentName/ComponentName.tsx + index.ts barrel export)
Co-locate component dependencies (utils, hooks, constants, config, tests, stories) next to the file using them
Use one component per file (no multi-component files)

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Call IPC methods from renderer process using window.ipcRenderer.invoke with type-safe object parameters

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
🧠 Learnings (5)
📚 Learning: 2025-12-12T05:45:09.686Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.686Z
Learning: Applies to **/*.{ts,tsx,js,jsx,json} : Use Biome for code formatting and linting, running at root level for speed

Applied to files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
📚 Learning: 2025-11-24T21:33:13.267Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.267Z
Learning: Applies to apps/desktop/**/*.{ts,tsx,js,jsx} : For Electron interprocess communication, ALWAYS use tRPC as defined in `src/lib/trpc`

Applied to files:

  • apps/desktop/src/lib/trpc/routers/settings/index.ts
📚 Learning: 2025-12-12T05:45:09.686Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.686Z
Learning: Applies to apps/desktop/src/renderer/**/*.{ts,tsx,js,jsx} apps/desktop/src/lib/**/*.{ts,tsx,js,jsx} apps/desktop/src/shared/**/*.{ts,tsx,js,tsx} : Never import Node.js modules in renderer process or shared code, only in main process

Applied to files:

  • apps/desktop/src/lib/trpc/routers/settings/index.ts
📚 Learning: 2025-11-24T21:33:13.267Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.267Z
Learning: Applies to apps/desktop/**/*.{ts,tsx} : Please use alias as defined in `tsconfig.json` when possible

Applied to files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
📚 Learning: 2025-12-12T05:45:09.686Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.686Z
Learning: Applies to packages/ui/**/*.{ts,tsx} : Use React + TailwindCSS v4 + shadcn/ui for UI components in `packages/ui`

Applied to files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
🧬 Code graph analysis (2)
apps/desktop/src/lib/trpc/routers/settings/index.ts (1)
apps/desktop/src/main/lib/db/schemas.ts (1)
  • TerminalPreset (99-105)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (3)
apps/desktop/src/renderer/assets/app-icons/preset-icons/index.ts (2)
  • useIsDarkTheme (36-39)
  • getPresetIcon (20-28)
packages/ui/src/components/ui/button.tsx (1)
  • Button (60-60)
packages/ui/src/components/ui/tooltip.tsx (3)
  • Tooltip (76-76)
  • TooltipTrigger (76-76)
  • TooltipContent (76-76)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Deploy Web
  • GitHub Check: Deploy Admin
  • GitHub Check: Deploy Marketing
  • GitHub Check: Deploy API
  • GitHub Check: Build
🔇 Additional comments (9)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (3)

13-16: LGTM!

Good use of aliased imports from renderer/assets/app-icons/preset-icons as per coding guidelines.


47-47: LGTM!

Theme hook usage is appropriate at the component level for deriving isDark state.


164-165: LGTM!

Clean derivation of tooltipText with fallback to cwd, and proper use of getPresetIcon with theme awareness.

apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx (3)

4-7: LGTM!

Proper aliased imports for the preset icon utilities as per coding guidelines.


26-65: LGTM!

The preset templates are well-structured with descriptive text for each CLI tool's "danger mode" configuration. The descriptions clearly communicate that permissions are auto-approved.


77-77: LGTM!

Theme hook properly placed at component level.

apps/desktop/src/lib/trpc/routers/settings/index.ts (3)

67-90: LGTM: Description field added correctly.

The optional description field is properly integrated:

  • Zod schema matches the TypeScript interface
  • Field is optional as intended
  • Automatically included in preset via spread operator

92-122: LGTM: Description patching implemented correctly.

The description field update follows the same pattern as other fields:

  • Optional in the patch schema
  • Conditional update based on undefined check
  • Consistent with existing update logic

35-65: Async change is safe—all callers use tRPC hooks which handle it correctly.

The getTerminalPresets procedure change to async is verified safe. All call sites use tRPC's useQuery() hook and invalidate() utilities, which handle async procedures transparently. The initialization logic is solid:

  • Correctly migrates existing presets before the flag existed
  • Seeds defaults only when needed
  • Properly generates IDs with nanoid
  • Marks initialization complete to avoid re-seeding

Comment thread apps/desktop/src/lib/trpc/routers/settings/index.ts
@AviPeltz AviPeltz merged commit d9c6056 into main Dec 16, 2025
11 of 12 checks passed
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.

1 participant