Skip to content

feat(settings): let the Ghostty import read a config file you pick - #18659

Closed
DeVFirmino wants to merge 1 commit into
stablyai:mainfrom
DeVFirmino:feat/ghostty-import-choose-file
Closed

DeVFirmino wants to merge 1 commit into
stablyai:mainfrom
DeVFirmino:feat/ghostty-import-choose-file

Conversation

@DeVFirmino

@DeVFirmino DeVFirmino commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Orca can copy a terminal appearance from a Ghostty config. The import reads only the paths that Ghostty uses. This change adds a second button. The button lets you select any file. The import itself does not change.

What Changed

  • previewGhosttyImport takes an optional { kind: 'auto' | 'chooseFile' }. Warp validates its source the same way. The source is an object with only kind. Extra fields, null, and chooseFolder are rejected.
  • chooseFile opens the native dialog. The function reads only the picked file. If you dismiss the dialog, or pick nothing, the function returns { found: false, canceled: true }. The function applies nothing. The preview modal opens only after you pick a file. Cancel leaves the modal closed.
  • The picked file uses the same read, parse, map, and diff pipeline. The existing size ceiling applies. Parser, mapper, and apply are untouched. Discovery (src/main/ghostty/discovery.ts) is untouched.
  • The picker is unfiltered. Ghostty's canonical file is the extensionless config. An extension filter would grey out that file on macOS.
  • A second button, "Choose Config File", is next to "Import from Ghostty". New strings use i18n and the settings search index. The new button is hidden on the paired web client (!isWebClientLocation()). A native dialog cannot open there.
  • A call with no argument still uses auto-discovery. The onboarding theme step is unchanged.

Why

Auto-discovery reads only the config locations that Ghostty uses. You cannot import a config that is in a different location. You must first write that config into ~/.config/ghostty/config. That action overwrites an unrelated file. That file belongs to a different program.

The import already works. The gap is that you cannot select a file as the source. The Warp theme import is in the same section. That import already has a file picker. This change removes a difference between two buttons that are next to each other. This change does not add a new concept. Ghostty does not get Warp's chooseFolder. This import reads a config file. It does not read a theme directory.

Linked Issue

Fixes #18658

Visual Proof

Settings -> Appearance -> Terminal Typography, at the same window size and crop.

Before. The heading action is only "Import from Ghostty".

Before

After. "Import from Ghostty" and "Choose Config File" are next to each other.

After

The images are on a separate branch of my fork, not in this pull request. The template asks that image files are not committed here.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Ten new main-process tests: no-argument auto-discovery, invalid source, cancel, empty selection, file over the size ceiling, unreadable file, picked file that produces the same diff as auto-discovery, only the picked file is read, dialog anchoring, and a window-less picker. Plus IPC (source forwarded), hook (the modal opens only after a pick. Cancel leaves the modal closed), and UI (button next to the existing one. Hidden on the paired web client).

pnpm lint and pnpm typecheck pass. pnpm test reports 13 failures out of 72,121. All 13 failures are pre-existing and unrelated. The cross-version-wire harness needs git tags. This run used a shallow clone. One flake occurred under load. Every test file in the touched areas passes. pnpm build was not run locally. CI should cover it.

Tested on macOS. Linux and Windows use the same Electron dialog and the existing read path. Unit tests cover those platforms.

AI Disclosure

I implemented this with Claude (Claude Code). I reviewed the work before I submitted it.

Review

Cross-platform: this change has no new path handling. The picker returns an absolute path. The existing read path is unchanged. The dialog is unfiltered on purpose (extensionless config). SSH/remote: the dialog and the file read happen on the desktop client. This is the same as the existing import. Mobile: untouched. Mobile keeps its own typography. Paired web: the new button is gated on !isWebClientLocation(). Agents/integrations: no agent or provider surface. Security: no new IPC channel. The source is validated before use (rejects extra fields). The size ceiling still applies. Performance: one extra dialog on an explicit click. The change does no work at startup. UI: the new button is next to the existing one and wraps. Cancel does not flash an empty modal. Backwards compatibility: the no-argument call keeps auto-discovery.

Agent skill upstream boundary

  • Not applicable.

Notes

A separate, pre-existing gap exists. The discovered-config button is not gated on the paired web client. The web settings API does not implement previewGhosttyImport. The button appears there and fails silently. This PR does not change that. This PR stays on one topic. I can open a follow-up.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Auto-discovery only reads Ghostty's own config locations, so a config kept
anywhere else could not be imported without writing it into
~/.config/ghostty/config first. Give the Ghostty import the same optional
source the Warp theme import already has: `{ kind: 'auto' | 'chooseFile' }`,
validated strictly, with a dismissed picker returning a canceled preview.

Auto-discovery stays the default and the no-argument call is unchanged, so
the onboarding theme step keeps working. The picked file goes through the
same read, parse, map and diff pipeline under the existing size ceiling —
the parser, mapper and apply semantics are untouched.

The new button is gated on !isWebClientLocation(): a native dialog cannot be
opened from a paired web client. The pre-existing web-client gap on the
discovered-config button is left alone and tracked separately.
@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds GhosttyImportSource with auto and chooseFile modes. The main process validates sources, opens an Electron file picker, handles cancellation, and previews selected configs. IPC and preload APIs forward the source and requesting window. The renderer adds a desktop-only “Choose Config File” control, search entries, localized strings, and state handling for cancellation and errors. Tests cover backend resolution, IPC forwarding, picker behavior, and renderer interactions.

Merge Risk: 🔵 Low · up to 9ff13

This adds a desktop file chooser for Ghostty configuration imports while preserving the existing preview and apply flow. The feature implementation is covered across its layers, but the new manual-import test mock should target the same filesystem module identifier as production code before relying on that coverage.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 17 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation satisfies issue #18658. It preserves auto-discovery, adds a validated chooseFile source, uses the existing import pipeline and size limit, handles cancellation without applying chan…
Out of Scope Changes check ✅ Passed The changes are focused on adding file selection to Ghostty configuration import. The related tests, IPC and preload plumbing, localization entries, search integration, and allowlist updates support t…
Title check ✅ Passed The title clearly and concisely describes the main change: allowing users to select a Ghostty configuration file for import.
Description check ✅ Passed The description follows the repository template. It explains the change and rationale, links issue #18658, provides visual proof, documents testing and platform considerations, discloses AI use, and c…
Full details: Docstring Coverage

Explanation

Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 17 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 3f41b7cc-a8e8-44c1-bc7b-320ba2c8e08d

📥 Commits

Reviewing files that changed from the base of the PR and between a5c6f40 and 9ff13b3.

📒 Files selected for processing (19)
  • config/localization-coverage-allowlist.json
  • src/main/ghostty/ghostty-import-source-validation.ts
  • src/main/ghostty/index.test.ts
  • src/main/ghostty/index.ts
  • src/main/ghostty/manual-config-import.test.ts
  • src/main/ghostty/manual-ghostty-config-file.ts
  • src/main/ghostty/theme-import.test.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/preload/api/settings-api.ts
  • src/preload/api/settings-bridge.ts
  • src/renderer/src/components/settings/TerminalAppearanceSection.ghostty.test.ts
  • src/renderer/src/components/settings/TerminalAppearanceSection.tsx
  • src/renderer/src/components/settings/terminal-advanced-platform-search.ts
  • src/renderer/src/components/settings/terminal-search.ts
  • src/renderer/src/components/settings/useGhosttyImport.test.ts
  • src/renderer/src/components/settings/useGhosttyImport.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/global-settings-types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Reviewed the full diff: an optional { kind: 'auto' | 'chooseFile' } source for the Ghostty import plus the plumbing, dialog, hook, UI, and search/i18n wiring that let users point the import at an arbitrary config file.

  • previewGhosttyImport source parameter — gains optional validated source and webContents; no-argument calls still auto-discover, so the onboarding theme step is untouched.
  • Main-process modules — ghostty-import-source-validation.ts (rejects null, extra fields, and chooseFolder) and manual-ghostty-config-file.ts (unfiltered native open dialog, anchored to the requesting window when resolvable).
  • IPC + preload — handler forwards args and event.sender; bridge signature is (source?: GhosttyImportSource).
  • Renderer hook + UI — handleChooseFileClick previews before opening the modal (cancel leaves it closed); the button is gated off the paired web client via !isWebClientLocation().
  • Search + i18n — new search entries gated behind the desktop-only bucket, en.json strings, and the localization coverage allowlist count bump.

The source is validated before any file is read (extra fields and a smuggled path are rejected), the picked file still goes through the existing size ceiling, and the read/parse/map/diff pipeline is unchanged. Tests assert exact values rather than truthiness, including that only the picked file is read and that a dismissed picker touches nothing.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker

nwparker commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Thank you @DeVFirmino for this PR and the careful write-up in #18658! The pick-a-file Ghostty import has landed in #37353. It builds directly on your design: the same { kind: 'auto' | 'chooseFile' } source validation, the unfiltered picker so the extensionless config stays selectable, and a dismissed picker leaving settings untouched. The one change is placement: the picker lives inside the import preview, so the Kitty import that followed could reuse the same flow. You're credited in the PR description. Closing this one in favor of it. Really appreciate the contribution!

@nwparker nwparker closed this Nov 2, 2026
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.

[Feature]: Let the Ghostty import read a config file you pick

2 participants