git-stack-cli 2.5.0 → 2.5.1
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/dist/js/index.js +19 -71
- package/package.json +1 -1
- package/src/app/App.tsx +16 -16
- package/src/app/DependencyCheck.tsx +18 -3
- package/src/app/SyncGithub.tsx +1 -60
package/dist/js/index.js
CHANGED
|
@@ -37869,7 +37869,13 @@ var RE = {
|
|
|
37869
37869
|
|
|
37870
37870
|
// src/app/DependencyCheck.tsx
|
|
37871
37871
|
function DependencyCheck(props) {
|
|
37872
|
-
return /* @__PURE__ */ React23.createElement(CheckGit, null, /* @__PURE__ */ React23.createElement(CheckGithubCli,
|
|
37872
|
+
return /* @__PURE__ */ React23.createElement(CheckGit, null, /* @__PURE__ */ React23.createElement(CheckGithubCli, {
|
|
37873
|
+
...props
|
|
37874
|
+
}, /* @__PURE__ */ React23.createElement(CheckGithubCliAuth, {
|
|
37875
|
+
...props
|
|
37876
|
+
}, /* @__PURE__ */ React23.createElement(CheckGitRevise, {
|
|
37877
|
+
...props
|
|
37878
|
+
}, props.children))));
|
|
37873
37879
|
}
|
|
37874
37880
|
function CheckGit(props) {
|
|
37875
37881
|
const actions = Store.useActions();
|
|
@@ -37890,6 +37896,9 @@ function CheckGit(props) {
|
|
|
37890
37896
|
}
|
|
37891
37897
|
function CheckGithubCli(props) {
|
|
37892
37898
|
const actions = Store.useActions();
|
|
37899
|
+
if (props.disableGithubCli) {
|
|
37900
|
+
return /* @__PURE__ */ React23.createElement(React23.Fragment, null, props.children);
|
|
37901
|
+
}
|
|
37893
37902
|
return /* @__PURE__ */ React23.createElement(Await, {
|
|
37894
37903
|
fallback: /* @__PURE__ */ React23.createElement(Text, {
|
|
37895
37904
|
color: colors.yellow
|
|
@@ -37917,6 +37926,9 @@ function CheckGithubCli(props) {
|
|
|
37917
37926
|
}
|
|
37918
37927
|
function CheckGithubCliAuth(props) {
|
|
37919
37928
|
const actions = Store.useActions();
|
|
37929
|
+
if (props.disableGithubCliAuth) {
|
|
37930
|
+
return /* @__PURE__ */ React23.createElement(React23.Fragment, null, props.children);
|
|
37931
|
+
}
|
|
37920
37932
|
return /* @__PURE__ */ React23.createElement(Await, {
|
|
37921
37933
|
fallback: /* @__PURE__ */ React23.createElement(Text, {
|
|
37922
37934
|
color: colors.yellow
|
|
@@ -37952,6 +37964,9 @@ function CheckGithubCliAuth(props) {
|
|
|
37952
37964
|
}
|
|
37953
37965
|
function CheckGitRevise(props) {
|
|
37954
37966
|
const actions = Store.useActions();
|
|
37967
|
+
if (props.disableGitRevise) {
|
|
37968
|
+
return /* @__PURE__ */ React23.createElement(React23.Fragment, null, props.children);
|
|
37969
|
+
}
|
|
37955
37970
|
return /* @__PURE__ */ React23.createElement(Await, {
|
|
37956
37971
|
fallback: /* @__PURE__ */ React23.createElement(Text, {
|
|
37957
37972
|
color: colors.yellow
|
|
@@ -38161,32 +38176,6 @@ async function pr_edit(args) {
|
|
|
38161
38176
|
await safe_rm(body_file);
|
|
38162
38177
|
}
|
|
38163
38178
|
}
|
|
38164
|
-
async function pr_draft(args) {
|
|
38165
|
-
const mutation_name = args.draft ? "convertPullRequestToDraft" : "markPullRequestReadyForReview";
|
|
38166
|
-
let query = `
|
|
38167
|
-
mutation($id: ID!) {
|
|
38168
|
-
${mutation_name}(input: { pullRequestId: $id }) {
|
|
38169
|
-
pullRequest {
|
|
38170
|
-
id
|
|
38171
|
-
number
|
|
38172
|
-
isDraft
|
|
38173
|
-
}
|
|
38174
|
-
}
|
|
38175
|
-
}
|
|
38176
|
-
`;
|
|
38177
|
-
query = query.replace(/\n/g, " ");
|
|
38178
|
-
query = query.replace(/\s+/g, " ");
|
|
38179
|
-
query = query.trim();
|
|
38180
|
-
const state = Store.getState();
|
|
38181
|
-
const cache_pr = state.pr[args.branch];
|
|
38182
|
-
invariant(cache_pr, "cache_pr must exist");
|
|
38183
|
-
const command_parts = [`gh api graphql -F id="${cache_pr.id}" -f query='${query}'`];
|
|
38184
|
-
const command = command_parts.join(" ");
|
|
38185
|
-
const cli_result = await cli(command);
|
|
38186
|
-
if (cli_result.code !== 0) {
|
|
38187
|
-
handle_error(cli_result.output);
|
|
38188
|
-
}
|
|
38189
|
-
}
|
|
38190
38179
|
var JSON_FIELDS = "--json id,number,state,baseRefName,headRefName,commits,title,body,url,isDraft";
|
|
38191
38180
|
async function gh_json(command) {
|
|
38192
38181
|
let hash = crypto.createHash("md5").update(command).digest("hex");
|
|
@@ -40272,13 +40261,6 @@ async function run9() {
|
|
|
40272
40261
|
invariant(sync_github, "sync_github must exist");
|
|
40273
40262
|
const commit_range = sync_github.commit_range;
|
|
40274
40263
|
const rebase_group_index = sync_github.rebase_group_index;
|
|
40275
|
-
actions.register_abort_handler(async function abort_sync_github() {
|
|
40276
|
-
actions.output(/* @__PURE__ */ React44.createElement(Text, {
|
|
40277
|
-
color: colors.red
|
|
40278
|
-
}, "\uD83D\uDEA8 Abort"));
|
|
40279
|
-
handle_exit2();
|
|
40280
|
-
return 17;
|
|
40281
|
-
});
|
|
40282
40264
|
let DEFAULT_PR_BODY = "";
|
|
40283
40265
|
if (state.pr_template_body) {
|
|
40284
40266
|
DEFAULT_PR_BODY = state.pr_template_body;
|
|
@@ -40344,17 +40326,7 @@ async function run9() {
|
|
|
40344
40326
|
async function before_push(args) {
|
|
40345
40327
|
const { group } = args;
|
|
40346
40328
|
invariant(group.base, "group.base must exist");
|
|
40347
|
-
let is_temp_draft = !group.pr?.isDraft;
|
|
40348
40329
|
if (group.pr) {
|
|
40349
|
-
if (!group.pr.isDraft) {
|
|
40350
|
-
is_temp_draft = true;
|
|
40351
|
-
}
|
|
40352
|
-
if (is_temp_draft) {
|
|
40353
|
-
await pr_draft({
|
|
40354
|
-
branch: group.id,
|
|
40355
|
-
draft: true
|
|
40356
|
-
});
|
|
40357
|
-
}
|
|
40358
40330
|
await pr_edit({
|
|
40359
40331
|
branch: group.id,
|
|
40360
40332
|
base: master_branch
|
|
@@ -40375,13 +40347,6 @@ async function run9() {
|
|
|
40375
40347
|
selected_url
|
|
40376
40348
|
})
|
|
40377
40349
|
});
|
|
40378
|
-
let is_temp_draft = !group.pr?.isDraft;
|
|
40379
|
-
if (is_temp_draft) {
|
|
40380
|
-
await pr_draft({
|
|
40381
|
-
branch: group.id,
|
|
40382
|
-
draft: false
|
|
40383
|
-
});
|
|
40384
|
-
}
|
|
40385
40350
|
} else {
|
|
40386
40351
|
const pr_url = await pr_create({
|
|
40387
40352
|
branch: group.id,
|
|
@@ -40421,23 +40386,6 @@ async function run9() {
|
|
|
40421
40386
|
});
|
|
40422
40387
|
}
|
|
40423
40388
|
}
|
|
40424
|
-
function handle_exit2() {
|
|
40425
|
-
actions.output(/* @__PURE__ */ React44.createElement(Text, {
|
|
40426
|
-
color: colors.yellow
|
|
40427
|
-
}, "Restoring PR state…"));
|
|
40428
|
-
for (const group of push_group_list) {
|
|
40429
|
-
let is_temp_draft = !group.pr?.isDraft;
|
|
40430
|
-
if (is_temp_draft) {
|
|
40431
|
-
pr_draft({
|
|
40432
|
-
branch: group.id,
|
|
40433
|
-
draft: false
|
|
40434
|
-
}).catch(actions.error);
|
|
40435
|
-
}
|
|
40436
|
-
}
|
|
40437
|
-
actions.output(/* @__PURE__ */ React44.createElement(Text, {
|
|
40438
|
-
color: colors.yellow
|
|
40439
|
-
}, "Restored PR state."));
|
|
40440
|
-
}
|
|
40441
40389
|
}
|
|
40442
40390
|
var get_group_url = (group) => group.pr?.url || group.id;
|
|
40443
40391
|
|
|
@@ -40807,7 +40755,7 @@ function App2() {
|
|
|
40807
40755
|
actions.exit(0);
|
|
40808
40756
|
}
|
|
40809
40757
|
}
|
|
40810
|
-
}, /* @__PURE__ */ React54.createElement(VerboseDebugInfo, null, /* @__PURE__ */ React54.createElement(
|
|
40758
|
+
}, /* @__PURE__ */ React54.createElement(VerboseDebugInfo, null, /* @__PURE__ */ React54.createElement(RebaseCheck, null, /* @__PURE__ */ React54.createElement(CherryPickCheck, null, /* @__PURE__ */ React54.createElement(MaybeMain, null))))), /* @__PURE__ */ React54.createElement(HandleCtrlCSigint, null))));
|
|
40811
40759
|
}
|
|
40812
40760
|
function MaybeMain() {
|
|
40813
40761
|
const argv = Store.useState((state) => state.argv);
|
|
@@ -40819,7 +40767,7 @@ function MaybeMain() {
|
|
|
40819
40767
|
} else if (positional_list.has("rebase")) {
|
|
40820
40768
|
return /* @__PURE__ */ React54.createElement(GatherMetadata, null, /* @__PURE__ */ React54.createElement(LocalCommitStatus, null, /* @__PURE__ */ React54.createElement(Rebase, null)));
|
|
40821
40769
|
}
|
|
40822
|
-
return /* @__PURE__ */ React54.createElement(React54.Fragment, null, !argv.verbose ? null : /* @__PURE__ */ React54.createElement(GithubApiError, null), /* @__PURE__ */ React54.createElement(GatherMetadata, null, /* @__PURE__ */ React54.createElement(DirtyCheck, null, /* @__PURE__ */ React54.createElement(LocalCommitStatus, null, /* @__PURE__ */ React54.createElement(DetectInitialPR, null, /* @__PURE__ */ React54.createElement(Main, null))))));
|
|
40770
|
+
return /* @__PURE__ */ React54.createElement(React54.Fragment, null, !argv.verbose ? null : /* @__PURE__ */ React54.createElement(GithubApiError, null), /* @__PURE__ */ React54.createElement(DependencyCheck, null, /* @__PURE__ */ React54.createElement(GatherMetadata, null, /* @__PURE__ */ React54.createElement(DirtyCheck, null, /* @__PURE__ */ React54.createElement(LocalCommitStatus, null, /* @__PURE__ */ React54.createElement(DetectInitialPR, null, /* @__PURE__ */ React54.createElement(Main, null)))))));
|
|
40823
40771
|
}
|
|
40824
40772
|
|
|
40825
40773
|
// node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/lib/platform-shims/esm.mjs
|
|
@@ -45684,7 +45632,7 @@ var yargs_default = Yargs;
|
|
|
45684
45632
|
|
|
45685
45633
|
// src/command.ts
|
|
45686
45634
|
async function command2() {
|
|
45687
|
-
return yargs_default(hideBin(process.argv)).scriptName("git stack").usage("Usage: git stack [command] [options]").command("$0", "Sync commit ranges to Github", (yargs) => yargs.options(DefaultOptions)).command("fixup [commit]", "Amend staged changes to a specific commit in history", (yargs) => yargs.positional("commit", FixupOptions.commit)).command("log [args...]", "Print an abbreviated log with numbered commits, useful for git stack fixup", (yargs) => yargs.strict(false)).command("rebase", "Update local branch via rebase with latest changes from origin master branch", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.5.
|
|
45635
|
+
return yargs_default(hideBin(process.argv)).scriptName("git stack").usage("Usage: git stack [command] [options]").command("$0", "Sync commit ranges to Github", (yargs) => yargs.options(DefaultOptions)).command("fixup [commit]", "Amend staged changes to a specific commit in history", (yargs) => yargs.positional("commit", FixupOptions.commit)).command("log [args...]", "Print an abbreviated log with numbered commits, useful for git stack fixup", (yargs) => yargs.strict(false)).command("rebase", "Update local branch via rebase with latest changes from origin master branch", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.5.1").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
|
|
45688
45636
|
}
|
|
45689
45637
|
var GlobalOptions = {
|
|
45690
45638
|
verbose: {
|
package/package.json
CHANGED
package/src/app/App.tsx
CHANGED
|
@@ -61,13 +61,11 @@ export function App() {
|
|
|
61
61
|
}}
|
|
62
62
|
>
|
|
63
63
|
<VerboseDebugInfo>
|
|
64
|
-
<
|
|
65
|
-
<
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</RebaseCheck>
|
|
70
|
-
</DependencyCheck>
|
|
64
|
+
<RebaseCheck>
|
|
65
|
+
<CherryPickCheck>
|
|
66
|
+
<MaybeMain />
|
|
67
|
+
</CherryPickCheck>
|
|
68
|
+
</RebaseCheck>
|
|
71
69
|
</VerboseDebugInfo>
|
|
72
70
|
</AutoUpdate>
|
|
73
71
|
|
|
@@ -100,15 +98,17 @@ function MaybeMain() {
|
|
|
100
98
|
<React.Fragment>
|
|
101
99
|
{!argv.verbose ? null : <GithubApiError />}
|
|
102
100
|
|
|
103
|
-
<
|
|
104
|
-
<
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
101
|
+
<DependencyCheck>
|
|
102
|
+
<GatherMetadata>
|
|
103
|
+
<DirtyCheck>
|
|
104
|
+
<LocalCommitStatus>
|
|
105
|
+
<DetectInitialPR>
|
|
106
|
+
<Main />
|
|
107
|
+
</DetectInitialPR>
|
|
108
|
+
</LocalCommitStatus>
|
|
109
|
+
</DirtyCheck>
|
|
110
|
+
</GatherMetadata>
|
|
111
|
+
</DependencyCheck>
|
|
112
112
|
</React.Fragment>
|
|
113
113
|
);
|
|
114
114
|
}
|
|
@@ -15,14 +15,17 @@ import * as gh from "~/github/gh";
|
|
|
15
15
|
|
|
16
16
|
type Props = {
|
|
17
17
|
children: React.ReactNode;
|
|
18
|
+
disableGithubCli?: boolean;
|
|
19
|
+
disableGithubCliAuth?: boolean;
|
|
20
|
+
disableGitRevise?: boolean;
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
export function DependencyCheck(props: Props) {
|
|
21
24
|
return (
|
|
22
25
|
<CheckGit>
|
|
23
|
-
<CheckGithubCli>
|
|
24
|
-
<CheckGithubCliAuth>
|
|
25
|
-
<CheckGitRevise>
|
|
26
|
+
<CheckGithubCli {...props}>
|
|
27
|
+
<CheckGithubCliAuth {...props}>
|
|
28
|
+
<CheckGitRevise {...props}>
|
|
26
29
|
{/* force line break */}
|
|
27
30
|
{props.children}
|
|
28
31
|
</CheckGitRevise>
|
|
@@ -69,6 +72,10 @@ function CheckGit(props: Props) {
|
|
|
69
72
|
function CheckGithubCli(props: Props) {
|
|
70
73
|
const actions = Store.useActions();
|
|
71
74
|
|
|
75
|
+
if (props.disableGithubCli) {
|
|
76
|
+
return <>{props.children}</>;
|
|
77
|
+
}
|
|
78
|
+
|
|
72
79
|
return (
|
|
73
80
|
<Await
|
|
74
81
|
fallback={
|
|
@@ -112,6 +119,10 @@ function CheckGithubCli(props: Props) {
|
|
|
112
119
|
function CheckGithubCliAuth(props: Props) {
|
|
113
120
|
const actions = Store.useActions();
|
|
114
121
|
|
|
122
|
+
if (props.disableGithubCliAuth) {
|
|
123
|
+
return <>{props.children}</>;
|
|
124
|
+
}
|
|
125
|
+
|
|
115
126
|
return (
|
|
116
127
|
<Await
|
|
117
128
|
fallback={
|
|
@@ -164,6 +175,10 @@ function CheckGithubCliAuth(props: Props) {
|
|
|
164
175
|
function CheckGitRevise(props: Props) {
|
|
165
176
|
const actions = Store.useActions();
|
|
166
177
|
|
|
178
|
+
if (props.disableGitRevise) {
|
|
179
|
+
return <>{props.children}</>;
|
|
180
|
+
}
|
|
181
|
+
|
|
167
182
|
return (
|
|
168
183
|
<Await
|
|
169
184
|
fallback={
|
package/src/app/SyncGithub.tsx
CHANGED
|
@@ -35,13 +35,6 @@ async function run() {
|
|
|
35
35
|
const commit_range = sync_github.commit_range;
|
|
36
36
|
const rebase_group_index = sync_github.rebase_group_index;
|
|
37
37
|
|
|
38
|
-
// immediately register abort_handler in case of ctrl+c exit
|
|
39
|
-
actions.register_abort_handler(async function abort_sync_github() {
|
|
40
|
-
actions.output(<Ink.Text color={colors.red}>🚨 Abort</Ink.Text>);
|
|
41
|
-
handle_exit();
|
|
42
|
-
return 17;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
38
|
let DEFAULT_PR_BODY = "";
|
|
46
39
|
if (state.pr_template_body) {
|
|
47
40
|
DEFAULT_PR_BODY = state.pr_template_body;
|
|
@@ -52,13 +45,10 @@ async function run() {
|
|
|
52
45
|
// for all push targets in push_group_list
|
|
53
46
|
// things that can be done in parallel are grouped by numbers
|
|
54
47
|
//
|
|
55
|
-
// -----------------------------------
|
|
56
|
-
// 1 (before_push) temp mark draft
|
|
57
48
|
// --------------------------------------
|
|
58
|
-
//
|
|
49
|
+
// 1 push simultaneously to github
|
|
59
50
|
// --------------------------------------
|
|
60
51
|
// 2 create PR / edit PR
|
|
61
|
-
// 2 (after_push) undo temp mark draft
|
|
62
52
|
// --------------------------------------
|
|
63
53
|
|
|
64
54
|
try {
|
|
@@ -170,25 +160,10 @@ async function run() {
|
|
|
170
160
|
|
|
171
161
|
invariant(group.base, "group.base must exist");
|
|
172
162
|
|
|
173
|
-
// we may temporarily mark PR as a draft before editing it
|
|
174
|
-
// if it is not already a draft PR, to avoid notification spam
|
|
175
|
-
let is_temp_draft = !group.pr?.isDraft;
|
|
176
|
-
|
|
177
163
|
// before pushing reset base to master temporarily
|
|
178
164
|
// avoid accidentally pointing to orphaned parent commit
|
|
179
165
|
// should hopefully fix issues where a PR includes a bunch of commits after pushing
|
|
180
166
|
if (group.pr) {
|
|
181
|
-
if (!group.pr.isDraft) {
|
|
182
|
-
is_temp_draft = true;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (is_temp_draft) {
|
|
186
|
-
await github.pr_draft({
|
|
187
|
-
branch: group.id,
|
|
188
|
-
draft: true,
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
|
|
192
167
|
await github.pr_edit({
|
|
193
168
|
branch: group.id,
|
|
194
169
|
base: master_branch,
|
|
@@ -214,18 +189,6 @@ async function run() {
|
|
|
214
189
|
selected_url,
|
|
215
190
|
}),
|
|
216
191
|
});
|
|
217
|
-
|
|
218
|
-
// we may temporarily mark PR as a draft before editing it
|
|
219
|
-
// if it is not already a draft PR, to avoid notification spam
|
|
220
|
-
let is_temp_draft = !group.pr?.isDraft;
|
|
221
|
-
|
|
222
|
-
if (is_temp_draft) {
|
|
223
|
-
// mark pr as ready for review again
|
|
224
|
-
await github.pr_draft({
|
|
225
|
-
branch: group.id,
|
|
226
|
-
draft: false,
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
192
|
} else {
|
|
230
193
|
// create pr in github
|
|
231
194
|
const pr_url = await github.pr_create({
|
|
@@ -279,28 +242,6 @@ async function run() {
|
|
|
279
242
|
});
|
|
280
243
|
}
|
|
281
244
|
}
|
|
282
|
-
|
|
283
|
-
function handle_exit() {
|
|
284
|
-
actions.output(<Ink.Text color={colors.yellow}>Restoring PR state…</Ink.Text>);
|
|
285
|
-
|
|
286
|
-
for (const group of push_group_list) {
|
|
287
|
-
// we may temporarily mark PR as a draft before editing it
|
|
288
|
-
// if it is not already a draft PR, to avoid notification spam
|
|
289
|
-
let is_temp_draft = !group.pr?.isDraft;
|
|
290
|
-
|
|
291
|
-
// restore PR to non-draft state
|
|
292
|
-
if (is_temp_draft) {
|
|
293
|
-
github
|
|
294
|
-
.pr_draft({
|
|
295
|
-
branch: group.id,
|
|
296
|
-
draft: false,
|
|
297
|
-
})
|
|
298
|
-
.catch(actions.error);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
actions.output(<Ink.Text color={colors.yellow}>Restored PR state.</Ink.Text>);
|
|
303
|
-
}
|
|
304
245
|
}
|
|
305
246
|
|
|
306
247
|
type CommitMetadataGroup = CommitMetadata.CommitRange["group_list"][number];
|