Skip to content

Split server CLI into focused submodules#2545

Merged
juliusmarminge merged 3 commits intomainfrom
t3code/cli-submodules
May 6, 2026
Merged

Split server CLI into focused submodules#2545
juliusmarminge merged 3 commits intomainfrom
t3code/cli-submodules

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented May 6, 2026

Summary

  • Split the large apps/server/src/cli.ts implementation into focused submodules for config resolution, auth commands, project commands, and server commands.
  • Kept the top-level CLI entrypoint minimal by composing the subcommands from the new modules.
  • Preserved the existing command behavior while improving maintainability and making the CLI easier to navigate.

Testing

  • Not run (bun fmt)
  • Not run (bun lint)
  • Not run (bun typecheck)

Note

Medium Risk
Mostly a structural refactor, but it changes the CLI entrypoint wiring and adds an import.meta.main guard, so packaging/import behavior and command routing could regress if any flags/subcommands were mis-composed.

Overview
Refactors the server CLI by deleting the monolithic cli.ts and splitting it into focused modules: cli/config.ts (flag/env/bootstrap config resolution + duration parsing), cli/server.ts (start/serve/run), cli/auth.ts (pairing/session management), and cli/project.ts (project add/rename/remove with live-server fallback).

Updates bin.ts to compose the top-level cli from these subcommands/flags and only execute Command.run when bin.ts is the main module (import.meta.main), and adjusts tests to import cli from bin.ts and cover auth/project command behavior plus config resolution via the new modules.

Reviewed by Cursor Bugbot for commit 798a769. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Split server CLI monolith into focused submodules under cli/

Breaks the monolithic cli.ts into focused modules: config.ts for flag schemas and config resolution, auth.ts for auth subcommands, server.ts for server start logic, and project.ts for project management subcommands. The bin.ts entrypoint assembles the root command from these submodules. Behavioral Change: importing bin.ts no longer executes the CLI — execution only occurs when the module is the program entrypoint (import.meta.main).

Macroscope summarized 798a769.

- Extract auth, config, project, and server CLI commands
- Keep `cli.ts` as the top-level command wiring entrypoint
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 80dd70e5-6401-4d14-b91c-0e80ea4e8637

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/cli-submodules

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels May 6, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes May 6, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 6, 2026

Approvability

Verdict: Approved

Pure mechanical reorganization splitting a monolithic CLI file into focused submodules. Code is moved verbatim without logic changes, and the added import.meta.main guard is standard practice for testability.

You can customize Macroscope's approvability policy. Learn more.

- Split the main `t3` command setup into `apps/server/src/bin.ts`
- Update tests and config imports to reference the new module
@macroscopeapp macroscopeapp Bot dismissed their stale review May 6, 2026 05:55

Dismissing prior approval to re-evaluate a5cb5f8

- Rename the CLI config test to `apps/server/src/cli/config.test.ts`
- Update imports to match the new test location
@juliusmarminge juliusmarminge merged commit 499f146 into main May 6, 2026
12 checks passed
@juliusmarminge juliusmarminge deleted the t3code/cli-submodules branch May 6, 2026 06:02
imabdulazeez added a commit to imabdulazeez/t3code that referenced this pull request May 6, 2026
Brings in: server CLI submodule split (pingdotgg#2545), process/trace diagnostics
views (pingdotgg#2532), JetBrains editor support (pingdotgg#2475), MessagesTimeline render
optimizations (pingdotgg#2527, pingdotgg#2498), git/terminal test stabilization (pingdotgg#2540),
keybindings settings editor (pingdotgg#2533), and provider update advisories
(pingdotgg#2312).

Conflict resolutions:
- packages/contracts/src/settings.ts: kept aa's diffFontFamily and
  terminalFontFamily alongside upstream's
  dismissedProviderUpdateNotificationKeys.
- apps/desktop/src/clientPersistence.test.ts: same shape, fixture mirrors
  the schema.
- apps/web/src/components/settings/SettingsPanels.tsx: kept both import
  groups (FontPicker from aa, ProviderUpdateLaunchNotification.logic from
  upstream).
- apps/web/src/localApi.test.ts: extended both fixtures with
  diffFontFamily and terminalFontFamily so the merged ClientSettings
  shape typechecks against the strict desktop bridge contract.

Pre-existing aa typecheck issues fixed at the root so the merge commit
is green:
- apps/desktop/src/electron.d.ts: declaration-merge "local-fonts" into
  Electron's Session.setPermissionRequestHandler permission union (the
  Electron 40 typings omit it even though the runtime supports it).
- apps/web/src/components/DiffPanel.tsx: conditionally spread style on
  Virtualizer instead of passing undefined, satisfying
  exactOptionalPropertyTypes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant