Skip to content

feat(cli): add routing and screen layout with react-router - #7

Merged
RaplesWojtyla merged 1 commit into
mainfrom
feat/cli-routing-and-screens
Jul 18, 2026
Merged

RaplesWojtyla merged 1 commit into
mainfrom
feat/cli-routing-and-screens

Conversation

@RaplesWojtyla

@RaplesWojtyla RaplesWojtyla commented Jul 18, 2026 •

Copy link
Copy Markdown
Owner

New Features

  • Added a CLI home screen with message entry and session navigation.
  • Added session views with user, bot, and error message displays.
  • Added loading indicators and a session input shell.
  • Added themed layouts and routed navigation for home and session screens.

Style

  • Improved split-border rendering for message panels.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The CLI now uses React Router for home and session routes, restores provider-backed themed layouts, and adds session shells with user, bot, error, and loading components.

Changes

CLI session interface

Layer / File(s) Summary
Routing and themed layouts
packages/cli/src/index.tsx, packages/cli/src/layouts/*, packages/cli/src/screens/*, packages/cli/package.json
Memory-router routes now render provider-backed layouts, with home navigation passing message state into the new-session screen.
Session shell and message rendering
packages/cli/src/components/border.tsx, packages/cli/src/components/messages/*, packages/cli/src/components/session-shell.tsx, packages/cli/src/components/spinner.tsx
Session content is rendered in themed bordered message components with input handling, loading feedback, and spinner support.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Router
  participant Home
  participant NewSession
  participant SessionShell
  CLI->>Router: initialize memory routes
  Router->>Home: render home screen
  Home->>Router: navigate with message
  Router->>NewSession: render new session
  NewSession->>SessionShell: render session content
Loading

Possibly related PRs

Poem

I’m a rabbit hopping through routes bright,
With themed boxes glowing just right.
Messages stack, the spinner twirls,
New sessions bloom in terminal swirls.
“Hop!” says the CLI, and off it goes!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No description was provided, so there isn't enough content to assess beyond its absence. Add a brief description of the routing and screen-layout changes so reviewers have a summary of the PR's intent.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately describes the main change: CLI routing and screen layout built with React Router.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-routing-and-screens

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/cli/src/components/messages/error-message.tsx (1)

10-33: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract a shared BorderedMessage component to eliminate duplication.

ErrorMessage and UserMessage share ~90% of their JSX structure — the same outer box, SplitBorder wrapper with borderColor, and inner box with colors.surface background and centered padding. The only differences are the borderColor value (colors.error vs colors.primary) and TextAttributes.DIM on the error variant's <text>. A single BorderedMessage component accepting borderColor, message, and optional textAttributes props would remove the duplication.

  • packages/cli/src/components/messages/error-message.tsx#L10-L33: Replace with <BorderedMessage borderColor={colors.error} message={message} textAttributes={TextAttributes.DIM} />.
  • packages/cli/src/components/messages/user-message.tsx#L9-L32: Replace with <BorderedMessage borderColor={colors.primary} message={message} />.
♻️ Proposed shared component
// packages/cli/src/components/messages/bordered-message.tsx
import { TextAttributes } from "`@opentui/core`"
import { useTheme } from "../../providers/theme"
import { SplitBorder } from "../border"

type Props = {
    message: string
    borderColor: string
    textAttributes?: number
}

export function BorderedMessage({ message, borderColor, textAttributes }: Props) {
    const { colors } = useTheme()

    return (
        <box width={"100%"} alignItems="center">
            <box {...SplitBorder} borderColor={borderColor} width={"100%"}>
                <box
                    justifyContent="center"
                    paddingX={2}
                    paddingY={1}
                    backgroundColor={colors.surface}
                    width={"100%"}
                >
                    <text attributes={textAttributes}>
                        {message}
                    </text>
                </box>
            </box>
        </box>
    )
}

Then ErrorMessage and UserMessage become thin wrappers:

// error-message.tsx
import { TextAttributes } from "`@opentui/core`"
import { useTheme } from "../../providers/theme"
import { BorderedMessage } from "./bordered-message"

export function ErrorMessage({ message }: { message: string }) {
    const { colors } = useTheme()
    return <BorderedMessage message={message} borderColor={colors.error} textAttributes={TextAttributes.DIM} />
}
// user-message.tsx
import { useTheme } from "../../providers/theme"
import { BorderedMessage } from "./bordered-message"

export function UserMessage({ message }: { message: string }) {
    const { colors } = useTheme()
    return <BorderedMessage message={message} borderColor={colors.primary} />
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/components/messages/error-message.tsx` around lines 10 - 33,
Extract the shared JSX structure from ErrorMessage and UserMessage into a
BorderedMessage component accepting message, borderColor, and optional
textAttributes props. Update
packages/cli/src/components/messages/error-message.tsx lines 10-33 to use
BorderedMessage with colors.error and TextAttributes.DIM, and update
packages/cli/src/components/messages/user-message.tsx lines 9-32 to use it with
colors.primary and no textAttributes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/cli/src/components/messages/error-message.tsx`:
- Around line 10-33: Extract the shared JSX structure from ErrorMessage and
UserMessage into a BorderedMessage component accepting message, borderColor, and
optional textAttributes props. Update
packages/cli/src/components/messages/error-message.tsx lines 10-33 to use
BorderedMessage with colors.error and TextAttributes.DIM, and update
packages/cli/src/components/messages/user-message.tsx lines 9-32 to use it with
colors.primary and no textAttributes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 883c9329-9ac8-4389-b288-91d52da1663f

📥 Commits

Reviewing files that changed from the base of the PR and between 19e0561 and 3d58c74.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (14)
  • packages/cli/package.json
  • packages/cli/src/components/border.tsx
  • packages/cli/src/components/messages/bot-message.tsx
  • packages/cli/src/components/messages/error-message.tsx
  • packages/cli/src/components/messages/index.tsx
  • packages/cli/src/components/messages/user-message.tsx
  • packages/cli/src/components/session-shell.tsx
  • packages/cli/src/components/spinner.tsx
  • packages/cli/src/index.tsx
  • packages/cli/src/layouts/root-layout.tsx
  • packages/cli/src/layouts/themed-root.tsx
  • packages/cli/src/screens/home.tsx
  • packages/cli/src/screens/new-session.tsx
  • packages/cli/src/screens/session.tsx

@RaplesWojtyla
RaplesWojtyla merged commit 746981d into main Jul 18, 2026
2 checks passed
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