git-stack-cli 2.2.6 → 2.2.8

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
@@ -37974,16 +37974,6 @@ function CheckGitRevise(props) {
37974
37974
  var React25 = __toESM(require_react(), 1);
37975
37975
  var import_cloneDeep = __toESM(require_cloneDeep(), 1);
37976
37976
 
37977
- // src/core/safe_quote.ts
37978
- function safe_quote(value) {
37979
- let result = value;
37980
- result = result.replace(RE2.all_double_quote, "\\\"");
37981
- return result;
37982
- }
37983
- var RE2 = {
37984
- all_double_quote: /"/g
37985
- };
37986
-
37987
37977
  // src/core/Metadata.ts
37988
37978
  function write(message, values) {
37989
37979
  let result = message;
@@ -37994,17 +37984,16 @@ function write(message, values) {
37994
37984
  }
37995
37985
  let new_message = line_list.join(`
37996
37986
  `);
37997
- new_message = safe_quote(new_message);
37998
37987
  return new_message;
37999
37988
  }
38000
37989
  function read(message) {
38001
37990
  const values = { id: null, title: null };
38002
- const match_id = message.match(RE3.stack_id);
37991
+ const match_id = message.match(RE2.stack_id);
38003
37992
  if (match_id?.groups) {
38004
37993
  values.id = match_id.groups["id"];
38005
37994
  invariant(values.id, "id must exist");
38006
37995
  }
38007
- const match_title = message.match(RE3.group_title);
37996
+ const match_title = message.match(RE2.group_title);
38008
37997
  if (match_title?.groups) {
38009
37998
  values.title = match_title.groups["title"];
38010
37999
  }
@@ -38012,8 +38001,8 @@ function read(message) {
38012
38001
  }
38013
38002
  function remove(message) {
38014
38003
  let result = message;
38015
- result = result.replace(new RegExp(RE3.stack_id, "gmi"), "");
38016
- result = result.replace(new RegExp(RE3.group_title, "gmi"), "");
38004
+ result = result.replace(new RegExp(RE2.stack_id, "gmi"), "");
38005
+ result = result.replace(new RegExp(RE2.group_title, "gmi"), "");
38017
38006
  result = result.trimEnd();
38018
38007
  return result;
38019
38008
  }
@@ -38025,7 +38014,7 @@ var TEMPLATE = {
38025
38014
  return `git-stack-title: ${title}`;
38026
38015
  }
38027
38016
  };
38028
- var RE3 = {
38017
+ var RE2 = {
38029
38018
  stack_id: new RegExp(`${TEMPLATE.stack_id("(?<id>[^\\s]+)")}`, "i"),
38030
38019
  group_title: new RegExp(TEMPLATE.group_title("(?<title>[^\\n^\\r]+)"), "i")
38031
38020
  };
@@ -38046,6 +38035,20 @@ async function get_tmp_dir() {
38046
38035
  return dir;
38047
38036
  }
38048
38037
 
38038
+ // src/core/safe_quote.ts
38039
+ function safe_quote(value) {
38040
+ let result = value;
38041
+ result = result.replace(RE3.all_backslash, "\\\\");
38042
+ result = result.replace(RE3.all_double_quote, "\\\"");
38043
+ result = result.replace(RE3.all_backtick, "\\`");
38044
+ return result;
38045
+ }
38046
+ var RE3 = {
38047
+ all_double_quote: /"/g,
38048
+ all_backtick: /`/g,
38049
+ all_backslash: /\\/g
38050
+ };
38051
+
38049
38052
  // src/core/github.tsx
38050
38053
  async function pr_list() {
38051
38054
  const state = Store.getState();
@@ -38391,7 +38394,6 @@ GitReviseTodo.todo = function todo(args) {
38391
38394
  const metadata = { id, title };
38392
38395
  const unsafe_message_with_id = write(commit2.full_message, metadata);
38393
38396
  let message_with_id = unsafe_message_with_id;
38394
- message_with_id = message_with_id.replace(/[^\\]"/g, "\\\"");
38395
38397
  const sha = commit2.sha.slice(0, 12);
38396
38398
  const entry_lines = [`++ pick ${sha}`, message_with_id];
38397
38399
  const entry = entry_lines.join(`
@@ -38404,7 +38406,6 @@ GitReviseTodo.todo = function todo(args) {
38404
38406
  return todo2;
38405
38407
  };
38406
38408
  GitReviseTodo.execute = async function grt_execute(args) {
38407
- const tmp_git_sequence_editor_path = path7.join(await get_tmp_dir(), "git-sequence-editor.sh");
38408
38409
  const GIT_SEQUENCE_EDITOR_SCRIPT = `#!/bin/sh
38409
38410
 
38410
38411
  # Example
@@ -38424,30 +38425,44 @@ echo "CLI=$0 $*"
38424
38425
  echo "PWD=$(pwd)"
38425
38426
 
38426
38427
  # ensure \\\`GIT_REVISE_TODO\\\` is not empty
38427
- if [ -z "$GIT_REVISE_TODO" ]; then
38428
- echo "\uD83D\uDEA8 GIT_REVISE_TODO environment variable is empty" >&2
38428
+ if [ ! -f "$GIT_REVISE_TODO" ]; then
38429
+ echo "\uD83D\uDEA8 GIT_REVISE_TODO file must exist" >&2
38429
38430
  exit 1
38430
38431
  fi
38431
38432
 
38432
38433
  # first argument into git sequence editor is git-revise-todo file
38433
38434
  git_revise_todo_path="$1"
38434
38435
 
38435
- # debug print git-revise-todo file passed into command
38436
- echo "$git_revise_todo_path"
38436
+ # print content of git-revise-todo file passed into command
38437
+ echo
38438
+ echo "BEFORE git_revise_todo_path=$git_revise_todo_path"
38437
38439
  echo "----- START -----"
38438
38440
  cat "$git_revise_todo_path"
38441
+ echo
38439
38442
  echo "------ END ------"
38443
+ echo
38444
+
38445
+ # copy content of file at \\\`GIT_REVISE_TODO\\\` env variable to \\\`git_revise_todo_path\\\`
38446
+ cp "$GIT_REVISE_TODO" "$git_revise_todo_path"
38440
38447
 
38441
- # write content of \\\`GIT_REVISE_TODO\\\` env variable to \\\`git_revise_todo_path\\\`
38442
- echo "$GIT_REVISE_TODO" > "$git_revise_todo_path"
38448
+ # print content of git-revise-todo file after copy above
38449
+ echo
38450
+ echo "AFTER git_revise_todo_path=$git_revise_todo_path"
38451
+ echo "----- START -----"
38452
+ cat "$git_revise_todo_path"
38453
+ echo
38454
+ echo "------ END ------"
38455
+ echo
38443
38456
  `;
38444
38457
  invariant(GIT_SEQUENCE_EDITOR_SCRIPT, "GIT_SEQUENCE_EDITOR_SCRIPT must exist");
38458
+ const tmp_git_sequence_editor_path = path7.join(await get_tmp_dir(), "git-sequence-editor.sh");
38445
38459
  await fs10.writeFile(tmp_git_sequence_editor_path, GIT_SEQUENCE_EDITOR_SCRIPT);
38446
38460
  await fs10.chmod(tmp_git_sequence_editor_path, "755");
38447
- const git_revise_todo = GitReviseTodo(args);
38461
+ const tmp_path_git_revise_todo = path7.join(await get_tmp_dir(), "git-revise-todo.txt");
38462
+ await fs10.writeFile(tmp_path_git_revise_todo, GitReviseTodo(args));
38448
38463
  const command = [
38449
38464
  `GIT_EDITOR="${tmp_git_sequence_editor_path}"`,
38450
- `GIT_REVISE_TODO="${git_revise_todo}"`,
38465
+ `GIT_REVISE_TODO="${tmp_path_git_revise_todo}"`,
38451
38466
  `git`,
38452
38467
  `revise --edit -i ${args.rebase_merge_base}`
38453
38468
  ];
@@ -38881,76 +38896,325 @@ async function run3() {
38881
38896
  var React45 = __toESM(require_react(), 1);
38882
38897
 
38883
38898
  // src/app/LocalMergeRebase.tsx
38884
- var React32 = __toESM(require_react(), 1);
38899
+ var React35 = __toESM(require_react(), 1);
38885
38900
 
38886
38901
  // src/commands/Rebase.tsx
38887
- var React31 = __toESM(require_react(), 1);
38902
+ var React34 = __toESM(require_react(), 1);
38888
38903
  import fs11 from "node:fs";
38889
38904
 
38890
- // src/core/short_id.ts
38891
- import crypto2 from "node:crypto";
38892
- function short_id() {
38893
- const timestamp = Date.now();
38894
- const js_max_bits = 53;
38895
- const timestamp_bits = Math.floor(Math.log2(timestamp)) + 1;
38896
- const padding_bits = js_max_bits - timestamp_bits;
38897
- const random = crypto2.randomInt(0, Math.pow(2, padding_bits));
38898
- const combined = interleave_bits(timestamp, random);
38899
- return encode(combined);
38905
+ // src/app/Status.tsx
38906
+ var React33 = __toESM(require_react(), 1);
38907
+
38908
+ // src/app/StatusTable.tsx
38909
+ var React32 = __toESM(require_react(), 1);
38910
+
38911
+ // src/app/Table.tsx
38912
+ var React31 = __toESM(require_react(), 1);
38913
+ function Table(props) {
38914
+ if (!props.data.length) {
38915
+ return /* @__PURE__ */ React31.createElement(Container, null, /* @__PURE__ */ React31.createElement(Text, {
38916
+ dimColor: true
38917
+ }, "No data found."));
38918
+ }
38919
+ const RowColumnList = Object.keys(props.columns);
38920
+ const max_col_width = {};
38921
+ for (const col of RowColumnList) {
38922
+ max_col_width[col] = 0;
38923
+ }
38924
+ for (const row of props.data) {
38925
+ for (const col of RowColumnList) {
38926
+ const row_col = row[col];
38927
+ max_col_width[col] = Math.max(String(row_col).length, max_col_width[col]);
38928
+ }
38929
+ }
38930
+ for (const col of RowColumnList) {
38931
+ const maxWidth = props.maxWidth?.[col];
38932
+ if (maxWidth) {
38933
+ max_col_width[col] = maxWidth(max_col_width[col]);
38934
+ }
38935
+ }
38936
+ const { stdout } = use_stdout_default();
38937
+ const available_width = stdout.columns;
38938
+ const columnGap = is_finite_value(props.columnGap) ? props.columnGap : 2;
38939
+ const breathing_room = 1;
38940
+ if (props.fillColumn) {
38941
+ let remaining_space = available_width;
38942
+ for (const col of RowColumnList) {
38943
+ if (props.fillColumn === col) {
38944
+ continue;
38945
+ }
38946
+ remaining_space -= max_col_width[col];
38947
+ }
38948
+ remaining_space -= columnGap * (RowColumnList.length - 1);
38949
+ remaining_space -= breathing_room;
38950
+ if (props.fillColumn) {
38951
+ max_col_width[props.fillColumn] = Math.min(max_col_width[props.fillColumn], remaining_space);
38952
+ }
38953
+ }
38954
+ return /* @__PURE__ */ React31.createElement(Container, null, props.data.map((row, i2) => {
38955
+ return /* @__PURE__ */ React31.createElement(Box_default, {
38956
+ key: i2,
38957
+ flexDirection: "row",
38958
+ columnGap,
38959
+ width: available_width
38960
+ }, RowColumnList.map((column) => {
38961
+ const ColumnComponent = props.columns[column];
38962
+ return /* @__PURE__ */ React31.createElement(Box_default, {
38963
+ key: String(column),
38964
+ width: max_col_width[column]
38965
+ }, /* @__PURE__ */ React31.createElement(ColumnComponent, {
38966
+ row,
38967
+ column
38968
+ }));
38969
+ }));
38970
+ }));
38900
38971
  }
38901
- function binary(value) {
38902
- return BigInt(value).toString(2);
38972
+ function Container(props) {
38973
+ return /* @__PURE__ */ React31.createElement(Box_default, {
38974
+ flexDirection: "column"
38975
+ }, /* @__PURE__ */ React31.createElement(Box_default, {
38976
+ height: 1
38977
+ }), props.children, /* @__PURE__ */ React31.createElement(Box_default, {
38978
+ height: 1
38979
+ }));
38903
38980
  }
38904
- function rand_index(list) {
38905
- return Math.floor(Math.random() * list.length);
38981
+
38982
+ // src/core/assertNever.ts
38983
+ function assertNever(value) {
38984
+ console.error("[assertNever]", { value });
38906
38985
  }
38907
- function interleave_bits(a, b2) {
38908
- const a_binary = binary(a).split("");
38909
- const b_binary = binary(b2).split("");
38910
- while (b_binary.length) {
38911
- const b_index = rand_index(b_binary);
38912
- const [selected] = b_binary.splice(b_index, 1);
38913
- const a_index = rand_index(a_binary);
38914
- a_binary.splice(a_index, 0, selected);
38986
+
38987
+ // src/app/StatusTable.tsx
38988
+ function StatusTable() {
38989
+ const commit_range = Store.useState((state) => state.commit_range);
38990
+ invariant(commit_range, "commit_range must exist");
38991
+ const row_list = [];
38992
+ for (const group of commit_range.group_list) {
38993
+ const row = {
38994
+ count: "",
38995
+ status: "NEW",
38996
+ title: "",
38997
+ url: ""
38998
+ };
38999
+ if (group.id === commit_range.UNASSIGNED) {
39000
+ row.status = "NEW";
39001
+ row.title = "Unassigned";
39002
+ row.count = `0/${group.commits.length}`;
39003
+ row.url = "";
39004
+ } else {
39005
+ if (group.dirty) {
39006
+ row.status = "OUTDATED";
39007
+ } else {
39008
+ row.status = "SYNCED";
39009
+ }
39010
+ if (group.pr) {
39011
+ if (group.pr.state === "MERGED") {
39012
+ row.status = "MERGED";
39013
+ }
39014
+ row.title = group.pr.title;
39015
+ row.count = `${group.pr.commits.length}/${group.commits.length}`;
39016
+ row.url = group.pr.url;
39017
+ } else {
39018
+ row.title = group.title || group.id;
39019
+ row.count = `0/${group.commits.length}`;
39020
+ }
39021
+ }
39022
+ row_list.push(row);
38915
39023
  }
38916
- const a_value = parseInt(a_binary.join(""), 2);
38917
- return a_value;
39024
+ return /* @__PURE__ */ React32.createElement(Table, {
39025
+ data: row_list,
39026
+ fillColumn: "title",
39027
+ maxWidth: {
39028
+ status: (v3) => v3 + 2
39029
+ },
39030
+ columnGap: 3,
39031
+ columns: {
39032
+ status: StatusColumn,
39033
+ count: CountColumn,
39034
+ title: TitleColumn,
39035
+ url: UrlColumn
39036
+ }
39037
+ });
38918
39038
  }
38919
- function encode(value) {
38920
- const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-+";
38921
- const bits_per_char = Math.log2(chars.length);
38922
- const max_value_bits = 53;
38923
- const max_char_size = Math.ceil(max_value_bits / bits_per_char);
38924
- let result = "";
38925
- while (value > 0) {
38926
- result = chars[value % chars.length] + result;
38927
- value = Math.floor(value / chars.length);
39039
+ function StatusColumn(props) {
39040
+ const value = props.row[props.column];
39041
+ return /* @__PURE__ */ React32.createElement(Text, {
39042
+ color: get_status_color(props.row),
39043
+ bold: get_status_bold(props.row)
39044
+ }, get_status_icon(props.row), " ", value);
39045
+ }
39046
+ function CountColumn(props) {
39047
+ const value = props.row[props.column];
39048
+ return /* @__PURE__ */ React32.createElement(Text, {
39049
+ dimColor: true
39050
+ }, value);
39051
+ }
39052
+ function TitleColumn(props) {
39053
+ const value = props.row[props.column];
39054
+ return /* @__PURE__ */ React32.createElement(Text, {
39055
+ wrap: "truncate-end"
39056
+ }, value);
39057
+ }
39058
+ function UrlColumn(props) {
39059
+ const value = props.row[props.column];
39060
+ return /* @__PURE__ */ React32.createElement(Url, {
39061
+ dimColor: true
39062
+ }, value);
39063
+ }
39064
+ function get_status_icon(row) {
39065
+ switch (row.status) {
39066
+ case "NEW":
39067
+ return "⭑";
39068
+ case "OUTDATED":
39069
+ return "!";
39070
+ case "MERGED":
39071
+ return "↗";
39072
+ case "SYNCED":
39073
+ return "✔";
39074
+ default:
39075
+ assertNever(row.status);
39076
+ return "?";
39077
+ }
39078
+ }
39079
+ function get_status_color(row) {
39080
+ switch (row.status) {
39081
+ case "NEW":
39082
+ return colors.yellow;
39083
+ case "OUTDATED":
39084
+ return colors.red;
39085
+ case "MERGED":
39086
+ return colors.purple;
39087
+ case "SYNCED":
39088
+ return colors.green;
39089
+ default:
39090
+ assertNever(row.status);
39091
+ return colors.gray;
39092
+ }
39093
+ }
39094
+ function get_status_bold(row) {
39095
+ switch (row.status) {
39096
+ case "NEW":
39097
+ case "OUTDATED":
39098
+ return true;
39099
+ default:
39100
+ return false;
38928
39101
  }
38929
- return result.padStart(max_char_size, "=");
38930
39102
  }
38931
39103
 
38932
- // src/commands/Rebase.tsx
38933
- function Rebase() {
38934
- return /* @__PURE__ */ React31.createElement(Await, {
38935
- fallback: /* @__PURE__ */ React31.createElement(Text, {
38936
- color: colors.yellow
38937
- }, "Rebasing commits…"),
38938
- function: Rebase.run
39104
+ // src/app/Status.tsx
39105
+ function Status() {
39106
+ return /* @__PURE__ */ React33.createElement(Await, {
39107
+ fallback: null,
39108
+ function: run4
38939
39109
  });
38940
39110
  }
38941
- Rebase.run = async function run4() {
39111
+ async function run4() {
38942
39112
  const state = Store.getState();
38943
39113
  const actions = state.actions;
38944
- const branch_name = state.branch_name;
38945
- const commit_range = state.commit_range;
38946
- const master_branch = state.master_branch;
38947
- const cwd2 = state.cwd;
38948
- const repo_root = state.repo_root;
38949
- invariant(branch_name, "branch_name must exist");
38950
- invariant(commit_range, "commit_range must exist");
39114
+ const argv = state.argv;
39115
+ const commit_range = Store.getState().commit_range;
39116
+ invariant(commit_range, "commit_range must exist");
39117
+ actions.output(/* @__PURE__ */ React33.createElement(StatusTable, null));
39118
+ let needs_rebase = false;
39119
+ let needs_update = false;
39120
+ for (const group of commit_range.group_list) {
39121
+ if (group.dirty) {
39122
+ needs_update = true;
39123
+ }
39124
+ if (group.pr?.state === "MERGED") {
39125
+ needs_rebase = true;
39126
+ }
39127
+ }
39128
+ if (argv.check) {
39129
+ actions.exit(0);
39130
+ } else if (needs_rebase) {
39131
+ Store.setState((state2) => {
39132
+ state2.step = "pre-local-merge-rebase";
39133
+ });
39134
+ } else if (needs_update) {
39135
+ Store.setState((state2) => {
39136
+ state2.step = "pre-select-commit-ranges";
39137
+ });
39138
+ } else if (argv.force) {
39139
+ Store.setState((state2) => {
39140
+ state2.step = "select-commit-ranges";
39141
+ });
39142
+ } else {
39143
+ actions.output(/* @__PURE__ */ React33.createElement(Text, null, "✅ Everything up to date."));
39144
+ actions.output(/* @__PURE__ */ React33.createElement(Text, {
39145
+ color: colors.gray
39146
+ }, /* @__PURE__ */ React33.createElement(Text, null, "Run with"), /* @__PURE__ */ React33.createElement(Text, {
39147
+ bold: true,
39148
+ color: colors.yellow
39149
+ }, ` --force `), /* @__PURE__ */ React33.createElement(Text, null, "to force update all pull requests.")));
39150
+ actions.exit(0);
39151
+ }
39152
+ }
39153
+
39154
+ // src/core/short_id.ts
39155
+ import crypto2 from "node:crypto";
39156
+ function short_id() {
39157
+ const timestamp = Date.now();
39158
+ const js_max_bits = 53;
39159
+ const timestamp_bits = Math.floor(Math.log2(timestamp)) + 1;
39160
+ const padding_bits = js_max_bits - timestamp_bits;
39161
+ const random = crypto2.randomInt(0, Math.pow(2, padding_bits));
39162
+ const combined = interleave_bits(timestamp, random);
39163
+ return encode(combined);
39164
+ }
39165
+ function binary(value) {
39166
+ return BigInt(value).toString(2);
39167
+ }
39168
+ function rand_index(list) {
39169
+ return Math.floor(Math.random() * list.length);
39170
+ }
39171
+ function interleave_bits(a, b2) {
39172
+ const a_binary = binary(a).split("");
39173
+ const b_binary = binary(b2).split("");
39174
+ while (b_binary.length) {
39175
+ const b_index = rand_index(b_binary);
39176
+ const [selected] = b_binary.splice(b_index, 1);
39177
+ const a_index = rand_index(a_binary);
39178
+ a_binary.splice(a_index, 0, selected);
39179
+ }
39180
+ const a_value = parseInt(a_binary.join(""), 2);
39181
+ return a_value;
39182
+ }
39183
+ function encode(value) {
39184
+ const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-+";
39185
+ const bits_per_char = Math.log2(chars.length);
39186
+ const max_value_bits = 53;
39187
+ const max_char_size = Math.ceil(max_value_bits / bits_per_char);
39188
+ let result = "";
39189
+ while (value > 0) {
39190
+ result = chars[value % chars.length] + result;
39191
+ value = Math.floor(value / chars.length);
39192
+ }
39193
+ return result.padStart(max_char_size, "=");
39194
+ }
39195
+
39196
+ // src/commands/Rebase.tsx
39197
+ function Rebase() {
39198
+ return /* @__PURE__ */ React34.createElement(Await, {
39199
+ fallback: /* @__PURE__ */ React34.createElement(Text, {
39200
+ color: colors.yellow
39201
+ }, "Rebasing commits…"),
39202
+ function: Rebase.run
39203
+ });
39204
+ }
39205
+ Rebase.run = async function run5() {
39206
+ const state = Store.getState();
39207
+ const actions = state.actions;
39208
+ const branch_name = state.branch_name;
39209
+ const commit_range = state.commit_range;
39210
+ const master_branch = state.master_branch;
39211
+ const cwd2 = state.cwd;
39212
+ const repo_root = state.repo_root;
39213
+ invariant(branch_name, "branch_name must exist");
39214
+ invariant(commit_range, "commit_range must exist");
38951
39215
  invariant(repo_root, "repo_root must exist");
38952
39216
  actions.register_abort_handler(async function abort_rebase() {
38953
- actions.output(/* @__PURE__ */ React31.createElement(Text, {
39217
+ actions.output(/* @__PURE__ */ React34.createElement(Text, {
38954
39218
  color: colors.red
38955
39219
  }, "\uD83D\uDEA8 Abort"));
38956
39220
  handle_exit();
@@ -38972,29 +39236,29 @@ Rebase.run = async function run4() {
38972
39236
  const merged_pr = commit_pr?.state === "MERGED";
38973
39237
  if (merged_pr) {
38974
39238
  if (actions.isDebug()) {
38975
- actions.output(/* @__PURE__ */ React31.createElement(FormatText, {
38976
- wrapper: /* @__PURE__ */ React31.createElement(Text, {
39239
+ actions.output(/* @__PURE__ */ React34.createElement(FormatText, {
39240
+ wrapper: /* @__PURE__ */ React34.createElement(Text, {
38977
39241
  color: colors.yellow,
38978
39242
  wrap: "truncate-end"
38979
39243
  }),
38980
39244
  message: "Dropping {commit_message} {pr_status}",
38981
39245
  values: {
38982
- commit_message: /* @__PURE__ */ React31.createElement(Brackets, null, commit2.subject_line),
38983
- pr_status: /* @__PURE__ */ React31.createElement(Parens, null, "MERGED")
39246
+ commit_message: /* @__PURE__ */ React34.createElement(Brackets, null, commit2.subject_line),
39247
+ pr_status: /* @__PURE__ */ React34.createElement(Parens, null, "MERGED")
38984
39248
  }
38985
39249
  }));
38986
39250
  }
38987
39251
  continue;
38988
39252
  }
38989
39253
  if (actions.isDebug()) {
38990
- actions.output(/* @__PURE__ */ React31.createElement(FormatText, {
38991
- wrapper: /* @__PURE__ */ React31.createElement(Text, {
39254
+ actions.output(/* @__PURE__ */ React34.createElement(FormatText, {
39255
+ wrapper: /* @__PURE__ */ React34.createElement(Text, {
38992
39256
  color: colors.yellow,
38993
39257
  wrap: "truncate-end"
38994
39258
  }),
38995
39259
  message: "Picking {commit_message}",
38996
39260
  values: {
38997
- commit_message: /* @__PURE__ */ React31.createElement(Brackets, null, commit2.subject_line)
39261
+ commit_message: /* @__PURE__ */ React34.createElement(Brackets, null, commit2.subject_line)
38998
39262
  }
38999
39263
  }));
39000
39264
  }
@@ -39008,21 +39272,22 @@ Rebase.run = async function run4() {
39008
39272
  await cli(`git branch -f ${branch_name} ${temp_branch_name}`);
39009
39273
  restore_git();
39010
39274
  const next_commit_range = await range();
39011
- actions.output(/* @__PURE__ */ React31.createElement(FormatText, {
39012
- wrapper: /* @__PURE__ */ React31.createElement(Text, {
39275
+ actions.output(/* @__PURE__ */ React34.createElement(FormatText, {
39276
+ wrapper: /* @__PURE__ */ React34.createElement(Text, {
39013
39277
  color: colors.green
39014
39278
  }),
39015
39279
  message: "✅ {branch_name} in sync with {origin_branch}",
39016
39280
  values: {
39017
- branch_name: /* @__PURE__ */ React31.createElement(Brackets, null, branch_name),
39018
- origin_branch: /* @__PURE__ */ React31.createElement(Brackets, null, `origin/${master_branch}`)
39281
+ branch_name: /* @__PURE__ */ React34.createElement(Brackets, null, branch_name),
39282
+ origin_branch: /* @__PURE__ */ React34.createElement(Brackets, null, master_branch)
39019
39283
  }
39020
39284
  }));
39021
39285
  actions.unregister_abort_handler();
39022
39286
  actions.set((state2) => {
39023
39287
  state2.commit_range = next_commit_range;
39024
- state2.step = "status";
39025
39288
  });
39289
+ actions.output(/* @__PURE__ */ React34.createElement(Status, null));
39290
+ actions.exit(0);
39026
39291
  } catch (err) {
39027
39292
  actions.error("Unable to rebase.");
39028
39293
  if (err instanceof Error) {
@@ -39045,33 +39310,33 @@ Rebase.run = async function run4() {
39045
39310
  cli.sync(`pwd`, spawn_options);
39046
39311
  }
39047
39312
  function handle_exit() {
39048
- actions.output(/* @__PURE__ */ React31.createElement(Text, {
39313
+ actions.output(/* @__PURE__ */ React34.createElement(Text, {
39049
39314
  color: colors.yellow
39050
- }, "Restoring ", /* @__PURE__ */ React31.createElement(Brackets, null, branch_name), "…"));
39315
+ }, "Restoring ", /* @__PURE__ */ React34.createElement(Brackets, null, branch_name), "…"));
39051
39316
  restore_git();
39052
- actions.output(/* @__PURE__ */ React31.createElement(Text, {
39317
+ actions.output(/* @__PURE__ */ React34.createElement(Text, {
39053
39318
  color: colors.yellow
39054
- }, "Restored ", /* @__PURE__ */ React31.createElement(Brackets, null, branch_name), "."));
39319
+ }, "Restored ", /* @__PURE__ */ React34.createElement(Brackets, null, branch_name), "."));
39055
39320
  }
39056
39321
  };
39057
39322
 
39058
39323
  // src/app/LocalMergeRebase.tsx
39059
39324
  function LocalMergeRebase() {
39060
- return /* @__PURE__ */ React32.createElement(Rebase, null);
39325
+ return /* @__PURE__ */ React35.createElement(Rebase, null);
39061
39326
  }
39062
39327
 
39063
39328
  // src/app/ManualRebase.tsx
39064
- var React33 = __toESM(require_react(), 1);
39329
+ var React36 = __toESM(require_react(), 1);
39065
39330
  import fs12 from "node:fs";
39066
39331
  function ManualRebase() {
39067
- return /* @__PURE__ */ React33.createElement(Await, {
39068
- fallback: /* @__PURE__ */ React33.createElement(Text, {
39332
+ return /* @__PURE__ */ React36.createElement(Await, {
39333
+ fallback: /* @__PURE__ */ React36.createElement(Text, {
39069
39334
  color: colors.yellow
39070
39335
  }, "Rebasing commits…"),
39071
- function: run5
39336
+ function: run6
39072
39337
  });
39073
39338
  }
39074
- async function run5() {
39339
+ async function run6() {
39075
39340
  const state = Store.getState();
39076
39341
  const actions = state.actions;
39077
39342
  const argv = state.argv;
@@ -39084,7 +39349,7 @@ async function run5() {
39084
39349
  invariant(commit_map, "commit_map must exist");
39085
39350
  invariant(repo_root, "repo_root must exist");
39086
39351
  actions.register_abort_handler(async function abort_manual_rebase() {
39087
- actions.output(/* @__PURE__ */ React33.createElement(Text, {
39352
+ actions.output(/* @__PURE__ */ React36.createElement(Text, {
39088
39353
  color: colors.red
39089
39354
  }, "\uD83D\uDEA8 Abort"));
39090
39355
  handle_exit();
@@ -39168,247 +39433,49 @@ async function run5() {
39168
39433
  cli.sync(`pwd`, spawn_options);
39169
39434
  }
39170
39435
  function handle_exit() {
39171
- actions.output(/* @__PURE__ */ React33.createElement(Text, {
39436
+ actions.output(/* @__PURE__ */ React36.createElement(Text, {
39172
39437
  color: colors.yellow
39173
- }, "Restoring ", /* @__PURE__ */ React33.createElement(Brackets, null, branch_name), "…"));
39438
+ }, "Restoring ", /* @__PURE__ */ React36.createElement(Brackets, null, branch_name), "…"));
39174
39439
  restore_git();
39175
- actions.output(/* @__PURE__ */ React33.createElement(Text, {
39440
+ actions.output(/* @__PURE__ */ React36.createElement(Text, {
39176
39441
  color: colors.yellow
39177
- }, "Restored ", /* @__PURE__ */ React33.createElement(Brackets, null, branch_name), "."));
39178
- }
39179
- }
39180
-
39181
- // src/app/PostRebaseStatus.tsx
39182
- var React36 = __toESM(require_react(), 1);
39183
-
39184
- // src/app/StatusTable.tsx
39185
- var React35 = __toESM(require_react(), 1);
39186
-
39187
- // src/app/Table.tsx
39188
- var React34 = __toESM(require_react(), 1);
39189
- function Table(props) {
39190
- if (!props.data.length) {
39191
- return /* @__PURE__ */ React34.createElement(Container, null, /* @__PURE__ */ React34.createElement(Text, {
39192
- dimColor: true
39193
- }, "No data found."));
39194
- }
39195
- const RowColumnList = Object.keys(props.columns);
39196
- const max_col_width = {};
39197
- for (const col of RowColumnList) {
39198
- max_col_width[col] = 0;
39199
- }
39200
- for (const row of props.data) {
39201
- for (const col of RowColumnList) {
39202
- const row_col = row[col];
39203
- max_col_width[col] = Math.max(String(row_col).length, max_col_width[col]);
39204
- }
39205
- }
39206
- for (const col of RowColumnList) {
39207
- const maxWidth = props.maxWidth?.[col];
39208
- if (maxWidth) {
39209
- max_col_width[col] = maxWidth(max_col_width[col]);
39210
- }
39211
- }
39212
- const { stdout } = use_stdout_default();
39213
- const available_width = stdout.columns;
39214
- const columnGap = is_finite_value(props.columnGap) ? props.columnGap : 2;
39215
- const breathing_room = 1;
39216
- if (props.fillColumn) {
39217
- let remaining_space = available_width;
39218
- for (const col of RowColumnList) {
39219
- if (props.fillColumn === col) {
39220
- continue;
39221
- }
39222
- remaining_space -= max_col_width[col];
39223
- }
39224
- remaining_space -= columnGap * (RowColumnList.length - 1);
39225
- remaining_space -= breathing_room;
39226
- if (props.fillColumn) {
39227
- max_col_width[props.fillColumn] = Math.min(max_col_width[props.fillColumn], remaining_space);
39228
- }
39229
- }
39230
- return /* @__PURE__ */ React34.createElement(Container, null, props.data.map((row, i2) => {
39231
- return /* @__PURE__ */ React34.createElement(Box_default, {
39232
- key: i2,
39233
- flexDirection: "row",
39234
- columnGap,
39235
- width: available_width
39236
- }, RowColumnList.map((column) => {
39237
- const ColumnComponent = props.columns[column];
39238
- return /* @__PURE__ */ React34.createElement(Box_default, {
39239
- key: String(column),
39240
- width: max_col_width[column]
39241
- }, /* @__PURE__ */ React34.createElement(ColumnComponent, {
39242
- row,
39243
- column
39244
- }));
39245
- }));
39246
- }));
39247
- }
39248
- function Container(props) {
39249
- return /* @__PURE__ */ React34.createElement(Box_default, {
39250
- flexDirection: "column"
39251
- }, /* @__PURE__ */ React34.createElement(Box_default, {
39252
- height: 1
39253
- }), props.children, /* @__PURE__ */ React34.createElement(Box_default, {
39254
- height: 1
39255
- }));
39256
- }
39257
-
39258
- // src/core/assertNever.ts
39259
- function assertNever(value) {
39260
- console.error("[assertNever]", { value });
39261
- }
39262
-
39263
- // src/app/StatusTable.tsx
39264
- function StatusTable() {
39265
- const commit_range = Store.useState((state) => state.commit_range);
39266
- invariant(commit_range, "commit_range must exist");
39267
- const row_list = [];
39268
- for (const group of commit_range.group_list) {
39269
- const row = {
39270
- count: "",
39271
- status: "NEW",
39272
- title: "",
39273
- url: ""
39274
- };
39275
- if (group.id === commit_range.UNASSIGNED) {
39276
- row.status = "NEW";
39277
- row.title = "Unassigned";
39278
- row.count = `0/${group.commits.length}`;
39279
- row.url = "";
39280
- } else {
39281
- if (group.dirty) {
39282
- row.status = "OUTDATED";
39283
- } else {
39284
- row.status = "SYNCED";
39285
- }
39286
- if (group.pr) {
39287
- if (group.pr.state === "MERGED") {
39288
- row.status = "MERGED";
39289
- }
39290
- row.title = group.pr.title;
39291
- row.count = `${group.pr.commits.length}/${group.commits.length}`;
39292
- row.url = group.pr.url;
39293
- } else {
39294
- row.title = group.title || group.id;
39295
- row.count = `0/${group.commits.length}`;
39296
- }
39297
- }
39298
- row_list.push(row);
39299
- }
39300
- return /* @__PURE__ */ React35.createElement(Table, {
39301
- data: row_list,
39302
- fillColumn: "title",
39303
- maxWidth: {
39304
- status: (v3) => v3 + 2
39305
- },
39306
- columnGap: 3,
39307
- columns: {
39308
- status: StatusColumn,
39309
- count: CountColumn,
39310
- title: TitleColumn,
39311
- url: UrlColumn
39312
- }
39313
- });
39314
- }
39315
- function StatusColumn(props) {
39316
- const value = props.row[props.column];
39317
- return /* @__PURE__ */ React35.createElement(Text, {
39318
- color: get_status_color(props.row),
39319
- bold: get_status_bold(props.row)
39320
- }, get_status_icon(props.row), " ", value);
39321
- }
39322
- function CountColumn(props) {
39323
- const value = props.row[props.column];
39324
- return /* @__PURE__ */ React35.createElement(Text, {
39325
- dimColor: true
39326
- }, value);
39327
- }
39328
- function TitleColumn(props) {
39329
- const value = props.row[props.column];
39330
- return /* @__PURE__ */ React35.createElement(Text, {
39331
- wrap: "truncate-end"
39332
- }, value);
39333
- }
39334
- function UrlColumn(props) {
39335
- const value = props.row[props.column];
39336
- return /* @__PURE__ */ React35.createElement(Url, {
39337
- dimColor: true
39338
- }, value);
39339
- }
39340
- function get_status_icon(row) {
39341
- switch (row.status) {
39342
- case "NEW":
39343
- return "⭑";
39344
- case "OUTDATED":
39345
- return "!";
39346
- case "MERGED":
39347
- return "↗";
39348
- case "SYNCED":
39349
- return "✔";
39350
- default:
39351
- assertNever(row.status);
39352
- return "?";
39353
- }
39354
- }
39355
- function get_status_color(row) {
39356
- switch (row.status) {
39357
- case "NEW":
39358
- return colors.yellow;
39359
- case "OUTDATED":
39360
- return colors.red;
39361
- case "MERGED":
39362
- return colors.purple;
39363
- case "SYNCED":
39364
- return colors.green;
39365
- default:
39366
- assertNever(row.status);
39367
- return colors.gray;
39368
- }
39369
- }
39370
- function get_status_bold(row) {
39371
- switch (row.status) {
39372
- case "NEW":
39373
- case "OUTDATED":
39374
- return true;
39375
- default:
39376
- return false;
39442
+ }, "Restored ", /* @__PURE__ */ React36.createElement(Brackets, null, branch_name), "."));
39377
39443
  }
39378
39444
  }
39379
39445
 
39380
39446
  // src/app/PostRebaseStatus.tsx
39447
+ var React37 = __toESM(require_react(), 1);
39381
39448
  function PostRebaseStatus() {
39382
- return /* @__PURE__ */ React36.createElement(Await, {
39449
+ return /* @__PURE__ */ React37.createElement(Await, {
39383
39450
  fallback: null,
39384
- function: run6
39451
+ function: run7
39385
39452
  });
39386
39453
  }
39387
- async function run6() {
39454
+ async function run7() {
39388
39455
  const actions = Store.getState().actions;
39389
39456
  actions.reset_pr();
39390
39457
  const commit_range = await range();
39391
39458
  actions.set((state) => {
39392
39459
  state.commit_range = commit_range;
39393
39460
  });
39394
- actions.output(/* @__PURE__ */ React36.createElement(StatusTable, null));
39395
- actions.output(/* @__PURE__ */ React36.createElement(Text, null, "✅ Everything up to date."));
39461
+ actions.output(/* @__PURE__ */ React37.createElement(StatusTable, null));
39462
+ actions.output(/* @__PURE__ */ React37.createElement(Text, null, "✅ Everything up to date."));
39396
39463
  actions.exit(0);
39397
39464
  }
39398
39465
 
39399
39466
  // src/app/PreLocalMergeRebase.tsx
39400
- var React37 = __toESM(require_react(), 1);
39467
+ var React38 = __toESM(require_react(), 1);
39401
39468
  function PreLocalMergeRebase() {
39402
39469
  const actions = Store.useActions();
39403
39470
  const argv = Store.useState((state) => state.argv);
39404
- React37.useEffect(() => {
39471
+ React38.useEffect(() => {
39405
39472
  if (argv.force) {
39406
39473
  Store.setState((state) => {
39407
39474
  state.step = "local-merge-rebase";
39408
39475
  });
39409
39476
  }
39410
39477
  }, [argv]);
39411
- return /* @__PURE__ */ React37.createElement(YesNoPrompt, {
39478
+ return /* @__PURE__ */ React38.createElement(YesNoPrompt, {
39412
39479
  message: "Local branch needs to be rebased, would you like to rebase to update your local branch?",
39413
39480
  onYes: () => {
39414
39481
  actions.set((state) => {
@@ -39420,16 +39487,16 @@ function PreLocalMergeRebase() {
39420
39487
  }
39421
39488
 
39422
39489
  // src/app/PreManualRebase.tsx
39423
- var React38 = __toESM(require_react(), 1);
39490
+ var React39 = __toESM(require_react(), 1);
39424
39491
  import fs13 from "node:fs/promises";
39425
39492
  import path8 from "node:path";
39426
39493
  function PreManualRebase() {
39427
- return /* @__PURE__ */ React38.createElement(Await, {
39494
+ return /* @__PURE__ */ React39.createElement(Await, {
39428
39495
  fallback: null,
39429
- function: run7
39496
+ function: run8
39430
39497
  });
39431
39498
  }
39432
- async function run7() {
39499
+ async function run8() {
39433
39500
  const state = Store.getState();
39434
39501
  const actions = state.actions;
39435
39502
  const repo_root = state.repo_root;
@@ -39445,13 +39512,13 @@ async function run7() {
39445
39512
  const pr_template_fn = PR_TEMPLATE[key];
39446
39513
  if (await safe_exists(pr_template_fn(repo_root))) {
39447
39514
  pr_template_body = await fs13.readFile(pr_template_fn(repo_root), "utf-8");
39448
- actions.output(/* @__PURE__ */ React38.createElement(FormatText, {
39449
- wrapper: /* @__PURE__ */ React38.createElement(Text, {
39515
+ actions.output(/* @__PURE__ */ React39.createElement(FormatText, {
39516
+ wrapper: /* @__PURE__ */ React39.createElement(Text, {
39450
39517
  color: colors.yellow
39451
39518
  }),
39452
39519
  message: "Using PR template {pr_filepath}",
39453
39520
  values: {
39454
- pr_filepath: /* @__PURE__ */ React38.createElement(Brackets, null, pr_template_fn(""))
39521
+ pr_filepath: /* @__PURE__ */ React39.createElement(Brackets, null, pr_template_fn(""))
39455
39522
  }
39456
39523
  }));
39457
39524
  break;
@@ -39465,16 +39532,16 @@ async function run7() {
39465
39532
  state2.pr_template_body = pr_template_body;
39466
39533
  state2.pr_templates = pr_templates;
39467
39534
  if (pr_templates.length > 0) {
39468
- actions.output(/* @__PURE__ */ React38.createElement(FormatText, {
39469
- wrapper: /* @__PURE__ */ React38.createElement(Text, {
39535
+ actions.output(/* @__PURE__ */ React39.createElement(FormatText, {
39536
+ wrapper: /* @__PURE__ */ React39.createElement(Text, {
39470
39537
  color: colors.yellow
39471
39538
  }),
39472
39539
  message: "{count} queryable templates found under {dir}, but not supported.",
39473
39540
  values: {
39474
- count: /* @__PURE__ */ React38.createElement(Text, {
39541
+ count: /* @__PURE__ */ React39.createElement(Text, {
39475
39542
  color: colors.blue
39476
39543
  }, pr_templates.length),
39477
- dir: /* @__PURE__ */ React38.createElement(Brackets, null, PR_TEMPLATE.TemplateDir(""))
39544
+ dir: /* @__PURE__ */ React39.createElement(Brackets, null, PR_TEMPLATE.TemplateDir(""))
39478
39545
  }
39479
39546
  }));
39480
39547
  }
@@ -39490,18 +39557,18 @@ var PR_TEMPLATE = Object.freeze({
39490
39557
  var PR_TEMPLATE_KEY_LIST = Object.keys(PR_TEMPLATE);
39491
39558
 
39492
39559
  // src/app/PreSelectCommitRanges.tsx
39493
- var React39 = __toESM(require_react(), 1);
39560
+ var React40 = __toESM(require_react(), 1);
39494
39561
  function PreSelectCommitRanges() {
39495
39562
  const actions = Store.useActions();
39496
39563
  const argv = Store.useState((state) => state.argv);
39497
- React39.useEffect(() => {
39564
+ React40.useEffect(() => {
39498
39565
  if (argv.force) {
39499
39566
  Store.setState((state) => {
39500
39567
  state.step = "select-commit-ranges";
39501
39568
  });
39502
39569
  }
39503
39570
  }, [argv]);
39504
- return /* @__PURE__ */ React39.createElement(YesNoPrompt, {
39571
+ return /* @__PURE__ */ React40.createElement(YesNoPrompt, {
39505
39572
  message: "Some commits are new or outdated, would you like to select new commit ranges?",
39506
39573
  onYes: () => {
39507
39574
  actions.set((state) => {
@@ -39513,10 +39580,10 @@ function PreSelectCommitRanges() {
39513
39580
  }
39514
39581
 
39515
39582
  // src/app/SelectCommitRanges.tsx
39516
- var React42 = __toESM(require_react(), 1);
39583
+ var React43 = __toESM(require_react(), 1);
39517
39584
 
39518
39585
  // src/app/MultiSelect.tsx
39519
- var React40 = __toESM(require_react(), 1);
39586
+ var React41 = __toESM(require_react(), 1);
39520
39587
 
39521
39588
  // src/core/clamp.ts
39522
39589
  function clamp(value, min, max) {
@@ -39539,7 +39606,7 @@ function wrap_index(value, list) {
39539
39606
 
39540
39607
  // src/app/MultiSelect.tsx
39541
39608
  function MultiSelect(props) {
39542
- const [selected_set, select] = React40.useReducer((state, value) => {
39609
+ const [selected_set, select] = React41.useReducer((state, value) => {
39543
39610
  const next = new Set(state);
39544
39611
  if (next.has(value)) {
39545
39612
  next.delete(value);
@@ -39555,7 +39622,7 @@ function MultiSelect(props) {
39555
39622
  });
39556
39623
  return set2;
39557
39624
  });
39558
- const [index, set_index] = React40.useReducer((_, value) => {
39625
+ const [index, set_index] = React41.useReducer((_, value) => {
39559
39626
  const next_index = clamp(value, 0, props.items.length - 1);
39560
39627
  return next_index;
39561
39628
  }, 0, function find_initial_index() {
@@ -39574,8 +39641,8 @@ function MultiSelect(props) {
39574
39641
  }
39575
39642
  return 0;
39576
39643
  });
39577
- const selectRef = React40.useRef(false);
39578
- React40.useEffect(() => {
39644
+ const selectRef = React41.useRef(false);
39645
+ React41.useEffect(() => {
39579
39646
  if (!selectRef.current) {
39580
39647
  return;
39581
39648
  }
@@ -39585,7 +39652,7 @@ function MultiSelect(props) {
39585
39652
  const state = selected_list.map((index2) => props.items[index2].value);
39586
39653
  props.onSelect({ item, selected, state });
39587
39654
  }, [selected_set]);
39588
- React40.useEffect(() => {
39655
+ React41.useEffect(() => {
39589
39656
  const item = props.items[index].value;
39590
39657
  const selected_list = Array.from(selected_set);
39591
39658
  const selected = selected_set.has(index);
@@ -39627,13 +39694,13 @@ function MultiSelect(props) {
39627
39694
  }
39628
39695
  }
39629
39696
  });
39630
- return /* @__PURE__ */ React40.createElement(Box_default, {
39697
+ return /* @__PURE__ */ React41.createElement(Box_default, {
39631
39698
  flexDirection: "column"
39632
39699
  }, props.items.map((item, i2) => {
39633
39700
  const active = i2 === index;
39634
39701
  const selected = selected_set.has(i2);
39635
39702
  const disabled = item.disabled || false;
39636
- return /* @__PURE__ */ React40.createElement(ItemRow, {
39703
+ return /* @__PURE__ */ React41.createElement(ItemRow, {
39637
39704
  key: i2,
39638
39705
  label: item.label,
39639
39706
  active,
@@ -39661,15 +39728,15 @@ function ItemRow(props) {
39661
39728
  underline = false;
39662
39729
  dimColor = true;
39663
39730
  }
39664
- return /* @__PURE__ */ React40.createElement(Box_default, {
39731
+ return /* @__PURE__ */ React41.createElement(Box_default, {
39665
39732
  flexDirection: "row",
39666
39733
  gap: 1
39667
- }, /* @__PURE__ */ React40.createElement(Radio, {
39734
+ }, /* @__PURE__ */ React41.createElement(Radio, {
39668
39735
  selected: props.selected,
39669
39736
  disabled: props.disabled
39670
- }), /* @__PURE__ */ React40.createElement(Box_default, {
39737
+ }), /* @__PURE__ */ React41.createElement(Box_default, {
39671
39738
  width: props.maxWidth
39672
- }, /* @__PURE__ */ React40.createElement(Text, {
39739
+ }, /* @__PURE__ */ React41.createElement(Text, {
39673
39740
  bold,
39674
39741
  underline,
39675
39742
  color,
@@ -39692,7 +39759,7 @@ function Radio(props) {
39692
39759
  color = colors.gray;
39693
39760
  dimColor = true;
39694
39761
  }
39695
- return /* @__PURE__ */ React40.createElement(Text, {
39762
+ return /* @__PURE__ */ React41.createElement(Text, {
39696
39763
  bold: props.selected,
39697
39764
  color,
39698
39765
  dimColor
@@ -39700,14 +39767,14 @@ function Radio(props) {
39700
39767
  }
39701
39768
 
39702
39769
  // src/app/TextInput.tsx
39703
- var React41 = __toESM(require_react(), 1);
39770
+ var React42 = __toESM(require_react(), 1);
39704
39771
  function TextInput(props) {
39705
- const [value, set_value] = React41.useState(get_value(props));
39706
- React41.useEffect(function sync_value_prop() {
39772
+ const [value, set_value] = React42.useState(get_value(props));
39773
+ React42.useEffect(function sync_value_prop() {
39707
39774
  set_value(get_value(props));
39708
39775
  }, [props.value]);
39709
- const [caret_visible, set_caret_visible] = React41.useState(false);
39710
- React41.useEffect(function blink_caret() {
39776
+ const [caret_visible, set_caret_visible] = React42.useState(false);
39777
+ React42.useEffect(function blink_caret() {
39711
39778
  const interval_ms = 500;
39712
39779
  let timeoutId = setTimeout(tick, interval_ms);
39713
39780
  function tick() {
@@ -39739,12 +39806,12 @@ function TextInput(props) {
39739
39806
  set_value(next_value);
39740
39807
  props.onChange?.(next_value);
39741
39808
  });
39742
- return /* @__PURE__ */ React41.createElement(Box_default, {
39809
+ return /* @__PURE__ */ React42.createElement(Box_default, {
39743
39810
  borderStyle: "single",
39744
39811
  minHeight: 1,
39745
39812
  borderColor: colors.yellow,
39746
39813
  borderDimColor: true
39747
- }, /* @__PURE__ */ React41.createElement(Text, null, value || ""), /* @__PURE__ */ React41.createElement(Text, {
39814
+ }, /* @__PURE__ */ React42.createElement(Text, null, value || ""), /* @__PURE__ */ React42.createElement(Text, {
39748
39815
  color: colors.yellow,
39749
39816
  dimColor: true,
39750
39817
  inverse: caret_visible
@@ -39763,26 +39830,26 @@ function gs_short_id() {
39763
39830
  function SelectCommitRanges() {
39764
39831
  const commit_range = Store.useState((state) => state.commit_range);
39765
39832
  invariant(commit_range, "commit_range must exist");
39766
- return /* @__PURE__ */ React42.createElement(SelectCommitRangesInternal, {
39833
+ return /* @__PURE__ */ React43.createElement(SelectCommitRangesInternal, {
39767
39834
  commit_range
39768
39835
  });
39769
39836
  }
39770
39837
  function SelectCommitRangesInternal(props) {
39771
39838
  const actions = Store.useActions();
39772
39839
  const argv = Store.useState((state) => state.argv);
39773
- const [selected_group_id, set_selected_group_id] = React42.useState(() => {
39840
+ const [selected_group_id, set_selected_group_id] = React43.useState(() => {
39774
39841
  const first_group = props.commit_range.group_list.find((g2) => g2.id !== props.commit_range.UNASSIGNED);
39775
39842
  if (first_group) {
39776
39843
  return first_group.id;
39777
39844
  }
39778
39845
  return props.commit_range.UNASSIGNED;
39779
39846
  });
39780
- const [group_input, set_group_input] = React42.useState(false);
39781
- const [new_group_list, create_group] = React42.useReducer((group_list2, group2) => {
39847
+ const [group_input, set_group_input] = React43.useState(false);
39848
+ const [new_group_list, create_group] = React43.useReducer((group_list2, group2) => {
39782
39849
  const next_group_list = group_list2.concat(group2);
39783
39850
  return next_group_list;
39784
39851
  }, []);
39785
- const [commit_map, update_commit_map] = React42.useReducer((map, args) => {
39852
+ const [commit_map, update_commit_map] = React43.useReducer((map, args) => {
39786
39853
  map.set(args.key, args.value);
39787
39854
  return new Map(map);
39788
39855
  }, new Map, (map) => {
@@ -39890,12 +39957,12 @@ function SelectCommitRangesInternal(props) {
39890
39957
  group_title_width = Math.min(group.title.length, group_title_width);
39891
39958
  let max_item_width = max_group_label_width;
39892
39959
  max_item_width -= left_arrow.length + right_arrow.length;
39893
- const [focused, set_focused] = React42.useState("");
39894
- return /* @__PURE__ */ React42.createElement(Box_default, {
39960
+ const [focused, set_focused] = React43.useState("");
39961
+ return /* @__PURE__ */ React43.createElement(Box_default, {
39895
39962
  flexDirection: "column"
39896
- }, /* @__PURE__ */ React42.createElement(Box_default, {
39963
+ }, /* @__PURE__ */ React43.createElement(Box_default, {
39897
39964
  height: 1
39898
- }), /* @__PURE__ */ React42.createElement(MultiSelect, {
39965
+ }), /* @__PURE__ */ React43.createElement(MultiSelect, {
39899
39966
  items,
39900
39967
  maxWidth: max_item_width,
39901
39968
  disabled: multiselect_disabled,
@@ -39913,108 +39980,108 @@ function SelectCommitRangesInternal(props) {
39913
39980
  }
39914
39981
  update_commit_map({ key, value });
39915
39982
  }
39916
- }), /* @__PURE__ */ React42.createElement(Box_default, {
39983
+ }), /* @__PURE__ */ React43.createElement(Box_default, {
39917
39984
  height: 1
39918
- }), /* @__PURE__ */ React42.createElement(Box_default, {
39985
+ }), /* @__PURE__ */ React43.createElement(Box_default, {
39919
39986
  width: max_group_label_width,
39920
39987
  flexDirection: "row"
39921
- }, /* @__PURE__ */ React42.createElement(Text, null, left_arrow), /* @__PURE__ */ React42.createElement(Text, null, group_position), /* @__PURE__ */ React42.createElement(Box_default, {
39988
+ }, /* @__PURE__ */ React43.createElement(Text, null, left_arrow), /* @__PURE__ */ React43.createElement(Text, null, group_position), /* @__PURE__ */ React43.createElement(Box_default, {
39922
39989
  width: group_title_width,
39923
39990
  justifyContent: "center"
39924
- }, /* @__PURE__ */ React42.createElement(Text, {
39991
+ }, /* @__PURE__ */ React43.createElement(Text, {
39925
39992
  wrap: "truncate-end"
39926
- }, group.title)), /* @__PURE__ */ React42.createElement(Text, null, right_arrow)), /* @__PURE__ */ React42.createElement(Box_default, {
39993
+ }, group.title)), /* @__PURE__ */ React43.createElement(Text, null, right_arrow)), /* @__PURE__ */ React43.createElement(Box_default, {
39927
39994
  height: 1
39928
- }), unassigned_count > 0 ? /* @__PURE__ */ React42.createElement(FormatText, {
39929
- wrapper: /* @__PURE__ */ React42.createElement(Text, {
39995
+ }), unassigned_count > 0 ? /* @__PURE__ */ React43.createElement(FormatText, {
39996
+ wrapper: /* @__PURE__ */ React43.createElement(Text, {
39930
39997
  color: colors.gray
39931
39998
  }),
39932
39999
  message: "{count} unassigned commits, press {c} to {create} a new group",
39933
40000
  values: {
39934
- count: /* @__PURE__ */ React42.createElement(Text, {
40001
+ count: /* @__PURE__ */ React43.createElement(Text, {
39935
40002
  color: colors.yellow,
39936
40003
  bold: true
39937
40004
  }, unassigned_count),
39938
- c: /* @__PURE__ */ React42.createElement(Text, {
40005
+ c: /* @__PURE__ */ React43.createElement(Text, {
39939
40006
  bold: true,
39940
40007
  color: colors.green
39941
40008
  }, "c"),
39942
- create: /* @__PURE__ */ React42.createElement(Text, {
40009
+ create: /* @__PURE__ */ React43.createElement(Text, {
39943
40010
  bold: true,
39944
40011
  color: colors.green
39945
- }, /* @__PURE__ */ React42.createElement(Parens, null, "c"), "reate")
40012
+ }, /* @__PURE__ */ React43.createElement(Parens, null, "c"), "reate")
39946
40013
  }
39947
- }) : /* @__PURE__ */ React42.createElement(React42.Fragment, null, argv.sync ? /* @__PURE__ */ React42.createElement(FormatText, {
39948
- wrapper: /* @__PURE__ */ React42.createElement(Text, null),
40014
+ }) : /* @__PURE__ */ React43.createElement(React43.Fragment, null, argv.sync ? /* @__PURE__ */ React43.createElement(FormatText, {
40015
+ wrapper: /* @__PURE__ */ React43.createElement(Text, null),
39949
40016
  message: "\uD83C\uDF89 Done! Press {s} to {sync} the commits to Github",
39950
40017
  values: {
39951
- s: /* @__PURE__ */ React42.createElement(Text, {
40018
+ s: /* @__PURE__ */ React43.createElement(Text, {
39952
40019
  bold: true,
39953
40020
  color: colors.green
39954
40021
  }, "s"),
39955
- sync: /* @__PURE__ */ React42.createElement(Text, {
40022
+ sync: /* @__PURE__ */ React43.createElement(Text, {
39956
40023
  bold: true,
39957
40024
  color: colors.green
39958
- }, /* @__PURE__ */ React42.createElement(Parens, null, "s"), "ync")
40025
+ }, /* @__PURE__ */ React43.createElement(Parens, null, "s"), "ync")
39959
40026
  }
39960
- }) : /* @__PURE__ */ React42.createElement(FormatText, {
39961
- wrapper: /* @__PURE__ */ React42.createElement(Text, null),
40027
+ }) : /* @__PURE__ */ React43.createElement(FormatText, {
40028
+ wrapper: /* @__PURE__ */ React43.createElement(Text, null),
39962
40029
  message: "\uD83C\uDF89 Done! Press {s} to {save} the commits locally",
39963
40030
  values: {
39964
- s: /* @__PURE__ */ React42.createElement(Text, {
40031
+ s: /* @__PURE__ */ React43.createElement(Text, {
39965
40032
  bold: true,
39966
40033
  color: colors.green
39967
40034
  }, "s"),
39968
- save: /* @__PURE__ */ React42.createElement(Text, {
40035
+ save: /* @__PURE__ */ React43.createElement(Text, {
39969
40036
  bold: true,
39970
40037
  color: colors.green
39971
- }, /* @__PURE__ */ React42.createElement(Parens, null, "s"), "save")
40038
+ }, /* @__PURE__ */ React43.createElement(Parens, null, "s"), "save")
39972
40039
  }
39973
- })), !group_input ? null : /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(Box_default, {
40040
+ })), !group_input ? null : /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(Box_default, {
39974
40041
  height: 1
39975
- }), /* @__PURE__ */ React42.createElement(FormatText, {
39976
- wrapper: /* @__PURE__ */ React42.createElement(Text, {
40042
+ }), /* @__PURE__ */ React43.createElement(FormatText, {
40043
+ wrapper: /* @__PURE__ */ React43.createElement(Text, {
39977
40044
  color: colors.gray
39978
40045
  }),
39979
40046
  message: "Enter a title for the PR {note}",
39980
40047
  values: {
39981
- note: /* @__PURE__ */ React42.createElement(Parens, null, /* @__PURE__ */ React42.createElement(FormatText, {
40048
+ note: /* @__PURE__ */ React43.createElement(Parens, null, /* @__PURE__ */ React43.createElement(FormatText, {
39982
40049
  message: "press {enter} to submit",
39983
40050
  values: {
39984
- enter: /* @__PURE__ */ React42.createElement(Text, {
40051
+ enter: /* @__PURE__ */ React43.createElement(Text, {
39985
40052
  bold: true,
39986
40053
  color: colors.green
39987
40054
  }, SYMBOL.enter)
39988
40055
  }
39989
40056
  }))
39990
40057
  }
39991
- }), /* @__PURE__ */ React42.createElement(TextInput, {
40058
+ }), /* @__PURE__ */ React43.createElement(TextInput, {
39992
40059
  defaultValue: focused,
39993
40060
  onSubmit: submit_group_input
39994
- }), /* @__PURE__ */ React42.createElement(Box_default, {
40061
+ }), /* @__PURE__ */ React43.createElement(Box_default, {
39995
40062
  height: 1
39996
- })), /* @__PURE__ */ React42.createElement(Box_default, null, /* @__PURE__ */ React42.createElement(FormatText, {
39997
- wrapper: /* @__PURE__ */ React42.createElement(Text, {
40063
+ })), /* @__PURE__ */ React43.createElement(Box_default, null, /* @__PURE__ */ React43.createElement(FormatText, {
40064
+ wrapper: /* @__PURE__ */ React43.createElement(Text, {
39998
40065
  color: colors.gray
39999
40066
  }),
40000
40067
  message: "Press {left} and {right} to view PR groups",
40001
40068
  values: {
40002
- left: /* @__PURE__ */ React42.createElement(Text, {
40069
+ left: /* @__PURE__ */ React43.createElement(Text, {
40003
40070
  bold: true,
40004
40071
  color: colors.green
40005
40072
  }, SYMBOL.left),
40006
- right: /* @__PURE__ */ React42.createElement(Text, {
40073
+ right: /* @__PURE__ */ React43.createElement(Text, {
40007
40074
  bold: true,
40008
40075
  color: colors.green
40009
40076
  }, SYMBOL.right)
40010
40077
  }
40011
- })), /* @__PURE__ */ React42.createElement(Box_default, null, /* @__PURE__ */ React42.createElement(FormatText, {
40012
- wrapper: /* @__PURE__ */ React42.createElement(Text, {
40078
+ })), /* @__PURE__ */ React43.createElement(Box_default, null, /* @__PURE__ */ React43.createElement(FormatText, {
40079
+ wrapper: /* @__PURE__ */ React43.createElement(Text, {
40013
40080
  color: colors.gray
40014
40081
  }),
40015
40082
  message: "Press {enter} to toggle commit selection",
40016
40083
  values: {
40017
- enter: /* @__PURE__ */ React42.createElement(Text, {
40084
+ enter: /* @__PURE__ */ React43.createElement(Text, {
40018
40085
  bold: true,
40019
40086
  color: colors.green
40020
40087
  }, SYMBOL.enter)
@@ -40024,20 +40091,21 @@ function SelectCommitRangesInternal(props) {
40024
40091
  let branch_prefix = "";
40025
40092
  if (argv["branch-prefix"]) {
40026
40093
  branch_prefix = argv["branch-prefix"];
40027
- } else if ("") {
40094
+ } else if (process.env.GIT_STACK_BRANCH_PREFIX) {
40095
+ branch_prefix = process.env.GIT_STACK_BRANCH_PREFIX;
40028
40096
  }
40029
40097
  return `${branch_prefix}${gs_short_id()}`;
40030
40098
  }
40031
40099
  function submit_group_input(title) {
40032
40100
  const id = get_group_id();
40033
- actions.output(/* @__PURE__ */ React42.createElement(FormatText, {
40034
- wrapper: /* @__PURE__ */ React42.createElement(Text, {
40101
+ actions.output(/* @__PURE__ */ React43.createElement(FormatText, {
40102
+ wrapper: /* @__PURE__ */ React43.createElement(Text, {
40035
40103
  dimColor: true
40036
40104
  }),
40037
40105
  message: "Created new group {group} {note}",
40038
40106
  values: {
40039
- group: /* @__PURE__ */ React42.createElement(Brackets, null, title),
40040
- note: /* @__PURE__ */ React42.createElement(Parens, null, id)
40107
+ group: /* @__PURE__ */ React43.createElement(Brackets, null, title),
40108
+ note: /* @__PURE__ */ React43.createElement(Parens, null, id)
40041
40109
  }
40042
40110
  }));
40043
40111
  create_group({ id, title });
@@ -40051,57 +40119,6 @@ var SYMBOL = {
40051
40119
  enter: "Enter"
40052
40120
  };
40053
40121
 
40054
- // src/app/Status.tsx
40055
- var React43 = __toESM(require_react(), 1);
40056
- function Status() {
40057
- return /* @__PURE__ */ React43.createElement(Await, {
40058
- fallback: null,
40059
- function: run8
40060
- });
40061
- }
40062
- async function run8() {
40063
- const state = Store.getState();
40064
- const actions = state.actions;
40065
- const argv = state.argv;
40066
- const commit_range = Store.getState().commit_range;
40067
- invariant(commit_range, "commit_range must exist");
40068
- actions.output(/* @__PURE__ */ React43.createElement(StatusTable, null));
40069
- let needs_rebase = false;
40070
- let needs_update = false;
40071
- for (const group of commit_range.group_list) {
40072
- if (group.dirty) {
40073
- needs_update = true;
40074
- }
40075
- if (group.pr?.state === "MERGED") {
40076
- needs_rebase = true;
40077
- }
40078
- }
40079
- if (argv.check) {
40080
- actions.exit(0);
40081
- } else if (needs_rebase) {
40082
- Store.setState((state2) => {
40083
- state2.step = "pre-local-merge-rebase";
40084
- });
40085
- } else if (needs_update) {
40086
- Store.setState((state2) => {
40087
- state2.step = "pre-select-commit-ranges";
40088
- });
40089
- } else if (argv.force) {
40090
- Store.setState((state2) => {
40091
- state2.step = "select-commit-ranges";
40092
- });
40093
- } else {
40094
- actions.output(/* @__PURE__ */ React43.createElement(Text, null, "✅ Everything up to date."));
40095
- actions.output(/* @__PURE__ */ React43.createElement(Text, {
40096
- color: colors.gray
40097
- }, /* @__PURE__ */ React43.createElement(Text, null, "Run with"), /* @__PURE__ */ React43.createElement(Text, {
40098
- bold: true,
40099
- color: colors.yellow
40100
- }, ` --force `), /* @__PURE__ */ React43.createElement(Text, null, "to force update all pull requests.")));
40101
- actions.exit(0);
40102
- }
40103
- }
40104
-
40105
40122
  // src/app/SyncGithub.tsx
40106
40123
  var React44 = __toESM(require_react(), 1);
40107
40124
  var import_last = __toESM(require_last(), 1);
@@ -45646,7 +45663,7 @@ var yargs_default = Yargs;
45646
45663
 
45647
45664
  // src/command.ts
45648
45665
  async function command2() {
45649
- 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.2.6").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45666
+ 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.2.8").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45650
45667
  }
45651
45668
  var GlobalOptions = {
45652
45669
  verbose: {