surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| @@ -2,29 +2,40 @@ | ||
| 2 | 2 | |
| 3 | 3 | The diff pane as a plugin: `/diff` opens the session's uncommitted changes |
| 4 | 4 | beside the transcript, one row per changed file and every file's hunks |
| 5 | -beneath, a row's click scrolling to its file, and closes it again; each | |
| 6 | -toggle leaves `Diff panel shown` or `Diff panel hidden` in the transcript. | |
| 7 | -The pane refreshes as Claude edits, runs shell commands and finishes turns, | |
| 8 | -and while it is open it polls the repository's HEAD so a commit or checkout | |
| 9 | -made elsewhere shows too. The first successful edit of a session opens the | |
| 10 | -pane by itself where the terminal is wide enough (144 columns when the | |
| 11 | -person never chose, 110 when they kept it open before; a person who closed | |
| 12 | -it is left alone). On a terminal under 110 columns `/diff` answers with the | |
| 13 | -built-in's line asking for a wider terminal and opens nothing; a pane the | |
| 14 | -surface seats inline on a terminal that wide shows only that line, and on a | |
| 15 | -wider one (a session without the fullscreen layout) the built-in dialog's | |
| 16 | -layout: the rows round the selected file and that file's hunks. A file's | |
| 17 | -ask button arms that file: its hunks ride the next prompt as context, once. | |
| 5 | +beneath, and closes it again; each toggle leaves `Diff panel shown` or | |
| 6 | +`Diff panel hidden` in the transcript. The header, the file list and its | |
| 7 | +toggles stay put while the wheel moves the hunks under them three rows a | |
| 8 | +tick (the plugin answers the pane's `ui.scroll` itself); a row's click puts | |
| 9 | +that file's hunks at the top; past eight rows the list scrolls under the | |
| 10 | +built-in's list keys (`ctrl+up`/`ctrl+down`, `opt+up`/`opt+down`), and | |
| 11 | +`ctrl+x b` moves the comparison base on, as the built-in's chord does: both | |
| 12 | +through Buttons that declare the engine's own actions. The pane refreshes | |
| 13 | +as Claude edits, runs shell commands and finishes turns, and while it is | |
| 14 | +open it polls the repository's HEAD so a commit or checkout made elsewhere | |
| 15 | +shows too. The first successful edit of a session opens the pane by itself | |
| 16 | +where the terminal is wide enough (144 columns when the person never chose, | |
| 17 | +110 when they kept it open before; a person who closed it is left alone). | |
| 18 | 18 | |
| 19 | +Under the fullscreen layout a terminal under 110 columns gets the | |
| 20 | +built-in's line asking for a wider one and nothing opens. Without that | |
| 21 | +layout (`CLAUDE_CODE_NO_FLICKER=0`, which `/diff` learns from the command's | |
| 22 | +`presentation`) the pane opens inline at any width, focused, in the | |
| 23 | +built-in dialog's shape: the title, the count, the file rows, the key | |
| 24 | +hints; the arrows walk the rows, Enter shows that file's hunks alone, | |
| 25 | +Escape backs out to the list and then closes, leaving `Diff dialog | |
| 26 | +dismissed`; toasts are held while it is up. A file's ask button arms that | |
| 27 | +file: its hunks ride the next prompt as context, once. | |
| 28 | + | |
| 19 | 29 | The pane compares the working tree against HEAD, split at the session's |
| 20 | 30 | start (the default), against HEAD plainly, or against the merge-base with |
| 21 | -the default branch; the choice is kept per repository in the plugin's | |
| 22 | -store. A second picker shows one earlier turn's edits instead of the | |
| 23 | -working tree, read from the session's messages. Files that changed before | |
| 24 | -the session started (by their timestamp, among the paths already dirty at | |
| 25 | -the start), and noise (lockfiles, generated and test files), are listed | |
| 26 | -apart and folded until asked for; a rename lists as git prints it. Outside | |
| 27 | -a git repository `/diff` says so and does nothing else. | |
| 31 | +the default branch; the base line under the header names a base other than | |
| 32 | +the session's, and the choice is kept per repository in the plugin's store. | |
| 33 | +A picker shows one earlier turn's edits instead of the working tree, read | |
| 34 | +from the session's messages. Files that changed before the session started | |
| 35 | +(by their timestamp, among the paths already dirty at the start), and noise | |
| 36 | +(lockfiles, generated and test files), are listed apart and folded until | |
| 37 | +asked for; a rename lists as git prints it. Outside a git repository | |
| 38 | +`/diff` says so and does nothing else. | |
| 28 | 39 | |
| 29 | 40 | `hooks/register.ts` is the module; everything under `hooks/` is its parts. |
| 30 | 41 | |
| @@ -34,9 +45,10 @@ | ||
| 34 | 45 | | --- | --- | |
| 35 | 46 | | `session.start` | Binds the engine once, registers `/diff` (a session where another `/diff` is listed leaves the plugin idle), and pins the repository. | |
| 36 | 47 | | `ui.render` of `PromptHint` | Reads the terminal's width, which decides whether the first edit opens the pane. | |
| 37 | -| `ui.render` of `Pane` | Draws the pane: header, the base and source pickers, the file list, the toggles, and the files' hunks. | | |
| 38 | -| `command.run` of `diff` | Opens or closes the pane, says which, and remembers the choice. | | |
| 39 | -| `ui.close` of the pane | Remembers the person's close as `/diff`'s. | | |
| 48 | +| `ui.render` of `Pane` | Draws the pane: docked, the header, base line, source picker, file list and toggles over the window of hunks; inline, the dialog. | | |
| 49 | +| `command.run` of `diff` | Opens or closes the pane (focused and closing on Escape without the fullscreen layout), says which, and remembers the choice. | | |
| 50 | +| `ui.close` of the pane | Backs out of the dialog's detail view instead of closing; else remembers the person's close as `/diff`'s. | | |
| 51 | +| `ui.scroll` of the pane | Docked, moves the hunks under the pinned header and list (three rows a wheel tick, a page a page key) and keeps the engine's window still. | | |
| 40 | 52 | | `command.run` of `clear`, `resume` | Closes the pane and forgets the session's state. | |
| 41 | 53 | | `tool.call` of `Edit`, `Write`, `NotebookEdit` | After the edit, refreshes an open pane; the session's first successful edit opens it. | |
| 42 | 54 | | `tool.call` of `Bash`, `PowerShell` | After the command, refreshes an open pane. | |
| @@ -48,7 +60,7 @@ | ||
| 48 | 60 | `clock.after`, `clock.every`, `clock.now`, `command.register`, `fs.list`, |
| 49 | 61 | `fs.read`, `fs.stat`, `process.run` (git, read-only), `session.messages`, |
| 50 | 62 | `store.get`, `store.set`, `telemetry.log`, `telemetry.mark`, `ui.close`, |
| 51 | -`ui.invalidate`, `ui.log`, `ui.open`, `ui.resolve`, `ui.scroll`, `ui.status`. | |
| 63 | +`ui.invalidate`, `ui.log`, `ui.open`, `ui.resolve`, `ui.status`. | |
| 52 | 64 | |
| 53 | 65 | `$.telemetry` is the telemetry plugin's noun; where it is absent the rows |
| 54 | 66 | are dropped and nothing else changes. |