Skip to content

refactor: decompose 8 large files into focused components#127

Merged
jbdevprimary merged 8 commits intomainfrom
ralph/ws-decomposition-2
Feb 12, 2026
Merged

refactor: decompose 8 large files into focused components#127
jbdevprimary merged 8 commits intomainfrom
ralph/ws-decomposition-2

Conversation

@jbdevprimary
Copy link
Contributor

Summary

  • US-115: Decompose 3 screens over 400 lines

    • project/[id].tsx → ProjectHeader, ProjectFileExplorer, ProjectActions
    • create-project.tsx → RepoSelector, ProjectForm
    • credentials.tsx → CredentialItem, ApiKeyInput
  • US-116: Decompose 5 files at 300-350 lines

    • agent/[id].tsx → AgentMetrics, AgentHistory, AgentActions
    • settings.tsx → SettingsItem, SettingsSection
    • github-auth.tsx → DeviceCodeDisplay, PollingStatus
    • openai-client.ts → StreamParser extracted
    • FileTree.tsx → TreeNode extracted

Results

All files now under 250 lines. 15 new focused components with barrel re-exports for backward compatibility.

Verification

  • TypeScript typecheck: PASS
  • All backward-compatible exports preserved

🤖 Generated with Claude Code

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Warning

Rate limit exceeded

@jbdevprimary has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 26 minutes and 11 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.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ralph/ws-decomposition-2

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.

@gemini-code-assist
Copy link

Summary of Changes

Hello @jbdevprimary, 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 improves the codebase's modularity and maintainability by decomposing eight large files into smaller, more focused, and reusable components. This refactoring effort aims to reduce file complexity, enhance readability, and streamline future development and testing. The changes primarily involve extracting UI elements and logic into new, dedicated components, ensuring that each component adheres to the single responsibility principle and keeps file sizes manageable.

Highlights

  • Decomposition of create-project.tsx: The create-project.tsx screen was refactored into smaller, focused components: RepoSelector for repository selection and ProjectFormHeader and ProjectFormActions for project form elements and actions.
  • Decomposition of github-auth.tsx: The github-auth.tsx screen was broken down into DeviceCodeDisplay to manage the display of the GitHub device code and PollingStatus to show authentication polling progress.
  • Decomposition of settings.tsx: The settings.tsx screen was refactored into SettingsItem for individual setting rows and SettingsSection for grouping related settings.
  • Decomposition of agent/[id].tsx: The agent/[id].tsx screen was split into AgentMetrics for displaying agent performance, AgentHistory for task history, and AgentActions for agent control buttons.
  • Decomposition of project/[id].tsx: The project/[id].tsx screen was modularized into ProjectHeader for project overview, ProjectFileExplorer for file tree display, and ProjectCommits, ProjectTasks, and ProjectAgents for their respective tab contents.
  • Decomposition of credentials.tsx: The credentials.tsx screen was refactored into CredentialItem for displaying individual credential status and ApiKeyInput for managing API key inputs.
  • Extraction of OpenAI Stream Parsing Logic: The stream parsing logic within openai-client.ts was extracted into new dedicated files: openai-helpers.ts and openai-stream-parser.ts, improving modularity and maintainability.
  • Extraction of FileTree Node Logic: The rendering logic for individual nodes in FileTree.tsx was extracted into a new TreeNode component, simplifying the main FileTree component.
Changelog
  • app/(onboarding)/create-project.tsx
    • Removed direct UI rendering for repository selection and project form actions.
    • Integrated RepoSelector, ProjectFormHeader, and ProjectFormActions components.
  • app/(onboarding)/github-auth.tsx
    • Removed direct UI rendering for device code display and polling status.
    • Integrated DeviceCodeDisplay and PollingStatus components.
  • app/(tabs)/settings.tsx
    • Removed direct UI rendering for settings items and sections.
    • Integrated SettingsItem and SettingsSection components.
  • app/agent/[id].tsx
    • Removed direct UI rendering for agent metrics, history, and controls.
    • Integrated AgentMetrics, AgentHistory, and AgentActions components.
  • app/project/[id].tsx
    • Removed direct UI rendering for project header, file explorer, commits, tasks, and agents.
    • Integrated ProjectHeader, ProjectFileExplorer, ProjectCommits, ProjectTasks, and ProjectAgents components.
  • app/settings/credentials.tsx
    • Removed direct UI rendering for credential items and API key inputs.
    • Integrated CredentialItem and ApiKeyInput components.
  • packages/agent-intelligence/src/services/ai/openai-client.ts
    • Extracted stream parsing logic into openai-helpers.ts and openai-stream-parser.ts.
    • Updated stream processing to use the new parser state and functions.
  • packages/agent-intelligence/src/services/ai/openai-helpers.ts
    • Added new file containing helper functions for OpenAI message formatting and stop reason mapping.
  • packages/agent-intelligence/src/services/ai/openai-stream-parser.ts
    • Added new file containing logic for managing OpenAI stream parsing state and processing chunks.
  • src/components/agents/AgentActions.tsx
    • Added new component for agent control buttons (idle/working status toggles).
  • src/components/agents/AgentHistory.tsx
    • Added new component for displaying an agent's task history list.
  • src/components/agents/AgentMetrics.tsx
    • Added new component for displaying an agent's task completion metrics.
  • src/components/agents/index.ts
    • Updated exports to include AgentMetrics, AgentHistory, and AgentActions.
  • src/components/code/FileTree.tsx
    • Removed internal FileTreeNode component logic.
    • Integrated the new TreeNode component for rendering file tree nodes.
  • src/components/code/TreeNode.tsx
    • Added new component for rendering individual file or folder nodes within a file tree.
  • src/components/onboarding/DeviceCodeDisplay.tsx
    • Added new component for displaying GitHub device codes during authentication.
  • src/components/onboarding/PollingStatus.tsx
    • Added new component for displaying authentication polling progress and error messages.
  • src/components/onboarding/ProjectForm.tsx
    • Added new components ProjectFormHeader for project name input and ProjectFormActions for bottom action buttons.
  • src/components/onboarding/RepoSelector.tsx
    • Added new component for selecting existing repositories and creating new ones.
  • src/components/onboarding/index.ts
    • Updated exports to include RepoSelector, ProjectFormHeader, ProjectFormActions, DeviceCodeDisplay, and PollingStatus.
  • src/components/project/ProjectActions.tsx
    • Added new components ProjectCommits for commit history, ProjectTasks for task lists, and ProjectAgents for agent display.
  • src/components/project/ProjectFileExplorer.tsx
    • Added new component for displaying a project's file tree.
  • src/components/project/ProjectHeader.tsx
    • Added new component for displaying project header information like repo URL and branch status.
  • src/components/project/index.ts
    • Updated exports to include ProjectHeader, ProjectFileExplorer, ProjectCommits, ProjectTasks, and ProjectAgents.
  • src/components/settings/CredentialSection.tsx
    • Added new components CredentialItem for displaying credential status and ApiKeyInput for API key management.
  • src/components/settings/SettingsItem.tsx
    • Added new component for a reusable settings row with icon, text, toggle, and navigation arrow.
  • src/components/settings/SettingsSection.tsx
    • Added new component for a labeled section wrapper for settings screens.
  • src/components/settings/index.ts
    • Updated exports to include CredentialItem, ApiKeyInput, SettingsItem, and SettingsSection.
Activity
  • The pull request was created to decompose large files into smaller, more manageable components.
  • No human activity has been recorded on this pull request yet.
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.

Copy link
Contributor

@amazon-q-developer amazon-q-developer bot left a comment

Choose a reason for hiding this comment

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

Summary

This refactoring successfully decomposes 8 large files (300-400+ lines) into 15 focused components, bringing all files under 250 lines. The changes maintain backward compatibility through barrel exports and preserve all existing functionality.

Key Improvements

Clean component extraction - Each new component has a single, clear responsibility
Type safety maintained - All TypeScript types properly exported and imported
No logic changes - Pure refactoring without behavioral modifications
Error handling preserved - All existing error handling remains intact
Backward compatibility - Barrel re-exports ensure no breaking changes

Files Reviewed

  • openai-client.tsopenai-helpers.ts + openai-stream-parser.ts
  • FileTree.tsxTreeNode.tsx extracted
  • create-project.tsxRepoSelector, ProjectForm components
  • github-auth.tsxDeviceCodeDisplay, PollingStatus components
  • settings.tsxSettingsItem, SettingsSection components
  • credentials.tsxCredentialItem, ApiKeyInput components
  • agent/[id].tsxAgentMetrics, AgentHistory, AgentActions components
  • project/[id].tsxProjectHeader, ProjectFileExplorer, ProjectActions components

The refactoring improves code maintainability and testability without introducing any defects. Ready to merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

jbdevprimary and others added 2 commits February 11, 2026 23:48
…ponents

Extract ProjectHeader, ProjectFileExplorer, ProjectCommits, ProjectTasks,
and ProjectAgents from app/project/[id].tsx into src/components/project/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…or and ProjectForm

Extract RepoSelector and ProjectForm (Header + Actions) from
app/(onboarding)/create-project.tsx into src/components/onboarding/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Feb 12, 2026

🚀 Expo preview is ready!

  • Project → thumbcode
  • Platforms → android, ios
  • Scheme → thumbcode
  • Runtime Version → 0.1.0
  • More info

Learn more about 𝝠 Expo Github Action

jbdevprimary and others added 6 commits February 11, 2026 23:49
…ntials screen

Move CredentialItem and ApiKeyInput components into
src/components/settings/CredentialSection.tsx for reuse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…entHistory, AgentActions

Extract reusable agent components from app/agent/[id].tsx into
src/components/agents/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tings screen

Move SettingsItem and SettingsSection into src/components/settings/
for reuse across settings-related screens.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…m github-auth screen

Move auth UI components into src/components/onboarding/ for reuse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eam-parser

Move stream chunk processing and result assembly logic into a
dedicated openai-stream-parser module.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move TreeNode rendering logic into src/components/code/TreeNode.tsx.
Extract formatMessagesForOpenAI, parseOpenAIContent, and mapOpenAIStopReason
into openai-helpers.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jbdevprimary jbdevprimary force-pushed the ralph/ws-decomposition-2 branch from 9b8bc04 to 4a75997 Compare February 12, 2026 05:49
@jbdevprimary jbdevprimary merged commit 0ff4c29 into main Feb 12, 2026
8 checks passed
@jbdevprimary jbdevprimary deleted the ralph/ws-decomposition-2 branch February 12, 2026 05:50
Copy link

@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 an excellent and extensive refactoring effort that successfully decomposes several large files into smaller, more focused, and reusable components. The changes significantly improve the codebase's modularity, readability, and maintainability, aligning perfectly with the goals outlined in the description. The new component structure is logical and the extractions have been handled cleanly. I've included a couple of suggestions for minor improvements to further enhance maintainability, but overall, this is a very strong contribution.

Comment on lines +20 to +41
interface RepoSelectorProps {
repos: RepoListItem[];
filteredRepos: RepoListItem[];
selectedRepo: RepoListItem | null;
searchQuery: string;
isLoadingRepos: boolean;
errorMessage: string | null;
onSelectRepo: (repo: RepoListItem) => void;
onSearchChange: (query: string) => void;
// New repo creation
mode: 'select' | 'create';
onModeChange: (mode: 'select' | 'create') => void;
newRepoName: string;
newRepoDescription: string;
newRepoPrivate: boolean;
isCreatingRepo: boolean;
onNewRepoNameChange: (name: string) => void;
onNewRepoDescriptionChange: (desc: string) => void;
onNewRepoPrivateChange: (isPrivate: boolean) => void;
onCreateNewRepo: () => void;
}

Choose a reason for hiding this comment

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

medium

The RepoSelectorProps interface has a large number of props, which can make the component harder to use and maintain. Consider grouping related props into objects. For example, all props related to new repository creation could be grouped into a newRepoForm object. This would make the component's signature cleaner and more organized.

Example:

interface NewRepoFormProps {
  mode: 'select' | 'create';
  onModeChange: (mode: 'select' | 'create') => void;
  name: string;
  onNameChange: (name: string) => void;
  description: string;
  onDescriptionChange: (desc: string) => void;
  isPrivate: boolean;
  onIsPrivateChange: (isPrivate: boolean) => void;
  isCreating: boolean;
  onCreate: () => void;
}

interface RepoSelectorProps {
  // ... other props
  newRepoForm: NewRepoFormProps;
}

This would require refactoring in both this component and its parent, create-project.tsx, but it would improve long-term maintainability.

</View>
) : (
commits.map((c, idx) => (
<View key={`${c.sha}-${idx}`}>

Choose a reason for hiding this comment

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

medium

Using an index idx as part of a React key is an anti-pattern. If the commits array changes (e.g., a new commit is added), indices will shift, causing unnecessary re-renders and potential state issues. Since c.sha is a 7-character slice of the commit hash, it should be unique enough for this list. Using it alone as the key is more stable and performant.

Suggested change
<View key={`${c.sha}-${idx}`}>
<View key={c.sha}>

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
55.4% Coverage on New Code (required ≥ 80%)
4.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

1 participant