Skip to content
Source
Sign inSign up
pingdotgg/t3code

tidy up git actions #45

Mergedjuliusmarmingemerged 18 commits intomain fromfoomerged by juliusmarminge View on GitHub

juliusmarmingecommented

Open with Devin

Summary by CodeRabbit

  • New Features

    • Git pull action (sync with upstream) and richer repo status showing per-file working-tree stats.
    • New toast + anchored-toast providers for operation feedback.
  • UI Improvements

    • Searchable combobox branch picker with inline branch creation.
    • Redesigned Git actions workflow: quick actions, dialogs, progress toasts and CTAs.
    • Modernized chat top bar, pickers, and open-in/editor controls.
    • Large set of themed UI primitives (buttons, dialogs, menus, selects, inputs, toasts, etc.).
  • Tests

    • Added comprehensive tests for pull behavior and Git action logic.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Note

      Reviews paused

      It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

      Use the following commands to manage reviews:

      • @coderabbitai resume to resume automatic reviews.
      • @coderabbitai review to trigger a single review.

      Use the checkboxes below for quick actions:

      • ▶️ Resume reviews
      • 🔍 Trigger review

      Walkthrough

      Adds a server-side git pull API and WS method; enriches git status with workingTree stats; updates contracts/NativeApi; adds React Query helpers; implements comprehensive UI primitives, git UI logic, toast system, and related tests.

      Changes

      Cohort / File(s)Summary
      Server — Git core & tests
      apps/server/src/git.ts, apps/server/src/git.test.ts, apps/server/src/gitManager.ts
      Added GitCoreService.pullCurrentBranch and top-level pullGitBranch export; status now includes workingTree with per-file insertions/deletions; added tests for pull scenarios and upstream-missing error.
      Server — WebSocket wiring & tests
      apps/server/src/wsServer.ts, apps/server/src/wsServer.test.ts
      Wired WS_METHODS.gitPull to pullGitBranch; added WS-level gitPull tests; updated shell-open handling to support file-manager editors.
      Contracts / IPC / WS
      packages/contracts/src/git.ts, packages/contracts/src/git.test.ts, packages/contracts/src/ipc.ts, packages/contracts/src/ws.ts
      Introduced gitPullInputSchema/gitPullResultSchema and types; extended GitStatusResult schema with workingTree; added NativeApi.git.pull and WS_METHODS.gitPull; tests updated.
      Web — Native API & React Query
      apps/web/src/wsNativeApi.ts, apps/web/src/lib/gitReactQuery.ts
      Added NativeApi.git.pull(...) wrapper; introduced centralized react-query builders and mutation options for git flows (including pull) with invalidation logic.
      Web — Git UI logic & components
      apps/web/src/components/GitActionsControl.logic.ts, apps/web/src/components/GitActionsControl.logic.test.ts, apps/web/src/components/GitActionsControl.tsx, apps/web/src/components/BranchToolbar.tsx, apps/web/src/components/DiffPanel.tsx, apps/web/src/components/Icons.tsx
      New git action logic module, extensive tests, dialog/toast-run flows; BranchToolbar replaced with Combobox UI and inline branch creation; DiffPanel minor UI change; added CursorIcon.
      Web — Toast integration
      apps/web/src/components/ui/toast.tsx, apps/web/src/App.tsx
      Added toast and anchored-toast providers and integrated them into App.
      Web — UI primitives (new modules)
      apps/web/src/components/ui/... (many files listed in diff)
      Large set of new themed UI primitives and composites (dialog, sheet, menu, popover, select, combobox/autocomplete, form/field, input-group/input/textarea, badge/button/card/checkbox/radio/switch/skeleton/spinner/scroll-area, command palette, etc.) with CVA variants and data-slot conventions.
      Web — Utilities & styling
      apps/web/src/lib/utils.ts, apps/web/src/index.css
      Added cn() utility (cva.cx + twMerge); removed/trimmed multiple CSS custom properties and adjusted body styling.
      Web — Config, deps & build
      apps/web/components.json, apps/web/package.json, apps/web/tsconfig.json, apps/web/vite.config.ts
      New components.json; added UI deps and bumped lucide-react; added TS path alias ~/*; enabled experimental native plugin and tsconfig path resolution in Vite.
      Model & contracts adjustments
      apps/web/src/model-logic.ts, packages/contracts/src/model.ts, packages/contracts/src/model.test.ts
      Typed ReasoningEffort and DEFAULT_REASONING; converted MODEL_OPTIONS to {slug,name} objects, introduced ModelSlug, updated normalize/resolve signatures and tests.
      Tests & Chat UI
      apps/web/src/components/ChatView.tsx, apps/web/src/components/GitActionsControl.logic.test.ts
      ChatView refactor with pickers and modular controls; large test suite added for git-action decision logic and summaries.
      Misc — formatting & small refactors
      multiple apps/server & apps/web test files and helpers
      Numerous formatting/line-wrap adjustments and small refactors across tests and helper modules; no behavior changes in most of these files.

      Sequence Diagram(s)

      sequenceDiagram
          participant Client as Web Client
          participant WS as WS Server
          participant Service as GitCoreService
          participant Repo as Git Repository
      
          Client->>WS: WS_METHODS.gitPull { cwd }
          WS->>Service: pullCurrentBranch(cwd)
          Service->>Repo: ensure not detached HEAD & upstream exists
          Service->>Repo: get HEAD SHA (before)
          Service->>Repo: git pull --ff-only
          Service->>Repo: get HEAD SHA (after)
          Service->>Service: compare SHAs => status ("pulled" / "skipped_up_to_date")
          Service->>Repo: get upstream branch info (optional)
          Service-->>WS: GitPullResult { status, branch, upstreamBranch? }
          WS-->>Client: return result or error

      Estimated code review effort

      🎯 4 (Complex) | ⏱️ ~45 minutes

      • pingdotgg/codething-mvp#13 — Related prior work on git core/service and WS API that introduced git pull/status flows and may overlap with new pull/status parsing.
      🚥 Pre-merge checks | ✅ 2 | ❌ 2
      ❌ Failed checks (1 warning, 1 inconclusive)
      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.85% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
      Title check❓ InconclusiveThe title 'tidy up git actions' is vague and generic. It does not clearly describe what was actually changed in the pull request.Provide a more specific title that describes the main changes, such as 'Add git pull support and refactor git actions UI' or 'Implement pullGitBranch function and modernize GitActionsControl component'.
      ✅ Passed checks (2 passed)
      Check nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Merge Conflict Detection✅ Passed✅ No merge conflicts detected when merging into main
      ✏️ Tip: You can configure your own custom pre-merge checks in the settings.
      ✨ Finishing touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment
      • Commit unit tests in branch `foo`

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Add Git pull API and working tree stats to server and wire new Git actions UI with toast-driven flows in web to tidy up git actions

      Introduce server-side GitCoreService.pullCurrentBranch and git.pullGitBranch, extend git.status with per-file insertions/deletions, and add WS gitPull; refactor web Git actions to use logic helpers, quick action + menu, confirmation dialog, and staged toasts in GitActionsControl.tsx; migrate BranchToolbar to a searchable combobox; add Base UI primitives and toast provider; update react-query helpers in gitReactQuery.ts; adjust Vite and tsconfig path aliases.

      📍Where to Start

      Start with GitActionsControl in apps/web/src/components/GitActionsControl.tsx, then review server pull logic in GitCoreService.pullCurrentBranch in apps/server/src/git.ts and the contracts in packages/contracts/src/git.ts.


      Macroscope summarized 0d4a38f.
    3. Greptile Summary

      Refactored git actions UI from custom modal-based workflow to Base UI components with toast notifications. Added git pull functionality with proper upstream validation. Extracted business logic into testable pure functions with comprehensive unit tests. Migrated multiple components to use Base UI library (@base-ui/react) for consistent styling and better accessibility.

      Key improvements:

      • Git pull feature with --ff-only flag and upstream branch validation
      • Separated presentation from logic in GitActionsControl for better testability
      • Default branch confirmation before pushing to main/master
      • Toast-based notifications replacing custom progress modals
      • Base UI Combobox for branch selection with search
      • Platform-specific file manager opening (macOS open, Windows explorer, Linux xdg-open)
      • Model options now include display names for better UX

      Confidence Score: 5/5

      • Safe to merge - well-tested refactoring with comprehensive test coverage
      • High confidence due to comprehensive test coverage (524 lines of unit tests for logic layer), proper error handling in git pull implementation, and improved separation of concerns. The refactoring maintains existing functionality while adding new features like git pull and default branch protection.
      • No files require special attention

      Important Files Changed

      FilenameOverview
      packages/contracts/src/git.tsAdded git pull contracts with proper input/result schemas and type exports
      apps/server/src/git.tsImplemented pullCurrentBranch with proper validation, SHA comparison for change detection, and error handling
      apps/web/src/components/GitActionsControl.logic.tsExtracted pure business logic for git actions into testable functions with comprehensive test coverage
      apps/web/src/components/GitActionsControl.tsxRefactored to use Base UI components, toast notifications, and separated logic layer with cleaner UX
      packages/contracts/src/model.tsRefactored model options to objects with slug and name properties for better UI display
      apps/web/src/components/BranchToolbar.tsxMigrated from custom dropdown to Base UI Combobox component with improved search and accessibility
      apps/web/src/components/ChatView.tsxRefactored to use Base UI components and removed manual click-outside handlers in favor of built-in behavior
      apps/web/package.jsonAdded Base UI, class-variance-authority, and tailwind-merge dependencies for component library

      Flowchart

      flowchart TD
          A[User clicks Git Action button] --> B{Quick Action Type}
          B -->|run_action| C[Execute Git Action]
          B -->|run_pull| D[Execute Git Pull]
          B -->|open_pr| E[Open PR in Browser]
          B -->|show_hint| F[Show Toast Hint]
          
          C --> G{Is Default Branch?}
          G -->|Yes| H[Show Confirmation Dialog]
          G -->|No| I[Execute Action]
          H -->|Confirmed| I
          H -->|Cancelled| J[Cancel]
          
          I --> K{Action Type}
          K -->|commit| L[Generate/Use Commit Message]
          K -->|commit_push| M[Commit + Push]
          K -->|commit_push_pr| N[Commit + Push + Create PR]
          
          L --> O[Show Toast with Result]
          M --> O
          N --> O
          D --> O
          E --> P[External Browser]
          F --> Q[Display Hint]
          
          O --> R[Refresh Git Status]
          R --> S[Update UI State]
      Last reviewed commit: 5aaae6c
    4. Actionable comments posted: 15

      Note

      Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.

      Caution

      Some comments are outside the diff and can’t be posted inline due to platform limitations.

      ⚠️ Outside diff range comments (2)
      apps/web/src/index.css (1)

      46-52: ⚠️ Potential issue | 🟠 Major

      Enable Tailwind directives in Biome to avoid CSS parse failures.

      Biome reports Tailwind-specific syntax is disabled; this file uses @apply, which can fail lint/CI. Please enable css.parser.tailwindDirectives (or equivalent) in Biome config if Tailwind CSS is expected here.

      packages/contracts/src/model.ts (1)

      19-30: ⚠️ Potential issue | 🟡 Minor

      Type assertion bypasses validation, return type may be misleading.

      Line 29 casts trimmed as ModelSlug without verifying that trimmed is actually a valid slug from MODEL_OPTIONS. While resolveModelSlug validates downstream, callers of normalizeModelSlug may incorrectly assume the return value is always a valid ModelSlug.

      Consider either:

      1. Renaming to indicate it doesn't guarantee validity (e.g., normalizeModelInput)
      2. Changing return type to string | null
      3. Adding validation here as well
      Option: Return string | null to reflect actual behavior
      -export function normalizeModelSlug(model: string | null | undefined): ModelSlug | null {
      +export function normalizeModelSlug(model: string | null | undefined): string | null {
         if (typeof model !== "string") {
           return null;
         }
      
         const trimmed = model.trim();
         if (!trimmed) {
           return null;
         }
      
      -  return MODEL_SLUG_ALIASES[trimmed] ?? (trimmed as ModelSlug);
      +  return MODEL_SLUG_ALIASES[trimmed] ?? trimmed;
       }
      🤖 Fix all issues with AI agents
      In `@apps/web/src/App.tsx`:
      - Line 13: The import in App.tsx currently pulls AnchoredToastProvider and
      ToastProvider from a local path; update the code to use the centralized UI
      package by importing AnchoredToastProvider and ToastProvider from "packages/ui"
      (or the published package name used in the monorepo), and if they are not yet
      re-exported from packages/ui, add re-exports there (export {
      AnchoredToastProvider, ToastProvider } from "apps/web/src/components/ui/toast"
      or from their original module) so all apps import these providers from the
      shared packages/ui entrypoint.
      
      In `@apps/web/src/components/ChatView.tsx`:
      - Around line 51-68: Replace local UI imports referencing "./ui/..." with
      imports from the shared package "packages/ui" for the UI primitives used in
      ChatView: Alert, AlertAction, AlertDescription, AlertTitle, Button, Select,
      SelectItem, SelectPopup, SelectTrigger, SelectValue, Separator, Group,
      GroupSeparator, Menu, MenuItem, MenuPopup, MenuShortcut, MenuTrigger, and Badge;
      keep local imports that are not part of the design system (e.g., CursorIcon/Icon
      from "./Icons") unchanged. Update the import statements so they import those
      named symbols from "packages/ui" instead of "./ui/*" to align with the shared
      design system.
      - Around line 1437-1441: activeProject is being looked up by comparing
      project.id to state.activeThreadId which is incorrect; update the lookup to use
      the active thread's project id (or state.activeProjectId if available).
      Specifically, use the existing activeThread (ensure it is defined) and resolve
      activeProject via state.projects.find(p => p.id === activeThread.projectId), and
      add a guard so OpenInPicker falls back or aborts when activeThread or
      activeProject is undefined.
      
      In `@apps/web/src/components/ui/dialog.tsx`:
      - Around line 5-7: Replace local UI imports so Button and ScrollArea are
      consumed from the shared package instead of internal paths: keep the cn import
      from "~/lib/utils" but change the imports for Button and ScrollArea (referencing
      the Button and ScrollArea symbols) to come from "packages/ui" per the shared UI
      guideline; update any other occurrences in this module that import those symbols
      from "~/components/ui/*" to use the package export instead.
      - Around line 3-8: The file is using React.ComponentProps for typing (e.g.,
      types derived from DialogPrimitive) but React isn’t imported, causing TS errors;
      add a type-only import such as import type { ComponentProps } from "react" (or
      import * as React from "react") at the top of the file so usages like
      ComponentProps<typeof DialogPrimitive> compile, and update any existing
      React.ComponentProps references to just ComponentProps if you use the type-only
      import.
      
      In `@apps/web/src/components/ui/empty.tsx`:
      - Around line 1-4: This file uses React.ComponentProps but never imports
      React—add an import for React (e.g., import * as React from "react") so all
      React types resolve; also fix the semantic mismatch in the EmptyDescription
      component by aligning its prop type with the rendered element (either change
      EmptyDescription's React.ComponentProps<"p"> to React.ComponentProps<"div"> if
      you intend to render a div, or change the rendered <div> to a <p> to keep the
      "p" prop type) and update any other components using React.ComponentProps
      accordingly (check usages in EmptyTitle/EmptyDescription and any functions
      referenced by those names).
      - Around line 46-79: The inner presentational div in the EmptyMedia component is
      currently spreading {...props} and causing duplicate event handlers/IDs; remove
      the {...props} spread from the inner div that renders
      className={cn(emptyMediaVariants({ className, variant }))} so that props remain
      only on the outer wrapper div (the first <div> with className={cn("relative
      mb-6", className)} and data-slot/data-variant). Keep all other behavior (variant
      handling, emptyMediaVariants, cn, and the conditional icon blocks) unchanged.
      
      In `@apps/web/src/components/ui/fieldset.tsx`:
      - Around line 1-29: The Fieldset wrapper and FieldsetLegend (functions Fieldset
      and FieldsetLegend) are currently defined in the app and should be moved into
      the shared UI package; extract these components from their current file and add
      them to the packages/ui package (re-exporting the primitives from
      "@base-ui/react/fieldset" as done now), then update all usages in apps/web to
      import Fieldset and FieldsetLegend from the packages/ui package instead of the
      local file; ensure the new module preserves the same props types
      (FieldsetPrimitive.Root.Props and FieldsetPrimitive.Legend.Props), className
      handling via cn, data-slot attributes, and update any barrel exports in
      packages/ui so consumers can import the components from the package.
      
      In `@apps/web/src/components/ui/form.tsx`:
      - Around line 1-17: The Form primitive defined as the React component Form
      (using FormPrimitive from "@base-ui/react/form" and cn from "~/lib/utils") must
      be moved into the shared UI package and imported from there; create an
      equivalent export in packages/ui (e.g., export a Form component that wraps
      FormPrimitive with the same props and className logic), update all usages in the
      app to import Form from the packages/ui package instead of the local component,
      and remove the local apps/web Form component to avoid duplicate primitives;
      ensure the moved component preserves the signature Form({ className, ...props }:
      FormPrimitive.Props) and re-exports exactly the same API.
      
      In `@apps/web/src/components/ui/group.tsx`:
      - Around line 8-9: Replace the app-local Separator import in
      components/ui/group.tsx (currently "import { Separator } from \"./separator\"")
      with the shared package import from the mono-repo UI package (e.g., "import {
      Separator } from 'ui'") so the component uses the centralized Separator from
      packages/ui; update the import statement accordingly and remove any reliance on
      the local ./separator file in this module (leave cn import unchanged).
      
      In `@apps/web/src/components/ui/input-group.tsx`:
      - Around line 6-8: The InputGroup component currently imports Input, InputProps,
      Textarea, and TextareaProps from local paths (and cn from utils); update the
      imports to use the shared UI package instead by replacing the local imports of
      Input, InputProps, Textarea, and TextareaProps with imports from "packages/ui"
      (or move this component into the shared package and re-export), ensuring you
      still use the existing symbols cn, Input, InputProps, Textarea, and
      TextareaProps where referenced in the component.
      
      In `@apps/web/src/components/ui/sheet.tsx`:
      - Around line 5-7: Update the imports in components/ui/sheet.tsx to consume
      shared UI components from the packages/ui package: keep cn from "~/lib/utils"
      but change the Button and ScrollArea imports (referenced as Button and
      ScrollArea in this file) to import from "packages/ui" instead of
      "~/components/ui/button" and "~/components/ui/scroll-area"; adjust any named
      import syntax accordingly so the rest of the file (e.g., usage of Button and
      ScrollArea) remains unchanged.
      - Around line 3-8: Add the missing React type import so usages of
      React.ComponentProps<"div"> compile: import React (or import * as React) at the
      top of the file and ensure the file now references React for the ComponentProps
      types used in the SheetPrimitive-related components (where
      React.ComponentProps<"div"> appears around the
      SheetRoot/SheetContent/SheetFooter definitions). No other code changes
      required—just add the React import alongside the existing imports (e.g., with
      the imports for SheetPrimitive, XIcon, cn, Button, ScrollArea) so TypeScript
      recognizes React.ComponentProps.
      
      In `@apps/web/src/components/ui/toast.tsx`:
      - Around line 152-158: The Toast.Action currently renders only
      toast.actionProps.children and drops actionable props (like onClick,
      aria-attributes); update the Toast.Action usage to spread toast.actionProps onto
      the component (e.g., <Toast.Action {...toast.actionProps} />) and merge/compose
      the className returned from buttonVariants({ size: "xs" }) with any className
      present on toast.actionProps so passed handlers and attributes are preserved;
      apply the same change for the other instance that uses toast.actionProps (the
      block referenced at lines 244–250).
      
      In `@apps/web/src/lib/utils.ts`:
      - Around line 1-6: Add the missing clsx dependency to the web app so the import
      in utils.ts (import { type ClassValue, clsx } from "clsx"; and the cn(...inputs:
      ClassValue[]) function) resolves at runtime: update apps/web/package.json
      dependencies to include a compatible "clsx" entry (match the project’s package
      manager style and versioning) and run install to ensure clsx is available for
      the cn function and any other imports.
      🟡 Minor comments (6)
      apps/web/vite.config.ts-20-25 (1)

      20-25: ⚠️ Potential issue | 🟡 Minor

      Use experimental.enableNativePlugin: 'v1' instead of true.

      resolve.tsconfigPaths: true is correct and valid for Vite 8. However, experimental.enableNativePlugin should be set to the string value 'v1' rather than the boolean true. In Vite 8, the documented default for native plugin support is 'v1'. While Vite ignores unknown config values silently, using the correct syntax ensures the native plugin integration works as intended, especially since 'resolver' was removed in Vite 8.0.0-beta.11.

      apps/web/src/components/ui/scroll-area.tsx-22-33 (1)

      22-33: ⚠️ Potential issue | 🟡 Minor

      Change transition-shadows to transition-shadow on line 24.

      The utility should use singular form transition-shadow to match standard Tailwind syntax and align with all other UI components in the codebase (textarea, radio-group, input, group, etc.).

      apps/web/src/components/ChatView.tsx-1469-1474 (1)

      1469-1474: ⚠️ Potential issue | 🟡 Minor

      Update the aria-label to match the “Open in editor” action group.

      💡 Suggested fix

      -    <Group aria-label="Subscription actions">
      +    <Group aria-label="Open in editor actions">
      apps/web/src/components/ui/select.tsx-176-186 (1)

      176-186: ⚠️ Potential issue | 🟡 Minor

      Fix the SVG xmlns to use the standard SVG namespace.

      The namespace URL contains an invalid year (1500 instead of 2000) and can cause rendering issues in some environments.

      Suggested fix
      -          xmlns="http://www.w3.org/1500/svg"
      +          xmlns="http://www.w3.org/2000/svg"
      apps/web/src/components/ui/empty.tsx-94-103 (1)

      94-103: ⚠️ Potential issue | 🟡 Minor

      Change EmptyDescription to render <p> to match its declared props type.

      The component declares React.ComponentProps<"p"> but renders a <div>, creating a semantic and type mismatch. This is inconsistent with the other components in the file (Empty, EmptyHeader, EmptyTitle, EmptyContent, EmptyMedia) which all render the element type matching their declared props.

      Suggested fix
      -    <div
      +    <p
             className={cn(
               "text-muted-foreground text-sm [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-slot=empty-title]+&]:mt-1",
               className,
             )}
             data-slot="empty-description"
             {...props}
           />
      apps/web/src/components/ui/alert-dialog.tsx-82-96 (1)

      82-96: ⚠️ Potential issue | 🟡 Minor

      Missing explicit React import for type annotations.

      AlertDialogHeader and AlertDialogFooter use React.ComponentProps<"div"> but React is not imported. While React 19 supports automatic JSX transform, explicit type usage like React.ComponentProps requires an import.

      🔧 Proposed fix
       "use client";
       
       import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
      +import type * as React from "react";
       
       import { cn } from "~/lib/utils";
      🧹 Nitpick comments (9)
      apps/web/src/model-logic.ts (1)

      8-10: Consider defining REASONING_OPTIONS in contracts with a Zod schema for consistency.

      REASONING_OPTIONS and ReasoningEffort align with the pattern used for model-related exports (DEFAULT_MODEL, MODEL_OPTIONS) from @t3tools/contracts. The effort field is included in the shared providerSendTurnInputSchema (packages/contracts/src/provider.ts:88) for provider API payloads, but valid effort values are only defined in the web app. Defining REASONING_OPTIONS as an enum in contracts with Zod validation would improve consistency and provide runtime validation for the shared protocol, as per coding guidelines on using Zod schemas for shared type contracts.

      packages/contracts/src/git.test.ts (1)

      90-98: Consider adding coverage for the skipped_up_to_date status variant.

      The test covers the "pulled" status, but gitPullResultSchema also accepts "skipped_up_to_date". Adding a test case for this variant would ensure complete schema coverage.

      📝 Suggested additional test case
         it("parses git pull result", () => {
           const parsed = gitPullResultSchema.parse({
             status: "pulled",
             branch: "feature/my-branch",
             upstreamBranch: "origin/feature/my-branch",
           });
           expect(parsed.status).toBe("pulled");
           expect(parsed.branch).toBe("feature/my-branch");
         });
      +
      +  it("parses git pull result when already up to date", () => {
      +    const parsed = gitPullResultSchema.parse({
      +      status: "skipped_up_to_date",
      +      branch: "main",
      +    });
      +    expect(parsed.status).toBe("skipped_up_to_date");
      +  });
      apps/web/src/components/ui/textarea.tsx (1)

      9-12: Consider documenting the purpose of number in the size type.

      The size prop accepts "sm" | "default" | "lg" | number, but the number value only flows to data-size attribute and doesn't affect styling (lines 37-40 only check for "sm" and "lg" strings). If this is intentional for custom data attributes or future extensibility, a brief comment would clarify the design.

      apps/web/src/components/ChatView.tsx (1)

      889-918: Avoid disabled on Buttons here; use aria-disabled + click guards instead. This preserves accessibility and tooltip behavior while still preventing double-submit. Please apply this pattern to all four approval buttons.

      💡 Example pattern (apply to each action)

      -                  <Button
      -                    size="xs"
      -                    variant="default"
      -                    disabled={isResponding}
      -                    onClick={() => void onRespondToApproval(approval.requestId, "accept")}
      -                  >
      +                  <Button
      +                    size="xs"
      +                    variant="default"
      +                    aria-disabled={isResponding}
      +                    className={cn(isResponding && "pointer-events-none opacity-60")}
      +                    onClick={() => {
      +                      if (isResponding) return;
      +                      void onRespondToApproval(approval.requestId, "accept");
      +                    }}
      +                  >

      Based on learnings: "Avoid using disabled props on buttons as they harm accessibility and break tooltips. Instead, use styling (e.g., opacity, hover states) and handle the disabled state through click handlers."

      apps/web/src/components/ui/menu.tsx (1)

      136-150: Consider using lucide-react CheckIcon for consistency.

      The MenuCheckboxItem and MenuRadioItem components use inline SVG for the checkmark indicator, while the file already imports ChevronRightIcon from lucide-react. Using CheckIcon from lucide-react would maintain icon consistency across the component library.

      ♻️ Optional refactor for consistency
      -import { ChevronRightIcon } from "lucide-react";
      +import { CheckIcon, ChevronRightIcon } from "lucide-react";

      Then replace the inline SVG in MenuCheckboxItem (line 137-149) and MenuRadioItem (line 177-189) with:

      <CheckIcon />
      apps/web/src/components/ui/autocomplete.tsx (1)

      64-73: Inline AutocompleteClear duplicates the standalone component's markup.

      The inline AutocompleteClear rendered within AutocompleteInput (lines 65-72) has similar but slightly different className than the standalone AutocompleteClear component (lines 238-254). Consider reusing the standalone component to reduce duplication and ensure consistent styling.

      ♻️ Proposed refactor to reuse AutocompleteClear
             {showClear && (
               <AutocompleteClear
                 className={cn(
      -            "-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
                   sizeValue === "sm" ? "end-0" : "end-0.5",
                 )}
      -        >
      -          <XIcon />
      -        </AutocompleteClear>
      +        />
             )}

      Note: This requires ensuring AutocompleteClear is defined before AutocompleteInput or hoisting the function definition.

      apps/web/src/components/ui/combobox.tsx (2)

      11-17: Context type could use more precise RefObject typing.

      The chipsRef in context is typed as React.RefObject<Element | null> but is cast to React.Ref<HTMLDivElement> when passed to ComboboxChips. Consider typing the context more precisely to avoid the cast.

      ♻️ Optional type refinement
       const ComboboxContext = React.createContext<{
      -  chipsRef: React.RefObject<Element | null> | null;
      +  chipsRef: React.RefObject<HTMLDivElement | null> | null;
         multiple: boolean;
       }>({
         chipsRef: null,
         multiple: false,
       });

      Then line 307 can use ref={chipsRef} without the cast.


      30-53: Similar input patterns between ComboboxInput and AutocompleteInput suggest potential abstraction.

      ComboboxInput and ComboboxChipsInput share significant structural similarity with AutocompleteInput from autocomplete.tsx. If these patterns continue to proliferate, consider extracting a shared base input wrapper to reduce duplication.

      Also applies to: 55-119

      apps/web/src/components/BranchToolbar.tsx (1)

      207-213: Combobox is missing onValueChange handler for selection.

      The Combobox component has value={activeThread.branch} but no onValueChange handler. The selection logic is handled via onClick on individual ComboboxItem components (line 253). This works but bypasses the Combobox's built-in selection management. Consider using onValueChange for a more idiomatic implementation.

      ♻️ Proposed refactor using onValueChange
               <Combobox
                 items={branchNames}
                 autoHighlight
                 onOpenChange={(open) => setIsBranchMenuOpen(open)}
      +          onValueChange={(value) => {
      +            const branch = branchByName.get(value);
      +            if (branch) selectBranch(branch);
      +          }}
                 open={isBranchMenuOpen}
                 value={activeThread.branch}
               >

      Then remove onClick from ComboboxItem:

                         <ComboboxItem
                           hideIndicator
                           key={branchName}
                           value={branchName}
                           className={branchName === activeThread.branch ? "bg-accent text-foreground" : undefined}
      -                    onClick={() => selectBranch(branch)}
                         >
      @@ -10,3 +10,4 @@
      1010 import { DEFAULT_THREAD_TERMINAL_HEIGHT, DEFAULT_THREAD_TERMINAL_ID } from "./types";
      1111 import { onServerWelcome } from "./wsNativeApi";
      1212 import { useNativeApi } from "./hooks/useNativeApi";
      13+import { AnchoredToastProvider, ToastProvider } from "./components/ui/toast";
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟠 Major

      Route toast providers through packages/ui instead of local UI components.

      This import bypasses the shared UI package; please move/re-export the toast providers from packages/ui and import from there to keep UI primitives centralized.

      Based on learnings: Applies to apps/web/**/*.{ts,tsx} : Use packages/ui components - import UI components from the packages/ui package.

      🤖 Prompt for AI Agents
      In `@apps/web/src/App.tsx` at line 13, The import in App.tsx currently pulls
      AnchoredToastProvider and ToastProvider from a local path; update the code to
      use the centralized UI package by importing AnchoredToastProvider and
      ToastProvider from "packages/ui" (or the published package name used in the
      monorepo), and if they are not yet re-exported from packages/ui, add re-exports
      there (export { AnchoredToastProvider, ToastProvider } from
      "apps/web/src/components/ui/toast" or from their original module) so all apps
      import these providers from the shared packages/ui entrypoint.
      apps/web/src/components/ChatView.tsx lines 53 to 70Resolvedby juliusmarminge
      apps/web/src/components/ui/dialog.tsx lines 3 to 8Resolvedby juliusmarminge
      apps/web/src/components/ui/dialog.tsx lines 5 to 7Resolvedby juliusmarminge
      @@ -0,0 +1,4 @@
      1+import { cva, type VariantProps } from "class-variance-authority";
      2+
      3+import { cn } from "~/lib/utils";
      4+
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🔴 Critical

      🧩 Analysis chain

      🏁 Script executed:

      #!/bin/bash
      # First, let's check if React.ComponentProps is used and if React is imported
      echo "=== Checking for React.ComponentProps usage ==="
      rg -n "React\.ComponentProps" apps/web/src/components/ui/empty.tsx
      
      echo -e "\n=== Checking for React imports ==="
      rg -n 'from ["'"'"']react["'"'"']' apps/web/src/components/ui/empty.tsx
      
      echo -e "\n=== Reading the full file ==="
      cat -n apps/web/src/components/ui/empty.tsx

      Repository: pingdotgg/codething-mvp

      Length of output: 4932


      Add the missing React type import to prevent TypeScript compilation error.

      React.ComponentProps is used throughout this component file (lines 5, 18, 50, 84, 94, 107) but React is never imported.

      💡 Suggested fix
      import { cva, type VariantProps } from "class-variance-authority";
      
      +import type * as React from "react";
      
      import { cn } from "~/lib/utils";

      Additionally, fix the semantic type mismatch in EmptyDescription (line 94): the function declares React.ComponentProps<"p"> but renders a <div> element instead.

      📝 Committable suggestion

      ‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      Suggested change
      1-import { cva, type VariantProps } from "class-variance-authority";
      2-
      3-import { cn } from "~/lib/utils";
      4-
      1+import { cva, type VariantProps } from "class-variance-authority";
      2+
      3+import type * as React from "react";
      4+
      5+import { cn } from "~/lib/utils";
      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/empty.tsx` around lines 1 - 4, This file uses
      React.ComponentProps but never imports React—add an import for React (e.g.,
      import * as React from "react") so all React types resolve; also fix the
      semantic mismatch in the EmptyDescription component by aligning its prop type
      with the rendered element (either change EmptyDescription's
      React.ComponentProps<"p"> to React.ComponentProps<"div"> if you intend to render
      a div, or change the rendered <div> to a <p> to keep the "p" prop type) and
      update any other components using React.ComponentProps accordingly (check usages
      in EmptyTitle/EmptyDescription and any functions referenced by those names).
      @@ -0,0 +59,21 @@
      59+ <>
      60+ <div
      61+ aria-hidden="true"
      62+ className={cn(
      63+ emptyMediaVariants({ className, variant }),
      64+ "-translate-x-0.5 -rotate-10 pointer-events-none absolute bottom-px origin-bottom-left scale-84 shadow-none",
      65+ )}
      66+ />
      67+ <div
      68+ aria-hidden="true"
      69+ className={cn(
      70+ emptyMediaVariants({ className, variant }),
      71+ "pointer-events-none absolute bottom-px origin-bottom-right translate-x-0.5 rotate-10 scale-84 shadow-none",
      72+ )}
      73+ />
      74+ </>
      75+ )}
      76+ <div
      77+ className={cn(emptyMediaVariants({ className, variant }))}
      78+ {...props}
      79+ />
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟠 Major

      🧩 Analysis chain

      🏁 Script executed:

      # First, let's check the actual file and see the full EmptyMedia component
      cat -n apps/web/src/components/ui/empty.tsx

      Repository: pingdotgg/codething-mvp

      Length of output: 4341


      Remove {...props} from the inner presentational div. Spreading props on both the wrapper and inner element causes any event handlers or IDs to duplicate—handlers fire twice, IDs violate DOM uniqueness. Keep props on the wrapper only; the inner div should remain purely presentational.

      Suggested fix
             <div
               className={cn(emptyMediaVariants({ className, variant }))}
      -        {...props}
             />
      📝 Committable suggestion

      ‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      Suggested change
      46+function EmptyMedia({
      47+ className,
      48+ variant = "default",
      49+ ...props
      50+}: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>) {
      51+ return (
      52+ <div
      53+ className={cn("relative mb-6", className)}
      54+ data-slot="empty-media"
      55+ data-variant={variant}
      56+ {...props}
      57+ >
      58+ {variant === "icon" && (
      59+ <>
      60+ <div
      61+ aria-hidden="true"
      62+ className={cn(
      63+ emptyMediaVariants({ className, variant }),
      64+ "-translate-x-0.5 -rotate-10 pointer-events-none absolute bottom-px origin-bottom-left scale-84 shadow-none",
      65+ )}
      66+ />
      67+ <div
      68+ aria-hidden="true"
      69+ className={cn(
      70+ emptyMediaVariants({ className, variant }),
      71+ "pointer-events-none absolute bottom-px origin-bottom-right translate-x-0.5 rotate-10 scale-84 shadow-none",
      72+ )}
      73+ />
      74+ </>
      75+ )}
      76+ <div
      77+ className={cn(emptyMediaVariants({ className, variant }))}
      78+ />
      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/empty.tsx` around lines 46 - 79, The inner
      presentational div in the EmptyMedia component is currently spreading {...props}
      and causing duplicate event handlers/IDs; remove the {...props} spread from the
      inner div that renders className={cn(emptyMediaVariants({ className, variant
      }))} so that props remain only on the outer wrapper div (the first <div> with
      className={cn("relative mb-6", className)} and data-slot/data-variant). Keep all
      other behavior (variant handling, emptyMediaVariants, cn, and the conditional
      icon blocks) unchanged.
      @@ -0,0 +9,21 @@
      9+ <FieldsetPrimitive.Root
      10+ className={cn("flex w-full max-w-64 flex-col gap-6", className)}
      11+ data-slot="fieldset"
      12+ {...props}
      13+ />
      14+ );
      15+}
      16+function FieldsetLegend({
      17+ className,
      18+ ...props
      19+}: FieldsetPrimitive.Legend.Props) {
      20+ return (
      21+ <FieldsetPrimitive.Legend
      22+ className={cn("font-semibold text-foreground", className)}
      23+ data-slot="fieldset-legend"
      24+ {...props}
      25+ />
      26+ );
      27+}
      28+
      29+export { Fieldset, FieldsetLegend };
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟠 Major

      Move Fieldset primitives into packages/ui and import from there.

      To keep UI primitives centralized and shared, this wrapper should live in packages/ui and be consumed from the package instead of apps/web.

      Based on learnings: Applies to apps/web/**/*.{ts,tsx} : Use packages/ui components - import UI components from the packages/ui package.

      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/fieldset.tsx` around lines 1 - 29, The Fieldset
      wrapper and FieldsetLegend (functions Fieldset and FieldsetLegend) are currently
      defined in the app and should be moved into the shared UI package; extract these
      components from their current file and add them to the packages/ui package
      (re-exporting the primitives from "@base-ui/react/fieldset" as done now), then
      update all usages in apps/web to import Fieldset and FieldsetLegend from the
      packages/ui package instead of the local file; ensure the new module preserves
      the same props types (FieldsetPrimitive.Root.Props and
      FieldsetPrimitive.Legend.Props), className handling via cn, data-slot
      attributes, and update any barrel exports in packages/ui so consumers can import
      the components from the package.
      @@ -0,0 +1,17 @@
      1+"use client";
      2+
      3+import { Form as FormPrimitive } from "@base-ui/react/form";
      4+
      5+import { cn } from "~/lib/utils";
      6+
      7+function Form({ className, ...props }: FormPrimitive.Props) {
      8+ return (
      9+ <FormPrimitive
      10+ className={cn("flex w-full flex-col gap-4", className)}
      11+ data-slot="form"
      12+ {...props}
      13+ />
      14+ );
      15+}
      16+
      17+export { Form };
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟠 Major

      Move this Form primitive into packages/ui and import it from there.

      Creating UI primitives under apps/web breaks the shared UI contract; please relocate/re-export this component from packages/ui and consume it from the package instead.

      Based on learnings: Applies to apps/web/**/*.{ts,tsx} : Use packages/ui components - import UI components from the packages/ui package.

      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/form.tsx` around lines 1 - 17, The Form primitive
      defined as the React component Form (using FormPrimitive from
      "@base-ui/react/form" and cn from "~/lib/utils") must be moved into the shared
      UI package and imported from there; create an equivalent export in packages/ui
      (e.g., export a Form component that wraps FormPrimitive with the same props and
      className logic), update all usages in the app to import Form from the
      packages/ui package instead of the local component, and remove the local
      apps/web Form component to avoid duplicate primitives; ensure the moved
      component preserves the signature Form({ className, ...props }:
      FormPrimitive.Props) and re-exports exactly the same API.
      @@ -0,0 +1,9 @@
      1+"use client";
      2+
      3+import { mergeProps } from "@base-ui/react/merge-props";
      4+import { useRender } from "@base-ui/react/use-render";
      5+import { cva, type VariantProps } from "class-variance-authority";
      6+import type * as React from "react";
      7+
      8+import { cn } from "~/lib/utils";
      9+import { Separator } from "./separator";
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      🛠️ Refactor suggestion | 🟠 Major

      Use the shared packages/ui Separator instead of the app-local import. This keeps web UI primitives centralized in the shared package. Based on learnings: "Use packages/ui components - import UI components from the packages/ui package".

      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/group.tsx` around lines 8 - 9, Replace the
      app-local Separator import in components/ui/group.tsx (currently "import {
      Separator } from \"./separator\"") with the shared package import from the
      mono-repo UI package (e.g., "import { Separator } from 'ui'") so the component
      uses the centralized Separator from packages/ui; update the import statement
      accordingly and remove any reliance on the local ./separator file in this module
      (leave cn import unchanged).
      @@ -0,0 +1,8 @@
      1+"use client";
      2+
      3+import { cva, type VariantProps } from "class-variance-authority";
      4+import type * as React from "react";
      5+
      6+import { cn } from "~/lib/utils";
      7+import { Input, type InputProps } from "~/components/ui/input";
      8+import { Textarea, type TextareaProps } from "~/components/ui/textarea";
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      🛠️ Refactor suggestion | 🟠 Major

      Switch Input/Textarea imports to packages/ui to keep the web UI on shared primitives. These local imports bypass the shared UI package; please import from packages/ui (or move this component there and re-export) to avoid drift. Based on learnings: "Use packages/ui components - import UI components from the packages/ui package".

      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/input-group.tsx` around lines 6 - 8, The
      InputGroup component currently imports Input, InputProps, Textarea, and
      TextareaProps from local paths (and cn from utils); update the imports to use
      the shared UI package instead by replacing the local imports of Input,
      InputProps, Textarea, and TextareaProps with imports from "packages/ui" (or move
      this component into the shared package and re-export), ensuring you still use
      the existing symbols cn, Input, InputProps, Textarea, and TextareaProps where
      referenced in the component.
      @@ -0,0 +1,8 @@
      1+"use client";
      2+
      3+import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
      4+import { XIcon } from "lucide-react";
      5+import { cn } from "~/lib/utils";
      6+import { Button } from "~/components/ui/button";
      7+import { ScrollArea } from "~/components/ui/scroll-area";
      8+
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🔴 Critical

      🧩 Analysis chain

      🏁 Script executed:

      cat -n apps/web/src/components/ui/sheet.tsx

      Repository: pingdotgg/codething-mvp

      Length of output: 7435


      Add missing React type import for ComponentProps usage throughout the file.

      The file uses React.ComponentProps<"div"> on lines 109, 126, and 174 without importing React. This causes TypeScript compilation errors.

       import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
       import { XIcon } from "lucide-react";
      +import type * as React from "react";
       import { cn } from "~/lib/utils";
       import { Button } from "~/components/ui/button";
       import { ScrollArea } from "~/components/ui/scroll-area";
      📝 Committable suggestion

      ‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      Suggested change
      3-import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
      4-import { XIcon } from "lucide-react";
      5-import { cn } from "~/lib/utils";
      6-import { Button } from "~/components/ui/button";
      7-import { ScrollArea } from "~/components/ui/scroll-area";
      8-
      3+import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
      4+import { XIcon } from "lucide-react";
      5+import type * as React from "react";
      6+import { cn } from "~/lib/utils";
      7+import { Button } from "~/components/ui/button";
      8+import { ScrollArea } from "~/components/ui/scroll-area";
      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/sheet.tsx` around lines 3 - 8, Add the missing
      React type import so usages of React.ComponentProps<"div"> compile: import React
      (or import * as React) at the top of the file and ensure the file now references
      React for the ComponentProps types used in the SheetPrimitive-related components
      (where React.ComponentProps<"div"> appears around the
      SheetRoot/SheetContent/SheetFooter definitions). No other code changes
      required—just add the React import alongside the existing imports (e.g., with
      the imports for SheetPrimitive, XIcon, cn, Button, ScrollArea) so TypeScript
      recognizes React.ComponentProps.
      @@ -0,0 +1,7 @@
      1+"use client";
      2+
      3+import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
      4+import { XIcon } from "lucide-react";
      5+import { cn } from "~/lib/utils";
      6+import { Button } from "~/components/ui/button";
      7+import { ScrollArea } from "~/components/ui/scroll-area";
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      🛠️ Refactor suggestion | 🟠 Major

      Consume Button/ScrollArea from packages/ui per the shared UI guideline. Based on learnings: "Use packages/ui components - import UI components from the packages/ui package".

      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/sheet.tsx` around lines 5 - 7, Update the imports
      in components/ui/sheet.tsx to consume shared UI components from the packages/ui
      package: keep cn from "~/lib/utils" but change the Button and ScrollArea imports
      (referenced as Button and ScrollArea in this file) to import from "packages/ui"
      instead of "~/components/ui/button" and "~/components/ui/scroll-area"; adjust
      any named import syntax accordingly so the rest of the file (e.g., usage of
      Button and ScrollArea) remains unchanged.
      @@ -0,0 +138,21 @@
      138+ </div>
      139+ )}
      140+
      141+ <div className="flex flex-col gap-0.5">
      142+ <Toast.Title
      143+ className="font-medium"
      144+ data-slot="toast-title"
      145+ />
      146+ <Toast.Description
      147+ className="text-muted-foreground"
      148+ data-slot="toast-description"
      149+ />
      150+ </div>
      151+ </div>
      152+ {toast.actionProps && (
      153+ <Toast.Action
      154+ className={buttonVariants({ size: "xs" })}
      155+ data-slot="toast-action"
      156+ >
      157+ {toast.actionProps.children}
      158+ </Toast.Action>
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟠 Major

      🧩 Analysis chain

      🏁 Script executed:

      cat -n apps/web/src/components/ui/toast.tsx | head -250

      Repository: pingdotgg/codething-mvp

      Length of output: 14544


      🏁 Script executed:

      rg "actionProps" apps/web/src --type tsx -B 2 -A 2

      Repository: pingdotgg/codething-mvp

      Length of output: 94


      🏁 Script executed:

      rg "actionProps" apps/web/src -B 2 -A 2

      Repository: pingdotgg/codething-mvp

      Length of output: 2424


      🏁 Script executed:

      cat -n apps/web/src/components/GitActionsControl.tsx | grep -A 5 -B 5 "actionProps"

      Repository: pingdotgg/codething-mvp

      Length of output: 853


      🏁 Script executed:

      fd "node_modules/@base-ui/react/toast" -type d 2>/dev/null | head -1 | xargs -I {} find {} -name "*.d.ts" -o -name "*.ts" | grep -i action | head -5

      Repository: pingdotgg/codething-mvp

      Length of output: 49


      🏁 Script executed:

      rg "Toast\.Action" apps/web/src --type-list 2>/dev/null || rg "Toast\.Action" apps/web/src

      Repository: pingdotgg/codething-mvp

      Length of output: 354


      🏁 Script executed:

      cat apps/web/package.json | grep -A 2 -B 2 "@base-ui/react"

      Repository: pingdotgg/codething-mvp

      Length of output: 204


      🌐 Web query:

      @base-ui/react Toast.Action component props documentation

      💡 Result:

      Toast.Action (from @base-ui/react/toast) performs an action when clicked and renders a <button> by default. (base-ui.com)

      Props (API)

      • nativeButton?: boolean (default: true) — when using render to replace the element, set to false if the replacement is not a <button> (e.g. a <div>). (base-ui.com)
      • className?: string | ((state: Toast.Action.State) => string | undefined) (base-ui.com)
      • style?: React.CSSProperties | ((state: Toast.Action.State) => React.CSSProperties | undefined) (base-ui.com)
      • render?: ReactElement | ((props: HTMLProps, state: Toast.Action.State) => ReactElement) — replace/compose the underlying element. (base-ui.com)

      Data attributes

      Citations:


      🌐 Web query:

      @base-ui/react Toast.Action onClick event handler button

      💡 Result:

      In Base UI Toast, the recommended way to wire an onClick for the <Toast.Action /> button is to pass it via the toast’s actionProps when you create/update the toast (those props are applied to the Action button rendered inside that toast). (base-ui.com)

      import { Toast } from '@base-ui/react/toast';
      
      function SaveButton() {
        const toastManager = Toast.useToastManager();
      
        return (
          <button
            onClick={() => {
              toastManager.add({
                title: 'Saved',
                description: 'Your changes were saved.',
                actionProps: {
                  children: 'Undo',
                  onClick: () => {
                    // undo work here
                  },
                },
              });
            }}
          >
            Save
          </button>
        );
      }
      
      // ...in your toast renderer:
      function ToastList() {
        const { toasts } = Toast.useToastManager();
      
        return toasts.map((toast) => (
          <Toast.Root key={toast.id} toast={toast}>
            <Toast.Content>
              <Toast.Title />
              <Toast.Description />
              <Toast.Action /> {/* uses toast.actionProps */}
              <Toast.Close />
            </Toast.Content>
          </Toast.Root>
        ));
      }
      ``` ([base-ui.com](https://base-ui.com/react/components/toast))
      
      Citations:
      
      - 1: https://base-ui.com/react/components/toast
      - 2: https://base-ui.com/react/components/toast
      
      ---
      
      🌐 Web query:
      
      `base-ui Toast.Action actionProps automatic spread render component`
      
      💡 Result:
      
      In Base UI, `actionProps` is **not** a prop you pass to `<Toast.Action />` directly. Instead, you attach it to the **toast object** when you create/update a toast (e.g. `toastManager.add({ actionProps: { children, onClick, ... } })`). Then, when that toast is rendered, `<Toast.Action />` will **automatically apply (“spread”) those `actionProps` onto its underlying `<button>`**, along with Base UI’s own required props/handlers. [1]
      
      If you customize the element via the `render` prop on `<Toast.Action />`, Base UI gives you the computed `props` to apply—**you must spread those `props` onto whatever you render** (whether it’s a different tag or a composed component), otherwise the action won’t behave correctly. [1]
      
      If your `render` target is *not* a real `<button>`, set `nativeButton={false}` on `<Toast.Action />`. [1]
      
      **Source:** Base UI Toast docs (see `actionProps` in the toast object / “Undo action” example, and the `<Toast.Action />` API for `render` + `nativeButton`). [1]
      
      References:  
      [1] https://base-ui.com/react/components/toast
      
      ---
      
      🌐 Web query:
      
      `base-ui Toast component actionProps automatic handling render example code`
      
      💡 Result:
      
      In Base UI **Toast**, you pass an action button’s props via the toast object’s `actionProps` option (e.g., for an “Undo” button). Then, when you render each toast, include `<Toast.Action />` inside `<Toast.Root />` and it will use those `actionProps`. [1]
      
      Also note: swipe-to-dismiss is **automatically prevented for interactive elements** inside a toast; you can manually opt out with `data-swipe-ignore` if needed. [1]
      
      ```tsx
      'use client';
      import * as React from 'react';
      import { Toast } from '@base-ui/react/toast';
      
      export default function App() {
        return (
          <Toast.Provider>
            <Composer />
            <Toast.Portal>
              <Toast.Viewport>
                <ToastList />
              </Toast.Viewport>
            </Toast.Portal>
          </Toast.Provider>
        );
      }
      
      function Composer() {
        const toast = Toast.useToastManager();
      
        function performAction() {
          // do the thing...
      
          toast.add({
            title: 'Item deleted',
            description: 'You can undo this.',
            actionProps: {
              children: 'Undo',
              onClick: () => {
                // undo the thing...
                // optionally close the toast (if you kept the id)
              },
            },
          });
        }
      
        return (
          <button type="button" onClick={performAction}>
            Perform action
          </button>
        );
      }
      
      function ToastList() {
        const { toasts } = Toast.useToastManager();
      
        return toasts.map((t) => (
          <Toast.Root key={t.id} toast={t}>
            <Toast.Content>
              <Toast.Title />
              <Toast.Description />
      
              {/* Uses toast.actionProps (children, onClick, etc.) */}
              <Toast.Action />
      
              <Toast.Close aria-label="Close">×</Toast.Close>
            </Toast.Content>
          </Toast.Root>
        ));
      }

      Custom rendering of the action button (via render)

      If you want to render the action as your own component, use the render prop; if the rendered element isn’t a native <button>, set nativeButton={false}. [1]

      <Toast.Action
        nativeButton={false}
        render={(props) => <a {...props} href="/support" />}
      />

      Sources: Base UI Toast docs (examples + API reference). [1]

      [1] (base-ui.com)

      Citations:


      Forward toast.actionProps to enable action handler — onClick and other props are currently dropped.

      toast.actionProps includes onClick, aria attributes, and other props passed when the toast is created, but the current rendering only extracts children and ignores the rest. This makes action buttons inert. Spread actionProps onto Toast.Action and merge the className with the existing buttonVariants styling.

      🛠️ Proposed fix to forward action props
      -                {toast.actionProps && (
      -                  <Toast.Action
      -                    className={buttonVariants({ size: "xs" })}
      -                    data-slot="toast-action"
      -                  >
      -                    {toast.actionProps.children}
      -                  </Toast.Action>
      -                )}
      +                {toast.actionProps && (
      +                  <Toast.Action
      +                    {...toast.actionProps}
      +                    className={cn(
      +                      buttonVariants({ size: "xs" }),
      +                      toast.actionProps.className,
      +                    )}
      +                    data-slot="toast-action"
      +                  >
      +                    {toast.actionProps.children}
      +                  </Toast.Action>
      +                )}
      
      -                    {toast.actionProps && (
      -                      <Toast.Action
      -                        className={buttonVariants({ size: "xs" })}
      -                        data-slot="toast-action"
      -                      >
      -                        {toast.actionProps.children}
      -                      </Toast.Action>
      -                    )}
      +                    {toast.actionProps && (
      +                      <Toast.Action
      +                        {...toast.actionProps}
      +                        className={cn(
      +                          buttonVariants({ size: "xs" }),
      +                          toast.actionProps.className,
      +                        )}
      +                        data-slot="toast-action"
      +                      >
      +                        {toast.actionProps.children}
      +                      </Toast.Action>
      +                    )}

      Also applies to: lines 244–250

      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/toast.tsx` around lines 152 - 158, The
      Toast.Action currently renders only toast.actionProps.children and drops
      actionable props (like onClick, aria-attributes); update the Toast.Action usage
      to spread toast.actionProps onto the component (e.g., <Toast.Action
      {...toast.actionProps} />) and merge/compose the className returned from
      buttonVariants({ size: "xs" }) with any className present on toast.actionProps
      so passed handlers and attributes are preserved; apply the same change for the
      other instance that uses toast.actionProps (the block referenced at lines
      244–250).
      @@ -0,0 +1,6 @@
      1+import { type ClassValue, clsx } from "clsx";
      2+import { twMerge } from "tailwind-merge";
      3+
      4+export function cn(...inputs: ClassValue[]) {
      5+ return twMerge(clsx(inputs));
      6+}
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🔴 Critical

      🧩 Analysis chain

      🏁 Script executed:

      #!/bin/bash
      
      # Check if clsx and tailwind-merge are in apps/web/package.json
      echo "=== Checking apps/web/package.json ==="
      if [ -f "apps/web/package.json" ]; then
        echo "Dependencies:"
        cat apps/web/package.json | jq '.dependencies | keys | .[] | select(. == "clsx" or . == "tailwind-merge")'
        echo ""
        echo "Dev Dependencies:"
        cat apps/web/package.json | jq '.devDependencies | keys | .[] | select(. == "clsx" or . == "tailwind-merge")'
        echo ""
        echo "Full dependencies output:"
        cat apps/web/package.json | jq '.dependencies.clsx // .devDependencies.clsx // "NOT FOUND"' | head -1
        cat apps/web/package.json | jq '.dependencies["tailwind-merge"] // .devDependencies["tailwind-merge"] // "NOT FOUND"' | head -1
      else
        echo "apps/web/package.json not found"
      fi
      
      # Also check the actual file to confirm it exists and has the expected content
      echo ""
      echo "=== Checking apps/web/src/lib/utils.ts ==="
      if [ -f "apps/web/src/lib/utils.ts" ]; then
        head -6 apps/web/src/lib/utils.ts
      else
        echo "File not found"
      fi

      Repository: pingdotgg/codething-mvp

      Length of output: 416


      Add missing clsx dependency to apps/web/package.json.

      The code imports clsx but the package is not in dependencies, which will cause a module resolution failure. Add clsx to the dependencies section of apps/web/package.json. The tailwind-merge package is already correctly installed.

      🧰 Tools
      🪛 GitHub Actions: CI

      [error] 1-1: Cannot find module 'clsx' or its corresponding type declarations.bun run typecheck failed in '@t3tools/web'.

      🤖 Prompt for AI Agents
      In `@apps/web/src/lib/utils.ts` around lines 1 - 6, Add the missing clsx
      dependency to the web app so the import in utils.ts (import { type ClassValue,
      clsx } from "clsx"; and the cn(...inputs: ClassValue[]) function) resolves at
      runtime: update apps/web/package.json dependencies to include a compatible
      "clsx" entry (match the project’s package manager style and versioning) and run
      install to ensure clsx is available for the cn function and any other imports.
    5. Actionable comments posted: 2

      🤖 Fix all issues with AI agents
      In `@apps/web/src/components/ChatView.tsx`:
      - Around line 249-252: The BranchToolbar is currently shown because isGitRepo
      defaults to true; change the guard so BranchToolbar only renders when gitCwd is
      non-null and the branchesQuery succeeded and reports a repo (use gitCwd &&
      branchesQuery.isSuccess && branchesQuery.data?.isRepo), and ensure branchesQuery
      is created with useQuery(gitBranchesQueryOptions(api, gitCwd)) but treated as
      disabled/false when gitCwd is null or the query errored (do not default
      isGitRepo to true). Update any checks around BranchToolbar (e.g., where
      BranchToolbar is rendered) to use this stricter condition to prevent rendering
      in non‑repo contexts.
      - Around line 895-923: The Button instances that currently use the disabled prop
      (the ones calling onRespondToApproval with approval.requestId and using
      isResponding) should switch to aria-disabled={isResponding}, appropriate
      "disabled" visual styling (e.g., reduced opacity/disabled cursor classes), and a
      click guard inside the onClick handlers so clicks are no-ops when isResponding
      is true; update the four approval Buttons (those invoking
      onRespondToApproval(..., "accept" | "acceptForSession" | "decline" | "cancel"))
      to use aria-disabled instead of disabled, add styling classes to reflect the
      disabled state, and wrap the handler call in a guard (if (isResponding) return)
      or inline conditional before calling onRespondToApproval; apply the same pattern
      to the runtime toggle and send button areas referenced in the comment.
      🧹 Nitpick comments (2)
      apps/web/src/components/GitActionsControl.tsx (1)

      158-693: Consider splitting this component into subcomponents. The file has grown large enough that extracting pieces like the quick-action button, menu, and dialog into local subcomponents would improve readability and reuse.

      As per coding guidelines: Extract large React components into multiple subcomponents with granular functionality. Co-locate subcomponents in the same file as the main component. Avoid hoisting callbacks too high up the component tree; prefer colocating logic close to JSX.

      apps/server/src/git.ts (1)

      282-294: Remove redundant first sort.

      The array is sorted at line 288 via .toSorted(), then additional entries are pushed (lines 290-293), and then sorted again at line 294. The first sort is wasted work.

      ♻️ Suggested simplification
           let insertions = 0;
           let deletions = 0;
           const files = Array.from(fileStatMap.entries())
             .map(([path, stat]) => {
               insertions += stat.insertions;
               deletions += stat.deletions;
               return { path, insertions: stat.insertions, deletions: stat.deletions };
      -      })
      -      .toSorted((a, b) => a.path.localeCompare(b.path));
      +      });
       
           for (const filePath of changedFilesWithoutNumstat) {
             if (fileStatMap.has(filePath)) continue;
             files.push({ path: filePath, insertions: 0, deletions: 0 });
           }
           files.sort((a, b) => a.path.localeCompare(b.path));
      @@ -243,4 +246,7 @@
      243246 sandboxMode: "workspace-write",
      244247 } as const);
      245248 const gitCwd = activeThread?.worktreePath ?? activeProject?.cwd ?? null;
      249+ const branchesQuery = useQuery(gitBranchesQueryOptions(api, gitCwd));
      250+ // Default true while loading to avoid toolbar flicker.
      251+ const isGitRepo = branchesQuery.data?.isRepo ?? true;
      246252
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟡 Minor

      Guard BranchToolbar when gitCwd/query is unavailable.

      isGitRepo defaults to true, so if gitCwd is null, the query is disabled, or the query errors, the toolbar can still render in non‑repo contexts. Tighten the guard so non‑repos never show it.

      🔧 Suggested fix
      -  const branchesQuery = useQuery(gitBranchesQueryOptions(api, gitCwd));
      -  // Default true while loading to avoid toolbar flicker.
      -  const isGitRepo = branchesQuery.data?.isRepo ?? true;
      +  const branchesQuery = useQuery(gitBranchesQueryOptions(api, gitCwd));
      +  const isGitRepo =
      +    Boolean(gitCwd) &&
      +    (branchesQuery.isLoading ? true : branchesQuery.data?.isRepo ?? false);

      Also applies to: 1307-1307

      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ChatView.tsx` around lines 249 - 252, The
      BranchToolbar is currently shown because isGitRepo defaults to true; change the
      guard so BranchToolbar only renders when gitCwd is non-null and the
      branchesQuery succeeded and reports a repo (use gitCwd &&
      branchesQuery.isSuccess && branchesQuery.data?.isRepo), and ensure branchesQuery
      is created with useQuery(gitBranchesQueryOptions(api, gitCwd)) but treated as
      disabled/false when gitCwd is null or the query errored (do not default
      isGitRepo to true). Update any checks around BranchToolbar (e.g., where
      BranchToolbar is rendered) to use this stricter condition to prevent rendering
      in non‑repo contexts.
      @@ -1020,0 +903,21 @@
      903+ <Button
      904+ size="xs"
      905+ variant="outline"
      906+ disabled={isResponding}
      907+ onClick={() => void onRespondToApproval(approval.requestId, "acceptForSession")}
      908+ >
      909+ Always allow this session
      910+ </Button>
      911+ <Button
      912+ size="xs"
      913+ variant="destructive-outline"
      914+ disabled={isResponding}
      915+ onClick={() => void onRespondToApproval(approval.requestId, "decline")}
      916+ >
      917+ Decline
      918+ </Button>
      919+ <Button
      920+ size="xs"
      921+ variant="ghost"
      922+ disabled={isResponding}
      923+ onClick={() => void onRespondToApproval(approval.requestId, "cancel")}
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟠 Major

      Avoid disabled on buttons; use aria-disabled + click guards.

      The approvals actions, runtime toggle, and send button all use disabled, which breaks tooltips and harms accessibility per repo guidance. Replace with aria-disabled, styling, and a click guard.

      ♿ Example pattern (apply to all three areas)
      -  <Button
      -    size="xs"
      -    variant="default"
      -    disabled={isResponding}
      -    onClick={() => void onRespondToApproval(approval.requestId, "accept")}
      -  >
      +  <Button
      +    size="xs"
      +    variant="default"
      +    aria-disabled={isResponding}
      +    className={cn(isResponding && "opacity-50")}
      +    onClick={() => {
      +      if (isResponding) return;
      +      void onRespondToApproval(approval.requestId, "accept");
      +    }}
      +  >

      Based on learnings: "Avoid using disabled props on buttons as they harm accessibility and break tooltips. Instead, use styling (e.g., opacity, hover states) and handle the disabled state through click handlers."

      Also applies to: 1211-1229, 1253-1258

      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ChatView.tsx` around lines 895 - 923, The Button
      instances that currently use the disabled prop (the ones calling
      onRespondToApproval with approval.requestId and using isResponding) should
      switch to aria-disabled={isResponding}, appropriate "disabled" visual styling
      (e.g., reduced opacity/disabled cursor classes), and a click guard inside the
      onClick handlers so clicks are no-ops when isResponding is true; update the four
      approval Buttons (those invoking onRespondToApproval(..., "accept" |
      "acceptForSession" | "decline" | "cancel")) to use aria-disabled instead of
      disabled, add styling classes to reflect the disabled state, and wrap the
      handler call in a guard (if (isResponding) return) or inline conditional before
      calling onRespondToApproval; apply the same pattern to the runtime toggle and
      send button areas referenced in the comment.
    6. @@ -386,8 +251,14 @@
      251+ if (!confirmed) return;
      252+
      253+ const progressStages = buildGitActionProgressStages({
      254+ action,
      255+ hasCustomCommitMessage: !!commitMessage?.trim(),
      256+ });
      257+ const progressToastId = toastManager.add({
      258+ type: "loading",
      259+ title: progressStages[0] ?? "Running git action...",
      260+ timeout: 0,
      261+ });
      386262
      387- const dismissGitProgressToast = useCallback(() => {
      388- if (isGitModalActionRunning) return;
      389- setIsGitProgressToastVisible(false);
      390- setGitModalProgress([]);
      391- setGitModalError(null);
      392- setGitModalResult(null);
      393- }, [isGitModalActionRunning]);
      263+ let stageIndex = 0;
      264+ const stageInterval = setInterval(() => {
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟢 Low

      components/GitActionsControl.tsx:264 Suggestion: ensure unmount‑safety. runGitActionWithToast creates a setInterval and toast action callbacks that can outlive the component, risking leaks and setState‑after‑unmount warnings. Consider storing the timer and any created toast IDs in refs and clearing/dismissing them in a useEffect cleanup, and guard setActiveDialogAction with an isMounted ref (or avoid using component state in toast actions).

      🚀 Want me to fix this? Reply ex: "fix it for me".

      🤖 Prompt for AI
      In file apps/web/src/components/GitActionsControl.tsx around line 264:
      
      Suggestion: ensure unmount‑safety. `runGitActionWithToast` creates a `setInterval` and toast action callbacks that can outlive the component, risking leaks and `setState`‑after‑unmount warnings. Consider storing the timer and any created toast IDs in refs and clearing/dismissing them in a `useEffect` cleanup, and guard `setActiveDialogAction` with an `isMounted` ref (or avoid using component state in toast actions).
      @@ -180,4 +230,8 @@
      180230 }
      181231
      182232 async statusDetails(cwd: string): Promise<GitStatusDetails> {
      183- const stdout = await this.gitStdout(cwd, ["status", "--porcelain=2", "--branch"]);
      233+ const [statusStdout, unstagedNumstatStdout, stagedNumstatStdout] = await Promise.all([
      234+ this.gitStdout(cwd, ["status", "--porcelain=2", "--branch"]),
      235+ this.gitStdout(cwd, ["diff", "--numstat"]),
      236+ this.gitStdout(cwd, ["diff", "--cached", "--numstat"]),
      237+ ]);
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      src/git.ts:233 Running git status and git diff commands concurrently via Promise.all causes index lock contention—both commands try to acquire .git/index.lock, causing intermittent Unable to create index.lock failures. Consider running these commands sequentially, or adding --no-refresh flags to the diff commands.

      -    const [statusStdout, unstagedNumstatStdout, stagedNumstatStdout] = await Promise.all([
      -      this.gitStdout(cwd, ["status", "--porcelain=2", "--branch"]),
      -      this.gitStdout(cwd, ["diff", "--numstat"]),
      -      this.gitStdout(cwd, ["diff", "--cached", "--numstat"]),
      -    ]);
      +    const [statusStdout, unstagedNumstatStdout, stagedNumstatStdout] = await Promise.all([
      +      this.gitStdout(cwd, ["status", "--porcelain=2", "--branch"]),
      +      this.gitStdout(cwd, ["diff", "--no-refresh", "--numstat"]),
      +      this.gitStdout(cwd, ["diff", "--no-refresh", "--cached", "--numstat"]),
      +    ]);

      🚀 Want me to fix this? Reply ex: "fix it for me".

      🤖 Prompt for AI
      In file apps/server/src/git.ts around lines 233-237:
      
      Running `git status` and `git diff` commands concurrently via `Promise.all` causes index lock contention—both commands try to acquire `.git/index.lock`, causing intermittent `Unable to create index.lock` failures. Consider running these commands sequentially, or adding `--no-refresh` flags to the `diff` commands.
    7. Actionable comments posted: 2

      🤖 Fix all issues with AI agents
      In `@apps/web/src/components/GitActionsControl.tsx`:
      - Around line 390-405: runDialogAction currently submits using
      dialogCommitMessage but never clears it afterwards, causing the text to persist
      into subsequent dialogs; update runDialogAction to call the state setter that
      clears the commit input (e.g., setDialogCommitMessage("")) immediately after
      invoking runGitActionWithToast (or after setActiveDialogAction(null)) so the
      dialogCommitMessage state is reset for the next open; reference runDialogAction
      and dialogCommitMessage (and the setter setDialogCommitMessage) when making this
      change.
      - Around line 293-311: The CTA in the success toast currently calls
      api?.shell.openExternal(prUrl) without handling rejections; update the branch
      that supplies the "Open PR" actionProps inside toastManager.update to call the
      same safe helper pattern used by openExistingPr (or inline the same logic) so
      the promise from api.shell.openExternal is awaited/then/catch-handled and errors
      surface to the user (e.g., update toast or show error toast) instead of
      producing an unhandled rejection; locate the CTA setup in toastManager.update
      and replace the raw api?.shell.openExternal(prUrl) call with the guarded call
      used in openExistingPr.
      🧹 Nitpick comments (1)
      apps/web/src/components/GitActionsControl.tsx (1)

      445-684: Consider splitting GitActionsControl into subcomponents. This JSX block is sizable; extracting the quick-action button, menu, and dialog/status card into co-located subcomponents would reduce cognitive load and keep state closer to the UI.

      Based on learnings: “Extract large React components into multiple subcomponents with granular functionality. Co-locate subcomponents in the same file as the main component. Avoid hoisting callbacks too high up the component tree; prefer colocating logic close to JSX.”

      @@ -465,0 +291,21 @@
      291+ action === "commit_push" && !prUrl && result.push.status === "pushed";
      292+
      293+ toastManager.update(progressToastId, {
      294+ type: "success",
      295+ title: "Done",
      296+ description: describeGitResult(result),
      297+ timeout: 10_000,
      298+ ...(shouldOfferPushCta
      299+ ? {
      300+ actionProps: {
      301+ children: "Push",
      302+ onClick: () => setActiveDialogAction("push"),
      303+ },
      304+ }
      305+ : shouldOfferOpenPrCta
      306+ ? {
      307+ actionProps: {
      308+ children: "Open PR",
      309+ onClick: () => void api?.shell.openExternal(prUrl),
      310+ },
      311+ }
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟡 Minor

      🧩 Analysis chain

      🏁 Script executed:

      rg -n "openExternal" -S

      Repository: pingdotgg/codething-mvp

      Length of output: 968


      🏁 Script executed:

      # Find the openExistingPr implementation and error handling
      rg -n "openExistingPr" --type ts --type tsx -A 20 | head -100

      Repository: pingdotgg/codething-mvp

      Length of output: 94


      🏁 Script executed:

      # Check the git actions file to see the current implementation
      cat -n apps/web/src/components/GitActionsControl.tsx | sed -n '280,320p'

      Repository: pingdotgg/codething-mvp

      Length of output: 1812


      🏁 Script executed:

      # Find the openExistingPr function to see the error handling pattern
      cat -n apps/web/src/components/GitActionsControl.tsx | sed -n '220,260p'

      Repository: pingdotgg/codething-mvp

      Length of output: 1669


      🏁 Script executed:

      # Check ThreadTerminalDrawer to see another example of proper error handling
      cat -n apps/web/src/components/ThreadTerminalDrawer.tsx | sed -n '215,230p'

      Repository: pingdotgg/codething-mvp

      Length of output: 778


      🏁 Script executed:

      # Check the toastManager implementation to see if it has a promise method
      rg -n "toastManager\.promise" --type ts -B 2 -A 5 | head -80

      Repository: pingdotgg/codething-mvp

      Length of output: 1536


      Handle failures from the PR CTA link opening. The success toast CTA calls api?.shell.openExternal(prUrl) without handling rejections, which can surface as unhandled promise rejections and leave users without feedback. The openExistingPr handler (line 220) demonstrates the proper pattern already established in this file.

      🔧 Suggested fix
      -                  onClick: () => void api?.shell.openExternal(prUrl),
      +                  onClick: () => {
      +                    const promise = api?.shell.openExternal(prUrl);
      +                    if (!promise) return;
      +                    toastManager.promise(promise, {
      +                      loading: { title: "Opening PR..." },
      +                      success: { title: "PR opened" },
      +                      error: (err) => ({
      +                        title: "Unable to open PR link",
      +                        description: err instanceof Error ? err.message : "An error occurred.",
      +                      }),
      +                    });
      +                    void promise.catch(() => undefined);
      +                  },
      🤖 Prompt for AI Agents
      In `@apps/web/src/components/GitActionsControl.tsx` around lines 293 - 311, The
      CTA in the success toast currently calls api?.shell.openExternal(prUrl) without
      handling rejections; update the branch that supplies the "Open PR" actionProps
      inside toastManager.update to call the same safe helper pattern used by
      openExistingPr (or inline the same logic) so the promise from
      api.shell.openExternal is awaited/then/catch-handled and errors surface to the
      user (e.g., update toast or show error toast) instead of producing an unhandled
      rejection; locate the CTA setup in toastManager.update and replace the raw
      api?.shell.openExternal(prUrl) call with the guarded call used in
      openExistingPr.
      @@ -563,3 +387,19 @@
      387+ [openExistingPr],
      388+ );
      563389
      564- useEffect(() => {
      565- if (!isGitModalOpen) return;
      390+ const runDialogAction = useCallback(() => {
      391+ if (!activeDialogAction) return;
      392+ const action: GitStackedAction =
      393+ activeDialogAction === "commit"
      394+ ? "commit"
      395+ : activeDialogAction === "push"
      396+ ? "commit_push"
      397+ : "commit_push_pr";
      398+ const commitMessage =
      399+ activeDialogAction === "commit" ? dialogCommitMessage.trim() : "";
      400+ setActiveDialogAction(null);
      401+ void runGitActionWithToast({
      402+ action,
      403+ ...(commitMessage ? { commitMessage } : {}),
      404+ });
      405+ }, [activeDialogAction, dialogCommitMessage, runGitActionWithToast]);
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟡 Minor

      Clear the commit message after submitting an action. dialogCommitMessage is only reset on cancel/onOpenChange, so it can persist into the next commit after a successful submit.

      🧹 Suggested fix
           setActiveDialogAction(null);
      +    setDialogCommitMessage("");
           void runGitActionWithToast({
      🤖 Prompt for AI Agents
      In `@apps/web/src/components/GitActionsControl.tsx` around lines 390 - 405,
      runDialogAction currently submits using dialogCommitMessage but never clears it
      afterwards, causing the text to persist into subsequent dialogs; update
      runDialogAction to call the state setter that clears the commit input (e.g.,
      setDialogCommitMessage("")) immediately after invoking runGitActionWithToast (or
      after setActiveDialogAction(null)) so the dialogCommitMessage state is reset for
      the next open; reference runDialogAction and dialogCommitMessage (and the setter
      setDialogCommitMessage) when making this change.
    8. @@ -0,0 +147,21 @@
      147+ kind: "show_hint",
      148+ hint: "Git status is unavailable.",
      149+ };
      150+ }
      151+
      152+ const hasBranch = gitStatus.branch !== null;
      153+ const hasChanges = gitStatus.hasWorkingTreeChanges;
      154+ const hasOpenPr = gitStatus.openPr !== null;
      155+ const isAhead = gitStatus.aheadCount > 0;
      156+ const isBehind = gitStatus.behindCount > 0;
      157+
      158+ if (!hasBranch) {
      159+ return {
      160+ label: "Commit",
      161+ disabled: true,
      162+ kind: "show_hint",
      163+ hint: "Create and checkout a branch before pushing or opening a PR.",
      164+ };
      165+ }
      166+
      167+ if (hasChanges) {
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      components/GitActionsControl.logic.ts:167 Consider checking isBehind before returning commit_push actions in the hasChanges block. Currently, if the branch has uncommitted changes and is behind remote, this returns a push action that will fail (non-fast-forward). The isBehind check should come first, or be added as a condition here.

      🚀 Want me to fix this? Reply ex: "fix it for me".

      🤖 Prompt for AI
      In file apps/web/src/components/GitActionsControl.logic.ts around line 167:
      
      Consider checking `isBehind` before returning `commit_push` actions in the `hasChanges` block. Currently, if the branch has uncommitted changes *and* is behind remote, this returns a push action that will fail (non-fast-forward). The `isBehind` check should come first, or be added as a condition here.
    9. @@ -0,0 +155,21 @@
      155+ const isAhead = gitStatus.aheadCount > 0;
      156+ const isBehind = gitStatus.behindCount > 0;
      157+
      158+ if (!hasBranch) {
      159+ return {
      160+ label: "Commit",
      161+ disabled: true,
      162+ kind: "show_hint",
      163+ hint: "Create and checkout a branch before pushing or opening a PR.",
      164+ };
      165+ }
      166+
      167+ if (hasChanges) {
      168+ if (hasOpenPr || isDefaultBranch) {
      169+ return { label: "Commit & push", disabled: false, kind: "run_action", action: "commit_push" };
      170+ }
      171+ return {
      172+ label: "Commit, push & create PR",
      173+ disabled: false,
      174+ kind: "run_action",
      175+ action: "commit_push_pr",
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      components/GitActionsControl.logic.ts:175 commit_push_pr is returned without checking gitStatus.hasUpstream, but buildMenuItems requires hasUpstream for PR creation. Consider adding the same check here to avoid failing PR creation on branches without upstream.

      🚀 Want me to fix this? Reply ex: "fix it for me".

      🤖 Prompt for AI
      In file apps/web/src/components/GitActionsControl.logic.ts around line 175:
      
      `commit_push_pr` is returned without checking `gitStatus.hasUpstream`, but `buildMenuItems` requires `hasUpstream` for PR creation. Consider adding the same check here to avoid failing PR creation on branches without upstream.
    10. @@ -0,0 +36,21 @@
      36+ "inline-end":
      37+ "has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]",
      38+ "inline-start":
      39+ "has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]",
      40+ },
      41+ },
      42+ },
      43+);
      44+
      45+function InputGroupAddon({
      46+ className,
      47+ align = "inline-start",
      48+ ...props
      49+}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
      50+ return (
      51+ <div
      52+ className={cn(inputGroupAddonVariants({ align }), className)}
      53+ data-align={align}
      54+ data-slot="input-group-addon"
      55+ onMouseDown={(e) => {
      56+ const target = e.target as HTMLElement;
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟢 Low

      ui/input-group.tsx:56 The cast to HTMLElement assumes e.target always has .closest(), but in some edge cases the target could be a non-Element node. Consider guarding with if (!(target instanceof Element)) return; before calling .closest(), or this might be intentionally relying on React's synthetic events always providing Elements.

      Suggested change
      56- const target = e.target as HTMLElement;
      56+ const target = e.target as HTMLElement;
      57+ if (!(target instanceof Element)) return;

      🚀 Want me to fix this? Reply ex: "fix it for me".

      🤖 Prompt for AI
      In file apps/web/src/components/ui/input-group.tsx around line 56:
      
      The cast to `HTMLElement` assumes `e.target` always has `.closest()`, but in some edge cases the target could be a non-Element node. Consider guarding with `if (!(target instanceof Element)) return;` before calling `.closest()`, or this might be intentionally relying on React's synthetic events always providing Elements.
      @@ -0,0 +1,13 @@
      1+import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
      2+
      3+import { cn } from "~/lib/utils";
      4+
      5+function Separator({ className, orientation = "horizontal", ...props }: SeparatorPrimitive.Props) {
      6+ return (
      7+ <SeparatorPrimitive
      8+ className={cn(
      9+ "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch",
      10+ className,
      11+ )}
      12+ data-slot="separator"
      13+ orientation={orientation}
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟢 Low

      ui/separator.tsx:13 The not-[[class^='h-']] selector won't work because cn prepends base classes like shrink-0, so h-* classes never appear at the start of the class string. Consider using not-[[class*='h-']] (contains) instead of [class^='h-'] (starts with).

      Suggested change
      13- orientation={orientation}
      13+ "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class*=' h-']]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch",

      🚀 Want me to fix this? Reply ex: "fix it for me".

      🤖 Prompt for AI
      In file apps/web/src/components/ui/separator.tsx around line 13:
      
      The `not-[[class^='h-']]` selector won't work because `cn` prepends base classes like `shrink-0`, so `h-*` classes never appear at the start of the class string. Consider using `not-[[class*='h-']]` (contains) instead of `[class^='h-']` (starts with).
    11. Actionable comments posted: 5

      🤖 Fix all issues with AI agents
      In `@apps/web/src/components/ChatView.tsx`:
      - Around line 1461-1474: The keyboard handler inside the useEffect (the handler
      function) calls api.shell.openInEditor directly and therefore bypasses the same
      local state/localStorage update performed by the openInEditor callback; update
      the handler to mirror openInEditor: call setLastEditor(newEditor) and persist
      the value to localStorage (same key used elsewhere, e.g., LAST_EDITOR_KEY)
      before invoking api.shell.openInEditor(cwd, newEditor) so lastEditor state and
      storage stay consistent with button-driven opens.
      
      In `@apps/web/src/components/ui/alert-dialog.tsx`:
      - Around line 1-5: The file uses React.ComponentProps<"div"> (seen on the props
      types at lines using those type expressions), but React is not imported; add an
      import for React at the top of the file (e.g., import React from "react" or
      import * as React from "react") so the type React.ComponentProps is available;
      update the top alongside the existing imports (near AlertDialogPrimitive and cn)
      to fix the TypeScript errors referencing React.ComponentProps<"div">.
      
      In `@apps/web/src/components/ui/card.tsx`:
      - Around line 1-196: The Card primitives (Card, CardFrame, CardHeader,
      CardTitle, CardDescription, CardAction, CardPanel, CardFooter, CardFrameHeader,
      CardFrameTitle, CardFrameDescription, CardFrameFooter) were implemented inside
      apps/web and must be moved to the shared UI package; extract the entire file
      contents into packages/ui as a new module (e.g.,
      packages/ui/src/components/card.tsx), ensure the module exports the same named
      symbols (Card, CardFrame, CardFrameHeader, CardFrameTitle, CardFrameDescription,
      CardFrameFooter, CardHeader, CardTitle, CardDescription, CardAction, CardPanel,
      CardContent alias, CardFooter), add that export to packages/ui's public exports
      (index barrel), then update the original apps/web imports to import these
      components from packages/ui instead of the local file; keep the same function
      names and prop types (useRender.ComponentProps<"div">) so callers continue to
      work.
      
      In `@apps/web/src/components/ui/input.tsx`:
      - Around line 1-62: Move the Input component (Input, InputProps, and its use of
      InputPrimitive/nativeInput) out of the app and into the shared UI package
      (packages/ui) and re-export it from that package; update the package's public
      exports (the UI package index/exports) to include Input, adjust all app imports
      to import Input from the shared UI package instead of the app path, and ensure
      TypeScript types and any peer deps (base-ui/react) are declared in the UI
      package so the component builds correctly.
      - Around line 8-57: The Input component declares refs for HTMLInputElement but
      currently wraps the input in a span so incoming refs attach to the span; convert
      the Input function into a React.forwardRef component (export default
      React.forwardRef or similar) that accepts a ref parameter typed as
      HTMLInputElement and pass that ref through to the actual input element (for
      nativeInput case) or to the underlying InputPrimitive (for non-native case),
      keeping the existing size prop handling and props spread; update InputProps to
      remove/react-adjust RefAttributes if needed so the forwarded ref type matches
      the component signature and ensure the span remains without receiving the
      forwarded ref.
      🧹 Nitpick comments (9)
      apps/web/src/components/ChatView.tsx (1)

      7-7: Import ModelSlug as a type.

      ModelSlug is only used as a type annotation (lines 798, 1375). Import it with the type keyword for proper tree-shaking.

      ♻️ Suggested fix
       import {
         PROVIDER_SEND_TURN_MAX_INPUT_CHARS,
         PROVIDER_SEND_TURN_MAX_ATTACHMENTS,
         PROVIDER_SEND_TURN_MAX_IMAGE_BYTES,
         type ProviderSendTurnAttachmentInput,
         type ProviderApprovalDecision,
      -  ModelSlug,
      +  type ModelSlug,
       } from "@t3tools/contracts";
      apps/web/src/components/ui/input-group.tsx (1)

      45-70: Compose onMouseDown with consumer handlers.

      Right now a consumer-provided onMouseDown (via props) will override this logic or vice‑versa. Composing both handlers preserves your focus behavior while still honoring consumer hooks.

      ♻️ Suggested refactor
      -function InputGroupAddon({
      -  className,
      -  align = "inline-start",
      -  ...props
      -}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
      +function InputGroupAddon({
      +  className,
      +  align = "inline-start",
      +  onMouseDown,
      +  ...props
      +}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
         return (
           <div
             className={cn(inputGroupAddonVariants({ align }), className)}
             data-align={align}
             data-slot="input-group-addon"
      -      onMouseDown={(e) => {
      +      onMouseDown={(e) => {
      +        onMouseDown?.(e);
      +        if (e.defaultPrevented) return;
               const target = e.target as HTMLElement;
               const isInteractive = target.closest(
                 "button, a, input, select, textarea, [role='button'], [role='combobox'], [role='listbox'], [data-slot='select-trigger']",
               );
               if (isInteractive) return;
               e.preventDefault();
               const parent = e.currentTarget.parentElement;
               const input = parent?.querySelector<HTMLInputElement | HTMLTextAreaElement>(
                 "input, textarea",
               );
               if (input && !parent?.querySelector("input:focus, textarea:focus")) {
                 input.focus();
               }
             }}
             {...props}
           />
         );
       }
      apps/web/src/components/ui/scroll-area.tsx (1)

      7-35: Prefer sourcing ScrollArea from packages/ui. This local component in apps/web can drift from the shared UI layer. Consider moving it into packages/ui and importing it from there so the web app consumes the shared component consistently.

      Based on learnings: Applies to apps/web/**/*.{ts,tsx} : Use packages/ui components - import UI components from the packages/ui package.

      apps/web/src/components/BranchToolbar.tsx (3)

      2-3: Consider namespace React import for consistency. The repo prefers import * as React and React.useState/useEffect over named React imports.

      Based on learnings: "Prefer namespace imports in TypeScript (e.g., import * as React from 'react', import * as Effect from 'effect/Effect')".


      12-23: Consider consuming UI primitives from packages/ui. This file imports Button/Combobox/InputGroup from local paths; the shared UI guideline suggests using the package export when available (or re-exporting these there).

      Based on learnings: "Use packages/ui components - import UI components from the packages/ui package".


      159-293: Consider splitting BranchToolbar into subcomponents. The JSX flow (env toggle, combobox list, and create-branch form) is large enough to benefit from co-located subcomponents for readability and testability.

      Based on learnings: "Extract large React components into multiple subcomponents with granular functionality. Co-locate subcomponents in the same file as the main component. Avoid hoisting callbacks too high up the component tree; prefer colocating logic close to JSX."

      apps/web/src/components/ui/command.tsx (1)

      7-17: Prefer shared UI exports for Autocomplete (and related primitives). To align with the shared UI guideline, consider re-exporting Autocomplete primitives from packages/ui and importing from there instead of local paths.

      Based on learnings: "Use packages/ui components - import UI components from the packages/ui package".

      apps/web/src/components/GitActionsControl.tsx (1)

      253-265: Consider clearing the interval on component unmount.

      The interval is cleared in both success and error branches, but if the component unmounts during a pending action, the interval may continue running. This is unlikely in practice since the action is awaited, but for robustness you could use useEffect cleanup or an abort pattern.

      apps/server/src/git.ts (1)

      283-295: Minor: Consider sorting once after all files are added.

      The code sorts at line 289 with .toSorted() then potentially adds more files (lines 291-294) and sorts again at line 295. You could simplify by collecting all files first and sorting once.

      ♻️ Suggested optimization
      -    const files = Array.from(fileStatMap.entries())
      -      .map(([path, stat]) => {
      -        insertions += stat.insertions;
      -        deletions += stat.deletions;
      -        return { path, insertions: stat.insertions, deletions: stat.deletions };
      -      })
      -      .toSorted((a, b) => a.path.localeCompare(b.path));
      -
      -    for (const filePath of changedFilesWithoutNumstat) {
      -      if (fileStatMap.has(filePath)) continue;
      -      files.push({ path: filePath, insertions: 0, deletions: 0 });
      -    }
      -    files.sort((a, b) => a.path.localeCompare(b.path));
      +    const files: Array<{ path: string; insertions: number; deletions: number }> = [];
      +    for (const [path, stat] of fileStatMap.entries()) {
      +      insertions += stat.insertions;
      +      deletions += stat.deletions;
      +      files.push({ path, insertions: stat.insertions, deletions: stat.deletions });
      +    }
      +    for (const filePath of changedFilesWithoutNumstat) {
      +      if (fileStatMap.has(filePath)) continue;
      +      files.push({ path: filePath, insertions: 0, deletions: 0 });
      +    }
      +    files.sort((a, b) => a.path.localeCompare(b.path));
      @@ -1575,0 +1454,21 @@
      1454+ void api.shell.openInEditor(cwd, editor);
      1455+ localStorage.setItem(LAST_EDITOR_KEY, editor);
      1456+ setLastEditor(editor);
      1457+ },
      1458+ [api, activeProject, activeThread, lastEditor, setLastEditor],
      1459+ );
      1460+
      1461+ // Cmd+O / Ctrl+O to open in last-used editor
      1462+ useEffect(() => {
      1463+ const handler = (e: globalThis.KeyboardEvent) => {
      1464+ if (e.key === "o" && (e.metaKey || e.ctrlKey) && !e.shiftKey) {
      1465+ if (api && activeProject) {
      1466+ e.preventDefault();
      1467+ const cwd = activeThread?.worktreePath ?? activeProject.cwd;
      1468+ void api.shell.openInEditor(cwd, lastEditor);
      1469+ }
      1470+ }
      1471+ };
      1472+ window.addEventListener("keydown", handler);
      1473+ return () => window.removeEventListener("keydown", handler);
      1474+ }, [api, activeProject, activeThread, lastEditor]);
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟡 Minor

      Keyboard handler bypasses setLastEditor update.

      The Cmd/Ctrl+O handler directly calls api.shell.openInEditor without updating localStorage or lastEditor state, unlike the openInEditor callback used by button clicks. This creates inconsistent behavior.

      🔧 Suggested fix
         useEffect(() => {
           const handler = (e: globalThis.KeyboardEvent) => {
             if (e.key === "o" && (e.metaKey || e.ctrlKey) && !e.shiftKey) {
      -        if (api && activeProject) {
      +        if (activeProject) {
                 e.preventDefault();
      -          const cwd = activeThread?.worktreePath ?? activeProject.cwd;
      -          void api.shell.openInEditor(cwd, lastEditor);
      +          openInEditor(lastEditor);
               }
             }
           };
           window.addEventListener("keydown", handler);
           return () => window.removeEventListener("keydown", handler);
      -  }, [api, activeProject, activeThread, lastEditor]);
      +  }, [activeProject, openInEditor, lastEditor]);
      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ChatView.tsx` around lines 1461 - 1474, The keyboard
      handler inside the useEffect (the handler function) calls api.shell.openInEditor
      directly and therefore bypasses the same local state/localStorage update
      performed by the openInEditor callback; update the handler to mirror
      openInEditor: call setLastEditor(newEditor) and persist the value to
      localStorage (same key used elsewhere, e.g., LAST_EDITOR_KEY) before invoking
      api.shell.openInEditor(cwd, newEditor) so lastEditor state and storage stay
      consistent with button-driven opens.
      @@ -0,0 +1,5 @@
      1+"use client";
      2+
      3+import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
      4+
      5+import { cn } from "~/lib/utils";
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🔴 Critical

      Missing React import for type usage.

      React.ComponentProps<"div"> is used on lines 71 and 85 but React is not imported. This will cause a TypeScript error.

      🐛 Proposed fix
       "use client";
       
       import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
      +import type * as React from "react";
       
       import { cn } from "~/lib/utils";
      📝 Committable suggestion

      ‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      Suggested change
      1-"use client";
      2-
      3-import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
      4-
      5-import { cn } from "~/lib/utils";
      1+"use client";
      2+
      3+import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
      4+import type * as React from "react";
      5+
      6+import { cn } from "~/lib/utils";
      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/alert-dialog.tsx` around lines 1 - 5, The file
      uses React.ComponentProps<"div"> (seen on the props types at lines using those
      type expressions), but React is not imported; add an import for React at the top
      of the file (e.g., import React from "react" or import * as React from "react")
      so the type React.ComponentProps is available; update the top alongside the
      existing imports (near AlertDialogPrimitive and cn) to fix the TypeScript errors
      referencing React.ComponentProps<"div">.
      @@ -0,0 +176,21 @@
      176+ defaultTagName: "div",
      177+ props: mergeProps<"div">(defaultProps, props),
      178+ render,
      179+ });
      180+}
      181+
      182+export {
      183+ Card,
      184+ CardFrame,
      185+ CardFrameHeader,
      186+ CardFrameTitle,
      187+ CardFrameDescription,
      188+ CardFrameFooter,
      189+ CardAction,
      190+ CardDescription,
      191+ CardFooter,
      192+ CardHeader,
      193+ CardPanel,
      194+ CardPanel as CardContent,
      195+ CardTitle,
      196+};
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟠 Major

      Move Card primitives into packages/ui and import from there.

      This file defines UI primitives directly inside apps/web, which conflicts with the shared UI sourcing rule. Please relocate these components into packages/ui (or add them there if missing) and consume them via imports in the web app. As per coding guidelines: "apps/web/**/*.{ts,tsx}: Use packages/ui components - import UI components from the packages/ui package".

      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/card.tsx` around lines 1 - 196, The Card
      primitives (Card, CardFrame, CardHeader, CardTitle, CardDescription, CardAction,
      CardPanel, CardFooter, CardFrameHeader, CardFrameTitle, CardFrameDescription,
      CardFrameFooter) were implemented inside apps/web and must be moved to the
      shared UI package; extract the entire file contents into packages/ui as a new
      module (e.g., packages/ui/src/components/card.tsx), ensure the module exports
      the same named symbols (Card, CardFrame, CardFrameHeader, CardFrameTitle,
      CardFrameDescription, CardFrameFooter, CardHeader, CardTitle, CardDescription,
      CardAction, CardPanel, CardContent alias, CardFooter), add that export to
      packages/ui's public exports (index barrel), then update the original apps/web
      imports to import these components from packages/ui instead of the local file;
      keep the same function names and prop types (useRender.ComponentProps<"div">) so
      callers continue to work.
      @@ -0,0 +42,21 @@
      42+ >
      43+ {nativeInput ? (
      44+ <input
      45+ className={inputClassName}
      46+ data-slot="input"
      47+ size={typeof size === "number" ? size : undefined}
      48+ {...props}
      49+ />
      50+ ) : (
      51+ <InputPrimitive
      52+ className={inputClassName}
      53+ data-slot="input"
      54+ size={typeof size === "number" ? size : undefined}
      55+ {...props}
      56+ />
      57+ )}
      58+ </span>
      59+ );
      60+}
      61+
      62+export { Input, type InputProps };
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟠 Major

      Place this Input in packages/ui and import it from there.

      This component lives in apps/web, but project conventions prefer shared UI primitives. Moving it to packages/ui (or re-exporting it from there) helps avoid divergence between apps.

      Based on learnings: "Use packages/ui components - import UI components from the packages/ui package".

      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/input.tsx` around lines 1 - 62, Move the Input
      component (Input, InputProps, and its use of InputPrimitive/nativeInput) out of
      the app and into the shared UI package (packages/ui) and re-export it from that
      package; update the package's public exports (the UI package index/exports) to
      include Input, adjust all app imports to import Input from the shared UI package
      instead of the app path, and ensure TypeScript types and any peer deps
      (base-ui/react) are declared in the UI package so the component builds
      correctly.
      @@ -0,0 +37,21 @@
      37+ className,
      38+ ) || undefined
      39+ }
      40+ data-size={size}
      41+ data-slot="input-control"
      42+ >
      43+ {nativeInput ? (
      44+ <input
      45+ className={inputClassName}
      46+ data-slot="input"
      47+ size={typeof size === "number" ? size : undefined}
      48+ {...props}
      49+ />
      50+ ) : (
      51+ <InputPrimitive
      52+ className={inputClassName}
      53+ data-slot="input"
      54+ size={typeof size === "number" ? size : undefined}
      55+ {...props}
      56+ />
      57+ )}
      coderabbitai[bot](GitHub profile, opens in a new tab)commented

      ⚠️ Potential issue | 🟠 Major

      🧩 Analysis chain

      🏁 Script executed:

      cat package.json | grep -A 5 '"react"'

      Repository: pingdotgg/codething-mvp

      Length of output: 49


      🏁 Script executed:

      # Check if Input component is used with refs anywhere
      rg -n 'ref=' apps/web/src --type=tsx | grep -i input | head -20

      Repository: pingdotgg/codething-mvp

      Length of output: 94


      🏁 Script executed:

      # Check React version more thoroughly
      fd package.json | xargs grep -l '"react"' | head -5 | xargs cat | grep -A 2 '"react"'

      Repository: pingdotgg/codething-mvp

      Length of output: 151


      🏁 Script executed:

      fd -e ts -e tsx | xargs grep -l "InputPrimitive" | head -5

      Repository: pingdotgg/codething-mvp

      Length of output: 103


      🏁 Script executed:

      # Search for Input component usage with ref in web app
      rg 'Input\s*[a-zA-Z0-9]*.*ref\s*=' apps/web/src --type=ts --type=tsx 2>/dev/null | head -20

      Repository: pingdotgg/codething-mvp

      Length of output: 49


      🏁 Script executed:

      # Check InputPrimitive import and definition
      cat apps/web/src/components/ui/input.tsx | head -20

      Repository: pingdotgg/codething-mvp

      Length of output: 530


      Forward refs to the actual input element; current component wraps in a span.

      InputProps accepts React.RefAttributes<HTMLInputElement>, but any ref passed to Input will attach to the outer <span> wrapper, not the actual input element. This breaks focus/measurement use-cases and creates a mismatch between the type signature and runtime behavior. Use React.forwardRef to explicitly wire the ref through to either the native <input> or <InputPrimitive> (depending on the nativeInput flag).

      ✅ Suggested fix
      -import type * as React from "react";
      +import * as React from "react";
      
      -type InputProps = Omit<InputPrimitive.Props & React.RefAttributes<HTMLInputElement>, "size"> & {
      +type InputProps = Omit<InputPrimitive.Props, "size"> & {
         size?: "sm" | "default" | "lg" | number;
         unstyled?: boolean;
         nativeInput?: boolean;
       };
      
      -function Input({
      +const Input = React.forwardRef<HTMLInputElement, InputProps>(function Input({
         className,
         size = "default",
         unstyled = false,
         nativeInput = false,
         ...props
      -}: InputProps) {
      +}: InputProps, ref) {
         const inputClassName = cn(
           "h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5 [transition:background-color_5000000s_ease-in-out_0s]",
           size === "sm" && "h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5",
           size === "lg" && "h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5",
           props.type === "search" &&
             "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",
           props.type === "file" &&
             "text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm",
         );
      
         return (
           <span
             className={
               cn(
                 !unstyled &&
                   "relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-autofill:bg-foreground/4 has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]",
                 className,
               ) || undefined
             }
             data-size={size}
             data-slot="input-control"
           >
             {nativeInput ? (
               <input
                 className={inputClassName}
                 data-slot="input"
                 size={typeof size === "number" ? size : undefined}
      +          ref={ref}
                 {...props}
               />
             ) : (
               <InputPrimitive
                 className={inputClassName}
                 data-slot="input"
                 size={typeof size === "number" ? size : undefined}
      +          ref={ref}
                 {...props}
               />
             )}
           </span>
         );
      -}
      +});
      +
      +Input.displayName = "Input";
      🤖 Prompt for AI Agents
      In `@apps/web/src/components/ui/input.tsx` around lines 8 - 57, The Input
      component declares refs for HTMLInputElement but currently wraps the input in a
      span so incoming refs attach to the span; convert the Input function into a
      React.forwardRef component (export default React.forwardRef or similar) that
      accepts a ref parameter typed as HTMLInputElement and pass that ref through to
      the actual input element (for nativeInput case) or to the underlying
      InputPrimitive (for non-native case), keeping the existing size prop handling
      and props spread; update InputProps to remove/react-adjust RefAttributes if
      needed so the forwarded ref type matches the component signature and ensure the
      span remains without receiving the forwarded ref.
    12. @@ -0,0 +1,14 @@
      1+"use client";
      2+
      3+import { Input as InputPrimitive } from "@base-ui/react/input";
      4+import type * as React from "react";
      5+
      6+import { cn } from "~/lib/utils";
      7+
      8+type InputProps = Omit<InputPrimitive.Props & React.RefAttributes<HTMLInputElement>, "size"> & {
      9+ size?: "sm" | "default" | "lg" | number;
      10+ unstyled?: boolean;
      11+ nativeInput?: boolean;
      12+};
      13+
      14+function Input({
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      ui/input.tsx:14 Refs won't forward to the underlying <input> because Input isn't wrapped in React.forwardRef. Consider wrapping this component with forwardRef and explicitly passing ref to the input elements.

      🚀 Want me to fix this? Reply ex: "fix it for me".

      🤖 Prompt for AI
      In file apps/web/src/components/ui/input.tsx around line 14:
      
      Refs won't forward to the underlying `<input>` because `Input` isn't wrapped in `React.forwardRef`. Consider wrapping this component with `forwardRef` and explicitly passing `ref` to the input elements.
    13. @@ -268,17 +153,5 @@
      268- }
      269- return api.git.runStackedAction({ cwd: gitCwd, action });
      270- },
      271- onMutate: () => {
      272- setIsGitMenuOpen(false);
      273- setGitActionError(null);
      274- setGitModalError(null);
      275- },
      276- onSuccess: async () => {
      277- await queryClient.invalidateQueries({ queryKey: ["git"] });
      278- },
      279- onError: (error) => {
      280- setGitActionError(error instanceof Error ? error.message : "Git action failed.");
      281- },
      282- });
      153+ const { data: branchList = null } = useQuery(gitBranchesQueryOptions(api, gitCwd));
      154+ // Default to true while loading so we don't flash init controls.
      155+ const isRepo = branchList?.isRepo ?? true;
      283156
      284- const isGitActionRunning = isGitModalActionRunning || runImmediateGitActionMutation.isPending;
      157+ const initMutation = useMutation(gitInitMutationOptions({ api, cwd: gitCwd, queryClient }));
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      components/GitActionsControl.tsx:157 When gitCwd changes, activeDialogAction isn't reset, so an open dialog could execute against a different repository. The missing useEffect that was removed in this refactor should be restored to reset dialog state when gitCwd changes.

       const [dialogCommitMessage, setDialogCommitMessage] = useState("");
      +
      +  useEffect(() => {
      +    setActiveDialogAction(null);
      +    setDialogCommitMessage("");
      +  }, [gitCwd]);

      🚀 Want me to fix this? Reply ex: "fix it for me".

      🤖 Prompt for AI
      In file apps/web/src/components/GitActionsControl.tsx around line 157:
      
      When `gitCwd` changes, `activeDialogAction` isn't reset, so an open dialog could execute against a different repository. The missing `useEffect` that was removed in this refactor should be restored to reset dialog state when `gitCwd` changes.
      @@ -0,0 +166,21 @@
      166+function SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props) {
      167+ return (
      168+ <SelectPrimitive.Item
      169+ className={cn(
      170+ "grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
      171+ className,
      172+ )}
      173+ data-slot="select-item"
      174+ {...props}
      175+ >
      176+ <SelectPrimitive.ItemIndicator className="col-start-1">
      177+ <svg
      178+ fill="none"
      179+ height="24"
      180+ stroke="currentColor"
      181+ strokeLinecap="round"
      182+ strokeLinejoin="round"
      183+ strokeWidth="2"
      184+ viewBox="0 0 24 24"
      185+ width="24"
      186+ xmlns="http://www.w3.org/1500/svg"
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟢 Low

      ui/select.tsx:186 Typo in SVG namespace: 1500 should be 2000. The checkmark won't render correctly in strict XML environments.

      Suggested change
      186- xmlns="http://www.w3.org/1500/svg"
      186+ xmlns="http://www.w3.org/2000/svg"

      🚀 Want me to fix this? Reply ex: "fix it for me".

      🤖 Prompt for AI
      In file apps/web/src/components/ui/select.tsx around line 186:
      
      Typo in SVG namespace: `1500` should be `2000`. The checkmark won't render correctly in strict XML environments.
    14. juliusmarminge merged this758df83

    15. juliusmarminge closed this

    16. @@ -0,0 +27,21 @@
      27+
      28+ return (
      29+ <div className="relative not-has-[>*.w-full]:w-fit w-full text-foreground has-disabled:opacity-64">
      30+ {startAddon && (
      31+ <div
      32+ aria-hidden="true"
      33+ className="[&_svg]:-mx-0.5 pointer-events-none absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] opacity-80 has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4"
      34+ data-slot="autocomplete-start-addon"
      35+ >
      36+ {startAddon}
      37+ </div>
      38+ )}
      39+ <AutocompletePrimitive.Input
      40+ className={cn(
      41+ startAddon &&
      42+ "data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7.5)-1px)] *:data-[slot=autocomplete-input]:ps-[calc(--spacing(8.5)-1px)] sm:data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7)-1px)] sm:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(8)-1px)]",
      43+ sizeValue === "sm"
      44+ ? "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-6.5"
      45+ : "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-7",
      46+ className,
      47+ )}
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟢 Low

      ui/autocomplete.tsx:40 The *:data-[slot=autocomplete-input] selector targets children of elements with that attribute, but data-slot="autocomplete-input" is on the wrapper itself (not its parent). Consider changing *:data-[slot=autocomplete-input] to *:data-[slot=input] to target the actual input element inside the wrapper.

      Suggested change
      40- className={cn(
      41- startAddon &&
      42- "data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7.5)-1px)] *:data-[slot=autocomplete-input]:ps-[calc(--spacing(8.5)-1px)] sm:data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7)-1px)] sm:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(8)-1px)]",
      43- sizeValue === "sm"
      44- ? "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-6.5"
      45- : "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-7",
      46- className,
      47- )}
      40+ className={cn(
      41+ startAddon &&
      42+ "data-[size=sm]:*:data-[slot=input]:ps-[calc(--spacing(7.5)-1px)] *:data-[slot=input]:ps-[calc(--spacing(8.5)-1px)] sm:data-[size=sm]:*:data-[slot=input]:ps-[calc(--spacing(7)-1px)] sm:*:data-[slot=input]:ps-[calc(--spacing(8)-1px)]",
      43+ sizeValue === "sm"
      44+ ? "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=input]:pe-6.5"
      45+ : "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=input]:pe-7",
      46+ className,
      47+ )}

      🚀 Want me to fix this? Reply ex: "fix it for me".

      🤖 Prompt for AI
      In file apps/web/src/components/ui/autocomplete.tsx around lines 40-47:
      
      The `*:data-[slot=autocomplete-input]` selector targets children of elements with that attribute, but `data-slot="autocomplete-input"` is on the wrapper itself (not its parent). Consider changing `*:data-[slot=autocomplete-input]` to `*:data-[slot=input]` to target the actual input element inside the wrapper.

Sign in to join this conversation.