PHPackages                             sugarcraft/sugar-stash - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. sugarcraft/sugar-stash

ActiveProject[CLI &amp; Console](/categories/cli)

sugarcraft/sugar-stash
======================

Terminal Git client — port of jesseduffield/lazygit on the SugarCraft stack.

00PHPCI failing

Since Jul 1Pushed 3w agoCompare

[ Source](https://github.com/sugarcraft/sugar-stash)[ Packagist](https://packagist.org/packages/sugarcraft/sugar-stash)[ RSS](/packages/sugarcraft-sugar-stash/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![sugar-stash](.assets/icon.png)](.assets/icon.png)

SugarStash
==========

[](#sugarstash)

[![CI](https://github.com/detain/sugarcraft/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/detain/sugarcraft/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/244faab7756693ca6b3d1fe563865ec88c38e8a205f5b1deeaee089665a4e071/68747470733a2f2f636f6465636f762e696f2f67682f64657461696e2f737567617263726166742f6272616e63682f6d61737465722f67726170682f62616467652e7376673f666c61673d73756761722d7374617368)](https://app.codecov.io/gh/detain/sugarcraft?flags%5B0%5D=sugar-stash)[![Packagist Version](https://camo.githubusercontent.com/8eb9762d20dd5c66575e8216394d76afe436e5b2183be96ee0bc71ebb42c15bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737567617263726166742f73756761722d73746173683f6c6162656c3d7061636b6167697374)](https://packagist.org/packages/sugarcraft/sugar-stash)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/e78ffc83837c0d12647811a7fd1910c3cbeae04988de94bb4fd5b67e0874696a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d254532253839254135382e312d3838393262662e737667)](https://www.php.net/)

[![demo](.vhs/play.gif)](.vhs/play.gif)

Three-pane git TUI on the SugarCraft stack — port of [`jesseduffield/lazygit`](https://github.com/jesseduffield/lazygit). Status / branches / log laid out side-by-side, single-key stage / unstage, refresh, and ahead/behind branch summary.

```
composer require sugarcraft/sugar-stash
sugar-stash    # run inside any git working tree
```

Keys
----

[](#keys)

KeyAction`Tab`Cycle pane focus`↑/↓` or `k/j`Move cursor in active pane`s` (status pane)Stage / unstage the highlighted entry`a` (status pane)Stage all files`d` (status pane)Discard changes to the highlighted file`P` (status pane)Open diff viewer for the highlighted file`Space` (branches pane)Checkout branch`c`Commit (type message, Enter to confirm, Esc to cancel)`A`Amend last commit`n`Create and switch to a new branch`u`Undo last operation`Ctrl+r`Redo last undone operation`D` (branches pane)Delete the selected branch`M`Merge selected branch into current`r`Open rebase menu (continue / abort / skip / cancel)`S`Open stash manager (list / apply / drop)`V`Cherry-pick — type a commit ref and press Enter`w` (branches pane)Open worktrees manager (list / add / remove)`i`Interactive rebase — select N commits, set actions`R`Refresh from disk`?`Context-sensitive help`q` / `Esc`Quit### Diff viewer keys

[](#diff-viewer-keys)

KeyAction`Space`Stage current hunk`↑/↓` or `k/j`Navigate between hunks`Esc`Close diff viewerArchitecture
------------

[](#architecture)

FileRole`Git`Concrete `git` shell-out — `status --porcelain=v1 -b`, `for-each-ref`, `log --pretty=format:…`, `add`, `restore --staged`. Throws `RuntimeException` on non-zero exit.`GitDriver`Interface for all git operations. Tests inject a fixture-backed driver so transition correctness is asserted without staging a real repo.`Pane`Enum — `Status`, `Branches`, `Log` — with `next()` for Tab cycling.`App` (Model)Owns the three lists + cursors + focus + overlays (stash/cherry-pick/worktrees/interactive-rebase). Pure-state — every key returns a fresh App.`Renderer`Pure view function — three `Style::border(rounded)` panes joined horizontally / vertically; the focused pane gets a brighter accent.`StashEntry`Immutable stash entry — `index`, `sha`, `branch`, `message` + `stashRef()` / `displayLine()`.`StashManager`Immutable stash list state — `stashes`, `cursor`, `withCursor()`, `withStashes()`, `current()`, `count()`.`CherryPick`Immutable cherry-pick state — `collecting` flag + `commitRef` accumulator + `withChar()`/`cancel()`.`WorktreeEntry`Immutable worktree entry — `path`, `branch`, `isBare`, `HEAD`.`Worktrees`Immutable worktree manager state — `worktrees`, `cursor`, `adding`/`removing` modes + path/branch collection.`RebaseAction`Enum — `Pick`, `Reword`, `Edit`, `Squash`, `Drop`.`RebaseCommit`Immutable rebase todo entry — `sha`, `subject`, `action` + `withAction()` / `displayLine()`.`InteractiveRebase`Immutable interactive-rebase state — `commits` todo list, `cursor`, `selectingN`/`countInput`, `cycleAction()`, `dropCurrent()`.`SugarStash` shells out to `git` directly via the system, so users keep their existing aliases, hooks, and signing config.

**Note:** All git operations are synchronous and block the event loop. This is by design for v1 — a TTY application naturally runs synchronously at the terminal. Async git operations are planned for v2 (see `GitDriver` interface for deprecation notes).

Internationalization
--------------------

[](#internationalization)

User-facing strings are internationalized via `SugarCraft\Stash\Lang::t()`. All translatable strings live in `lang/en.php` under the `'stash'` namespace.

**Available keys** (`lang/en.php`):

KeyDefault stringParameters`git.spawn_failed``git: failed to spawn`—`git.error``git: {stderr}``{stderr}``cli.not_a_repo``sugar-stash: not a git repository (no .git in {cwd})``{cwd}``ui.error_prefix``error: `—`status.clean``clean working tree`—`branches.empty``(no branches)`—`log.empty``(empty log)`—`help.keyhints``tab  switch pane  ·  j/k  move  ·  s  stage/unstage  ·  R  refresh  ·  q  quit`—To add a locale, copy `lang/en.php` to `lang/.php` and translate the values. The lookup chain follows `SugarCraft\Core\I18n\T`: exact locale → base language → `en` → raw key.

**Using the facade:**

```
use SugarCraft\Stash\Lang;

$msg = Lang::t('status.clean');                 // 'clean working tree'
$hint = Lang::t('help.keyhints');               // 'tab  switch pane  ·  ...'
$err = Lang::t('ui.error_prefix') . $error;     // 'error: '
```

**Adding new translatable strings:**

```
// In any source file:
use SugarCraft\Stash\Lang;

// Simple key:
$msg = Lang::t('status.clean');

// With placeholder:
$msg = Lang::t('git.error', ['stderr' => $stderr]);
```

Demos
-----

[](#demos)

### Staging workflow

[](#staging-workflow)

[![stage](.vhs/stage.gif)](.vhs/stage.gif)

Shared foundations
------------------

[](#shared-foundations)

sugar-stash uses [candy-fuzzy](https://github.com/detain/sugarcraft#candy-fuzzy) for Smith-Waterman scored matching infrastructure, laying the groundwork for future fuzzy stash search.

Test
----

[](#test)

```
composer install
vendor/bin/phpunit
```

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance62

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1036e0717211b8030b83cbe729e8ba6ba442fdbd5285fb97a39d7dcfe339342?d=identicon)[detain](/maintainers/detain)

---

Top Contributors

[![detain](https://avatars.githubusercontent.com/u/1364504?v=4)](https://github.com/detain "detain (98 commits)")

---

Tags

candycorecomposerphpsugarcraftterminaltui

### Embed Badge

![Health badge](/badges/sugarcraft-sugar-stash/health.svg)

```
[![Health](https://phpackages.com/badges/sugarcraft-sugar-stash/health.svg)](https://phpackages.com/packages/sugarcraft-sugar-stash)
```

###  Alternatives

[illuminate/console

The Illuminate Console package.

13046.0M6.8k](/packages/illuminate-console)[styleci/cli

The CLI tool for StyleCI

71470.5k9](/packages/styleci-cli)[winbox/args

Windows command-line formatter

20720.9k21](/packages/winbox-args)[mallardduck/laravel-traits

A collection of useful Laravel snippets in the form of easy to use traits.

136.2k2](/packages/mallardduck-laravel-traits)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
