git-stack-cli 2.5.2 → 2.6.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/dist/js/index.js +259 -142
- package/package.json +2 -2
- package/src/app/App.tsx +11 -4
- package/src/app/AutoUpdate.tsx +19 -5
- package/src/app/ManualRebase.tsx +5 -0
- package/src/app/MultiSelect.tsx +7 -4
- package/src/app/SelectCommitRanges.tsx +232 -117
- package/src/app/SyncGithub.tsx +9 -4
- package/src/app/TextInput.tsx +8 -1
- package/src/command.ts +6 -7
- package/src/commands/Update.tsx +15 -0
- package/src/core/CommitMetadata.ts +6 -5
- package/src/core/GitReviseTodo.test.ts +197 -2
- package/src/core/GitReviseTodo.ts +20 -17
- package/src/core/Metadata.test.ts +2 -2
package/dist/js/index.js
CHANGED
|
@@ -28098,7 +28098,7 @@ var require_last = __commonJS((exports, module) => {
|
|
|
28098
28098
|
});
|
|
28099
28099
|
|
|
28100
28100
|
// src/index.tsx
|
|
28101
|
-
var
|
|
28101
|
+
var React56 = __toESM(require_react(), 1);
|
|
28102
28102
|
import fs12 from "node:fs/promises";
|
|
28103
28103
|
import path9 from "node:path";
|
|
28104
28104
|
|
|
@@ -31935,7 +31935,7 @@ var import_react20 = __toESM(require_react(), 1);
|
|
|
31935
31935
|
// node_modules/.pnpm/ink-cjs@4.4.1_@types+react@18.2.33_react-devtools-core@4.19.1_react@18.2.0/node_modules/ink-cjs/build/hooks/use-focus-manager.js
|
|
31936
31936
|
var import_react21 = __toESM(require_react(), 1);
|
|
31937
31937
|
// src/app/App.tsx
|
|
31938
|
-
var
|
|
31938
|
+
var React55 = __toESM(require_react(), 1);
|
|
31939
31939
|
|
|
31940
31940
|
// src/app/AutoUpdate.tsx
|
|
31941
31941
|
var React18 = __toESM(require_react(), 1);
|
|
@@ -37445,12 +37445,13 @@ function AutoUpdate(props) {
|
|
|
37445
37445
|
let status2 = "done";
|
|
37446
37446
|
let latest_version = null;
|
|
37447
37447
|
let is_brew_bun_standalone = false;
|
|
37448
|
-
const local_version = "2.
|
|
37448
|
+
const local_version = "2.6.0";
|
|
37449
|
+
const is_output = props_ref.current.verbose || props_ref.current.force;
|
|
37449
37450
|
async function auto_update() {
|
|
37450
37451
|
if (!local_version) {
|
|
37451
37452
|
throw new Error("Auto update requires process.env.CLI_VERSION to be set");
|
|
37452
37453
|
}
|
|
37453
|
-
if (
|
|
37454
|
+
if (is_output) {
|
|
37454
37455
|
handle_output(/* @__PURE__ */ React18.createElement(Text, {
|
|
37455
37456
|
key: "init"
|
|
37456
37457
|
}, "Checking for latest version..."));
|
|
@@ -37496,8 +37497,10 @@ function AutoUpdate(props) {
|
|
|
37496
37497
|
}));
|
|
37497
37498
|
}
|
|
37498
37499
|
const semver_result = semver_compare(latest_version, local_version);
|
|
37499
|
-
status2 = "prompt";
|
|
37500
37500
|
if (semver_result === 0) {
|
|
37501
|
+
if (is_output) {
|
|
37502
|
+
handle_output(/* @__PURE__ */ React18.createElement(Text, null, "✅ Everything up to date. ", /* @__PURE__ */ React18.createElement(Brackets, null, latest_version)));
|
|
37503
|
+
}
|
|
37501
37504
|
return;
|
|
37502
37505
|
}
|
|
37503
37506
|
if (semver_result === -1) {
|
|
@@ -37531,14 +37534,20 @@ function AutoUpdate(props) {
|
|
|
37531
37534
|
if (state.is_brew_bun_standalone) {
|
|
37532
37535
|
install_command = `npm install -g ${props.name}@latest`;
|
|
37533
37536
|
} else {
|
|
37534
|
-
install_command =
|
|
37537
|
+
install_command = "brew upgrade magus/git-stack/git-stack";
|
|
37535
37538
|
}
|
|
37536
37539
|
return /* @__PURE__ */ React18.createElement(YesNoPrompt, {
|
|
37537
37540
|
message: /* @__PURE__ */ React18.createElement(Box_default, {
|
|
37538
37541
|
flexDirection: "column"
|
|
37539
37542
|
}, /* @__PURE__ */ React18.createElement(Text, {
|
|
37540
37543
|
color: colors.yellow
|
|
37541
|
-
},
|
|
37544
|
+
}, /* @__PURE__ */ React18.createElement(FormatText, {
|
|
37545
|
+
wrapper: /* @__PURE__ */ React18.createElement(Text, null),
|
|
37546
|
+
message: "New version available {latest_version}, would you like to update?",
|
|
37547
|
+
values: {
|
|
37548
|
+
latest_version: /* @__PURE__ */ React18.createElement(Brackets, null, state.latest_version)
|
|
37549
|
+
}
|
|
37550
|
+
}), ","), /* @__PURE__ */ React18.createElement(Text, null, " "), /* @__PURE__ */ React18.createElement(Command, null, install_command), /* @__PURE__ */ React18.createElement(Text, null, " "), /* @__PURE__ */ React18.createElement(FormatText, {
|
|
37542
37551
|
wrapper: /* @__PURE__ */ React18.createElement(Text, {
|
|
37543
37552
|
color: colors.yellow
|
|
37544
37553
|
}),
|
|
@@ -38400,15 +38409,19 @@ function GitReviseTodo(args) {
|
|
|
38400
38409
|
GitReviseTodo.todo = function todo(args) {
|
|
38401
38410
|
const entry_list = [];
|
|
38402
38411
|
for (const commit2 of args.commit_list) {
|
|
38403
|
-
const id = commit2.branch_id;
|
|
38404
|
-
const title = commit2.title;
|
|
38405
|
-
invariant(id, "commit.branch_id must exist");
|
|
38406
|
-
invariant(title, "commit.title must exist");
|
|
38407
|
-
const metadata = { id, title };
|
|
38408
|
-
const unsafe_message_with_id = write(commit2.full_message, metadata);
|
|
38409
|
-
let message_with_id = unsafe_message_with_id;
|
|
38410
38412
|
const sha = commit2.sha.slice(0, 12);
|
|
38411
|
-
const entry_lines = [`++ pick ${sha}
|
|
38413
|
+
const entry_lines = [`++ pick ${sha}`];
|
|
38414
|
+
const id = commit2.branch_id;
|
|
38415
|
+
if (id == null || id === UNASSIGNED) {
|
|
38416
|
+
entry_lines.push(commit2.full_message);
|
|
38417
|
+
} else {
|
|
38418
|
+
const title = commit2.title;
|
|
38419
|
+
invariant(title, "commit.title must exist");
|
|
38420
|
+
const metadata = { id, title };
|
|
38421
|
+
const unsafe_message_with_id = write(commit2.full_message, metadata);
|
|
38422
|
+
const message_with_id = unsafe_message_with_id;
|
|
38423
|
+
entry_lines.push(message_with_id);
|
|
38424
|
+
}
|
|
38412
38425
|
const entry = entry_lines.join(`
|
|
38413
38426
|
`);
|
|
38414
38427
|
entry_list.push(entry);
|
|
@@ -39658,17 +39671,18 @@ function MultiSelect(props) {
|
|
|
39658
39671
|
let last_enabled;
|
|
39659
39672
|
for (let i2 = props.items.length - 1;i2 >= 0; i2--) {
|
|
39660
39673
|
const item = props.items[i2];
|
|
39661
|
-
if (
|
|
39662
|
-
|
|
39674
|
+
if (item.disabled) {
|
|
39675
|
+
continue;
|
|
39663
39676
|
}
|
|
39664
|
-
|
|
39677
|
+
last_enabled = i2;
|
|
39678
|
+
if (!item.selected) {
|
|
39665
39679
|
return i2;
|
|
39666
39680
|
}
|
|
39667
39681
|
}
|
|
39668
39682
|
if (is_finite_value(last_enabled)) {
|
|
39669
39683
|
return last_enabled;
|
|
39670
39684
|
}
|
|
39671
|
-
return 0;
|
|
39685
|
+
return props.startIndex || 0;
|
|
39672
39686
|
});
|
|
39673
39687
|
const selectRef = React41.useRef(false);
|
|
39674
39688
|
React41.useEffect(() => {
|
|
@@ -39816,7 +39830,13 @@ function TextInput(props) {
|
|
|
39816
39830
|
}, []);
|
|
39817
39831
|
use_input_default((input, key) => {
|
|
39818
39832
|
let next_value = value;
|
|
39819
|
-
if (key.
|
|
39833
|
+
if (key.escape) {
|
|
39834
|
+
if (value === "") {
|
|
39835
|
+
props.onCancel?.();
|
|
39836
|
+
} else {
|
|
39837
|
+
next_value = "";
|
|
39838
|
+
}
|
|
39839
|
+
} else if (key.backspace || key.delete) {
|
|
39820
39840
|
next_value = value.slice(0, -1);
|
|
39821
39841
|
} else if (key.return) {
|
|
39822
39842
|
props.onSubmit?.(next_value);
|
|
@@ -39889,9 +39909,12 @@ function SelectCommitRangesInternal(props) {
|
|
|
39889
39909
|
});
|
|
39890
39910
|
const group_list = [];
|
|
39891
39911
|
let unassigned_count = 0;
|
|
39912
|
+
let assigned_count = 0;
|
|
39892
39913
|
for (const [, group_id] of commit_map.entries()) {
|
|
39893
39914
|
if (group_id === null) {
|
|
39894
39915
|
unassigned_count++;
|
|
39916
|
+
} else {
|
|
39917
|
+
assigned_count++;
|
|
39895
39918
|
}
|
|
39896
39919
|
}
|
|
39897
39920
|
const total_group_count = new_group_list.length + props.commit_range.group_list.length;
|
|
@@ -39919,29 +39942,37 @@ function SelectCommitRangesInternal(props) {
|
|
|
39919
39942
|
if (current_index === -1) {
|
|
39920
39943
|
current_index = 0;
|
|
39921
39944
|
}
|
|
39945
|
+
const has_unassigned_commits = unassigned_count > 0;
|
|
39946
|
+
const has_assigned_commits = assigned_count > 0;
|
|
39947
|
+
const sync_status = detect_sync_status();
|
|
39922
39948
|
use_input_default((input, key) => {
|
|
39923
|
-
const
|
|
39924
|
-
|
|
39925
|
-
|
|
39949
|
+
const input_lower = input.toLowerCase();
|
|
39950
|
+
if (input_lower === SYMBOL.s) {
|
|
39951
|
+
if (group_input) {
|
|
39952
|
+
return;
|
|
39953
|
+
}
|
|
39954
|
+
if (sync_status === "disabled") {
|
|
39955
|
+
return;
|
|
39956
|
+
}
|
|
39926
39957
|
actions.set((state) => {
|
|
39927
|
-
|
|
39928
|
-
for (
|
|
39929
|
-
if (id) {
|
|
39930
|
-
|
|
39931
|
-
|
|
39932
|
-
|
|
39933
|
-
|
|
39958
|
+
const state_commit_map = {};
|
|
39959
|
+
for (let [sha, id] of commit_map.entries()) {
|
|
39960
|
+
if (!id) {
|
|
39961
|
+
id = props.commit_range.UNASSIGNED;
|
|
39962
|
+
const title = "allow_unassigned";
|
|
39963
|
+
state_commit_map[sha] = { id, title };
|
|
39964
|
+
continue;
|
|
39934
39965
|
}
|
|
39966
|
+
const group2 = group_list.find((g2) => g2.id === id);
|
|
39967
|
+
invariant(group2, "group must exist");
|
|
39968
|
+
state_commit_map[sha] = group2;
|
|
39935
39969
|
}
|
|
39936
|
-
|
|
39937
|
-
|
|
39938
|
-
state.step = "pre-manual-rebase";
|
|
39939
|
-
break;
|
|
39940
|
-
}
|
|
39970
|
+
state.commit_map = state_commit_map;
|
|
39971
|
+
state.step = "pre-manual-rebase";
|
|
39941
39972
|
});
|
|
39942
39973
|
return;
|
|
39943
39974
|
}
|
|
39944
|
-
if (
|
|
39975
|
+
if (has_unassigned_commits && input_lower === SYMBOL.c) {
|
|
39945
39976
|
set_group_input(true);
|
|
39946
39977
|
return;
|
|
39947
39978
|
}
|
|
@@ -39959,12 +39990,17 @@ function SelectCommitRangesInternal(props) {
|
|
|
39959
39990
|
const group = group_list[current_index];
|
|
39960
39991
|
const multiselect_disabled = group_input;
|
|
39961
39992
|
const multiselect_disableSelect = group.id === props.commit_range.UNASSIGNED;
|
|
39993
|
+
const max_width = 80;
|
|
39994
|
+
const [focused, set_focused] = React43.useState("");
|
|
39995
|
+
const has_groups = group.id !== props.commit_range.UNASSIGNED;
|
|
39962
39996
|
const items = props.commit_range.commit_list.map((commit2) => {
|
|
39963
39997
|
const commit_metadata_id = commit_map.get(commit2.sha);
|
|
39964
39998
|
const selected = commit_metadata_id !== null;
|
|
39965
39999
|
let disabled;
|
|
39966
40000
|
if (group_input) {
|
|
39967
40001
|
disabled = true;
|
|
40002
|
+
} else if (!has_groups) {
|
|
40003
|
+
disabled = true;
|
|
39968
40004
|
} else {
|
|
39969
40005
|
disabled = Boolean(selected && commit_metadata_id !== group.id);
|
|
39970
40006
|
}
|
|
@@ -39976,24 +40012,84 @@ function SelectCommitRangesInternal(props) {
|
|
|
39976
40012
|
};
|
|
39977
40013
|
});
|
|
39978
40014
|
items.reverse();
|
|
39979
|
-
const left_arrow = `${SYMBOL.left} `;
|
|
39980
|
-
const right_arrow = ` ${SYMBOL.right}`;
|
|
39981
|
-
const group_position = `(${current_index + 1}/${group_list.length}) `;
|
|
39982
|
-
const max_group_label_width = 80;
|
|
39983
|
-
let group_title_width = max_group_label_width;
|
|
39984
|
-
group_title_width -= group_position.length;
|
|
39985
|
-
group_title_width -= left_arrow.length + right_arrow.length;
|
|
39986
|
-
group_title_width = Math.min(group.title.length, group_title_width);
|
|
39987
|
-
let max_item_width = max_group_label_width;
|
|
39988
|
-
max_item_width -= left_arrow.length + right_arrow.length;
|
|
39989
|
-
const [focused, set_focused] = React43.useState("");
|
|
39990
40015
|
return /* @__PURE__ */ React43.createElement(Box_default, {
|
|
39991
40016
|
flexDirection: "column"
|
|
39992
40017
|
}, /* @__PURE__ */ React43.createElement(Box_default, {
|
|
39993
40018
|
height: 1
|
|
40019
|
+
}), has_groups || group_input ? null : /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40020
|
+
flexDirection: "column"
|
|
40021
|
+
}, /* @__PURE__ */ React43.createElement(Text, {
|
|
40022
|
+
bold: true,
|
|
40023
|
+
color: colors.blue
|
|
40024
|
+
}, "\uD83D\uDC4B Welcome to ", /* @__PURE__ */ React43.createElement(Command, null, "git stack"), "!"), /* @__PURE__ */ React43.createElement(Text, {
|
|
40025
|
+
color: colors.blue
|
|
40026
|
+
}, /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40027
|
+
message: "Press {c} to {create} a new PR group",
|
|
40028
|
+
values: {
|
|
40029
|
+
c: /* @__PURE__ */ React43.createElement(Text, {
|
|
40030
|
+
bold: true,
|
|
40031
|
+
color: colors.green
|
|
40032
|
+
}, "c"),
|
|
40033
|
+
create: /* @__PURE__ */ React43.createElement(Text, {
|
|
40034
|
+
bold: true,
|
|
40035
|
+
color: colors.green
|
|
40036
|
+
}, /* @__PURE__ */ React43.createElement(Parens, null, "c"), "reate")
|
|
40037
|
+
}
|
|
40038
|
+
}))), !has_groups || group_input ? null : /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40039
|
+
width: max_width,
|
|
40040
|
+
flexDirection: "row"
|
|
40041
|
+
}, /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40042
|
+
flexDirection: "row"
|
|
40043
|
+
}, /* @__PURE__ */ React43.createElement(Text, {
|
|
40044
|
+
bold: true,
|
|
40045
|
+
color: colors.green
|
|
40046
|
+
}, SYMBOL.left), /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40047
|
+
width: 1
|
|
40048
|
+
}), /* @__PURE__ */ React43.createElement(Text, {
|
|
40049
|
+
color: colors.gray
|
|
40050
|
+
}, "Pull request"), /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40051
|
+
width: 1
|
|
40052
|
+
}), /* @__PURE__ */ React43.createElement(Text, {
|
|
40053
|
+
color: colors.gray
|
|
40054
|
+
}, `(${current_index + 1}/${group_list.length})`), /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40055
|
+
width: 1
|
|
40056
|
+
}), /* @__PURE__ */ React43.createElement(Text, {
|
|
40057
|
+
bold: true,
|
|
40058
|
+
color: colors.green
|
|
40059
|
+
}, SYMBOL.right))), /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40060
|
+
width: max_width
|
|
40061
|
+
}, /* @__PURE__ */ React43.createElement(Text, {
|
|
40062
|
+
wrap: "truncate-end",
|
|
40063
|
+
bold: true,
|
|
40064
|
+
color: colors.green
|
|
40065
|
+
}, group.title))), !group_input ? null : /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40066
|
+
height: 1
|
|
40067
|
+
}), /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40068
|
+
wrapper: /* @__PURE__ */ React43.createElement(Text, {
|
|
40069
|
+
color: colors.gray
|
|
40070
|
+
}),
|
|
40071
|
+
message: "Enter a title for the PR {note}",
|
|
40072
|
+
values: {
|
|
40073
|
+
note: /* @__PURE__ */ React43.createElement(Parens, null, /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40074
|
+
message: "press {enter} to submit",
|
|
40075
|
+
values: {
|
|
40076
|
+
enter: /* @__PURE__ */ React43.createElement(Text, {
|
|
40077
|
+
bold: true,
|
|
40078
|
+
color: colors.green
|
|
40079
|
+
}, SYMBOL.enter)
|
|
40080
|
+
}
|
|
40081
|
+
}))
|
|
40082
|
+
}
|
|
40083
|
+
}), /* @__PURE__ */ React43.createElement(TextInput, {
|
|
40084
|
+
defaultValue: focused,
|
|
40085
|
+
onSubmit: submit_group_input,
|
|
40086
|
+
onCancel: () => set_group_input(false)
|
|
40087
|
+
})), /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40088
|
+
height: 1
|
|
39994
40089
|
}), /* @__PURE__ */ React43.createElement(MultiSelect, {
|
|
40090
|
+
startIndex: items.length - 1,
|
|
39995
40091
|
items,
|
|
39996
|
-
maxWidth:
|
|
40092
|
+
maxWidth: max_width,
|
|
39997
40093
|
disabled: multiselect_disabled,
|
|
39998
40094
|
disableSelect: multiselect_disableSelect,
|
|
39999
40095
|
onFocus: (args) => {
|
|
@@ -40011,26 +40107,23 @@ function SelectCommitRangesInternal(props) {
|
|
|
40011
40107
|
}
|
|
40012
40108
|
}), /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40013
40109
|
height: 1
|
|
40014
|
-
}), /* @__PURE__ */ React43.createElement(
|
|
40015
|
-
width: max_group_label_width,
|
|
40016
|
-
flexDirection: "row"
|
|
40017
|
-
}, /* @__PURE__ */ React43.createElement(Text, null, left_arrow), /* @__PURE__ */ React43.createElement(Text, null, group_position), /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40018
|
-
width: group_title_width,
|
|
40019
|
-
justifyContent: "center"
|
|
40020
|
-
}, /* @__PURE__ */ React43.createElement(Text, {
|
|
40021
|
-
wrap: "truncate-end"
|
|
40022
|
-
}, group.title)), /* @__PURE__ */ React43.createElement(Text, null, right_arrow)), /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40023
|
-
height: 1
|
|
40024
|
-
}), unassigned_count > 0 ? /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40110
|
+
}), has_unassigned_commits ? /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40025
40111
|
wrapper: /* @__PURE__ */ React43.createElement(Text, {
|
|
40026
40112
|
color: colors.gray
|
|
40027
40113
|
}),
|
|
40028
|
-
message: "{count} unassigned commits
|
|
40114
|
+
message: "{count} unassigned commits",
|
|
40029
40115
|
values: {
|
|
40030
40116
|
count: /* @__PURE__ */ React43.createElement(Text, {
|
|
40031
40117
|
color: colors.yellow,
|
|
40032
40118
|
bold: true
|
|
40033
|
-
}, unassigned_count)
|
|
40119
|
+
}, unassigned_count)
|
|
40120
|
+
}
|
|
40121
|
+
}), group_input ? null : /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40122
|
+
wrapper: /* @__PURE__ */ React43.createElement(Text, {
|
|
40123
|
+
color: colors.gray
|
|
40124
|
+
}),
|
|
40125
|
+
message: "Press {c} to {create} a new PR group",
|
|
40126
|
+
values: {
|
|
40034
40127
|
c: /* @__PURE__ */ React43.createElement(Text, {
|
|
40035
40128
|
bold: true,
|
|
40036
40129
|
color: colors.green
|
|
@@ -40040,55 +40133,26 @@ function SelectCommitRangesInternal(props) {
|
|
|
40040
40133
|
color: colors.green
|
|
40041
40134
|
}, /* @__PURE__ */ React43.createElement(Parens, null, "c"), "reate")
|
|
40042
40135
|
}
|
|
40043
|
-
})
|
|
40044
|
-
wrapper: /* @__PURE__ */ React43.createElement(Text, null),
|
|
40045
|
-
message: "\uD83C\uDF89 Done! Press {s} to {sync} the commits to Github",
|
|
40046
|
-
values: {
|
|
40047
|
-
s: /* @__PURE__ */ React43.createElement(Text, {
|
|
40048
|
-
bold: true,
|
|
40049
|
-
color: colors.green
|
|
40050
|
-
}, "s"),
|
|
40051
|
-
sync: /* @__PURE__ */ React43.createElement(Text, {
|
|
40052
|
-
bold: true,
|
|
40053
|
-
color: colors.green
|
|
40054
|
-
}, /* @__PURE__ */ React43.createElement(Parens, null, "s"), "ync")
|
|
40055
|
-
}
|
|
40056
|
-
}) : /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40057
|
-
wrapper: /* @__PURE__ */ React43.createElement(Text, null),
|
|
40058
|
-
message: "\uD83C\uDF89 Done! Press {s} to {save} the commits locally",
|
|
40059
|
-
values: {
|
|
40060
|
-
s: /* @__PURE__ */ React43.createElement(Text, {
|
|
40061
|
-
bold: true,
|
|
40062
|
-
color: colors.green
|
|
40063
|
-
}, "s"),
|
|
40064
|
-
save: /* @__PURE__ */ React43.createElement(Text, {
|
|
40065
|
-
bold: true,
|
|
40066
|
-
color: colors.green
|
|
40067
|
-
}, /* @__PURE__ */ React43.createElement(Parens, null, "s"), "save")
|
|
40068
|
-
}
|
|
40069
|
-
})), !group_input ? null : /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(Box_default, {
|
|
40070
|
-
height: 1
|
|
40071
|
-
}), /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40136
|
+
}), sync_status !== "allow_unassigned" ? null : /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40072
40137
|
wrapper: /* @__PURE__ */ React43.createElement(Text, {
|
|
40073
40138
|
color: colors.gray
|
|
40074
40139
|
}),
|
|
40075
|
-
message: "
|
|
40140
|
+
message: "Press {s} to {sync} the {count} assigned commits to Github",
|
|
40076
40141
|
values: {
|
|
40077
|
-
|
|
40078
|
-
|
|
40079
|
-
|
|
40080
|
-
|
|
40081
|
-
|
|
40082
|
-
color: colors.green
|
|
40083
|
-
}, SYMBOL.enter)
|
|
40084
|
-
}
|
|
40085
|
-
}))
|
|
40142
|
+
...S_TO_SYNC_VALUES,
|
|
40143
|
+
count: /* @__PURE__ */ React43.createElement(Text, {
|
|
40144
|
+
color: colors.yellow,
|
|
40145
|
+
bold: true
|
|
40146
|
+
}, assigned_count)
|
|
40086
40147
|
}
|
|
40087
|
-
}), /* @__PURE__ */ React43.createElement(
|
|
40088
|
-
|
|
40089
|
-
|
|
40090
|
-
|
|
40091
|
-
|
|
40148
|
+
})) : /* @__PURE__ */ React43.createElement(React43.Fragment, null, argv.sync ? /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40149
|
+
wrapper: /* @__PURE__ */ React43.createElement(Text, null),
|
|
40150
|
+
message: "\uD83C\uDF89 Done! Press {s} to {sync} the commits to Github",
|
|
40151
|
+
values: S_TO_SYNC_VALUES
|
|
40152
|
+
}) : /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40153
|
+
wrapper: /* @__PURE__ */ React43.createElement(Text, null),
|
|
40154
|
+
message: "\uD83C\uDF89 Done! Press {s} to {save} the commits locally",
|
|
40155
|
+
values: S_TO_SYNC_VALUES
|
|
40092
40156
|
})), /* @__PURE__ */ React43.createElement(Box_default, null, /* @__PURE__ */ React43.createElement(FormatText, {
|
|
40093
40157
|
wrapper: /* @__PURE__ */ React43.createElement(Text, {
|
|
40094
40158
|
color: colors.gray
|
|
@@ -40131,7 +40195,7 @@ function SelectCommitRangesInternal(props) {
|
|
|
40131
40195
|
wrapper: /* @__PURE__ */ React43.createElement(Text, {
|
|
40132
40196
|
dimColor: true
|
|
40133
40197
|
}),
|
|
40134
|
-
message: "Created new group {group} {note}",
|
|
40198
|
+
message: "Created new PR group {group} {note}",
|
|
40135
40199
|
values: {
|
|
40136
40200
|
group: /* @__PURE__ */ React43.createElement(Brackets, null, title),
|
|
40137
40201
|
note: /* @__PURE__ */ React43.createElement(Parens, null, id)
|
|
@@ -40141,11 +40205,49 @@ function SelectCommitRangesInternal(props) {
|
|
|
40141
40205
|
set_selected_group_id(id);
|
|
40142
40206
|
set_group_input(false);
|
|
40143
40207
|
}
|
|
40208
|
+
function detect_sync_status() {
|
|
40209
|
+
if (!has_unassigned_commits) {
|
|
40210
|
+
return "allow";
|
|
40211
|
+
}
|
|
40212
|
+
if (!has_assigned_commits) {
|
|
40213
|
+
return "disabled";
|
|
40214
|
+
}
|
|
40215
|
+
let allow_unassigned_sync = null;
|
|
40216
|
+
for (let i2 = 0;i2 < props.commit_range.commit_list.length; i2++) {
|
|
40217
|
+
const commit2 = props.commit_range.commit_list[i2];
|
|
40218
|
+
const group_id = commit_map.get(commit2.sha);
|
|
40219
|
+
if (allow_unassigned_sync === null) {
|
|
40220
|
+
if (group_id === null) {
|
|
40221
|
+
allow_unassigned_sync = true;
|
|
40222
|
+
}
|
|
40223
|
+
} else {
|
|
40224
|
+
if (group_id) {
|
|
40225
|
+
allow_unassigned_sync = false;
|
|
40226
|
+
}
|
|
40227
|
+
}
|
|
40228
|
+
}
|
|
40229
|
+
if (allow_unassigned_sync) {
|
|
40230
|
+
return "allow_unassigned";
|
|
40231
|
+
}
|
|
40232
|
+
return "disabled";
|
|
40233
|
+
}
|
|
40144
40234
|
}
|
|
40145
40235
|
var SYMBOL = {
|
|
40146
40236
|
left: "←",
|
|
40147
40237
|
right: "→",
|
|
40148
|
-
enter: "Enter"
|
|
40238
|
+
enter: "Enter",
|
|
40239
|
+
c: "c",
|
|
40240
|
+
s: "s"
|
|
40241
|
+
};
|
|
40242
|
+
var S_TO_SYNC_VALUES = {
|
|
40243
|
+
s: /* @__PURE__ */ React43.createElement(Text, {
|
|
40244
|
+
bold: true,
|
|
40245
|
+
color: colors.green
|
|
40246
|
+
}, "s"),
|
|
40247
|
+
sync: /* @__PURE__ */ React43.createElement(Text, {
|
|
40248
|
+
bold: true,
|
|
40249
|
+
color: colors.green
|
|
40250
|
+
}, /* @__PURE__ */ React43.createElement(Parens, null, "s"), "ync")
|
|
40149
40251
|
};
|
|
40150
40252
|
|
|
40151
40253
|
// src/app/SyncGithub.tsx
|
|
@@ -40298,15 +40400,15 @@ async function run9() {
|
|
|
40298
40400
|
git_push_command.push(target);
|
|
40299
40401
|
}
|
|
40300
40402
|
await cli(git_push_command);
|
|
40301
|
-
const pr_url_list =
|
|
40403
|
+
const pr_url_list = push_group_list.map(get_group_url);
|
|
40302
40404
|
const after_push_tasks = [];
|
|
40303
40405
|
for (const group of push_group_list) {
|
|
40304
40406
|
after_push_tasks.push(after_push({ group, pr_url_list }));
|
|
40305
40407
|
}
|
|
40306
40408
|
await Promise.all(after_push_tasks);
|
|
40307
40409
|
const update_pr_body_tasks = [];
|
|
40308
|
-
for (let i2 = 0;i2 <
|
|
40309
|
-
const group =
|
|
40410
|
+
for (let i2 = 0;i2 < push_group_list.length; i2++) {
|
|
40411
|
+
const group = push_group_list[i2];
|
|
40310
40412
|
const selected_url = pr_url_list[i2];
|
|
40311
40413
|
const task = update_pr_body({ group, selected_url, pr_url_list });
|
|
40312
40414
|
update_pr_body_tasks.push(task);
|
|
@@ -40334,7 +40436,9 @@ async function run9() {
|
|
|
40334
40436
|
break;
|
|
40335
40437
|
}
|
|
40336
40438
|
const group = commit_range.group_list[index];
|
|
40337
|
-
|
|
40439
|
+
if (group.id !== commit_range.UNASSIGNED) {
|
|
40440
|
+
push_group_list2.unshift(group);
|
|
40441
|
+
}
|
|
40338
40442
|
}
|
|
40339
40443
|
return push_group_list2;
|
|
40340
40444
|
}
|
|
@@ -40671,9 +40775,23 @@ async function run12(args) {
|
|
|
40671
40775
|
actions.exit(0);
|
|
40672
40776
|
}
|
|
40673
40777
|
|
|
40674
|
-
// src/
|
|
40778
|
+
// src/commands/Update.tsx
|
|
40675
40779
|
var React52 = __toESM(require_react(), 1);
|
|
40676
|
-
|
|
40780
|
+
function Update() {
|
|
40781
|
+
return /* @__PURE__ */ React52.createElement(Await, {
|
|
40782
|
+
fallback: null,
|
|
40783
|
+
function: run13
|
|
40784
|
+
});
|
|
40785
|
+
}
|
|
40786
|
+
async function run13() {
|
|
40787
|
+
const state = Store.getState();
|
|
40788
|
+
const actions = state.actions;
|
|
40789
|
+
actions.exit(0);
|
|
40790
|
+
}
|
|
40791
|
+
|
|
40792
|
+
// src/components/ErrorBoundary.tsx
|
|
40793
|
+
var React53 = __toESM(require_react(), 1);
|
|
40794
|
+
class ErrorBoundary extends React53.Component {
|
|
40677
40795
|
constructor(props) {
|
|
40678
40796
|
super(props);
|
|
40679
40797
|
this.state = {
|
|
@@ -40700,15 +40818,15 @@ class ErrorBoundary extends React52.Component {
|
|
|
40700
40818
|
return this.props.children;
|
|
40701
40819
|
}
|
|
40702
40820
|
const message = this.state.error.message;
|
|
40703
|
-
return /* @__PURE__ */
|
|
40821
|
+
return /* @__PURE__ */ React53.createElement(Box_default, {
|
|
40704
40822
|
flexDirection: "column",
|
|
40705
40823
|
gap: 0
|
|
40706
|
-
}, /* @__PURE__ */
|
|
40824
|
+
}, /* @__PURE__ */ React53.createElement(Text, {
|
|
40707
40825
|
color: colors.red
|
|
40708
|
-
}, /* @__PURE__ */
|
|
40826
|
+
}, /* @__PURE__ */ React53.createElement(FormatText, {
|
|
40709
40827
|
message: "\uD83D\uDEA8 Unhandled error {message}",
|
|
40710
40828
|
values: {
|
|
40711
|
-
message: /* @__PURE__ */
|
|
40829
|
+
message: /* @__PURE__ */ React53.createElement(Text, {
|
|
40712
40830
|
color: colors.gray
|
|
40713
40831
|
}, message)
|
|
40714
40832
|
}
|
|
@@ -40717,20 +40835,20 @@ class ErrorBoundary extends React52.Component {
|
|
|
40717
40835
|
_render_verbose() {
|
|
40718
40836
|
const store_state = Store.getState();
|
|
40719
40837
|
if (store_state.argv.verbose) {
|
|
40720
|
-
return /* @__PURE__ */
|
|
40838
|
+
return /* @__PURE__ */ React53.createElement(Text, {
|
|
40721
40839
|
color: colors.gray
|
|
40722
40840
|
}, this.state.component_stack);
|
|
40723
40841
|
}
|
|
40724
|
-
return /* @__PURE__ */
|
|
40842
|
+
return /* @__PURE__ */ React53.createElement(Text, {
|
|
40725
40843
|
color: colors.gray
|
|
40726
|
-
}, /* @__PURE__ */
|
|
40844
|
+
}, /* @__PURE__ */ React53.createElement(FormatText, {
|
|
40727
40845
|
message: "Try again with `--verbose` to see more information."
|
|
40728
40846
|
}));
|
|
40729
40847
|
}
|
|
40730
40848
|
}
|
|
40731
40849
|
|
|
40732
40850
|
// src/components/ExitingGate.tsx
|
|
40733
|
-
var
|
|
40851
|
+
var React54 = __toESM(require_react(), 1);
|
|
40734
40852
|
function ExitingGate(props) {
|
|
40735
40853
|
const exit_mode = Store.useState((state) => state.exit_mode);
|
|
40736
40854
|
if (!exit_mode) {
|
|
@@ -40740,11 +40858,11 @@ function ExitingGate(props) {
|
|
|
40740
40858
|
case "quiet":
|
|
40741
40859
|
return null;
|
|
40742
40860
|
case "normal":
|
|
40743
|
-
return /* @__PURE__ */
|
|
40861
|
+
return /* @__PURE__ */ React54.createElement(Box_default, {
|
|
40744
40862
|
flexDirection: "column"
|
|
40745
|
-
}, /* @__PURE__ */
|
|
40863
|
+
}, /* @__PURE__ */ React54.createElement(Text, {
|
|
40746
40864
|
color: colors.red
|
|
40747
|
-
}, /* @__PURE__ */
|
|
40865
|
+
}, /* @__PURE__ */ React54.createElement(FormatText, {
|
|
40748
40866
|
message: "\uD83D\uDEA8 Exiting…"
|
|
40749
40867
|
})));
|
|
40750
40868
|
default:
|
|
@@ -40757,32 +40875,37 @@ function App2() {
|
|
|
40757
40875
|
const actions = Store.useActions();
|
|
40758
40876
|
const ink = Store.useState((state) => state.ink);
|
|
40759
40877
|
const argv = Store.useState((state) => state.argv);
|
|
40760
|
-
if (!ink || !argv) {
|
|
40878
|
+
if (!ink || !argv || !argv.$0) {
|
|
40761
40879
|
return null;
|
|
40762
40880
|
}
|
|
40763
|
-
|
|
40881
|
+
const positional_list = new Set(argv["_"]);
|
|
40882
|
+
const is_update = positional_list.has("update") || positional_list.has("upgrade");
|
|
40883
|
+
return /* @__PURE__ */ React55.createElement(Providers, null, /* @__PURE__ */ React55.createElement(ErrorBoundary, null, /* @__PURE__ */ React55.createElement(Debug, null), /* @__PURE__ */ React55.createElement(Output2, null), /* @__PURE__ */ React55.createElement(ExitingGate, null, /* @__PURE__ */ React55.createElement(AutoUpdate, {
|
|
40764
40884
|
name: "git-stack-cli",
|
|
40765
|
-
verbose: argv.verbose
|
|
40766
|
-
|
|
40885
|
+
verbose: argv.verbose,
|
|
40886
|
+
force: is_update,
|
|
40887
|
+
timeoutMs: is_update ? 30 * 1000 : 2 * 1000,
|
|
40767
40888
|
onOutput: actions.output,
|
|
40768
40889
|
onDone: () => {
|
|
40769
|
-
if (
|
|
40890
|
+
if (is_update) {
|
|
40770
40891
|
actions.exit(0);
|
|
40771
40892
|
}
|
|
40772
40893
|
}
|
|
40773
|
-
}, /* @__PURE__ */
|
|
40894
|
+
}, /* @__PURE__ */ React55.createElement(VerboseDebugInfo, null, /* @__PURE__ */ React55.createElement(RebaseCheck, null, /* @__PURE__ */ React55.createElement(CherryPickCheck, null, /* @__PURE__ */ React55.createElement(MaybeMain, null))))), /* @__PURE__ */ React55.createElement(HandleCtrlCSigint, null))));
|
|
40774
40895
|
}
|
|
40775
40896
|
function MaybeMain() {
|
|
40776
40897
|
const argv = Store.useState((state) => state.argv);
|
|
40777
40898
|
const positional_list = new Set(argv["_"]);
|
|
40778
40899
|
if (positional_list.has("fixup")) {
|
|
40779
|
-
return /* @__PURE__ */
|
|
40900
|
+
return /* @__PURE__ */ React55.createElement(Fixup, null);
|
|
40780
40901
|
} else if (positional_list.has("log")) {
|
|
40781
|
-
return /* @__PURE__ */
|
|
40902
|
+
return /* @__PURE__ */ React55.createElement(Log, null);
|
|
40903
|
+
} else if (positional_list.has("update")) {
|
|
40904
|
+
return /* @__PURE__ */ React55.createElement(Update, null);
|
|
40782
40905
|
} else if (positional_list.has("rebase")) {
|
|
40783
|
-
return /* @__PURE__ */
|
|
40906
|
+
return /* @__PURE__ */ React55.createElement(DependencyCheck, null, /* @__PURE__ */ React55.createElement(DirtyCheck, null, /* @__PURE__ */ React55.createElement(GatherMetadata, null, /* @__PURE__ */ React55.createElement(LocalCommitStatus, null, /* @__PURE__ */ React55.createElement(Rebase, null)))));
|
|
40784
40907
|
}
|
|
40785
|
-
return /* @__PURE__ */
|
|
40908
|
+
return /* @__PURE__ */ React55.createElement(React55.Fragment, null, !argv.verbose ? null : /* @__PURE__ */ React55.createElement(GithubApiError, null), /* @__PURE__ */ React55.createElement(DependencyCheck, null, /* @__PURE__ */ React55.createElement(DirtyCheck, null, /* @__PURE__ */ React55.createElement(GatherMetadata, null, /* @__PURE__ */ React55.createElement(LocalCommitStatus, null, /* @__PURE__ */ React55.createElement(DetectInitialPR, null, /* @__PURE__ */ React55.createElement(Main, null)))))));
|
|
40786
40909
|
}
|
|
40787
40910
|
|
|
40788
40911
|
// node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/lib/platform-shims/esm.mjs
|
|
@@ -45647,7 +45770,7 @@ var yargs_default = Yargs;
|
|
|
45647
45770
|
|
|
45648
45771
|
// src/command.ts
|
|
45649
45772
|
async function command2() {
|
|
45650
|
-
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.
|
|
45773
|
+
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).command(["update", "upgrade"], "Check and install the latest version of git stack", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.6.0").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
|
|
45651
45774
|
}
|
|
45652
45775
|
var GlobalOptions = {
|
|
45653
45776
|
verbose: {
|
|
@@ -45685,12 +45808,6 @@ var DefaultOptions = {
|
|
|
45685
45808
|
].join(`
|
|
45686
45809
|
`)
|
|
45687
45810
|
},
|
|
45688
|
-
update: {
|
|
45689
|
-
type: "boolean",
|
|
45690
|
-
alias: ["u", "upgrade"],
|
|
45691
|
-
default: false,
|
|
45692
|
-
description: "Check and install the latest version"
|
|
45693
|
-
},
|
|
45694
45811
|
branch: {
|
|
45695
45812
|
type: "string",
|
|
45696
45813
|
alias: ["b"],
|
|
@@ -45775,7 +45892,7 @@ var FixupOptions = {
|
|
|
45775
45892
|
});
|
|
45776
45893
|
const tmp_dir = await get_tmp_dir();
|
|
45777
45894
|
await fs12.rm(tmp_dir, { recursive: true });
|
|
45778
|
-
const ink = render_default(/* @__PURE__ */
|
|
45895
|
+
const ink = render_default(/* @__PURE__ */ React56.createElement(App2, null), {
|
|
45779
45896
|
exitOnCtrlC: false
|
|
45780
45897
|
});
|
|
45781
45898
|
Store.setState((state) => {
|