@kitlangton/stack 0.1.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 +21 -0
- package/README.md +116 -0
- package/dist/cli.js +26796 -0
- package/package.json +56 -0
- package/skills/stack/skill.md +204 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kit Langton
|
|
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/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# stack
|
|
2
|
+
|
|
3
|
+
Squash-safe stacked PRs for GitHub repos that squash-merge and delete branches.
|
|
4
|
+
|
|
5
|
+
`stack` preserves stack intent locally, infers obvious relationships from PR
|
|
6
|
+
bases, and repairs descendants after each merge so open PRs keep their comments,
|
|
7
|
+
reviews, and context.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g @kitlangton/stack
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Install the agent skill too, so coding agents know the safe workflow:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx skills add kitlangton/stack --skill stack
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Example Workflow
|
|
22
|
+
|
|
23
|
+
An agent splits one cleanup into two PRs. The second PR is based on the first, so
|
|
24
|
+
GitHub knows the stack but Git will forget that relationship after squash merge.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
gh pr create --base dev --head cleanup/schema-source
|
|
28
|
+
gh pr create --base cleanup/schema-source --head cleanup/openapi-output
|
|
29
|
+
|
|
30
|
+
stack sync --dry-run
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The preview shows what `stack` will infer and update:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
→ fetch origin --prune
|
|
37
|
+
→ inspect open PRs and local refs
|
|
38
|
+
→ reconcile local stack metadata
|
|
39
|
+
→ infer PR-base stack links
|
|
40
|
+
→ preview repairs
|
|
41
|
+
→ preview stack block updates
|
|
42
|
+
infer link: cleanup/schema-source -> dev @ abc123
|
|
43
|
+
infer link: cleanup/openapi-output -> cleanup/schema-source @ def456
|
|
44
|
+
would update PR body: #101 Stack block
|
|
45
|
+
would update PR body: #102 Stack block
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then sync it:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
stack sync
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`stack sync` records the inferred links, refreshes each PR body, and prints the
|
|
55
|
+
local stack:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
dev
|
|
59
|
+
└─ cleanup/schema-source
|
|
60
|
+
PR: #101
|
|
61
|
+
└─ cleanup/openapi-output 👈 current
|
|
62
|
+
PR: #102
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Each PR gets a compact GitHub-native stack block:
|
|
66
|
+
|
|
67
|
+
```md
|
|
68
|
+
### Stack
|
|
69
|
+
|
|
70
|
+
1. #101
|
|
71
|
+
2. **#102** 👈 current
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
When the first PR is ready, the agent previews and merges the root:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
stack merge
|
|
78
|
+
stack merge --apply
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Before merging, `stack` retargets child PRs away from the root branch. That keeps
|
|
82
|
+
GitHub auto-delete from closing descendants, then `stack` rebases/pushes the
|
|
83
|
+
remaining branches and refreshes stack blocks.
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
→ retarget #102 (cleanup/openapi-output) to dev before merge
|
|
87
|
+
→ merge #101 (cleanup/schema-source)
|
|
88
|
+
→ rebase cleanup/openapi-output onto dev
|
|
89
|
+
→ push cleanup/openapi-output
|
|
90
|
+
→ update #102 stack block
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The child PR keeps its comments and reviews. Its stack block becomes history plus
|
|
94
|
+
the current PR:
|
|
95
|
+
|
|
96
|
+
```md
|
|
97
|
+
### Stack
|
|
98
|
+
|
|
99
|
+
1. #101
|
|
100
|
+
2. **#102** 👈 current
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Commands
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
stack status # local tracked stack, no GitHub API call
|
|
107
|
+
stack sync --dry-run # preview GitHub PR-base inference and repairs
|
|
108
|
+
stack sync # record inferred links, repair, and refresh PR bodies
|
|
109
|
+
stack merge # dry-run the next root merge
|
|
110
|
+
stack merge --apply # merge root and repair descendants
|
|
111
|
+
stack merge --auto # wait for GitHub requirements, then merge and repair
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Do not run `stack track` defensively when PR bases are already correct. Use it
|
|
115
|
+
only when GitHub PR bases do not encode the stack or when correcting explicit
|
|
116
|
+
local metadata.
|