git-stack-cli 1.15.0 → 2.0.0-beta

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.
Files changed (59) hide show
  1. package/README.md +15 -14
  2. package/dist/js/index.js +45709 -0
  3. package/package.json +17 -23
  4. package/scripts/bun-build.ts +109 -0
  5. package/scripts/bun-compile.ts +79 -0
  6. package/scripts/npm-prepublishOnly.ts +1 -1
  7. package/scripts/release-brew.ts +26 -48
  8. package/scripts/release-github.ts +21 -9
  9. package/scripts/release-npm.ts +8 -11
  10. package/src/app/App.tsx +39 -31
  11. package/src/app/AutoUpdate.tsx +9 -24
  12. package/src/app/CherryPickCheck.tsx +1 -2
  13. package/src/app/Debug.tsx +3 -5
  14. package/src/app/DependencyCheck.tsx +6 -6
  15. package/src/app/DetectInitialPR.tsx +2 -8
  16. package/src/app/DirtyCheck.tsx +15 -1
  17. package/src/app/Exit.tsx +1 -5
  18. package/src/app/FormatText.tsx +1 -5
  19. package/src/app/GatherMetadata.tsx +6 -13
  20. package/src/app/GithubApiError.tsx +1 -1
  21. package/src/app/HandleCtrlCSigint.tsx +1 -12
  22. package/src/app/LocalCommitStatus.tsx +1 -3
  23. package/src/app/LogTimestamp.tsx +1 -5
  24. package/src/app/ManualRebase.tsx +4 -8
  25. package/src/app/MultiSelect.tsx +2 -2
  26. package/src/app/PostRebaseStatus.tsx +2 -0
  27. package/src/app/PreManualRebase.tsx +3 -5
  28. package/src/app/RebaseCheck.tsx +1 -2
  29. package/src/app/SelectCommitRanges.tsx +6 -10
  30. package/src/app/Status.tsx +1 -1
  31. package/src/app/StatusTable.tsx +1 -4
  32. package/src/app/Store.tsx +5 -1
  33. package/src/app/SyncGithub.tsx +4 -16
  34. package/src/app/Table.tsx +4 -14
  35. package/src/app/TextInput.tsx +2 -7
  36. package/src/app/VerboseDebugInfo.tsx +1 -5
  37. package/src/app/YesNoPrompt.tsx +42 -31
  38. package/src/command.ts +8 -17
  39. package/src/commands/Fixup.tsx +15 -22
  40. package/src/commands/Log.tsx +3 -7
  41. package/src/commands/Rebase.tsx +6 -8
  42. package/src/components/ErrorBoundary.tsx +79 -0
  43. package/src/components/ExitingGate.tsx +27 -0
  44. package/src/core/CommitMetadata.ts +1 -1
  45. package/src/core/GitReviseTodo.test.ts +3 -3
  46. package/src/core/GitReviseTodo.ts +8 -12
  47. package/src/core/Metadata.test.ts +4 -4
  48. package/src/core/StackSummaryTable.ts +3 -3
  49. package/src/core/chalk.ts +1 -5
  50. package/src/core/cli.ts +2 -2
  51. package/src/core/github.tsx +7 -13
  52. package/src/core/pretty_json.ts +1 -6
  53. package/src/github/gh.auth_status.test.ts +2 -6
  54. package/src/index.tsx +28 -3
  55. package/src/types/global.d.ts +0 -1
  56. package/tsconfig.json +1 -1
  57. package/dist/cjs/index.cjs +0 -38461
  58. package/rollup.config.js +0 -54
  59. package/scripts/build-standalone.ts +0 -73
@@ -24,7 +24,7 @@ export async function pr_list(): Promise<Array<PullRequest>> {
24
24
  invariant(repo_path, "repo_path must exist");
25
25
 
26
26
  const result_pr_list = await gh_json<Array<PullRequest>>(
27
- `pr list --repo ${repo_path} --author ${username} --state open ${JSON_FIELDS}`
27
+ `pr list --repo ${repo_path} --author ${username} --state open ${JSON_FIELDS}`,
28
28
  );
29
29
 
30
30
  if (result_pr_list instanceof Error) {
@@ -42,7 +42,7 @@ export async function pr_list(): Promise<Array<PullRequest>> {
42
42
  <Brackets>{repo_path}</Brackets>
43
43
  <Ink.Text>{" authored by "}</Ink.Text>
44
44
  <Brackets>{username}</Brackets>
45
- </Ink.Text>
45
+ </Ink.Text>,
46
46
  );
47
47
  }
48
48
 
@@ -77,7 +77,7 @@ export async function pr_status(branch: string): Promise<null | PullRequest> {
77
77
  </Ink.Text>
78
78
  <Ink.Text> </Ink.Text>
79
79
  <Ink.Text dimColor>{branch}</Ink.Text>
80
- </Ink.Text>
80
+ </Ink.Text>,
81
81
  );
82
82
  }
83
83
 
@@ -94,13 +94,11 @@ export async function pr_status(branch: string): Promise<null | PullRequest> {
94
94
  </Ink.Text>
95
95
  <Ink.Text> </Ink.Text>
96
96
  <Ink.Text dimColor>{branch}</Ink.Text>
97
- </Ink.Text>
97
+ </Ink.Text>,
98
98
  );
99
99
  }
100
100
 
101
- const pr = await gh_json<PullRequest>(
102
- `pr view ${branch} --repo ${repo_path} ${JSON_FIELDS}`
103
- );
101
+ const pr = await gh_json<PullRequest>(`pr view ${branch} --repo ${repo_path} ${JSON_FIELDS}`);
104
102
 
105
103
  if (pr instanceof Error) {
106
104
  return null;
@@ -190,9 +188,7 @@ export async function pr_draft(args: DraftPullRequestArgs) {
190
188
  // https://docs.github.com/en/graphql/reference/mutations#convertpullrequesttodraft
191
189
  // https://docs.github.com/en/graphql/reference/mutations#markpullrequestreadyforreview
192
190
 
193
- const mutation_name = args.draft
194
- ? "convertPullRequestToDraft"
195
- : "markPullRequestReadyForReview";
191
+ const mutation_name = args.draft ? "convertPullRequestToDraft" : "markPullRequestReadyForReview";
196
192
 
197
193
  let query = `
198
194
  mutation($id: ID!) {
@@ -215,9 +211,7 @@ export async function pr_draft(args: DraftPullRequestArgs) {
215
211
  const cache_pr = state.pr[args.branch];
216
212
  invariant(cache_pr, "cache_pr must exist");
217
213
 
218
- const command_parts = [
219
- `gh api graphql -F id="${cache_pr.id}" -f query='${query}'`,
220
- ];
214
+ const command_parts = [`gh api graphql -F id="${cache_pr.id}" -f query='${query}'`];
221
215
 
222
216
  const command = command_parts.join(" ");
223
217
 
@@ -1,10 +1,5 @@
1
1
  export namespace pretty_json {
2
- export type JSONValue =
3
- | null
4
- | number
5
- | string
6
- | boolean
7
- | { [key: string]: JSONValue };
2
+ export type JSONValue = null | number | string | boolean | { [key: string]: JSONValue };
8
3
  }
9
4
 
10
5
  export function pretty_json<T extends pretty_json.JSONValue>(input: T): string {
@@ -3,17 +3,13 @@ import { test, expect } from "bun:test";
3
3
  import * as gh from "./gh";
4
4
 
5
5
  test("logged in as", () => {
6
- const username = gh.auth_status(
7
- " ✓ Logged in to github.com as magus (keyring)\n"
8
- );
6
+ const username = gh.auth_status(" ✓ Logged in to github.com as magus (keyring)\n");
9
7
 
10
8
  expect(username).toBe("magus");
11
9
  });
12
10
 
13
11
  test("logged in without as", () => {
14
- const username = gh.auth_status(
15
- "✓ Logged in to github.com account xoxohorses (keyring)"
16
- );
12
+ const username = gh.auth_status("✓ Logged in to github.com account xoxohorses (keyring)");
17
13
 
18
14
  expect(username).toBe("xoxohorses");
19
15
  });
package/src/index.tsx CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ /* eslint-disable no-console */
4
+
3
5
  import * as React from "react";
4
6
 
5
7
  import * as Ink from "ink-cjs";
@@ -13,6 +15,24 @@ import { pretty_json } from "~/core/pretty_json";
13
15
  try {
14
16
  const argv = await command();
15
17
 
18
+ // required to get bun working with ink
19
+ // https://github.com/oven-sh/bun/issues/6862#issuecomment-2429444852
20
+ process.stdin.resume();
21
+
22
+ process.on("uncaughtException", (error) => {
23
+ console.error("🚨 uncaughtException");
24
+ console.error(error);
25
+ maybe_verbose_help();
26
+ process.exit(237);
27
+ });
28
+
29
+ process.on("unhandledRejection", (reason, _promise) => {
30
+ console.error("🚨 unhandledRejection");
31
+ console.error(reason);
32
+ maybe_verbose_help();
33
+ process.exit(238);
34
+ });
35
+
16
36
  const ink = Ink.render(<App />, {
17
37
  // If true, each update will be rendered as a separate output, without replacing the previous one.
18
38
  // debug: true,
@@ -32,12 +52,17 @@ import { pretty_json } from "~/core/pretty_json";
32
52
  Store.getState().actions.debug(pretty_json(argv as any));
33
53
 
34
54
  await ink.waitUntilExit();
55
+
56
+ function maybe_verbose_help() {
57
+ if (!argv.verbose) {
58
+ console.error();
59
+ console.error("Try again with `--verbose` to see more information.");
60
+ }
61
+ }
35
62
  } catch (err) {
36
- // eslint-disable-next-line no-console
37
63
  console.error(err);
38
- process.exit(235);
64
+ process.exit(236);
39
65
  }
40
66
  })().catch((err) => {
41
- // eslint-disable-next-line no-console
42
67
  console.error(err);
43
68
  });
@@ -3,7 +3,6 @@ declare namespace NodeJS {
3
3
  PATH: string;
4
4
  DEV?: "true" | "false";
5
5
  CLI_VERSION?: string;
6
- GIT_STACK_STANDALONE?: "true" | "false";
7
6
  GIT_SEQUENCE_EDITOR_SCRIPT?: string;
8
7
  GIT_STACK_BRANCH_PREFIX?: string;
9
8
  }
package/tsconfig.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "exclude": ["node_modules"],
4
4
 
5
5
  "compilerOptions": {
6
- // prevent outputting any files, rollup will handle that
6
+ // prevent outputting any files, bundler will handle that
7
7
  "noEmit": true,
8
8
 
9
9
  "module": "es2022",