git-stack-cli 2.1.1-beta → 2.1.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/README.md CHANGED
@@ -126,8 +126,10 @@ Managing even a few stacked diffs requires a relatively strong knowledge of `git
126
126
  Ensure `node --version` is the same across both projects you are using to test the `git-stack` cli
127
127
 
128
128
  ```bash
129
+ corepack enable
130
+
129
131
  git submodule update --init --recursive
130
- npm i
132
+ pnpm i
131
133
  pnpm run dev
132
134
  pnpm link --global
133
135
 
package/dist/js/index.js CHANGED
@@ -28100,6 +28100,7 @@ var require_last = __commonJS((exports, module) => {
28100
28100
  // src/index.tsx
28101
28101
  var React55 = __toESM(require_react(), 1);
28102
28102
  import fs14 from "node:fs/promises";
28103
+ import path10 from "node:path";
28103
28104
 
28104
28105
  // 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/render.js
28105
28106
  import { Stream } from "node:stream";
@@ -37090,11 +37091,24 @@ var BaseStore = createStore()(immer2((set2, get) => ({
37090
37091
  state.mutate.output(state, { node });
37091
37092
  });
37092
37093
  },
37093
- error(message) {
37094
- set2((state) => {
37095
- const node = /* @__PURE__ */ React16.createElement(Text, {
37094
+ error(error) {
37095
+ let node;
37096
+ if (typeof error === "string") {
37097
+ node = /* @__PURE__ */ React16.createElement(Text, {
37098
+ color: colors.red
37099
+ }, error);
37100
+ } else if (error instanceof Error) {
37101
+ node = /* @__PURE__ */ React16.createElement(Box_default, {
37102
+ flexDirection: "column"
37103
+ }, /* @__PURE__ */ React16.createElement(Text, {
37104
+ color: colors.red
37105
+ }, error.stack));
37106
+ } else {
37107
+ node = /* @__PURE__ */ React16.createElement(Text, {
37096
37108
  color: colors.red
37097
- }, message);
37109
+ }, `Unhandled error: ${JSON.stringify(error)}`);
37110
+ }
37111
+ set2((state) => {
37098
37112
  state.mutate.output(state, { node });
37099
37113
  });
37100
37114
  },
@@ -37280,9 +37294,7 @@ async function cli(unsafe_command, unsafe_options) {
37280
37294
  };
37281
37295
  state.actions.set((state2) => state2.mutate.end_pending_output(state2, id));
37282
37296
  state.actions.debug(log.end(result));
37283
- state.actions.debug(result.output);
37284
- state.actions.debug(`
37285
- `);
37297
+ state.actions.debug(log.output(result));
37286
37298
  if (!options.ignoreExitCode && result.code !== 0) {
37287
37299
  reject(new Error(log.error(result)));
37288
37300
  } else {
@@ -37318,7 +37330,7 @@ cli.sync = function cli_sync(unsafe_command, unsafe_options) {
37318
37330
  duration
37319
37331
  };
37320
37332
  state.actions.debug(log.end(result));
37321
- state.actions.debug(result.output);
37333
+ state.actions.debug(log.output(result));
37322
37334
  if (!options.ignoreExitCode && result.code !== 0) {
37323
37335
  throw new Error(log.error(result));
37324
37336
  }
@@ -37336,6 +37348,10 @@ var log = {
37336
37348
  const { command, code, duration } = result;
37337
37349
  return `[end] ${command} (exit_code=${code} duration=${duration})`;
37338
37350
  },
37351
+ output(result) {
37352
+ return `${result.output}
37353
+ `;
37354
+ },
37339
37355
  error(result) {
37340
37356
  const { command, code, duration } = result;
37341
37357
  return `${command} (exit_code=${code} duration=${duration})`;
@@ -37797,7 +37813,7 @@ function Url(props) {
37797
37813
  import fs7 from "node:fs";
37798
37814
  import path4 from "node:path";
37799
37815
  function is_command_available(command) {
37800
- const PATH = "/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/.rvm/gems/ruby-2.6.3/bin:/Users/noah/.rvm/gems/ruby-2.6.3@global/bin:/Users/noah/.rvm/rubies/ruby-2.6.3/bin:/Users/noah/Library/pnpm:/Users/noah/.bun/bin:/Users/noah/Library/Caches/fnm_multishells/45565_1737429645385/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/local/sbin:/Users/noah/.dotfiles/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/noah/.cargo/bin:/Applications/iTerm.app/Contents/Resources/utilities:/Users/noah/google-cloud-sdk/bin:/Users/noah/.yarn/bin:/Users/noah/.fastlane/bin:/usr/local/opt/fzf/bin:/Users/noah/google-cloud-sdk/bin:/Users/noah/.yarn/bin:/Users/noah/.fastlane/bin:/Users/noah/.rvm/bin";
37816
+ const PATH = "/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/github/git-stack-cli/node_modules/.bin:/Users/noah/.cache/node/corepack/v1/pnpm/9.15.4/dist/node-gyp-bin:/Users/noah/.rvm/gems/ruby-3.0.0/bin:/Users/noah/.rvm/gems/ruby-3.0.0@global/bin:/Users/noah/.rvm/rubies/ruby-3.0.0/bin:/Users/noah/Library/pnpm:/Users/noah/.bun/bin:/Users/noah/Library/Caches/fnm_multishells/99719_1742855928667/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/local/sbin:/Users/noah/.dotfiles/bin:/usr/local/sbin:/usr/local/bin:/Users/noah/.openai/bin:/Users/noah/.virtualenvs/openai/bin:/Users/noah/.pyenv/shims:/Users/noah/.pyenv/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/go/bin:/Users/noah/.cargo/bin:/Users/noah/Applications/iTerm.app/Contents/Resources/utilities:/Users/noah/.openai/bin:/Users/noah/google-cloud-sdk/bin:/Users/noah/.yarn/bin:/Users/noah/.fastlane/bin:/usr/local/go/bin:/usr/local/opt/fzf/bin:/Users/noah/google-cloud-sdk/bin:/Users/noah/.yarn/bin:/Users/noah/.fastlane/bin:/usr/local/go/bin:/Users/noah/.rvm/bin";
37801
37817
  invariant(PATH, "PATH env must exist");
37802
37818
  const path_list = PATH.split(path4.delimiter);
37803
37819
  for (const dir of path_list) {
@@ -40002,8 +40018,7 @@ function SelectCommitRangesInternal(props) {
40002
40018
  let branch_prefix = "";
40003
40019
  if (argv["branch-prefix"]) {
40004
40020
  branch_prefix = argv["branch-prefix"];
40005
- } else if (process.env.GIT_STACK_BRANCH_PREFIX) {
40006
- branch_prefix = process.env.GIT_STACK_BRANCH_PREFIX;
40021
+ } else if ("") {
40007
40022
  }
40008
40023
  return `${branch_prefix}${gs_short_id()}`;
40009
40024
  }
@@ -45625,7 +45640,7 @@ var yargs_default = Yargs;
45625
45640
 
45626
45641
  // src/command.ts
45627
45642
  async function command2() {
45628
- return yargs_default(hideBin(process.argv)).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.1.1-beta").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45643
+ return yargs_default(hideBin(process.argv)).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.1.3").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45629
45644
  }
45630
45645
  var GlobalOptions = {
45631
45646
  verbose: {
@@ -45745,7 +45760,11 @@ var FixupOptions = {
45745
45760
  state.argv = argv;
45746
45761
  state.cwd = process.cwd();
45747
45762
  });
45748
- Store.getState().actions.debug(pretty_json(argv));
45763
+ const actions = Store.getState().actions;
45764
+ actions.debug(pretty_json(argv));
45765
+ const PATH = process.env["PATH"];
45766
+ const PATH_LIST = pretty_json(PATH.split(path10.delimiter));
45767
+ actions.debug(`process.env.PATH ${PATH_LIST}`);
45749
45768
  await ink.waitUntilExit();
45750
45769
  } catch (err) {
45751
45770
  console.error(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "2.1.1-beta",
3
+ "version": "2.1.3",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",
package/src/app/Store.tsx CHANGED
@@ -84,7 +84,7 @@ export type State = {
84
84
  unmount(): void;
85
85
  newline(): void;
86
86
  json(value: pretty_json.JSONValue): void;
87
- error(message: string): void;
87
+ error(error: unknown): void;
88
88
  output(node: React.ReactNode): void;
89
89
  debug(node: React.ReactNode, id?: string): void;
90
90
 
@@ -176,9 +176,24 @@ const BaseStore = createStore<State>()(
176
176
  });
177
177
  },
178
178
 
179
- error(message) {
179
+ error(error) {
180
+ let node: React.ReactNode;
181
+
182
+ if (typeof error === "string") {
183
+ node = <Ink.Text color={colors.red}>{error}</Ink.Text>;
184
+ } else if (error instanceof Error) {
185
+ node = (
186
+ <Ink.Box flexDirection="column">
187
+ <Ink.Text color={colors.red}>{error.stack}</Ink.Text>
188
+ </Ink.Box>
189
+ );
190
+ } else {
191
+ node = (
192
+ <Ink.Text color={colors.red}>{`Unhandled error: ${JSON.stringify(error)}`}</Ink.Text>
193
+ );
194
+ }
195
+
180
196
  set((state) => {
181
- const node = <Ink.Text color={colors.red}>{message}</Ink.Text>;
182
197
  state.mutate.output(state, { node });
183
198
  });
184
199
  },
package/src/core/cli.ts CHANGED
@@ -79,8 +79,7 @@ export async function cli(
79
79
 
80
80
  state.actions.set((state) => state.mutate.end_pending_output(state, id));
81
81
  state.actions.debug(log.end(result));
82
- state.actions.debug(result.output);
83
- state.actions.debug("\n");
82
+ state.actions.debug(log.output(result));
84
83
 
85
84
  if (!options.ignoreExitCode && result.code !== 0) {
86
85
  reject(new Error(log.error(result)));
@@ -131,7 +130,7 @@ cli.sync = function cli_sync(
131
130
  };
132
131
 
133
132
  state.actions.debug(log.end(result));
134
- state.actions.debug(result.output);
133
+ state.actions.debug(log.output(result));
135
134
 
136
135
  if (!options.ignoreExitCode && result.code !== 0) {
137
136
  throw new Error(log.error(result));
@@ -154,6 +153,10 @@ const log = {
154
153
  return `[end] ${command} (exit_code=${code} duration=${duration})`;
155
154
  },
156
155
 
156
+ output(result: Return) {
157
+ return `${result.output}\n`;
158
+ },
159
+
157
160
  error(result: Return) {
158
161
  const { command, code, duration } = result;
159
162
  return `${command} (exit_code=${code} duration=${duration})`;
@@ -1,5 +1,11 @@
1
1
  export namespace pretty_json {
2
- export type JSONValue = null | number | string | boolean | { [key: string]: JSONValue };
2
+ export type JSONValue =
3
+ | null
4
+ | number
5
+ | string
6
+ | boolean
7
+ | { [key: string]: JSONValue }
8
+ | Array<JSONValue>;
3
9
  }
4
10
 
5
11
  export function pretty_json<T extends pretty_json.JSONValue>(input: T): string {
package/src/index.tsx CHANGED
@@ -5,6 +5,7 @@
5
5
  import * as React from "react";
6
6
 
7
7
  import fs from "node:fs/promises";
8
+ import path from "node:path";
8
9
 
9
10
  import * as Ink from "ink-cjs";
10
11
 
@@ -56,7 +57,13 @@ import { pretty_json } from "~/core/pretty_json";
56
57
  state.cwd = process.cwd();
57
58
  });
58
59
 
59
- Store.getState().actions.debug(pretty_json(argv as any));
60
+ const actions = Store.getState().actions;
61
+
62
+ actions.debug(pretty_json(argv as any));
63
+
64
+ const PATH = process.env["PATH"];
65
+ const PATH_LIST = pretty_json(PATH.split(path.delimiter));
66
+ actions.debug(`process.env.PATH ${PATH_LIST}`);
60
67
 
61
68
  await ink.waitUntilExit();
62
69