stak-git 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 memorypasta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/Makefile ADDED
@@ -0,0 +1,32 @@
1
+ PREFIX ?= /usr/local
2
+ BINDIR ?= $(PREFIX)/bin
3
+ ZSHDIR ?= $(PREFIX)/share/zsh/site-functions
4
+
5
+ .PHONY: install uninstall check-deps
6
+
7
+ install: check-deps
8
+ @echo "Installing stak..."
9
+ @mkdir -p $(BINDIR)
10
+ @mkdir -p $(ZSHDIR)
11
+ install -m 755 stak $(BINDIR)/stak
12
+ install -m 644 _stak $(ZSHDIR)/_stak
13
+ @echo ""
14
+ @echo "✓ Installed stak to $(BINDIR)/stak"
15
+ @echo "✓ Installed zsh completion to $(ZSHDIR)/_stak"
16
+ @echo ""
17
+ @echo "For interactive features, install fzf:"
18
+ @echo " brew install fzf # macOS"
19
+ @echo " apt install fzf # Debian/Ubuntu"
20
+ @echo " pacman -S fzf # Arch"
21
+ @echo ""
22
+ @echo "Or run: stak setup-interactive"
23
+
24
+ uninstall:
25
+ @echo "Uninstalling stak..."
26
+ rm -f $(BINDIR)/stak
27
+ rm -f $(ZSHDIR)/_stak
28
+ @echo "✓ Uninstalled"
29
+
30
+ check-deps:
31
+ @command -v git >/dev/null 2>&1 || { echo "Error: git is required"; exit 1; }
32
+ @echo "✓ git found"
package/README.md ADDED
@@ -0,0 +1,193 @@
1
+ # stak
2
+
3
+ Minimal stacked changes for git.
4
+
5
+ ## What is it?
6
+
7
+ Build big features as a chain of small, reviewable branches:
8
+
9
+ ```
10
+ main → auth-types → auth-service → auth-ui
11
+ ```
12
+
13
+ Each branch builds on the previous. Submit all for review at once. When you edit a lower branch, one command updates everything above.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ # Copy the script
19
+ sudo cp stak /usr/local/bin/stak
20
+
21
+ # Install zsh completions (optional)
22
+ sudo mkdir -p /usr/local/share/zsh/site-functions
23
+ sudo cp _stak /usr/local/share/zsh/site-functions/_stak
24
+ exec zsh
25
+ ```
26
+
27
+ ## Commands
28
+
29
+ | Command | Description |
30
+ |---------|-------------|
31
+ | `stak new <name>` | Create branch on top of current |
32
+ | `stak insert` | Insert branch at any position (fzf) |
33
+ | `stak split` | Split current branch's commits (fzf) |
34
+ | `stak up` / `down` | Move up or down the stack |
35
+ | `stak goto` | Jump to branch (fzf interactive) |
36
+ | `stak status` | Show the stack |
37
+ | `stak sync` | Rebase entire stack |
38
+ | `stak continue` | Continue after resolving conflicts |
39
+ | `stak abort` | Abort current rebase |
40
+ | `stak push` | Push branches (fzf multi-select) |
41
+ | `stak push -a` | Push all branches |
42
+ | `stak drop` | Remove top branch |
43
+ | `stak fold` | Fold branch (fzf interactive) |
44
+ | `stak fold --down` | Fold into child (non-interactive) |
45
+ | `stak land` | Clean up after PR merge |
46
+ | `stak log` | View commits (fzf interactive) |
47
+ | `stak log -a` | Show all branches |
48
+ | `stak ls` | List all stacks |
49
+ | `stak use` | Switch to stack (fzf interactive) |
50
+ | `stak use <name>` | Switch/create stack by name |
51
+ | `stak rm-stack` | Delete a stack (fzf interactive) |
52
+ | `stak setup-interactive` | Install fzf |
53
+
54
+ ### Disable Interactive Mode
55
+
56
+ ```bash
57
+ export STAK_NO_INTERACTIVE=1
58
+ stak push # pushes all without fzf prompt
59
+ ```
60
+
61
+ ## Basic Workflow
62
+
63
+ ```bash
64
+ git checkout main
65
+
66
+ # Build feature in parts
67
+ stak new auth-types
68
+ # ... commit ...
69
+
70
+ stak new auth-service
71
+ # ... commit ...
72
+
73
+ stak new auth-ui
74
+ # ... commit ...
75
+
76
+ # See the stack
77
+ stak status
78
+ # main
79
+ # auth-types (2 commits)
80
+ # auth-service (3 commits)
81
+ # → auth-ui (4 commits)
82
+
83
+ # Push all for review
84
+ stak push
85
+ ```
86
+
87
+ ## Editing a Lower Branch
88
+
89
+ ```bash
90
+ # Go back to fix something
91
+ stak down
92
+ stak down
93
+ # ... fix and commit ...
94
+
95
+ # Update everything above
96
+ stak sync
97
+
98
+ # Push updates
99
+ stak push
100
+ ```
101
+
102
+ ## Handling Conflicts
103
+
104
+ ```bash
105
+ stak sync
106
+ # Conflict in auth-service!
107
+
108
+ # Fix the conflict in your editor
109
+ git add .
110
+ stak continue # continues sync
111
+
112
+ # Or abort and try differently
113
+ stak abort
114
+ ```
115
+
116
+ ## Combining Branches
117
+
118
+ **Fold up** (into parent - keep parent's name):
119
+ ```bash
120
+ # Combine auth-service into auth-types
121
+ stak down # go to auth-service
122
+ stak fold # fold up into auth-types
123
+
124
+ # main
125
+ # → auth-types (combined)
126
+ # auth-ui
127
+ ```
128
+
129
+ **Fold down** (into child - keep child's name):
130
+ ```bash
131
+ # Combine auth-service into auth-ui
132
+ stak down # go to auth-service
133
+ stak fold --down # fold down into auth-ui
134
+
135
+ # main
136
+ # auth-types
137
+ # → auth-ui (combined)
138
+ ```
139
+
140
+ ## After PR Merges
141
+
142
+ ```bash
143
+ # auth-types PR merged to main
144
+ stak land # removes auth-types, rebases rest onto main
145
+
146
+ # Stack is now:
147
+ # main
148
+ # → auth-service
149
+ # auth-ui
150
+ ```
151
+
152
+ ## Multiple Stacks
153
+
154
+ Work on different features simultaneously:
155
+
156
+ ```bash
157
+ # Create stacks for different features
158
+ stak use auth-feature # creates & switches
159
+ stak new auth-types
160
+ stak new auth-service
161
+
162
+ stak use billing-feature # creates & switches
163
+ stak new billing-api
164
+ stak new billing-ui
165
+
166
+ # Switch between them
167
+ stak use auth-feature
168
+
169
+ # List all stacks
170
+ stak ls
171
+ # ● auth-feature (2 branches) ◀ current
172
+ # ○ billing-feature (2 branches)
173
+
174
+ # Delete when done
175
+ stak rm-stak billing-feature
176
+ ```
177
+
178
+ Each stak tracks its own chain of branches independently.
179
+
180
+ ## Philosophy
181
+
182
+ - **Minimal**: Only commands you need for stacked changes
183
+ - **Transparent**: Just git branches. Use git directly anytime.
184
+ - **No magic**: Stacks stored in `.git/stacks/`, one branch per line
185
+ - **Conflict-friendly**: Resolve normally, then `stak continue`
186
+
187
+ ## Tips
188
+
189
+ - Keep stacks shallow (2-3 branches). Deep stacks = more conflicts.
190
+ - Commit before running `sync`, `fold`, or `drop`.
191
+ - Use `stak status` often to see where you are.
192
+ - You can always use raw git commands - stak just helps manage the chain.
193
+ - Run `stak setup-interactive` to install fzf for interactive navigation.
package/_stak ADDED
@@ -0,0 +1,111 @@
1
+ #compdef stak
2
+
3
+ # Zsh completion for stak - stacked changes for git
4
+
5
+ _stak_commands() {
6
+ local commands=(
7
+ 'new:Create a new branch on top of current'
8
+ 'insert:Insert branch at any position'
9
+ 'split:Split current branch commits'
10
+ 'up:Move up the stack'
11
+ 'down:Move down the stack'
12
+ 'goto:Jump to any branch in the stack'
13
+ 'status:Show the current stack'
14
+ 'st:Show the current stack (alias)'
15
+ 'sync:Rebase entire stack'
16
+ 'continue:Continue after resolving conflicts'
17
+ 'abort:Abort current rebase'
18
+ 'push:Push branches to remote'
19
+ 'drop:Remove current branch from stack'
20
+ 'fold:Fold branch into parent or child'
21
+ 'land:Clean up after PR is merged'
22
+ 'log:Show commits in the stack'
23
+ 'ls:List all stacks'
24
+ 'use:Switch to stack (creates if needed)'
25
+ 'rm-stack:Delete a stack'
26
+ 'setup-interactive:Install fzf for interactive mode'
27
+ 'help:Show help'
28
+ )
29
+ _describe 'command' commands
30
+ }
31
+
32
+ _stak_names() {
33
+ local stacks_dir=".git/stacks"
34
+ if [[ -d "$stacks_dir" ]]; then
35
+ local stacks=(${(f)"$(ls $stacks_dir 2>/dev/null)"})
36
+ _describe 'stack' stacks
37
+ fi
38
+ }
39
+
40
+ _stak_branches() {
41
+ local current_stack_file=".git/stack-current"
42
+ local stacks_dir=".git/stacks"
43
+ local stack_name="default"
44
+
45
+ [[ -f "$current_stack_file" ]] && stack_name=$(cat "$current_stack_file")
46
+
47
+ local stack_file="$stacks_dir/$stack_name"
48
+ if [[ -f "$stack_file" ]]; then
49
+ local branches=(${(f)"$(cat $stack_file)"})
50
+ _describe 'branch' branches
51
+ fi
52
+ }
53
+
54
+ _stak() {
55
+ local curcontext="$curcontext" state line
56
+
57
+ _arguments -C \
58
+ '1: :_stak_commands' \
59
+ '*::arg:->args'
60
+
61
+ case $state in
62
+ args)
63
+ case $line[1] in
64
+ new)
65
+ _message 'branch name'
66
+ ;;
67
+ goto)
68
+ _alternative \
69
+ 'branches:branch:_stak_branches' \
70
+ 'numbers:position:(1 2 3 4 5 6 7 8 9 10)'
71
+ ;;
72
+ fold)
73
+ _arguments \
74
+ '--down[Fold into child branch]' \
75
+ '-d[Fold into child branch]'
76
+ ;;
77
+ push)
78
+ _arguments \
79
+ '--all[Push all branches]' \
80
+ '-a[Push all branches]'
81
+ ;;
82
+ log)
83
+ _alternative \
84
+ 'options:option:(--all -a)' \
85
+ 'branches:branch:_stak_branches'
86
+ ;;
87
+ land)
88
+ _arguments \
89
+ '--force[Force land for squash merges]' \
90
+ '-f[Force land for squash merges]'
91
+ ;;
92
+ use)
93
+ _stak_names
94
+ ;;
95
+ rm-stack)
96
+ _stak_names
97
+ ;;
98
+ insert)
99
+ _arguments \
100
+ '1:branch name:' \
101
+ '--after[Insert after branch]:branch:_stak_branches'
102
+ ;;
103
+ split)
104
+ _message 'new branch name'
105
+ ;;
106
+ esac
107
+ ;;
108
+ esac
109
+ }
110
+
111
+ _stak "$@"
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "stak-git",
3
+ "version": "1.0.0",
4
+ "description": "Minimal stacked changes for git - build big features as small branches",
5
+ "bin": {
6
+ "stak": "./stak"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/memorypasta/stak.git"
11
+ },
12
+ "keywords": [
13
+ "git",
14
+ "stacked-diffs",
15
+ "stacked-branches",
16
+ "code-review",
17
+ "workflow",
18
+ "cli"
19
+ ],
20
+ "author": "memorypasta",
21
+ "license": "MIT",
22
+ "bugs": {
23
+ "url": "https://github.com/memorypasta/stak/issues"
24
+ },
25
+ "homepage": "https://github.com/memorypasta/stak#readme",
26
+ "os": ["darwin", "linux"],
27
+ "engines": {
28
+ "node": ">=14"
29
+ }
30
+ }
31
+
@@ -0,0 +1,30 @@
1
+ # AUR PKGBUILD for stak
2
+ # Maintainer: memorypasta <memorypasta@gmail.com>
3
+
4
+ pkgname=stak
5
+ pkgver=1.0.0
6
+ pkgrel=1
7
+ pkgdesc="Minimal stacked changes for git - build big features as small branches"
8
+ arch=('any')
9
+ url="https://github.com/memorypasta/stak"
10
+ license=('MIT')
11
+ depends=('git' 'bash')
12
+ optdepends=('fzf: interactive branch selection')
13
+ source=("$pkgname-$pkgver.tar.gz::https://github.com/memorypasta/stak/archive/refs/tags/v$pkgver.tar.gz")
14
+ sha256sums=('82a137dc6cdd0ceaac5d803c9be7767b1f2bcfe81925a9d27fdfa9cf2ece5d75')
15
+
16
+ package() {
17
+ cd "$srcdir/stak-$pkgver"
18
+
19
+ # Install main script
20
+ install -Dm755 stak "$pkgdir/usr/bin/stak"
21
+
22
+ # Install zsh completion
23
+ install -Dm644 _stak "$pkgdir/usr/share/zsh/site-functions/_stak"
24
+
25
+ # Install license
26
+ install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
27
+
28
+ # Install docs
29
+ install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
30
+ }
@@ -0,0 +1,57 @@
1
+ #!/bin/bash
2
+ # Quick install script for stak
3
+ # Usage: curl -fsSL https://raw.githubusercontent.com/memorypasta/stak/main/packaging/install.sh | bash
4
+
5
+ set -e
6
+
7
+ REPO="memorypasta/stak"
8
+ INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
9
+ ZSH_COMPLETION_DIR="${ZSH_COMPLETION_DIR:-/usr/local/share/zsh/site-functions}"
10
+
11
+ echo "Installing stak..."
12
+ echo ""
13
+
14
+ # Check dependencies
15
+ if ! command -v git >/dev/null 2>&1; then
16
+ echo "Error: git is required but not installed."
17
+ exit 1
18
+ fi
19
+
20
+ # Download
21
+ TMPDIR=$(mktemp -d)
22
+ trap 'rm -rf "$TMPDIR"' EXIT
23
+
24
+ echo "Downloading..."
25
+ curl -fsSL "https://raw.githubusercontent.com/$REPO/main/stak" -o "$TMPDIR/stak"
26
+ curl -fsSL "https://raw.githubusercontent.com/$REPO/main/_stak" -o "$TMPDIR/_stak"
27
+
28
+ # Install (may need sudo)
29
+ echo "Installing to $INSTALL_DIR..."
30
+ if [ -w "$INSTALL_DIR" ]; then
31
+ install -m 755 "$TMPDIR/stak" "$INSTALL_DIR/stak"
32
+ else
33
+ sudo install -m 755 "$TMPDIR/stak" "$INSTALL_DIR/stak"
34
+ fi
35
+
36
+ # Install zsh completion
37
+ if [ -d "$ZSH_COMPLETION_DIR" ] || [ -w "$(dirname "$ZSH_COMPLETION_DIR")" ]; then
38
+ echo "Installing zsh completion..."
39
+ sudo mkdir -p "$ZSH_COMPLETION_DIR"
40
+ sudo install -m 644 "$TMPDIR/_stak" "$ZSH_COMPLETION_DIR/_stak"
41
+ fi
42
+
43
+ echo ""
44
+ echo "✓ stak installed successfully!"
45
+ echo ""
46
+ echo "Quick start:"
47
+ echo " cd your-repo"
48
+ echo " stak new feature-part1"
49
+ echo " stak help"
50
+ echo ""
51
+
52
+ # Check for fzf
53
+ if ! command -v fzf >/dev/null 2>&1; then
54
+ echo "Tip: Install fzf for interactive features:"
55
+ echo " stak setup-interactive"
56
+ echo ""
57
+ fi
package/pyproject.toml ADDED
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "stak-git"
7
+ version = "1.0.0"
8
+ description = "Minimal stacked changes for git - build big features as small branches"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ authors = [
12
+ { name = "memorypasta", email = "memorypasta@gmail.com" }
13
+ ]
14
+ keywords = ["git", "stacked-diffs", "stacked-branches", "code-review", "workflow", "cli"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: MacOS",
21
+ "Operating System :: POSIX :: Linux",
22
+ "Programming Language :: Unix Shell",
23
+ "Topic :: Software Development :: Version Control :: Git",
24
+ ]
25
+ requires-python = ">=3.8"
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/memorypasta/stak"
29
+ Repository = "https://github.com/memorypasta/stak"
30
+ Issues = "https://github.com/memorypasta/stak/issues"
31
+
32
+ [project.scripts]
33
+ stak = "stak_git:main"
34
+
35
+ [tool.hatch.build.targets.wheel]
36
+ packages = ["stak_git"]
37
+
38
+ [tool.hatch.build.targets.sdist]
39
+ include = ["stak_git", "stak", "_stak", "README.md", "LICENSE"]
40
+
41
+ [tool.hatch.build.targets.wheel.shared-data]
42
+ "stak" = "bin/stak"
43
+