# Git Dash A Herdr app mod. It is a side panel (or a tab) that shows the pending work of every Git repository under one or more base folders: unpushed commits, staged, modified and new files, stash, conflicts, operations in progress and merged branches that were not deleted. It lists the repositories that need attention first. No preview image ships with this recipe: a real screenshot would show private repository names. ## What you see A card with a 1 px border, 10 px radius and the theme `background`, filling its block. From top to bottom: 1. **Header**, 40 px high. A `repos.svg` icon in `accent`, the title **Git Dash** in semibold, in `dim` (11 px, truncated) the name of the only base folder or `N folders`, and 3 square 28 px icon buttons: Fetch (`download.svg`), Folder (`folder.svg`) and Refresh (`refresh.svg`). Fetch and Folder have an accent wash when they are on (Folder: while the folders view shows). Refresh shows an accent `spinner.svg` while it works. 2. **Summary line**, 11 px, `dim`: `111 repositories · 5 with pending` on the left; on the right `N folder(s) not found` in `blocked` (only when a base folder cannot be read; a click shows the folders view), then `Scanning folders…`, then `Analyzing 22/111` in `accent`, then `Updated 3m ago`. 3. **Filter box**, 34 px, `raised` background, with a magnifier, the typed text and a clear button. The right side shows `shown/total` while text is typed. 4. **Chips**, wrapping: **Pending** (yellow dot), **Clean** (green dot), **Errors** (red dot, only when there are errors) and **All**. Each chip has a count badge. **Pending** is on at start. 5. **List**, scrolling, with a 1 px top border. Each repository is a card with a 1 px bottom border: - Row 1: an 8 px dot colored by severity, the path of the repository relative to its base folder (13 px semibold, truncated), and a `▸` or `▾` when it has changed files. With 2 or more base folders, the path starts with the name of the base folder (`Projetos/api`; the folder itself shows only that name). When 2 base folders have the same last part, the name is the last 2 parts (`D:/Projetos`). - Row 2, indented 16 px, wrapping 20 px pills: the branch (`branch.svg`, monospace), a neutral `worktree` pill when the folder is a linked worktree, then `merge in progress` (and `rebase`, `cherry-pick`, `revert`, `bisect`) and `N conflicts` and `N unpushed` in red, `N staged` in green, `N modified` in yellow, `N new` in cyan, `N stash` in magenta, `↓N behind` in blue, `N merged` (`branch.svg`) in blue. - Row 3, 11 px `dim`, only when needed: notes joined by ` · `: `No remote`, `Branch has no upstream`, `Upstream branch was removed`, `Detached HEAD with N unpushed commit(s)`, `↑N ahead of upstream`, `Other branches: x (2), y (1)`, `Fetch failed`. - Expanded: up to 12 rows of `state path` (state in monospace: `UU` red, `??` cyan, a staged code green, an unstaged code yellow) and `… N more file(s)`. - Expanded, below the files, the **fix area** (indented 16 px, clicks stop there so the card stays open): - `Resolve by hand: …` in yellow (11 px), when `fixes(r).manual` is not empty. - A row of 24 px buttons (`smallButton`): the safe fixes in accent (**Commit**, **Push**, **Pull**, **Publish to origin**), then **Terminal** (`terminal.svg`), **New space** and **Git** (`branch.svg`; only while the `git-client` mod is on). - When the repository has merged branches: a 1 px top border, the line `Merged into origin/main, not deleted:` (11 px `dim`) with a red **Delete all N** button on the right (only for 2 or more), then 2 lines per branch. Line 1 (22 px): `branch.svg` in blue, the name in monospace, an accent `current` pill for the checked-out branch, a neutral `worktree` pill for the branch of a linked worktree. Line 2 (24 px, indented 19 px): `local` or `local + origin` in `dim`, and on the right a red **Delete** button (**Remove worktree** for a worktree branch; its tooltip names the worktree folder). When the delete must wait, the row shows the reason in yellow instead of the button: `finish the operation first`, `commit or stash the changes first`, `the worktree is locked` or `close the terminals in this folder first`. - After a click on Push, Pull, Publish or a delete: a `raised` box with `Run this command?`, the commands in monospace and **Run** / **Cancel**. **Run** is red for a delete. - After a click on Commit: a `raised` box with a message input, 1 to 3 mode buttons (**Staged only**, **Tracked files**, **All, with new files**; the last one red with a warning line), the commands in monospace and **Commit** / **Cancel**. - While a fix runs: a spinner and `Push · Running…`. - The result: a green `Done.` or a red `Failed.` box with the last 4 output lines, and **Run in terminal** on a failure. 6. **Empty states**: no folder: a tile with the icon, the title *Choose a folder with your repositories*, a hint and a primary **Choose folder** button. No repository in the folders, or an error (no base folder can be read): the message, the folders (native slashes, `~` for home, joined by `, `), a primary **Add folder…** button and a **Folders** button. 7. **Folders view** (the Folder button, or the `folders` command), in place of rows 2 to 6: the title `Repository folders` (13 px semibold) and `Git Dash looks for Git repositories in each folder, up to 4 levels deep.` (11 px `dim`), then, with a 1 px top border, one 40 px row per base folder with a 1 px bottom border: `folder.svg` (15 px, `accent`, or `blocked` when the folder cannot be read, with the error as tooltip), the path (12 px, native slashes, `~` for home, truncated), a pill `12 repos` (`…` while the search runs) or `not found` in `blocked`, and a 28 px `trash.svg` icon button. Below: a primary **Add folder…** button and **Back to the list** (only with 1 or more folders). Severity (dot color and sort order, highest first): 5 conflicts or an operation (red), 4 unpushed commits (red), 3 staged or modified (yellow), 2 new files only (cyan), 1 stash or merged branches only (magenta), 0 clean (green). An error repository has a red dot, shows its error line and no pills. Ties sort by path. 8. **Tabs**, under the header (not in the folders view): 2 `filterChip`s, **Repositories** (the number of cards) and **Worktrees** (the number of worktrees, `…` before the first read). The Worktrees tab replaces rows 2 to 6. 9. **Worktrees tab** (`wt-view.js`, data in `wt.js`): the summary `N worktrees in M repositories` and the run state, a filter box, the chips **All**, **Merged** (blue), **Changes** (yellow), **Old** (magenta) and **Missing** (red) (a chip with 0 shows only while it is on), then the list. 1 header row (30 px, `raised`) for each repository: `repos.svg`, the name, ` ·
` in `dim`, and a count pill. Then 1 row for each worktree: a dot (red: folder missing, an error or conflicts; yellow: changes; blue: merged; green: other), `branch.svg`, the branch in monospace (`detached` when there is none), `▸`/`▾`; the folder in `dim`; the pills of the README. A click shows the action area: **Open**, **Terminal**, **Git** (only while `git-client` is on), the actions that are ready, and a yellow line `: ` for each action that must wait. An action shows a `raised` box with `Run these steps?`, a red warning line when needed, the steps in monospace and **Run** / **Cancel**. Then a spinner, then a `Done.` or `Failed.` box with **Open a terminal** for a failed program step. ## How it behaves - Start: the base folders are `shared("git-dash.roots")`, one list for every copy of the panel: an array of paths with forward slashes, no trailing slash (except a drive root such as `D:/`), no duplicates (compared with `samePath`). When the key is not an array (it was never saved), the mod builds it once from the folder of older versions, `shared("git-dash.root:")` for a copy with a `root` prop, else `shared("git-dash.root")`, else the `root` prop, and saves it. The old keys are never written. A saved empty list stays empty. With no folder, the panel shows the empty state. Fetch is a getter: `shared("git-dash.fetch")` when it is a boolean, else the `fetch` prop, else off; the Download button writes the key. The language is a getter too: `shared("herdr-mods.lang")` (`en` or `pt`, set in the mods-hub), else the `lang` prop, else `en`. Do not assign `this.lang` or `this.fetch`. The placeholders made in `init` keep the language of the start. - The mod finds the repositories of all base folders at the same time (one `findRepos` per folder), then analyzes 12 at a time. A folder that cannot be read goes in `rootErrors` and does not stop the others; only when every folder fails does the panel show the error. A repository that two base folders hold (one folder inside the other) shows once, under the first folder. Each result keeps its `root`. Cards appear while the run goes on. On a refresh the old cards stay until their new data arrives; repositories that vanished are removed at the end. - **Add folder…** opens `pickFolder`. A folder that is in the list already shows an `info` toast. A new folder is added at the end, the list is saved with `setShared`, the cards are cleared and a run starts. A run of the old list that ends later is ignored (a generation counter). - The trash button removes a folder and saves the list. While no run is active, only the cards of that folder go away, with no new search. During a run, the cards are cleared and a run starts. - A 1 s timer compares `shared("git-dash.roots")` with the list of this copy. When another copy (or the mods-hub) changed it, the copy takes the new list, clears the cards and starts a run. - Commands (`nextCommand()`): `folders` shows the folders view, `list` shows the repositories, `worktrees` shows the Worktrees tab, `refresh` reads the shown tab again. - **Refresh** does nothing while a run is active. A 30 s timer re-renders the *Updated* age, and marks a silent run as due when the data is 5 minutes old. `render()` starts the due run. Herdr does not draw a hidden copy, so a hidden panel runs no `git` and refreshes when it shows again. - A card with changed files, a fix, a pending item, an error or a fix result toggles on click. A clean card does nothing. - **Fixes** (`fixes(r)` in `git.js`) split into `auto` and `manual`. Conflicts, an operation or a detached HEAD block all `auto` fixes. Otherwise: dirty files give `commit`; with an upstream, ahead only gives `push`, behind only gives `pull` (`--ff-only`), ahead and behind is `diverged` (manual); an upstream that is gone is manual, unless the checked-out branch is in the merged list (its delete is the fix); no upstream with commits on the branch gives `publish` to `origin` (or the only remote). No remote, stash and other branches with commits are manual. - **Merged branches** (`fixes(r).merged`, one entry per branch with `fix` or `blocked`): a conflict or an operation blocks every delete (`busy`); staged or modified files block the delete of the checked-out branch (`dirty`). For the branch of a linked worktree: a locked worktree gives `locked`, staged, modified or new files in it give `dirty`, and a Herdr terminal whose `panes()[i].cwd` is the worktree folder or inside it gives `inUse`. Each fix has `cwd` (the main worktree when the card is a linked worktree, else null) and `removes` (the worktree folders that its `worktree remove` step removes; empty for a prunable worktree, which has no card). **Delete all N** runs the steps of every branch that is not blocked, one branch after the other, the checked-out branch last. - Only one card at a time asks (`this.ask`). The commit mode starts at *staged* when something is staged, else *tracked*, else *all*. An empty message does not commit. - A fix runs with `runSteps` (`exec("git", ...)` in `fix.cwd` or the card folder, one step after the other, stop at the first failure; `done` counts the steps that ended well), then `refreshOne` reads the repository again: `findRepos(path, 0)` for its operations, then `analyze`. When a `worktree` step ended well (`removedBy`), the cards of the removed folders go away. When the card itself was removed, `notify` shows `Worktree removed` (success) or `Worktree removed, but a later step failed` (warning, with the Git output), and the card of the main worktree is read again. - **Terminal** runs `tab.new {name, folder, argv: ["git","status"]}`; **New space** runs `space.new` with the same arguments. **Run in terminal** uses `argv: ["git", ...failedStep]`. The shell stays open after the command. Then `refreshOne` runs after 20 s, 90 s and 5 min. - **Git** opens the repository in the Git panel (`git-client`), which follows the focused terminal. 1) A terminal of a local space whose `cwd` is in the repository (and not in a nested repository of the list) gets `space.select` and `pane.focus {pane}`; the active space comes first. 2) Else `tab.new {name, space: , folder}`, or `space.new {name, folder}` when there is no space; the new terminal (found by comparing `panes()` before and after) gets `pane.focus {terminal}`. 3) Then the bar opens the Changes panel: `kanban.panel-changes` when a block shows `kanban`, else `tabs-dock.changes`, unless the Changes panel already shows in the side panel. A layout without a `changes` block in `panel-body` gets a dialog: `openOverlay({mod: "git-client", props: {folder}, kind: "dialog"})`. - Languages: `en` and `pt` dictionaries in `main.js`. ## Built from Files in `mods/git-dash/`: `mod.json` (`{ "place": "none" }`, written first), `main.js` (the `View`), `git.js` (search and analysis), `ui.js` (pills, chips, buttons, small card buttons, search box) and the icons `repos`, `refresh`, `folder`, `download`, `search`, `close`, `branch`, `spinner`, `terminal`, `trash` (`.svg`, 24 px, stroke `currentColor`). - **Search** (`findRepos`): runs `pwsh -NoProfile -NonInteractive -Command