git-stack-cli 2.6.0 → 2.7.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 +25 -6
- package/dist/js/index.js +639 -528
- package/package.json +1 -1
- package/scripts/bun-build.ts +5 -0
- package/src/app/App.tsx +11 -5
- package/src/app/AutoUpdate.tsx +72 -54
- package/src/app/GatherMetadata.tsx +2 -24
- package/src/app/Main.tsx +0 -4
- package/src/app/MultiSelect.tsx +1 -8
- package/src/app/RequireBranch.tsx +67 -0
- package/src/app/SelectCommitRanges.tsx +9 -17
- package/src/app/Status.tsx +1 -5
- package/src/app/Store.tsx +2 -1
- package/src/command.ts +68 -50
- package/src/commands/Config.tsx +106 -0
- package/src/commands/Rebase.tsx +50 -36
- package/src/components/ColorTest.tsx +49 -0
- package/src/core/cli.ts +2 -0
- package/src/core/colors.ts +4 -2
- package/src/index.tsx +2 -2
- package/src/types/global.d.ts +1 -1
- package/src/app/PreSelectCommitRanges.tsx +0 -29
- package/src/core/gs_short_id.ts +0 -5
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 React57 = __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 React56 = __toESM(require_react(), 1);
|
|
31939
31939
|
|
|
31940
31940
|
// src/app/AutoUpdate.tsx
|
|
31941
31941
|
var React18 = __toESM(require_react(), 1);
|
|
@@ -31944,7 +31944,7 @@ var React18 = __toESM(require_react(), 1);
|
|
|
31944
31944
|
var React10 = __toESM(require_react(), 1);
|
|
31945
31945
|
|
|
31946
31946
|
// src/core/colors.ts
|
|
31947
|
-
var colors = {
|
|
31947
|
+
var colors = Object.freeze({
|
|
31948
31948
|
red: "rgb(248, 81, 73)",
|
|
31949
31949
|
green: "rgb(63, 185, 80)",
|
|
31950
31950
|
purple: "rgb(163, 113, 247)",
|
|
@@ -31952,8 +31952,9 @@ var colors = {
|
|
|
31952
31952
|
orange: "rgb(255, 166, 87)",
|
|
31953
31953
|
yellow: "rgb(234, 179, 8)",
|
|
31954
31954
|
gray: "rgb(110, 118, 129)",
|
|
31955
|
-
lightGray: "rgb(125, 133, 144)"
|
|
31956
|
-
|
|
31955
|
+
lightGray: "rgb(125, 133, 144)",
|
|
31956
|
+
white: "whiteBright"
|
|
31957
|
+
});
|
|
31957
31958
|
|
|
31958
31959
|
// src/app/Brackets.tsx
|
|
31959
31960
|
function Brackets(props) {
|
|
@@ -32061,6 +32062,11 @@ function YesNoPrompt(props) {
|
|
|
32061
32062
|
}, choices))));
|
|
32062
32063
|
}
|
|
32063
32064
|
|
|
32065
|
+
// src/core/assertNever.ts
|
|
32066
|
+
function assertNever(value) {
|
|
32067
|
+
console.error("[assertNever]", { value });
|
|
32068
|
+
}
|
|
32069
|
+
|
|
32064
32070
|
// src/core/cli.ts
|
|
32065
32071
|
import * as child from "node:child_process";
|
|
32066
32072
|
|
|
@@ -37053,6 +37059,7 @@ var BaseStore = createStore()(immer2((set2, get) => ({
|
|
|
37053
37059
|
master_branch: "origin/master",
|
|
37054
37060
|
head: null,
|
|
37055
37061
|
branch_name: null,
|
|
37062
|
+
merge_base: null,
|
|
37056
37063
|
commit_range: null,
|
|
37057
37064
|
commit_map: null,
|
|
37058
37065
|
pr_templates: [],
|
|
@@ -37279,6 +37286,7 @@ async function cli(unsafe_command, unsafe_options) {
|
|
|
37279
37286
|
function write_output(value) {
|
|
37280
37287
|
output += value;
|
|
37281
37288
|
state.actions.debug(value, id);
|
|
37289
|
+
options.onOutput?.(value);
|
|
37282
37290
|
}
|
|
37283
37291
|
childProcess.stdout?.on("data", (data) => {
|
|
37284
37292
|
const value = String(data);
|
|
@@ -37442,25 +37450,34 @@ function AutoUpdate(props) {
|
|
|
37442
37450
|
}
|
|
37443
37451
|
}
|
|
37444
37452
|
React18.useEffect(() => {
|
|
37445
|
-
|
|
37453
|
+
switch (state.status) {
|
|
37454
|
+
case "init":
|
|
37455
|
+
case "prompt":
|
|
37456
|
+
case "install":
|
|
37457
|
+
break;
|
|
37458
|
+
case "done": {
|
|
37459
|
+
props.onDone?.();
|
|
37460
|
+
break;
|
|
37461
|
+
}
|
|
37462
|
+
default:
|
|
37463
|
+
assertNever(state.status);
|
|
37464
|
+
}
|
|
37465
|
+
}, [state.status]);
|
|
37466
|
+
React18.useEffect(() => {
|
|
37467
|
+
let status2 = "init";
|
|
37446
37468
|
let latest_version = null;
|
|
37447
37469
|
let is_brew_bun_standalone = false;
|
|
37448
|
-
const local_version = "2.
|
|
37470
|
+
const local_version = "2.7.0";
|
|
37449
37471
|
const is_output = props_ref.current.verbose || props_ref.current.force;
|
|
37450
37472
|
async function auto_update() {
|
|
37451
37473
|
if (!local_version) {
|
|
37452
37474
|
throw new Error("Auto update requires process.env.CLI_VERSION to be set");
|
|
37453
37475
|
}
|
|
37454
|
-
if (is_output) {
|
|
37455
|
-
handle_output(/* @__PURE__ */ React18.createElement(Text, {
|
|
37456
|
-
key: "init"
|
|
37457
|
-
}, "Checking for latest version..."));
|
|
37458
|
-
}
|
|
37459
37476
|
const timeout_ms = is_finite_value(props.timeoutMs) ? props.timeoutMs : 2 * 1000;
|
|
37460
37477
|
const npm_json = await Promise.race([
|
|
37461
37478
|
fetch_json(`https://registry.npmjs.org/${props.name}`),
|
|
37462
37479
|
sleep(timeout_ms).then(() => {
|
|
37463
|
-
throw new Error("
|
|
37480
|
+
throw new Error("AutoUpdate timeout");
|
|
37464
37481
|
})
|
|
37465
37482
|
]);
|
|
37466
37483
|
latest_version = npm_json?.["dist-tags"]?.latest;
|
|
@@ -37497,32 +37514,37 @@ function AutoUpdate(props) {
|
|
|
37497
37514
|
}));
|
|
37498
37515
|
}
|
|
37499
37516
|
const semver_result = semver_compare(latest_version, local_version);
|
|
37517
|
+
if (props_ref.current.verbose) {
|
|
37518
|
+
handle_output(/* @__PURE__ */ React18.createElement(Text, {
|
|
37519
|
+
dimColor: true
|
|
37520
|
+
}, JSON.stringify({ semver_result })));
|
|
37521
|
+
}
|
|
37500
37522
|
if (semver_result === 0) {
|
|
37523
|
+
status2 = "done";
|
|
37501
37524
|
if (is_output) {
|
|
37502
37525
|
handle_output(/* @__PURE__ */ React18.createElement(Text, null, "✅ Everything up to date. ", /* @__PURE__ */ React18.createElement(Brackets, null, latest_version)));
|
|
37503
37526
|
}
|
|
37504
37527
|
return;
|
|
37505
37528
|
}
|
|
37506
|
-
if (semver_result ===
|
|
37507
|
-
|
|
37529
|
+
if (semver_result === 1) {
|
|
37530
|
+
status2 = "prompt";
|
|
37508
37531
|
}
|
|
37509
|
-
|
|
37532
|
+
throw new Error("AutoUpdate failed");
|
|
37510
37533
|
}
|
|
37511
37534
|
const onError = props_ref.current.onError || (() => {
|
|
37512
37535
|
});
|
|
37513
37536
|
auto_update().then(() => {
|
|
37514
37537
|
patch({ status: status2, local_version, latest_version, is_brew_bun_standalone });
|
|
37515
37538
|
}).catch((error) => {
|
|
37516
|
-
patch({ status: status2, error, local_version, latest_version, is_brew_bun_standalone });
|
|
37517
|
-
onError(error);
|
|
37518
37539
|
if (props_ref.current.verbose) {
|
|
37519
37540
|
handle_output(/* @__PURE__ */ React18.createElement(Text, {
|
|
37520
37541
|
key: "error",
|
|
37521
37542
|
color: colors.red
|
|
37522
37543
|
}, error?.message));
|
|
37523
37544
|
}
|
|
37524
|
-
|
|
37525
|
-
|
|
37545
|
+
status2 = "done";
|
|
37546
|
+
patch({ status: status2, error, local_version, latest_version, is_brew_bun_standalone });
|
|
37547
|
+
onError(error);
|
|
37526
37548
|
});
|
|
37527
37549
|
}, []);
|
|
37528
37550
|
const status = function render_status() {
|
|
@@ -37532,47 +37554,45 @@ function AutoUpdate(props) {
|
|
|
37532
37554
|
case "prompt": {
|
|
37533
37555
|
let install_command = "";
|
|
37534
37556
|
if (state.is_brew_bun_standalone) {
|
|
37535
|
-
install_command =
|
|
37557
|
+
install_command = "brew install magus/git-stack/git-stack";
|
|
37536
37558
|
} else {
|
|
37537
|
-
install_command =
|
|
37559
|
+
install_command = `npm install -g ${props.name}@latest`;
|
|
37538
37560
|
}
|
|
37539
37561
|
return /* @__PURE__ */ React18.createElement(YesNoPrompt, {
|
|
37540
37562
|
message: /* @__PURE__ */ React18.createElement(Box_default, {
|
|
37541
37563
|
flexDirection: "column"
|
|
37564
|
+
}, /* @__PURE__ */ React18.createElement(Box_default, {
|
|
37565
|
+
flexDirection: "column"
|
|
37542
37566
|
}, /* @__PURE__ */ React18.createElement(Text, {
|
|
37543
37567
|
color: colors.yellow
|
|
37544
37568
|
}, /* @__PURE__ */ React18.createElement(FormatText, {
|
|
37545
37569
|
wrapper: /* @__PURE__ */ React18.createElement(Text, null),
|
|
37546
|
-
message: "New version available {latest_version}
|
|
37570
|
+
message: "New version available {latest_version}",
|
|
37547
37571
|
values: {
|
|
37548
37572
|
latest_version: /* @__PURE__ */ React18.createElement(Brackets, null, state.latest_version)
|
|
37549
37573
|
}
|
|
37550
|
-
}), ","), /* @__PURE__ */ React18.createElement(Text, null, " "), /* @__PURE__ */ React18.createElement(Command, null, install_command), /* @__PURE__ */ React18.createElement(Text, null, " "), /* @__PURE__ */ React18.createElement(FormatText, {
|
|
37574
|
+
}), ","), /* @__PURE__ */ React18.createElement(Text, null, " "), /* @__PURE__ */ React18.createElement(Command, null, install_command), /* @__PURE__ */ React18.createElement(Text, null, " ")), /* @__PURE__ */ React18.createElement(Box_default, null, /* @__PURE__ */ React18.createElement(FormatText, {
|
|
37551
37575
|
wrapper: /* @__PURE__ */ React18.createElement(Text, {
|
|
37552
37576
|
color: colors.yellow
|
|
37553
37577
|
}),
|
|
37554
37578
|
message: "Would you like to run the above command to update?"
|
|
37555
|
-
})),
|
|
37579
|
+
}))),
|
|
37556
37580
|
onYes: async () => {
|
|
37557
|
-
handle_output(/* @__PURE__ */ React18.createElement(
|
|
37558
|
-
key: "install",
|
|
37559
|
-
wrapper: /* @__PURE__ */ React18.createElement(Text, null),
|
|
37560
|
-
message: "Installing {name}@{version}...",
|
|
37561
|
-
values: {
|
|
37562
|
-
name: /* @__PURE__ */ React18.createElement(Text, {
|
|
37563
|
-
color: colors.yellow
|
|
37564
|
-
}, props.name),
|
|
37565
|
-
version: /* @__PURE__ */ React18.createElement(Text, {
|
|
37566
|
-
color: colors.blue
|
|
37567
|
-
}, state.latest_version)
|
|
37568
|
-
}
|
|
37569
|
-
}));
|
|
37581
|
+
handle_output(/* @__PURE__ */ React18.createElement(Command, null, install_command));
|
|
37570
37582
|
patch({ status: "install" });
|
|
37571
|
-
await cli(install_command
|
|
37572
|
-
|
|
37583
|
+
await cli(install_command, {
|
|
37584
|
+
env: {
|
|
37585
|
+
...process.env,
|
|
37586
|
+
HOMEBREW_COLOR: "1"
|
|
37587
|
+
},
|
|
37588
|
+
onOutput: (data) => {
|
|
37589
|
+
handle_output(/* @__PURE__ */ React18.createElement(Text, null, data));
|
|
37590
|
+
}
|
|
37591
|
+
});
|
|
37573
37592
|
handle_output(/* @__PURE__ */ React18.createElement(Text, {
|
|
37574
37593
|
key: "done"
|
|
37575
|
-
}, "
|
|
37594
|
+
}, "✅ Installed ", /* @__PURE__ */ React18.createElement(Brackets, null, state.latest_version)));
|
|
37595
|
+
patch({ status: "done" });
|
|
37576
37596
|
},
|
|
37577
37597
|
onNo: () => {
|
|
37578
37598
|
patch({ status: "done" });
|
|
@@ -37581,8 +37601,6 @@ function AutoUpdate(props) {
|
|
|
37581
37601
|
}
|
|
37582
37602
|
case "install":
|
|
37583
37603
|
return null;
|
|
37584
|
-
case "exit":
|
|
37585
|
-
return null;
|
|
37586
37604
|
case "done":
|
|
37587
37605
|
return props.children;
|
|
37588
37606
|
}
|
|
@@ -38765,27 +38783,9 @@ async function run() {
|
|
|
38765
38783
|
}
|
|
38766
38784
|
}
|
|
38767
38785
|
actions.debug(`master_branch = ${master_branch}`);
|
|
38768
|
-
const branch_name = (await cli("git rev-parse --abbrev-ref HEAD")).stdout;
|
|
38769
|
-
if (branch_name === "HEAD") {
|
|
38770
|
-
actions.error("Must run within a branch.");
|
|
38771
|
-
actions.exit(0);
|
|
38772
|
-
return;
|
|
38773
|
-
}
|
|
38774
|
-
if (`origin/${branch_name}` === master_branch) {
|
|
38775
|
-
actions.error("Must run within a branch.");
|
|
38776
|
-
actions.exit(0);
|
|
38777
|
-
return;
|
|
38778
|
-
}
|
|
38779
38786
|
const head = (await cli("git rev-parse HEAD")).stdout;
|
|
38787
|
+
const branch_name = (await cli("git rev-parse --abbrev-ref HEAD")).stdout;
|
|
38780
38788
|
const merge_base = (await cli(`git merge-base HEAD ${master_branch}`)).stdout;
|
|
38781
|
-
if (head === merge_base) {
|
|
38782
|
-
actions.newline();
|
|
38783
|
-
actions.output(/* @__PURE__ */ React27.createElement(Text, {
|
|
38784
|
-
color: colors.gray
|
|
38785
|
-
}, "No changes detected."));
|
|
38786
|
-
actions.exit(0);
|
|
38787
|
-
return;
|
|
38788
|
-
}
|
|
38789
38789
|
const origin_url = (await cli(`git config --get remote.origin.url`)).stdout;
|
|
38790
38790
|
const repo_path = match_group(origin_url, RE5.repo_path, "repo_path");
|
|
38791
38791
|
const repo_root = (await cli(`git rev-parse --show-toplevel`)).stdout;
|
|
@@ -38795,6 +38795,7 @@ async function run() {
|
|
|
38795
38795
|
state.master_branch = master_branch;
|
|
38796
38796
|
state.head = head;
|
|
38797
38797
|
state.branch_name = branch_name;
|
|
38798
|
+
state.merge_base = merge_base;
|
|
38798
38799
|
});
|
|
38799
38800
|
} catch (err) {
|
|
38800
38801
|
actions.error("Unable to gather git metadata.");
|
|
@@ -38931,7 +38932,7 @@ async function run3() {
|
|
|
38931
38932
|
}
|
|
38932
38933
|
|
|
38933
38934
|
// src/app/Main.tsx
|
|
38934
|
-
var
|
|
38935
|
+
var React44 = __toESM(require_react(), 1);
|
|
38935
38936
|
|
|
38936
38937
|
// src/app/LocalMergeRebase.tsx
|
|
38937
38938
|
var React35 = __toESM(require_react(), 1);
|
|
@@ -39017,11 +39018,6 @@ function Container(props) {
|
|
|
39017
39018
|
}));
|
|
39018
39019
|
}
|
|
39019
39020
|
|
|
39020
|
-
// src/core/assertNever.ts
|
|
39021
|
-
function assertNever(value) {
|
|
39022
|
-
console.error("[assertNever]", { value });
|
|
39023
|
-
}
|
|
39024
|
-
|
|
39025
39021
|
// src/app/StatusTable.tsx
|
|
39026
39022
|
function StatusTable() {
|
|
39027
39023
|
const commit_range = Store.useState((state) => state.commit_range);
|
|
@@ -39169,11 +39165,7 @@ async function run4() {
|
|
|
39169
39165
|
Store.setState((state2) => {
|
|
39170
39166
|
state2.step = "pre-local-merge-rebase";
|
|
39171
39167
|
});
|
|
39172
|
-
} else if (needs_update) {
|
|
39173
|
-
Store.setState((state2) => {
|
|
39174
|
-
state2.step = "pre-select-commit-ranges";
|
|
39175
|
-
});
|
|
39176
|
-
} else if (argv.force) {
|
|
39168
|
+
} else if (needs_update || argv.force) {
|
|
39177
39169
|
Store.setState((state2) => {
|
|
39178
39170
|
state2.step = "select-commit-ranges";
|
|
39179
39171
|
});
|
|
@@ -39232,7 +39224,7 @@ function Rebase(props) {
|
|
|
39232
39224
|
return /* @__PURE__ */ React34.createElement(Await, {
|
|
39233
39225
|
fallback: /* @__PURE__ */ React34.createElement(Text, {
|
|
39234
39226
|
color: colors.yellow
|
|
39235
|
-
}, "Rebasing
|
|
39227
|
+
}, "Rebasing…"),
|
|
39236
39228
|
function: () => Rebase.run(props)
|
|
39237
39229
|
});
|
|
39238
39230
|
}
|
|
@@ -39254,12 +39246,50 @@ Rebase.run = async function run5(props) {
|
|
|
39254
39246
|
handle_exit2();
|
|
39255
39247
|
return 19;
|
|
39256
39248
|
});
|
|
39249
|
+
const master_branch_name = master_branch.replace(/^origin\//, "");
|
|
39257
39250
|
const temp_branch_name = `${branch_name}_${short_id()}`;
|
|
39258
39251
|
try {
|
|
39259
39252
|
process.chdir(repo_root);
|
|
39260
39253
|
await cli(`pwd`);
|
|
39261
|
-
const master_branch_name = master_branch.replace(/^origin\//, "");
|
|
39262
39254
|
await cli(`git fetch --no-tags -v origin ${master_branch_name}`);
|
|
39255
|
+
if (branch_name === master_branch_name) {
|
|
39256
|
+
await rebase_master();
|
|
39257
|
+
} else {
|
|
39258
|
+
await rebase_branch();
|
|
39259
|
+
}
|
|
39260
|
+
actions.unregister_abort_handler();
|
|
39261
|
+
} catch (err) {
|
|
39262
|
+
actions.error("Unable to rebase.");
|
|
39263
|
+
if (err instanceof Error) {
|
|
39264
|
+
actions.error(err.message);
|
|
39265
|
+
}
|
|
39266
|
+
actions.exit(20);
|
|
39267
|
+
}
|
|
39268
|
+
const next_commit_range = await range();
|
|
39269
|
+
actions.output(/* @__PURE__ */ React34.createElement(FormatText, {
|
|
39270
|
+
wrapper: /* @__PURE__ */ React34.createElement(Text, {
|
|
39271
|
+
color: colors.green
|
|
39272
|
+
}),
|
|
39273
|
+
message: "✅ {branch_name} in sync with {origin_branch}",
|
|
39274
|
+
values: {
|
|
39275
|
+
branch_name: /* @__PURE__ */ React34.createElement(Brackets, null, branch_name),
|
|
39276
|
+
origin_branch: /* @__PURE__ */ React34.createElement(Brackets, null, master_branch)
|
|
39277
|
+
}
|
|
39278
|
+
}));
|
|
39279
|
+
actions.set((state2) => {
|
|
39280
|
+
state2.commit_range = next_commit_range;
|
|
39281
|
+
});
|
|
39282
|
+
if (props.onComplete) {
|
|
39283
|
+
props.onComplete();
|
|
39284
|
+
} else {
|
|
39285
|
+
actions.output(/* @__PURE__ */ React34.createElement(Status, null));
|
|
39286
|
+
actions.exit(0);
|
|
39287
|
+
}
|
|
39288
|
+
async function rebase_master() {
|
|
39289
|
+
await cli(`git switch -C "${master_branch_name}" "${master_branch}"`);
|
|
39290
|
+
}
|
|
39291
|
+
async function rebase_branch() {
|
|
39292
|
+
invariant(commit_range, "commit_range must exist");
|
|
39263
39293
|
const master_sha = (await cli(`git rev-parse ${master_branch}`)).stdout;
|
|
39264
39294
|
const rebase_merge_base = master_sha;
|
|
39265
39295
|
await cli(`git checkout -b ${temp_branch_name} ${rebase_merge_base}`);
|
|
@@ -39306,33 +39336,6 @@ Rebase.run = async function run5(props) {
|
|
|
39306
39336
|
}
|
|
39307
39337
|
await cli(`git branch -f ${branch_name} ${temp_branch_name}`);
|
|
39308
39338
|
restore_git();
|
|
39309
|
-
actions.unregister_abort_handler();
|
|
39310
|
-
} catch (err) {
|
|
39311
|
-
actions.error("Unable to rebase.");
|
|
39312
|
-
if (err instanceof Error) {
|
|
39313
|
-
actions.error(err.message);
|
|
39314
|
-
}
|
|
39315
|
-
actions.exit(20);
|
|
39316
|
-
}
|
|
39317
|
-
const next_commit_range = await range();
|
|
39318
|
-
actions.output(/* @__PURE__ */ React34.createElement(FormatText, {
|
|
39319
|
-
wrapper: /* @__PURE__ */ React34.createElement(Text, {
|
|
39320
|
-
color: colors.green
|
|
39321
|
-
}),
|
|
39322
|
-
message: "✅ {branch_name} in sync with {origin_branch}",
|
|
39323
|
-
values: {
|
|
39324
|
-
branch_name: /* @__PURE__ */ React34.createElement(Brackets, null, branch_name),
|
|
39325
|
-
origin_branch: /* @__PURE__ */ React34.createElement(Brackets, null, master_branch)
|
|
39326
|
-
}
|
|
39327
|
-
}));
|
|
39328
|
-
actions.set((state2) => {
|
|
39329
|
-
state2.commit_range = next_commit_range;
|
|
39330
|
-
});
|
|
39331
|
-
if (props.onComplete) {
|
|
39332
|
-
props.onComplete();
|
|
39333
|
-
} else {
|
|
39334
|
-
actions.output(/* @__PURE__ */ React34.createElement(Status, null));
|
|
39335
|
-
actions.exit(0);
|
|
39336
39339
|
}
|
|
39337
39340
|
function restore_git() {
|
|
39338
39341
|
const spawn_options = { ignoreExitCode: true };
|
|
@@ -39598,34 +39601,11 @@ var PR_TEMPLATE = Object.freeze({
|
|
|
39598
39601
|
});
|
|
39599
39602
|
var PR_TEMPLATE_KEY_LIST = Object.keys(PR_TEMPLATE);
|
|
39600
39603
|
|
|
39601
|
-
// src/app/PreSelectCommitRanges.tsx
|
|
39602
|
-
var React40 = __toESM(require_react(), 1);
|
|
39603
|
-
function PreSelectCommitRanges() {
|
|
39604
|
-
const actions = Store.useActions();
|
|
39605
|
-
const argv = Store.useState((state) => state.argv);
|
|
39606
|
-
React40.useEffect(() => {
|
|
39607
|
-
if (argv.force) {
|
|
39608
|
-
Store.setState((state) => {
|
|
39609
|
-
state.step = "select-commit-ranges";
|
|
39610
|
-
});
|
|
39611
|
-
}
|
|
39612
|
-
}, [argv]);
|
|
39613
|
-
return /* @__PURE__ */ React40.createElement(YesNoPrompt, {
|
|
39614
|
-
message: "Some commits are new or outdated, would you like to select new commit ranges?",
|
|
39615
|
-
onYes: () => {
|
|
39616
|
-
actions.set((state) => {
|
|
39617
|
-
state.step = "select-commit-ranges";
|
|
39618
|
-
});
|
|
39619
|
-
},
|
|
39620
|
-
onNo: () => actions.exit(0)
|
|
39621
|
-
});
|
|
39622
|
-
}
|
|
39623
|
-
|
|
39624
39604
|
// src/app/SelectCommitRanges.tsx
|
|
39625
|
-
var
|
|
39605
|
+
var React42 = __toESM(require_react(), 1);
|
|
39626
39606
|
|
|
39627
39607
|
// src/app/MultiSelect.tsx
|
|
39628
|
-
var
|
|
39608
|
+
var React40 = __toESM(require_react(), 1);
|
|
39629
39609
|
|
|
39630
39610
|
// src/core/clamp.ts
|
|
39631
39611
|
function clamp(value, min, max) {
|
|
@@ -39648,7 +39628,7 @@ function wrap_index(value, list) {
|
|
|
39648
39628
|
|
|
39649
39629
|
// src/app/MultiSelect.tsx
|
|
39650
39630
|
function MultiSelect(props) {
|
|
39651
|
-
const [selected_set, select] =
|
|
39631
|
+
const [selected_set, select] = React40.useReducer((state, value) => {
|
|
39652
39632
|
const next = new Set(state);
|
|
39653
39633
|
if (next.has(value)) {
|
|
39654
39634
|
next.delete(value);
|
|
@@ -39664,7 +39644,7 @@ function MultiSelect(props) {
|
|
|
39664
39644
|
});
|
|
39665
39645
|
return set2;
|
|
39666
39646
|
});
|
|
39667
|
-
const [index, set_index] =
|
|
39647
|
+
const [index, set_index] = React40.useReducer((_, value) => {
|
|
39668
39648
|
const next_index = clamp(value, 0, props.items.length - 1);
|
|
39669
39649
|
return next_index;
|
|
39670
39650
|
}, 0, function find_initial_index() {
|
|
@@ -39684,8 +39664,8 @@ function MultiSelect(props) {
|
|
|
39684
39664
|
}
|
|
39685
39665
|
return props.startIndex || 0;
|
|
39686
39666
|
});
|
|
39687
|
-
const selectRef =
|
|
39688
|
-
|
|
39667
|
+
const selectRef = React40.useRef(false);
|
|
39668
|
+
React40.useEffect(() => {
|
|
39689
39669
|
if (!selectRef.current) {
|
|
39690
39670
|
return;
|
|
39691
39671
|
}
|
|
@@ -39695,7 +39675,7 @@ function MultiSelect(props) {
|
|
|
39695
39675
|
const state = selected_list.map((index2) => props.items[index2].value);
|
|
39696
39676
|
props.onSelect({ item, selected, state });
|
|
39697
39677
|
}, [selected_set]);
|
|
39698
|
-
|
|
39678
|
+
React40.useEffect(() => {
|
|
39699
39679
|
const item = props.items[index].value;
|
|
39700
39680
|
const selected_list = Array.from(selected_set);
|
|
39701
39681
|
const selected = selected_set.has(index);
|
|
@@ -39737,13 +39717,13 @@ function MultiSelect(props) {
|
|
|
39737
39717
|
}
|
|
39738
39718
|
}
|
|
39739
39719
|
});
|
|
39740
|
-
return /* @__PURE__ */
|
|
39720
|
+
return /* @__PURE__ */ React40.createElement(Box_default, {
|
|
39741
39721
|
flexDirection: "column"
|
|
39742
39722
|
}, props.items.map((item, i2) => {
|
|
39743
39723
|
const active = i2 === index;
|
|
39744
39724
|
const selected = selected_set.has(i2);
|
|
39745
39725
|
const disabled = item.disabled || false;
|
|
39746
|
-
return /* @__PURE__ */
|
|
39726
|
+
return /* @__PURE__ */ React40.createElement(ItemRow, {
|
|
39747
39727
|
key: i2,
|
|
39748
39728
|
label: item.label,
|
|
39749
39729
|
active,
|
|
@@ -39755,32 +39735,26 @@ function MultiSelect(props) {
|
|
|
39755
39735
|
}
|
|
39756
39736
|
function ItemRow(props) {
|
|
39757
39737
|
let color;
|
|
39758
|
-
let bold;
|
|
39759
39738
|
let underline;
|
|
39760
39739
|
let dimColor;
|
|
39761
39740
|
if (props.active) {
|
|
39762
39741
|
color = colors.blue;
|
|
39763
39742
|
underline = true;
|
|
39764
39743
|
}
|
|
39765
|
-
if (props.selected) {
|
|
39766
|
-
bold = true;
|
|
39767
|
-
}
|
|
39768
39744
|
if (props.disabled) {
|
|
39769
39745
|
color = "";
|
|
39770
|
-
bold = false;
|
|
39771
39746
|
underline = false;
|
|
39772
39747
|
dimColor = true;
|
|
39773
39748
|
}
|
|
39774
|
-
return /* @__PURE__ */
|
|
39749
|
+
return /* @__PURE__ */ React40.createElement(Box_default, {
|
|
39775
39750
|
flexDirection: "row",
|
|
39776
39751
|
gap: 1
|
|
39777
|
-
}, /* @__PURE__ */
|
|
39752
|
+
}, /* @__PURE__ */ React40.createElement(Radio, {
|
|
39778
39753
|
selected: props.selected,
|
|
39779
39754
|
disabled: props.disabled
|
|
39780
|
-
}), /* @__PURE__ */
|
|
39755
|
+
}), /* @__PURE__ */ React40.createElement(Box_default, {
|
|
39781
39756
|
width: props.maxWidth
|
|
39782
|
-
}, /* @__PURE__ */
|
|
39783
|
-
bold,
|
|
39757
|
+
}, /* @__PURE__ */ React40.createElement(Text, {
|
|
39784
39758
|
underline,
|
|
39785
39759
|
color,
|
|
39786
39760
|
dimColor,
|
|
@@ -39802,7 +39776,7 @@ function Radio(props) {
|
|
|
39802
39776
|
color = colors.gray;
|
|
39803
39777
|
dimColor = true;
|
|
39804
39778
|
}
|
|
39805
|
-
return /* @__PURE__ */
|
|
39779
|
+
return /* @__PURE__ */ React40.createElement(Text, {
|
|
39806
39780
|
bold: props.selected,
|
|
39807
39781
|
color,
|
|
39808
39782
|
dimColor
|
|
@@ -39810,14 +39784,14 @@ function Radio(props) {
|
|
|
39810
39784
|
}
|
|
39811
39785
|
|
|
39812
39786
|
// src/app/TextInput.tsx
|
|
39813
|
-
var
|
|
39787
|
+
var React41 = __toESM(require_react(), 1);
|
|
39814
39788
|
function TextInput(props) {
|
|
39815
|
-
const [value, set_value] =
|
|
39816
|
-
|
|
39789
|
+
const [value, set_value] = React41.useState(get_value(props));
|
|
39790
|
+
React41.useEffect(function sync_value_prop() {
|
|
39817
39791
|
set_value(get_value(props));
|
|
39818
39792
|
}, [props.value]);
|
|
39819
|
-
const [caret_visible, set_caret_visible] =
|
|
39820
|
-
|
|
39793
|
+
const [caret_visible, set_caret_visible] = React41.useState(false);
|
|
39794
|
+
React41.useEffect(function blink_caret() {
|
|
39821
39795
|
const interval_ms = 500;
|
|
39822
39796
|
let timeoutId = setTimeout(tick, interval_ms);
|
|
39823
39797
|
function tick() {
|
|
@@ -39855,12 +39829,12 @@ function TextInput(props) {
|
|
|
39855
39829
|
set_value(next_value);
|
|
39856
39830
|
props.onChange?.(next_value);
|
|
39857
39831
|
});
|
|
39858
|
-
return /* @__PURE__ */
|
|
39832
|
+
return /* @__PURE__ */ React41.createElement(Box_default, {
|
|
39859
39833
|
borderStyle: "single",
|
|
39860
39834
|
minHeight: 1,
|
|
39861
39835
|
borderColor: colors.yellow,
|
|
39862
39836
|
borderDimColor: true
|
|
39863
|
-
}, /* @__PURE__ */
|
|
39837
|
+
}, /* @__PURE__ */ React41.createElement(Text, null, value || ""), /* @__PURE__ */ React41.createElement(Text, {
|
|
39864
39838
|
color: colors.yellow,
|
|
39865
39839
|
dimColor: true,
|
|
39866
39840
|
inverse: caret_visible
|
|
@@ -39870,35 +39844,32 @@ function get_value(props) {
|
|
|
39870
39844
|
return props.value || props.defaultValue || "";
|
|
39871
39845
|
}
|
|
39872
39846
|
|
|
39873
|
-
// src/core/gs_short_id.ts
|
|
39874
|
-
function gs_short_id() {
|
|
39875
|
-
return `gs-${short_id()}`;
|
|
39876
|
-
}
|
|
39877
|
-
|
|
39878
39847
|
// src/app/SelectCommitRanges.tsx
|
|
39879
39848
|
function SelectCommitRanges() {
|
|
39880
39849
|
const commit_range = Store.useState((state) => state.commit_range);
|
|
39881
39850
|
invariant(commit_range, "commit_range must exist");
|
|
39882
|
-
return /* @__PURE__ */
|
|
39851
|
+
return /* @__PURE__ */ React42.createElement(SelectCommitRangesInternal, {
|
|
39883
39852
|
commit_range
|
|
39884
39853
|
});
|
|
39885
39854
|
}
|
|
39886
39855
|
function SelectCommitRangesInternal(props) {
|
|
39887
39856
|
const actions = Store.useActions();
|
|
39888
39857
|
const argv = Store.useState((state) => state.argv);
|
|
39889
|
-
const
|
|
39858
|
+
const branch_name = Store.useState((state) => state.branch_name);
|
|
39859
|
+
invariant(branch_name, "branch_name must exist");
|
|
39860
|
+
const [selected_group_id, set_selected_group_id] = React42.useState(() => {
|
|
39890
39861
|
const first_group = props.commit_range.group_list.find((g2) => g2.id !== props.commit_range.UNASSIGNED);
|
|
39891
39862
|
if (first_group) {
|
|
39892
39863
|
return first_group.id;
|
|
39893
39864
|
}
|
|
39894
39865
|
return props.commit_range.UNASSIGNED;
|
|
39895
39866
|
});
|
|
39896
|
-
const [group_input, set_group_input] =
|
|
39897
|
-
const [new_group_list, create_group] =
|
|
39867
|
+
const [group_input, set_group_input] = React42.useState(false);
|
|
39868
|
+
const [new_group_list, create_group] = React42.useReducer((group_list2, group2) => {
|
|
39898
39869
|
const next_group_list = group_list2.concat(group2);
|
|
39899
39870
|
return next_group_list;
|
|
39900
39871
|
}, []);
|
|
39901
|
-
const [commit_map, update_commit_map] =
|
|
39872
|
+
const [commit_map, update_commit_map] = React42.useReducer((map, args) => {
|
|
39902
39873
|
map.set(args.key, args.value);
|
|
39903
39874
|
return new Map(map);
|
|
39904
39875
|
}, new Map, (map) => {
|
|
@@ -39991,7 +39962,7 @@ function SelectCommitRangesInternal(props) {
|
|
|
39991
39962
|
const multiselect_disabled = group_input;
|
|
39992
39963
|
const multiselect_disableSelect = group.id === props.commit_range.UNASSIGNED;
|
|
39993
39964
|
const max_width = 80;
|
|
39994
|
-
const [focused, set_focused] =
|
|
39965
|
+
const [focused, set_focused] = React42.useState("");
|
|
39995
39966
|
const has_groups = group.id !== props.commit_range.UNASSIGNED;
|
|
39996
39967
|
const items = props.commit_range.commit_list.map((commit2) => {
|
|
39997
39968
|
const commit_metadata_id = commit_map.get(commit2.sha);
|
|
@@ -40012,81 +39983,81 @@ function SelectCommitRangesInternal(props) {
|
|
|
40012
39983
|
};
|
|
40013
39984
|
});
|
|
40014
39985
|
items.reverse();
|
|
40015
|
-
return /* @__PURE__ */
|
|
39986
|
+
return /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40016
39987
|
flexDirection: "column"
|
|
40017
|
-
}, /* @__PURE__ */
|
|
39988
|
+
}, /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40018
39989
|
height: 1
|
|
40019
|
-
}), has_groups || group_input ? null : /* @__PURE__ */
|
|
39990
|
+
}), has_groups || group_input ? null : /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40020
39991
|
flexDirection: "column"
|
|
40021
|
-
}, /* @__PURE__ */
|
|
39992
|
+
}, /* @__PURE__ */ React42.createElement(Text, {
|
|
40022
39993
|
bold: true,
|
|
40023
39994
|
color: colors.blue
|
|
40024
|
-
}, "\uD83D\uDC4B Welcome to ", /* @__PURE__ */
|
|
39995
|
+
}, "\uD83D\uDC4B Welcome to ", /* @__PURE__ */ React42.createElement(Command, null, "git stack"), "!"), /* @__PURE__ */ React42.createElement(Text, {
|
|
40025
39996
|
color: colors.blue
|
|
40026
|
-
}, /* @__PURE__ */
|
|
40027
|
-
message: "Press {c} to {create} a new PR
|
|
39997
|
+
}, /* @__PURE__ */ React42.createElement(FormatText, {
|
|
39998
|
+
message: "Press {c} to {create} a new PR",
|
|
40028
39999
|
values: {
|
|
40029
|
-
c: /* @__PURE__ */
|
|
40000
|
+
c: /* @__PURE__ */ React42.createElement(Text, {
|
|
40030
40001
|
bold: true,
|
|
40031
40002
|
color: colors.green
|
|
40032
40003
|
}, "c"),
|
|
40033
|
-
create: /* @__PURE__ */
|
|
40004
|
+
create: /* @__PURE__ */ React42.createElement(Text, {
|
|
40034
40005
|
bold: true,
|
|
40035
40006
|
color: colors.green
|
|
40036
|
-
}, /* @__PURE__ */
|
|
40007
|
+
}, /* @__PURE__ */ React42.createElement(Parens, null, "c"), "reate")
|
|
40037
40008
|
}
|
|
40038
|
-
}))), !has_groups || group_input ? null : /* @__PURE__ */
|
|
40009
|
+
}))), !has_groups || group_input ? null : /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40039
40010
|
width: max_width,
|
|
40040
40011
|
flexDirection: "row"
|
|
40041
|
-
}, /* @__PURE__ */
|
|
40012
|
+
}, /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40042
40013
|
flexDirection: "row"
|
|
40043
|
-
}, /* @__PURE__ */
|
|
40014
|
+
}, /* @__PURE__ */ React42.createElement(Text, {
|
|
40044
40015
|
bold: true,
|
|
40045
40016
|
color: colors.green
|
|
40046
|
-
}, SYMBOL.left), /* @__PURE__ */
|
|
40017
|
+
}, SYMBOL.left), /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40047
40018
|
width: 1
|
|
40048
|
-
}), /* @__PURE__ */
|
|
40019
|
+
}), /* @__PURE__ */ React42.createElement(Text, {
|
|
40049
40020
|
color: colors.gray
|
|
40050
|
-
}, "Pull request"), /* @__PURE__ */
|
|
40021
|
+
}, "Pull request"), /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40051
40022
|
width: 1
|
|
40052
|
-
}), /* @__PURE__ */
|
|
40023
|
+
}), /* @__PURE__ */ React42.createElement(Text, {
|
|
40053
40024
|
color: colors.gray
|
|
40054
|
-
}, `(${current_index + 1}/${group_list.length})`), /* @__PURE__ */
|
|
40025
|
+
}, `(${current_index + 1}/${group_list.length})`), /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40055
40026
|
width: 1
|
|
40056
|
-
}), /* @__PURE__ */
|
|
40027
|
+
}), /* @__PURE__ */ React42.createElement(Text, {
|
|
40057
40028
|
bold: true,
|
|
40058
40029
|
color: colors.green
|
|
40059
|
-
}, SYMBOL.right))), /* @__PURE__ */
|
|
40030
|
+
}, SYMBOL.right))), /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40060
40031
|
width: max_width
|
|
40061
|
-
}, /* @__PURE__ */
|
|
40032
|
+
}, /* @__PURE__ */ React42.createElement(Text, {
|
|
40062
40033
|
wrap: "truncate-end",
|
|
40063
40034
|
bold: true,
|
|
40064
|
-
color: colors.
|
|
40065
|
-
}, group.title))), !group_input ? null : /* @__PURE__ */
|
|
40035
|
+
color: colors.white
|
|
40036
|
+
}, group.title))), !group_input ? null : /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40066
40037
|
height: 1
|
|
40067
|
-
}), /* @__PURE__ */
|
|
40068
|
-
wrapper: /* @__PURE__ */
|
|
40038
|
+
}), /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40039
|
+
wrapper: /* @__PURE__ */ React42.createElement(Text, {
|
|
40069
40040
|
color: colors.gray
|
|
40070
40041
|
}),
|
|
40071
40042
|
message: "Enter a title for the PR {note}",
|
|
40072
40043
|
values: {
|
|
40073
|
-
note: /* @__PURE__ */
|
|
40044
|
+
note: /* @__PURE__ */ React42.createElement(Parens, null, /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40074
40045
|
message: "press {enter} to submit",
|
|
40075
40046
|
values: {
|
|
40076
|
-
enter: /* @__PURE__ */
|
|
40047
|
+
enter: /* @__PURE__ */ React42.createElement(Text, {
|
|
40077
40048
|
bold: true,
|
|
40078
40049
|
color: colors.green
|
|
40079
40050
|
}, SYMBOL.enter)
|
|
40080
40051
|
}
|
|
40081
40052
|
}))
|
|
40082
40053
|
}
|
|
40083
|
-
}), /* @__PURE__ */
|
|
40054
|
+
}), /* @__PURE__ */ React42.createElement(TextInput, {
|
|
40084
40055
|
defaultValue: focused,
|
|
40085
40056
|
onSubmit: submit_group_input,
|
|
40086
40057
|
onCancel: () => set_group_input(false)
|
|
40087
|
-
})), /* @__PURE__ */
|
|
40058
|
+
})), /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40088
40059
|
height: 1
|
|
40089
|
-
}), /* @__PURE__ */
|
|
40060
|
+
}), /* @__PURE__ */ React42.createElement(MultiSelect, {
|
|
40090
40061
|
startIndex: items.length - 1,
|
|
40091
40062
|
items,
|
|
40092
40063
|
maxWidth: max_width,
|
|
@@ -40105,100 +40076,94 @@ function SelectCommitRangesInternal(props) {
|
|
|
40105
40076
|
}
|
|
40106
40077
|
update_commit_map({ key, value });
|
|
40107
40078
|
}
|
|
40108
|
-
}), /* @__PURE__ */
|
|
40079
|
+
}), /* @__PURE__ */ React42.createElement(Box_default, {
|
|
40109
40080
|
height: 1
|
|
40110
|
-
}), has_unassigned_commits ? /* @__PURE__ */
|
|
40111
|
-
wrapper: /* @__PURE__ */
|
|
40081
|
+
}), has_unassigned_commits ? /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40082
|
+
wrapper: /* @__PURE__ */ React42.createElement(Text, {
|
|
40112
40083
|
color: colors.gray
|
|
40113
40084
|
}),
|
|
40114
40085
|
message: "{count} unassigned commits",
|
|
40115
40086
|
values: {
|
|
40116
|
-
count: /* @__PURE__ */
|
|
40087
|
+
count: /* @__PURE__ */ React42.createElement(Text, {
|
|
40117
40088
|
color: colors.yellow,
|
|
40118
40089
|
bold: true
|
|
40119
40090
|
}, unassigned_count)
|
|
40120
40091
|
}
|
|
40121
|
-
}), group_input ? null : /* @__PURE__ */
|
|
40122
|
-
wrapper: /* @__PURE__ */
|
|
40092
|
+
}), group_input ? null : /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40093
|
+
wrapper: /* @__PURE__ */ React42.createElement(Text, {
|
|
40123
40094
|
color: colors.gray
|
|
40124
40095
|
}),
|
|
40125
|
-
message: "Press {c} to {create} a new PR
|
|
40096
|
+
message: "Press {c} to {create} a new PR",
|
|
40126
40097
|
values: {
|
|
40127
|
-
c: /* @__PURE__ */
|
|
40098
|
+
c: /* @__PURE__ */ React42.createElement(Text, {
|
|
40128
40099
|
bold: true,
|
|
40129
40100
|
color: colors.green
|
|
40130
40101
|
}, "c"),
|
|
40131
|
-
create: /* @__PURE__ */
|
|
40102
|
+
create: /* @__PURE__ */ React42.createElement(Text, {
|
|
40132
40103
|
bold: true,
|
|
40133
40104
|
color: colors.green
|
|
40134
|
-
}, /* @__PURE__ */
|
|
40105
|
+
}, /* @__PURE__ */ React42.createElement(Parens, null, "c"), "reate")
|
|
40135
40106
|
}
|
|
40136
|
-
}), sync_status !== "allow_unassigned" ? null : /* @__PURE__ */
|
|
40137
|
-
wrapper: /* @__PURE__ */
|
|
40107
|
+
}), sync_status !== "allow_unassigned" ? null : /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40108
|
+
wrapper: /* @__PURE__ */ React42.createElement(Text, {
|
|
40138
40109
|
color: colors.gray
|
|
40139
40110
|
}),
|
|
40140
40111
|
message: "Press {s} to {sync} the {count} assigned commits to Github",
|
|
40141
40112
|
values: {
|
|
40142
40113
|
...S_TO_SYNC_VALUES,
|
|
40143
|
-
count: /* @__PURE__ */
|
|
40114
|
+
count: /* @__PURE__ */ React42.createElement(Text, {
|
|
40144
40115
|
color: colors.yellow,
|
|
40145
40116
|
bold: true
|
|
40146
40117
|
}, assigned_count)
|
|
40147
40118
|
}
|
|
40148
|
-
})) : /* @__PURE__ */
|
|
40149
|
-
wrapper: /* @__PURE__ */
|
|
40119
|
+
})) : /* @__PURE__ */ React42.createElement(React42.Fragment, null, argv.sync ? /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40120
|
+
wrapper: /* @__PURE__ */ React42.createElement(Text, null),
|
|
40150
40121
|
message: "\uD83C\uDF89 Done! Press {s} to {sync} the commits to Github",
|
|
40151
40122
|
values: S_TO_SYNC_VALUES
|
|
40152
|
-
}) : /* @__PURE__ */
|
|
40153
|
-
wrapper: /* @__PURE__ */
|
|
40123
|
+
}) : /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40124
|
+
wrapper: /* @__PURE__ */ React42.createElement(Text, null),
|
|
40154
40125
|
message: "\uD83C\uDF89 Done! Press {s} to {save} the commits locally",
|
|
40155
40126
|
values: S_TO_SYNC_VALUES
|
|
40156
|
-
})), /* @__PURE__ */
|
|
40157
|
-
wrapper: /* @__PURE__ */
|
|
40127
|
+
})), /* @__PURE__ */ React42.createElement(Box_default, null, /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40128
|
+
wrapper: /* @__PURE__ */ React42.createElement(Text, {
|
|
40158
40129
|
color: colors.gray
|
|
40159
40130
|
}),
|
|
40160
|
-
message: "Press {left} and {right} to view
|
|
40131
|
+
message: "Press {left} and {right} to view PRs",
|
|
40161
40132
|
values: {
|
|
40162
|
-
left: /* @__PURE__ */
|
|
40133
|
+
left: /* @__PURE__ */ React42.createElement(Text, {
|
|
40163
40134
|
bold: true,
|
|
40164
40135
|
color: colors.green
|
|
40165
40136
|
}, SYMBOL.left),
|
|
40166
|
-
right: /* @__PURE__ */
|
|
40137
|
+
right: /* @__PURE__ */ React42.createElement(Text, {
|
|
40167
40138
|
bold: true,
|
|
40168
40139
|
color: colors.green
|
|
40169
40140
|
}, SYMBOL.right)
|
|
40170
40141
|
}
|
|
40171
|
-
})), /* @__PURE__ */
|
|
40172
|
-
wrapper: /* @__PURE__ */
|
|
40142
|
+
})), /* @__PURE__ */ React42.createElement(Box_default, null, /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40143
|
+
wrapper: /* @__PURE__ */ React42.createElement(Text, {
|
|
40173
40144
|
color: colors.gray
|
|
40174
40145
|
}),
|
|
40175
40146
|
message: "Press {enter} to toggle commit selection",
|
|
40176
40147
|
values: {
|
|
40177
|
-
enter: /* @__PURE__ */
|
|
40148
|
+
enter: /* @__PURE__ */ React42.createElement(Text, {
|
|
40178
40149
|
bold: true,
|
|
40179
40150
|
color: colors.green
|
|
40180
40151
|
}, SYMBOL.enter)
|
|
40181
40152
|
}
|
|
40182
40153
|
})));
|
|
40183
40154
|
function get_group_id() {
|
|
40184
|
-
|
|
40185
|
-
if (argv["branch-prefix"]) {
|
|
40186
|
-
branch_prefix = argv["branch-prefix"];
|
|
40187
|
-
} else if (process.env.GIT_STACK_BRANCH_PREFIX) {
|
|
40188
|
-
branch_prefix = process.env.GIT_STACK_BRANCH_PREFIX;
|
|
40189
|
-
}
|
|
40190
|
-
return `${branch_prefix}${gs_short_id()}`;
|
|
40155
|
+
return `${branch_name}-${short_id()}`;
|
|
40191
40156
|
}
|
|
40192
40157
|
function submit_group_input(title) {
|
|
40193
40158
|
const id = get_group_id();
|
|
40194
|
-
actions.output(/* @__PURE__ */
|
|
40195
|
-
wrapper: /* @__PURE__ */
|
|
40159
|
+
actions.output(/* @__PURE__ */ React42.createElement(FormatText, {
|
|
40160
|
+
wrapper: /* @__PURE__ */ React42.createElement(Text, {
|
|
40196
40161
|
dimColor: true
|
|
40197
40162
|
}),
|
|
40198
|
-
message: "Created new PR
|
|
40163
|
+
message: "Created new PR {group} {note}",
|
|
40199
40164
|
values: {
|
|
40200
|
-
group: /* @__PURE__ */
|
|
40201
|
-
note: /* @__PURE__ */
|
|
40165
|
+
group: /* @__PURE__ */ React42.createElement(Brackets, null, title),
|
|
40166
|
+
note: /* @__PURE__ */ React42.createElement(Parens, null, id)
|
|
40202
40167
|
}
|
|
40203
40168
|
}));
|
|
40204
40169
|
create_group({ id, title });
|
|
@@ -40240,18 +40205,18 @@ var SYMBOL = {
|
|
|
40240
40205
|
s: "s"
|
|
40241
40206
|
};
|
|
40242
40207
|
var S_TO_SYNC_VALUES = {
|
|
40243
|
-
s: /* @__PURE__ */
|
|
40208
|
+
s: /* @__PURE__ */ React42.createElement(Text, {
|
|
40244
40209
|
bold: true,
|
|
40245
40210
|
color: colors.green
|
|
40246
40211
|
}, "s"),
|
|
40247
|
-
sync: /* @__PURE__ */
|
|
40212
|
+
sync: /* @__PURE__ */ React42.createElement(Text, {
|
|
40248
40213
|
bold: true,
|
|
40249
40214
|
color: colors.green
|
|
40250
|
-
}, /* @__PURE__ */
|
|
40215
|
+
}, /* @__PURE__ */ React42.createElement(Parens, null, "s"), "ync")
|
|
40251
40216
|
};
|
|
40252
40217
|
|
|
40253
40218
|
// src/app/SyncGithub.tsx
|
|
40254
|
-
var
|
|
40219
|
+
var React43 = __toESM(require_react(), 1);
|
|
40255
40220
|
var import_last = __toESM(require_last(), 1);
|
|
40256
40221
|
|
|
40257
40222
|
// src/core/StackSummaryTable.ts
|
|
@@ -40356,8 +40321,8 @@ var RE6 = {
|
|
|
40356
40321
|
|
|
40357
40322
|
// src/app/SyncGithub.tsx
|
|
40358
40323
|
function SyncGithub() {
|
|
40359
|
-
return /* @__PURE__ */
|
|
40360
|
-
fallback: /* @__PURE__ */
|
|
40324
|
+
return /* @__PURE__ */ React43.createElement(Await, {
|
|
40325
|
+
fallback: /* @__PURE__ */ React43.createElement(Text, {
|
|
40361
40326
|
color: colors.yellow
|
|
40362
40327
|
}, "Syncing…"),
|
|
40363
40328
|
function: run9
|
|
@@ -40515,25 +40480,23 @@ function Main() {
|
|
|
40515
40480
|
case "loading":
|
|
40516
40481
|
return null;
|
|
40517
40482
|
case "github-api-error":
|
|
40518
|
-
return /* @__PURE__ */
|
|
40483
|
+
return /* @__PURE__ */ React44.createElement(GithubApiError, null);
|
|
40519
40484
|
case "status":
|
|
40520
|
-
return /* @__PURE__ */
|
|
40485
|
+
return /* @__PURE__ */ React44.createElement(Status, null);
|
|
40521
40486
|
case "local-merge-rebase":
|
|
40522
|
-
return /* @__PURE__ */
|
|
40487
|
+
return /* @__PURE__ */ React44.createElement(LocalMergeRebase, null);
|
|
40523
40488
|
case "pre-local-merge-rebase":
|
|
40524
|
-
return /* @__PURE__ */
|
|
40525
|
-
case "pre-select-commit-ranges":
|
|
40526
|
-
return /* @__PURE__ */ React45.createElement(PreSelectCommitRanges, null);
|
|
40489
|
+
return /* @__PURE__ */ React44.createElement(PreLocalMergeRebase, null);
|
|
40527
40490
|
case "select-commit-ranges":
|
|
40528
|
-
return /* @__PURE__ */
|
|
40491
|
+
return /* @__PURE__ */ React44.createElement(SelectCommitRanges, null);
|
|
40529
40492
|
case "pre-manual-rebase":
|
|
40530
|
-
return /* @__PURE__ */
|
|
40493
|
+
return /* @__PURE__ */ React44.createElement(PreManualRebase, null);
|
|
40531
40494
|
case "manual-rebase":
|
|
40532
|
-
return /* @__PURE__ */
|
|
40495
|
+
return /* @__PURE__ */ React44.createElement(ManualRebase, null);
|
|
40533
40496
|
case "sync-github":
|
|
40534
|
-
return /* @__PURE__ */
|
|
40497
|
+
return /* @__PURE__ */ React44.createElement(SyncGithub, null);
|
|
40535
40498
|
case "post-rebase-status":
|
|
40536
|
-
return /* @__PURE__ */
|
|
40499
|
+
return /* @__PURE__ */ React44.createElement(PostRebaseStatus, null);
|
|
40537
40500
|
default:
|
|
40538
40501
|
assertNever(step);
|
|
40539
40502
|
return null;
|
|
@@ -40541,56 +40504,56 @@ function Main() {
|
|
|
40541
40504
|
}
|
|
40542
40505
|
|
|
40543
40506
|
// src/app/Output.tsx
|
|
40544
|
-
var
|
|
40507
|
+
var React45 = __toESM(require_react(), 1);
|
|
40545
40508
|
function Output2() {
|
|
40546
40509
|
const output = Store.useState((state) => state.output);
|
|
40547
40510
|
const pending_output = Store.useState((state) => state.pending_output);
|
|
40548
40511
|
const pending_output_items = Object.values(pending_output);
|
|
40549
|
-
return /* @__PURE__ */
|
|
40512
|
+
return /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement(Static, {
|
|
40550
40513
|
items: output
|
|
40551
40514
|
}, (node, i2) => {
|
|
40552
|
-
return /* @__PURE__ */
|
|
40515
|
+
return /* @__PURE__ */ React45.createElement(Box_default, {
|
|
40553
40516
|
key: i2
|
|
40554
40517
|
}, node);
|
|
40555
40518
|
}), pending_output_items.map((node_list, i2) => {
|
|
40556
|
-
return /* @__PURE__ */
|
|
40519
|
+
return /* @__PURE__ */ React45.createElement(Box_default, {
|
|
40557
40520
|
key: i2
|
|
40558
|
-
}, /* @__PURE__ */
|
|
40559
|
-
return /* @__PURE__ */
|
|
40521
|
+
}, /* @__PURE__ */ React45.createElement(Text, null, node_list.map((text, j) => {
|
|
40522
|
+
return /* @__PURE__ */ React45.createElement(React45.Fragment, {
|
|
40560
40523
|
key: j
|
|
40561
|
-
}, /* @__PURE__ */
|
|
40524
|
+
}, /* @__PURE__ */ React45.createElement(Text, null, text));
|
|
40562
40525
|
})));
|
|
40563
40526
|
}));
|
|
40564
40527
|
}
|
|
40565
40528
|
|
|
40566
40529
|
// src/app/Providers.tsx
|
|
40567
|
-
var
|
|
40530
|
+
var React46 = __toESM(require_react(), 1);
|
|
40568
40531
|
var import_react_intl2 = __toESM(require_react_intl(), 1);
|
|
40569
40532
|
function Providers(props) {
|
|
40570
|
-
return /* @__PURE__ */
|
|
40533
|
+
return /* @__PURE__ */ React46.createElement(import_react_intl2.IntlProvider, {
|
|
40571
40534
|
locale: "en"
|
|
40572
40535
|
}, props.children);
|
|
40573
40536
|
}
|
|
40574
40537
|
|
|
40575
40538
|
// src/app/RebaseCheck.tsx
|
|
40576
|
-
var
|
|
40539
|
+
var React47 = __toESM(require_react(), 1);
|
|
40577
40540
|
import path8 from "node:path";
|
|
40578
40541
|
function reducer5(state, patch) {
|
|
40579
40542
|
return { ...state, ...patch };
|
|
40580
40543
|
}
|
|
40581
40544
|
function RebaseCheck(props) {
|
|
40582
40545
|
const actions = Store.useActions();
|
|
40583
|
-
const [state, patch] =
|
|
40546
|
+
const [state, patch] = React47.useReducer(reducer5, {
|
|
40584
40547
|
status: "init"
|
|
40585
40548
|
});
|
|
40586
40549
|
switch (state.status) {
|
|
40587
40550
|
case "done":
|
|
40588
40551
|
return props.children;
|
|
40589
40552
|
case "prompt":
|
|
40590
|
-
return /* @__PURE__ */
|
|
40591
|
-
message: /* @__PURE__ */
|
|
40553
|
+
return /* @__PURE__ */ React47.createElement(YesNoPrompt, {
|
|
40554
|
+
message: /* @__PURE__ */ React47.createElement(Text, {
|
|
40592
40555
|
color: colors.yellow
|
|
40593
|
-
}, /* @__PURE__ */
|
|
40556
|
+
}, /* @__PURE__ */ React47.createElement(Command, null, "git rebase"), " detected, would you like to abort it?"),
|
|
40594
40557
|
onYes: async () => {
|
|
40595
40558
|
await cli(`git rebase --abort`);
|
|
40596
40559
|
patch({ status: "done" });
|
|
@@ -40600,11 +40563,11 @@ function RebaseCheck(props) {
|
|
|
40600
40563
|
}
|
|
40601
40564
|
});
|
|
40602
40565
|
default:
|
|
40603
|
-
return /* @__PURE__ */
|
|
40566
|
+
return /* @__PURE__ */ React47.createElement(Await, {
|
|
40604
40567
|
function: run10,
|
|
40605
|
-
fallback: /* @__PURE__ */
|
|
40568
|
+
fallback: /* @__PURE__ */ React47.createElement(Text, {
|
|
40606
40569
|
color: colors.yellow
|
|
40607
|
-
}, "Checking for ", /* @__PURE__ */
|
|
40570
|
+
}, "Checking for ", /* @__PURE__ */ React47.createElement(Command, null, "git rebase"), "…")
|
|
40608
40571
|
});
|
|
40609
40572
|
}
|
|
40610
40573
|
async function run10() {
|
|
@@ -40625,6 +40588,55 @@ function RebaseCheck(props) {
|
|
|
40625
40588
|
}
|
|
40626
40589
|
}
|
|
40627
40590
|
|
|
40591
|
+
// src/app/RequireBranch.tsx
|
|
40592
|
+
var React48 = __toESM(require_react(), 1);
|
|
40593
|
+
function RequireBranch(props) {
|
|
40594
|
+
const fallback = /* @__PURE__ */ React48.createElement(Text, {
|
|
40595
|
+
color: colors.yellow
|
|
40596
|
+
}, "Gathering local git information…");
|
|
40597
|
+
return /* @__PURE__ */ React48.createElement(Await, {
|
|
40598
|
+
fallback,
|
|
40599
|
+
function: run10
|
|
40600
|
+
}, props.children);
|
|
40601
|
+
}
|
|
40602
|
+
async function run10() {
|
|
40603
|
+
const state = Store.getState();
|
|
40604
|
+
const actions = Store.getState().actions;
|
|
40605
|
+
const master_branch = state.master_branch;
|
|
40606
|
+
const head = state.head;
|
|
40607
|
+
const branch_name = state.branch_name;
|
|
40608
|
+
const merge_base = state.merge_base;
|
|
40609
|
+
invariant(head, "head must exist");
|
|
40610
|
+
invariant(branch_name, "branch_name must exist");
|
|
40611
|
+
invariant(merge_base, "merge_base must exist");
|
|
40612
|
+
try {
|
|
40613
|
+
if (branch_name === "HEAD") {
|
|
40614
|
+
actions.error("Must run within a branch.");
|
|
40615
|
+
actions.exit(0);
|
|
40616
|
+
return;
|
|
40617
|
+
}
|
|
40618
|
+
if (`origin/${branch_name}` === master_branch) {
|
|
40619
|
+
actions.error("Must run within a branch.");
|
|
40620
|
+
actions.exit(0);
|
|
40621
|
+
return;
|
|
40622
|
+
}
|
|
40623
|
+
if (head === merge_base) {
|
|
40624
|
+
actions.newline();
|
|
40625
|
+
actions.output(/* @__PURE__ */ React48.createElement(Text, {
|
|
40626
|
+
color: colors.gray
|
|
40627
|
+
}, "No changes detected."));
|
|
40628
|
+
actions.exit(0);
|
|
40629
|
+
return;
|
|
40630
|
+
}
|
|
40631
|
+
} catch (err) {
|
|
40632
|
+
actions.error("Unable to detect branch changes.");
|
|
40633
|
+
if (err instanceof Error) {
|
|
40634
|
+
actions.error(err.message);
|
|
40635
|
+
}
|
|
40636
|
+
actions.exit(17);
|
|
40637
|
+
}
|
|
40638
|
+
}
|
|
40639
|
+
|
|
40628
40640
|
// src/app/VerboseDebugInfo.tsx
|
|
40629
40641
|
var React49 = __toESM(require_react(), 1);
|
|
40630
40642
|
function VerboseDebugInfo(props) {
|
|
@@ -40633,10 +40645,10 @@ function VerboseDebugInfo(props) {
|
|
|
40633
40645
|
}, "Logging verbose debug information…");
|
|
40634
40646
|
return /* @__PURE__ */ React49.createElement(Await, {
|
|
40635
40647
|
fallback,
|
|
40636
|
-
function:
|
|
40648
|
+
function: run11
|
|
40637
40649
|
}, props.children);
|
|
40638
40650
|
}
|
|
40639
|
-
async function
|
|
40651
|
+
async function run11() {
|
|
40640
40652
|
const actions = Store.getState().actions;
|
|
40641
40653
|
try {
|
|
40642
40654
|
await cli(`echo HOME=$HOME`);
|
|
@@ -40653,260 +40665,8 @@ async function run10() {
|
|
|
40653
40665
|
}
|
|
40654
40666
|
}
|
|
40655
40667
|
|
|
40656
|
-
// src/commands/
|
|
40668
|
+
// src/commands/Config.tsx
|
|
40657
40669
|
var React50 = __toESM(require_react(), 1);
|
|
40658
|
-
function Fixup() {
|
|
40659
|
-
return /* @__PURE__ */ React50.createElement(Await, {
|
|
40660
|
-
fallback: null,
|
|
40661
|
-
function: run11
|
|
40662
|
-
});
|
|
40663
|
-
}
|
|
40664
|
-
async function run11() {
|
|
40665
|
-
const state = Store.getState();
|
|
40666
|
-
const actions = state.actions;
|
|
40667
|
-
const argv = state.argv;
|
|
40668
|
-
const relative_number = argv.commit;
|
|
40669
|
-
if (!relative_number) {
|
|
40670
|
-
actions.output(/* @__PURE__ */ React50.createElement(Text, {
|
|
40671
|
-
color: colors.red
|
|
40672
|
-
}, "❗️ Usage: git fixup ", "<relative-commit-number>"));
|
|
40673
|
-
actions.output("");
|
|
40674
|
-
actions.output("This script automates the process of adding staged changes as a fixup commit");
|
|
40675
|
-
actions.output("and the subsequent git rebase to flatten the commits based on relative commit number");
|
|
40676
|
-
actions.output("You can use a `git log` like below to get the relative commit number");
|
|
40677
|
-
actions.output("");
|
|
40678
|
-
actions.output(" ❯ git stack log");
|
|
40679
|
-
actions.output(" 1\te329794d5f881cbf0fc3f26d2108cf6f3fdebabe enable drop_error_subtask test param");
|
|
40680
|
-
actions.output(" 2\t57f43b596e5c6b97bc47e2a591f82ccc81651156 test drop_error_subtask baseline");
|
|
40681
|
-
actions.output(" 3\t838e878d483c6a2d5393063fc59baf2407225c6d ErrorSubtask test baseline");
|
|
40682
|
-
actions.output("");
|
|
40683
|
-
actions.output("To target `838e87` above, you would call `fixup 3`");
|
|
40684
|
-
actions.exit(0);
|
|
40685
|
-
}
|
|
40686
|
-
const diff_staged_cmd = await cli("git diff --cached --quiet", {
|
|
40687
|
-
ignoreExitCode: true
|
|
40688
|
-
});
|
|
40689
|
-
if (!diff_staged_cmd.code) {
|
|
40690
|
-
actions.error("\uD83D\uDEA8 Stage changes before calling fixup");
|
|
40691
|
-
actions.exit(1);
|
|
40692
|
-
}
|
|
40693
|
-
const adjusted_number = Number(relative_number) - 1;
|
|
40694
|
-
const commit_sha = (await cli(`git rev-parse HEAD~${adjusted_number}`)).stdout;
|
|
40695
|
-
actions.output(/* @__PURE__ */ React50.createElement(FormatText, {
|
|
40696
|
-
wrapper: /* @__PURE__ */ React50.createElement(Text, {
|
|
40697
|
-
color: colors.yellow
|
|
40698
|
-
}),
|
|
40699
|
-
message: "\uD83D\uDEE0️ fixup {relative_number} {commit_sha}",
|
|
40700
|
-
values: {
|
|
40701
|
-
commit_sha: /* @__PURE__ */ React50.createElement(Parens, null, commit_sha),
|
|
40702
|
-
relative_number
|
|
40703
|
-
}
|
|
40704
|
-
}));
|
|
40705
|
-
await cli(`git commit --fixup ${commit_sha}`);
|
|
40706
|
-
let save_stash = false;
|
|
40707
|
-
const diff_cmd = await cli("git diff-index --quiet HEAD --", {
|
|
40708
|
-
ignoreExitCode: true
|
|
40709
|
-
});
|
|
40710
|
-
if (diff_cmd.code) {
|
|
40711
|
-
save_stash = true;
|
|
40712
|
-
await cli("git stash --include-untracked");
|
|
40713
|
-
actions.output(/* @__PURE__ */ React50.createElement(Text, {
|
|
40714
|
-
color: colors.yellow
|
|
40715
|
-
}, /* @__PURE__ */ React50.createElement(FormatText, {
|
|
40716
|
-
message: "\uD83D\uDCE6 Changes saved to stash"
|
|
40717
|
-
})));
|
|
40718
|
-
}
|
|
40719
|
-
try {
|
|
40720
|
-
const rebase_target = Number(relative_number) + 1;
|
|
40721
|
-
await cli(`git rebase -i --autosquash HEAD~${rebase_target}`, {
|
|
40722
|
-
env: {
|
|
40723
|
-
...process.env,
|
|
40724
|
-
GIT_EDITOR: "true"
|
|
40725
|
-
}
|
|
40726
|
-
});
|
|
40727
|
-
} catch (error) {
|
|
40728
|
-
actions.error("\uD83D\uDEA8 Fixup failed");
|
|
40729
|
-
await cli("git rebase --abort");
|
|
40730
|
-
await cli("git reset --soft HEAD~1");
|
|
40731
|
-
} finally {
|
|
40732
|
-
if (save_stash) {
|
|
40733
|
-
await cli("git stash pop");
|
|
40734
|
-
actions.output(/* @__PURE__ */ React50.createElement(Text, {
|
|
40735
|
-
color: colors.green
|
|
40736
|
-
}, "✅ Changes restored from stash"));
|
|
40737
|
-
}
|
|
40738
|
-
}
|
|
40739
|
-
actions.exit(0);
|
|
40740
|
-
}
|
|
40741
|
-
|
|
40742
|
-
// src/commands/Log.tsx
|
|
40743
|
-
var React51 = __toESM(require_react(), 1);
|
|
40744
|
-
function Log() {
|
|
40745
|
-
const { stdout } = use_stdout_default();
|
|
40746
|
-
const available_width = stdout.columns || 80;
|
|
40747
|
-
return /* @__PURE__ */ React51.createElement(Await, {
|
|
40748
|
-
fallback: null,
|
|
40749
|
-
function: () => run12({ available_width })
|
|
40750
|
-
});
|
|
40751
|
-
}
|
|
40752
|
-
async function run12(args) {
|
|
40753
|
-
const state = Store.getState();
|
|
40754
|
-
const actions = state.actions;
|
|
40755
|
-
const process_argv = state.process_argv;
|
|
40756
|
-
invariant(actions, "actions must exist");
|
|
40757
|
-
const color_buffer = 12 * 5;
|
|
40758
|
-
const truncation_width = args.available_width + color_buffer;
|
|
40759
|
-
const short_sha = (await cli(`git log -1 --format=%h`)).stdout.trim();
|
|
40760
|
-
const short_sha_length = short_sha.length + 1;
|
|
40761
|
-
const sha_format = `%C(green)%<(${short_sha_length},trunc)%h`;
|
|
40762
|
-
const date_format = `%C(white)%<(15,trunc)%cr`;
|
|
40763
|
-
const author_format = `%C(white)%<(8,trunc)%al`;
|
|
40764
|
-
const decoration_format = `%C(auto)%d`;
|
|
40765
|
-
const subject_format = `%<(60,trunc)%s`;
|
|
40766
|
-
const format = [sha_format, date_format, author_format, decoration_format, subject_format].join(" ");
|
|
40767
|
-
const rest_args = process_argv.slice(3).join(" ");
|
|
40768
|
-
const command = [
|
|
40769
|
-
`git log --pretty=format:"${format}" -n20 --graph --color ${rest_args}`,
|
|
40770
|
-
`cut -c 1-"${truncation_width}"`,
|
|
40771
|
-
`nl -w3 -s' '`
|
|
40772
|
-
].join(" | ");
|
|
40773
|
-
const result = await cli(command);
|
|
40774
|
-
actions.output(result.stdout);
|
|
40775
|
-
actions.exit(0);
|
|
40776
|
-
}
|
|
40777
|
-
|
|
40778
|
-
// src/commands/Update.tsx
|
|
40779
|
-
var React52 = __toESM(require_react(), 1);
|
|
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 {
|
|
40795
|
-
constructor(props) {
|
|
40796
|
-
super(props);
|
|
40797
|
-
this.state = {
|
|
40798
|
-
error: null,
|
|
40799
|
-
component_stack: ""
|
|
40800
|
-
};
|
|
40801
|
-
}
|
|
40802
|
-
static getDerivedStateFromError(error) {
|
|
40803
|
-
return { error };
|
|
40804
|
-
}
|
|
40805
|
-
componentDidCatch(_error, error_info) {
|
|
40806
|
-
let component_stack = error_info.componentStack;
|
|
40807
|
-
if (component_stack) {
|
|
40808
|
-
component_stack = component_stack.split(`
|
|
40809
|
-
`).slice(1).join(`
|
|
40810
|
-
`);
|
|
40811
|
-
this.setState({ component_stack }, async () => {
|
|
40812
|
-
await Exit.handle_exit({ code: 30, clear: true });
|
|
40813
|
-
});
|
|
40814
|
-
}
|
|
40815
|
-
}
|
|
40816
|
-
render() {
|
|
40817
|
-
if (!this.state.error) {
|
|
40818
|
-
return this.props.children;
|
|
40819
|
-
}
|
|
40820
|
-
const message = this.state.error.message;
|
|
40821
|
-
return /* @__PURE__ */ React53.createElement(Box_default, {
|
|
40822
|
-
flexDirection: "column",
|
|
40823
|
-
gap: 0
|
|
40824
|
-
}, /* @__PURE__ */ React53.createElement(Text, {
|
|
40825
|
-
color: colors.red
|
|
40826
|
-
}, /* @__PURE__ */ React53.createElement(FormatText, {
|
|
40827
|
-
message: "\uD83D\uDEA8 Unhandled error {message}",
|
|
40828
|
-
values: {
|
|
40829
|
-
message: /* @__PURE__ */ React53.createElement(Text, {
|
|
40830
|
-
color: colors.gray
|
|
40831
|
-
}, message)
|
|
40832
|
-
}
|
|
40833
|
-
})), this._render_verbose());
|
|
40834
|
-
}
|
|
40835
|
-
_render_verbose() {
|
|
40836
|
-
const store_state = Store.getState();
|
|
40837
|
-
if (store_state.argv.verbose) {
|
|
40838
|
-
return /* @__PURE__ */ React53.createElement(Text, {
|
|
40839
|
-
color: colors.gray
|
|
40840
|
-
}, this.state.component_stack);
|
|
40841
|
-
}
|
|
40842
|
-
return /* @__PURE__ */ React53.createElement(Text, {
|
|
40843
|
-
color: colors.gray
|
|
40844
|
-
}, /* @__PURE__ */ React53.createElement(FormatText, {
|
|
40845
|
-
message: "Try again with `--verbose` to see more information."
|
|
40846
|
-
}));
|
|
40847
|
-
}
|
|
40848
|
-
}
|
|
40849
|
-
|
|
40850
|
-
// src/components/ExitingGate.tsx
|
|
40851
|
-
var React54 = __toESM(require_react(), 1);
|
|
40852
|
-
function ExitingGate(props) {
|
|
40853
|
-
const exit_mode = Store.useState((state) => state.exit_mode);
|
|
40854
|
-
if (!exit_mode) {
|
|
40855
|
-
return props.children;
|
|
40856
|
-
}
|
|
40857
|
-
switch (exit_mode) {
|
|
40858
|
-
case "quiet":
|
|
40859
|
-
return null;
|
|
40860
|
-
case "normal":
|
|
40861
|
-
return /* @__PURE__ */ React54.createElement(Box_default, {
|
|
40862
|
-
flexDirection: "column"
|
|
40863
|
-
}, /* @__PURE__ */ React54.createElement(Text, {
|
|
40864
|
-
color: colors.red
|
|
40865
|
-
}, /* @__PURE__ */ React54.createElement(FormatText, {
|
|
40866
|
-
message: "\uD83D\uDEA8 Exiting…"
|
|
40867
|
-
})));
|
|
40868
|
-
default:
|
|
40869
|
-
return null;
|
|
40870
|
-
}
|
|
40871
|
-
}
|
|
40872
|
-
|
|
40873
|
-
// src/app/App.tsx
|
|
40874
|
-
function App2() {
|
|
40875
|
-
const actions = Store.useActions();
|
|
40876
|
-
const ink = Store.useState((state) => state.ink);
|
|
40877
|
-
const argv = Store.useState((state) => state.argv);
|
|
40878
|
-
if (!ink || !argv || !argv.$0) {
|
|
40879
|
-
return null;
|
|
40880
|
-
}
|
|
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, {
|
|
40884
|
-
name: "git-stack-cli",
|
|
40885
|
-
verbose: argv.verbose,
|
|
40886
|
-
force: is_update,
|
|
40887
|
-
timeoutMs: is_update ? 30 * 1000 : 2 * 1000,
|
|
40888
|
-
onOutput: actions.output,
|
|
40889
|
-
onDone: () => {
|
|
40890
|
-
if (is_update) {
|
|
40891
|
-
actions.exit(0);
|
|
40892
|
-
}
|
|
40893
|
-
}
|
|
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))));
|
|
40895
|
-
}
|
|
40896
|
-
function MaybeMain() {
|
|
40897
|
-
const argv = Store.useState((state) => state.argv);
|
|
40898
|
-
const positional_list = new Set(argv["_"]);
|
|
40899
|
-
if (positional_list.has("fixup")) {
|
|
40900
|
-
return /* @__PURE__ */ React55.createElement(Fixup, null);
|
|
40901
|
-
} else if (positional_list.has("log")) {
|
|
40902
|
-
return /* @__PURE__ */ React55.createElement(Log, null);
|
|
40903
|
-
} else if (positional_list.has("update")) {
|
|
40904
|
-
return /* @__PURE__ */ React55.createElement(Update, null);
|
|
40905
|
-
} else if (positional_list.has("rebase")) {
|
|
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)))));
|
|
40907
|
-
}
|
|
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)))))));
|
|
40909
|
-
}
|
|
40910
40670
|
|
|
40911
40671
|
// node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/lib/platform-shims/esm.mjs
|
|
40912
40672
|
import { notStrictEqual, strictEqual } from "assert";
|
|
@@ -45769,8 +45529,17 @@ var Yargs = YargsFactory(esm_default);
|
|
|
45769
45529
|
var yargs_default = Yargs;
|
|
45770
45530
|
|
|
45771
45531
|
// src/command.ts
|
|
45772
|
-
async function command2() {
|
|
45773
|
-
|
|
45532
|
+
async function command2(argv, options = {}) {
|
|
45533
|
+
let builder = yargs_default(hideBin(argv));
|
|
45534
|
+
if (options.parserConfiguration) {
|
|
45535
|
+
builder = builder.parserConfiguration(options.parserConfiguration);
|
|
45536
|
+
}
|
|
45537
|
+
if (options.env_config) {
|
|
45538
|
+
builder = builder.config(options.env_config);
|
|
45539
|
+
}
|
|
45540
|
+
const parsed = await builder.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).command("config", "Generate a one-time configuration json based on the passed arguments", (yargs) => yargs.options(DefaultOptions)).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.7.0").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`");
|
|
45541
|
+
const result = parsed.argv;
|
|
45542
|
+
return result;
|
|
45774
45543
|
}
|
|
45775
45544
|
var GlobalOptions = {
|
|
45776
45545
|
verbose: {
|
|
@@ -45823,11 +45592,6 @@ var DefaultOptions = {
|
|
|
45823
45592
|
default: false,
|
|
45824
45593
|
description: "Open all PRs as drafts"
|
|
45825
45594
|
},
|
|
45826
|
-
"branch-prefix": {
|
|
45827
|
-
type: "string",
|
|
45828
|
-
default: "",
|
|
45829
|
-
description: "Prefix for generated branch names, e.g. dev/magus/"
|
|
45830
|
-
},
|
|
45831
45595
|
"revise-sign": {
|
|
45832
45596
|
type: "boolean",
|
|
45833
45597
|
default: true,
|
|
@@ -45867,6 +45631,353 @@ var FixupOptions = {
|
|
|
45867
45631
|
}
|
|
45868
45632
|
};
|
|
45869
45633
|
|
|
45634
|
+
// src/commands/Config.tsx
|
|
45635
|
+
function Config() {
|
|
45636
|
+
return /* @__PURE__ */ React50.createElement(Await, {
|
|
45637
|
+
fallback: null,
|
|
45638
|
+
function: run12
|
|
45639
|
+
});
|
|
45640
|
+
async function run12() {
|
|
45641
|
+
const state = Store.getState();
|
|
45642
|
+
const actions = state.actions;
|
|
45643
|
+
const config = await get_explicit_args();
|
|
45644
|
+
const config_json = JSON.stringify(config).replace(/"/g, "\\\"");
|
|
45645
|
+
actions.output(/* @__PURE__ */ React50.createElement(Box_default, {
|
|
45646
|
+
flexDirection: "column",
|
|
45647
|
+
gap: 1,
|
|
45648
|
+
paddingTop: 1
|
|
45649
|
+
}, /* @__PURE__ */ React50.createElement(Text, null), /* @__PURE__ */ React50.createElement(FormatText, {
|
|
45650
|
+
message: "Add the line below to your shell rc file ({zshrc}, {bashrc}, etc.)",
|
|
45651
|
+
values: {
|
|
45652
|
+
zshrc: /* @__PURE__ */ React50.createElement(Text, {
|
|
45653
|
+
color: colors.gray
|
|
45654
|
+
}, ".zshrc"),
|
|
45655
|
+
bashrc: /* @__PURE__ */ React50.createElement(Text, {
|
|
45656
|
+
color: colors.gray
|
|
45657
|
+
}, ".bashrc")
|
|
45658
|
+
}
|
|
45659
|
+
}), /* @__PURE__ */ React50.createElement(FormatText, {
|
|
45660
|
+
message: `{export} {ENV_VAR}{e}{q}{config_json}{q}`,
|
|
45661
|
+
values: {
|
|
45662
|
+
export: /* @__PURE__ */ React50.createElement(Text, {
|
|
45663
|
+
color: colors.purple
|
|
45664
|
+
}, "export"),
|
|
45665
|
+
ENV_VAR: /* @__PURE__ */ React50.createElement(Text, {
|
|
45666
|
+
color: colors.yellow
|
|
45667
|
+
}, ENV_VAR),
|
|
45668
|
+
e: /* @__PURE__ */ React50.createElement(Text, {
|
|
45669
|
+
color: colors.purple
|
|
45670
|
+
}, "="),
|
|
45671
|
+
q: /* @__PURE__ */ React50.createElement(Text, {
|
|
45672
|
+
color: colors.white
|
|
45673
|
+
}, '"'),
|
|
45674
|
+
config_json: /* @__PURE__ */ React50.createElement(Text, {
|
|
45675
|
+
color: colors.green
|
|
45676
|
+
}, config_json)
|
|
45677
|
+
}
|
|
45678
|
+
})));
|
|
45679
|
+
actions.exit(0);
|
|
45680
|
+
}
|
|
45681
|
+
}
|
|
45682
|
+
async function argv_with_config_from_env() {
|
|
45683
|
+
if (!process.env.GIT_STACK_CONFIG) {
|
|
45684
|
+
return await command2(process.argv);
|
|
45685
|
+
}
|
|
45686
|
+
const env_config = parse_env_config();
|
|
45687
|
+
return await command2(process.argv, { env_config });
|
|
45688
|
+
}
|
|
45689
|
+
function parse_env_config() {
|
|
45690
|
+
const GIT_STACK_CONFIG = process.env.GIT_STACK_CONFIG;
|
|
45691
|
+
invariant(GIT_STACK_CONFIG, "GIT_STACK_CONFIG must exist");
|
|
45692
|
+
try {
|
|
45693
|
+
const env_config = JSON.parse(GIT_STACK_CONFIG);
|
|
45694
|
+
return env_config;
|
|
45695
|
+
} catch (error) {
|
|
45696
|
+
console.error(`ERROR GIT_STACK_CONFIG=${GIT_STACK_CONFIG}`);
|
|
45697
|
+
console.error("ERROR GIT_STACK_CONFIG environment variable is not valid JSON");
|
|
45698
|
+
process.exit(18);
|
|
45699
|
+
}
|
|
45700
|
+
}
|
|
45701
|
+
async function get_explicit_args() {
|
|
45702
|
+
const default_argv = await command2(["git", "stack"], COMMAND_OPTIONS);
|
|
45703
|
+
const state_argv = await command2(process.argv, COMMAND_OPTIONS);
|
|
45704
|
+
const config = {};
|
|
45705
|
+
for (const key of Object.keys(state_argv)) {
|
|
45706
|
+
if (key === "_" || key === "$0")
|
|
45707
|
+
continue;
|
|
45708
|
+
const state_value = state_argv[key];
|
|
45709
|
+
const default_value = default_argv[key];
|
|
45710
|
+
const is_set = default_value !== state_value;
|
|
45711
|
+
if (is_set) {
|
|
45712
|
+
config[key] = state_value;
|
|
45713
|
+
}
|
|
45714
|
+
}
|
|
45715
|
+
return config;
|
|
45716
|
+
}
|
|
45717
|
+
var ENV_VAR = "GIT_STACK_CONFIG";
|
|
45718
|
+
var COMMAND_OPTIONS = {
|
|
45719
|
+
parserConfiguration: {
|
|
45720
|
+
"strip-aliased": true
|
|
45721
|
+
}
|
|
45722
|
+
};
|
|
45723
|
+
|
|
45724
|
+
// src/commands/Fixup.tsx
|
|
45725
|
+
var React51 = __toESM(require_react(), 1);
|
|
45726
|
+
function Fixup() {
|
|
45727
|
+
return /* @__PURE__ */ React51.createElement(Await, {
|
|
45728
|
+
fallback: null,
|
|
45729
|
+
function: run12
|
|
45730
|
+
});
|
|
45731
|
+
}
|
|
45732
|
+
async function run12() {
|
|
45733
|
+
const state = Store.getState();
|
|
45734
|
+
const actions = state.actions;
|
|
45735
|
+
const argv = state.argv;
|
|
45736
|
+
const relative_number = argv.commit;
|
|
45737
|
+
if (!relative_number) {
|
|
45738
|
+
actions.output(/* @__PURE__ */ React51.createElement(Text, {
|
|
45739
|
+
color: colors.red
|
|
45740
|
+
}, "❗️ Usage: git fixup ", "<relative-commit-number>"));
|
|
45741
|
+
actions.output("");
|
|
45742
|
+
actions.output("This script automates the process of adding staged changes as a fixup commit");
|
|
45743
|
+
actions.output("and the subsequent git rebase to flatten the commits based on relative commit number");
|
|
45744
|
+
actions.output("You can use a `git log` like below to get the relative commit number");
|
|
45745
|
+
actions.output("");
|
|
45746
|
+
actions.output(" ❯ git stack log");
|
|
45747
|
+
actions.output(" 1\te329794d5f881cbf0fc3f26d2108cf6f3fdebabe enable drop_error_subtask test param");
|
|
45748
|
+
actions.output(" 2\t57f43b596e5c6b97bc47e2a591f82ccc81651156 test drop_error_subtask baseline");
|
|
45749
|
+
actions.output(" 3\t838e878d483c6a2d5393063fc59baf2407225c6d ErrorSubtask test baseline");
|
|
45750
|
+
actions.output("");
|
|
45751
|
+
actions.output("To target `838e87` above, you would call `fixup 3`");
|
|
45752
|
+
actions.exit(0);
|
|
45753
|
+
}
|
|
45754
|
+
const diff_staged_cmd = await cli("git diff --cached --quiet", {
|
|
45755
|
+
ignoreExitCode: true
|
|
45756
|
+
});
|
|
45757
|
+
if (!diff_staged_cmd.code) {
|
|
45758
|
+
actions.error("\uD83D\uDEA8 Stage changes before calling fixup");
|
|
45759
|
+
actions.exit(1);
|
|
45760
|
+
}
|
|
45761
|
+
const adjusted_number = Number(relative_number) - 1;
|
|
45762
|
+
const commit_sha = (await cli(`git rev-parse HEAD~${adjusted_number}`)).stdout;
|
|
45763
|
+
actions.output(/* @__PURE__ */ React51.createElement(FormatText, {
|
|
45764
|
+
wrapper: /* @__PURE__ */ React51.createElement(Text, {
|
|
45765
|
+
color: colors.yellow
|
|
45766
|
+
}),
|
|
45767
|
+
message: "\uD83D\uDEE0️ fixup {relative_number} {commit_sha}",
|
|
45768
|
+
values: {
|
|
45769
|
+
commit_sha: /* @__PURE__ */ React51.createElement(Parens, null, commit_sha),
|
|
45770
|
+
relative_number
|
|
45771
|
+
}
|
|
45772
|
+
}));
|
|
45773
|
+
await cli(`git commit --fixup ${commit_sha}`);
|
|
45774
|
+
let save_stash = false;
|
|
45775
|
+
const diff_cmd = await cli("git diff-index --quiet HEAD --", {
|
|
45776
|
+
ignoreExitCode: true
|
|
45777
|
+
});
|
|
45778
|
+
if (diff_cmd.code) {
|
|
45779
|
+
save_stash = true;
|
|
45780
|
+
await cli("git stash --include-untracked");
|
|
45781
|
+
actions.output(/* @__PURE__ */ React51.createElement(Text, {
|
|
45782
|
+
color: colors.yellow
|
|
45783
|
+
}, /* @__PURE__ */ React51.createElement(FormatText, {
|
|
45784
|
+
message: "\uD83D\uDCE6 Changes saved to stash"
|
|
45785
|
+
})));
|
|
45786
|
+
}
|
|
45787
|
+
try {
|
|
45788
|
+
const rebase_target = Number(relative_number) + 1;
|
|
45789
|
+
await cli(`git rebase -i --autosquash HEAD~${rebase_target}`, {
|
|
45790
|
+
env: {
|
|
45791
|
+
...process.env,
|
|
45792
|
+
GIT_EDITOR: "true"
|
|
45793
|
+
}
|
|
45794
|
+
});
|
|
45795
|
+
} catch (error) {
|
|
45796
|
+
actions.error("\uD83D\uDEA8 Fixup failed");
|
|
45797
|
+
await cli("git rebase --abort");
|
|
45798
|
+
await cli("git reset --soft HEAD~1");
|
|
45799
|
+
} finally {
|
|
45800
|
+
if (save_stash) {
|
|
45801
|
+
await cli("git stash pop");
|
|
45802
|
+
actions.output(/* @__PURE__ */ React51.createElement(Text, {
|
|
45803
|
+
color: colors.green
|
|
45804
|
+
}, "✅ Changes restored from stash"));
|
|
45805
|
+
}
|
|
45806
|
+
}
|
|
45807
|
+
actions.exit(0);
|
|
45808
|
+
}
|
|
45809
|
+
|
|
45810
|
+
// src/commands/Log.tsx
|
|
45811
|
+
var React52 = __toESM(require_react(), 1);
|
|
45812
|
+
function Log() {
|
|
45813
|
+
const { stdout } = use_stdout_default();
|
|
45814
|
+
const available_width = stdout.columns || 80;
|
|
45815
|
+
return /* @__PURE__ */ React52.createElement(Await, {
|
|
45816
|
+
fallback: null,
|
|
45817
|
+
function: () => run13({ available_width })
|
|
45818
|
+
});
|
|
45819
|
+
}
|
|
45820
|
+
async function run13(args) {
|
|
45821
|
+
const state = Store.getState();
|
|
45822
|
+
const actions = state.actions;
|
|
45823
|
+
const process_argv = state.process_argv;
|
|
45824
|
+
invariant(actions, "actions must exist");
|
|
45825
|
+
const color_buffer = 12 * 5;
|
|
45826
|
+
const truncation_width = args.available_width + color_buffer;
|
|
45827
|
+
const short_sha = (await cli(`git log -1 --format=%h`)).stdout.trim();
|
|
45828
|
+
const short_sha_length = short_sha.length + 1;
|
|
45829
|
+
const sha_format = `%C(green)%<(${short_sha_length},trunc)%h`;
|
|
45830
|
+
const date_format = `%C(white)%<(15,trunc)%cr`;
|
|
45831
|
+
const author_format = `%C(white)%<(8,trunc)%al`;
|
|
45832
|
+
const decoration_format = `%C(auto)%d`;
|
|
45833
|
+
const subject_format = `%<(60,trunc)%s`;
|
|
45834
|
+
const format3 = [sha_format, date_format, author_format, decoration_format, subject_format].join(" ");
|
|
45835
|
+
const rest_args = process_argv.slice(3).join(" ");
|
|
45836
|
+
const command3 = [
|
|
45837
|
+
`git log --pretty=format:"${format3}" -n20 --graph --color ${rest_args}`,
|
|
45838
|
+
`cut -c 1-"${truncation_width}"`,
|
|
45839
|
+
`nl -w3 -s' '`
|
|
45840
|
+
].join(" | ");
|
|
45841
|
+
const result = await cli(command3);
|
|
45842
|
+
actions.output(result.stdout);
|
|
45843
|
+
actions.exit(0);
|
|
45844
|
+
}
|
|
45845
|
+
|
|
45846
|
+
// src/commands/Update.tsx
|
|
45847
|
+
var React53 = __toESM(require_react(), 1);
|
|
45848
|
+
function Update() {
|
|
45849
|
+
return /* @__PURE__ */ React53.createElement(Await, {
|
|
45850
|
+
fallback: null,
|
|
45851
|
+
function: run14
|
|
45852
|
+
});
|
|
45853
|
+
}
|
|
45854
|
+
async function run14() {
|
|
45855
|
+
const state = Store.getState();
|
|
45856
|
+
const actions = state.actions;
|
|
45857
|
+
actions.exit(0);
|
|
45858
|
+
}
|
|
45859
|
+
|
|
45860
|
+
// src/components/ErrorBoundary.tsx
|
|
45861
|
+
var React54 = __toESM(require_react(), 1);
|
|
45862
|
+
class ErrorBoundary extends React54.Component {
|
|
45863
|
+
constructor(props) {
|
|
45864
|
+
super(props);
|
|
45865
|
+
this.state = {
|
|
45866
|
+
error: null,
|
|
45867
|
+
component_stack: ""
|
|
45868
|
+
};
|
|
45869
|
+
}
|
|
45870
|
+
static getDerivedStateFromError(error) {
|
|
45871
|
+
return { error };
|
|
45872
|
+
}
|
|
45873
|
+
componentDidCatch(_error, error_info) {
|
|
45874
|
+
let component_stack = error_info.componentStack;
|
|
45875
|
+
if (component_stack) {
|
|
45876
|
+
component_stack = component_stack.split(`
|
|
45877
|
+
`).slice(1).join(`
|
|
45878
|
+
`);
|
|
45879
|
+
this.setState({ component_stack }, async () => {
|
|
45880
|
+
await Exit.handle_exit({ code: 30, clear: true });
|
|
45881
|
+
});
|
|
45882
|
+
}
|
|
45883
|
+
}
|
|
45884
|
+
render() {
|
|
45885
|
+
if (!this.state.error) {
|
|
45886
|
+
return this.props.children;
|
|
45887
|
+
}
|
|
45888
|
+
const message = this.state.error.message;
|
|
45889
|
+
return /* @__PURE__ */ React54.createElement(Box_default, {
|
|
45890
|
+
flexDirection: "column",
|
|
45891
|
+
gap: 0
|
|
45892
|
+
}, /* @__PURE__ */ React54.createElement(Text, {
|
|
45893
|
+
color: colors.red
|
|
45894
|
+
}, /* @__PURE__ */ React54.createElement(FormatText, {
|
|
45895
|
+
message: "\uD83D\uDEA8 Unhandled error {message}",
|
|
45896
|
+
values: {
|
|
45897
|
+
message: /* @__PURE__ */ React54.createElement(Text, {
|
|
45898
|
+
color: colors.gray
|
|
45899
|
+
}, message)
|
|
45900
|
+
}
|
|
45901
|
+
})), this._render_verbose());
|
|
45902
|
+
}
|
|
45903
|
+
_render_verbose() {
|
|
45904
|
+
const store_state = Store.getState();
|
|
45905
|
+
if (store_state.argv.verbose) {
|
|
45906
|
+
return /* @__PURE__ */ React54.createElement(Text, {
|
|
45907
|
+
color: colors.gray
|
|
45908
|
+
}, this.state.component_stack);
|
|
45909
|
+
}
|
|
45910
|
+
return /* @__PURE__ */ React54.createElement(Text, {
|
|
45911
|
+
color: colors.gray
|
|
45912
|
+
}, /* @__PURE__ */ React54.createElement(FormatText, {
|
|
45913
|
+
message: "Try again with `--verbose` to see more information."
|
|
45914
|
+
}));
|
|
45915
|
+
}
|
|
45916
|
+
}
|
|
45917
|
+
|
|
45918
|
+
// src/components/ExitingGate.tsx
|
|
45919
|
+
var React55 = __toESM(require_react(), 1);
|
|
45920
|
+
function ExitingGate(props) {
|
|
45921
|
+
const exit_mode = Store.useState((state) => state.exit_mode);
|
|
45922
|
+
if (!exit_mode) {
|
|
45923
|
+
return props.children;
|
|
45924
|
+
}
|
|
45925
|
+
switch (exit_mode) {
|
|
45926
|
+
case "quiet":
|
|
45927
|
+
return null;
|
|
45928
|
+
case "normal":
|
|
45929
|
+
return /* @__PURE__ */ React55.createElement(Box_default, {
|
|
45930
|
+
flexDirection: "column"
|
|
45931
|
+
}, /* @__PURE__ */ React55.createElement(Text, {
|
|
45932
|
+
color: colors.red
|
|
45933
|
+
}, /* @__PURE__ */ React55.createElement(FormatText, {
|
|
45934
|
+
message: "\uD83D\uDEA8 Exiting…"
|
|
45935
|
+
})));
|
|
45936
|
+
default:
|
|
45937
|
+
return null;
|
|
45938
|
+
}
|
|
45939
|
+
}
|
|
45940
|
+
|
|
45941
|
+
// src/app/App.tsx
|
|
45942
|
+
function App2() {
|
|
45943
|
+
const actions = Store.useActions();
|
|
45944
|
+
const ink = Store.useState((state) => state.ink);
|
|
45945
|
+
const argv = Store.useState((state) => state.argv);
|
|
45946
|
+
if (!ink || !argv || !argv.$0) {
|
|
45947
|
+
return null;
|
|
45948
|
+
}
|
|
45949
|
+
const positional_list = new Set(argv["_"]);
|
|
45950
|
+
const is_update = positional_list.has("update") || positional_list.has("upgrade");
|
|
45951
|
+
return /* @__PURE__ */ React56.createElement(Providers, null, /* @__PURE__ */ React56.createElement(ErrorBoundary, null, /* @__PURE__ */ React56.createElement(Debug, null), /* @__PURE__ */ React56.createElement(Output2, null), /* @__PURE__ */ React56.createElement(ExitingGate, null, /* @__PURE__ */ React56.createElement(AutoUpdate, {
|
|
45952
|
+
name: "git-stack-cli",
|
|
45953
|
+
verbose: argv.verbose,
|
|
45954
|
+
force: is_update,
|
|
45955
|
+
timeoutMs: is_update ? 30 * 1000 : 2 * 1000,
|
|
45956
|
+
onOutput: actions.output,
|
|
45957
|
+
onDone: () => {
|
|
45958
|
+
if (is_update) {
|
|
45959
|
+
actions.exit(0);
|
|
45960
|
+
}
|
|
45961
|
+
}
|
|
45962
|
+
}, /* @__PURE__ */ React56.createElement(VerboseDebugInfo, null, /* @__PURE__ */ React56.createElement(RebaseCheck, null, /* @__PURE__ */ React56.createElement(CherryPickCheck, null, /* @__PURE__ */ React56.createElement(MaybeMain, null))))), /* @__PURE__ */ React56.createElement(HandleCtrlCSigint, null))));
|
|
45963
|
+
}
|
|
45964
|
+
function MaybeMain() {
|
|
45965
|
+
const argv = Store.useState((state) => state.argv);
|
|
45966
|
+
const positional_list = new Set(argv["_"]);
|
|
45967
|
+
if (positional_list.has("fixup")) {
|
|
45968
|
+
return /* @__PURE__ */ React56.createElement(Fixup, null);
|
|
45969
|
+
} else if (positional_list.has("log")) {
|
|
45970
|
+
return /* @__PURE__ */ React56.createElement(Log, null);
|
|
45971
|
+
} else if (positional_list.has("update")) {
|
|
45972
|
+
return /* @__PURE__ */ React56.createElement(Update, null);
|
|
45973
|
+
} else if (positional_list.has("config")) {
|
|
45974
|
+
return /* @__PURE__ */ React56.createElement(Config, null);
|
|
45975
|
+
} else if (positional_list.has("rebase")) {
|
|
45976
|
+
return /* @__PURE__ */ React56.createElement(DependencyCheck, null, /* @__PURE__ */ React56.createElement(DirtyCheck, null, /* @__PURE__ */ React56.createElement(GatherMetadata, null, /* @__PURE__ */ React56.createElement(LocalCommitStatus, null, /* @__PURE__ */ React56.createElement(Rebase, null)))));
|
|
45977
|
+
}
|
|
45978
|
+
return /* @__PURE__ */ React56.createElement(React56.Fragment, null, !argv.verbose ? null : /* @__PURE__ */ React56.createElement(GithubApiError, null), /* @__PURE__ */ React56.createElement(DependencyCheck, null, /* @__PURE__ */ React56.createElement(DirtyCheck, null, /* @__PURE__ */ React56.createElement(GatherMetadata, null, /* @__PURE__ */ React56.createElement(RequireBranch, null, /* @__PURE__ */ React56.createElement(LocalCommitStatus, null, /* @__PURE__ */ React56.createElement(DetectInitialPR, null, /* @__PURE__ */ React56.createElement(Main, null))))))));
|
|
45979
|
+
}
|
|
45980
|
+
|
|
45870
45981
|
// src/index.tsx
|
|
45871
45982
|
(async function main() {
|
|
45872
45983
|
try {
|
|
@@ -45876,7 +45987,7 @@ var FixupOptions = {
|
|
|
45876
45987
|
console.error("Try again with `--verbose` to see more information.");
|
|
45877
45988
|
}
|
|
45878
45989
|
};
|
|
45879
|
-
const argv = await
|
|
45990
|
+
const argv = await argv_with_config_from_env();
|
|
45880
45991
|
process.stdin.resume();
|
|
45881
45992
|
process.on("uncaughtException", (error) => {
|
|
45882
45993
|
console.error("\uD83D\uDEA8 uncaughtException");
|
|
@@ -45892,7 +46003,7 @@ var FixupOptions = {
|
|
|
45892
46003
|
});
|
|
45893
46004
|
const tmp_dir = await get_tmp_dir();
|
|
45894
46005
|
await fs12.rm(tmp_dir, { recursive: true });
|
|
45895
|
-
const ink = render_default(/* @__PURE__ */
|
|
46006
|
+
const ink = render_default(/* @__PURE__ */ React57.createElement(App2, null), {
|
|
45896
46007
|
exitOnCtrlC: false
|
|
45897
46008
|
});
|
|
45898
46009
|
Store.setState((state) => {
|