git-stack-cli 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js/index.js CHANGED
@@ -38415,6 +38415,8 @@ GitReviseTodo.todo = function todo(args) {
38415
38415
  return todo2;
38416
38416
  };
38417
38417
  GitReviseTodo.execute = async function grt_execute(args) {
38418
+ const argv = Store.getState().argv;
38419
+ const actions = Store.getState().actions;
38418
38420
  const GIT_SEQUENCE_EDITOR_SCRIPT = `#!/bin/sh
38419
38421
 
38420
38422
  # Example
@@ -38472,10 +38474,30 @@ echo
38472
38474
  const command = [
38473
38475
  `GIT_EDITOR="${tmp_git_sequence_editor_path}"`,
38474
38476
  `GIT_REVISE_TODO="${tmp_path_git_revise_todo}"`,
38475
- `git`,
38476
- `revise --edit -i ${args.rebase_merge_base}`
38477
+ `git`
38477
38478
  ];
38478
- await cli(command, { stdio: ["pipe", "pipe", "pipe"] });
38479
+ if (!argv["revise-sign"]) {
38480
+ command.push(...["-c", "commit.gpgsign=false"]);
38481
+ }
38482
+ command.push(`revise --edit -i ${args.rebase_merge_base}`);
38483
+ try {
38484
+ await cli(command, { stdio: ["pipe", "pipe", "pipe"] });
38485
+ } catch (err) {
38486
+ if (err instanceof Error) {
38487
+ actions.error(err.message);
38488
+ if (err.message.includes("gpg failed to sign commit")) {
38489
+ actions.error(`
38490
+
38491
+ `);
38492
+ actions.error("\uD83D\uDEA8 git revise failed to sign commit");
38493
+ actions.error("\uD83D\uDCA1 Try again with `--no-revise-sign`?");
38494
+ actions.error(`
38495
+
38496
+ `);
38497
+ actions.exit(21);
38498
+ }
38499
+ }
38500
+ }
38479
38501
  await safe_rm(tmp_git_sequence_editor_path);
38480
38502
  };
38481
38503
 
@@ -40094,7 +40116,8 @@ function SelectCommitRangesInternal(props) {
40094
40116
  let branch_prefix = "";
40095
40117
  if (argv["branch-prefix"]) {
40096
40118
  branch_prefix = argv["branch-prefix"];
40097
- } else if ("") {
40119
+ } else if (process.env.GIT_STACK_BRANCH_PREFIX) {
40120
+ branch_prefix = process.env.GIT_STACK_BRANCH_PREFIX;
40098
40121
  }
40099
40122
  return `${branch_prefix}${gs_short_id()}`;
40100
40123
  }
@@ -45661,7 +45684,7 @@ var yargs_default = Yargs;
45661
45684
 
45662
45685
  // src/command.ts
45663
45686
  async function command2() {
45664
- 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.4.0").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45687
+ 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.0").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45665
45688
  }
45666
45689
  var GlobalOptions = {
45667
45690
  verbose: {
@@ -45693,7 +45716,11 @@ var DefaultOptions = {
45693
45716
  verify: {
45694
45717
  type: "boolean",
45695
45718
  default: true,
45696
- description: "Run git hooks such as pre-commit and pre-push, disable with --no-verify"
45719
+ description: [
45720
+ "Run git hooks such as pre-commit and pre-push",
45721
+ "Disable with --no-verify"
45722
+ ].join(`
45723
+ `)
45697
45724
  },
45698
45725
  update: {
45699
45726
  type: "boolean",
@@ -45704,7 +45731,11 @@ var DefaultOptions = {
45704
45731
  branch: {
45705
45732
  type: "string",
45706
45733
  alias: ["b"],
45707
- description: 'Set the master branch name, defaults to "origin/master" (or "origin/main" if "origin/master" is not found)'
45734
+ description: [
45735
+ "Set the master branch name, defaults to 'origin/master'",
45736
+ "(or 'origin/main' if 'origin/master' is not found)"
45737
+ ].join(`
45738
+ `)
45708
45739
  },
45709
45740
  draft: {
45710
45741
  type: "boolean",
@@ -45717,10 +45748,19 @@ var DefaultOptions = {
45717
45748
  default: "",
45718
45749
  description: "Prefix for generated branch names, e.g. dev/magus/"
45719
45750
  },
45751
+ "revise-sign": {
45752
+ type: "boolean",
45753
+ default: true,
45754
+ description: "Disable GPG signing for git revise with --no-revise-sign"
45755
+ },
45720
45756
  template: {
45721
45757
  type: "boolean",
45722
45758
  default: true,
45723
- description: "Use automatic Github PR template, e.g. .github/pull_request_template.md, disable with --no-template"
45759
+ description: [
45760
+ "Use automatic Github PR template, e.g. .github/pull_request_template.md",
45761
+ "Disable with --no-template"
45762
+ ].join(`
45763
+ `)
45724
45764
  },
45725
45765
  "write-state-json": {
45726
45766
  hidden: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",
@@ -55,11 +55,6 @@ for (const filepath of package_json.files) {
55
55
  }
56
56
  }
57
57
 
58
- process.env.GS_RELEASE_NPM = "true";
59
- console.info("Publishing to NPM requires a one-time password");
60
- const otp = await input("Enter OTP: ");
61
- await spawn(["npm", "publish", `--otp=${otp}`]);
62
-
63
58
  process.chdir(REPO_ROOT);
64
59
 
65
60
  await spawn.sync(`git commit -a -m ${version}`);
@@ -70,6 +65,11 @@ await spawn.sync(`git push`);
70
65
  await spawn.sync(`git tag -a ${version} -m ${version}`);
71
66
  await spawn.sync(`git push origin ${version}`);
72
67
 
68
+ process.env.GS_RELEASE_NPM = "true";
69
+ console.info("Publishing to NPM requires a one-time password");
70
+ const otp = await input("Enter OTP: ");
71
+ await spawn(["npm", "publish", `--otp=${otp}`]);
72
+
73
73
  console.debug();
74
74
  console.debug("✅", "published", version);
75
75
  console.debug();
package/src/command.ts CHANGED
@@ -79,7 +79,11 @@ const DefaultOptions = {
79
79
  "verify": {
80
80
  type: "boolean",
81
81
  default: true,
82
- description: "Run git hooks such as pre-commit and pre-push, disable with --no-verify",
82
+ description: [
83
+ // force line break
84
+ "Run git hooks such as pre-commit and pre-push",
85
+ "Disable with --no-verify",
86
+ ].join("\n"),
83
87
  },
84
88
 
85
89
  "update": {
@@ -92,8 +96,11 @@ const DefaultOptions = {
92
96
  "branch": {
93
97
  type: "string",
94
98
  alias: ["b"],
95
- description:
96
- 'Set the master branch name, defaults to "origin/master" (or "origin/main" if "origin/master" is not found)',
99
+ description: [
100
+ // force line break
101
+ "Set the master branch name, defaults to 'origin/master'",
102
+ "(or 'origin/main' if 'origin/master' is not found)",
103
+ ].join("\n"),
97
104
  },
98
105
 
99
106
  "draft": {
@@ -109,11 +116,20 @@ const DefaultOptions = {
109
116
  description: "Prefix for generated branch names, e.g. dev/magus/",
110
117
  },
111
118
 
119
+ "revise-sign": {
120
+ type: "boolean",
121
+ default: true,
122
+ description: "Disable GPG signing for git revise with --no-revise-sign",
123
+ },
124
+
112
125
  "template": {
113
126
  type: "boolean",
114
127
  default: true,
115
- description:
116
- "Use automatic Github PR template, e.g. .github/pull_request_template.md, disable with --no-template",
128
+ description: [
129
+ // force line break
130
+ "Use automatic Github PR template, e.g. .github/pull_request_template.md",
131
+ "Disable with --no-template",
132
+ ].join("\n"),
117
133
  },
118
134
 
119
135
  "write-state-json": {
@@ -1,6 +1,7 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
3
 
4
+ import { Store } from "~/app/Store";
4
5
  import * as Metadata from "~/core/Metadata";
5
6
  import { cli } from "~/core/cli";
6
7
  import { get_tmp_dir } from "~/core/get_tmp_dir";
@@ -106,6 +107,9 @@ GitReviseTodo.todo = function todo(args: CommitListArgs) {
106
107
  };
107
108
 
108
109
  GitReviseTodo.execute = async function grt_execute(args: ExecuteArgs) {
110
+ const argv = Store.getState().argv;
111
+ const actions = Store.getState().actions;
112
+
109
113
  // replaced at build time with literal contents of `scripts/git-sequence-editor.sh`
110
114
  const GIT_SEQUENCE_EDITOR_SCRIPT = process.env.GIT_SEQUENCE_EDITOR_SCRIPT;
111
115
  invariant(GIT_SEQUENCE_EDITOR_SCRIPT, "GIT_SEQUENCE_EDITOR_SCRIPT must exist");
@@ -126,13 +130,31 @@ GitReviseTodo.execute = async function grt_execute(args: ExecuteArgs) {
126
130
  `GIT_EDITOR="${tmp_git_sequence_editor_path}"`,
127
131
  `GIT_REVISE_TODO="${tmp_path_git_revise_todo}"`,
128
132
  `git`,
129
- `revise --edit -i ${args.rebase_merge_base}`,
130
133
  ];
131
134
 
132
- // `ignore` hdies output which helps prevent scrollback clear
133
- // `pipe` helps see failures when git revise fails
134
- // https://github.com/magus/git-stack-cli/commit/f9f10e3ac3cd9a35ee75d3e0851a48391967a23f
135
- await cli(command, { stdio: ["pipe", "pipe", "pipe"] });
135
+ if (!argv["revise-sign"]) {
136
+ command.push(...["-c", "commit.gpgsign=false"]);
137
+ }
138
+
139
+ command.push(`revise --edit -i ${args.rebase_merge_base}`);
140
+
141
+ try {
142
+ // `ignore` hides output which helps prevent scrollback clear
143
+ // `pipe` helps see failures when git revise fails
144
+ // https://github.com/magus/git-stack-cli/commit/f9f10e3ac3cd9a35ee75d3e0851a48391967a23f
145
+ await cli(command, { stdio: ["pipe", "pipe", "pipe"] });
146
+ } catch (err) {
147
+ if (err instanceof Error) {
148
+ actions.error(err.message);
149
+ if (err.message.includes("gpg failed to sign commit")) {
150
+ actions.error("\n\n");
151
+ actions.error("🚨 git revise failed to sign commit");
152
+ actions.error("💡 Try again with `--no-revise-sign`?");
153
+ actions.error("\n\n");
154
+ actions.exit(21);
155
+ }
156
+ }
157
+ }
136
158
 
137
159
  // cleanup tmp_git_sequence_editor_path
138
160
  await safe_rm(tmp_git_sequence_editor_path);