git-stack-cli 2.6.1 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -6
- package/dist/js/index.js +612 -497
- package/package.json +1 -1
- package/src/app/App.tsx +3 -0
- package/src/app/AutoUpdate.tsx +204 -168
- package/src/app/SelectCommitRanges.tsx +4 -12
- package/src/command.ts +68 -50
- package/src/commands/Config.tsx +106 -0
- package/src/index.tsx +2 -2
- package/src/types/global.d.ts +1 -1
- 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,10 +31935,10 @@ 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
|
-
var
|
|
31941
|
+
var React19 = __toESM(require_react(), 1);
|
|
31942
31942
|
|
|
31943
31943
|
// src/app/Brackets.tsx
|
|
31944
31944
|
var React10 = __toESM(require_react(), 1);
|
|
@@ -31993,24 +31993,34 @@ function FormatText(props) {
|
|
|
31993
31993
|
});
|
|
31994
31994
|
}
|
|
31995
31995
|
|
|
31996
|
+
// src/app/Url.tsx
|
|
31997
|
+
var React13 = __toESM(require_react(), 1);
|
|
31998
|
+
function Url(props) {
|
|
31999
|
+
return /* @__PURE__ */ React13.createElement(Text, {
|
|
32000
|
+
bold: true,
|
|
32001
|
+
color: colors.blue,
|
|
32002
|
+
...props
|
|
32003
|
+
}, props.children);
|
|
32004
|
+
}
|
|
32005
|
+
|
|
31996
32006
|
// src/app/YesNoPrompt.tsx
|
|
31997
|
-
var
|
|
32007
|
+
var React15 = __toESM(require_react(), 1);
|
|
31998
32008
|
|
|
31999
32009
|
// src/app/Parens.tsx
|
|
32000
|
-
var
|
|
32010
|
+
var React14 = __toESM(require_react(), 1);
|
|
32001
32011
|
function Parens(props) {
|
|
32002
32012
|
const color = colors.blue;
|
|
32003
|
-
return /* @__PURE__ */
|
|
32013
|
+
return /* @__PURE__ */ React14.createElement(Text, null, /* @__PURE__ */ React14.createElement(Text, {
|
|
32004
32014
|
color
|
|
32005
|
-
}, "("), props.children, /* @__PURE__ */
|
|
32015
|
+
}, "("), props.children, /* @__PURE__ */ React14.createElement(Text, {
|
|
32006
32016
|
color
|
|
32007
32017
|
}, ")"));
|
|
32008
32018
|
}
|
|
32009
32019
|
|
|
32010
32020
|
// src/app/YesNoPrompt.tsx
|
|
32011
32021
|
function YesNoPrompt(props) {
|
|
32012
|
-
const [answer, set_answer] =
|
|
32013
|
-
const answered_ref =
|
|
32022
|
+
const [answer, set_answer] = React15.useState("");
|
|
32023
|
+
const answered_ref = React15.useRef(false);
|
|
32014
32024
|
use_input_default((input) => {
|
|
32015
32025
|
if (answered_ref.current) {
|
|
32016
32026
|
return;
|
|
@@ -32032,11 +32042,11 @@ function YesNoPrompt(props) {
|
|
|
32032
32042
|
}
|
|
32033
32043
|
});
|
|
32034
32044
|
const choices = function get_choices() {
|
|
32035
|
-
const y3 = /* @__PURE__ */
|
|
32045
|
+
const y3 = /* @__PURE__ */ React15.createElement(Text, {
|
|
32036
32046
|
bold: true,
|
|
32037
32047
|
color: colors.green
|
|
32038
32048
|
}, "Y");
|
|
32039
|
-
const n3 = /* @__PURE__ */
|
|
32049
|
+
const n3 = /* @__PURE__ */ React15.createElement(Text, {
|
|
32040
32050
|
color: colors.red
|
|
32041
32051
|
}, "n");
|
|
32042
32052
|
switch (answer) {
|
|
@@ -32045,19 +32055,19 @@ function YesNoPrompt(props) {
|
|
|
32045
32055
|
case "n":
|
|
32046
32056
|
return n3;
|
|
32047
32057
|
default:
|
|
32048
|
-
return /* @__PURE__ */
|
|
32058
|
+
return /* @__PURE__ */ React15.createElement(FormatText, {
|
|
32049
32059
|
message: "{y}/{n}",
|
|
32050
32060
|
values: { y: y3, n: n3 }
|
|
32051
32061
|
});
|
|
32052
32062
|
}
|
|
32053
32063
|
}();
|
|
32054
|
-
return /* @__PURE__ */
|
|
32064
|
+
return /* @__PURE__ */ React15.createElement(Box_default, {
|
|
32055
32065
|
flexDirection: "column"
|
|
32056
|
-
}, /* @__PURE__ */
|
|
32066
|
+
}, /* @__PURE__ */ React15.createElement(Box_default, {
|
|
32057
32067
|
alignItems: "flex-end"
|
|
32058
|
-
}, typeof props.message === "object" ? props.message : /* @__PURE__ */
|
|
32068
|
+
}, typeof props.message === "object" ? props.message : /* @__PURE__ */ React15.createElement(Text, {
|
|
32059
32069
|
color: colors.yellow
|
|
32060
|
-
}, props.message), /* @__PURE__ */
|
|
32070
|
+
}, props.message), /* @__PURE__ */ React15.createElement(Text, null, " "), /* @__PURE__ */ React15.createElement(Parens, null, /* @__PURE__ */ React15.createElement(Text, {
|
|
32061
32071
|
color: colors.gray
|
|
32062
32072
|
}, choices))));
|
|
32063
32073
|
}
|
|
@@ -32071,7 +32081,7 @@ function assertNever(value) {
|
|
|
32071
32081
|
import * as child from "node:child_process";
|
|
32072
32082
|
|
|
32073
32083
|
// src/app/Store.tsx
|
|
32074
|
-
var
|
|
32084
|
+
var React18 = __toESM(require_react(), 1);
|
|
32075
32085
|
|
|
32076
32086
|
// node_modules/.pnpm/zustand@4.4.4_@types+react@18.2.33_immer@10.0.3_react@18.2.0/node_modules/zustand/esm/vanilla.mjs
|
|
32077
32087
|
var createStoreImpl = (createState) => {
|
|
@@ -32702,7 +32712,7 @@ var immerImpl = (initializer) => (set2, get, store) => {
|
|
|
32702
32712
|
var immer2 = immerImpl;
|
|
32703
32713
|
|
|
32704
32714
|
// src/app/Exit.tsx
|
|
32705
|
-
var
|
|
32715
|
+
var React16 = __toESM(require_react(), 1);
|
|
32706
32716
|
|
|
32707
32717
|
// src/core/sleep.ts
|
|
32708
32718
|
async function sleep(time) {
|
|
@@ -32711,7 +32721,7 @@ async function sleep(time) {
|
|
|
32711
32721
|
|
|
32712
32722
|
// src/app/Exit.tsx
|
|
32713
32723
|
function Exit(props) {
|
|
32714
|
-
|
|
32724
|
+
React16.useEffect(() => {
|
|
32715
32725
|
Exit.handle_exit(props).catch((err) => {
|
|
32716
32726
|
console.error(err);
|
|
32717
32727
|
});
|
|
@@ -32728,7 +32738,7 @@ Exit.handle_exit = async function handle_exit(props) {
|
|
|
32728
32738
|
}
|
|
32729
32739
|
if (state.is_dirty_check_stash) {
|
|
32730
32740
|
await cli("git stash pop");
|
|
32731
|
-
actions.output(/* @__PURE__ */
|
|
32741
|
+
actions.output(/* @__PURE__ */ React16.createElement(Text, {
|
|
32732
32742
|
color: colors.green
|
|
32733
32743
|
}, "✅ Changes restored from stash"));
|
|
32734
32744
|
}
|
|
@@ -32742,7 +32752,7 @@ Exit.handle_exit = async function handle_exit(props) {
|
|
|
32742
32752
|
};
|
|
32743
32753
|
|
|
32744
32754
|
// src/app/LogTimestamp.tsx
|
|
32745
|
-
var
|
|
32755
|
+
var React17 = __toESM(require_react(), 1);
|
|
32746
32756
|
|
|
32747
32757
|
// node_modules/.pnpm/luxon@3.4.4/node_modules/luxon/src/errors.js
|
|
32748
32758
|
class LuxonError extends Error {
|
|
@@ -37037,7 +37047,7 @@ function friendlyDateTime(dateTimeish) {
|
|
|
37037
37047
|
|
|
37038
37048
|
// src/app/LogTimestamp.tsx
|
|
37039
37049
|
function LogTimestamp() {
|
|
37040
|
-
return /* @__PURE__ */
|
|
37050
|
+
return /* @__PURE__ */ React17.createElement(Text, {
|
|
37041
37051
|
dimColor: true
|
|
37042
37052
|
}, DateTime.now().toFormat("[yyyy-MM-dd HH:mm:ss.SSS] "));
|
|
37043
37053
|
}
|
|
@@ -37081,7 +37091,7 @@ var BaseStore = createStore()(immer2((set2, get) => ({
|
|
|
37081
37091
|
state.exit_mode = "normal";
|
|
37082
37092
|
}
|
|
37083
37093
|
let clear = args?.clear ?? true;
|
|
37084
|
-
const node = /* @__PURE__ */
|
|
37094
|
+
const node = /* @__PURE__ */ React18.createElement(Exit, {
|
|
37085
37095
|
clear,
|
|
37086
37096
|
code
|
|
37087
37097
|
});
|
|
@@ -37109,17 +37119,17 @@ var BaseStore = createStore()(immer2((set2, get) => ({
|
|
|
37109
37119
|
error(error) {
|
|
37110
37120
|
let node;
|
|
37111
37121
|
if (typeof error === "string") {
|
|
37112
|
-
node = /* @__PURE__ */
|
|
37122
|
+
node = /* @__PURE__ */ React18.createElement(Text, {
|
|
37113
37123
|
color: colors.red
|
|
37114
37124
|
}, error);
|
|
37115
37125
|
} else if (error instanceof Error) {
|
|
37116
|
-
node = /* @__PURE__ */
|
|
37126
|
+
node = /* @__PURE__ */ React18.createElement(Box_default, {
|
|
37117
37127
|
flexDirection: "column"
|
|
37118
|
-
}, /* @__PURE__ */
|
|
37128
|
+
}, /* @__PURE__ */ React18.createElement(Text, {
|
|
37119
37129
|
color: colors.red
|
|
37120
37130
|
}, error.stack));
|
|
37121
37131
|
} else {
|
|
37122
|
-
node = /* @__PURE__ */
|
|
37132
|
+
node = /* @__PURE__ */ React18.createElement(Text, {
|
|
37123
37133
|
color: colors.red
|
|
37124
37134
|
}, `Unhandled error: ${JSON.stringify(error)}`);
|
|
37125
37135
|
}
|
|
@@ -37203,12 +37213,12 @@ function renderOutputArgs(args) {
|
|
|
37203
37213
|
case "boolean":
|
|
37204
37214
|
case "number":
|
|
37205
37215
|
case "string":
|
|
37206
|
-
output = /* @__PURE__ */
|
|
37216
|
+
output = /* @__PURE__ */ React18.createElement(Text, {
|
|
37207
37217
|
dimColor: args.debug
|
|
37208
37218
|
}, String(args.node));
|
|
37209
37219
|
}
|
|
37210
37220
|
if (args.debug) {
|
|
37211
|
-
return /* @__PURE__ */
|
|
37221
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, args.withoutTimestamp ? null : /* @__PURE__ */ React18.createElement(LogTimestamp, null), output);
|
|
37212
37222
|
}
|
|
37213
37223
|
return output;
|
|
37214
37224
|
}
|
|
@@ -37430,127 +37440,28 @@ function reducer(state, patch) {
|
|
|
37430
37440
|
return { ...state, ...patch };
|
|
37431
37441
|
}
|
|
37432
37442
|
function AutoUpdate(props) {
|
|
37433
|
-
const props_ref =
|
|
37443
|
+
const props_ref = React19.useRef(props);
|
|
37434
37444
|
props_ref.current = props;
|
|
37435
|
-
const [output, set_output] =
|
|
37436
|
-
const [state, patch] =
|
|
37437
|
-
|
|
37445
|
+
const [output, set_output] = React19.useState([]);
|
|
37446
|
+
const [state, patch] = React19.useReducer(reducer, {
|
|
37447
|
+
status: "init",
|
|
37438
37448
|
local_version: null,
|
|
37439
37449
|
latest_version: null,
|
|
37440
|
-
status: "init",
|
|
37441
37450
|
is_brew_bun_standalone: false
|
|
37442
37451
|
});
|
|
37443
|
-
|
|
37444
|
-
|
|
37445
|
-
|
|
37446
|
-
|
|
37447
|
-
|
|
37448
|
-
|
|
37449
|
-
});
|
|
37450
|
-
}
|
|
37451
|
-
}
|
|
37452
|
-
React18.useEffect(() => {
|
|
37452
|
+
React19.useEffect(handle_init_state, []);
|
|
37453
|
+
React19.useEffect(handle_status, [state.latest_version]);
|
|
37454
|
+
React19.useEffect(handle_on_done, [state.status]);
|
|
37455
|
+
const status = render_status();
|
|
37456
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, output, status);
|
|
37457
|
+
function render_status() {
|
|
37453
37458
|
switch (state.status) {
|
|
37454
37459
|
case "init":
|
|
37455
|
-
|
|
37460
|
+
return null;
|
|
37456
37461
|
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";
|
|
37468
|
-
let latest_version = null;
|
|
37469
|
-
let is_brew_bun_standalone = false;
|
|
37470
|
-
const local_version = "2.6.1";
|
|
37471
|
-
const is_output = props_ref.current.verbose || props_ref.current.force;
|
|
37472
|
-
async function auto_update() {
|
|
37473
|
-
if (!local_version) {
|
|
37474
|
-
throw new Error("Auto update requires process.env.CLI_VERSION to be set");
|
|
37475
|
-
}
|
|
37476
|
-
const timeout_ms = is_finite_value(props.timeoutMs) ? props.timeoutMs : 2 * 1000;
|
|
37477
|
-
const npm_json = await Promise.race([
|
|
37478
|
-
fetch_json(`https://registry.npmjs.org/${props.name}`),
|
|
37479
|
-
sleep(timeout_ms).then(() => {
|
|
37480
|
-
throw new Error("AutoUpdate timeout");
|
|
37481
|
-
})
|
|
37482
|
-
]);
|
|
37483
|
-
latest_version = npm_json?.["dist-tags"]?.latest;
|
|
37484
|
-
if (!latest_version) {
|
|
37485
|
-
throw new Error("Unable to retrieve latest version from npm");
|
|
37486
|
-
}
|
|
37487
|
-
const binary_path = process.argv[1];
|
|
37488
|
-
if (props_ref.current.verbose) {
|
|
37489
|
-
handle_output(/* @__PURE__ */ React18.createElement(Text, {
|
|
37490
|
-
dimColor: true
|
|
37491
|
-
}, JSON.stringify({ binary_path })));
|
|
37492
|
-
}
|
|
37493
|
-
is_brew_bun_standalone = binary_path.startsWith("/$bunfs");
|
|
37494
|
-
if (props_ref.current.verbose) {
|
|
37495
|
-
if (is_brew_bun_standalone) {
|
|
37496
|
-
handle_output(/* @__PURE__ */ React18.createElement(Text, {
|
|
37497
|
-
dimColor: true
|
|
37498
|
-
}, "brew install detected (compiled bun standalone)"));
|
|
37499
|
-
} else {
|
|
37500
|
-
handle_output(/* @__PURE__ */ React18.createElement(Text, {
|
|
37501
|
-
dimColor: true
|
|
37502
|
-
}, "npm install detected"));
|
|
37503
|
-
}
|
|
37504
|
-
}
|
|
37505
|
-
if (props_ref.current.verbose) {
|
|
37506
|
-
handle_output(/* @__PURE__ */ React18.createElement(FormatText, {
|
|
37507
|
-
key: "versions",
|
|
37508
|
-
wrapper: /* @__PURE__ */ React18.createElement(Text, null),
|
|
37509
|
-
message: "Auto update found latest version {latest_version} and current local version {local_version}",
|
|
37510
|
-
values: {
|
|
37511
|
-
latest_version: /* @__PURE__ */ React18.createElement(Brackets, null, latest_version),
|
|
37512
|
-
local_version: /* @__PURE__ */ React18.createElement(Brackets, null, local_version)
|
|
37513
|
-
}
|
|
37514
|
-
}));
|
|
37515
|
-
}
|
|
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
|
-
}
|
|
37522
|
-
if (semver_result === 0) {
|
|
37523
|
-
status2 = "done";
|
|
37524
|
-
if (is_output) {
|
|
37525
|
-
handle_output(/* @__PURE__ */ React18.createElement(Text, null, "✅ Everything up to date. ", /* @__PURE__ */ React18.createElement(Brackets, null, latest_version)));
|
|
37526
|
-
}
|
|
37527
|
-
return;
|
|
37528
|
-
}
|
|
37529
|
-
if (semver_result === 1) {
|
|
37530
|
-
status2 = "prompt";
|
|
37531
|
-
}
|
|
37532
|
-
throw new Error("AutoUpdate failed");
|
|
37533
|
-
}
|
|
37534
|
-
const onError = props_ref.current.onError || (() => {
|
|
37535
|
-
});
|
|
37536
|
-
auto_update().then(() => {
|
|
37537
|
-
patch({ status: status2, local_version, latest_version, is_brew_bun_standalone });
|
|
37538
|
-
}).catch((error) => {
|
|
37539
|
-
if (props_ref.current.verbose) {
|
|
37540
|
-
handle_output(/* @__PURE__ */ React18.createElement(Text, {
|
|
37541
|
-
key: "error",
|
|
37542
|
-
color: colors.red
|
|
37543
|
-
}, error?.message));
|
|
37544
|
-
}
|
|
37545
|
-
status2 = "done";
|
|
37546
|
-
patch({ status: status2, error, local_version, latest_version, is_brew_bun_standalone });
|
|
37547
|
-
onError(error);
|
|
37548
|
-
});
|
|
37549
|
-
}, []);
|
|
37550
|
-
const status = function render_status() {
|
|
37551
|
-
switch (state.status) {
|
|
37552
|
-
case "init":
|
|
37553
37462
|
return null;
|
|
37463
|
+
case "done":
|
|
37464
|
+
return props.children;
|
|
37554
37465
|
case "prompt": {
|
|
37555
37466
|
let install_command = "";
|
|
37556
37467
|
if (state.is_brew_bun_standalone) {
|
|
@@ -37558,27 +37469,21 @@ function AutoUpdate(props) {
|
|
|
37558
37469
|
} else {
|
|
37559
37470
|
install_command = `npm install -g ${props.name}@latest`;
|
|
37560
37471
|
}
|
|
37561
|
-
return /* @__PURE__ */
|
|
37562
|
-
message: /* @__PURE__ */
|
|
37563
|
-
flexDirection: "column"
|
|
37564
|
-
|
|
37565
|
-
|
|
37566
|
-
|
|
37567
|
-
color: colors.yellow
|
|
37568
|
-
}, /* @__PURE__ */ React18.createElement(FormatText, {
|
|
37569
|
-
wrapper: /* @__PURE__ */ React18.createElement(Text, null),
|
|
37570
|
-
message: "New version available {latest_version}",
|
|
37571
|
-
values: {
|
|
37572
|
-
latest_version: /* @__PURE__ */ React18.createElement(Brackets, null, state.latest_version)
|
|
37573
|
-
}
|
|
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, {
|
|
37575
|
-
wrapper: /* @__PURE__ */ React18.createElement(Text, {
|
|
37472
|
+
return /* @__PURE__ */ React19.createElement(YesNoPrompt, {
|
|
37473
|
+
message: /* @__PURE__ */ React19.createElement(Box_default, {
|
|
37474
|
+
flexDirection: "column",
|
|
37475
|
+
gap: 1
|
|
37476
|
+
}, /* @__PURE__ */ React19.createElement(Command, null, install_command), /* @__PURE__ */ React19.createElement(FormatText, {
|
|
37477
|
+
wrapper: /* @__PURE__ */ React19.createElement(Text, {
|
|
37576
37478
|
color: colors.yellow
|
|
37577
37479
|
}),
|
|
37578
37480
|
message: "Would you like to run the above command to update?"
|
|
37579
|
-
}))
|
|
37481
|
+
})),
|
|
37482
|
+
onNo: () => {
|
|
37483
|
+
patch({ status: "done" });
|
|
37484
|
+
},
|
|
37580
37485
|
onYes: async () => {
|
|
37581
|
-
|
|
37486
|
+
info(/* @__PURE__ */ React19.createElement(Command, null, install_command));
|
|
37582
37487
|
patch({ status: "install" });
|
|
37583
37488
|
await cli(install_command, {
|
|
37584
37489
|
env: {
|
|
@@ -37586,34 +37491,164 @@ function AutoUpdate(props) {
|
|
|
37586
37491
|
HOMEBREW_COLOR: "1"
|
|
37587
37492
|
},
|
|
37588
37493
|
onOutput: (data) => {
|
|
37589
|
-
|
|
37494
|
+
info(/* @__PURE__ */ React19.createElement(Text, null, data));
|
|
37590
37495
|
}
|
|
37591
37496
|
});
|
|
37592
|
-
|
|
37497
|
+
info(/* @__PURE__ */ React19.createElement(Text, {
|
|
37593
37498
|
key: "done"
|
|
37594
|
-
}, "✅ Installed ", /* @__PURE__ */
|
|
37595
|
-
patch({ status: "done" });
|
|
37596
|
-
},
|
|
37597
|
-
onNo: () => {
|
|
37499
|
+
}, "✅ Installed ", /* @__PURE__ */ React19.createElement(Brackets, null, state.latest_version)));
|
|
37598
37500
|
patch({ status: "done" });
|
|
37599
37501
|
}
|
|
37600
37502
|
});
|
|
37601
37503
|
}
|
|
37504
|
+
}
|
|
37505
|
+
}
|
|
37506
|
+
function handle_on_done() {
|
|
37507
|
+
switch (state.status) {
|
|
37508
|
+
case "init":
|
|
37509
|
+
case "prompt":
|
|
37602
37510
|
case "install":
|
|
37603
|
-
|
|
37604
|
-
case "done":
|
|
37605
|
-
|
|
37511
|
+
break;
|
|
37512
|
+
case "done": {
|
|
37513
|
+
props.onDone?.();
|
|
37514
|
+
break;
|
|
37515
|
+
}
|
|
37516
|
+
default:
|
|
37517
|
+
assertNever(state.status);
|
|
37606
37518
|
}
|
|
37607
|
-
}
|
|
37608
|
-
|
|
37519
|
+
}
|
|
37520
|
+
function handle_init_state() {
|
|
37521
|
+
init_state().catch(abort);
|
|
37522
|
+
async function init_state() {
|
|
37523
|
+
if (state.latest_version !== null)
|
|
37524
|
+
return;
|
|
37525
|
+
const local_version = "2.7.1";
|
|
37526
|
+
const latest_version = await get_latest_version();
|
|
37527
|
+
const is_brew_bun_standalone = get_is_brew_bun_standalone();
|
|
37528
|
+
patch({ local_version, latest_version, is_brew_bun_standalone });
|
|
37529
|
+
}
|
|
37530
|
+
async function get_latest_version() {
|
|
37531
|
+
const timeout_ms = is_finite_value(props.timeoutMs) ? props.timeoutMs : 2 * 1000;
|
|
37532
|
+
const npm_json = await Promise.race([
|
|
37533
|
+
fetch_json(`https://registry.npmjs.org/${props.name}`),
|
|
37534
|
+
sleep(timeout_ms).then(() => {
|
|
37535
|
+
abort(new Error("AutoUpdate timeout"));
|
|
37536
|
+
})
|
|
37537
|
+
]);
|
|
37538
|
+
const maybe_version = npm_json?.["dist-tags"]?.latest;
|
|
37539
|
+
if (typeof maybe_version === "string") {
|
|
37540
|
+
return maybe_version;
|
|
37541
|
+
}
|
|
37542
|
+
throw new Error("Unable to retrieve latest version from npm");
|
|
37543
|
+
}
|
|
37544
|
+
function get_is_brew_bun_standalone() {
|
|
37545
|
+
const binary_path = process.argv[1];
|
|
37546
|
+
debug(/* @__PURE__ */ React19.createElement(Text, {
|
|
37547
|
+
dimColor: true
|
|
37548
|
+
}, JSON.stringify({ binary_path })));
|
|
37549
|
+
const is_bunfs_path = binary_path.startsWith("/$bunfs");
|
|
37550
|
+
debug(/* @__PURE__ */ React19.createElement(Text, {
|
|
37551
|
+
dimColor: true
|
|
37552
|
+
}, is_bunfs_path ? "brew install detected (compiled bun standalone)" : "npm install detected"));
|
|
37553
|
+
return is_bunfs_path;
|
|
37554
|
+
}
|
|
37555
|
+
}
|
|
37556
|
+
function handle_status() {
|
|
37557
|
+
const latest_version = state.latest_version;
|
|
37558
|
+
if (latest_version === null) {
|
|
37559
|
+
return;
|
|
37560
|
+
}
|
|
37561
|
+
const local_version = state.local_version;
|
|
37562
|
+
if (!local_version) {
|
|
37563
|
+
throw new Error("Auto update requires process.env.CLI_VERSION to be set");
|
|
37564
|
+
}
|
|
37565
|
+
debug(/* @__PURE__ */ React19.createElement(FormatText, {
|
|
37566
|
+
key: "versions",
|
|
37567
|
+
wrapper: /* @__PURE__ */ React19.createElement(Text, {
|
|
37568
|
+
dimColor: true
|
|
37569
|
+
}),
|
|
37570
|
+
message: "Auto update found latest version {latest_version} and current local version {local_version}",
|
|
37571
|
+
values: {
|
|
37572
|
+
latest_version: /* @__PURE__ */ React19.createElement(Brackets, null, latest_version),
|
|
37573
|
+
local_version: /* @__PURE__ */ React19.createElement(Brackets, null, local_version)
|
|
37574
|
+
}
|
|
37575
|
+
}));
|
|
37576
|
+
const semver_result = semver_compare(latest_version, local_version);
|
|
37577
|
+
debug(/* @__PURE__ */ React19.createElement(Text, {
|
|
37578
|
+
dimColor: true
|
|
37579
|
+
}, JSON.stringify({ semver_result })));
|
|
37580
|
+
switch (semver_result) {
|
|
37581
|
+
case 0: {
|
|
37582
|
+
info(/* @__PURE__ */ React19.createElement(Text, null, "✅ Everything up to date. ", /* @__PURE__ */ React19.createElement(Brackets, null, latest_version)));
|
|
37583
|
+
return patch({ status: "done" });
|
|
37584
|
+
}
|
|
37585
|
+
case 1: {
|
|
37586
|
+
const old_tag = local_version;
|
|
37587
|
+
const new_tag = state.latest_version;
|
|
37588
|
+
const url = `https://github.com/magus/git-stack-cli/compare/${old_tag}...${new_tag}`;
|
|
37589
|
+
info(/* @__PURE__ */ React19.createElement(Box_default, {
|
|
37590
|
+
flexDirection: "column",
|
|
37591
|
+
gap: 1,
|
|
37592
|
+
paddingTop: 1,
|
|
37593
|
+
paddingBottom: 1
|
|
37594
|
+
}, /* @__PURE__ */ React19.createElement(Text, null, "\uD83C\uDD95 New version available! ", /* @__PURE__ */ React19.createElement(Brackets, null, latest_version)), /* @__PURE__ */ React19.createElement(Box_default, {
|
|
37595
|
+
flexDirection: "column"
|
|
37596
|
+
}, /* @__PURE__ */ React19.createElement(Text, {
|
|
37597
|
+
dimColor: true
|
|
37598
|
+
}, "Changelog"), /* @__PURE__ */ React19.createElement(Url, null, url))));
|
|
37599
|
+
return patch({ status: "prompt" });
|
|
37600
|
+
}
|
|
37601
|
+
case -1: {
|
|
37602
|
+
info(/* @__PURE__ */ React19.createElement(FormatText, {
|
|
37603
|
+
message: "⚠️ Local version {local_version} is newer than latest version {latest_version}",
|
|
37604
|
+
values: {
|
|
37605
|
+
local_version: /* @__PURE__ */ React19.createElement(Brackets, null, local_version),
|
|
37606
|
+
latest_version: /* @__PURE__ */ React19.createElement(Brackets, null, latest_version)
|
|
37607
|
+
}
|
|
37608
|
+
}));
|
|
37609
|
+
return patch({ status: "done" });
|
|
37610
|
+
}
|
|
37611
|
+
default: {
|
|
37612
|
+
assertNever(semver_result);
|
|
37613
|
+
abort(new Error("AutoUpdate failed"));
|
|
37614
|
+
}
|
|
37615
|
+
}
|
|
37616
|
+
}
|
|
37617
|
+
function info(node) {
|
|
37618
|
+
if (props_ref.current.verbose || props_ref.current.force) {
|
|
37619
|
+
handle_output(node);
|
|
37620
|
+
}
|
|
37621
|
+
}
|
|
37622
|
+
function debug(node) {
|
|
37623
|
+
if (props_ref.current.verbose) {
|
|
37624
|
+
handle_output(node);
|
|
37625
|
+
}
|
|
37626
|
+
}
|
|
37627
|
+
function abort(error) {
|
|
37628
|
+
info(/* @__PURE__ */ React19.createElement(Text, {
|
|
37629
|
+
key: "error",
|
|
37630
|
+
color: colors.red
|
|
37631
|
+
}, error.message));
|
|
37632
|
+
patch({ status: "done" });
|
|
37633
|
+
props_ref.current.onError?.(error);
|
|
37634
|
+
}
|
|
37635
|
+
function handle_output(node) {
|
|
37636
|
+
if (typeof props.onOutput === "function") {
|
|
37637
|
+
props.onOutput(node);
|
|
37638
|
+
} else {
|
|
37639
|
+
set_output((current2) => {
|
|
37640
|
+
return [...current2, node];
|
|
37641
|
+
});
|
|
37642
|
+
}
|
|
37643
|
+
}
|
|
37609
37644
|
}
|
|
37610
37645
|
|
|
37611
37646
|
// src/app/CherryPickCheck.tsx
|
|
37612
|
-
var
|
|
37647
|
+
var React21 = __toESM(require_react(), 1);
|
|
37613
37648
|
import path from "node:path";
|
|
37614
37649
|
|
|
37615
37650
|
// src/app/Await.tsx
|
|
37616
|
-
var
|
|
37651
|
+
var React20 = __toESM(require_react(), 1);
|
|
37617
37652
|
|
|
37618
37653
|
// src/core/cache.ts
|
|
37619
37654
|
function cache3(cacheable) {
|
|
@@ -37661,8 +37696,8 @@ function invariant(condition, message) {
|
|
|
37661
37696
|
|
|
37662
37697
|
// src/app/Await.tsx
|
|
37663
37698
|
function Await(props) {
|
|
37664
|
-
const [display_fallback, set_display_fallback] =
|
|
37665
|
-
const cacheRef =
|
|
37699
|
+
const [display_fallback, set_display_fallback] = React20.useState(false);
|
|
37700
|
+
const cacheRef = React20.useRef(null);
|
|
37666
37701
|
if (!cacheRef.current) {
|
|
37667
37702
|
cacheRef.current = cache3(props.function);
|
|
37668
37703
|
}
|
|
@@ -37672,7 +37707,7 @@ function Await(props) {
|
|
|
37672
37707
|
} else {
|
|
37673
37708
|
delayFallbackMs = 1000;
|
|
37674
37709
|
}
|
|
37675
|
-
|
|
37710
|
+
React20.useEffect(() => {
|
|
37676
37711
|
const cache4 = cacheRef.current;
|
|
37677
37712
|
if (!cache4) {
|
|
37678
37713
|
return;
|
|
@@ -37689,13 +37724,13 @@ function Await(props) {
|
|
|
37689
37724
|
}, [delayFallbackMs]);
|
|
37690
37725
|
invariant(cacheRef.current, "cache must exist");
|
|
37691
37726
|
if ("fallback" in props) {
|
|
37692
|
-
return /* @__PURE__ */
|
|
37727
|
+
return /* @__PURE__ */ React20.createElement(React20.Suspense, {
|
|
37693
37728
|
fallback: !display_fallback ? null : props.fallback
|
|
37694
|
-
}, /* @__PURE__ */
|
|
37729
|
+
}, /* @__PURE__ */ React20.createElement(ReadCache, {
|
|
37695
37730
|
cache: cacheRef.current
|
|
37696
37731
|
}, props.children));
|
|
37697
37732
|
}
|
|
37698
|
-
return /* @__PURE__ */
|
|
37733
|
+
return /* @__PURE__ */ React20.createElement(ReadCache, {
|
|
37699
37734
|
cache: cacheRef.current
|
|
37700
37735
|
});
|
|
37701
37736
|
}
|
|
@@ -37721,17 +37756,17 @@ function reducer2(state, patch) {
|
|
|
37721
37756
|
}
|
|
37722
37757
|
function CherryPickCheck(props) {
|
|
37723
37758
|
const actions = Store.useActions();
|
|
37724
|
-
const [state, patch] =
|
|
37759
|
+
const [state, patch] = React21.useReducer(reducer2, {
|
|
37725
37760
|
status: "init"
|
|
37726
37761
|
});
|
|
37727
37762
|
switch (state.status) {
|
|
37728
37763
|
case "done":
|
|
37729
37764
|
return props.children;
|
|
37730
37765
|
case "prompt":
|
|
37731
|
-
return /* @__PURE__ */
|
|
37732
|
-
message: /* @__PURE__ */
|
|
37766
|
+
return /* @__PURE__ */ React21.createElement(YesNoPrompt, {
|
|
37767
|
+
message: /* @__PURE__ */ React21.createElement(Text, {
|
|
37733
37768
|
color: colors.yellow
|
|
37734
|
-
}, /* @__PURE__ */
|
|
37769
|
+
}, /* @__PURE__ */ React21.createElement(Command, null, "git cherry-pick"), " detected, would you like to abort it?"),
|
|
37735
37770
|
onYes: async () => {
|
|
37736
37771
|
await cli(`git cherry-pick --abort`);
|
|
37737
37772
|
patch({ status: "done" });
|
|
@@ -37741,11 +37776,11 @@ function CherryPickCheck(props) {
|
|
|
37741
37776
|
}
|
|
37742
37777
|
});
|
|
37743
37778
|
default:
|
|
37744
|
-
return /* @__PURE__ */
|
|
37779
|
+
return /* @__PURE__ */ React21.createElement(Await, {
|
|
37745
37780
|
function: run,
|
|
37746
|
-
fallback: /* @__PURE__ */
|
|
37781
|
+
fallback: /* @__PURE__ */ React21.createElement(Text, {
|
|
37747
37782
|
color: colors.yellow
|
|
37748
|
-
}, "Checking for ", /* @__PURE__ */
|
|
37783
|
+
}, "Checking for ", /* @__PURE__ */ React21.createElement(Command, null, "git cherry-pick"), "…")
|
|
37749
37784
|
});
|
|
37750
37785
|
}
|
|
37751
37786
|
async function run() {
|
|
@@ -37771,7 +37806,7 @@ function CherryPickCheck(props) {
|
|
|
37771
37806
|
}
|
|
37772
37807
|
|
|
37773
37808
|
// src/app/Debug.tsx
|
|
37774
|
-
var
|
|
37809
|
+
var React22 = __toESM(require_react(), 1);
|
|
37775
37810
|
import fs4 from "node:fs/promises";
|
|
37776
37811
|
import path2 from "node:path";
|
|
37777
37812
|
|
|
@@ -37824,14 +37859,14 @@ function Debug() {
|
|
|
37824
37859
|
const state = Store.useState((state2) => state2);
|
|
37825
37860
|
const argv = Store.useState((state2) => state2.argv);
|
|
37826
37861
|
const debug = Store.useState((state2) => state2.select.debug(state2));
|
|
37827
|
-
|
|
37862
|
+
React22.useEffect(function debugMessageOnce() {
|
|
37828
37863
|
if (debug) {
|
|
37829
|
-
actions.output(/* @__PURE__ */
|
|
37864
|
+
actions.output(/* @__PURE__ */ React22.createElement(Text, {
|
|
37830
37865
|
color: colors.yellow
|
|
37831
37866
|
}, "Debug mode enabled"));
|
|
37832
37867
|
}
|
|
37833
37868
|
}, [argv]);
|
|
37834
|
-
|
|
37869
|
+
React22.useEffect(function sync_state_json() {
|
|
37835
37870
|
if (!argv?.["write-state-json"]) {
|
|
37836
37871
|
return;
|
|
37837
37872
|
}
|
|
@@ -37850,16 +37885,6 @@ function Debug() {
|
|
|
37850
37885
|
// src/app/DependencyCheck.tsx
|
|
37851
37886
|
var React23 = __toESM(require_react(), 1);
|
|
37852
37887
|
|
|
37853
|
-
// src/app/Url.tsx
|
|
37854
|
-
var React22 = __toESM(require_react(), 1);
|
|
37855
|
-
function Url(props) {
|
|
37856
|
-
return /* @__PURE__ */ React22.createElement(Text, {
|
|
37857
|
-
bold: true,
|
|
37858
|
-
color: colors.blue,
|
|
37859
|
-
...props
|
|
37860
|
-
}, props.children);
|
|
37861
|
-
}
|
|
37862
|
-
|
|
37863
37888
|
// src/core/is_command_available.ts
|
|
37864
37889
|
import fs5 from "node:fs";
|
|
37865
37890
|
import path3 from "node:path";
|
|
@@ -39844,11 +39869,6 @@ function get_value(props) {
|
|
|
39844
39869
|
return props.value || props.defaultValue || "";
|
|
39845
39870
|
}
|
|
39846
39871
|
|
|
39847
|
-
// src/core/gs_short_id.ts
|
|
39848
|
-
function gs_short_id() {
|
|
39849
|
-
return `gs-${short_id()}`;
|
|
39850
|
-
}
|
|
39851
|
-
|
|
39852
39872
|
// src/app/SelectCommitRanges.tsx
|
|
39853
39873
|
function SelectCommitRanges() {
|
|
39854
39874
|
const commit_range = Store.useState((state) => state.commit_range);
|
|
@@ -39860,6 +39880,8 @@ function SelectCommitRanges() {
|
|
|
39860
39880
|
function SelectCommitRangesInternal(props) {
|
|
39861
39881
|
const actions = Store.useActions();
|
|
39862
39882
|
const argv = Store.useState((state) => state.argv);
|
|
39883
|
+
const branch_name = Store.useState((state) => state.branch_name);
|
|
39884
|
+
invariant(branch_name, "branch_name must exist");
|
|
39863
39885
|
const [selected_group_id, set_selected_group_id] = React42.useState(() => {
|
|
39864
39886
|
const first_group = props.commit_range.group_list.find((g2) => g2.id !== props.commit_range.UNASSIGNED);
|
|
39865
39887
|
if (first_group) {
|
|
@@ -40155,13 +40177,7 @@ function SelectCommitRangesInternal(props) {
|
|
|
40155
40177
|
}
|
|
40156
40178
|
})));
|
|
40157
40179
|
function get_group_id() {
|
|
40158
|
-
|
|
40159
|
-
if (argv["branch-prefix"]) {
|
|
40160
|
-
branch_prefix = argv["branch-prefix"];
|
|
40161
|
-
} else if (process.env.GIT_STACK_BRANCH_PREFIX) {
|
|
40162
|
-
branch_prefix = process.env.GIT_STACK_BRANCH_PREFIX;
|
|
40163
|
-
}
|
|
40164
|
-
return `${branch_prefix}${gs_short_id()}`;
|
|
40180
|
+
return `${branch_name}-${short_id()}`;
|
|
40165
40181
|
}
|
|
40166
40182
|
function submit_group_input(title) {
|
|
40167
40183
|
const id = get_group_id();
|
|
@@ -40674,287 +40690,35 @@ async function run11() {
|
|
|
40674
40690
|
}
|
|
40675
40691
|
}
|
|
40676
40692
|
|
|
40677
|
-
// src/commands/
|
|
40693
|
+
// src/commands/Config.tsx
|
|
40678
40694
|
var React50 = __toESM(require_react(), 1);
|
|
40679
|
-
|
|
40680
|
-
|
|
40681
|
-
|
|
40682
|
-
|
|
40683
|
-
|
|
40684
|
-
|
|
40685
|
-
|
|
40686
|
-
|
|
40687
|
-
|
|
40688
|
-
|
|
40689
|
-
|
|
40690
|
-
|
|
40691
|
-
|
|
40692
|
-
|
|
40693
|
-
|
|
40694
|
-
|
|
40695
|
-
|
|
40696
|
-
|
|
40697
|
-
|
|
40698
|
-
|
|
40699
|
-
actions.output(" ❯ git stack log");
|
|
40700
|
-
actions.output(" 1\te329794d5f881cbf0fc3f26d2108cf6f3fdebabe enable drop_error_subtask test param");
|
|
40701
|
-
actions.output(" 2\t57f43b596e5c6b97bc47e2a591f82ccc81651156 test drop_error_subtask baseline");
|
|
40702
|
-
actions.output(" 3\t838e878d483c6a2d5393063fc59baf2407225c6d ErrorSubtask test baseline");
|
|
40703
|
-
actions.output("");
|
|
40704
|
-
actions.output("To target `838e87` above, you would call `fixup 3`");
|
|
40705
|
-
actions.exit(0);
|
|
40695
|
+
|
|
40696
|
+
// node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/lib/platform-shims/esm.mjs
|
|
40697
|
+
import { notStrictEqual, strictEqual } from "assert";
|
|
40698
|
+
|
|
40699
|
+
// node_modules/.pnpm/cliui@8.0.1/node_modules/cliui/build/lib/index.js
|
|
40700
|
+
var align = {
|
|
40701
|
+
right: alignRight,
|
|
40702
|
+
center: alignCenter
|
|
40703
|
+
};
|
|
40704
|
+
var top = 0;
|
|
40705
|
+
var right = 1;
|
|
40706
|
+
var bottom = 2;
|
|
40707
|
+
var left = 3;
|
|
40708
|
+
|
|
40709
|
+
class UI {
|
|
40710
|
+
constructor(opts) {
|
|
40711
|
+
var _a;
|
|
40712
|
+
this.width = opts.width;
|
|
40713
|
+
this.wrap = (_a = opts.wrap) !== null && _a !== undefined ? _a : true;
|
|
40714
|
+
this.rows = [];
|
|
40706
40715
|
}
|
|
40707
|
-
|
|
40708
|
-
|
|
40709
|
-
|
|
40710
|
-
if (!diff_staged_cmd.code) {
|
|
40711
|
-
actions.error("\uD83D\uDEA8 Stage changes before calling fixup");
|
|
40712
|
-
actions.exit(1);
|
|
40716
|
+
span(...args) {
|
|
40717
|
+
const cols = this.div(...args);
|
|
40718
|
+
cols.span = true;
|
|
40713
40719
|
}
|
|
40714
|
-
|
|
40715
|
-
|
|
40716
|
-
actions.output(/* @__PURE__ */ React50.createElement(FormatText, {
|
|
40717
|
-
wrapper: /* @__PURE__ */ React50.createElement(Text, {
|
|
40718
|
-
color: colors.yellow
|
|
40719
|
-
}),
|
|
40720
|
-
message: "\uD83D\uDEE0️ fixup {relative_number} {commit_sha}",
|
|
40721
|
-
values: {
|
|
40722
|
-
commit_sha: /* @__PURE__ */ React50.createElement(Parens, null, commit_sha),
|
|
40723
|
-
relative_number
|
|
40724
|
-
}
|
|
40725
|
-
}));
|
|
40726
|
-
await cli(`git commit --fixup ${commit_sha}`);
|
|
40727
|
-
let save_stash = false;
|
|
40728
|
-
const diff_cmd = await cli("git diff-index --quiet HEAD --", {
|
|
40729
|
-
ignoreExitCode: true
|
|
40730
|
-
});
|
|
40731
|
-
if (diff_cmd.code) {
|
|
40732
|
-
save_stash = true;
|
|
40733
|
-
await cli("git stash --include-untracked");
|
|
40734
|
-
actions.output(/* @__PURE__ */ React50.createElement(Text, {
|
|
40735
|
-
color: colors.yellow
|
|
40736
|
-
}, /* @__PURE__ */ React50.createElement(FormatText, {
|
|
40737
|
-
message: "\uD83D\uDCE6 Changes saved to stash"
|
|
40738
|
-
})));
|
|
40739
|
-
}
|
|
40740
|
-
try {
|
|
40741
|
-
const rebase_target = Number(relative_number) + 1;
|
|
40742
|
-
await cli(`git rebase -i --autosquash HEAD~${rebase_target}`, {
|
|
40743
|
-
env: {
|
|
40744
|
-
...process.env,
|
|
40745
|
-
GIT_EDITOR: "true"
|
|
40746
|
-
}
|
|
40747
|
-
});
|
|
40748
|
-
} catch (error) {
|
|
40749
|
-
actions.error("\uD83D\uDEA8 Fixup failed");
|
|
40750
|
-
await cli("git rebase --abort");
|
|
40751
|
-
await cli("git reset --soft HEAD~1");
|
|
40752
|
-
} finally {
|
|
40753
|
-
if (save_stash) {
|
|
40754
|
-
await cli("git stash pop");
|
|
40755
|
-
actions.output(/* @__PURE__ */ React50.createElement(Text, {
|
|
40756
|
-
color: colors.green
|
|
40757
|
-
}, "✅ Changes restored from stash"));
|
|
40758
|
-
}
|
|
40759
|
-
}
|
|
40760
|
-
actions.exit(0);
|
|
40761
|
-
}
|
|
40762
|
-
|
|
40763
|
-
// src/commands/Log.tsx
|
|
40764
|
-
var React51 = __toESM(require_react(), 1);
|
|
40765
|
-
function Log() {
|
|
40766
|
-
const { stdout } = use_stdout_default();
|
|
40767
|
-
const available_width = stdout.columns || 80;
|
|
40768
|
-
return /* @__PURE__ */ React51.createElement(Await, {
|
|
40769
|
-
fallback: null,
|
|
40770
|
-
function: () => run13({ available_width })
|
|
40771
|
-
});
|
|
40772
|
-
}
|
|
40773
|
-
async function run13(args) {
|
|
40774
|
-
const state = Store.getState();
|
|
40775
|
-
const actions = state.actions;
|
|
40776
|
-
const process_argv = state.process_argv;
|
|
40777
|
-
invariant(actions, "actions must exist");
|
|
40778
|
-
const color_buffer = 12 * 5;
|
|
40779
|
-
const truncation_width = args.available_width + color_buffer;
|
|
40780
|
-
const short_sha = (await cli(`git log -1 --format=%h`)).stdout.trim();
|
|
40781
|
-
const short_sha_length = short_sha.length + 1;
|
|
40782
|
-
const sha_format = `%C(green)%<(${short_sha_length},trunc)%h`;
|
|
40783
|
-
const date_format = `%C(white)%<(15,trunc)%cr`;
|
|
40784
|
-
const author_format = `%C(white)%<(8,trunc)%al`;
|
|
40785
|
-
const decoration_format = `%C(auto)%d`;
|
|
40786
|
-
const subject_format = `%<(60,trunc)%s`;
|
|
40787
|
-
const format = [sha_format, date_format, author_format, decoration_format, subject_format].join(" ");
|
|
40788
|
-
const rest_args = process_argv.slice(3).join(" ");
|
|
40789
|
-
const command = [
|
|
40790
|
-
`git log --pretty=format:"${format}" -n20 --graph --color ${rest_args}`,
|
|
40791
|
-
`cut -c 1-"${truncation_width}"`,
|
|
40792
|
-
`nl -w3 -s' '`
|
|
40793
|
-
].join(" | ");
|
|
40794
|
-
const result = await cli(command);
|
|
40795
|
-
actions.output(result.stdout);
|
|
40796
|
-
actions.exit(0);
|
|
40797
|
-
}
|
|
40798
|
-
|
|
40799
|
-
// src/commands/Update.tsx
|
|
40800
|
-
var React52 = __toESM(require_react(), 1);
|
|
40801
|
-
function Update() {
|
|
40802
|
-
return /* @__PURE__ */ React52.createElement(Await, {
|
|
40803
|
-
fallback: null,
|
|
40804
|
-
function: run14
|
|
40805
|
-
});
|
|
40806
|
-
}
|
|
40807
|
-
async function run14() {
|
|
40808
|
-
const state = Store.getState();
|
|
40809
|
-
const actions = state.actions;
|
|
40810
|
-
actions.exit(0);
|
|
40811
|
-
}
|
|
40812
|
-
|
|
40813
|
-
// src/components/ErrorBoundary.tsx
|
|
40814
|
-
var React53 = __toESM(require_react(), 1);
|
|
40815
|
-
class ErrorBoundary extends React53.Component {
|
|
40816
|
-
constructor(props) {
|
|
40817
|
-
super(props);
|
|
40818
|
-
this.state = {
|
|
40819
|
-
error: null,
|
|
40820
|
-
component_stack: ""
|
|
40821
|
-
};
|
|
40822
|
-
}
|
|
40823
|
-
static getDerivedStateFromError(error) {
|
|
40824
|
-
return { error };
|
|
40825
|
-
}
|
|
40826
|
-
componentDidCatch(_error, error_info) {
|
|
40827
|
-
let component_stack = error_info.componentStack;
|
|
40828
|
-
if (component_stack) {
|
|
40829
|
-
component_stack = component_stack.split(`
|
|
40830
|
-
`).slice(1).join(`
|
|
40831
|
-
`);
|
|
40832
|
-
this.setState({ component_stack }, async () => {
|
|
40833
|
-
await Exit.handle_exit({ code: 30, clear: true });
|
|
40834
|
-
});
|
|
40835
|
-
}
|
|
40836
|
-
}
|
|
40837
|
-
render() {
|
|
40838
|
-
if (!this.state.error) {
|
|
40839
|
-
return this.props.children;
|
|
40840
|
-
}
|
|
40841
|
-
const message = this.state.error.message;
|
|
40842
|
-
return /* @__PURE__ */ React53.createElement(Box_default, {
|
|
40843
|
-
flexDirection: "column",
|
|
40844
|
-
gap: 0
|
|
40845
|
-
}, /* @__PURE__ */ React53.createElement(Text, {
|
|
40846
|
-
color: colors.red
|
|
40847
|
-
}, /* @__PURE__ */ React53.createElement(FormatText, {
|
|
40848
|
-
message: "\uD83D\uDEA8 Unhandled error {message}",
|
|
40849
|
-
values: {
|
|
40850
|
-
message: /* @__PURE__ */ React53.createElement(Text, {
|
|
40851
|
-
color: colors.gray
|
|
40852
|
-
}, message)
|
|
40853
|
-
}
|
|
40854
|
-
})), this._render_verbose());
|
|
40855
|
-
}
|
|
40856
|
-
_render_verbose() {
|
|
40857
|
-
const store_state = Store.getState();
|
|
40858
|
-
if (store_state.argv.verbose) {
|
|
40859
|
-
return /* @__PURE__ */ React53.createElement(Text, {
|
|
40860
|
-
color: colors.gray
|
|
40861
|
-
}, this.state.component_stack);
|
|
40862
|
-
}
|
|
40863
|
-
return /* @__PURE__ */ React53.createElement(Text, {
|
|
40864
|
-
color: colors.gray
|
|
40865
|
-
}, /* @__PURE__ */ React53.createElement(FormatText, {
|
|
40866
|
-
message: "Try again with `--verbose` to see more information."
|
|
40867
|
-
}));
|
|
40868
|
-
}
|
|
40869
|
-
}
|
|
40870
|
-
|
|
40871
|
-
// src/components/ExitingGate.tsx
|
|
40872
|
-
var React54 = __toESM(require_react(), 1);
|
|
40873
|
-
function ExitingGate(props) {
|
|
40874
|
-
const exit_mode = Store.useState((state) => state.exit_mode);
|
|
40875
|
-
if (!exit_mode) {
|
|
40876
|
-
return props.children;
|
|
40877
|
-
}
|
|
40878
|
-
switch (exit_mode) {
|
|
40879
|
-
case "quiet":
|
|
40880
|
-
return null;
|
|
40881
|
-
case "normal":
|
|
40882
|
-
return /* @__PURE__ */ React54.createElement(Box_default, {
|
|
40883
|
-
flexDirection: "column"
|
|
40884
|
-
}, /* @__PURE__ */ React54.createElement(Text, {
|
|
40885
|
-
color: colors.red
|
|
40886
|
-
}, /* @__PURE__ */ React54.createElement(FormatText, {
|
|
40887
|
-
message: "\uD83D\uDEA8 Exiting…"
|
|
40888
|
-
})));
|
|
40889
|
-
default:
|
|
40890
|
-
return null;
|
|
40891
|
-
}
|
|
40892
|
-
}
|
|
40893
|
-
|
|
40894
|
-
// src/app/App.tsx
|
|
40895
|
-
function App2() {
|
|
40896
|
-
const actions = Store.useActions();
|
|
40897
|
-
const ink = Store.useState((state) => state.ink);
|
|
40898
|
-
const argv = Store.useState((state) => state.argv);
|
|
40899
|
-
if (!ink || !argv || !argv.$0) {
|
|
40900
|
-
return null;
|
|
40901
|
-
}
|
|
40902
|
-
const positional_list = new Set(argv["_"]);
|
|
40903
|
-
const is_update = positional_list.has("update") || positional_list.has("upgrade");
|
|
40904
|
-
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, {
|
|
40905
|
-
name: "git-stack-cli",
|
|
40906
|
-
verbose: argv.verbose,
|
|
40907
|
-
force: is_update,
|
|
40908
|
-
timeoutMs: is_update ? 30 * 1000 : 2 * 1000,
|
|
40909
|
-
onOutput: actions.output,
|
|
40910
|
-
onDone: () => {
|
|
40911
|
-
if (is_update) {
|
|
40912
|
-
actions.exit(0);
|
|
40913
|
-
}
|
|
40914
|
-
}
|
|
40915
|
-
}, /* @__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))));
|
|
40916
|
-
}
|
|
40917
|
-
function MaybeMain() {
|
|
40918
|
-
const argv = Store.useState((state) => state.argv);
|
|
40919
|
-
const positional_list = new Set(argv["_"]);
|
|
40920
|
-
if (positional_list.has("fixup")) {
|
|
40921
|
-
return /* @__PURE__ */ React55.createElement(Fixup, null);
|
|
40922
|
-
} else if (positional_list.has("log")) {
|
|
40923
|
-
return /* @__PURE__ */ React55.createElement(Log, null);
|
|
40924
|
-
} else if (positional_list.has("update")) {
|
|
40925
|
-
return /* @__PURE__ */ React55.createElement(Update, null);
|
|
40926
|
-
} else if (positional_list.has("rebase")) {
|
|
40927
|
-
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)))));
|
|
40928
|
-
}
|
|
40929
|
-
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(RequireBranch, null, /* @__PURE__ */ React55.createElement(LocalCommitStatus, null, /* @__PURE__ */ React55.createElement(DetectInitialPR, null, /* @__PURE__ */ React55.createElement(Main, null))))))));
|
|
40930
|
-
}
|
|
40931
|
-
|
|
40932
|
-
// node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/lib/platform-shims/esm.mjs
|
|
40933
|
-
import { notStrictEqual, strictEqual } from "assert";
|
|
40934
|
-
|
|
40935
|
-
// node_modules/.pnpm/cliui@8.0.1/node_modules/cliui/build/lib/index.js
|
|
40936
|
-
var align = {
|
|
40937
|
-
right: alignRight,
|
|
40938
|
-
center: alignCenter
|
|
40939
|
-
};
|
|
40940
|
-
var top = 0;
|
|
40941
|
-
var right = 1;
|
|
40942
|
-
var bottom = 2;
|
|
40943
|
-
var left = 3;
|
|
40944
|
-
|
|
40945
|
-
class UI {
|
|
40946
|
-
constructor(opts) {
|
|
40947
|
-
var _a;
|
|
40948
|
-
this.width = opts.width;
|
|
40949
|
-
this.wrap = (_a = opts.wrap) !== null && _a !== undefined ? _a : true;
|
|
40950
|
-
this.rows = [];
|
|
40951
|
-
}
|
|
40952
|
-
span(...args) {
|
|
40953
|
-
const cols = this.div(...args);
|
|
40954
|
-
cols.span = true;
|
|
40955
|
-
}
|
|
40956
|
-
resetOutput() {
|
|
40957
|
-
this.rows = [];
|
|
40720
|
+
resetOutput() {
|
|
40721
|
+
this.rows = [];
|
|
40958
40722
|
}
|
|
40959
40723
|
div(...args) {
|
|
40960
40724
|
if (args.length === 0) {
|
|
@@ -45790,8 +45554,17 @@ var Yargs = YargsFactory(esm_default);
|
|
|
45790
45554
|
var yargs_default = Yargs;
|
|
45791
45555
|
|
|
45792
45556
|
// src/command.ts
|
|
45793
|
-
async function command2() {
|
|
45794
|
-
|
|
45557
|
+
async function command2(argv, options = {}) {
|
|
45558
|
+
let builder = yargs_default(hideBin(argv));
|
|
45559
|
+
if (options.parserConfiguration) {
|
|
45560
|
+
builder = builder.parserConfiguration(options.parserConfiguration);
|
|
45561
|
+
}
|
|
45562
|
+
if (options.env_config) {
|
|
45563
|
+
builder = builder.config(options.env_config);
|
|
45564
|
+
}
|
|
45565
|
+
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.1").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`");
|
|
45566
|
+
const result = parsed.argv;
|
|
45567
|
+
return result;
|
|
45795
45568
|
}
|
|
45796
45569
|
var GlobalOptions = {
|
|
45797
45570
|
verbose: {
|
|
@@ -45844,11 +45617,6 @@ var DefaultOptions = {
|
|
|
45844
45617
|
default: false,
|
|
45845
45618
|
description: "Open all PRs as drafts"
|
|
45846
45619
|
},
|
|
45847
|
-
"branch-prefix": {
|
|
45848
|
-
type: "string",
|
|
45849
|
-
default: "",
|
|
45850
|
-
description: "Prefix for generated branch names, e.g. dev/magus/"
|
|
45851
|
-
},
|
|
45852
45620
|
"revise-sign": {
|
|
45853
45621
|
type: "boolean",
|
|
45854
45622
|
default: true,
|
|
@@ -45888,6 +45656,353 @@ var FixupOptions = {
|
|
|
45888
45656
|
}
|
|
45889
45657
|
};
|
|
45890
45658
|
|
|
45659
|
+
// src/commands/Config.tsx
|
|
45660
|
+
function Config() {
|
|
45661
|
+
return /* @__PURE__ */ React50.createElement(Await, {
|
|
45662
|
+
fallback: null,
|
|
45663
|
+
function: run12
|
|
45664
|
+
});
|
|
45665
|
+
async function run12() {
|
|
45666
|
+
const state = Store.getState();
|
|
45667
|
+
const actions = state.actions;
|
|
45668
|
+
const config = await get_explicit_args();
|
|
45669
|
+
const config_json = JSON.stringify(config).replace(/"/g, "\\\"");
|
|
45670
|
+
actions.output(/* @__PURE__ */ React50.createElement(Box_default, {
|
|
45671
|
+
flexDirection: "column",
|
|
45672
|
+
gap: 1,
|
|
45673
|
+
paddingTop: 1
|
|
45674
|
+
}, /* @__PURE__ */ React50.createElement(Text, null), /* @__PURE__ */ React50.createElement(FormatText, {
|
|
45675
|
+
message: "Add the line below to your shell rc file ({zshrc}, {bashrc}, etc.)",
|
|
45676
|
+
values: {
|
|
45677
|
+
zshrc: /* @__PURE__ */ React50.createElement(Text, {
|
|
45678
|
+
color: colors.gray
|
|
45679
|
+
}, ".zshrc"),
|
|
45680
|
+
bashrc: /* @__PURE__ */ React50.createElement(Text, {
|
|
45681
|
+
color: colors.gray
|
|
45682
|
+
}, ".bashrc")
|
|
45683
|
+
}
|
|
45684
|
+
}), /* @__PURE__ */ React50.createElement(FormatText, {
|
|
45685
|
+
message: `{export} {ENV_VAR}{e}{q}{config_json}{q}`,
|
|
45686
|
+
values: {
|
|
45687
|
+
export: /* @__PURE__ */ React50.createElement(Text, {
|
|
45688
|
+
color: colors.purple
|
|
45689
|
+
}, "export"),
|
|
45690
|
+
ENV_VAR: /* @__PURE__ */ React50.createElement(Text, {
|
|
45691
|
+
color: colors.yellow
|
|
45692
|
+
}, ENV_VAR),
|
|
45693
|
+
e: /* @__PURE__ */ React50.createElement(Text, {
|
|
45694
|
+
color: colors.purple
|
|
45695
|
+
}, "="),
|
|
45696
|
+
q: /* @__PURE__ */ React50.createElement(Text, {
|
|
45697
|
+
color: colors.white
|
|
45698
|
+
}, '"'),
|
|
45699
|
+
config_json: /* @__PURE__ */ React50.createElement(Text, {
|
|
45700
|
+
color: colors.green
|
|
45701
|
+
}, config_json)
|
|
45702
|
+
}
|
|
45703
|
+
})));
|
|
45704
|
+
actions.exit(0);
|
|
45705
|
+
}
|
|
45706
|
+
}
|
|
45707
|
+
async function argv_with_config_from_env() {
|
|
45708
|
+
if (!process.env.GIT_STACK_CONFIG) {
|
|
45709
|
+
return await command2(process.argv);
|
|
45710
|
+
}
|
|
45711
|
+
const env_config = parse_env_config();
|
|
45712
|
+
return await command2(process.argv, { env_config });
|
|
45713
|
+
}
|
|
45714
|
+
function parse_env_config() {
|
|
45715
|
+
const GIT_STACK_CONFIG = process.env.GIT_STACK_CONFIG;
|
|
45716
|
+
invariant(GIT_STACK_CONFIG, "GIT_STACK_CONFIG must exist");
|
|
45717
|
+
try {
|
|
45718
|
+
const env_config = JSON.parse(GIT_STACK_CONFIG);
|
|
45719
|
+
return env_config;
|
|
45720
|
+
} catch (error) {
|
|
45721
|
+
console.error(`ERROR GIT_STACK_CONFIG=${GIT_STACK_CONFIG}`);
|
|
45722
|
+
console.error("ERROR GIT_STACK_CONFIG environment variable is not valid JSON");
|
|
45723
|
+
process.exit(18);
|
|
45724
|
+
}
|
|
45725
|
+
}
|
|
45726
|
+
async function get_explicit_args() {
|
|
45727
|
+
const default_argv = await command2(["git", "stack"], COMMAND_OPTIONS);
|
|
45728
|
+
const state_argv = await command2(process.argv, COMMAND_OPTIONS);
|
|
45729
|
+
const config = {};
|
|
45730
|
+
for (const key of Object.keys(state_argv)) {
|
|
45731
|
+
if (key === "_" || key === "$0")
|
|
45732
|
+
continue;
|
|
45733
|
+
const state_value = state_argv[key];
|
|
45734
|
+
const default_value = default_argv[key];
|
|
45735
|
+
const is_set = default_value !== state_value;
|
|
45736
|
+
if (is_set) {
|
|
45737
|
+
config[key] = state_value;
|
|
45738
|
+
}
|
|
45739
|
+
}
|
|
45740
|
+
return config;
|
|
45741
|
+
}
|
|
45742
|
+
var ENV_VAR = "GIT_STACK_CONFIG";
|
|
45743
|
+
var COMMAND_OPTIONS = {
|
|
45744
|
+
parserConfiguration: {
|
|
45745
|
+
"strip-aliased": true
|
|
45746
|
+
}
|
|
45747
|
+
};
|
|
45748
|
+
|
|
45749
|
+
// src/commands/Fixup.tsx
|
|
45750
|
+
var React51 = __toESM(require_react(), 1);
|
|
45751
|
+
function Fixup() {
|
|
45752
|
+
return /* @__PURE__ */ React51.createElement(Await, {
|
|
45753
|
+
fallback: null,
|
|
45754
|
+
function: run12
|
|
45755
|
+
});
|
|
45756
|
+
}
|
|
45757
|
+
async function run12() {
|
|
45758
|
+
const state = Store.getState();
|
|
45759
|
+
const actions = state.actions;
|
|
45760
|
+
const argv = state.argv;
|
|
45761
|
+
const relative_number = argv.commit;
|
|
45762
|
+
if (!relative_number) {
|
|
45763
|
+
actions.output(/* @__PURE__ */ React51.createElement(Text, {
|
|
45764
|
+
color: colors.red
|
|
45765
|
+
}, "❗️ Usage: git fixup ", "<relative-commit-number>"));
|
|
45766
|
+
actions.output("");
|
|
45767
|
+
actions.output("This script automates the process of adding staged changes as a fixup commit");
|
|
45768
|
+
actions.output("and the subsequent git rebase to flatten the commits based on relative commit number");
|
|
45769
|
+
actions.output("You can use a `git log` like below to get the relative commit number");
|
|
45770
|
+
actions.output("");
|
|
45771
|
+
actions.output(" ❯ git stack log");
|
|
45772
|
+
actions.output(" 1\te329794d5f881cbf0fc3f26d2108cf6f3fdebabe enable drop_error_subtask test param");
|
|
45773
|
+
actions.output(" 2\t57f43b596e5c6b97bc47e2a591f82ccc81651156 test drop_error_subtask baseline");
|
|
45774
|
+
actions.output(" 3\t838e878d483c6a2d5393063fc59baf2407225c6d ErrorSubtask test baseline");
|
|
45775
|
+
actions.output("");
|
|
45776
|
+
actions.output("To target `838e87` above, you would call `fixup 3`");
|
|
45777
|
+
actions.exit(0);
|
|
45778
|
+
}
|
|
45779
|
+
const diff_staged_cmd = await cli("git diff --cached --quiet", {
|
|
45780
|
+
ignoreExitCode: true
|
|
45781
|
+
});
|
|
45782
|
+
if (!diff_staged_cmd.code) {
|
|
45783
|
+
actions.error("\uD83D\uDEA8 Stage changes before calling fixup");
|
|
45784
|
+
actions.exit(1);
|
|
45785
|
+
}
|
|
45786
|
+
const adjusted_number = Number(relative_number) - 1;
|
|
45787
|
+
const commit_sha = (await cli(`git rev-parse HEAD~${adjusted_number}`)).stdout;
|
|
45788
|
+
actions.output(/* @__PURE__ */ React51.createElement(FormatText, {
|
|
45789
|
+
wrapper: /* @__PURE__ */ React51.createElement(Text, {
|
|
45790
|
+
color: colors.yellow
|
|
45791
|
+
}),
|
|
45792
|
+
message: "\uD83D\uDEE0️ fixup {relative_number} {commit_sha}",
|
|
45793
|
+
values: {
|
|
45794
|
+
commit_sha: /* @__PURE__ */ React51.createElement(Parens, null, commit_sha),
|
|
45795
|
+
relative_number
|
|
45796
|
+
}
|
|
45797
|
+
}));
|
|
45798
|
+
await cli(`git commit --fixup ${commit_sha}`);
|
|
45799
|
+
let save_stash = false;
|
|
45800
|
+
const diff_cmd = await cli("git diff-index --quiet HEAD --", {
|
|
45801
|
+
ignoreExitCode: true
|
|
45802
|
+
});
|
|
45803
|
+
if (diff_cmd.code) {
|
|
45804
|
+
save_stash = true;
|
|
45805
|
+
await cli("git stash --include-untracked");
|
|
45806
|
+
actions.output(/* @__PURE__ */ React51.createElement(Text, {
|
|
45807
|
+
color: colors.yellow
|
|
45808
|
+
}, /* @__PURE__ */ React51.createElement(FormatText, {
|
|
45809
|
+
message: "\uD83D\uDCE6 Changes saved to stash"
|
|
45810
|
+
})));
|
|
45811
|
+
}
|
|
45812
|
+
try {
|
|
45813
|
+
const rebase_target = Number(relative_number) + 1;
|
|
45814
|
+
await cli(`git rebase -i --autosquash HEAD~${rebase_target}`, {
|
|
45815
|
+
env: {
|
|
45816
|
+
...process.env,
|
|
45817
|
+
GIT_EDITOR: "true"
|
|
45818
|
+
}
|
|
45819
|
+
});
|
|
45820
|
+
} catch (error) {
|
|
45821
|
+
actions.error("\uD83D\uDEA8 Fixup failed");
|
|
45822
|
+
await cli("git rebase --abort");
|
|
45823
|
+
await cli("git reset --soft HEAD~1");
|
|
45824
|
+
} finally {
|
|
45825
|
+
if (save_stash) {
|
|
45826
|
+
await cli("git stash pop");
|
|
45827
|
+
actions.output(/* @__PURE__ */ React51.createElement(Text, {
|
|
45828
|
+
color: colors.green
|
|
45829
|
+
}, "✅ Changes restored from stash"));
|
|
45830
|
+
}
|
|
45831
|
+
}
|
|
45832
|
+
actions.exit(0);
|
|
45833
|
+
}
|
|
45834
|
+
|
|
45835
|
+
// src/commands/Log.tsx
|
|
45836
|
+
var React52 = __toESM(require_react(), 1);
|
|
45837
|
+
function Log() {
|
|
45838
|
+
const { stdout } = use_stdout_default();
|
|
45839
|
+
const available_width = stdout.columns || 80;
|
|
45840
|
+
return /* @__PURE__ */ React52.createElement(Await, {
|
|
45841
|
+
fallback: null,
|
|
45842
|
+
function: () => run13({ available_width })
|
|
45843
|
+
});
|
|
45844
|
+
}
|
|
45845
|
+
async function run13(args) {
|
|
45846
|
+
const state = Store.getState();
|
|
45847
|
+
const actions = state.actions;
|
|
45848
|
+
const process_argv = state.process_argv;
|
|
45849
|
+
invariant(actions, "actions must exist");
|
|
45850
|
+
const color_buffer = 12 * 5;
|
|
45851
|
+
const truncation_width = args.available_width + color_buffer;
|
|
45852
|
+
const short_sha = (await cli(`git log -1 --format=%h`)).stdout.trim();
|
|
45853
|
+
const short_sha_length = short_sha.length + 1;
|
|
45854
|
+
const sha_format = `%C(green)%<(${short_sha_length},trunc)%h`;
|
|
45855
|
+
const date_format = `%C(white)%<(15,trunc)%cr`;
|
|
45856
|
+
const author_format = `%C(white)%<(8,trunc)%al`;
|
|
45857
|
+
const decoration_format = `%C(auto)%d`;
|
|
45858
|
+
const subject_format = `%<(60,trunc)%s`;
|
|
45859
|
+
const format3 = [sha_format, date_format, author_format, decoration_format, subject_format].join(" ");
|
|
45860
|
+
const rest_args = process_argv.slice(3).join(" ");
|
|
45861
|
+
const command3 = [
|
|
45862
|
+
`git log --pretty=format:"${format3}" -n20 --graph --color ${rest_args}`,
|
|
45863
|
+
`cut -c 1-"${truncation_width}"`,
|
|
45864
|
+
`nl -w3 -s' '`
|
|
45865
|
+
].join(" | ");
|
|
45866
|
+
const result = await cli(command3);
|
|
45867
|
+
actions.output(result.stdout);
|
|
45868
|
+
actions.exit(0);
|
|
45869
|
+
}
|
|
45870
|
+
|
|
45871
|
+
// src/commands/Update.tsx
|
|
45872
|
+
var React53 = __toESM(require_react(), 1);
|
|
45873
|
+
function Update() {
|
|
45874
|
+
return /* @__PURE__ */ React53.createElement(Await, {
|
|
45875
|
+
fallback: null,
|
|
45876
|
+
function: run14
|
|
45877
|
+
});
|
|
45878
|
+
}
|
|
45879
|
+
async function run14() {
|
|
45880
|
+
const state = Store.getState();
|
|
45881
|
+
const actions = state.actions;
|
|
45882
|
+
actions.exit(0);
|
|
45883
|
+
}
|
|
45884
|
+
|
|
45885
|
+
// src/components/ErrorBoundary.tsx
|
|
45886
|
+
var React54 = __toESM(require_react(), 1);
|
|
45887
|
+
class ErrorBoundary extends React54.Component {
|
|
45888
|
+
constructor(props) {
|
|
45889
|
+
super(props);
|
|
45890
|
+
this.state = {
|
|
45891
|
+
error: null,
|
|
45892
|
+
component_stack: ""
|
|
45893
|
+
};
|
|
45894
|
+
}
|
|
45895
|
+
static getDerivedStateFromError(error) {
|
|
45896
|
+
return { error };
|
|
45897
|
+
}
|
|
45898
|
+
componentDidCatch(_error, error_info) {
|
|
45899
|
+
let component_stack = error_info.componentStack;
|
|
45900
|
+
if (component_stack) {
|
|
45901
|
+
component_stack = component_stack.split(`
|
|
45902
|
+
`).slice(1).join(`
|
|
45903
|
+
`);
|
|
45904
|
+
this.setState({ component_stack }, async () => {
|
|
45905
|
+
await Exit.handle_exit({ code: 30, clear: true });
|
|
45906
|
+
});
|
|
45907
|
+
}
|
|
45908
|
+
}
|
|
45909
|
+
render() {
|
|
45910
|
+
if (!this.state.error) {
|
|
45911
|
+
return this.props.children;
|
|
45912
|
+
}
|
|
45913
|
+
const message = this.state.error.message;
|
|
45914
|
+
return /* @__PURE__ */ React54.createElement(Box_default, {
|
|
45915
|
+
flexDirection: "column",
|
|
45916
|
+
gap: 0
|
|
45917
|
+
}, /* @__PURE__ */ React54.createElement(Text, {
|
|
45918
|
+
color: colors.red
|
|
45919
|
+
}, /* @__PURE__ */ React54.createElement(FormatText, {
|
|
45920
|
+
message: "\uD83D\uDEA8 Unhandled error {message}",
|
|
45921
|
+
values: {
|
|
45922
|
+
message: /* @__PURE__ */ React54.createElement(Text, {
|
|
45923
|
+
color: colors.gray
|
|
45924
|
+
}, message)
|
|
45925
|
+
}
|
|
45926
|
+
})), this._render_verbose());
|
|
45927
|
+
}
|
|
45928
|
+
_render_verbose() {
|
|
45929
|
+
const store_state = Store.getState();
|
|
45930
|
+
if (store_state.argv.verbose) {
|
|
45931
|
+
return /* @__PURE__ */ React54.createElement(Text, {
|
|
45932
|
+
color: colors.gray
|
|
45933
|
+
}, this.state.component_stack);
|
|
45934
|
+
}
|
|
45935
|
+
return /* @__PURE__ */ React54.createElement(Text, {
|
|
45936
|
+
color: colors.gray
|
|
45937
|
+
}, /* @__PURE__ */ React54.createElement(FormatText, {
|
|
45938
|
+
message: "Try again with `--verbose` to see more information."
|
|
45939
|
+
}));
|
|
45940
|
+
}
|
|
45941
|
+
}
|
|
45942
|
+
|
|
45943
|
+
// src/components/ExitingGate.tsx
|
|
45944
|
+
var React55 = __toESM(require_react(), 1);
|
|
45945
|
+
function ExitingGate(props) {
|
|
45946
|
+
const exit_mode = Store.useState((state) => state.exit_mode);
|
|
45947
|
+
if (!exit_mode) {
|
|
45948
|
+
return props.children;
|
|
45949
|
+
}
|
|
45950
|
+
switch (exit_mode) {
|
|
45951
|
+
case "quiet":
|
|
45952
|
+
return null;
|
|
45953
|
+
case "normal":
|
|
45954
|
+
return /* @__PURE__ */ React55.createElement(Box_default, {
|
|
45955
|
+
flexDirection: "column"
|
|
45956
|
+
}, /* @__PURE__ */ React55.createElement(Text, {
|
|
45957
|
+
color: colors.red
|
|
45958
|
+
}, /* @__PURE__ */ React55.createElement(FormatText, {
|
|
45959
|
+
message: "\uD83D\uDEA8 Exiting…"
|
|
45960
|
+
})));
|
|
45961
|
+
default:
|
|
45962
|
+
return null;
|
|
45963
|
+
}
|
|
45964
|
+
}
|
|
45965
|
+
|
|
45966
|
+
// src/app/App.tsx
|
|
45967
|
+
function App2() {
|
|
45968
|
+
const actions = Store.useActions();
|
|
45969
|
+
const ink = Store.useState((state) => state.ink);
|
|
45970
|
+
const argv = Store.useState((state) => state.argv);
|
|
45971
|
+
if (!ink || !argv || !argv.$0) {
|
|
45972
|
+
return null;
|
|
45973
|
+
}
|
|
45974
|
+
const positional_list = new Set(argv["_"]);
|
|
45975
|
+
const is_update = positional_list.has("update") || positional_list.has("upgrade");
|
|
45976
|
+
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, {
|
|
45977
|
+
name: "git-stack-cli",
|
|
45978
|
+
verbose: argv.verbose,
|
|
45979
|
+
force: is_update,
|
|
45980
|
+
timeoutMs: is_update ? 30 * 1000 : 2 * 1000,
|
|
45981
|
+
onOutput: actions.output,
|
|
45982
|
+
onDone: () => {
|
|
45983
|
+
if (is_update) {
|
|
45984
|
+
actions.exit(0);
|
|
45985
|
+
}
|
|
45986
|
+
}
|
|
45987
|
+
}, /* @__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))));
|
|
45988
|
+
}
|
|
45989
|
+
function MaybeMain() {
|
|
45990
|
+
const argv = Store.useState((state) => state.argv);
|
|
45991
|
+
const positional_list = new Set(argv["_"]);
|
|
45992
|
+
if (positional_list.has("fixup")) {
|
|
45993
|
+
return /* @__PURE__ */ React56.createElement(Fixup, null);
|
|
45994
|
+
} else if (positional_list.has("log")) {
|
|
45995
|
+
return /* @__PURE__ */ React56.createElement(Log, null);
|
|
45996
|
+
} else if (positional_list.has("update")) {
|
|
45997
|
+
return /* @__PURE__ */ React56.createElement(Update, null);
|
|
45998
|
+
} else if (positional_list.has("config")) {
|
|
45999
|
+
return /* @__PURE__ */ React56.createElement(Config, null);
|
|
46000
|
+
} else if (positional_list.has("rebase")) {
|
|
46001
|
+
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)))));
|
|
46002
|
+
}
|
|
46003
|
+
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))))))));
|
|
46004
|
+
}
|
|
46005
|
+
|
|
45891
46006
|
// src/index.tsx
|
|
45892
46007
|
(async function main() {
|
|
45893
46008
|
try {
|
|
@@ -45897,7 +46012,7 @@ var FixupOptions = {
|
|
|
45897
46012
|
console.error("Try again with `--verbose` to see more information.");
|
|
45898
46013
|
}
|
|
45899
46014
|
};
|
|
45900
|
-
const argv = await
|
|
46015
|
+
const argv = await argv_with_config_from_env();
|
|
45901
46016
|
process.stdin.resume();
|
|
45902
46017
|
process.on("uncaughtException", (error) => {
|
|
45903
46018
|
console.error("\uD83D\uDEA8 uncaughtException");
|
|
@@ -45913,7 +46028,7 @@ var FixupOptions = {
|
|
|
45913
46028
|
});
|
|
45914
46029
|
const tmp_dir = await get_tmp_dir();
|
|
45915
46030
|
await fs12.rm(tmp_dir, { recursive: true });
|
|
45916
|
-
const ink = render_default(/* @__PURE__ */
|
|
46031
|
+
const ink = render_default(/* @__PURE__ */ React57.createElement(App2, null), {
|
|
45917
46032
|
exitOnCtrlC: false
|
|
45918
46033
|
});
|
|
45919
46034
|
Store.setState((state) => {
|