Skip to content

Conversation

@Shironex
Copy link
Collaborator

@Shironex Shironex commented Jan 25, 2026

Summary

  • Extract all type definitions from app-store.ts (4,419 lines) into a modular store/types/ directory
  • Break circular dependency between electron.ts and app-store.ts
  • Maintain backward compatibility through re-exports

Changes

New Files Created (apps/ui/src/store/types/)

File Types Lines
usage-types.ts ClaudeUsage, ClaudeUsageResponse, CodexPlanType, CodexRateLimitWindow, CodexUsage, CodexUsageResponse, isClaudeUsageAtLimit 93
ui-types.ts ViewMode, ThemeMode, BoardViewMode, ShortcutKey, KeyboardShortcuts, DEFAULT_KEYBOARD_SHORTCUTS, parseShortcut, formatShortcut 222
settings-types.ts ApiKeys 5
chat-types.ts ImageAttachment, TextFileAttachment, ChatMessage, ChatSession, FeatureImage 43
terminal-types.ts TerminalPanelContent, TerminalTab, TerminalState, PersistedTerminal*, generateSplitId 82
project-types.ts ClaudeModel, Feature, FileTreeNode, ProjectAnalysis 67
state-types.ts InitScriptState, AutoModeActivity, AppState, AppActions 811
index.ts Re-exports all types 7

Files Modified

  • apps/ui/src/lib/electron.ts - Import from @/store/types/usage-types instead of @/store/app-store (breaks circular dependency)
  • apps/ui/src/store/app-store.ts - Import types from ./types and re-export for backward compatibility

Backward Compatibility

All existing imports from @/store/app-store continue to work:

// These still work
import type { ViewMode, ThemeMode, Feature } from '@/store/app-store';
import { DEFAULT_KEYBOARD_SHORTCUTS, parseShortcut } from '@/store/app-store';

Test Plan

  • Build succeeds (npm run build)
  • Lint passes (npm run lint - 0 errors)
  • Package tests pass (npm run test:packages - 519 tests)
  • Server tests pass (npm run test:server - 1,415 tests)
  • TypeScript compilation succeeds

Summary by CodeRabbit

  • New Features

    • Keyboard shortcut parsing & display support, richer chat messages with image/text attachments, split-pane terminal layouts with session persistence, project analysis/file-tree and feature metadata, API key fields in settings, and usage tracking indicators.
  • Chores

    • Centralized and expanded type definitions to support the above UI features and state management improvements.

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

- Create store/types/ directory with 8 modular type files:
  - usage-types.ts: ClaudeUsage, CodexUsage, isClaudeUsageAtLimit
  - ui-types.ts: ViewMode, ThemeMode, KeyboardShortcuts, etc.
  - settings-types.ts: ApiKeys
  - chat-types.ts: ChatMessage, ChatSession, FeatureImage
  - terminal-types.ts: TerminalState, TerminalTab, etc.
  - project-types.ts: Feature, FileTreeNode, ProjectAnalysis
  - state-types.ts: AppState, AppActions interfaces
  - index.ts: Re-exports all types

- Update electron.ts to import from store/types/usage-types
  (breaks circular dependency between electron.ts and app-store.ts)

- Update app-store.ts to import and re-export types for backward
  compatibility - existing imports from @/store/app-store continue
  to work

This is PR 1 of the app-store refactoring plan.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Shironex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request represents a foundational step in refactoring the application's state management. By moving all type definitions into a dedicated and modular directory structure, it enhances the clarity and navigability of the codebase. This change not only addresses a critical circular dependency but also sets the stage for future improvements by making the core store logic cleaner and more focused on state management rather than type declarations.

Highlights

  • Type Extraction and Modularization: All type definitions from the monolithic app-store.ts file (originally 4,419 lines) have been extracted into a new, modular store/types/ directory. This significantly improves code organization and maintainability.
  • Circular Dependency Resolution: A circular dependency between electron.ts and app-store.ts has been successfully broken by updating import paths in electron.ts to reference the newly created modular type files.
  • Backward Compatibility: Backward compatibility is maintained through re-exports in the new store/types/index.ts file, ensuring that existing imports from @/store/app-store continue to function without requiring immediate changes in consuming code.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds a new UI store types directory with multiple type modules (chat, project, settings, state, terminal, UI, usage), a barrel export, and updates one import in apps/ui/src/lib/electron.ts to use the new usage-types module.

Changes

Cohort / File(s) Change Summary
Core type modules
apps/ui/src/store/types/chat-types.ts, apps/ui/src/store/types/project-types.ts, apps/ui/src/store/types/settings-types.ts, apps/ui/src/store/types/terminal-types.ts, apps/ui/src/store/types/ui-types.ts, apps/ui/src/store/types/usage-types.ts
New TypeScript modules introducing UI-facing data shapes and utilities: chat attachments/messages/sessions, project/feature analysis types, API key shape, terminal layout/persistence types and helper, UI theme/view/keyboard shortcut types and parser/formatter, Claude/Codex usage types and usage-limit utility.
Global state & actions
apps/ui/src/store/types/state-types.ts
New comprehensive AppState and AppActions interfaces (large, nested UI store schema and action contract), plus supporting types like InitScriptState and AutoModeActivity.
Barrel export
apps/ui/src/store/types/index.ts
New index re-exporting the new type modules for unified imports.
Import update
apps/ui/src/lib/electron.ts
Updated type import for ClaudeUsageResponse and CodexUsageResponse to @/store/types/usage-types (was @/store/app-store).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

scope: ui

Poem

🐰 New types hop into their nest,
Barrelled neat, the imports rest,
Chats and terminals line the track,
State and usage tucked in back,
A tiny hop — the store's dressed best. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically summarizes the main objective: extracting type definitions from a monolithic app-store.ts file into modular, organized type files within a new types directory.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@Shironex Shironex self-assigned this Jan 25, 2026
@Shironex Shironex added Refactor A complete logic rewrite is requested or being performed for an issue. cleanup remove unused files in the codebase labels Jan 25, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a significant and well-executed refactoring that extracts type definitions from the monolithic app-store.ts into a modular store/types/ directory. This greatly improves code organization, breaks a circular dependency, and enhances maintainability. The changes are clear and the use of a central index.ts for re-exports ensures backward compatibility. I've added a few suggestions to further improve the separation of types from implementation logic, which aligns with the goal of this refactoring.

Address Gemini review feedback - reduce code duplication by having
FeatureImage extend ImageAttachment instead of duplicating properties.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Shironex
Copy link
Collaborator Author

Response to Gemini Review

Thank you for the thorough review! Here's my response to each suggestion:

✅ Applied: FeatureImage extends ImageAttachment

Implemented in commit f55c985 - this reduces code duplication as suggested.

⏳ Deferred to PR 2: Utility Functions

The following suggestions are explicitly planned for PR 2 (refactor/store-utils) in our refactoring plan:

  • generateSplitId()store/utils/terminal-utils.ts
  • parseShortcut(), formatShortcut()store/utils/shortcut-utils.ts
  • isClaudeUsageAtLimit()store/utils/usage-utils.ts

⏳ Deferred to PR 3: Default Values

The following is explicitly planned for PR 3 (refactor/store-defaults):

  • DEFAULT_KEYBOARD_SHORTCUTSstore/defaults/keyboard-shortcuts.ts

We're following a structured 10-PR refactoring plan to minimize risk:

  1. PR 1 (this PR): Extract types ✅
  2. PR 2: Extract utility functions
  3. PR 3: Extract default values
  4. PR 4-9: Extract slices
  5. PR 10: Final assembly

Moving functions/constants in this PR would conflate type extraction with utility extraction, making the PRs harder to review individually.

@Shironex Shironex merged commit 7fe9aac into v0.14.0rc Jan 25, 2026
14 checks passed
@Shironex Shironex deleted the refactor/store-types branch January 25, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup remove unused files in the codebase Refactor A complete logic rewrite is requested or being performed for an issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants