#18365 · @anduimagui · opened Mar 20, 2026 at 8:25 AM UTC · last updated Mar 21, 2026 at 4:54 PM UTC
refactor(app): move command palette to dedicated module
Score breakdown
Impact
Clarity
Urgency
Ease Of Review
Guidelines
Readiness
Size
Trust
Traction
Summary
This PR refactors the command palette logic by moving command registration, action helpers, and dialog openers from layout.tsx to a new layout/commands.tsx module. The goal is to improve maintainability, reduce merge conflicts, and simplify adding new commands. New tests have been added for the moved logic, but a keybinding change contradicts the claim of no UI impact.
Description
Issue for this PR
Closes #
Type of change
- [ ] Bug fix
- [x] New feature
- [x] Refactor / code improvement
- [ ] Documentation
What does this PR do?
This starts by moving the layout command registration block out of packages/app/src/pages/layout.tsx into packages/app/src/pages/layout/commands.tsx, then goes further by moving the command-owned action helpers and dialog openers into the same module.
That expanded scope means layout.tsx no longer carries the inline command wrappers for archiving the current session, creating or toggling workspaces, or opening the provider, server, and settings dialogs. The page now mostly passes the layout state and actions into the command module, which keeps command-related churn in one smaller file and reduces the chance of merge conflicts in a high-traffic page.
A good example of why this refactor matters is the new Edit project command added to the palette. Instead of threading command logic through multiple layout files, the new command can now be added and maintained in packages/app/src/pages/layout/commands.tsx, making it much easier to ship targeted palette actions for the current project.
I also added focused coverage in packages/app/src/pages/layout/commands.test.ts so future command changes have a small test seam around registration, workspace toggling, archive behavior, and dialog-triggering commands.
How did you verify your code works?
Ran bun typecheck in packages/app.
Ran bun test --preload ./happydom.ts ./src/pages/layout/commands.test.ts in packages/app.
Push verification also passed the repo pre-push bun turbo typecheck hook.
Screenshots / recordings
Not needed; this is a code organization change with no intended UI change.
Checklist
- [x] I have tested my changes locally
- [x] I have not included unrelated changes in this PR
Linked Issues
None.
Comments
No comments.
Changed Files
packages/app/e2e/actions.ts
+2−2packages/app/e2e/app/palette.spec.ts
+21−3packages/app/src/components/dialog-actions.tsx
+14−0packages/app/src/components/dialog-command-palette.tsx
+116−0packages/app/src/components/dialog-select-file.tsx
+30−30packages/app/src/context/command.tsx
+12−3packages/app/src/i18n/en.ts
+1−0packages/app/src/pages/layout.tsx
+32−202packages/app/src/pages/layout/commands.test.ts
+234−0packages/app/src/pages/layout/commands.tsx
+265−0