git-stack-cli 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/js/index.js +326 -287
- package/package.json +1 -1
- package/scripts/bun-build.ts +2 -1
- package/scripts/core/get_local_iso.ts +20 -0
- package/src/app/AutoUpdate.tsx +203 -176
- package/src/app/SelectCommitRanges.tsx +14 -16
- package/src/commands/Rebase.tsx +4 -0
- package/src/core/CommitMetadata.ts +8 -60
- package/src/core/Metadata.test.ts +3 -0
- package/src/core/Metadata.ts +11 -1
- package/src/core/__snapshots__/git.test.ts.snap +95 -0
- package/src/core/get_timeout_fn.ts +11 -0
- package/src/core/git.test.ts +54 -0
- package/src/core/git.ts +55 -0
- package/src/core/github.tsx +6 -0
package/dist/js/index.js
CHANGED
|
@@ -31938,7 +31938,7 @@ var import_react21 = __toESM(require_react(), 1);
|
|
|
31938
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
|
}
|
|
@@ -37404,6 +37414,17 @@ async function fetch_json(url) {
|
|
|
37404
37414
|
});
|
|
37405
37415
|
}
|
|
37406
37416
|
|
|
37417
|
+
// src/core/get_timeout_fn.ts
|
|
37418
|
+
function get_timeout_fn(ms, message) {
|
|
37419
|
+
return function timeout(promise) {
|
|
37420
|
+
let id;
|
|
37421
|
+
const timeout = new Promise((_resolve, reject) => {
|
|
37422
|
+
id = setTimeout(() => reject(new Error(message)), ms);
|
|
37423
|
+
});
|
|
37424
|
+
return Promise.race([promise, timeout]).finally(() => clearTimeout(id));
|
|
37425
|
+
};
|
|
37426
|
+
}
|
|
37427
|
+
|
|
37407
37428
|
// src/core/is_finite_value.ts
|
|
37408
37429
|
function is_finite_value(value) {
|
|
37409
37430
|
return typeof value === "number" && Number.isFinite(value);
|
|
@@ -37430,127 +37451,28 @@ function reducer(state, patch) {
|
|
|
37430
37451
|
return { ...state, ...patch };
|
|
37431
37452
|
}
|
|
37432
37453
|
function AutoUpdate(props) {
|
|
37433
|
-
const props_ref =
|
|
37454
|
+
const props_ref = React19.useRef(props);
|
|
37434
37455
|
props_ref.current = props;
|
|
37435
|
-
const [output, set_output] =
|
|
37436
|
-
const [state, patch] =
|
|
37437
|
-
|
|
37456
|
+
const [output, set_output] = React19.useState([]);
|
|
37457
|
+
const [state, patch] = React19.useReducer(reducer, {
|
|
37458
|
+
status: "init",
|
|
37438
37459
|
local_version: null,
|
|
37439
37460
|
latest_version: null,
|
|
37440
|
-
status: "init",
|
|
37441
37461
|
is_brew_bun_standalone: false
|
|
37442
37462
|
});
|
|
37443
|
-
|
|
37444
|
-
|
|
37445
|
-
|
|
37446
|
-
|
|
37447
|
-
|
|
37448
|
-
|
|
37449
|
-
});
|
|
37450
|
-
}
|
|
37451
|
-
}
|
|
37452
|
-
React18.useEffect(() => {
|
|
37463
|
+
React19.useEffect(handle_init_state, []);
|
|
37464
|
+
React19.useEffect(handle_status, [state.latest_version]);
|
|
37465
|
+
React19.useEffect(handle_on_done, [state.status]);
|
|
37466
|
+
const status = render_status();
|
|
37467
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, output, status);
|
|
37468
|
+
function render_status() {
|
|
37453
37469
|
switch (state.status) {
|
|
37454
37470
|
case "init":
|
|
37455
|
-
|
|
37471
|
+
return null;
|
|
37456
37472
|
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.7.0";
|
|
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
37473
|
return null;
|
|
37474
|
+
case "done":
|
|
37475
|
+
return props.children;
|
|
37554
37476
|
case "prompt": {
|
|
37555
37477
|
let install_command = "";
|
|
37556
37478
|
if (state.is_brew_bun_standalone) {
|
|
@@ -37558,27 +37480,21 @@ function AutoUpdate(props) {
|
|
|
37558
37480
|
} else {
|
|
37559
37481
|
install_command = `npm install -g ${props.name}@latest`;
|
|
37560
37482
|
}
|
|
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, {
|
|
37483
|
+
return /* @__PURE__ */ React19.createElement(YesNoPrompt, {
|
|
37484
|
+
message: /* @__PURE__ */ React19.createElement(Box_default, {
|
|
37485
|
+
flexDirection: "column",
|
|
37486
|
+
gap: 1
|
|
37487
|
+
}, /* @__PURE__ */ React19.createElement(Command, null, install_command), /* @__PURE__ */ React19.createElement(FormatText, {
|
|
37488
|
+
wrapper: /* @__PURE__ */ React19.createElement(Text, {
|
|
37576
37489
|
color: colors.yellow
|
|
37577
37490
|
}),
|
|
37578
37491
|
message: "Would you like to run the above command to update?"
|
|
37579
|
-
}))
|
|
37492
|
+
})),
|
|
37493
|
+
onNo: () => {
|
|
37494
|
+
patch({ status: "done" });
|
|
37495
|
+
},
|
|
37580
37496
|
onYes: async () => {
|
|
37581
|
-
|
|
37497
|
+
info(/* @__PURE__ */ React19.createElement(Command, null, install_command));
|
|
37582
37498
|
patch({ status: "install" });
|
|
37583
37499
|
await cli(install_command, {
|
|
37584
37500
|
env: {
|
|
@@ -37586,34 +37502,160 @@ function AutoUpdate(props) {
|
|
|
37586
37502
|
HOMEBREW_COLOR: "1"
|
|
37587
37503
|
},
|
|
37588
37504
|
onOutput: (data) => {
|
|
37589
|
-
|
|
37505
|
+
info(/* @__PURE__ */ React19.createElement(Text, null, data));
|
|
37590
37506
|
}
|
|
37591
37507
|
});
|
|
37592
|
-
|
|
37508
|
+
info(/* @__PURE__ */ React19.createElement(Text, {
|
|
37593
37509
|
key: "done"
|
|
37594
|
-
}, "✅ Installed ", /* @__PURE__ */
|
|
37595
|
-
patch({ status: "done" });
|
|
37596
|
-
},
|
|
37597
|
-
onNo: () => {
|
|
37510
|
+
}, "✅ Installed ", /* @__PURE__ */ React19.createElement(Brackets, null, state.latest_version)));
|
|
37598
37511
|
patch({ status: "done" });
|
|
37599
37512
|
}
|
|
37600
37513
|
});
|
|
37601
37514
|
}
|
|
37515
|
+
}
|
|
37516
|
+
}
|
|
37517
|
+
function handle_on_done() {
|
|
37518
|
+
switch (state.status) {
|
|
37519
|
+
case "init":
|
|
37520
|
+
case "prompt":
|
|
37602
37521
|
case "install":
|
|
37603
|
-
|
|
37604
|
-
case "done":
|
|
37605
|
-
|
|
37522
|
+
break;
|
|
37523
|
+
case "done": {
|
|
37524
|
+
props.onDone?.();
|
|
37525
|
+
break;
|
|
37526
|
+
}
|
|
37527
|
+
default:
|
|
37528
|
+
assertNever(state.status);
|
|
37606
37529
|
}
|
|
37607
|
-
}
|
|
37608
|
-
|
|
37530
|
+
}
|
|
37531
|
+
function handle_init_state() {
|
|
37532
|
+
init_state().catch(abort);
|
|
37533
|
+
async function init_state() {
|
|
37534
|
+
if (state.latest_version !== null)
|
|
37535
|
+
return;
|
|
37536
|
+
const local_version = "2.7.2";
|
|
37537
|
+
const latest_version = await get_latest_version();
|
|
37538
|
+
const is_brew_bun_standalone = get_is_brew_bun_standalone();
|
|
37539
|
+
patch({ local_version, latest_version, is_brew_bun_standalone });
|
|
37540
|
+
}
|
|
37541
|
+
async function get_latest_version() {
|
|
37542
|
+
const timeout_ms = is_finite_value(props.timeoutMs) ? props.timeoutMs : 2 * 1000;
|
|
37543
|
+
const timeout = get_timeout_fn(timeout_ms, "AutoUpdate timeout");
|
|
37544
|
+
const npm_json = await timeout(fetch_json(`https://registry.npmjs.org/${props.name}`));
|
|
37545
|
+
const maybe_version = npm_json?.["dist-tags"]?.latest;
|
|
37546
|
+
if (typeof maybe_version === "string") {
|
|
37547
|
+
return maybe_version;
|
|
37548
|
+
}
|
|
37549
|
+
throw new Error("Unable to retrieve latest version from npm");
|
|
37550
|
+
}
|
|
37551
|
+
function get_is_brew_bun_standalone() {
|
|
37552
|
+
const binary_path = process.argv[1];
|
|
37553
|
+
debug(/* @__PURE__ */ React19.createElement(Text, {
|
|
37554
|
+
dimColor: true
|
|
37555
|
+
}, JSON.stringify({ binary_path })));
|
|
37556
|
+
const is_bunfs_path = binary_path.startsWith("/$bunfs");
|
|
37557
|
+
debug(/* @__PURE__ */ React19.createElement(Text, {
|
|
37558
|
+
dimColor: true
|
|
37559
|
+
}, is_bunfs_path ? "brew install detected (compiled bun standalone)" : "npm install detected"));
|
|
37560
|
+
return is_bunfs_path;
|
|
37561
|
+
}
|
|
37562
|
+
}
|
|
37563
|
+
function handle_status() {
|
|
37564
|
+
const latest_version = state.latest_version;
|
|
37565
|
+
if (latest_version === null) {
|
|
37566
|
+
return;
|
|
37567
|
+
}
|
|
37568
|
+
const local_version = state.local_version;
|
|
37569
|
+
if (!local_version) {
|
|
37570
|
+
throw new Error("Auto update requires process.env.CLI_VERSION to be set");
|
|
37571
|
+
}
|
|
37572
|
+
debug(/* @__PURE__ */ React19.createElement(FormatText, {
|
|
37573
|
+
key: "versions",
|
|
37574
|
+
wrapper: /* @__PURE__ */ React19.createElement(Text, {
|
|
37575
|
+
dimColor: true
|
|
37576
|
+
}),
|
|
37577
|
+
message: "Auto update found latest version {latest_version} and current local version {local_version}",
|
|
37578
|
+
values: {
|
|
37579
|
+
latest_version: /* @__PURE__ */ React19.createElement(Brackets, null, latest_version),
|
|
37580
|
+
local_version: /* @__PURE__ */ React19.createElement(Brackets, null, local_version)
|
|
37581
|
+
}
|
|
37582
|
+
}));
|
|
37583
|
+
const semver_result = semver_compare(latest_version, local_version);
|
|
37584
|
+
debug(/* @__PURE__ */ React19.createElement(Text, {
|
|
37585
|
+
dimColor: true
|
|
37586
|
+
}, JSON.stringify({ semver_result })));
|
|
37587
|
+
switch (semver_result) {
|
|
37588
|
+
case 0: {
|
|
37589
|
+
info(/* @__PURE__ */ React19.createElement(Text, null, "✅ Everything up to date. ", /* @__PURE__ */ React19.createElement(Brackets, null, latest_version)));
|
|
37590
|
+
return patch({ status: "done" });
|
|
37591
|
+
}
|
|
37592
|
+
case 1: {
|
|
37593
|
+
const old_tag = local_version;
|
|
37594
|
+
const new_tag = state.latest_version;
|
|
37595
|
+
const url = `https://github.com/magus/git-stack-cli/compare/${old_tag}...${new_tag}`;
|
|
37596
|
+
info(/* @__PURE__ */ React19.createElement(Box_default, {
|
|
37597
|
+
flexDirection: "column",
|
|
37598
|
+
gap: 1,
|
|
37599
|
+
paddingTop: 1,
|
|
37600
|
+
paddingBottom: 1
|
|
37601
|
+
}, /* @__PURE__ */ React19.createElement(Text, null, "\uD83C\uDD95 New version available! ", /* @__PURE__ */ React19.createElement(Brackets, null, latest_version)), /* @__PURE__ */ React19.createElement(Box_default, {
|
|
37602
|
+
flexDirection: "column"
|
|
37603
|
+
}, /* @__PURE__ */ React19.createElement(Text, {
|
|
37604
|
+
dimColor: true
|
|
37605
|
+
}, "Changelog"), /* @__PURE__ */ React19.createElement(Url, null, url))));
|
|
37606
|
+
return patch({ status: "prompt" });
|
|
37607
|
+
}
|
|
37608
|
+
case -1: {
|
|
37609
|
+
info(/* @__PURE__ */ React19.createElement(FormatText, {
|
|
37610
|
+
message: "⚠️ Local version {local_version} is newer than latest version {latest_version}",
|
|
37611
|
+
values: {
|
|
37612
|
+
local_version: /* @__PURE__ */ React19.createElement(Brackets, null, local_version),
|
|
37613
|
+
latest_version: /* @__PURE__ */ React19.createElement(Brackets, null, latest_version)
|
|
37614
|
+
}
|
|
37615
|
+
}));
|
|
37616
|
+
return patch({ status: "done" });
|
|
37617
|
+
}
|
|
37618
|
+
default: {
|
|
37619
|
+
assertNever(semver_result);
|
|
37620
|
+
abort(new Error("AutoUpdate failed"));
|
|
37621
|
+
}
|
|
37622
|
+
}
|
|
37623
|
+
}
|
|
37624
|
+
function info(node) {
|
|
37625
|
+
if (props_ref.current.verbose || props_ref.current.force) {
|
|
37626
|
+
handle_output(node);
|
|
37627
|
+
}
|
|
37628
|
+
}
|
|
37629
|
+
function debug(node) {
|
|
37630
|
+
if (props_ref.current.verbose) {
|
|
37631
|
+
handle_output(node);
|
|
37632
|
+
}
|
|
37633
|
+
}
|
|
37634
|
+
function abort(error) {
|
|
37635
|
+
info(/* @__PURE__ */ React19.createElement(Text, {
|
|
37636
|
+
key: "error",
|
|
37637
|
+
color: colors.red
|
|
37638
|
+
}, error.message));
|
|
37639
|
+
patch({ status: "done" });
|
|
37640
|
+
props_ref.current.onError?.(error);
|
|
37641
|
+
}
|
|
37642
|
+
function handle_output(node) {
|
|
37643
|
+
if (typeof props.onOutput === "function") {
|
|
37644
|
+
props.onOutput(node);
|
|
37645
|
+
} else {
|
|
37646
|
+
set_output((current2) => {
|
|
37647
|
+
return [...current2, node];
|
|
37648
|
+
});
|
|
37649
|
+
}
|
|
37650
|
+
}
|
|
37609
37651
|
}
|
|
37610
37652
|
|
|
37611
37653
|
// src/app/CherryPickCheck.tsx
|
|
37612
|
-
var
|
|
37654
|
+
var React21 = __toESM(require_react(), 1);
|
|
37613
37655
|
import path from "node:path";
|
|
37614
37656
|
|
|
37615
37657
|
// src/app/Await.tsx
|
|
37616
|
-
var
|
|
37658
|
+
var React20 = __toESM(require_react(), 1);
|
|
37617
37659
|
|
|
37618
37660
|
// src/core/cache.ts
|
|
37619
37661
|
function cache3(cacheable) {
|
|
@@ -37661,8 +37703,8 @@ function invariant(condition, message) {
|
|
|
37661
37703
|
|
|
37662
37704
|
// src/app/Await.tsx
|
|
37663
37705
|
function Await(props) {
|
|
37664
|
-
const [display_fallback, set_display_fallback] =
|
|
37665
|
-
const cacheRef =
|
|
37706
|
+
const [display_fallback, set_display_fallback] = React20.useState(false);
|
|
37707
|
+
const cacheRef = React20.useRef(null);
|
|
37666
37708
|
if (!cacheRef.current) {
|
|
37667
37709
|
cacheRef.current = cache3(props.function);
|
|
37668
37710
|
}
|
|
@@ -37672,7 +37714,7 @@ function Await(props) {
|
|
|
37672
37714
|
} else {
|
|
37673
37715
|
delayFallbackMs = 1000;
|
|
37674
37716
|
}
|
|
37675
|
-
|
|
37717
|
+
React20.useEffect(() => {
|
|
37676
37718
|
const cache4 = cacheRef.current;
|
|
37677
37719
|
if (!cache4) {
|
|
37678
37720
|
return;
|
|
@@ -37689,13 +37731,13 @@ function Await(props) {
|
|
|
37689
37731
|
}, [delayFallbackMs]);
|
|
37690
37732
|
invariant(cacheRef.current, "cache must exist");
|
|
37691
37733
|
if ("fallback" in props) {
|
|
37692
|
-
return /* @__PURE__ */
|
|
37734
|
+
return /* @__PURE__ */ React20.createElement(React20.Suspense, {
|
|
37693
37735
|
fallback: !display_fallback ? null : props.fallback
|
|
37694
|
-
}, /* @__PURE__ */
|
|
37736
|
+
}, /* @__PURE__ */ React20.createElement(ReadCache, {
|
|
37695
37737
|
cache: cacheRef.current
|
|
37696
37738
|
}, props.children));
|
|
37697
37739
|
}
|
|
37698
|
-
return /* @__PURE__ */
|
|
37740
|
+
return /* @__PURE__ */ React20.createElement(ReadCache, {
|
|
37699
37741
|
cache: cacheRef.current
|
|
37700
37742
|
});
|
|
37701
37743
|
}
|
|
@@ -37721,17 +37763,17 @@ function reducer2(state, patch) {
|
|
|
37721
37763
|
}
|
|
37722
37764
|
function CherryPickCheck(props) {
|
|
37723
37765
|
const actions = Store.useActions();
|
|
37724
|
-
const [state, patch] =
|
|
37766
|
+
const [state, patch] = React21.useReducer(reducer2, {
|
|
37725
37767
|
status: "init"
|
|
37726
37768
|
});
|
|
37727
37769
|
switch (state.status) {
|
|
37728
37770
|
case "done":
|
|
37729
37771
|
return props.children;
|
|
37730
37772
|
case "prompt":
|
|
37731
|
-
return /* @__PURE__ */
|
|
37732
|
-
message: /* @__PURE__ */
|
|
37773
|
+
return /* @__PURE__ */ React21.createElement(YesNoPrompt, {
|
|
37774
|
+
message: /* @__PURE__ */ React21.createElement(Text, {
|
|
37733
37775
|
color: colors.yellow
|
|
37734
|
-
}, /* @__PURE__ */
|
|
37776
|
+
}, /* @__PURE__ */ React21.createElement(Command, null, "git cherry-pick"), " detected, would you like to abort it?"),
|
|
37735
37777
|
onYes: async () => {
|
|
37736
37778
|
await cli(`git cherry-pick --abort`);
|
|
37737
37779
|
patch({ status: "done" });
|
|
@@ -37741,11 +37783,11 @@ function CherryPickCheck(props) {
|
|
|
37741
37783
|
}
|
|
37742
37784
|
});
|
|
37743
37785
|
default:
|
|
37744
|
-
return /* @__PURE__ */
|
|
37786
|
+
return /* @__PURE__ */ React21.createElement(Await, {
|
|
37745
37787
|
function: run,
|
|
37746
|
-
fallback: /* @__PURE__ */
|
|
37788
|
+
fallback: /* @__PURE__ */ React21.createElement(Text, {
|
|
37747
37789
|
color: colors.yellow
|
|
37748
|
-
}, "Checking for ", /* @__PURE__ */
|
|
37790
|
+
}, "Checking for ", /* @__PURE__ */ React21.createElement(Command, null, "git cherry-pick"), "…")
|
|
37749
37791
|
});
|
|
37750
37792
|
}
|
|
37751
37793
|
async function run() {
|
|
@@ -37771,7 +37813,7 @@ function CherryPickCheck(props) {
|
|
|
37771
37813
|
}
|
|
37772
37814
|
|
|
37773
37815
|
// src/app/Debug.tsx
|
|
37774
|
-
var
|
|
37816
|
+
var React22 = __toESM(require_react(), 1);
|
|
37775
37817
|
import fs4 from "node:fs/promises";
|
|
37776
37818
|
import path2 from "node:path";
|
|
37777
37819
|
|
|
@@ -37824,14 +37866,14 @@ function Debug() {
|
|
|
37824
37866
|
const state = Store.useState((state2) => state2);
|
|
37825
37867
|
const argv = Store.useState((state2) => state2.argv);
|
|
37826
37868
|
const debug = Store.useState((state2) => state2.select.debug(state2));
|
|
37827
|
-
|
|
37869
|
+
React22.useEffect(function debugMessageOnce() {
|
|
37828
37870
|
if (debug) {
|
|
37829
|
-
actions.output(/* @__PURE__ */
|
|
37871
|
+
actions.output(/* @__PURE__ */ React22.createElement(Text, {
|
|
37830
37872
|
color: colors.yellow
|
|
37831
37873
|
}, "Debug mode enabled"));
|
|
37832
37874
|
}
|
|
37833
37875
|
}, [argv]);
|
|
37834
|
-
|
|
37876
|
+
React22.useEffect(function sync_state_json() {
|
|
37835
37877
|
if (!argv?.["write-state-json"]) {
|
|
37836
37878
|
return;
|
|
37837
37879
|
}
|
|
@@ -37850,16 +37892,6 @@ function Debug() {
|
|
|
37850
37892
|
// src/app/DependencyCheck.tsx
|
|
37851
37893
|
var React23 = __toESM(require_react(), 1);
|
|
37852
37894
|
|
|
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
37895
|
// src/core/is_command_available.ts
|
|
37864
37896
|
import fs5 from "node:fs";
|
|
37865
37897
|
import path3 from "node:path";
|
|
@@ -38053,7 +38085,12 @@ function write(message, values) {
|
|
|
38053
38085
|
return new_message;
|
|
38054
38086
|
}
|
|
38055
38087
|
function read(message) {
|
|
38056
|
-
const values = { id: null, title: null };
|
|
38088
|
+
const values = { subject: null, id: null, title: null };
|
|
38089
|
+
const match_subject = message.match(RE2.subject_line);
|
|
38090
|
+
if (match_subject?.groups) {
|
|
38091
|
+
values.subject = match_subject.groups["subject"];
|
|
38092
|
+
invariant(values.subject, "subject must exist");
|
|
38093
|
+
}
|
|
38057
38094
|
const match_id = message.match(RE2.stack_id);
|
|
38058
38095
|
if (match_id?.groups) {
|
|
38059
38096
|
values.id = match_id.groups["id"];
|
|
@@ -38081,10 +38118,46 @@ var TEMPLATE = {
|
|
|
38081
38118
|
}
|
|
38082
38119
|
};
|
|
38083
38120
|
var RE2 = {
|
|
38121
|
+
subject_line: /^(?<subject>[^\n]*)/,
|
|
38084
38122
|
stack_id: new RegExp(`${TEMPLATE.stack_id("(?<id>[^\\s]+)")}`, "i"),
|
|
38085
38123
|
group_title: new RegExp(TEMPLATE.group_title("(?<title>[^\\n^\\r]+)"), "i")
|
|
38086
38124
|
};
|
|
38087
38125
|
|
|
38126
|
+
// src/core/git.ts
|
|
38127
|
+
async function get_commits(dot_range) {
|
|
38128
|
+
const log_result = await cli(`git log ${dot_range} --format=${FORMAT} --color=never`);
|
|
38129
|
+
if (!log_result.stdout) {
|
|
38130
|
+
return [];
|
|
38131
|
+
}
|
|
38132
|
+
const commit_list = [];
|
|
38133
|
+
for (let record of log_result.stdout.split(SEP2.record)) {
|
|
38134
|
+
record = record.replace(/^\n/, "");
|
|
38135
|
+
record = record.replace(/\n$/, "");
|
|
38136
|
+
if (!record)
|
|
38137
|
+
continue;
|
|
38138
|
+
const [sha, full_message] = record.split(SEP2.field);
|
|
38139
|
+
const metadata = read(full_message);
|
|
38140
|
+
const branch_id = metadata.id;
|
|
38141
|
+
const subject_line = metadata.subject || "";
|
|
38142
|
+
const title = metadata.title;
|
|
38143
|
+
const commit = {
|
|
38144
|
+
sha,
|
|
38145
|
+
full_message,
|
|
38146
|
+
subject_line,
|
|
38147
|
+
branch_id,
|
|
38148
|
+
title
|
|
38149
|
+
};
|
|
38150
|
+
commit_list.push(commit);
|
|
38151
|
+
}
|
|
38152
|
+
commit_list.reverse();
|
|
38153
|
+
return commit_list;
|
|
38154
|
+
}
|
|
38155
|
+
var SEP2 = {
|
|
38156
|
+
record: "\x1E",
|
|
38157
|
+
field: "\x1F"
|
|
38158
|
+
};
|
|
38159
|
+
var FORMAT = `%H${SEP2.field}%B${SEP2.record}`;
|
|
38160
|
+
|
|
38088
38161
|
// src/core/github.tsx
|
|
38089
38162
|
var React24 = __toESM(require_react(), 1);
|
|
38090
38163
|
import crypto from "node:crypto";
|
|
@@ -38119,6 +38192,8 @@ var RE3 = {
|
|
|
38119
38192
|
async function pr_list() {
|
|
38120
38193
|
const state = Store.getState();
|
|
38121
38194
|
const actions = state.actions;
|
|
38195
|
+
const timer = Timer();
|
|
38196
|
+
actions.debug("start github.pr_list");
|
|
38122
38197
|
const username = state.username;
|
|
38123
38198
|
const repo_path = state.repo_path;
|
|
38124
38199
|
invariant(username, "username must exist");
|
|
@@ -38140,6 +38215,8 @@ async function pr_list() {
|
|
|
38140
38215
|
state2.pr[pr.headRefName] = pr;
|
|
38141
38216
|
}
|
|
38142
38217
|
});
|
|
38218
|
+
const duration = timer.duration();
|
|
38219
|
+
actions.debug(`end github.pr_list (duration=${duration})`);
|
|
38143
38220
|
return result_pr_list;
|
|
38144
38221
|
}
|
|
38145
38222
|
async function pr_status(branch) {
|
|
@@ -38262,11 +38339,12 @@ var RE4 = {
|
|
|
38262
38339
|
|
|
38263
38340
|
// src/core/CommitMetadata.ts
|
|
38264
38341
|
async function range(commit_group_map) {
|
|
38265
|
-
const master_branch = Store.getState().master_branch;
|
|
38266
38342
|
await pr_list();
|
|
38267
|
-
const
|
|
38343
|
+
const master_branch = Store.getState().master_branch;
|
|
38344
|
+
const commit_list = await get_commits(`${master_branch}..HEAD`);
|
|
38268
38345
|
const pr_lookup = {};
|
|
38269
38346
|
let invalid = false;
|
|
38347
|
+
let last_group_id = null;
|
|
38270
38348
|
const group_map = new Map;
|
|
38271
38349
|
for (const commit of commit_list) {
|
|
38272
38350
|
let id = commit.branch_id;
|
|
@@ -38282,9 +38360,7 @@ async function range(commit_group_map) {
|
|
|
38282
38360
|
invalid = true;
|
|
38283
38361
|
}
|
|
38284
38362
|
if (id) {
|
|
38285
|
-
|
|
38286
|
-
const last_key = group_key_list[group_key_list.length - 1];
|
|
38287
|
-
if (group_map.has(id) && last_key !== id) {
|
|
38363
|
+
if (group_map.has(id) && last_group_id !== id) {
|
|
38288
38364
|
invalid = true;
|
|
38289
38365
|
}
|
|
38290
38366
|
} else {
|
|
@@ -38304,6 +38380,7 @@ async function range(commit_group_map) {
|
|
|
38304
38380
|
};
|
|
38305
38381
|
group.commits.push(commit);
|
|
38306
38382
|
group_map.set(id, group);
|
|
38383
|
+
last_group_id = id;
|
|
38307
38384
|
}
|
|
38308
38385
|
const group_value_list = Array.from(group_map.values());
|
|
38309
38386
|
const group_list = [];
|
|
@@ -38369,44 +38446,6 @@ async function range(commit_group_map) {
|
|
|
38369
38446
|
}
|
|
38370
38447
|
return { invalid, group_list, commit_list, pr_lookup, UNASSIGNED };
|
|
38371
38448
|
}
|
|
38372
|
-
async function get_commit_list() {
|
|
38373
|
-
const master_branch = Store.getState().master_branch;
|
|
38374
|
-
const log_result = await cli(`git log ${master_branch}..HEAD --oneline --format=%H --color=never`);
|
|
38375
|
-
if (!log_result.stdout) {
|
|
38376
|
-
return [];
|
|
38377
|
-
}
|
|
38378
|
-
const sha_list = lines(log_result.stdout).reverse();
|
|
38379
|
-
const commit_metadata_list = [];
|
|
38380
|
-
for (let i2 = 0;i2 < sha_list.length; i2++) {
|
|
38381
|
-
const sha = sha_list[i2];
|
|
38382
|
-
const commit_metadata = await commit(sha);
|
|
38383
|
-
commit_metadata_list.push(commit_metadata);
|
|
38384
|
-
}
|
|
38385
|
-
return commit_metadata_list;
|
|
38386
|
-
}
|
|
38387
|
-
async function commit(sha) {
|
|
38388
|
-
const full_message = (await cli(`git show -s --format=%B ${sha}`)).stdout;
|
|
38389
|
-
const metadata = await read(full_message);
|
|
38390
|
-
const branch_id = metadata?.id;
|
|
38391
|
-
const subject_line = get_subject_line(full_message);
|
|
38392
|
-
const title = metadata?.title;
|
|
38393
|
-
return {
|
|
38394
|
-
sha,
|
|
38395
|
-
full_message,
|
|
38396
|
-
subject_line,
|
|
38397
|
-
branch_id,
|
|
38398
|
-
title
|
|
38399
|
-
};
|
|
38400
|
-
}
|
|
38401
|
-
function get_subject_line(message) {
|
|
38402
|
-
const line_list = lines(message);
|
|
38403
|
-
const first_line = line_list[0];
|
|
38404
|
-
return remove(first_line);
|
|
38405
|
-
}
|
|
38406
|
-
function lines(value) {
|
|
38407
|
-
return value.split(`
|
|
38408
|
-
`);
|
|
38409
|
-
}
|
|
38410
38449
|
var UNASSIGNED = "unassigned";
|
|
38411
38450
|
|
|
38412
38451
|
// src/core/GitReviseTodo.ts
|
|
@@ -38417,8 +38456,8 @@ function GitReviseTodo(args) {
|
|
|
38417
38456
|
const group_list = args.commit_range.group_list;
|
|
38418
38457
|
for (let i2 = args.rebase_group_index;i2 < group_list.length; i2++) {
|
|
38419
38458
|
const group = group_list[i2];
|
|
38420
|
-
for (const
|
|
38421
|
-
commit_list.push(
|
|
38459
|
+
for (const commit of group.commits) {
|
|
38460
|
+
commit_list.push(commit);
|
|
38422
38461
|
}
|
|
38423
38462
|
}
|
|
38424
38463
|
const todo = GitReviseTodo.todo({ commit_list });
|
|
@@ -38426,17 +38465,17 @@ function GitReviseTodo(args) {
|
|
|
38426
38465
|
}
|
|
38427
38466
|
GitReviseTodo.todo = function todo(args) {
|
|
38428
38467
|
const entry_list = [];
|
|
38429
|
-
for (const
|
|
38430
|
-
const sha =
|
|
38468
|
+
for (const commit of args.commit_list) {
|
|
38469
|
+
const sha = commit.sha.slice(0, 12);
|
|
38431
38470
|
const entry_lines = [`++ pick ${sha}`];
|
|
38432
|
-
const id =
|
|
38471
|
+
const id = commit.branch_id;
|
|
38433
38472
|
if (id == null || id === UNASSIGNED) {
|
|
38434
|
-
entry_lines.push(
|
|
38473
|
+
entry_lines.push(commit.full_message);
|
|
38435
38474
|
} else {
|
|
38436
|
-
const title =
|
|
38475
|
+
const title = commit.title;
|
|
38437
38476
|
invariant(title, "commit.title must exist");
|
|
38438
38477
|
const metadata = { id, title };
|
|
38439
|
-
const unsafe_message_with_id = write(
|
|
38478
|
+
const unsafe_message_with_id = write(commit.full_message, metadata);
|
|
38440
38479
|
const message_with_id = unsafe_message_with_id;
|
|
38441
38480
|
entry_lines.push(message_with_id);
|
|
38442
38481
|
}
|
|
@@ -38604,8 +38643,8 @@ function DetectInitialPR(props) {
|
|
|
38604
38643
|
invariant(commit_range, "commit_range must exist");
|
|
38605
38644
|
try {
|
|
38606
38645
|
let has_existing_metadata = false;
|
|
38607
|
-
for (const
|
|
38608
|
-
if (
|
|
38646
|
+
for (const commit of commit_range.commit_list) {
|
|
38647
|
+
if (commit.branch_id) {
|
|
38609
38648
|
has_existing_metadata = true;
|
|
38610
38649
|
break;
|
|
38611
38650
|
}
|
|
@@ -38634,9 +38673,9 @@ function DetectInitialPR(props) {
|
|
|
38634
38673
|
for (const group of commit_range.group_list) {
|
|
38635
38674
|
group.id = branch_name2;
|
|
38636
38675
|
group.title = state.pr?.title || "-";
|
|
38637
|
-
for (const
|
|
38638
|
-
|
|
38639
|
-
|
|
38676
|
+
for (const commit of commit_range.commit_list) {
|
|
38677
|
+
commit.branch_id = group.id;
|
|
38678
|
+
commit.title = group.title;
|
|
38640
38679
|
}
|
|
38641
38680
|
}
|
|
38642
38681
|
const rebase_group_index = 0;
|
|
@@ -39265,7 +39304,9 @@ Rebase.run = async function run5(props) {
|
|
|
39265
39304
|
}
|
|
39266
39305
|
actions.exit(20);
|
|
39267
39306
|
}
|
|
39307
|
+
actions.debug("start CommitMetadata.range");
|
|
39268
39308
|
const next_commit_range = await range();
|
|
39309
|
+
actions.debug("end CommitMetadata.range");
|
|
39269
39310
|
actions.output(/* @__PURE__ */ React34.createElement(FormatText, {
|
|
39270
39311
|
wrapper: /* @__PURE__ */ React34.createElement(Text, {
|
|
39271
39312
|
color: colors.green
|
|
@@ -39295,12 +39336,12 @@ Rebase.run = async function run5(props) {
|
|
|
39295
39336
|
await cli(`git checkout -b ${temp_branch_name} ${rebase_merge_base}`);
|
|
39296
39337
|
const picked_commit_list = [];
|
|
39297
39338
|
for (let i2 = 0;i2 < commit_range.commit_list.length; i2++) {
|
|
39298
|
-
const
|
|
39299
|
-
const commit_pr = commit_range.pr_lookup[
|
|
39339
|
+
const commit = commit_range.commit_list[i2];
|
|
39340
|
+
const commit_pr = commit_range.pr_lookup[commit.branch_id || ""];
|
|
39300
39341
|
const merged_pr = commit_pr?.state === "MERGED";
|
|
39301
39342
|
const commit_message = /* @__PURE__ */ React34.createElement(Text, {
|
|
39302
39343
|
color: colors.blue
|
|
39303
|
-
},
|
|
39344
|
+
}, commit.subject_line);
|
|
39304
39345
|
if (merged_pr) {
|
|
39305
39346
|
actions.output(/* @__PURE__ */ React34.createElement(FormatText, {
|
|
39306
39347
|
wrapper: /* @__PURE__ */ React34.createElement(Text, {
|
|
@@ -39327,15 +39368,17 @@ Rebase.run = async function run5(props) {
|
|
|
39327
39368
|
commit_message
|
|
39328
39369
|
}
|
|
39329
39370
|
}));
|
|
39330
|
-
picked_commit_list.push(
|
|
39371
|
+
picked_commit_list.push(commit);
|
|
39331
39372
|
}
|
|
39332
39373
|
if (picked_commit_list.length > 0) {
|
|
39333
39374
|
await cli(`git clean -fd`);
|
|
39334
|
-
const sha_list = picked_commit_list.map((
|
|
39375
|
+
const sha_list = picked_commit_list.map((commit) => commit.sha).join(" ");
|
|
39335
39376
|
await cli(`git cherry-pick --keep-redundant-commits ${sha_list}`);
|
|
39336
39377
|
}
|
|
39337
39378
|
await cli(`git branch -f ${branch_name} ${temp_branch_name}`);
|
|
39379
|
+
actions.debug("start restore_git()");
|
|
39338
39380
|
restore_git();
|
|
39381
|
+
actions.debug("end restore_git()");
|
|
39339
39382
|
}
|
|
39340
39383
|
function restore_git() {
|
|
39341
39384
|
const spawn_options = { ignoreExitCode: true };
|
|
@@ -39406,10 +39449,10 @@ async function run6() {
|
|
|
39406
39449
|
const merge_base = (await cli(`git merge-base HEAD ${master_branch}`)).stdout;
|
|
39407
39450
|
let commit_range = await range(commit_map);
|
|
39408
39451
|
commit_range.group_list.reverse();
|
|
39409
|
-
for (const
|
|
39410
|
-
const group_from_map = commit_map[
|
|
39411
|
-
|
|
39412
|
-
|
|
39452
|
+
for (const commit of commit_range.commit_list) {
|
|
39453
|
+
const group_from_map = commit_map[commit.sha];
|
|
39454
|
+
commit.branch_id = group_from_map.id;
|
|
39455
|
+
commit.title = group_from_map.title;
|
|
39413
39456
|
}
|
|
39414
39457
|
await GitReviseTodo.execute({
|
|
39415
39458
|
rebase_group_index: 0,
|
|
@@ -39873,8 +39916,8 @@ function SelectCommitRangesInternal(props) {
|
|
|
39873
39916
|
map.set(args.key, args.value);
|
|
39874
39917
|
return new Map(map);
|
|
39875
39918
|
}, new Map, (map) => {
|
|
39876
|
-
for (const
|
|
39877
|
-
map.set(
|
|
39919
|
+
for (const commit of props.commit_range.commit_list) {
|
|
39920
|
+
map.set(commit.sha, commit.branch_id);
|
|
39878
39921
|
}
|
|
39879
39922
|
return new Map(map);
|
|
39880
39923
|
});
|
|
@@ -39964,8 +40007,8 @@ function SelectCommitRangesInternal(props) {
|
|
|
39964
40007
|
const max_width = 80;
|
|
39965
40008
|
const [focused, set_focused] = React42.useState("");
|
|
39966
40009
|
const has_groups = group.id !== props.commit_range.UNASSIGNED;
|
|
39967
|
-
const items = props.commit_range.commit_list.map((
|
|
39968
|
-
const commit_metadata_id = commit_map.get(
|
|
40010
|
+
const items = props.commit_range.commit_list.map((commit) => {
|
|
40011
|
+
const commit_metadata_id = commit_map.get(commit.sha);
|
|
39969
40012
|
const selected = commit_metadata_id !== null;
|
|
39970
40013
|
let disabled;
|
|
39971
40014
|
if (group_input) {
|
|
@@ -39976,8 +40019,8 @@ function SelectCommitRangesInternal(props) {
|
|
|
39976
40019
|
disabled = Boolean(selected && commit_metadata_id !== group.id);
|
|
39977
40020
|
}
|
|
39978
40021
|
return {
|
|
39979
|
-
label:
|
|
39980
|
-
value:
|
|
40022
|
+
label: commit.subject_line,
|
|
40023
|
+
value: commit,
|
|
39981
40024
|
selected,
|
|
39982
40025
|
disabled
|
|
39983
40026
|
};
|
|
@@ -40108,7 +40151,7 @@ function SelectCommitRangesInternal(props) {
|
|
|
40108
40151
|
wrapper: /* @__PURE__ */ React42.createElement(Text, {
|
|
40109
40152
|
color: colors.gray
|
|
40110
40153
|
}),
|
|
40111
|
-
message: "Press {s} to {sync} the {count} assigned commits to Github",
|
|
40154
|
+
message: argv.sync ? "Press {s} to {sync} the {count} assigned commits to Github" : "Press {s} to {sync} the {count} assigned commits locally",
|
|
40112
40155
|
values: {
|
|
40113
40156
|
...S_TO_SYNC_VALUES,
|
|
40114
40157
|
count: /* @__PURE__ */ React42.createElement(Text, {
|
|
@@ -40116,15 +40159,11 @@ function SelectCommitRangesInternal(props) {
|
|
|
40116
40159
|
bold: true
|
|
40117
40160
|
}, assigned_count)
|
|
40118
40161
|
}
|
|
40119
|
-
})) : /* @__PURE__ */ React42.createElement(
|
|
40162
|
+
})) : /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40120
40163
|
wrapper: /* @__PURE__ */ React42.createElement(Text, null),
|
|
40121
|
-
message: "\uD83C\uDF89 Done! Press {s} to {sync} the
|
|
40164
|
+
message: argv.sync ? "\uD83C\uDF89 Done! Press {s} to {sync} the PRs to Github" : "\uD83C\uDF89 Done! Press {s} to {sync} the PRs locally",
|
|
40122
40165
|
values: S_TO_SYNC_VALUES
|
|
40123
|
-
})
|
|
40124
|
-
wrapper: /* @__PURE__ */ React42.createElement(Text, null),
|
|
40125
|
-
message: "\uD83C\uDF89 Done! Press {s} to {save} the commits locally",
|
|
40126
|
-
values: S_TO_SYNC_VALUES
|
|
40127
|
-
})), /* @__PURE__ */ React42.createElement(Box_default, null, /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40166
|
+
}), /* @__PURE__ */ React42.createElement(Box_default, null, /* @__PURE__ */ React42.createElement(FormatText, {
|
|
40128
40167
|
wrapper: /* @__PURE__ */ React42.createElement(Text, {
|
|
40129
40168
|
color: colors.gray
|
|
40130
40169
|
}),
|
|
@@ -40179,8 +40218,8 @@ function SelectCommitRangesInternal(props) {
|
|
|
40179
40218
|
}
|
|
40180
40219
|
let allow_unassigned_sync = null;
|
|
40181
40220
|
for (let i2 = 0;i2 < props.commit_range.commit_list.length; i2++) {
|
|
40182
|
-
const
|
|
40183
|
-
const group_id = commit_map.get(
|
|
40221
|
+
const commit = props.commit_range.commit_list[i2];
|
|
40222
|
+
const group_id = commit_map.get(commit.sha);
|
|
40184
40223
|
if (allow_unassigned_sync === null) {
|
|
40185
40224
|
if (group_id === null) {
|
|
40186
40225
|
allow_unassigned_sync = true;
|
|
@@ -40745,14 +40784,14 @@ class UI {
|
|
|
40745
40784
|
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
|
40746
40785
|
}
|
|
40747
40786
|
toString() {
|
|
40748
|
-
const
|
|
40787
|
+
const lines = [];
|
|
40749
40788
|
this.rows.forEach((row) => {
|
|
40750
|
-
this.rowToString(row,
|
|
40789
|
+
this.rowToString(row, lines);
|
|
40751
40790
|
});
|
|
40752
|
-
return
|
|
40791
|
+
return lines.filter((line) => !line.hidden).map((line) => line.text).join(`
|
|
40753
40792
|
`);
|
|
40754
40793
|
}
|
|
40755
|
-
rowToString(row,
|
|
40794
|
+
rowToString(row, lines) {
|
|
40756
40795
|
this.rasterize(row).forEach((rrow, r3) => {
|
|
40757
40796
|
let str = "";
|
|
40758
40797
|
rrow.forEach((col, c2) => {
|
|
@@ -40779,16 +40818,16 @@ class UI {
|
|
|
40779
40818
|
if (padding[right]) {
|
|
40780
40819
|
str += " ".repeat(padding[right]);
|
|
40781
40820
|
}
|
|
40782
|
-
if (r3 === 0 &&
|
|
40783
|
-
str = this.renderInline(str,
|
|
40821
|
+
if (r3 === 0 && lines.length > 0) {
|
|
40822
|
+
str = this.renderInline(str, lines[lines.length - 1]);
|
|
40784
40823
|
}
|
|
40785
40824
|
});
|
|
40786
|
-
|
|
40825
|
+
lines.push({
|
|
40787
40826
|
text: str.replace(/ +$/, ""),
|
|
40788
40827
|
span: row.span
|
|
40789
40828
|
});
|
|
40790
40829
|
});
|
|
40791
|
-
return
|
|
40830
|
+
return lines;
|
|
40792
40831
|
}
|
|
40793
40832
|
renderInline(source, previousLine) {
|
|
40794
40833
|
const match2 = source.match(/^ */);
|
|
@@ -45537,7 +45576,7 @@ async function command2(argv, options = {}) {
|
|
|
45537
45576
|
if (options.env_config) {
|
|
45538
45577
|
builder = builder.config(options.env_config);
|
|
45539
45578
|
}
|
|
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.
|
|
45579
|
+
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.2").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`");
|
|
45541
45580
|
const result = parsed.argv;
|
|
45542
45581
|
return result;
|
|
45543
45582
|
}
|