Initial public release of Warp.

Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
David Stern
2026-04-28 08:43:33 -05:00
commit 0dbd3d567a
4982 changed files with 1431549 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
# APP-3919: Commit Dialog
Parent spec: `specs/APP-3918/PRODUCT.md`
Branch: `edward/commit-dialog`
## Summary
Add a commit dialog overlay to the code review panel that lets users compose and execute a git commit directly from the code review header, without switching to the terminal.
## Problem
The git operations button (from the parent branch) dispatches `OpenCommitDialog` but has no dialog to open. Users must switch to the terminal to run `git commit`. This breaks the inline workflow the button is designed to enable.
## User Experience
### Opening the dialog
The commit dialog opens when the user:
- Clicks the "Commit" primary button in the code review header
- Selects "Commit" from the chevron dropdown menu
The dialog renders as a centered modal overlay with a blurred background, consistent with the existing discard confirmation dialog.
### Dialog layout
The dialog ("Commit your changes") contains four sections:
1. **Branch** — displays the current branch name with a git-branch icon. Read-only.
2. **Changes** — shows a summary of changed files with aggregate stats (file count, +additions, -deletions).
- A collapsible file list shows per-file stats (filename, directory, +/-, -)
- "Include unstaged" toggle (on by default) controls whether unstaged + untracked changes are included or only staged changes
- Toggling the switch reloads the file list from git
3. **Commit message** — a multi-line text editor with placeholder text "Leave blank to autogenerate a commit message".
- Supports soft-wrap and autogrow
- ESC dismisses the dialog
- Editor is focused on open
4. **Intent selector** — currently only "Commit" button. Future: "Commit and push", "Commit and create PR".
### Footer
- Cancel button (left)
- Confirm "Commit" button (right) — disabled when no files or no commit message
### After committing
On success:
- Dialog closes
- A toast notification shows "Changes successfully committed."
- Diffs are reloaded to reflect the new state
- Diff metadata and PR info are refreshed
On failure:
- Dialog closes
- A toast shows the error message
- Diffs are reloaded (state may have partially changed)
### Closing the dialog
The dialog can be closed by:
- Clicking Cancel
- Clicking the X button
- Pressing ESC in the message editor
## Non-goals
- Staging individual files/hunks from the dialog (the "Include unstaged" toggle is all-or-nothing)
- Commit amend
- Compound actions (commit+push, commit+create PR) — stubs exist but are wired in child branches
## Success Criteria
1. Clicking "Commit" in the header opens the dialog overlay
2. The dialog shows the current branch, file changes with stats, and a message editor
3. Toggling "Include unstaged" refreshes the file list (staged-only vs all changes)
4. Confirming runs `git commit` with the entered message
5. Success/failure toasts appear after the commit
6. The code review panel refreshes to reflect post-commit state
7. ESC and Cancel close the dialog without committing
+100
View File
@@ -0,0 +1,100 @@
# APP-3919: Commit Dialog — Tech Spec
Product spec: `specs/APP-3919/PRODUCT.md`
Branch: `edward/commit-dialog`
## Relevant Code
- `app/src/code_review/commit_dialog.rs` — new file, entire dialog view
- `app/src/code_review/code_review_view.rs``open_commit_dialog`, dialog overlay rendering, action wiring
- `app/src/util/git.rs``get_file_change_entries`, `FileChangeEntry`
- `app/src/code_review/mod.rs` — module registration
## Changes
### 1. `CommitDialog` view (`commit_dialog.rs`)
New 718-line view implementing the dialog UI. Key types:
- `CommitIntent` enum — `CommitOnly` (future: `CommitAndPush`, `CommitAndCreatePr`)
- `CommitDialogAction` — internal actions: `Cancel`, `Confirm`, `SetIntent`, `ToggleIncludeUnstaged`, `ToggleChangesExpanded`
- `CommitDialogEvent` — events emitted to parent: `Confirmed { message, intent, include_unstaged }`, `Cancelled`
State:
- `repo_path`, `branch_name` — set at construction
- `intent: CommitIntent` — which action to take on confirm
- `include_unstaged: bool` — toggle for staged-only vs all changes (default: true)
- `file_changes: Vec<FileChangeEntry>` — loaded async on open and on toggle
- `changes_expanded: bool` — collapsible file list
- `message_editor: ViewHandle<EditorView>` — commit message input
The dialog uses the existing `Dialog` component with `dialog_styles`. The message editor uses `EditorView` with `soft_wrap`, `autogrow`, and `supports_vim_mode: false`.
File changes are loaded on construction and reloaded when `include_unstaged` is toggled. The confirm button is disabled when there are no files or no message.
### 2. `get_file_change_entries` (`git.rs`)
New async function that returns per-file change stats:
```rust
pub async fn get_file_change_entries(
repo_path: &Path,
include_unstaged: bool,
) -> Result<Vec<FileChangeEntry>>
```
- When `include_unstaged` is true: runs `git diff --numstat HEAD` + `git ls-files --others --exclude-standard` for untracked files
- When false: runs `git diff --cached --numstat` (staged only)
- Returns `FileChangeEntry { path, additions, deletions }` for each file
### 3. Dialog lifecycle in `CodeReviewView`
New field: `commit_dialog: Option<ViewHandle<CommitDialog>>`
`open_commit_dialog` method:
1. Guards against double-open
2. Gets repo path and branch name from `DiffStateModel`
3. Creates `CommitDialog` view
4. Subscribes to `CommitDialogEvent`:
- `Confirmed` → closes dialog, spawns async `run_commit`, shows success/error toast, reloads diffs + metadata + PR info
- `Cancelled` → closes dialog
5. Focuses the dialog
### 4. Overlay rendering
The dialog is rendered as a positioned overlay in `View::render`, using the same pattern as the discard confirmation dialog. Both dialogs are mutually exclusive — only one modal can be open at a time.
### 5. Action wiring
`CodeReviewAction::OpenCommitDialog` now calls `self.open_commit_dialog(ctx)` instead of being a TODO stub. `CommitAndPush` and `CommitAndCreatePr` remain stubs for child branches.
### 6. Post-commit refresh
After commit (success or failure):
- `load_diffs_for_active_repo(false, ctx)` — reloads diffs
- `refresh_diff_metadata_for_current_repo(PromptRefresh)` — updates stats
- `refresh_pr_info(ctx)` — updates PR button state
## End-to-End Flow
```mermaid
graph TD
A[User clicks Commit button] --> B[open_commit_dialog]
B --> C[CommitDialog created + focused]
C --> D{User action}
D -->|Cancel/ESC| E[Dialog closes]
D -->|Confirm| F[CommitDialogEvent::Confirmed emitted]
F --> G[run_commit async]
G -->|success| H[Toast: 'Changes successfully committed']
G -->|failure| I[Toast: error message]
H --> J[Reload diffs + metadata + PR info]
I --> J
```
## Follow-ups
- Wire `CommitAndPush` intent (push-dialog branch)
- Wire `CommitAndCreatePr` intent (pr-dialog branch)
- Auto-generate commit message when left blank (AI integration)
- Per-file staging/unstaging in the changes panel
- Commit amend support