pi-graphite 0.3.4 → 0.4.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/README.md +12 -9
- package/package.json +1 -1
- package/skills/graphite/SKILL.md +11 -11
- package/src/index.ts +5 -5
- package/src/tools/submit.ts +5 -5
package/README.md
CHANGED
|
@@ -5,12 +5,15 @@ Opinionated pi tools + skill that wrap the [Graphite](https://graphite.com)
|
|
|
5
5
|
|
|
6
6
|
```
|
|
7
7
|
graphite_status → (graphite_setup if needed) → graphite_sync → graphite_navigate
|
|
8
|
-
→ graphite_change →
|
|
8
|
+
→ graphite_change → graphite_submit (dry-run) → graphite_submit (apply)
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
The extension wraps `gt` only. It deliberately does **not** call `gh`, edit
|
|
12
|
-
titles/bodies, fetch review comments, or perform stack surgery
|
|
13
|
-
|
|
11
|
+
The extension wraps `gt` only. It deliberately does **not** call `gh`, edit
|
|
12
|
+
PR titles/bodies, fetch review comments, or perform stack surgery (split /
|
|
13
|
+
fold / move / squash / reorder). For those flows, run the underlying `gt`
|
|
14
|
+
or `gh` command yourself in your own terminal; the agent should not invoke
|
|
15
|
+
them from bash, as their defaults open interactive prompts, hunk pickers,
|
|
16
|
+
or editors that will hang non-interactive sessions.
|
|
14
17
|
|
|
15
18
|
## Requirements
|
|
16
19
|
|
|
@@ -45,7 +48,7 @@ agent loads it on demand.
|
|
|
45
48
|
| `graphite_sync` | Start-of-day / after-merge cleanup + restack | `gt sync` |
|
|
46
49
|
| `graphite_navigate` | Move around the stack | `gt checkout`, `gt up`/`down`/`top`/`bottom` |
|
|
47
50
|
| `graphite_change` | Create / amend a stacked branch | `gt create -am`, `gt modify -am`, `gt modify --into`, `gt absorb` |
|
|
48
|
-
| `
|
|
51
|
+
| `graphite_submit` | Push the entire stack and open/update PRs (dry-run by default) | `gt submit --stack --no-edit --no-ai` |
|
|
49
52
|
| `graphite_recover` | Continue / abort / undo | `gt continue`, `gt abort`, `gt undo` |
|
|
50
53
|
|
|
51
54
|
## Golden path
|
|
@@ -57,14 +60,14 @@ graphite_sync # at session start, or after merges
|
|
|
57
60
|
graphite_navigate action=checkout branch=… # move to the target PR / parent
|
|
58
61
|
# user edits files
|
|
59
62
|
graphite_change action=create message="…" # or action=amend
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
graphite_submit apply=false # review the dry-run plan
|
|
64
|
+
graphite_submit apply=true confirmRemote=true
|
|
62
65
|
```
|
|
63
66
|
|
|
64
67
|
Conflict path:
|
|
65
68
|
|
|
66
69
|
```text
|
|
67
|
-
# resolve files, git add
|
|
70
|
+
# resolve files, then: git add -- <paths>
|
|
68
71
|
graphite_recover action=continue
|
|
69
72
|
```
|
|
70
73
|
|
|
@@ -83,7 +86,7 @@ dependent branches.
|
|
|
83
86
|
- `graphite_setup action=track_branch` requires explicit `branch`, explicit
|
|
84
87
|
`parent`, and `confirmParent:true`; do not guess parent if unclear.
|
|
85
88
|
- `graphite_setup action=init_repo reset:true` needs `confirmDestructive:true`.
|
|
86
|
-
- `
|
|
89
|
+
- `graphite_submit` defaults to `--dry-run`; `apply:true` also needs
|
|
87
90
|
`confirmRemote:true`. `--force` push also requires `confirmRemote:true`.
|
|
88
91
|
- `graphite_sync` with `force` or `deleteAll` needs `confirmDestructive:true`.
|
|
89
92
|
- `graphite_recover action=continue` refuses to proceed if tracked files
|
package/package.json
CHANGED
package/skills/graphite/SKILL.md
CHANGED
|
@@ -42,7 +42,7 @@ The extension registers seven tools. Prefer them over `gt`/`git`/`gh` in bash.
|
|
|
42
42
|
| `graphite_sync` | `gt sync` — pull trunk, drop merged branches, restack |
|
|
43
43
|
| `graphite_navigate` | `gt checkout` / `up` / `down` / `top` / `bottom` / trunk |
|
|
44
44
|
| `graphite_change` | `gt create` / `gt modify` / `gt modify --into` / `gt absorb` |
|
|
45
|
-
| `
|
|
45
|
+
| `graphite_submit` | `gt submit --stack --no-edit` (dry-run by default) |
|
|
46
46
|
| `graphite_recover` | `gt continue` / `gt abort` / `gt undo` |
|
|
47
47
|
|
|
48
48
|
All tools require an absolute `cwd`.
|
|
@@ -60,9 +60,9 @@ graphite_navigate (move to the branch you want to mutate)
|
|
|
60
60
|
↓
|
|
61
61
|
graphite_change (create or amend)
|
|
62
62
|
↓
|
|
63
|
-
|
|
63
|
+
graphite_submit apply=false (review dry-run plan)
|
|
64
64
|
↓
|
|
65
|
-
|
|
65
|
+
graphite_submit apply=true (push, with confirmRemote=true)
|
|
66
66
|
confirmRemote=true
|
|
67
67
|
```
|
|
68
68
|
|
|
@@ -129,9 +129,9 @@ graphite_status({ cwd }) # confirm state
|
|
|
129
129
|
graphite_status({ cwd }) # confirm position
|
|
130
130
|
# ... user makes code changes ...
|
|
131
131
|
graphite_change({ cwd, action: "create", message: "..." })
|
|
132
|
-
|
|
132
|
+
graphite_submit({ cwd, apply: false })
|
|
133
133
|
# review plan with user; then:
|
|
134
|
-
|
|
134
|
+
graphite_submit({ cwd, apply: true, confirmRemote: true })
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
### Update an existing PR
|
|
@@ -141,8 +141,8 @@ graphite_status({ cwd })
|
|
|
141
141
|
graphite_navigate({ cwd, action: "checkout", branch: "<pr-branch>" })
|
|
142
142
|
# ... user makes code changes ...
|
|
143
143
|
graphite_change({ cwd, action: "amend", message: "..." })
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
graphite_submit({ cwd, apply: false })
|
|
145
|
+
graphite_submit({ cwd, apply: true, confirmRemote: true })
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
### Add a child PR off a specific parent
|
|
@@ -151,7 +151,7 @@ graphite_submit_stack({ cwd, apply: true, confirmRemote: true })
|
|
|
151
151
|
graphite_navigate({ cwd, action: "checkout", branch: "<parent-branch>" })
|
|
152
152
|
# ... changes ...
|
|
153
153
|
graphite_change({ cwd, action: "create", message: "..." })
|
|
154
|
-
|
|
154
|
+
graphite_submit({ cwd, apply: false })
|
|
155
155
|
```
|
|
156
156
|
|
|
157
157
|
### Land changes into a downstack branch
|
|
@@ -160,7 +160,7 @@ graphite_submit_stack({ cwd, apply: false })
|
|
|
160
160
|
# Make the change locally (working tree dirty).
|
|
161
161
|
graphite_change({ cwd, action: "amend_into", into: "<downstack-branch>", message: "..." })
|
|
162
162
|
graphite_status({ cwd })
|
|
163
|
-
|
|
163
|
+
graphite_submit({ cwd, apply: false })
|
|
164
164
|
```
|
|
165
165
|
|
|
166
166
|
For larger reshuffles touching several downstack commits, prefer `absorb`:
|
|
@@ -199,7 +199,7 @@ graphite_recover({ cwd, action: "undo" })
|
|
|
199
199
|
|
|
200
200
|
## Rules
|
|
201
201
|
|
|
202
|
-
- **Submit stacks, not branches.** `
|
|
202
|
+
- **Submit stacks, not branches.** `graphite_submit` always passes
|
|
203
203
|
`--stack`. There is no safe single-branch submit path in this extension.
|
|
204
204
|
If the user truly needs to push only one branch, ask them to run
|
|
205
205
|
`gt submit --branch=<name>` themselves in their own terminal — do not
|
|
@@ -213,7 +213,7 @@ graphite_recover({ cwd, action: "undo" })
|
|
|
213
213
|
- **Prefer `graphite_sync` over manual restack.** The extension does not
|
|
214
214
|
expose a standalone restack tool. Sync covers both pull + restack.
|
|
215
215
|
- **Always dry-run first.** Show the user the dry-run plan from
|
|
216
|
-
`
|
|
216
|
+
`graphite_submit apply=false` before pushing.
|
|
217
217
|
- **`apply:true` requires `confirmRemote:true`.** The tool will refuse
|
|
218
218
|
otherwise. This is intentional friction.
|
|
219
219
|
- **Destructive sync flags require `confirmDestructive:true`** (`force`,
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { registerSetup } from "./tools/setup";
|
|
|
5
5
|
import { registerSync } from "./tools/sync";
|
|
6
6
|
import { registerNavigate } from "./tools/navigate";
|
|
7
7
|
import { registerChange } from "./tools/change";
|
|
8
|
-
import {
|
|
8
|
+
import { registerSubmit } from "./tools/submit";
|
|
9
9
|
import { registerRecover } from "./tools/recover";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -18,12 +18,12 @@ import { registerRecover } from "./tools/recover";
|
|
|
18
18
|
* graphite_sync — start-of-day / after-merge cleanup + restack
|
|
19
19
|
* graphite_navigate — move to the branch / PR you want to mutate
|
|
20
20
|
* graphite_change — create or amend a stacked branch
|
|
21
|
-
*
|
|
21
|
+
* graphite_submit — push the whole stack and open/update PRs
|
|
22
22
|
* graphite_recover — continue / abort / undo after conflicts or mistakes
|
|
23
23
|
*
|
|
24
24
|
* Golden path:
|
|
25
25
|
*
|
|
26
|
-
* status → (setup if needed) → sync → navigate → change →
|
|
26
|
+
* status → (setup if needed) → sync → navigate → change → submit(dry-run) → submit(apply)
|
|
27
27
|
*
|
|
28
28
|
* Conflict path:
|
|
29
29
|
*
|
|
@@ -34,7 +34,7 @@ import { registerRecover } from "./tools/recover";
|
|
|
34
34
|
* - `gt` is invoked with --cwd <cwd> --no-interactive by default; tools that support AI metadata pass --no-ai.
|
|
35
35
|
* - Editor / pager / browser env is forced safe; interactive editor / hunk /
|
|
36
36
|
* browser flows are not exposed.
|
|
37
|
-
* -
|
|
37
|
+
* - graphite_submit defaults to --dry-run; apply requires
|
|
38
38
|
* `apply:true` AND `confirmRemote:true`.
|
|
39
39
|
* - graphite_sync with force / deleteAll requires `confirmDestructive:true`.
|
|
40
40
|
* - This extension wraps `gt` only. It deliberately does not call `gh`,
|
|
@@ -47,6 +47,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
47
47
|
registerSync(pi);
|
|
48
48
|
registerNavigate(pi);
|
|
49
49
|
registerChange(pi);
|
|
50
|
-
|
|
50
|
+
registerSubmit(pi);
|
|
51
51
|
registerRecover(pi);
|
|
52
52
|
}
|
package/src/tools/submit.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "../lib/schema";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* graphite_submit — the only blessed submit path.
|
|
14
14
|
*
|
|
15
15
|
* Wraps `gt submit --stack --no-edit --no-ai`. Defaults to --dry-run so the
|
|
16
16
|
* caller can review the plan. Actually pushing requires `apply:true` AND
|
|
@@ -20,16 +20,16 @@ import {
|
|
|
20
20
|
* current-branch-only submit. The skill calls out that the correct workflow
|
|
21
21
|
* is always to submit the entire stack.
|
|
22
22
|
*/
|
|
23
|
-
export function
|
|
23
|
+
export function registerSubmit(pi: ExtensionAPI) {
|
|
24
24
|
pi.registerTool({
|
|
25
|
-
name: "
|
|
25
|
+
name: "graphite_submit",
|
|
26
26
|
label: "Graphite: submit stack",
|
|
27
27
|
description:
|
|
28
28
|
"Push the entire current stack and create/update PRs via `gt submit --stack --no-edit`. Defaults to a dry-run plan; pass apply:true with confirmRemote:true to actually push. PR title/body editing is intentionally not exposed.",
|
|
29
29
|
promptSnippet:
|
|
30
|
-
"
|
|
30
|
+
"graphite_submit: plan or apply `gt submit --stack` for the full stack",
|
|
31
31
|
promptGuidelines: [
|
|
32
|
-
"Always call
|
|
32
|
+
"Always call graphite_submit with apply:false (default) first to review the dry-run plan, then call again with apply:true and confirmRemote:true to actually push.",
|
|
33
33
|
"This extension does not edit PR titles/bodies. If you need to set them, do it outside this extension after the push.",
|
|
34
34
|
],
|
|
35
35
|
parameters: Type.Object({
|