Skip to content

Conversation

@Shironex
Copy link
Collaborator

@Shironex Shironex commented Jan 25, 2026

Summary

  • Extract pure utility functions from app-store.ts into a modular store/utils/ directory
  • Move shortcut parsing/formatting, theme storage, and usage limit checking utilities
  • Maintain backward compatibility through re-exports from app-store.ts

Changes

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

File Functions Lines
theme-utils.ts THEME_STORAGE_KEY, FONT__STORAGE_KEY, getStoredTheme, getStoredFont, saveThemeToStorage, saveFontToStorage, getEffectiveFont, persistEffectiveThemeForProject 115
shortcut-utils.ts parseShortcut, formatShortcut, DEFAULT_KEYBOARD_SHORTCUTS 117
usage-utils.ts isClaudeUsageAtLimit 34
index.ts Re-exports public utilities 13

Files Modified

File Changes
apps/ui/src/store/app-store.ts Import utilities from ./utils, remove inline definitions, update re-exports
apps/ui/src/store/types/ui-types.ts Remove utility functions (moved to utils/)
apps/ui/src/store/types/usage-types.ts Remove utility function (moved to utils/)
apps/ui/src/lib/electron.ts Import from @/store/app-store instead of @/store/types/usage-types

Backward Compatibility

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

// These still work
import { parseShortcut, formatShortcut, DEFAULT_KEYBOARD_SHORTCUTS } from '@/store/app-store';
import { getStoredTheme, THEME_STORAGE_KEY } from '@/store/app-store';
import { isClaudeUsageAtLimit } from '@/store/app-store';

New canonical import path:

import { parseShortcut, formatShortcut } from '@/store/utils';

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)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added OS-aware keyboard shortcut parsing/formatting and a default shortcut set for consistent display.
    • Added persistent theme and font preference handling (read/write and project-specific fallbacks).
    • Centralized usage-limit check for Claude-style usage to drive auto-mode behavior.
  • Refactor

    • Moved and re-exposed utilities into dedicated modules for cleaner public APIs and maintenance.

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

@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 significantly refactors the application's store by reorganizing utility functions into a more modular and maintainable structure. By extracting theme, shortcut, and usage-related logic into their own dedicated files, the change enhances code clarity and separation of concerns within the app-store. This refactoring improves the overall architecture without altering external behavior, as backward compatibility is maintained through strategic re-exports.

Highlights

  • Modularization of Utilities: Pure utility functions previously residing in app-store.ts, ui-types.ts, and usage-types.ts have been extracted into new, dedicated modules within a store/utils/ directory.
  • New Utility Modules Created: Three new modules were created: theme-utils.ts for theme and font storage, shortcut-utils.ts for keyboard shortcut parsing and formatting, and usage-utils.ts for Claude usage limit checking.
  • Centralized Export: A new store/utils/index.ts file was introduced to provide a single point of export for these public utility functions, simplifying imports for consumers.
  • Backward Compatibility Maintained: app-store.ts now imports and re-exports these modularized utilities, ensuring that existing code relying on their previous locations continues to function without modification.

🧠 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

Warning

Rate limit exceeded

@Shironex has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 38 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

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

This PR moves theme, shortcut, and Claude-usage helpers out of store type files into new utility modules, adds a utils barrel export, updates imports/exports in the store and electron type import paths, and re-exports select utilities from the new modules. No runtime behavior changes.

Changes

Cohort / File(s) Summary
Store core update
apps/ui/src/store/app-store.ts
Replaced inline theme/shortcut/usage helpers with imports from new store/utils/* modules; updated initial state to use those utils; added generateSplitId re-export for compatibility.
Type cleanup
apps/ui/src/store/types/ui-types.ts, apps/ui/src/store/types/usage-types.ts
Removed parseShortcut, formatShortcut, DEFAULT_KEYBOARD_SHORTCUTS (ui-types) and removed isClaudeUsageAtLimit (usage-types); these moved to utility modules.
New utilities & barrel
apps/ui/src/store/utils/index.ts, .../shortcut-utils.ts, .../theme-utils.ts, .../usage-utils.ts
Added shortcut parsing/formatting and default shortcuts, theme/font persistence and resolution, and Claude usage limit check; created barrel re-exporting these utilities.
Import path update
apps/ui/src/lib/electron.ts
Switched type-only import for ClaudeUsageResponse and CodexUsageResponse from @/store/types/usage-types to @/store/app-store.
Package manifest
package.json
One-line change (shown in diff).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Refactor, cleanup

Poem

🐰
Hop, hop — code in tidy rows,
Utilities where the wildflower grows.
Themes and shortcuts jump to new nooks,
Claude checks settled in neat little books.
A carrot-cheer for cleaner hooks!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.73% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(store): Extract utility functions into store/utils/' accurately and concisely summarizes the main change: extracting utility functions from the store into a new utils directory structure.

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


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.

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 does a great job of refactoring pure utility functions out of app-store.ts into dedicated modules under store/utils/. This significantly improves the organization and maintainability of the store logic. The changes are well-structured, and maintaining backward compatibility through re-exports is a good approach. I have a couple of suggestions for the new theme-utils.ts file to further improve encapsulation and consistency with your storage abstraction.

@Shironex Shironex force-pushed the refactor/store-utils branch from eda187d to 2765c1f Compare January 25, 2026 22:00
Copy link

@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: 2

🤖 Fix all issues with AI agents
In `@apps/ui/src/store/utils/theme-utils.ts`:
- Around line 48-63: The getEffectiveFont function currently returns null when a
provided projectFont is invalid, which prevents a valid globalFont from being
used; update getEffectiveFont (and its isValidFont check) so that an invalid
projectFont is treated as "unset" (i.e., do not return null from the projectFont
branch) and the logic falls through to evaluate globalFont instead, preserving
the existing DEFAULT_FONT_VALUE handling and the final return behavior that maps
DEFAULT_FONT_VALUE to null; locate getEffectiveFont and isValidFont in
theme-utils.ts and remove the early return on invalid projectFont so the
globalFont fallback can apply.
- Around line 90-105: The direct localStorage.removeItem calls in
saveFontSansToStorage and saveFontMonoToStorage are unsafe for SSR/tests;
replace those with the storage wrapper's remove method (use the same helper
namespace as setItem, e.g., removeItem(FONT_SANS_STORAGE_KEY) and
removeItem(FONT_MONO_STORAGE_KEY)) or guard access via the helper so
reads/writes/removals all go through the storage utility rather than calling
localStorage directly.

Move pure utility functions from app-store.ts and type files into
dedicated utils modules for better separation of concerns:

- theme-utils.ts: Theme and font storage utilities
- shortcut-utils.ts: Keyboard shortcut parsing/formatting
- usage-utils.ts: Usage limit checking

All utilities are re-exported from store/utils/index.ts and
app-store.ts maintains backward compatibility for existing imports.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Shironex Shironex force-pushed the refactor/store-utils branch from 2765c1f to 8caec15 Compare January 25, 2026 22:03
Copy link

@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

🤖 Fix all issues with AI agents
In `@apps/ui/src/store/utils/shortcut-utils.ts`:
- Around line 31-76: formatShortcut currently collapses cmdCtrl into
platform-specific labels so Windows/Linux show "Win"/"Super" for Ctrl shortcuts;
change the mapping so non-mac platforms use "Ctrl" (and the Ctrl symbol/text)
instead of "Win"/"Super". In formatShortcut, update the cmdCtrl branch and its
forDisplay/non-forDisplay branches (the code that pushes platform === 'darwin' ?
'⌘' : platform === 'win32' ? '⊞' : '◆' and the corresponding
'Cmd'/'Win'/'Super') to push 'Ctrl' (or the appropriate display symbol/text for
Ctrl) when platform !== 'darwin', ensuring both display-mode (forDisplay) and
non-display mode use Ctrl for non-mac instead of Win/Super.
🧹 Nitpick comments (2)
apps/ui/src/store/utils/shortcut-utils.ts (1)

1-1: Prefer a shared-package or canonical barrel for these types.

This new relative import adds another deep path into store types; if these are core UI types, consider moving them to a shared package (e.g., @automaker/types) or at least importing from the store types barrel to keep paths stable.

As per coding guidelines, and based on learnings, ...

apps/ui/src/store/app-store.ts (1)

102-121: Align new utils imports with the shared‑package import policy.

These new relative imports introduce additional internal paths; if the utilities are intended for reuse across modules, expose them via an @automaker/* package (or a canonical barrel) and import from there to match the repo’s import convention.

As per coding guidelines, ...

@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
@Shironex Shironex merged commit e876d17 into v0.14.0rc Jan 25, 2026
8 of 10 checks passed
@Shironex Shironex deleted the refactor/store-utils branch January 25, 2026 22:18
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