git-stack-cli 2.0.0-beta → 2.1.0-beta
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 +44 -18
- package/package.json +1 -1
- package/scripts/bun-build.ts +2 -0
- package/scripts/release-brew.ts +4 -2
- package/src/app/Store.tsx +16 -5
- package/src/commands/Fixup.tsx +2 -0
- package/src/commands/Log.tsx +2 -0
- package/src/components/ExitingGate.tsx +19 -9
- package/src/core/CommitMetadata.ts +20 -3
- package/src/core/github.tsx +2 -2
package/dist/js/index.js
CHANGED
|
@@ -37050,15 +37050,20 @@ var BaseStore = createStore()(immer2((set2, get) => ({
|
|
|
37050
37050
|
sync_github: null,
|
|
37051
37051
|
is_dirty_check_stash: false,
|
|
37052
37052
|
abort_handler: null,
|
|
37053
|
-
|
|
37053
|
+
exit_mode: null,
|
|
37054
37054
|
step: "loading",
|
|
37055
37055
|
output: [],
|
|
37056
37056
|
pending_output: {},
|
|
37057
37057
|
pr: {},
|
|
37058
37058
|
actions: {
|
|
37059
|
-
exit(code,
|
|
37059
|
+
exit(code, args) {
|
|
37060
37060
|
set2((state) => {
|
|
37061
|
-
|
|
37061
|
+
if (args?.quiet ?? code === 0) {
|
|
37062
|
+
state.exit_mode = "quiet";
|
|
37063
|
+
} else {
|
|
37064
|
+
state.exit_mode = "normal";
|
|
37065
|
+
}
|
|
37066
|
+
let clear = args?.clear ?? true;
|
|
37062
37067
|
const node = /* @__PURE__ */ React16.createElement(Exit, {
|
|
37063
37068
|
clear,
|
|
37064
37069
|
code
|
|
@@ -37791,7 +37796,7 @@ function Url(props) {
|
|
|
37791
37796
|
import fs7 from "node:fs";
|
|
37792
37797
|
import path4 from "node:path";
|
|
37793
37798
|
function is_command_available(command) {
|
|
37794
|
-
const PATH = "/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/.
|
|
37799
|
+
const PATH = "/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/.rvm/gems/ruby-2.6.3/bin:/Users/noah/.rvm/gems/ruby-2.6.3@global/bin:/Users/noah/.rvm/rubies/ruby-2.6.3/bin:/Users/noah/Library/pnpm:/Users/noah/.bun/bin:/Users/noah/Library/Caches/fnm_multishells/45565_1737429645385/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/local/sbin:/Users/noah/.dotfiles/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/noah/.cargo/bin:/Applications/iTerm.app/Contents/Resources/utilities:/Users/noah/google-cloud-sdk/bin:/Users/noah/.yarn/bin:/Users/noah/.fastlane/bin:/usr/local/opt/fzf/bin:/Users/noah/google-cloud-sdk/bin:/Users/noah/.yarn/bin:/Users/noah/.fastlane/bin:/Users/noah/.rvm/bin";
|
|
37795
37800
|
invariant(PATH, "PATH env must exist");
|
|
37796
37801
|
const path_list = PATH.split(path4.delimiter);
|
|
37797
37802
|
for (const dir of path_list) {
|
|
@@ -38049,7 +38054,7 @@ async function pr_status(branch) {
|
|
|
38049
38054
|
const cache4 = state.pr[branch];
|
|
38050
38055
|
if (cache4) {
|
|
38051
38056
|
if (actions.isDebug()) {
|
|
38052
|
-
actions.
|
|
38057
|
+
actions.debug(/* @__PURE__ */ React24.createElement(Text, null, /* @__PURE__ */ React24.createElement(Text, {
|
|
38053
38058
|
dimColor: true
|
|
38054
38059
|
}, "Github pr_status cache"), /* @__PURE__ */ React24.createElement(Text, null, " "), /* @__PURE__ */ React24.createElement(Text, {
|
|
38055
38060
|
bold: true,
|
|
@@ -38061,7 +38066,7 @@ async function pr_status(branch) {
|
|
|
38061
38066
|
return cache4;
|
|
38062
38067
|
}
|
|
38063
38068
|
if (actions.isDebug()) {
|
|
38064
|
-
actions.
|
|
38069
|
+
actions.debug(/* @__PURE__ */ React24.createElement(Text, null, /* @__PURE__ */ React24.createElement(Text, {
|
|
38065
38070
|
dimColor: true
|
|
38066
38071
|
}, "Github pr_status cache"), /* @__PURE__ */ React24.createElement(Text, null, " "), /* @__PURE__ */ React24.createElement(Text, {
|
|
38067
38072
|
bold: true,
|
|
@@ -38221,13 +38226,25 @@ async function range(commit_group_map) {
|
|
|
38221
38226
|
const group_value_list = Array.from(group_map.values());
|
|
38222
38227
|
const group_list = [];
|
|
38223
38228
|
let unassigned_group;
|
|
38229
|
+
const pr_status_promise_list = {};
|
|
38230
|
+
for (const group of group_value_list) {
|
|
38231
|
+
if (group.id !== UNASSIGNED) {
|
|
38232
|
+
pr_status_promise_list[group.id] = pr_status(group.id);
|
|
38233
|
+
}
|
|
38234
|
+
}
|
|
38235
|
+
await Promise.all(Array.from(Object.values(pr_status_promise_list)));
|
|
38236
|
+
for (const [group_id, pr_status_promise] of Object.entries(pr_status_promise_list)) {
|
|
38237
|
+
const pr_status2 = await pr_status_promise;
|
|
38238
|
+
if (pr_status2) {
|
|
38239
|
+
pr_lookup[group_id] = pr_status2;
|
|
38240
|
+
}
|
|
38241
|
+
}
|
|
38224
38242
|
for (let i2 = 0;i2 < group_value_list.length; i2++) {
|
|
38225
38243
|
const group = group_value_list[i2];
|
|
38226
38244
|
if (group.id !== UNASSIGNED) {
|
|
38227
|
-
|
|
38245
|
+
let pr_result = pr_lookup[group.id];
|
|
38228
38246
|
if (pr_result && pr_result.state !== "CLOSED") {
|
|
38229
38247
|
group.pr = pr_result;
|
|
38230
|
-
pr_lookup[group.id] = pr_result;
|
|
38231
38248
|
}
|
|
38232
38249
|
}
|
|
38233
38250
|
if (group.id === UNASSIGNED) {
|
|
@@ -40576,6 +40593,7 @@ async function run11() {
|
|
|
40576
40593
|
}, "✅ Changes restored from stash"));
|
|
40577
40594
|
}
|
|
40578
40595
|
}
|
|
40596
|
+
actions.exit(0);
|
|
40579
40597
|
}
|
|
40580
40598
|
|
|
40581
40599
|
// src/commands/Log.tsx
|
|
@@ -40611,6 +40629,7 @@ async function run12(args) {
|
|
|
40611
40629
|
].join(" | ");
|
|
40612
40630
|
const result = await cli(command);
|
|
40613
40631
|
actions.output(result.stdout);
|
|
40632
|
+
actions.exit(0);
|
|
40614
40633
|
}
|
|
40615
40634
|
|
|
40616
40635
|
// src/components/ErrorBoundary.tsx
|
|
@@ -40672,17 +40691,24 @@ class ErrorBoundary extends React52.Component {
|
|
|
40672
40691
|
// src/components/ExitingGate.tsx
|
|
40673
40692
|
var React53 = __toESM(require_react(), 1);
|
|
40674
40693
|
function ExitingGate(props) {
|
|
40675
|
-
const
|
|
40676
|
-
if (!
|
|
40694
|
+
const exit_mode = Store.useState((state) => state.exit_mode);
|
|
40695
|
+
if (!exit_mode) {
|
|
40677
40696
|
return props.children;
|
|
40678
40697
|
}
|
|
40679
|
-
|
|
40680
|
-
|
|
40681
|
-
|
|
40682
|
-
|
|
40683
|
-
|
|
40684
|
-
|
|
40685
|
-
|
|
40698
|
+
switch (exit_mode) {
|
|
40699
|
+
case "quiet":
|
|
40700
|
+
return null;
|
|
40701
|
+
case "normal":
|
|
40702
|
+
return /* @__PURE__ */ React53.createElement(Box_default, {
|
|
40703
|
+
flexDirection: "column"
|
|
40704
|
+
}, /* @__PURE__ */ React53.createElement(Text, {
|
|
40705
|
+
color: colors.red
|
|
40706
|
+
}, /* @__PURE__ */ React53.createElement(FormatText, {
|
|
40707
|
+
message: "\uD83D\uDEA8 Exiting…"
|
|
40708
|
+
})));
|
|
40709
|
+
default:
|
|
40710
|
+
return null;
|
|
40711
|
+
}
|
|
40686
40712
|
}
|
|
40687
40713
|
|
|
40688
40714
|
// src/app/App.tsx
|
|
@@ -45580,7 +45606,7 @@ var yargs_default = Yargs;
|
|
|
45580
45606
|
|
|
45581
45607
|
// src/command.ts
|
|
45582
45608
|
async function command2() {
|
|
45583
|
-
return yargs_default(hideBin(process.argv)).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.
|
|
45609
|
+
return yargs_default(hideBin(process.argv)).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.1.0-beta").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
|
|
45584
45610
|
}
|
|
45585
45611
|
var GlobalOptions = {
|
|
45586
45612
|
verbose: {
|
package/package.json
CHANGED
package/scripts/bun-build.ts
CHANGED
package/scripts/release-brew.ts
CHANGED
|
@@ -25,7 +25,9 @@ const previous_formula_path = path.join(HOMEBREW_DIR, "Formula", "git-stack.rb")
|
|
|
25
25
|
// version = "1.0.4"
|
|
26
26
|
//
|
|
27
27
|
let previous_formula = await file.read_text(previous_formula_path);
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
// https://regex101.com/r/BnvdqK/1
|
|
30
|
+
const re_version = /version(?: =)? "(?<version>\d+\.\d+\.\d+(?:-.+)?)"/m;
|
|
29
31
|
const previous_version_match = previous_formula.match(re_version);
|
|
30
32
|
|
|
31
33
|
if (!previous_version_match?.groups) {
|
|
@@ -35,7 +37,7 @@ if (!previous_version_match?.groups) {
|
|
|
35
37
|
|
|
36
38
|
const previous_version = previous_version_match.groups.version;
|
|
37
39
|
// convert `1.0.4` to `104`
|
|
38
|
-
const not_dot_version = previous_version.replace(
|
|
40
|
+
const not_dot_version = previous_version.replace(/[^a-z0-9]/gi, "");
|
|
39
41
|
const previous_class = `GitStackAT${not_dot_version}`;
|
|
40
42
|
previous_formula = previous_formula.replace("class GitStack", `class ${previous_class}`);
|
|
41
43
|
|
package/src/app/Store.tsx
CHANGED
|
@@ -33,6 +33,11 @@ type SyncGithubState = {
|
|
|
33
33
|
// async function that returns exit code
|
|
34
34
|
type AbortHandler = () => Promise<number>;
|
|
35
35
|
|
|
36
|
+
type ExitArgs = {
|
|
37
|
+
quiet?: boolean;
|
|
38
|
+
clear?: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
36
41
|
export type State = {
|
|
37
42
|
// set immediately in `index.tsx` so no `null` scenario
|
|
38
43
|
process_argv: Array<string>;
|
|
@@ -53,7 +58,7 @@ export type State = {
|
|
|
53
58
|
sync_github: null | SyncGithubState;
|
|
54
59
|
is_dirty_check_stash: boolean;
|
|
55
60
|
abort_handler: null | AbortHandler;
|
|
56
|
-
|
|
61
|
+
exit_mode: null | "normal" | "quiet";
|
|
57
62
|
|
|
58
63
|
step:
|
|
59
64
|
| "github-api-error"
|
|
@@ -74,7 +79,7 @@ export type State = {
|
|
|
74
79
|
pr: { [branch: string]: PullRequest };
|
|
75
80
|
|
|
76
81
|
actions: {
|
|
77
|
-
exit(code: number,
|
|
82
|
+
exit(code: number, args?: ExitArgs): void;
|
|
78
83
|
clear(): void;
|
|
79
84
|
unmount(): void;
|
|
80
85
|
newline(): void;
|
|
@@ -124,7 +129,7 @@ const BaseStore = createStore<State>()(
|
|
|
124
129
|
sync_github: null,
|
|
125
130
|
is_dirty_check_stash: false,
|
|
126
131
|
abort_handler: null,
|
|
127
|
-
|
|
132
|
+
exit_mode: null,
|
|
128
133
|
|
|
129
134
|
step: "loading",
|
|
130
135
|
|
|
@@ -134,9 +139,15 @@ const BaseStore = createStore<State>()(
|
|
|
134
139
|
pr: {},
|
|
135
140
|
|
|
136
141
|
actions: {
|
|
137
|
-
exit(code,
|
|
142
|
+
exit(code, args) {
|
|
138
143
|
set((state) => {
|
|
139
|
-
|
|
144
|
+
if (args?.quiet ?? code === 0) {
|
|
145
|
+
state.exit_mode = "quiet";
|
|
146
|
+
} else {
|
|
147
|
+
state.exit_mode = "normal";
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
let clear = args?.clear ?? true;
|
|
140
151
|
|
|
141
152
|
const node = <Exit clear={clear} code={code} />;
|
|
142
153
|
state.mutate.output(state, { node });
|
package/src/commands/Fixup.tsx
CHANGED
package/src/commands/Log.tsx
CHANGED
|
@@ -11,17 +11,27 @@ type Props = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export function ExitingGate(props: Props) {
|
|
14
|
-
const
|
|
14
|
+
const exit_mode = Store.useState((state) => state.exit_mode);
|
|
15
15
|
|
|
16
|
-
if (!
|
|
16
|
+
if (!exit_mode) {
|
|
17
17
|
return props.children;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
switch (exit_mode) {
|
|
21
|
+
case "quiet":
|
|
22
|
+
return null;
|
|
23
|
+
|
|
24
|
+
case "normal":
|
|
25
|
+
return (
|
|
26
|
+
<Ink.Box flexDirection="column">
|
|
27
|
+
<Ink.Text color={colors.red}>
|
|
28
|
+
<FormatText message="🚨 Exiting…" />
|
|
29
|
+
</Ink.Text>
|
|
30
|
+
</Ink.Box>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
default:
|
|
34
|
+
exit_mode satisfies never;
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
27
37
|
}
|
|
@@ -6,7 +6,8 @@ import * as github from "~/core/github";
|
|
|
6
6
|
export type CommitMetadata = Awaited<ReturnType<typeof commit>>;
|
|
7
7
|
export type CommitRange = Awaited<ReturnType<typeof range>>;
|
|
8
8
|
|
|
9
|
-
type
|
|
9
|
+
type GithubPRStatus = ReturnType<typeof github.pr_status>;
|
|
10
|
+
type PullRequest = NonNullable<Awaited<GithubPRStatus>>;
|
|
10
11
|
|
|
11
12
|
type CommitGroup = {
|
|
12
13
|
id: string;
|
|
@@ -93,15 +94,31 @@ export async function range(commit_group_map?: CommitGroupMap) {
|
|
|
93
94
|
const group_list = [];
|
|
94
95
|
let unassigned_group;
|
|
95
96
|
|
|
97
|
+
// collect github pr status in parallel
|
|
98
|
+
const pr_status_promise_list: Record<string, GithubPRStatus> = {};
|
|
99
|
+
for (const group of group_value_list) {
|
|
100
|
+
if (group.id !== UNASSIGNED) {
|
|
101
|
+
pr_status_promise_list[group.id] = github.pr_status(group.id);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
await Promise.all(Array.from(Object.values(pr_status_promise_list)));
|
|
106
|
+
|
|
107
|
+
for (const [group_id, pr_status_promise] of Object.entries(pr_status_promise_list)) {
|
|
108
|
+
const pr_status = await pr_status_promise;
|
|
109
|
+
if (pr_status) {
|
|
110
|
+
pr_lookup[group_id] = pr_status;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
96
114
|
for (let i = 0; i < group_value_list.length; i++) {
|
|
97
115
|
const group = group_value_list[i];
|
|
98
116
|
|
|
99
117
|
if (group.id !== UNASSIGNED) {
|
|
100
|
-
|
|
118
|
+
let pr_result = pr_lookup[group.id];
|
|
101
119
|
|
|
102
120
|
if (pr_result && pr_result.state !== "CLOSED") {
|
|
103
121
|
group.pr = pr_result;
|
|
104
|
-
pr_lookup[group.id] = pr_result;
|
|
105
122
|
}
|
|
106
123
|
}
|
|
107
124
|
|
package/src/core/github.tsx
CHANGED
|
@@ -68,7 +68,7 @@ export async function pr_status(branch: string): Promise<null | PullRequest> {
|
|
|
68
68
|
|
|
69
69
|
if (cache) {
|
|
70
70
|
if (actions.isDebug()) {
|
|
71
|
-
actions.
|
|
71
|
+
actions.debug(
|
|
72
72
|
<Ink.Text>
|
|
73
73
|
<Ink.Text dimColor>Github pr_status cache</Ink.Text>
|
|
74
74
|
<Ink.Text> </Ink.Text>
|
|
@@ -85,7 +85,7 @@ export async function pr_status(branch: string): Promise<null | PullRequest> {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
if (actions.isDebug()) {
|
|
88
|
-
actions.
|
|
88
|
+
actions.debug(
|
|
89
89
|
<Ink.Text>
|
|
90
90
|
<Ink.Text dimColor>Github pr_status cache</Ink.Text>
|
|
91
91
|
<Ink.Text> </Ink.Text>
|