git-stack-cli 2.5.2 → 2.5.3

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 CHANGED
@@ -28098,7 +28098,7 @@ var require_last = __commonJS((exports, module) => {
28098
28098
  });
28099
28099
 
28100
28100
  // src/index.tsx
28101
- var React55 = __toESM(require_react(), 1);
28101
+ var React56 = __toESM(require_react(), 1);
28102
28102
  import fs12 from "node:fs/promises";
28103
28103
  import path9 from "node:path";
28104
28104
 
@@ -31935,7 +31935,7 @@ var import_react20 = __toESM(require_react(), 1);
31935
31935
  // node_modules/.pnpm/ink-cjs@4.4.1_@types+react@18.2.33_react-devtools-core@4.19.1_react@18.2.0/node_modules/ink-cjs/build/hooks/use-focus-manager.js
31936
31936
  var import_react21 = __toESM(require_react(), 1);
31937
31937
  // src/app/App.tsx
31938
- var React54 = __toESM(require_react(), 1);
31938
+ var React55 = __toESM(require_react(), 1);
31939
31939
 
31940
31940
  // src/app/AutoUpdate.tsx
31941
31941
  var React18 = __toESM(require_react(), 1);
@@ -37445,12 +37445,13 @@ function AutoUpdate(props) {
37445
37445
  let status2 = "done";
37446
37446
  let latest_version = null;
37447
37447
  let is_brew_bun_standalone = false;
37448
- const local_version = "2.5.2";
37448
+ const local_version = "2.5.3";
37449
+ const is_output = props_ref.current.verbose || props_ref.current.force;
37449
37450
  async function auto_update() {
37450
37451
  if (!local_version) {
37451
37452
  throw new Error("Auto update requires process.env.CLI_VERSION to be set");
37452
37453
  }
37453
- if (props_ref.current.verbose) {
37454
+ if (is_output) {
37454
37455
  handle_output(/* @__PURE__ */ React18.createElement(Text, {
37455
37456
  key: "init"
37456
37457
  }, "Checking for latest version..."));
@@ -37496,8 +37497,10 @@ function AutoUpdate(props) {
37496
37497
  }));
37497
37498
  }
37498
37499
  const semver_result = semver_compare(latest_version, local_version);
37499
- status2 = "prompt";
37500
37500
  if (semver_result === 0) {
37501
+ if (is_output) {
37502
+ handle_output(/* @__PURE__ */ React18.createElement(Text, null, "✅ Everything up to date. ", /* @__PURE__ */ React18.createElement(Brackets, null, latest_version)));
37503
+ }
37501
37504
  return;
37502
37505
  }
37503
37506
  if (semver_result === -1) {
@@ -37531,14 +37534,20 @@ function AutoUpdate(props) {
37531
37534
  if (state.is_brew_bun_standalone) {
37532
37535
  install_command = `npm install -g ${props.name}@latest`;
37533
37536
  } else {
37534
- install_command = `HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade magus/git-stack/git-stack`;
37537
+ install_command = "brew upgrade magus/git-stack/git-stack";
37535
37538
  }
37536
37539
  return /* @__PURE__ */ React18.createElement(YesNoPrompt, {
37537
37540
  message: /* @__PURE__ */ React18.createElement(Box_default, {
37538
37541
  flexDirection: "column"
37539
37542
  }, /* @__PURE__ */ React18.createElement(Text, {
37540
37543
  color: colors.yellow
37541
- }, "New version available, would you like to update?"), /* @__PURE__ */ React18.createElement(Text, null, " "), /* @__PURE__ */ React18.createElement(Command, null, install_command), /* @__PURE__ */ React18.createElement(Text, null, " "), /* @__PURE__ */ React18.createElement(FormatText, {
37544
+ }, /* @__PURE__ */ React18.createElement(FormatText, {
37545
+ wrapper: /* @__PURE__ */ React18.createElement(Text, null),
37546
+ message: "New version available {latest_version}, would you like to update?",
37547
+ values: {
37548
+ latest_version: /* @__PURE__ */ React18.createElement(Brackets, null, state.latest_version)
37549
+ }
37550
+ }), ","), /* @__PURE__ */ React18.createElement(Text, null, " "), /* @__PURE__ */ React18.createElement(Command, null, install_command), /* @__PURE__ */ React18.createElement(Text, null, " "), /* @__PURE__ */ React18.createElement(FormatText, {
37542
37551
  wrapper: /* @__PURE__ */ React18.createElement(Text, {
37543
37552
  color: colors.yellow
37544
37553
  }),
@@ -40671,9 +40680,23 @@ async function run12(args) {
40671
40680
  actions.exit(0);
40672
40681
  }
40673
40682
 
40674
- // src/components/ErrorBoundary.tsx
40683
+ // src/commands/Update.tsx
40675
40684
  var React52 = __toESM(require_react(), 1);
40676
- class ErrorBoundary extends React52.Component {
40685
+ function Update() {
40686
+ return /* @__PURE__ */ React52.createElement(Await, {
40687
+ fallback: null,
40688
+ function: run13
40689
+ });
40690
+ }
40691
+ async function run13() {
40692
+ const state = Store.getState();
40693
+ const actions = state.actions;
40694
+ actions.exit(0);
40695
+ }
40696
+
40697
+ // src/components/ErrorBoundary.tsx
40698
+ var React53 = __toESM(require_react(), 1);
40699
+ class ErrorBoundary extends React53.Component {
40677
40700
  constructor(props) {
40678
40701
  super(props);
40679
40702
  this.state = {
@@ -40700,15 +40723,15 @@ class ErrorBoundary extends React52.Component {
40700
40723
  return this.props.children;
40701
40724
  }
40702
40725
  const message = this.state.error.message;
40703
- return /* @__PURE__ */ React52.createElement(Box_default, {
40726
+ return /* @__PURE__ */ React53.createElement(Box_default, {
40704
40727
  flexDirection: "column",
40705
40728
  gap: 0
40706
- }, /* @__PURE__ */ React52.createElement(Text, {
40729
+ }, /* @__PURE__ */ React53.createElement(Text, {
40707
40730
  color: colors.red
40708
- }, /* @__PURE__ */ React52.createElement(FormatText, {
40731
+ }, /* @__PURE__ */ React53.createElement(FormatText, {
40709
40732
  message: "\uD83D\uDEA8 Unhandled error {message}",
40710
40733
  values: {
40711
- message: /* @__PURE__ */ React52.createElement(Text, {
40734
+ message: /* @__PURE__ */ React53.createElement(Text, {
40712
40735
  color: colors.gray
40713
40736
  }, message)
40714
40737
  }
@@ -40717,20 +40740,20 @@ class ErrorBoundary extends React52.Component {
40717
40740
  _render_verbose() {
40718
40741
  const store_state = Store.getState();
40719
40742
  if (store_state.argv.verbose) {
40720
- return /* @__PURE__ */ React52.createElement(Text, {
40743
+ return /* @__PURE__ */ React53.createElement(Text, {
40721
40744
  color: colors.gray
40722
40745
  }, this.state.component_stack);
40723
40746
  }
40724
- return /* @__PURE__ */ React52.createElement(Text, {
40747
+ return /* @__PURE__ */ React53.createElement(Text, {
40725
40748
  color: colors.gray
40726
- }, /* @__PURE__ */ React52.createElement(FormatText, {
40749
+ }, /* @__PURE__ */ React53.createElement(FormatText, {
40727
40750
  message: "Try again with `--verbose` to see more information."
40728
40751
  }));
40729
40752
  }
40730
40753
  }
40731
40754
 
40732
40755
  // src/components/ExitingGate.tsx
40733
- var React53 = __toESM(require_react(), 1);
40756
+ var React54 = __toESM(require_react(), 1);
40734
40757
  function ExitingGate(props) {
40735
40758
  const exit_mode = Store.useState((state) => state.exit_mode);
40736
40759
  if (!exit_mode) {
@@ -40740,11 +40763,11 @@ function ExitingGate(props) {
40740
40763
  case "quiet":
40741
40764
  return null;
40742
40765
  case "normal":
40743
- return /* @__PURE__ */ React53.createElement(Box_default, {
40766
+ return /* @__PURE__ */ React54.createElement(Box_default, {
40744
40767
  flexDirection: "column"
40745
- }, /* @__PURE__ */ React53.createElement(Text, {
40768
+ }, /* @__PURE__ */ React54.createElement(Text, {
40746
40769
  color: colors.red
40747
- }, /* @__PURE__ */ React53.createElement(FormatText, {
40770
+ }, /* @__PURE__ */ React54.createElement(FormatText, {
40748
40771
  message: "\uD83D\uDEA8 Exiting…"
40749
40772
  })));
40750
40773
  default:
@@ -40757,32 +40780,37 @@ function App2() {
40757
40780
  const actions = Store.useActions();
40758
40781
  const ink = Store.useState((state) => state.ink);
40759
40782
  const argv = Store.useState((state) => state.argv);
40760
- if (!ink || !argv) {
40783
+ if (!ink || !argv || !argv.$0) {
40761
40784
  return null;
40762
40785
  }
40763
- return /* @__PURE__ */ React54.createElement(Providers, null, /* @__PURE__ */ React54.createElement(ErrorBoundary, null, /* @__PURE__ */ React54.createElement(Debug, null), /* @__PURE__ */ React54.createElement(Output2, null), /* @__PURE__ */ React54.createElement(ExitingGate, null, /* @__PURE__ */ React54.createElement(AutoUpdate, {
40786
+ const positional_list = new Set(argv["_"]);
40787
+ const is_update = positional_list.has("update") || positional_list.has("upgrade");
40788
+ return /* @__PURE__ */ React55.createElement(Providers, null, /* @__PURE__ */ React55.createElement(ErrorBoundary, null, /* @__PURE__ */ React55.createElement(Debug, null), /* @__PURE__ */ React55.createElement(Output2, null), /* @__PURE__ */ React55.createElement(ExitingGate, null, /* @__PURE__ */ React55.createElement(AutoUpdate, {
40764
40789
  name: "git-stack-cli",
40765
- verbose: argv.verbose || argv.update,
40766
- timeoutMs: argv.update ? 30 * 1000 : 2 * 1000,
40790
+ verbose: argv.verbose,
40791
+ force: is_update,
40792
+ timeoutMs: is_update ? 30 * 1000 : 2 * 1000,
40767
40793
  onOutput: actions.output,
40768
40794
  onDone: () => {
40769
- if (argv.update) {
40795
+ if (is_update) {
40770
40796
  actions.exit(0);
40771
40797
  }
40772
40798
  }
40773
- }, /* @__PURE__ */ React54.createElement(VerboseDebugInfo, null, /* @__PURE__ */ React54.createElement(RebaseCheck, null, /* @__PURE__ */ React54.createElement(CherryPickCheck, null, /* @__PURE__ */ React54.createElement(MaybeMain, null))))), /* @__PURE__ */ React54.createElement(HandleCtrlCSigint, null))));
40799
+ }, /* @__PURE__ */ React55.createElement(VerboseDebugInfo, null, /* @__PURE__ */ React55.createElement(RebaseCheck, null, /* @__PURE__ */ React55.createElement(CherryPickCheck, null, /* @__PURE__ */ React55.createElement(MaybeMain, null))))), /* @__PURE__ */ React55.createElement(HandleCtrlCSigint, null))));
40774
40800
  }
40775
40801
  function MaybeMain() {
40776
40802
  const argv = Store.useState((state) => state.argv);
40777
40803
  const positional_list = new Set(argv["_"]);
40778
40804
  if (positional_list.has("fixup")) {
40779
- return /* @__PURE__ */ React54.createElement(Fixup, null);
40805
+ return /* @__PURE__ */ React55.createElement(Fixup, null);
40780
40806
  } else if (positional_list.has("log")) {
40781
- return /* @__PURE__ */ React54.createElement(Log, null);
40807
+ return /* @__PURE__ */ React55.createElement(Log, null);
40808
+ } else if (positional_list.has("update")) {
40809
+ return /* @__PURE__ */ React55.createElement(Update, null);
40782
40810
  } else if (positional_list.has("rebase")) {
40783
- return /* @__PURE__ */ React54.createElement(DependencyCheck, null, /* @__PURE__ */ React54.createElement(DirtyCheck, null, /* @__PURE__ */ React54.createElement(GatherMetadata, null, /* @__PURE__ */ React54.createElement(LocalCommitStatus, null, /* @__PURE__ */ React54.createElement(Rebase, null)))));
40811
+ return /* @__PURE__ */ React55.createElement(DependencyCheck, null, /* @__PURE__ */ React55.createElement(DirtyCheck, null, /* @__PURE__ */ React55.createElement(GatherMetadata, null, /* @__PURE__ */ React55.createElement(LocalCommitStatus, null, /* @__PURE__ */ React55.createElement(Rebase, null)))));
40784
40812
  }
40785
- return /* @__PURE__ */ React54.createElement(React54.Fragment, null, !argv.verbose ? null : /* @__PURE__ */ React54.createElement(GithubApiError, null), /* @__PURE__ */ React54.createElement(DependencyCheck, null, /* @__PURE__ */ React54.createElement(DirtyCheck, null, /* @__PURE__ */ React54.createElement(GatherMetadata, null, /* @__PURE__ */ React54.createElement(LocalCommitStatus, null, /* @__PURE__ */ React54.createElement(DetectInitialPR, null, /* @__PURE__ */ React54.createElement(Main, null)))))));
40813
+ return /* @__PURE__ */ React55.createElement(React55.Fragment, null, !argv.verbose ? null : /* @__PURE__ */ React55.createElement(GithubApiError, null), /* @__PURE__ */ React55.createElement(DependencyCheck, null, /* @__PURE__ */ React55.createElement(DirtyCheck, null, /* @__PURE__ */ React55.createElement(GatherMetadata, null, /* @__PURE__ */ React55.createElement(LocalCommitStatus, null, /* @__PURE__ */ React55.createElement(DetectInitialPR, null, /* @__PURE__ */ React55.createElement(Main, null)))))));
40786
40814
  }
40787
40815
 
40788
40816
  // node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/lib/platform-shims/esm.mjs
@@ -45647,7 +45675,7 @@ var yargs_default = Yargs;
45647
45675
 
45648
45676
  // src/command.ts
45649
45677
  async function command2() {
45650
- return yargs_default(hideBin(process.argv)).scriptName("git stack").usage("Usage: git stack [command] [options]").command("$0", "Sync commit ranges to Github", (yargs) => yargs.options(DefaultOptions)).command("fixup [commit]", "Amend staged changes to a specific commit in history", (yargs) => yargs.positional("commit", FixupOptions.commit)).command("log [args...]", "Print an abbreviated log with numbered commits, useful for git stack fixup", (yargs) => yargs.strict(false)).command("rebase", "Update local branch via rebase with latest changes from origin master branch", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.5.2").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45678
+ return yargs_default(hideBin(process.argv)).scriptName("git stack").usage("Usage: git stack [command] [options]").command("$0", "Sync commit ranges to Github", (yargs) => yargs.options(DefaultOptions)).command("fixup [commit]", "Amend staged changes to a specific commit in history", (yargs) => yargs.positional("commit", FixupOptions.commit)).command("log [args...]", "Print an abbreviated log with numbered commits, useful for git stack fixup", (yargs) => yargs.strict(false)).command("rebase", "Update local branch via rebase with latest changes from origin master branch", (yargs) => yargs).command(["update", "upgrade"], "Check and install the latest version of git stack", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.5.3").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45651
45679
  }
45652
45680
  var GlobalOptions = {
45653
45681
  verbose: {
@@ -45685,12 +45713,6 @@ var DefaultOptions = {
45685
45713
  ].join(`
45686
45714
  `)
45687
45715
  },
45688
- update: {
45689
- type: "boolean",
45690
- alias: ["u", "upgrade"],
45691
- default: false,
45692
- description: "Check and install the latest version"
45693
- },
45694
45716
  branch: {
45695
45717
  type: "string",
45696
45718
  alias: ["b"],
@@ -45775,7 +45797,7 @@ var FixupOptions = {
45775
45797
  });
45776
45798
  const tmp_dir = await get_tmp_dir();
45777
45799
  await fs12.rm(tmp_dir, { recursive: true });
45778
- const ink = render_default(/* @__PURE__ */ React55.createElement(App2, null), {
45800
+ const ink = render_default(/* @__PURE__ */ React56.createElement(App2, null), {
45779
45801
  exitOnCtrlC: false
45780
45802
  });
45781
45803
  Store.setState((state) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",
package/src/app/App.tsx CHANGED
@@ -19,6 +19,7 @@ import { VerboseDebugInfo } from "~/app/VerboseDebugInfo";
19
19
  import { Fixup } from "~/commands/Fixup";
20
20
  import { Log } from "~/commands/Log";
21
21
  import { Rebase } from "~/commands/Rebase";
22
+ import { Update } from "~/commands/Update";
22
23
  import { ErrorBoundary } from "~/components/ErrorBoundary";
23
24
  import { ExitingGate } from "~/components/ExitingGate";
24
25
 
@@ -28,7 +29,7 @@ export function App() {
28
29
  const ink = Store.useState((state) => state.ink);
29
30
  const argv = Store.useState((state) => state.argv);
30
31
 
31
- if (!ink || !argv) {
32
+ if (!ink || !argv || !argv.$0) {
32
33
  return null;
33
34
  }
34
35
 
@@ -42,6 +43,9 @@ export function App() {
42
43
  // </React.Fragment>
43
44
  // );
44
45
 
46
+ const positional_list = new Set(argv["_"]);
47
+ const is_update = positional_list.has("update") || positional_list.has("upgrade");
48
+
45
49
  return (
46
50
  <Providers>
47
51
  <ErrorBoundary>
@@ -51,11 +55,12 @@ export function App() {
51
55
  <ExitingGate>
52
56
  <AutoUpdate
53
57
  name="git-stack-cli"
54
- verbose={argv.verbose || argv.update}
55
- timeoutMs={argv.update ? 30 * 1000 : 2 * 1000}
58
+ verbose={argv.verbose}
59
+ force={is_update}
60
+ timeoutMs={is_update ? 30 * 1000 : 2 * 1000}
56
61
  onOutput={actions.output}
57
62
  onDone={() => {
58
- if (argv.update) {
63
+ if (is_update) {
59
64
  actions.exit(0);
60
65
  }
61
66
  }}
@@ -84,6 +89,8 @@ function MaybeMain() {
84
89
  return <Fixup />;
85
90
  } else if (positional_list.has("log")) {
86
91
  return <Log />;
92
+ } else if (positional_list.has("update")) {
93
+ return <Update />;
87
94
  } else if (positional_list.has("rebase")) {
88
95
  return (
89
96
  <DependencyCheck>
@@ -17,6 +17,7 @@ type Props = {
17
17
  name: string;
18
18
  children: React.ReactNode;
19
19
  verbose?: boolean;
20
+ force?: boolean;
20
21
  timeoutMs?: number;
21
22
  onError?: (error: Error) => void;
22
23
  onOutput?: (output: React.ReactNode) => void;
@@ -65,13 +66,14 @@ export function AutoUpdate(props: Props) {
65
66
  let is_brew_bun_standalone = false;
66
67
 
67
68
  const local_version = process.env.CLI_VERSION;
69
+ const is_output = props_ref.current.verbose || props_ref.current.force;
68
70
 
69
71
  async function auto_update() {
70
72
  if (!local_version) {
71
73
  throw new Error("Auto update requires process.env.CLI_VERSION to be set");
72
74
  }
73
75
 
74
- if (props_ref.current.verbose) {
76
+ if (is_output) {
75
77
  handle_output(<Ink.Text key="init">Checking for latest version...</Ink.Text>);
76
78
  }
77
79
 
@@ -125,9 +127,14 @@ export function AutoUpdate(props: Props) {
125
127
 
126
128
  const semver_result = semver_compare(latest_version, local_version);
127
129
 
128
- status = "prompt";
129
-
130
130
  if (semver_result === 0) {
131
+ if (is_output) {
132
+ handle_output(
133
+ <Ink.Text>
134
+ ✅ Everything up to date. <Brackets>{latest_version}</Brackets>
135
+ </Ink.Text>,
136
+ );
137
+ }
131
138
  return;
132
139
  }
133
140
 
@@ -175,7 +182,7 @@ export function AutoUpdate(props: Props) {
175
182
  if (state.is_brew_bun_standalone) {
176
183
  install_command = `npm install -g ${props.name}@latest`;
177
184
  } else {
178
- install_command = `HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade magus/git-stack/git-stack`;
185
+ install_command = "brew upgrade magus/git-stack/git-stack";
179
186
  }
180
187
 
181
188
  return (
@@ -183,7 +190,14 @@ export function AutoUpdate(props: Props) {
183
190
  message={
184
191
  <Ink.Box flexDirection="column">
185
192
  <Ink.Text color={colors.yellow}>
186
- New version available, would you like to update?
193
+ <FormatText
194
+ wrapper={<Ink.Text />}
195
+ message="New version available {latest_version}, would you like to update?"
196
+ values={{
197
+ latest_version: <Brackets>{state.latest_version}</Brackets>,
198
+ }}
199
+ />
200
+ ,
187
201
  </Ink.Text>
188
202
  <Ink.Text> </Ink.Text>
189
203
  <Command>{install_command}</Command>
package/src/command.ts CHANGED
@@ -30,6 +30,12 @@ export async function command() {
30
30
  (yargs) => yargs,
31
31
  )
32
32
 
33
+ .command(
34
+ ["update", "upgrade"],
35
+ "Check and install the latest version of git stack",
36
+ (yargs) => yargs,
37
+ )
38
+
33
39
  .option("verbose", GlobalOptions.verbose)
34
40
 
35
41
  // yargs default wraps to 80 columns
@@ -86,13 +92,6 @@ const DefaultOptions = {
86
92
  ].join("\n"),
87
93
  },
88
94
 
89
- "update": {
90
- type: "boolean",
91
- alias: ["u", "upgrade"],
92
- default: false,
93
- description: "Check and install the latest version",
94
- },
95
-
96
95
  "branch": {
97
96
  type: "string",
98
97
  alias: ["b"],
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+
3
+ import { Await } from "~/app/Await";
4
+ import { Store } from "~/app/Store";
5
+
6
+ export function Update() {
7
+ return <Await fallback={null} function={run} />;
8
+ }
9
+
10
+ async function run() {
11
+ const state = Store.getState();
12
+ const actions = state.actions;
13
+
14
+ actions.exit(0);
15
+ }
@@ -67,10 +67,10 @@ test("git-revise-todo handles double quotes in commit message", () => {
67
67
  [
68
68
  //force line break
69
69
  "++ pick f143d03c723c",
70
- '[new] invalid \\"by me\\" quotes',
70
+ '[new] invalid "by me" quotes',
71
71
  "",
72
72
  "git-stack-id: 6Ak-qn+5Z",
73
- 'git-stack-title: [new] invalid \\"by me\\" quotes',
73
+ 'git-stack-title: [new] invalid "by me" quotes',
74
74
  ].join("\n"),
75
75
  );
76
76
  });
@@ -129,10 +129,10 @@ test("write handles double quotes", () => {
129
129
  expect(Metadata.write(body, metadata)).toEqual(
130
130
  [
131
131
  // force line break
132
- 'Revert \\"[abc / 123] subject (#1234)\\"',
132
+ 'Revert "[abc / 123] subject (#1234)"',
133
133
  "",
134
134
  "git-stack-id: abc123",
135
- 'git-stack-title: Revert \\"[abc / 123] subject (#1234)\\"',
135
+ 'git-stack-title: Revert "[abc / 123] subject (#1234)"',
136
136
  ].join("\n"),
137
137
  );
138
138
  });