diff --git a/AGENTS.md b/AGENTS.md index b12580c..22a6c4b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,79 +1,26 @@ # AGENTS.md -This project is a PR review UI with Bitbucket Cloud OAuth. It renders diffs and a file tree for Bitbucket pull requests with a terminal-inspired design. +pullrequest.review is a Bitbucket pull request review UI with a terminal-style interface focused on fast diff and file-tree navigation. -## Stack -- Vite + React + TypeScript -- TanStack Router/Start + React Query -- Diff rendering: `@pierre/diffs` -- UI components in `src/components/ui` -- Design: Terminal-inspired, monospaced (JetBrains Mono), dark theme with defined borders +## Project Principles +- Keep the UI practical, compact, and keyboard-friendly. +- Preserve the terminal-inspired design language. +- Prefer simple, maintainable code over complex abstractions. -## Key flows -- OAuth + token persistence + refresh: `src/lib/bitbucket-oauth.ts`, `src/lib/pr-context.tsx`, `src/routes/oauth/callback.tsx` -- Onboarding + repo selection: `src/routes/__root.tsx` -- PR input + PR list landing: `src/routes/index.tsx` -- Bitbucket API fetch + diff parsing: `src/routes/index.tsx` -- File tree data model: `src/lib/file-tree-context.tsx` -- File tree UI: `src/components/file-tree.tsx` -- Diff anchors: `src/lib/file-anchors.ts` -- Settings popup with diff options: `src/components/settings-menu.tsx` -- Keyboard shortcuts: `src/lib/shortcuts-context.tsx` +## Technical Direction +- Use Bun only for dependency management and scripts. +- Keep the app client-first and avoid unnecessary server complexity. +- Prefer existing context/state patterns before introducing new globals. -## Bitbucket Cloud integration -- Accepts PR URL: `https://bitbucket.org///pull-requests/` -- Fetches: - - `GET https://api.bitbucket.org/2.0/repositories///pullrequests//diff` - - `GET https://api.bitbucket.org/2.0/repositories///pullrequests//diffstat?pagelen=100` -- Repository listing: - - `GET https://api.bitbucket.org/2.0/repositories?role=member&pagelen=100` -- PR list per repo: - - `GET https://api.bitbucket.org/2.0/repositories///pullrequests?pagelen=20` - -## OAuth setup -- OAuth endpoints: - - `https://bitbucket.org/site/oauth2/authorize` - - `https://bitbucket.org/site/oauth2/access_token` -- Required env: - - `VITE_BITBUCKET_CLIENT_ID` (client/public) - - `BITBUCKET_CLIENT_SECRET` (server) -- Callback route: - - `http://localhost:3000/oauth/callback` (adjust to your dev origin) - -## Local storage keys -- OAuth tokens: `bitbucket_oauth` -- Selected repos: `bitbucket_repos` -- OAuth state: `bitbucket_oauth_state` -- Keyboard shortcuts: `pr_review_shortcuts` - -## Design System -- Monospaced font: JetBrains Mono -- Dark theme: Near-black backgrounds (#0a0a0a, #111111) with subtle borders (#2a2a2a) -- Sharp corners: 2px border radius maximum -- Terminal aesthetic: Clean panels, minimal rounding, computer-focused -- Status colors: Green (#22c55e) for added, Red (#ef4444) for removed, Yellow (#eab308) for modified - -## Settings & Shortcuts -- Settings accessed via "Settings" button in header -- Diff options moved to settings popup with tabbed interface -- Keyboard shortcuts configurable in settings: - - Default: `j` = Next file, `k` = Previous file - - Supports modifier keys (Ctrl, Alt, Shift, Cmd) - - Persisted to localStorage -- File navigation works globally (j/k keys scroll to file in diff view) - -## Conventions and notes +## Coding Conventions - Use ASCII in source files. -- No nested bullet lists in responses. -- Use Bun only for dependency management and scripts. Do not use npm, yarn, or pnpm. -- Use `pullrequestdotreview` as the canonical name of the project when pullrequest.review is not possible -- Prefer existing contexts (`pr-context`, `file-tree-context`, `shortcuts-context`) over adding new global state. -- Wrap context provider values in `useMemo` to prevent unnecessary re-renders. -- `ScrollArea` from Radix is currently avoided due to a render loop; use simple `div` + `overflow-auto` for now. -- Dialog animations removed from Radix Dialog to prevent infinite loop issues. +- Keep components small and focused. +- Use memoization for provider/context values when needed to avoid avoidable re-renders. + +## UI Conventions +- Monospaced-first typography. +- Sharp corners and clean panel structure. +- Consistent controls for settings, themes, and keyboard shortcuts. -## Suggested next upgrades -- Add PR state badges and sorting on the landing list. -- Store selected repos in a small settings panel to edit later. -- Add PR metadata (title, author, status) in the header/sidebar of the diff view. -- Filter diff view by selected file (optional). +## Naming +- Use `pullrequestdotreview` as the canonical project name when `pullrequest.review` cannot be used. diff --git a/README.md b/README.md index 12f75fe..1212833 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# bun-tanstack-start-template +# pullrequest.review -A TanStack Start project powered by Bun. +A lightweight Bitbucket pull request review app with a terminal-inspired UI, focused on fast diff reading, file-tree navigation, and keyboard-driven workflows. To install dependencies: @@ -13,23 +13,3 @@ To start a development server: ```bash bun dev ``` - -To build for production: - -```bash -bun run build -``` - -## About TanStack Start - -[TanStack Start](https://tanstack.com/start/latest) is a full-stack framework powered by TanStack Router for React and Solid that provides: - -- File-based routing -- Server-side rendering (SSR) -- Server functions with `createServerFn` -- Built-in data loading with route loaders -- Hot module replacement (HMR) - -This project was created using `bun init --react=tanstack` in bun v1.3.3. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime. - -For more information, check out Bun's [TanStack Start guide](https://bun.com/guides/ecosystem/tanstack-start).