git-stack-cli 0.8.7 → 1.0.2

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 (105) hide show
  1. package/README.md +32 -3
  2. package/dist/cjs/index.cjs +34770 -0
  3. package/package.json +21 -7
  4. package/dist/__fixtures__/metadata.js +0 -666
  5. package/dist/__fixtures__/metadata.json +0 -186
  6. package/dist/app/App copy.js +0 -30
  7. package/dist/app/App.js +0 -42
  8. package/dist/app/ArgCheck.js +0 -21
  9. package/dist/app/AutoUpdate.js +0 -128
  10. package/dist/app/Await.js +0 -45
  11. package/dist/app/Brackets copy.js +0 -10
  12. package/dist/app/Brackets.js +0 -11
  13. package/dist/app/Command.js +0 -7
  14. package/dist/app/Counter.js +0 -19
  15. package/dist/app/Debug.js +0 -33
  16. package/dist/app/DependencyCheck.js +0 -89
  17. package/dist/app/Exit.js +0 -14
  18. package/dist/app/FormatText.js +0 -9
  19. package/dist/app/GatherMetadata copy.js +0 -91
  20. package/dist/app/GatherMetadata.js +0 -100
  21. package/dist/app/GithubApiError.js +0 -50
  22. package/dist/app/InitMetadata.js +0 -14
  23. package/dist/app/Input.js +0 -15
  24. package/dist/app/KeepAlive.js +0 -11
  25. package/dist/app/LocalCommitStatus.js +0 -43
  26. package/dist/app/LocalMergeRebase.js +0 -157
  27. package/dist/app/Main copy.js +0 -200
  28. package/dist/app/ManualRebase copy.js +0 -127
  29. package/dist/app/ManualRebase.js +0 -220
  30. package/dist/app/MultiSelect copy.js +0 -76
  31. package/dist/app/MultiSelect.js +0 -143
  32. package/dist/app/NPMAutoUpdate.js +0 -34
  33. package/dist/app/Output.js +0 -19
  34. package/dist/app/Parens copy.js +0 -9
  35. package/dist/app/Parens.js +0 -10
  36. package/dist/app/PostRebaseStatus copy.js +0 -23
  37. package/dist/app/PostRebaseStatus.js +0 -23
  38. package/dist/app/PreLocalMergeRebase.js +0 -21
  39. package/dist/app/PreSelectCommitRanges copy.js +0 -21
  40. package/dist/app/PreSelectCommitRanges.js +0 -21
  41. package/dist/app/Providers.js +0 -5
  42. package/dist/app/RebaseCheck.js +0 -56
  43. package/dist/app/SelectCommitRange.js +0 -1
  44. package/dist/app/SelectCommitRanges.js +0 -207
  45. package/dist/app/Status copy.js +0 -46
  46. package/dist/app/Status.js +0 -61
  47. package/dist/app/StatusTable.js +0 -115
  48. package/dist/app/Store.js +0 -136
  49. package/dist/app/Table.js +0 -65
  50. package/dist/app/TextInput.js +0 -51
  51. package/dist/app/Url copy.js +0 -6
  52. package/dist/app/Url.js +0 -6
  53. package/dist/app/Waterfall.js +0 -20
  54. package/dist/app/YesNoPrompt copy.js +0 -24
  55. package/dist/app/YesNoPrompt.js +0 -40
  56. package/dist/app/main.js +0 -39
  57. package/dist/cli.js +0 -9
  58. package/dist/command.js +0 -60
  59. package/dist/core/CommitMetadata.js +0 -159
  60. package/dist/core/Metadata copy.js +0 -37
  61. package/dist/core/Metadata.js +0 -36
  62. package/dist/core/Metadata.test.js +0 -34
  63. package/dist/core/StackSummaryTable.js +0 -86
  64. package/dist/core/StackSummaryTable.test.js +0 -134
  65. package/dist/core/StackTable.js +0 -38
  66. package/dist/core/SummaryTable.js +0 -38
  67. package/dist/core/ZustandStore.js +0 -23
  68. package/dist/core/assertNever.js +0 -4
  69. package/dist/core/cache.js +0 -39
  70. package/dist/core/capitalize.js +0 -5
  71. package/dist/core/chalk.js +0 -83
  72. package/dist/core/clamp.js +0 -6
  73. package/dist/core/cli copy.js +0 -44
  74. package/dist/core/cli.js +0 -86
  75. package/dist/core/color.js +0 -83
  76. package/dist/core/colors.js +0 -15
  77. package/dist/core/date.js +0 -18
  78. package/dist/core/dependency_check.js +0 -27
  79. package/dist/core/env.js +0 -4
  80. package/dist/core/exit.js +0 -4
  81. package/dist/core/fetch_json.js +0 -24
  82. package/dist/core/get_commit_metadata.js +0 -61
  83. package/dist/core/github.js +0 -118
  84. package/dist/core/id.js +0 -61
  85. package/dist/core/invariant copy.js +0 -5
  86. package/dist/core/invariant.js +0 -5
  87. package/dist/core/isFiniteValue.js +0 -3
  88. package/dist/core/is_command_available.js +0 -15
  89. package/dist/core/is_dev.js +0 -1
  90. package/dist/core/is_finite_value.js +0 -3
  91. package/dist/core/json.js +0 -35
  92. package/dist/core/match_group.js +0 -9
  93. package/dist/core/readJson.js +0 -3
  94. package/dist/core/read_json.js +0 -12
  95. package/dist/core/safe_quote.js +0 -9
  96. package/dist/core/semver_compare.js +0 -26
  97. package/dist/core/serialize_json.js +0 -17
  98. package/dist/core/short_id.js +0 -60
  99. package/dist/core/sleep copy.js +0 -3
  100. package/dist/core/sleep.js +0 -3
  101. package/dist/core/wrap_index.js +0 -10
  102. package/dist/index.js +0 -13
  103. package/dist/main copy.js +0 -266
  104. package/dist/main.backup.js +0 -266
  105. package/dist/main.js +0 -265
@@ -1,61 +0,0 @@
1
- import * as React from "react";
2
- import * as Ink from "ink";
3
- import { colors } from "../core/colors.js";
4
- import { invariant } from "../core/invariant.js";
5
- import { Await } from "./Await.js";
6
- import { StatusTable } from "./StatusTable.js";
7
- import { Store } from "./Store.js";
8
- export function Status() {
9
- const argv = Store.useState((state) => state.argv);
10
- invariant(argv, "argv must exist");
11
- return React.createElement(Await, { fallback: null, function: () => run({ argv }) });
12
- }
13
- async function run(args) {
14
- const actions = Store.getState().actions;
15
- const commit_range = Store.getState().commit_range;
16
- invariant(commit_range, "commit_range must exist");
17
- actions.output(React.createElement(StatusTable, null));
18
- let needs_rebase = false;
19
- let needs_update = false;
20
- for (const group of commit_range.group_list) {
21
- if (group.dirty) {
22
- needs_update = true;
23
- }
24
- if (group.pr?.state === "MERGED") {
25
- needs_rebase = true;
26
- }
27
- }
28
- for (let i = 0; i < commit_range.commit_list.length; i++) {
29
- const commit = commit_range.commit_list[i];
30
- const commit_pr = commit_range.pr_lookup[commit.branch_id || ""];
31
- if (commit.branch_id && !commit_pr) {
32
- needs_rebase = true;
33
- }
34
- }
35
- if (args.argv.check) {
36
- actions.exit(0);
37
- }
38
- else if (needs_rebase) {
39
- Store.setState((state) => {
40
- state.step = "pre-local-merge-rebase";
41
- });
42
- }
43
- else if (needs_update) {
44
- Store.setState((state) => {
45
- state.step = "pre-select-commit-ranges";
46
- });
47
- }
48
- else if (args.argv.force) {
49
- Store.setState((state) => {
50
- state.step = "select-commit-ranges";
51
- });
52
- }
53
- else {
54
- actions.output(React.createElement(Ink.Text, null, "\u2705 Everything up to date."));
55
- actions.output(React.createElement(Ink.Text, { color: colors.gray },
56
- React.createElement(Ink.Text, null, "Run with"),
57
- React.createElement(Ink.Text, { bold: true, color: colors.yellow }, ` --force `),
58
- React.createElement(Ink.Text, null, "to force update all pull requests.")));
59
- actions.exit(0);
60
- }
61
- }
@@ -1,115 +0,0 @@
1
- import * as React from "react";
2
- import * as Ink from "ink";
3
- import { assertNever } from "../core/assertNever.js";
4
- import { colors } from "../core/colors.js";
5
- import { invariant } from "../core/invariant.js";
6
- import { Store } from "./Store.js";
7
- import { Table } from "./Table.js";
8
- import { Url } from "./Url.js";
9
- export function StatusTable() {
10
- const commit_range = Store.useState((state) => state.commit_range);
11
- invariant(commit_range, "commit_range must exist");
12
- const row_list = [];
13
- for (const group of commit_range.group_list) {
14
- const row = {
15
- count: "",
16
- status: "NEW",
17
- title: "",
18
- url: "",
19
- };
20
- if (group.id === commit_range.UNASSIGNED) {
21
- row.status = "NEW";
22
- row.title = "Unassigned";
23
- row.count = `0/${group.commits.length}`;
24
- row.url = "";
25
- }
26
- else {
27
- if (group.dirty) {
28
- row.status = "OUTDATED";
29
- }
30
- else {
31
- row.status = "SYNCED";
32
- }
33
- if (group.pr) {
34
- if (group.pr.state === "MERGED") {
35
- row.status = "MERGED";
36
- }
37
- row.title = group.pr.title;
38
- row.count = `${group.pr.commits.length}/${group.commits.length}`;
39
- row.url = group.pr.url;
40
- }
41
- else {
42
- row.title = group.title || group.id;
43
- row.count = `0/${group.commits.length}`;
44
- }
45
- }
46
- row_list.push(row);
47
- }
48
- return (React.createElement(Table, { data: row_list, fillColumn: "title", maxWidth: {
49
- status: (v) => v + 2,
50
- }, columnGap: 3, columns: {
51
- status: StatusColumn,
52
- count: CountColumn,
53
- title: TitleColumn,
54
- url: UrlColumn,
55
- } }));
56
- }
57
- function StatusColumn(props) {
58
- const value = props.row[props.column];
59
- return (React.createElement(Ink.Text, { color: get_status_color(props.row), bold: get_status_bold(props.row) },
60
- get_status_icon(props.row),
61
- " ",
62
- value));
63
- }
64
- function CountColumn(props) {
65
- const value = props.row[props.column];
66
- return React.createElement(Ink.Text, { dimColor: true }, value);
67
- }
68
- function TitleColumn(props) {
69
- const value = props.row[props.column];
70
- return React.createElement(Ink.Text, { wrap: "truncate-end" }, value);
71
- }
72
- function UrlColumn(props) {
73
- const value = props.row[props.column];
74
- return React.createElement(Url, { dimColor: true }, value);
75
- }
76
- function get_status_icon(row) {
77
- switch (row.status) {
78
- case "NEW":
79
- return "⭑";
80
- case "OUTDATED":
81
- return "!";
82
- case "MERGED":
83
- return "↗";
84
- case "SYNCED":
85
- return "✔";
86
- default:
87
- assertNever(row.status);
88
- return "?";
89
- // unicode question mark in box
90
- }
91
- }
92
- function get_status_color(row) {
93
- switch (row.status) {
94
- case "NEW":
95
- return colors.yellow;
96
- case "OUTDATED":
97
- return colors.red;
98
- case "MERGED":
99
- return colors.purple;
100
- case "SYNCED":
101
- return colors.green;
102
- default:
103
- assertNever(row.status);
104
- return colors.gray;
105
- }
106
- }
107
- function get_status_bold(row) {
108
- switch (row.status) {
109
- case "NEW":
110
- case "OUTDATED":
111
- return true;
112
- default:
113
- return false;
114
- }
115
- }
package/dist/app/Store.js DELETED
@@ -1,136 +0,0 @@
1
- import * as React from "react";
2
- import * as Ink from "ink";
3
- import { createStore, useStore } from "zustand";
4
- import { immer } from "zustand/middleware/immer";
5
- import { colors } from "../core/colors.js";
6
- import { Exit } from "./Exit.js";
7
- const BaseStore = createStore()(immer((set, get) => ({
8
- argv: null,
9
- ink: null,
10
- cwd: null,
11
- username: null,
12
- repo_path: null,
13
- repo_root: null,
14
- master_branch: "master",
15
- head: null,
16
- merge_base: null,
17
- branch_name: null,
18
- commit_range: null,
19
- commit_map: null,
20
- step: "loading",
21
- output: [],
22
- pending_output: {},
23
- pr: {},
24
- actions: {
25
- exit(code, clear = true) {
26
- set((state) => {
27
- const node = React.createElement(Exit, { clear: clear, code: code });
28
- state.mutate.output(state, { node });
29
- });
30
- },
31
- clear() {
32
- get().ink?.clear();
33
- },
34
- unmount() {
35
- get().ink?.unmount();
36
- },
37
- newline() {
38
- set((state) => {
39
- const node = "‎";
40
- state.mutate.output(state, { node });
41
- });
42
- },
43
- json(value) {
44
- set((state) => {
45
- const node = JSON.stringify(value, null, 2);
46
- state.mutate.output(state, { node });
47
- });
48
- },
49
- error(message) {
50
- set((state) => {
51
- const node = React.createElement(Ink.Text, { color: colors.red }, message);
52
- state.mutate.output(state, { node });
53
- });
54
- },
55
- output(node) {
56
- set((state) => {
57
- state.mutate.output(state, { node });
58
- });
59
- },
60
- debug(node, id) {
61
- if (get().actions.isDebug()) {
62
- const debug = true;
63
- set((state) => {
64
- if (id) {
65
- state.mutate.pending_output(state, { id, node, debug });
66
- }
67
- else {
68
- state.mutate.output(state, { node, debug });
69
- }
70
- });
71
- }
72
- },
73
- isDebug() {
74
- const state = get();
75
- return state.select.debug(state);
76
- },
77
- reset_pr() {
78
- set((state) => {
79
- state.pr = {};
80
- });
81
- },
82
- set(setter) {
83
- set((state) => {
84
- setter(state);
85
- });
86
- },
87
- },
88
- mutate: {
89
- output(state, args) {
90
- switch (typeof args.node) {
91
- case "boolean":
92
- case "number":
93
- case "string":
94
- state.output.push(React.createElement(Ink.Text, { dimColor: args.debug }, String(args.node)));
95
- return;
96
- }
97
- state.output.push(args.node);
98
- },
99
- pending_output(state, args) {
100
- const { id } = args;
101
- if (!id) {
102
- return;
103
- }
104
- if (!state.pending_output[id]) {
105
- state.pending_output[id] = [];
106
- }
107
- switch (typeof args.node) {
108
- case "boolean":
109
- case "number":
110
- case "string": {
111
- state.pending_output[id].push(React.createElement(Ink.Text, { dimColor: args.debug }, String(args.node)));
112
- return;
113
- }
114
- }
115
- state.pending_output[id].push(args.node);
116
- },
117
- end_pending_output(state, id) {
118
- delete state.pending_output[id];
119
- },
120
- },
121
- select: {
122
- debug(state) {
123
- return state.argv?.verbose || false;
124
- },
125
- },
126
- })));
127
- function useState(selector) {
128
- return useStore(BaseStore, selector);
129
- }
130
- function useActions() {
131
- return useState((state) => state.actions);
132
- }
133
- const getState = BaseStore.getState;
134
- const setState = BaseStore.setState;
135
- const subscribe = BaseStore.subscribe;
136
- export const Store = { useActions, useState, getState, setState, subscribe };
package/dist/app/Table.js DELETED
@@ -1,65 +0,0 @@
1
- import * as React from "react";
2
- import * as Ink from "ink";
3
- import { is_finite_value } from "../core/is_finite_value.js";
4
- export function Table(props) {
5
- if (!props.data.length) {
6
- return (React.createElement(Container, null,
7
- React.createElement(Ink.Text, { dimColor: true }, "No data found.")));
8
- }
9
- const RowColumnList = Object.keys(props.columns);
10
- // walk data and discover max width for each column
11
- const max_col_width = {};
12
- for (const col of RowColumnList) {
13
- max_col_width[col] = 0;
14
- }
15
- for (const row of props.data) {
16
- for (const col of RowColumnList) {
17
- const row_col = row[col];
18
- max_col_width[col] = Math.max(String(row_col).length, max_col_width[col]);
19
- }
20
- }
21
- for (const col of RowColumnList) {
22
- const maxWidth = props.maxWidth?.[col];
23
- if (maxWidth) {
24
- max_col_width[col] = maxWidth(max_col_width[col]);
25
- }
26
- }
27
- const { stdout } = Ink.useStdout();
28
- const available_width = stdout.columns;
29
- const columnGap = is_finite_value(props.columnGap) ? props.columnGap : 2;
30
- // single character breathing room to prevent url including next line via overflow
31
- const breathing_room = 1;
32
- if (props.fillColumn) {
33
- let remaining_space = available_width;
34
- for (const col of RowColumnList) {
35
- // skip fill column from calculation
36
- if (props.fillColumn === col) {
37
- continue;
38
- }
39
- remaining_space -= max_col_width[col];
40
- }
41
- // gap * col count
42
- remaining_space -= columnGap * (RowColumnList.length - 1);
43
- // remove some extra space
44
- remaining_space -= breathing_room;
45
- if (props.fillColumn) {
46
- max_col_width[props.fillColumn] = Math.min(max_col_width[props.fillColumn], remaining_space);
47
- }
48
- }
49
- // console.debug({ available_width, max_col_width });
50
- return (React.createElement(Container, null, props.data.map((row, i) => {
51
- return (React.createElement(Ink.Box, { key: i,
52
- // borderStyle="round"
53
- flexDirection: "row", columnGap: columnGap, width: available_width }, RowColumnList.map((column) => {
54
- const ColumnComponent = props.columns[column];
55
- return (React.createElement(Ink.Box, { key: String(column), width: max_col_width[column] },
56
- React.createElement(ColumnComponent, { row: row, column: column })));
57
- })));
58
- })));
59
- }
60
- function Container(props) {
61
- return (React.createElement(Ink.Box, { flexDirection: "column" },
62
- React.createElement(Ink.Box, { height: 1 }),
63
- props.children,
64
- React.createElement(Ink.Box, { height: 1 })));
65
- }
@@ -1,51 +0,0 @@
1
- import * as React from "react";
2
- import * as Ink from "ink";
3
- import { colors } from "../core/colors.js";
4
- export function TextInput(props) {
5
- const [value, set_value] = React.useState(get_value(props));
6
- React.useEffect(function sync_value_prop() {
7
- set_value(get_value(props));
8
- }, [props.value]);
9
- const [caret_visible, set_caret_visible] = React.useState(false);
10
- React.useEffect(function blink_caret() {
11
- const interval_ms = 500;
12
- let timeoutId = setTimeout(tick, interval_ms);
13
- function tick() {
14
- set_caret_visible((visible) => !visible);
15
- timeoutId = setTimeout(tick, interval_ms);
16
- }
17
- return function cleanup() {
18
- clearTimeout(timeoutId);
19
- };
20
- }, []);
21
- Ink.useInput((input, key) => {
22
- let next_value = value;
23
- // console.debug("[useInput]", { input, key });
24
- if (key.backspace || key.delete) {
25
- next_value = value.slice(0, -1);
26
- }
27
- else if (key.return) {
28
- props.onSubmit?.(next_value);
29
- }
30
- else {
31
- switch (input) {
32
- case "\r":
33
- if (props.multiline) {
34
- next_value = `${value}\n`;
35
- }
36
- break;
37
- default:
38
- next_value = `${value}${input}`;
39
- }
40
- }
41
- set_value(next_value);
42
- props.onChange?.(next_value);
43
- });
44
- // console.debug("[TextInput]", { value });
45
- return (React.createElement(Ink.Box, { borderStyle: "single", minHeight: 1, borderColor: colors.yellow, borderDimColor: true },
46
- React.createElement(Ink.Text, null, value || ""),
47
- React.createElement(Ink.Text, { color: colors.yellow, dimColor: true, inverse: caret_visible }, " ")));
48
- }
49
- function get_value(props) {
50
- return props.value || "";
51
- }
@@ -1,6 +0,0 @@
1
- import * as React from "react";
2
- import * as Ink from "ink";
3
- export function Url(props) {
4
- const text_color = "#38bdf8";
5
- return React.createElement(Ink.Text, { color: text_color }, props.children);
6
- }
package/dist/app/Url.js DELETED
@@ -1,6 +0,0 @@
1
- import * as React from "react";
2
- import * as Ink from "ink";
3
- import { colors } from "../core/colors.js";
4
- export function Url(props) {
5
- return (React.createElement(Ink.Text, { bold: true, color: colors.blue, ...props }, props.children));
6
- }
@@ -1,20 +0,0 @@
1
- import * as React from "react";
2
- import * as Ink from "ink";
3
- import { sleep } from "../core/sleep.js";
4
- import { Await } from "./Await.js";
5
- import { Store } from "./Store.js";
6
- export function Waterfall() {
7
- return (React.createElement(Await, { fallback: React.createElement(Ink.Text, null, "Loading..."), function: async () => {
8
- await sleep(3 * 1000);
9
- Store.getState().actions.output(React.createElement(Ink.Text, null, "apple"));
10
- } },
11
- React.createElement(Await, { fallback: React.createElement(Ink.Text, null, "Loading..."), function: async () => {
12
- await sleep(3 * 1000);
13
- Store.getState().actions.output(React.createElement(Ink.Text, null, "banana"));
14
- } },
15
- React.createElement(Await, { fallback: React.createElement(Ink.Text, null, "Loading..."), function: async () => {
16
- await sleep(3 * 1000);
17
- Store.getState().actions.output(React.createElement(Ink.Text, null, "orange"));
18
- } },
19
- React.createElement(Ink.Text, null, "Waterfall")))));
20
- }
@@ -1,24 +0,0 @@
1
- import * as React from "react";
2
- import * as Ink from "ink";
3
- export function YesNoPrompt(props) {
4
- Ink.useInput((input) => {
5
- const inputLower = input.toLowerCase();
6
- switch (inputLower) {
7
- case "n":
8
- return props.onNo();
9
- case "y":
10
- return props.onYes();
11
- }
12
- });
13
- return (React.createElement(Ink.Box, { flexDirection: "column" },
14
- React.createElement(Ink.Box, null,
15
- React.createElement(Ink.Text, { color: "yellow" }, props.message),
16
- React.createElement(Ink.Text, null, " "),
17
- React.createElement(Ink.Text, { color: "#06b6d4" },
18
- "(",
19
- React.createElement(Ink.Text, { color: "gray" },
20
- React.createElement(Ink.Text, { color: "#22c55e", dimColor: true }, "Y"),
21
- "/",
22
- React.createElement(Ink.Text, { color: "#ef4444", dimColor: true }, "n")),
23
- ")"))));
24
- }
@@ -1,40 +0,0 @@
1
- import * as React from "react";
2
- import * as Ink from "ink";
3
- import { colors } from "../core/colors.js";
4
- import { Parens } from "./Parens.js";
5
- export function YesNoPrompt(props) {
6
- const [answer, set_answer] = React.useState("");
7
- Ink.useInput((input) => {
8
- const inputLower = input.toLowerCase();
9
- set_answer(inputLower);
10
- switch (inputLower) {
11
- case "n":
12
- return props.onNo();
13
- case "y":
14
- return props.onYes();
15
- }
16
- });
17
- // prettier-ignore
18
- const y = React.createElement(Ink.Text, { bold: true, color: colors.green }, "Y");
19
- const n = React.createElement(Ink.Text, { color: colors.red }, "n");
20
- let choices;
21
- switch (answer) {
22
- case "y":
23
- choices = y;
24
- break;
25
- case "n":
26
- choices = n;
27
- break;
28
- default:
29
- choices = (React.createElement(React.Fragment, null,
30
- y,
31
- React.createElement(Ink.Text, null, "/"),
32
- n));
33
- }
34
- return (React.createElement(Ink.Box, { flexDirection: "column" },
35
- React.createElement(Ink.Box, null,
36
- typeof props.message === "object" ? (props.message) : (React.createElement(Ink.Text, { color: colors.yellow }, props.message)),
37
- React.createElement(Ink.Text, null, " "),
38
- React.createElement(Parens, null,
39
- React.createElement(Ink.Text, { color: colors.gray }, choices)))));
40
- }
package/dist/app/main.js DELETED
@@ -1,39 +0,0 @@
1
- import * as React from "react";
2
- import { assertNever } from "../core/assertNever.js";
3
- import { GithubApiError } from "./GithubApiError.js";
4
- import { LocalMergeRebase } from "./LocalMergeRebase.js";
5
- import { ManualRebase } from "./ManualRebase.js";
6
- import { PostRebaseStatus } from "./PostRebaseStatus.js";
7
- import { PreLocalMergeRebase } from "./PreLocalMergeRebase.js";
8
- import { PreSelectCommitRanges } from "./PreSelectCommitRanges.js";
9
- import { SelectCommitRanges } from "./SelectCommitRanges.js";
10
- import { Status } from "./Status.js";
11
- import { Store } from "./Store.js";
12
- export function Main() {
13
- const step = Store.useState((state) => state.step);
14
- switch (step) {
15
- case "github-api-error":
16
- return React.createElement(GithubApiError, null);
17
- case "loading":
18
- return null;
19
- case "status":
20
- return React.createElement(Status, null);
21
- case "local-merge-rebase":
22
- return React.createElement(LocalMergeRebase, null);
23
- case "pre-local-merge-rebase":
24
- return React.createElement(PreLocalMergeRebase, null);
25
- case "pre-select-commit-ranges":
26
- return React.createElement(PreSelectCommitRanges, null);
27
- case "select-commit-ranges":
28
- return React.createElement(SelectCommitRanges, null);
29
- case "manual-rebase":
30
- return React.createElement(ManualRebase, null);
31
- case "manual-rebase-no-sync":
32
- return React.createElement(ManualRebase, { skipSync: true });
33
- case "post-rebase-status":
34
- return React.createElement(PostRebaseStatus, null);
35
- default:
36
- assertNever(step);
37
- return null;
38
- }
39
- }
package/dist/cli.js DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import * as React from "react";
3
- import * as Ink from "ink";
4
- import { App } from "./app/App.js";
5
- import { command } from "./command.js";
6
- const argv = await command();
7
- const ink = {};
8
- const app = Ink.render(React.createElement(App, { argv: argv, ink: ink }));
9
- Object.assign(ink, app);
package/dist/command.js DELETED
@@ -1,60 +0,0 @@
1
- import yargs from "yargs";
2
- import { hideBin } from "yargs/helpers";
3
- export async function command() {
4
- // https://yargs.js.org/docs/#api-reference-optionkey-opt
5
- return (yargs(hideBin(process.argv))
6
- .usage("Usage: git stack [options]")
7
- .option("force", {
8
- type: "boolean",
9
- alias: ["f"],
10
- default: false,
11
- description: "Force sync even if no changes are detected",
12
- })
13
- .option("check", {
14
- type: "boolean",
15
- alias: ["c"],
16
- default: false,
17
- description: "Print status table without syncing",
18
- })
19
- .option("verify", {
20
- type: "boolean",
21
- default: true,
22
- description: "Skip git hooks such as pre-commit and pre-push",
23
- })
24
- .option("verbose", {
25
- type: "boolean",
26
- alias: ["v"],
27
- default: false,
28
- description: "Print more detailed logs for debugging internals",
29
- })
30
- .option("update", {
31
- type: "boolean",
32
- alias: ["u"],
33
- default: false,
34
- description: "Check for updates",
35
- })
36
- .option("branch", {
37
- type: "string",
38
- alias: ["b"],
39
- description: `Set the master branch name, defaults to "master" (or "main" if "master" is not found)`,
40
- })
41
- .option("write-state-json", {
42
- hidden: true,
43
- type: "boolean",
44
- default: false,
45
- description: "Write state to local json file for debugging",
46
- })
47
- .option("mock-metadata", {
48
- hidden: true,
49
- type: "boolean",
50
- default: false,
51
- description: "Mock local store metadata for testing",
52
- })
53
- // do not wrap to 80 columns (yargs default)
54
- // .wrap(yargs().terminalWidth()) will fill terminal (maximuize)
55
- .wrap(null)
56
- // disallow unknown options
57
- .strict()
58
- .version()
59
- .help("help").argv);
60
- }