git-stack-cli 0.7.4 → 0.7.5

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
@@ -1,13 +1,15 @@
1
1
  # git-stack-cli
2
2
 
3
+ - ✨ **[Stacked diffs](https://graphite.dev/guides/stacked-diffs) for `git`**
3
4
  - 🚀 **Simple one-branch workflow**
4
5
  - 🎯 **Interactively select commits for each pull request**
5
- - 📚 **Preserve your detailed commit history**
6
- - ♻️ **Automatically synchronize each pull request in the stack**
7
6
  - 💬 **Group commits for focused code review**
8
- - 🚫 **Avoid mutiple branch juggling and complex rebasing**
7
+ - 🌐 **Use the [official GitHub CLI](https://cli.github.com/)**
8
+ - ♻️ **Automatically synchronize each pull request in the stack**
9
9
  - 💪 **Work seamlessly with GitHub's interface**
10
- - 🌐 **Leverage the [official GitHub CLI](https://cli.github.com/)**
10
+ - 🚫 **Avoid juggling mutiple branches and complex rebasing**
11
+ - 📚 **Preserve your detailed commit history**
12
+
11
13
 
12
14
  ## Demo
13
15
 
@@ -17,10 +19,19 @@
17
19
 
18
20
  ```bash
19
21
  npm i -g git-stack-cli
22
+ ```
20
23
 
24
+ ## Usage
25
+
26
+
27
+ ```bash
21
28
  git stack
22
- ```
23
29
 
30
+ git stack --verbose # print more detailed logs for debugging internals
31
+ git stack --no-verify # skip git hooks such as pre-commit and pre-push
32
+
33
+ git-stack --help # print a table of all command-line arguments
34
+ ```
24
35
 
25
36
  ## Why?
26
37
 
@@ -17,9 +17,11 @@ export function LocalMergeRebase() {
17
17
  async function run() {
18
18
  const state = Store.getState();
19
19
  const actions = state.actions;
20
+ const argv = state.argv;
20
21
  const branch_name = state.branch_name;
21
22
  const commit_range = state.commit_range;
22
23
  const master_branch = state.master_branch;
24
+ invariant(argv, "argv must exist");
23
25
  invariant(branch_name, "branch_name must exist");
24
26
  invariant(commit_range, "commit_range must exist");
25
27
  // always listen for SIGINT event and restore git state
@@ -51,7 +53,11 @@ async function run() {
51
53
  commit_message: React.createElement(Brackets, null, commit.message),
52
54
  } }));
53
55
  }
54
- await cli(`git cherry-pick ${commit.sha}`);
56
+ const git_cherry_pick_command = [`git cherry-pick ${commit.sha}`];
57
+ if (argv.verify === false) {
58
+ git_cherry_pick_command.push("--no-verify");
59
+ }
60
+ await cli(git_cherry_pick_command);
55
61
  if (commit.branch_id && !commit_pr) {
56
62
  if (actions.isDebug()) {
57
63
  actions.output(React.createElement(FormatText, { wrapper: React.createElement(Ink.Text, { color: colors.yellow, wrap: "truncate-end" }), message: "Cleaning up unused group {group}", values: {
@@ -57,7 +57,11 @@ async function run(props) {
57
57
  const selected_url = get_group_url(group);
58
58
  // cherry-pick and amend commits one by one
59
59
  for (const commit of group.commits) {
60
- await cli(`git cherry-pick ${commit.sha}`);
60
+ const git_cherry_pick_command = [`git cherry-pick ${commit.sha}`];
61
+ if (argv.verify === false) {
62
+ git_cherry_pick_command.push("--no-verify");
63
+ }
64
+ await cli(git_cherry_pick_command);
61
65
  if (commit.branch_id !== group.id) {
62
66
  const new_message = await Metadata.write(commit.message, group.id);
63
67
  await cli(`git commit --amend -m "${new_message}"`);
@@ -72,7 +76,7 @@ async function run(props) {
72
76
  if (argv.verify === false) {
73
77
  git_push_command.push("--no-verify");
74
78
  }
75
- await cli(git_push_command.join(" "));
79
+ await cli(git_push_command);
76
80
  if (group.pr) {
77
81
  // ensure base matches pr in github
78
82
  await github.pr_edit({
package/dist/command.js CHANGED
@@ -19,13 +19,13 @@ export async function command() {
19
19
  .option("verify", {
20
20
  type: "boolean",
21
21
  default: true,
22
- description: "Disable the pre-push hook, bypassing it completely",
22
+ description: "Skip git hooks such as pre-commit and pre-push",
23
23
  })
24
24
  .option("verbose", {
25
25
  type: "boolean",
26
26
  alias: ["v"],
27
27
  default: false,
28
- description: "Enable verbose mode with more detailed output for debugging",
28
+ description: "Print more detailed logs for debugging internals",
29
29
  })
30
30
  .option("branch", {
31
31
  type: "string",
package/dist/core/cli.js CHANGED
@@ -1,8 +1,15 @@
1
1
  import * as child from "node:child_process";
2
2
  import { Store } from "../app/Store.js";
3
- export async function cli(command, unsafe_options) {
3
+ export async function cli(unsafe_command, unsafe_options) {
4
4
  const state = Store.getState();
5
5
  const options = Object.assign({}, unsafe_options);
6
+ let command;
7
+ if (Array.isArray(unsafe_command)) {
8
+ command = unsafe_command.join(" ");
9
+ }
10
+ else {
11
+ command = unsafe_command;
12
+ }
6
13
  return new Promise((resolve, reject) => {
7
14
  const childProcess = child.spawn("sh", ["-c", command], options);
8
15
  let stdout = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",