repomind 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1206 -708
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9638,14 +9638,14 @@ var require_react_reconciler_production = __commonJS({
9638
9638
  }
9639
9639
  var exports2 = {};
9640
9640
  "use strict";
9641
- var React18 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
9641
+ var React20 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
9642
9642
  Symbol.for("react.scope");
9643
9643
  var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
9644
9644
  Symbol.for("react.legacy_hidden");
9645
9645
  Symbol.for("react.tracing_marker");
9646
9646
  var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
9647
9647
  Symbol.for("react.view_transition");
9648
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React18.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
9648
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React20.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
9649
9649
  $$$config.cloneMutableInstance;
9650
9650
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
9651
9651
  $$$config.cloneMutableTextInstance;
@@ -22238,14 +22238,14 @@ var require_react_reconciler_development = __commonJS({
22238
22238
  }
22239
22239
  var exports2 = {};
22240
22240
  "use strict";
22241
- var React18 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
22241
+ var React20 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
22242
22242
  Symbol.for("react.scope");
22243
22243
  var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
22244
22244
  Symbol.for("react.legacy_hidden");
22245
22245
  Symbol.for("react.tracing_marker");
22246
22246
  var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
22247
22247
  Symbol.for("react.view_transition");
22248
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React18.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
22248
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React20.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
22249
22249
  $$$config.cloneMutableInstance;
22250
22250
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
22251
22251
  $$$config.cloneMutableTextInstance;
@@ -30234,18 +30234,18 @@ var require_react_jsx_runtime_development = __commonJS({
30234
30234
  function isValidElement(object) {
30235
30235
  return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
30236
30236
  }
30237
- var React18 = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React18.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
30237
+ var React20 = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React20.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
30238
30238
  return null;
30239
30239
  };
30240
- React18 = {
30240
+ React20 = {
30241
30241
  react_stack_bottom_frame: function(callStackForError) {
30242
30242
  return callStackForError();
30243
30243
  }
30244
30244
  };
30245
30245
  var specialPropKeyWarningShown;
30246
30246
  var didWarnAboutElementRef = {};
30247
- var unknownOwnerDebugStack = React18.react_stack_bottom_frame.bind(
30248
- React18,
30247
+ var unknownOwnerDebugStack = React20.react_stack_bottom_frame.bind(
30248
+ React20,
30249
30249
  UnknownOwner
30250
30250
  )();
30251
30251
  var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
@@ -30322,6 +30322,26 @@ function parseNumstat(line) {
30322
30322
  };
30323
30323
  }
30324
30324
  var HUNK_HEADER_RE = /^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@\s*(.*)/;
30325
+ function annotatePairs(lines) {
30326
+ let pairIdx = 0;
30327
+ let i = 0;
30328
+ while (i < lines.length) {
30329
+ if (lines[i].type !== "deletion") {
30330
+ i++;
30331
+ continue;
30332
+ }
30333
+ const delStart = i;
30334
+ while (i < lines.length && lines[i].type === "deletion") i++;
30335
+ const addStart = i;
30336
+ while (i < lines.length && lines[i].type === "addition") i++;
30337
+ if (addStart < i) {
30338
+ for (let j = delStart; j < i; j++) {
30339
+ lines[j].pairIndex = pairIdx;
30340
+ }
30341
+ pairIdx++;
30342
+ }
30343
+ }
30344
+ }
30325
30345
  function parseHunks(patch) {
30326
30346
  if (!patch.trim()) return [];
30327
30347
  const hunks = [];
@@ -30335,6 +30355,7 @@ function parseHunks(patch) {
30335
30355
  const headerMatch = line.match(HUNK_HEADER_RE);
30336
30356
  if (headerMatch) {
30337
30357
  if (currentHunk) {
30358
+ annotatePairs(currentHunk.lines);
30338
30359
  currentHunk.content = hunkLines.join("\n");
30339
30360
  hunks.push(currentHunk);
30340
30361
  }
@@ -30387,6 +30408,7 @@ function parseHunks(patch) {
30387
30408
  }
30388
30409
  }
30389
30410
  if (currentHunk) {
30411
+ annotatePairs(currentHunk.lines);
30390
30412
  currentHunk.content = hunkLines.join("\n");
30391
30413
  hunks.push(currentHunk);
30392
30414
  }
@@ -30736,7 +30758,21 @@ async function applyPatch(patch) {
30736
30758
  throw new GitError(`Failed to apply patch: ${stderr.trim()}`);
30737
30759
  }
30738
30760
  }
30739
- function buildSelectivePatch(fullPatch, lineSelections) {
30761
+ function expandForPairs(selectedIndices, hunkLines) {
30762
+ const pairsNeeded = /* @__PURE__ */ new Set();
30763
+ for (const idx of selectedIndices) {
30764
+ const pi = hunkLines[idx]?.pairIndex;
30765
+ if (pi !== void 0) pairsNeeded.add(pi);
30766
+ }
30767
+ if (pairsNeeded.size === 0) return selectedIndices;
30768
+ const expanded = new Set(selectedIndices);
30769
+ for (let i = 0; i < hunkLines.length; i++) {
30770
+ const pi = hunkLines[i].pairIndex;
30771
+ if (pi !== void 0 && pairsNeeded.has(pi)) expanded.add(i);
30772
+ }
30773
+ return expanded;
30774
+ }
30775
+ function buildSelectivePatch(fullPatch, lineSelections, parsedHunks) {
30740
30776
  const selectionMap = /* @__PURE__ */ new Map();
30741
30777
  for (const sel of lineSelections) {
30742
30778
  const existing = selectionMap.get(sel.hunkIndex);
@@ -30748,37 +30784,48 @@ function buildSelectivePatch(fullPatch, lineSelections) {
30748
30784
  }
30749
30785
  const fileDiffs = parseDiff(fullPatch);
30750
30786
  if (fileDiffs.length === 0) return "";
30787
+ const hunks = parsedHunks ?? parseHunks(fullPatch);
30751
30788
  const fullHunkIds = [];
30752
30789
  const linePatches = [];
30790
+ let globalHunkIdx = 0;
30753
30791
  for (const file of fileDiffs) {
30754
30792
  for (let i = 0; i < file.hunks.length; i++) {
30755
30793
  const hunk = file.hunks[i];
30756
- const selectedIndices = selectionMap.get(i);
30757
- if (!selectedIndices) continue;
30758
- const changeLineIndices = [];
30759
- let changeIdx = 0;
30760
- for (let li = 0; li < hunk.lines.length; li++) {
30761
- const line = hunk.lines[li];
30762
- if (line.type === "added" || line.type === "removed") {
30763
- changeIdx++;
30764
- if (selectedIndices.has(li)) {
30765
- changeLineIndices.push(changeIdx);
30766
- }
30767
- }
30768
- }
30769
- const totalChangeLines = hunk.lines.filter(
30770
- (l) => l.type === "added" || l.type === "removed"
30771
- ).length;
30772
- if (changeLineIndices.length === totalChangeLines) {
30773
- fullHunkIds.push(hunk.id);
30774
- } else if (changeLineIndices.length > 0) {
30775
- const patch = buildPatchFromLines(
30776
- fileDiffs,
30777
- hunk.id,
30778
- changeLineIndices
30779
- );
30780
- linePatches.push(patch);
30794
+ let selectedIndices = selectionMap.get(globalHunkIdx);
30795
+ if (selectedIndices) {
30796
+ const hunkFromParser = hunks.find((h) => h.index === globalHunkIdx);
30797
+ if (hunkFromParser) {
30798
+ selectedIndices = expandForPairs(
30799
+ selectedIndices,
30800
+ hunkFromParser.lines
30801
+ );
30802
+ }
30803
+ const changeLineIndices = [];
30804
+ let changeIdx = 0;
30805
+ for (let li = 0; li < hunk.lines.length; li++) {
30806
+ const line = hunk.lines[li];
30807
+ if (line.type === "added" || line.type === "removed") {
30808
+ changeIdx++;
30809
+ if (selectedIndices.has(li)) {
30810
+ changeLineIndices.push(changeIdx);
30811
+ }
30812
+ }
30813
+ }
30814
+ const totalChangeLines = hunk.lines.filter(
30815
+ (l) => l.type === "added" || l.type === "removed"
30816
+ ).length;
30817
+ if (changeLineIndices.length === totalChangeLines) {
30818
+ fullHunkIds.push(hunk.id);
30819
+ } else if (changeLineIndices.length > 0) {
30820
+ const patch = buildPatchFromLines(
30821
+ fileDiffs,
30822
+ hunk.id,
30823
+ changeLineIndices
30824
+ );
30825
+ linePatches.push(patch);
30826
+ }
30781
30827
  }
30828
+ globalHunkIdx++;
30782
30829
  }
30783
30830
  }
30784
30831
  let result = "";
@@ -30812,12 +30859,15 @@ async function stageHunks(fullPatch, hunkIndices) {
30812
30859
  }
30813
30860
  async function stageLines(fullPatch, lineSelections) {
30814
30861
  const patch = buildSelectivePatch(fullPatch, lineSelections);
30815
- if (!patch) return;
30862
+ if (!patch) return { usedFallback: false };
30816
30863
  const valid = await validatePatch(patch);
30817
30864
  if (!valid) {
30818
- throw new GitError("Generated patch is invalid");
30865
+ const affectedHunks = [...new Set(lineSelections.map((s) => s.hunkIndex))];
30866
+ await stageHunks(fullPatch, affectedHunks);
30867
+ return { usedFallback: true };
30819
30868
  }
30820
30869
  await applyPatch(patch);
30870
+ return { usedFallback: false };
30821
30871
  }
30822
30872
 
30823
30873
  // ../../packages/git/src/index.ts
@@ -30956,7 +31006,7 @@ var PlanLimitError = class extends Error {
30956
31006
  }
30957
31007
  };
30958
31008
  function createApiClient(baseUrl = DEFAULT_BASE_URL, fetchFn = fetch) {
30959
- async function request(method, path, token, body) {
31009
+ async function request(method, path, token, body, timeoutMs) {
30960
31010
  let res;
30961
31011
  try {
30962
31012
  res = await fetchFn(`${baseUrl}${path}`, {
@@ -30966,7 +31016,7 @@ function createApiClient(baseUrl = DEFAULT_BASE_URL, fetchFn = fetch) {
30966
31016
  ...token ? { Authorization: `Bearer ${token}` } : {}
30967
31017
  },
30968
31018
  ...body !== void 0 ? { body: JSON.stringify(body) } : {},
30969
- signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
31019
+ signal: AbortSignal.timeout(timeoutMs ?? FETCH_TIMEOUT_MS)
30970
31020
  });
30971
31021
  } catch (err) {
30972
31022
  if (DEBUG) console.error("[api-client] network error:", err);
@@ -30995,8 +31045,8 @@ function createApiClient(baseUrl = DEFAULT_BASE_URL, fetchFn = fetch) {
30995
31045
  return res.json();
30996
31046
  }
30997
31047
  return {
30998
- post(path, body, token) {
30999
- return request("POST", path, token, body);
31048
+ post(path, body, token, timeoutMs) {
31049
+ return request("POST", path, token, body, timeoutMs);
31000
31050
  },
31001
31051
  get(path, token) {
31002
31052
  return request("GET", path, token);
@@ -31463,12 +31513,12 @@ var loadYoga = (() => {
31463
31513
  }
31464
31514
  return d;
31465
31515
  }
31466
- var ia, ja, A, C, ka, D, E, la, ma;
31516
+ var ia, ja, A, C2, ka, D, E, la, ma;
31467
31517
  function na() {
31468
31518
  var a = fa.buffer;
31469
31519
  ia = a;
31470
31520
  h.HEAP8 = ja = new Int8Array(a);
31471
- h.HEAP16 = C = new Int16Array(a);
31521
+ h.HEAP16 = C2 = new Int16Array(a);
31472
31522
  h.HEAP32 = D = new Int32Array(a);
31473
31523
  h.HEAPU8 = A = new Uint8Array(a);
31474
31524
  h.HEAPU16 = ka = new Uint16Array(a);
@@ -31899,7 +31949,7 @@ var loadYoga = (() => {
31899
31949
  };
31900
31950
  case 1:
31901
31951
  return c ? function(d) {
31902
- return C[d >> 1];
31952
+ return C2[d >> 1];
31903
31953
  } : function(d) {
31904
31954
  return ka[d >> 1];
31905
31955
  };
@@ -31915,7 +31965,7 @@ var loadYoga = (() => {
31915
31965
  }
31916
31966
  function tb(a, b) {
31917
31967
  for (var c = "", d = 0; !(d >= b / 2); ++d) {
31918
- var e = C[a + 2 * d >> 1];
31968
+ var e = C2[a + 2 * d >> 1];
31919
31969
  if (0 == e) break;
31920
31970
  c += String.fromCharCode(e);
31921
31971
  }
@@ -31927,8 +31977,8 @@ var loadYoga = (() => {
31927
31977
  c -= 2;
31928
31978
  var d = b;
31929
31979
  c = c < 2 * a.length ? c / 2 : a.length;
31930
- for (var e = 0; e < c; ++e) C[b >> 1] = a.charCodeAt(e), b += 2;
31931
- C[b >> 1] = 0;
31980
+ for (var e = 0; e < c; ++e) C2[b >> 1] = a.charCodeAt(e), b += 2;
31981
+ C2[b >> 1] = 0;
31932
31982
  return b - d;
31933
31983
  }
31934
31984
  function vb(a) {
@@ -32182,7 +32232,7 @@ var loadYoga = (() => {
32182
32232
  argPackAdvance: 8,
32183
32233
  readValueFromPointer: function(g) {
32184
32234
  if (1 === c) var k = ja;
32185
- else if (2 === c) k = C;
32235
+ else if (2 === c) k = C2;
32186
32236
  else if (4 === c) k = D;
32187
32237
  else throw new TypeError("Unknown boolean type size: " + b);
32188
32238
  return this.fromWireType(k[g >> f]);
@@ -39162,7 +39212,7 @@ var import_react27 = __toESM(require_react(), 1);
39162
39212
  var import_react28 = __toESM(require_react(), 1);
39163
39213
 
39164
39214
  // src/commands/commit.ts
39165
- var import_react31 = __toESM(require_react(), 1);
39215
+ var import_react33 = __toESM(require_react(), 1);
39166
39216
 
39167
39217
  // src/lib/auth.ts
39168
39218
  import { mkdirSync, readFileSync as readFileSync2, rmSync, writeFileSync } from "node:fs";
@@ -39215,6 +39265,22 @@ function saveTokenToPath(path, token, expiresAt) {
39215
39265
  writeFileSync(path, JSON.stringify(data), { mode: 384 });
39216
39266
  }
39217
39267
 
39268
+ // src/lib/immersive.ts
39269
+ var ENTER_ALT = "\x1B[?1049h";
39270
+ var EXIT_ALT = "\x1B[?1049l";
39271
+ var CLEAR = "\x1B[2J\x1B[H";
39272
+ function onProcessExit() {
39273
+ process.stdout.write(EXIT_ALT);
39274
+ }
39275
+ function enterImmersive() {
39276
+ process.stdout.write(ENTER_ALT + CLEAR);
39277
+ process.once("exit", onProcessExit);
39278
+ }
39279
+ function exitImmersive() {
39280
+ process.off("exit", onProcessExit);
39281
+ process.stdout.write(EXIT_ALT);
39282
+ }
39283
+
39218
39284
  // src/lib/repo-config.ts
39219
39285
  import { readFile } from "node:fs/promises";
39220
39286
  import { join as join2 } from "node:path";
@@ -39252,30 +39318,232 @@ function Spinner({ type = "dots" }) {
39252
39318
  var build_default = Spinner;
39253
39319
 
39254
39320
  // src/ui/commit-app.tsx
39321
+ var import_react31 = __toESM(require_react(), 1);
39322
+
39323
+ // src/ui/colors.ts
39324
+ var C = {
39325
+ cyan: "#22d3ee",
39326
+ green: "#4ade80",
39327
+ yellow: "#facc15",
39328
+ red: "#f87171",
39329
+ white: "#f9fafb",
39330
+ dim: "#6b7280",
39331
+ cyanBg: "#0891b2",
39332
+ grayBg: "#374151",
39333
+ blueBg: "#1d4ed8"
39334
+ };
39335
+ var TYPE_BG = {
39336
+ feat: "#0891b2",
39337
+ fix: "#dc2626",
39338
+ refactor: "#ca8a04",
39339
+ docs: "#1d4ed8",
39340
+ test: "#7e22ce",
39341
+ chore: "#374151",
39342
+ style: "#15803d",
39343
+ ci: "#1d4ed8",
39344
+ perf: "#ca8a04",
39345
+ build: "#374151",
39346
+ revert: "#dc2626"
39347
+ };
39348
+ var TYPE_FG = {
39349
+ feat: "#000",
39350
+ fix: "#fff",
39351
+ refactor: "#000",
39352
+ docs: "#fff",
39353
+ test: "#fff",
39354
+ chore: "#fff",
39355
+ style: "#000",
39356
+ ci: "#fff",
39357
+ perf: "#000",
39358
+ build: "#fff",
39359
+ revert: "#fff"
39360
+ };
39361
+
39362
+ // src/ui/commit-utils.ts
39363
+ var TERMINAL_PHASES = [
39364
+ "done",
39365
+ "aborted",
39366
+ "error-auth",
39367
+ "error-empty",
39368
+ "error-git",
39369
+ "error-api",
39370
+ "error-commit",
39371
+ "error-plan"
39372
+ ];
39373
+ function parseCommitType(msg) {
39374
+ const match = msg.match(/^(\w+)(?:\(([^)]+)\))?!?:\s*(.+)/);
39375
+ if (!match) return { type: "chore", scope: null, description: msg };
39376
+ return { type: match[1], scope: match[2] ?? null, description: match[3] };
39377
+ }
39378
+
39379
+ // src/ui/components/diff-viewer.tsx
39255
39380
  var import_react30 = __toESM(require_react(), 1);
39381
+ var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
39382
+ function DiffViewer({ filePath, patch, onClose }) {
39383
+ const [scrollOffset, setScrollOffset] = (0, import_react30.useState)(0);
39384
+ const termHeight = process.stdout.rows || 24;
39385
+ use_input_default((input, key) => {
39386
+ if (input === "q" || input === "d" || key.escape) {
39387
+ onClose();
39388
+ return;
39389
+ }
39390
+ if (key.upArrow || input === "k") {
39391
+ setScrollOffset((prev) => Math.max(0, prev - 1));
39392
+ }
39393
+ if (key.downArrow || input === "j") {
39394
+ setScrollOffset((prev) => prev + 1);
39395
+ }
39396
+ if (input === " " || key.pageDown) {
39397
+ setScrollOffset((prev) => prev + (termHeight - 5));
39398
+ }
39399
+ if (input === "u" || key.pageUp) {
39400
+ setScrollOffset((prev) => Math.max(0, prev - (termHeight - 5)));
39401
+ }
39402
+ if (input === "g") {
39403
+ setScrollOffset(0);
39404
+ }
39405
+ });
39406
+ const allLines = patch.split("\n");
39407
+ const contentLines = [];
39408
+ for (const line of allLines) {
39409
+ if (line.startsWith("diff --git")) {
39410
+ const match = line.match(/^diff --git a\/.+ b\/(.+)$/);
39411
+ const file = match?.[1] ?? line;
39412
+ contentLines.push(`__FILE__${file}`);
39413
+ } else if (line.startsWith("index ") || line.startsWith("--- ") || line.startsWith("+++ ") || line.startsWith("old mode") || line.startsWith("new mode") || line.startsWith("new file") || line.startsWith("deleted file") || line.startsWith("similarity")) {
39414
+ } else {
39415
+ contentLines.push(line);
39416
+ }
39417
+ }
39418
+ const totalLines = contentLines.length;
39419
+ const viewportHeight = Math.max(1, termHeight - 5);
39420
+ const maxScroll = Math.max(0, totalLines - viewportHeight);
39421
+ const clamped = Math.min(scrollOffset, maxScroll);
39422
+ const visibleLines = contentLines.slice(clamped, clamped + viewportHeight);
39423
+ const scrollPercent = maxScroll > 0 ? Math.round(clamped / maxScroll * 100) : 100;
39424
+ const safeWidth = Math.max(20, (process.stdout.columns ?? 80) - 3);
39425
+ const fileCount = contentLines.filter((l) => l.startsWith("__FILE__")).length;
39426
+ const footerHints = [
39427
+ { key: "\u2191\u2193", label: "rolar" },
39428
+ { key: "space", label: "p\xE1gina" },
39429
+ { key: "g", label: "topo" },
39430
+ { key: "q", label: "sair" }
39431
+ ];
39432
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", children: [
39433
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
39434
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { backgroundColor: C.cyanBg, color: "#000", bold: true, children: [
39435
+ " ",
39436
+ "DIFF",
39437
+ " "
39438
+ ] }),
39439
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { bold: true, children: [
39440
+ " ",
39441
+ filePath,
39442
+ " "
39443
+ ] }),
39444
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.dim, children: [
39445
+ "\xB7 ",
39446
+ fileCount > 1 ? `${fileCount} arquivos \xB7 ` : "",
39447
+ totalLines,
39448
+ " linhas \xB7 ",
39449
+ scrollPercent,
39450
+ "%"
39451
+ ] })
39452
+ ] }),
39453
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: C.dim, children: "\u2500".repeat(safeWidth) }),
39454
+ visibleLines.map((line, i) => {
39455
+ const key = `dl-${clamped + i}`;
39456
+ if (line.startsWith("__FILE__")) {
39457
+ const file = line.slice(8);
39458
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", marginTop: i > 0 ? 1 : 0, children: [
39459
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: C.dim, children: "\u2500".repeat(safeWidth) }),
39460
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { gap: 1, children: [
39461
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { backgroundColor: C.blueBg, color: C.white, bold: true, children: [
39462
+ " ",
39463
+ "FILE",
39464
+ " "
39465
+ ] }),
39466
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: C.white, children: file })
39467
+ ] }),
39468
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: C.dim, children: "\u2500".repeat(safeWidth) })
39469
+ ] }, key);
39470
+ }
39471
+ const num = String(clamped + i + 1).padStart(4);
39472
+ if (line.startsWith("@@")) {
39473
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.cyan, dimColor: true, children: [
39474
+ " ",
39475
+ " ",
39476
+ line
39477
+ ] }, key);
39478
+ }
39479
+ if (line.startsWith("+")) {
39480
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.green, children: [
39481
+ num,
39482
+ " ",
39483
+ line
39484
+ ] }, key);
39485
+ }
39486
+ if (line.startsWith("-")) {
39487
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.red, children: [
39488
+ num,
39489
+ " ",
39490
+ line
39491
+ ] }, key);
39492
+ }
39493
+ if (line.startsWith("\\")) {
39494
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.dim, children: [
39495
+ " ",
39496
+ line
39497
+ ] }, key);
39498
+ }
39499
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.dim, children: [
39500
+ num,
39501
+ " ",
39502
+ line
39503
+ ] }, key);
39504
+ }),
39505
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: C.dim, children: "\u2500".repeat(safeWidth) }),
39506
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { justifyContent: "space-between", children: [
39507
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { gap: 1, flexWrap: "wrap", children: footerHints.map(({ key, label }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { gap: 0, children: [
39508
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { backgroundColor: C.grayBg, color: C.white, bold: true, children: ` ${key} ` }),
39509
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.dim, children: [
39510
+ " ",
39511
+ label,
39512
+ " "
39513
+ ] })
39514
+ ] }, key)) }),
39515
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: C.dim, children: [
39516
+ clamped + 1,
39517
+ "-",
39518
+ Math.min(clamped + viewportHeight, totalLines),
39519
+ "/",
39520
+ totalLines
39521
+ ] })
39522
+ ] })
39523
+ ] });
39524
+ }
39256
39525
 
39257
39526
  // src/ui/components/header.tsx
39258
- var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
39259
- function Header({ title = "RepoMind Split" }) {
39260
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
39261
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { gap: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { backgroundColor: "cyan", color: "black", bold: true, children: [
39262
- " ",
39263
- "\u26A1 ",
39264
- title,
39265
- " "
39266
- ] }) }),
39267
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, children: "\u2500".repeat(40) })
39527
+ var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
39528
+ function Header({ title = "repomind" }) {
39529
+ const safeWidth = Math.max(20, (process.stdout.columns ?? 80) - 3);
39530
+ const inner = `\u26A1 ${title}`;
39531
+ const padded = ` ${inner}${" ".repeat(Math.max(0, safeWidth - inner.length - 1))}`;
39532
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
39533
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { backgroundColor: C.cyanBg, color: "#000", bold: true, children: padded }),
39534
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: C.dim, children: "\u2500".repeat(safeWidth) })
39268
39535
  ] });
39269
39536
  }
39270
39537
 
39271
39538
  // src/ui/components/key-hints.tsx
39272
- var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
39539
+ var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
39273
39540
  function KeyHints({ hints }) {
39274
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { marginTop: 1, gap: 0, flexWrap: "wrap", children: [
39275
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\u2500".repeat(40) }),
39276
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { gap: 1, marginTop: 0, children: hints.map((hint) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { gap: 0, children: [
39277
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { backgroundColor: "gray", color: "white", bold: true, children: ` ${hint.key} ` }),
39278
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
39541
+ const safeWidth = Math.max(20, (process.stdout.columns ?? 80) - 3);
39542
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", marginTop: 0, children: [
39543
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: C.dim, children: "\u2500".repeat(safeWidth) }),
39544
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { gap: 1, flexWrap: "wrap", children: hints.map((hint) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { gap: 0, children: [
39545
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { backgroundColor: C.grayBg, color: C.white, bold: true, children: ` ${hint.key} ` }),
39546
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: C.dim, children: [
39279
39547
  " ",
39280
39548
  hint.label,
39281
39549
  " "
@@ -39285,107 +39553,63 @@ function KeyHints({ hints }) {
39285
39553
  }
39286
39554
 
39287
39555
  // src/ui/components/step-list.tsx
39288
- var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
39289
- var STATUS_ICONS = {
39290
- done: "\u25CF",
39291
- active: "",
39292
- pending: "\u25CB",
39293
- error: "\u2717"
39294
- };
39295
- var STATUS_COLORS = {
39296
- done: "green",
39297
- active: "cyan",
39298
- pending: void 0,
39299
- error: "red"
39300
- };
39556
+ var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
39301
39557
  function StepList({ steps }) {
39302
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { flexDirection: "column", gap: 0, marginLeft: 1, children: steps.map((step, idx) => {
39558
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { flexDirection: "column", gap: 0, marginLeft: 1, children: steps.map((step, idx) => {
39303
39559
  const isLast = idx === steps.length - 1;
39304
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
39305
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { gap: 1, children: [
39306
- step.status === "active" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: "cyan", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(build_default, { type: "dots" }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
39307
- Text,
39308
- {
39309
- color: STATUS_COLORS[step.status],
39310
- dimColor: step.status === "pending",
39311
- children: STATUS_ICONS[step.status]
39312
- }
39313
- ),
39314
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
39560
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", children: [
39561
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { gap: 1, children: [
39562
+ step.status === "active" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(build_default, { type: "dots" }) }) : step.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.green, children: "\u25CF" }) : step.status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.red, children: "\u2717" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.dim, children: "\u25CB" }),
39563
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
39315
39564
  Text,
39316
39565
  {
39317
- color: STATUS_COLORS[step.status],
39318
- dimColor: step.status === "pending",
39566
+ color: step.status === "done" ? C.green : step.status === "active" ? C.cyan : step.status === "error" ? C.red : C.dim,
39319
39567
  bold: step.status === "active",
39320
39568
  children: step.label
39321
39569
  }
39322
39570
  ),
39323
- step.detail && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: true, children: [
39571
+ step.detail && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: C.dim, children: [
39324
39572
  "\xB7 ",
39325
39573
  step.detail
39326
39574
  ] })
39327
39575
  ] }),
39328
- !isLast && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { marginLeft: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "\u2502" }) })
39576
+ !isLast && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { marginLeft: 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: C.dim, children: "\u2502" }) })
39329
39577
  ] }, step.label);
39330
39578
  }) });
39331
39579
  }
39332
39580
 
39333
39581
  // src/ui/components/type-badge.tsx
39334
- var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
39335
- var TYPE_STYLES = {
39336
- feat: { bg: "cyan", fg: "black" },
39337
- fix: { bg: "red", fg: "white" },
39338
- refactor: { bg: "yellow", fg: "black" },
39339
- docs: { bg: "blue", fg: "white" },
39340
- test: { bg: "magenta", fg: "white" },
39341
- chore: { bg: "gray", fg: "white" },
39342
- style: { bg: "green", fg: "black" },
39343
- ci: { bg: "blue", fg: "white" },
39344
- perf: { bg: "yellow", fg: "black" },
39345
- build: { bg: "gray", fg: "white" },
39346
- revert: { bg: "red", fg: "white" }
39347
- };
39582
+ var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
39348
39583
  function TypeBadge({ type }) {
39349
- const style = TYPE_STYLES[type] ?? { bg: "gray", fg: "white" };
39350
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { backgroundColor: style.bg, color: style.fg, bold: true, children: ` ${type} ` });
39584
+ const bg = TYPE_BG[type] ?? "#374151";
39585
+ const fg = TYPE_FG[type] ?? "#fff";
39586
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { backgroundColor: bg, color: fg, bold: true, children: ` ${type} ` });
39351
39587
  }
39352
39588
 
39353
39589
  // src/ui/commit-app.tsx
39354
- var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
39355
- var TERMINAL_PHASES = [
39356
- "done",
39357
- "aborted",
39358
- "error-auth",
39359
- "error-empty",
39360
- "error-git",
39361
- "error-api",
39362
- "error-commit",
39363
- "error-plan"
39364
- ];
39365
- function parseCommitType(msg) {
39366
- const match = msg.match(/^(\w+)(?:\(([^)]+)\))?!?:\s*(.+)/);
39367
- if (!match) return { type: "chore", scope: null, description: msg };
39368
- return { type: match[1], scope: match[2] ?? null, description: match[3] };
39369
- }
39590
+ var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
39370
39591
  function CommitApp({
39371
39592
  deps,
39372
39593
  onExit
39373
39594
  }) {
39374
39595
  const { exit } = use_app_default();
39375
- const [phase, setPhase] = (0, import_react30.useState)("analyzing");
39376
- const [message, setMessage] = (0, import_react30.useState)("");
39377
- const [issueRef, setIssueRef] = (0, import_react30.useState)("");
39378
- const [errorMsg, setErrorMsg] = (0, import_react30.useState)("");
39379
- const [fileCount, setFileCount] = (0, import_react30.useState)(0);
39380
- const [additions, setAdditions] = (0, import_react30.useState)(0);
39381
- const [deletions, setDeletions] = (0, import_react30.useState)(0);
39382
- (0, import_react30.useEffect)(() => {
39596
+ const committedMessageRef = (0, import_react31.useRef)("");
39597
+ const [phase, setPhase] = (0, import_react31.useState)("analyzing");
39598
+ const [message, setMessage] = (0, import_react31.useState)("");
39599
+ const [issueRef, setIssueRef] = (0, import_react31.useState)("");
39600
+ const [errorMsg, setErrorMsg] = (0, import_react31.useState)("");
39601
+ const [fileCount, setFileCount] = (0, import_react31.useState)(0);
39602
+ const [additions, setAdditions] = (0, import_react31.useState)(0);
39603
+ const [deletions, setDeletions] = (0, import_react31.useState)(0);
39604
+ const [rawDiff, setRawDiff] = (0, import_react31.useState)("");
39605
+ const [editBuffer, setEditBuffer] = (0, import_react31.useState)("");
39606
+ (0, import_react31.useEffect)(() => {
39383
39607
  if (!TERMINAL_PHASES.includes(phase)) return;
39384
39608
  const code = phase === "done" || phase === "aborted" ? 0 : 1;
39385
39609
  exit();
39386
- onExit(code);
39610
+ onExit(code, phase === "done" ? committedMessageRef.current : void 0);
39387
39611
  }, [phase]);
39388
- (0, import_react30.useEffect)(() => {
39612
+ (0, import_react31.useEffect)(() => {
39389
39613
  async function run2() {
39390
39614
  const token = deps.readToken();
39391
39615
  if (!token) {
@@ -39413,6 +39637,7 @@ function CommitApp({
39413
39637
  setFileCount(changes.files.length);
39414
39638
  setAdditions(changes.files.reduce((s, f) => s + f.additions, 0));
39415
39639
  setDeletions(changes.files.reduce((s, f) => s + f.deletions, 0));
39640
+ setRawDiff(changes.rawDiff);
39416
39641
  setPhase("generating");
39417
39642
  try {
39418
39643
  const stagedFiles = await deps.readStagedFiles(changes.files);
@@ -39475,6 +39700,16 @@ ${issueRef.trim()}`);
39475
39700
  use_input_default(
39476
39701
  async (input, key) => {
39477
39702
  if (phase !== "confirm") return;
39703
+ const parsed2 = parseCommitType(message);
39704
+ if (input === "e") {
39705
+ setEditBuffer(parsed2.description);
39706
+ setPhase("editing");
39707
+ return;
39708
+ }
39709
+ if (input === "d") {
39710
+ setPhase("viewing-diff");
39711
+ return;
39712
+ }
39478
39713
  const confirmed = key.return || input.toLowerCase() === "y" || input === "";
39479
39714
  const denied = input.toLowerCase() === "n";
39480
39715
  if (confirmed) {
@@ -39484,6 +39719,7 @@ ${issueRef.trim()}`);
39484
39719
  setErrorMsg("git commit falhou. Verifique os hooks do reposit\xF3rio.");
39485
39720
  setPhase("error-commit");
39486
39721
  } else {
39722
+ committedMessageRef.current = message;
39487
39723
  setPhase("done");
39488
39724
  }
39489
39725
  } else if (denied) {
@@ -39492,6 +39728,44 @@ ${issueRef.trim()}`);
39492
39728
  },
39493
39729
  { isActive: phase === "confirm" }
39494
39730
  );
39731
+ use_input_default(
39732
+ (input, key) => {
39733
+ if (key.return) {
39734
+ const parsed2 = parseCommitType(message);
39735
+ const newMsg = parsed2.scope ? `${parsed2.type}(${parsed2.scope}): ${editBuffer}` : `${parsed2.type}: ${editBuffer}`;
39736
+ const bodyParts = message.split("\n\n").slice(1);
39737
+ setMessage(
39738
+ bodyParts.length > 0 ? `${newMsg}
39739
+
39740
+ ${bodyParts.join("\n\n")}` : newMsg
39741
+ );
39742
+ setPhase("confirm");
39743
+ return;
39744
+ }
39745
+ if (key.escape) {
39746
+ setPhase("confirm");
39747
+ return;
39748
+ }
39749
+ if (key.backspace || key.delete) {
39750
+ setEditBuffer((prev) => prev.slice(0, -1));
39751
+ return;
39752
+ }
39753
+ if (input && !key.ctrl && !key.meta) {
39754
+ setEditBuffer((prev) => prev + input);
39755
+ }
39756
+ },
39757
+ { isActive: phase === "editing" }
39758
+ );
39759
+ if (phase === "viewing-diff") {
39760
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
39761
+ DiffViewer,
39762
+ {
39763
+ filePath: `${fileCount} arquivo${fileCount !== 1 ? "s" : ""}`,
39764
+ patch: rawDiff,
39765
+ onClose: () => setPhase("confirm")
39766
+ }
39767
+ );
39768
+ }
39495
39769
  const steps = [];
39496
39770
  const phaseOrder = [
39497
39771
  "analyzing",
@@ -39512,35 +39786,35 @@ ${issueRef.trim()}`);
39512
39786
  status: phase === "generating" ? "active" : phaseIdx > 1 || TERMINAL_PHASES.includes(phase) ? message ? "done" : phase.startsWith("error") ? "error" : "pending" : "pending"
39513
39787
  });
39514
39788
  const parsed = parseCommitType(message);
39515
- const hasMessage = phase === "link-issue" || phase === "confirm" || phase === "committing" || phase === "done" || phase === "aborted";
39516
- const commitCard = hasMessage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
39789
+ const hasMessage = phase === "link-issue" || phase === "confirm" || phase === "editing" || phase === "committing" || phase === "done" || phase === "aborted";
39790
+ const commitCard = hasMessage ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
39517
39791
  Box_default,
39518
39792
  {
39519
- borderStyle: "bold",
39520
- borderColor: phase === "done" ? "green" : "cyan",
39521
- paddingX: 2,
39522
- paddingY: 1,
39793
+ borderStyle: "round",
39794
+ borderColor: phase === "confirm" || phase === "editing" || phase === "committing" || phase === "done" ? C.green : C.cyan,
39795
+ paddingX: 1,
39796
+ paddingY: 0,
39523
39797
  flexDirection: "column",
39524
39798
  children: [
39525
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { gap: 1, marginBottom: message.includes("\n\n") ? 1 : 0, children: [
39526
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TypeBadge, { type: parsed.type }),
39527
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: parsed.description })
39799
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, alignItems: "center", children: [
39800
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TypeBadge, { type: parsed.type }),
39801
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: parsed.description })
39528
39802
  ] }),
39529
- parsed.scope && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginBottom: message.includes("\n\n") ? 0 : 0, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { dimColor: true, children: [
39803
+ parsed.scope && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.dim, children: [
39530
39804
  "scope: ",
39531
39805
  parsed.scope
39532
39806
  ] }) }),
39533
- message.includes("\n\n") && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: message.split("\n\n").slice(1).join("\n\n") }) }),
39534
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginTop: 1, gap: 1, children: [
39535
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: "green", bold: true, children: [
39807
+ message.includes("\n\n") && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.dim, children: message.split("\n\n").slice(1).join("\n\n") }) }),
39808
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, children: [
39809
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.green, bold: true, children: [
39536
39810
  "+",
39537
39811
  additions
39538
39812
  ] }),
39539
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: "red", bold: true, children: [
39813
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.red, bold: true, children: [
39540
39814
  "-",
39541
39815
  deletions
39542
39816
  ] }),
39543
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { dimColor: true, children: [
39817
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: C.dim, children: [
39544
39818
  "\xB7 ",
39545
39819
  fileCount,
39546
39820
  " arquivos"
@@ -39549,74 +39823,133 @@ ${issueRef.trim()}`);
39549
39823
  ]
39550
39824
  }
39551
39825
  ) }) : null;
39552
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", children: [
39553
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Header, { title: "RepoMind Commit" }),
39554
- !hasMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StepList, { steps }),
39555
- commitCard,
39556
- phase === "link-issue" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { gap: 1, children: [
39557
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { backgroundColor: "blue", color: "white", bold: true, children: [
39558
- " ",
39559
- "?",
39560
- " "
39561
- ] }),
39562
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: " Link issue " }),
39563
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "cyan", children: issueRef }),
39564
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "cyan", children: "\u258C" }),
39565
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: " (ex: Closes #42, Enter para pular)" })
39566
- ] }),
39567
- phase === "confirm" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { gap: 1, children: [
39568
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { backgroundColor: "cyan", color: "black", bold: true, children: [
39569
- " ",
39570
- "?",
39571
- " "
39572
- ] }),
39573
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: " Confirmar este commit? " }),
39574
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: "[Y/n]" })
39575
- ] }),
39576
- phase === "committing" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { gap: 1, children: [
39577
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "cyan", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(build_default, { type: "dots" }) }),
39578
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: "Fazendo commit..." })
39579
- ] }),
39580
- phase === "done" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { gap: 1, children: [
39581
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "green", children: "\u2728" }),
39582
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: "Commit realizado com sucesso" })
39583
- ] }),
39584
- phase === "aborted" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { gap: 1, children: [
39585
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: "\u25C6" }),
39586
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: "Abortado. Nenhum commit foi feito." })
39587
- ] }),
39588
- phase === "error-empty" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
39589
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { gap: 1, children: [
39590
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: "\u25B2" }),
39591
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: errorMsg })
39826
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
39827
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Header, { title: "repomind commit" }),
39828
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
39829
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StepList, { steps }),
39830
+ commitCard,
39831
+ phase === "link-issue" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, children: [
39832
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { backgroundColor: C.blueBg, color: C.white, bold: true, children: [
39833
+ " ",
39834
+ "?",
39835
+ " "
39836
+ ] }),
39837
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: " Link issue " }),
39838
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.cyan, children: issueRef }),
39839
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.cyan, children: "\u258C" }),
39840
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.dim, children: " (ex: Closes #42, Enter para pular)" })
39592
39841
  ] }),
39593
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
39842
+ phase === "confirm" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
39594
39843
  KeyHints,
39595
39844
  {
39596
39845
  hints: [
39597
- { key: "git add .", label: "stage todos os arquivos" },
39598
- { key: "git add -p", label: "stage interativo" }
39846
+ { key: "enter", label: "confirmar" },
39847
+ { key: "e", label: "editar" },
39848
+ { key: "d", label: "diff" },
39849
+ { key: "n", label: "cancelar" }
39599
39850
  ]
39600
39851
  }
39601
- )
39602
- ] }),
39603
- (phase === "error-auth" || phase === "error-git" || phase === "error-api" || phase === "error-commit") && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { gap: 1, children: [
39604
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "red", children: "\u2717" }),
39605
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "red", children: errorMsg })
39606
- ] }) }),
39607
- phase === "error-plan" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
39608
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { gap: 1, children: [
39609
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: "\u25B2" }),
39610
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: errorMsg.split("\n")[0] })
39852
+ ),
39853
+ phase === "editing" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, marginTop: 1, children: [
39854
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.cyan, children: "Editar:" }),
39855
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.cyan, children: editBuffer }),
39856
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.cyan, children: "\u258C" }),
39857
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.dim, children: "(Enter salvar, Esc cancelar)" })
39858
+ ] }),
39859
+ phase === "committing" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, children: [
39860
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(build_default, { type: "dots" }) }),
39861
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.dim, children: "Fazendo commit..." })
39862
+ ] }),
39863
+ phase === "done" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, children: [
39864
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.green, children: "\u2728" }),
39865
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: "Commit realizado com sucesso" })
39866
+ ] }),
39867
+ phase === "aborted" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, children: [
39868
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.yellow, children: "\u25C6" }),
39869
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.dim, children: "Abortado. Nenhum commit foi feito." })
39870
+ ] }),
39871
+ phase === "error-empty" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
39872
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, children: [
39873
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.yellow, children: "\u25B2" }),
39874
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.yellow, children: errorMsg })
39875
+ ] }),
39876
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
39877
+ KeyHints,
39878
+ {
39879
+ hints: [
39880
+ { key: "git add .", label: "stage todos os arquivos" },
39881
+ { key: "git add -p", label: "stage interativo" }
39882
+ ]
39883
+ }
39884
+ )
39611
39885
  ] }),
39612
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: errorMsg.split("\n")[1] }) })
39886
+ (phase === "error-auth" || phase === "error-git" || phase === "error-api" || phase === "error-commit") && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, children: [
39887
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.red, children: "\u2717" }),
39888
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.red, children: errorMsg })
39889
+ ] }) }),
39890
+ phase === "error-plan" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
39891
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, children: [
39892
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.yellow, children: "\u25B2" }),
39893
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.yellow, children: errorMsg.split("\n")[0] })
39894
+ ] }),
39895
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: C.dim, children: errorMsg.split("\n")[1] }) })
39896
+ ] })
39613
39897
  ] })
39614
39898
  ] });
39615
39899
  }
39616
39900
 
39617
- // src/commands/commit.ts
39618
- async function runGitCommit(message) {
39619
- const proc = Bun.spawn(["git", "commit", "-m", message], {
39901
+ // src/ui/done-summary.tsx
39902
+ var import_react32 = __toESM(require_react(), 1);
39903
+ var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
39904
+ function parseType(msg) {
39905
+ const match = msg.match(/^(\w+)(?:\([^)]+\))?!?:\s*(.+)/);
39906
+ return { type: match?.[1] ?? "chore", description: match?.[2] ?? msg };
39907
+ }
39908
+ function SplitDoneSummary({ commits }) {
39909
+ const { exit } = use_app_default();
39910
+ (0, import_react32.useEffect)(() => {
39911
+ exit();
39912
+ }, []);
39913
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
39914
+ commits.map((msg, i) => {
39915
+ const { type, description } = parseType(msg);
39916
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
39917
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { gap: 1, alignItems: "center", children: [
39918
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.green, children: "\u2713" }),
39919
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TypeBadge, { type }),
39920
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.green, children: description })
39921
+ ] }),
39922
+ i < commits.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.dim, children: "\u2502" })
39923
+ ] }, `${i}-${msg}`);
39924
+ }),
39925
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { marginTop: 1, gap: 1, children: [
39926
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.green, children: "\u2728" }),
39927
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { bold: true, color: C.green, children: [
39928
+ commits.length,
39929
+ " commit",
39930
+ commits.length !== 1 ? "s" : "",
39931
+ " realizado",
39932
+ commits.length !== 1 ? "s" : ""
39933
+ ] })
39934
+ ] })
39935
+ ] });
39936
+ }
39937
+ function CommitDoneSummary({ message }) {
39938
+ const { exit } = use_app_default();
39939
+ (0, import_react32.useEffect)(() => {
39940
+ exit();
39941
+ }, []);
39942
+ const { type, description } = parseType(message);
39943
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { paddingLeft: 1, gap: 1, alignItems: "center", children: [
39944
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.green, children: "\u2713" }),
39945
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TypeBadge, { type }),
39946
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.green, children: description })
39947
+ ] });
39948
+ }
39949
+
39950
+ // src/commands/commit.ts
39951
+ async function runGitCommit(message) {
39952
+ const proc = Bun.spawn(["git", "commit", "-m", message], {
39620
39953
  stdout: "inherit",
39621
39954
  stderr: "inherit"
39622
39955
  });
@@ -39625,8 +39958,10 @@ async function runGitCommit(message) {
39625
39958
  async function commitCommand() {
39626
39959
  const fileConfig = await readRepoConfig();
39627
39960
  let exitCode = 0;
39961
+ let completedMessage = "";
39962
+ enterImmersive();
39628
39963
  const { waitUntilExit } = render_default(
39629
- import_react31.default.createElement(CommitApp, {
39964
+ import_react33.default.createElement(CommitApp, {
39630
39965
  deps: {
39631
39966
  readToken,
39632
39967
  getStagedChanges,
@@ -39635,107 +39970,107 @@ async function commitCommand() {
39635
39970
  runGitCommit,
39636
39971
  fileConfig
39637
39972
  },
39638
- onExit: (code) => {
39973
+ onExit: (code, message) => {
39639
39974
  exitCode = code;
39975
+ completedMessage = message ?? "";
39640
39976
  }
39641
39977
  })
39642
39978
  );
39643
39979
  await waitUntilExit();
39980
+ exitImmersive();
39981
+ if (completedMessage) {
39982
+ const { waitUntilExit: waitUntilExit2 } = render_default(
39983
+ import_react33.default.createElement(CommitDoneSummary, { message: completedMessage })
39984
+ );
39985
+ await waitUntilExit2();
39986
+ }
39644
39987
  process.exit(exitCode);
39645
39988
  }
39646
39989
 
39647
39990
  // src/commands/help.tsx
39648
- var import_react32 = __toESM(require_react(), 1);
39649
- var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
39991
+ var import_react34 = __toESM(require_react(), 1);
39992
+ var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
39650
39993
  var COMMANDS = [
39651
39994
  {
39652
39995
  name: "commit",
39653
39996
  description: "Gerar mensagem de commit com IA",
39654
39997
  icon: "\u2726",
39655
- color: "cyan"
39998
+ color: C.cyan
39656
39999
  },
39657
40000
  {
39658
40001
  name: "split",
39659
40002
  description: "Dividir altera\xE7\xF5es em commits at\xF4micos",
39660
40003
  icon: "\u25C8",
39661
- color: "magenta"
40004
+ color: "#c084fc"
39662
40005
  },
39663
40006
  {
39664
40007
  name: "login",
39665
40008
  description: "Autenticar com sua conta RepoMind",
39666
40009
  icon: "\u2192",
39667
- color: "green"
40010
+ color: C.green
39668
40011
  },
39669
40012
  {
39670
40013
  name: "logout",
39671
40014
  description: "Encerrar sess\xE3o atual",
39672
40015
  icon: "\u2190",
39673
- color: "yellow"
40016
+ color: C.yellow
39674
40017
  },
39675
40018
  {
39676
40019
  name: "whoami",
39677
40020
  description: "Exibir usu\xE1rio autenticado",
39678
40021
  icon: "\u25CF",
39679
- color: "blue"
40022
+ color: C.dim
39680
40023
  }
39681
40024
  ];
39682
40025
  function HelpApp() {
39683
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
39684
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Header, { title: "RepoMind" }),
39685
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { flexDirection: "column", gap: 0, marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { paddingLeft: 1, gap: 1, children: [
39686
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: "Uso:" }),
39687
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: "repomind" }),
39688
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "cyan", children: "<comando>" }),
39689
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: "[op\xE7\xF5es]" })
40026
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", children: [
40027
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Header, { title: "RepoMind" }),
40028
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { flexDirection: "column", gap: 0, marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { paddingLeft: 1, gap: 1, children: [
40029
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.dim, children: "Uso:" }),
40030
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { bold: true, children: "repomind" }),
40031
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.cyan, children: "<comando>" }),
40032
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.dim, children: "[op\xE7\xF5es]" })
39690
40033
  ] }) }),
39691
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
40034
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
39692
40035
  Box_default,
39693
40036
  {
39694
40037
  flexDirection: "column",
39695
40038
  paddingLeft: 1,
39696
40039
  marginBottom: 1,
39697
40040
  borderStyle: "round",
39698
- borderColor: "gray",
40041
+ borderColor: C.dim,
39699
40042
  paddingX: 2,
39700
- paddingY: 1,
39701
- children: COMMANDS.map((cmd, idx) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
39702
- Box_default,
39703
- {
39704
- gap: 1,
39705
- marginBottom: idx < COMMANDS.length - 1 ? 0 : 0,
39706
- children: [
39707
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: cmd.color, children: cmd.icon }),
39708
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { width: 10, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, color: cmd.color, children: cmd.name }) }),
39709
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: cmd.description })
39710
- ]
39711
- },
39712
- cmd.name
39713
- ))
40043
+ paddingY: 0,
40044
+ children: COMMANDS.map((cmd) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { gap: 1, children: [
40045
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: cmd.color, children: cmd.icon }),
40046
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { width: 10, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { bold: true, color: cmd.color, children: cmd.name }) }),
40047
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.dim, children: cmd.description })
40048
+ ] }, cmd.name))
39714
40049
  }
39715
40050
  ),
39716
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { paddingLeft: 1, flexDirection: "column", gap: 0, children: [
39717
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, children: [
39718
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { backgroundColor: "gray", color: "white", bold: true, children: [
40051
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { paddingLeft: 1, flexDirection: "column", gap: 0, children: [
40052
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { gap: 1, children: [
40053
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { backgroundColor: C.grayBg, color: C.white, bold: true, children: [
39719
40054
  " ",
39720
40055
  "--version",
39721
40056
  " "
39722
40057
  ] }),
39723
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: "Exibir vers\xE3o instalada" })
40058
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.dim, children: "Exibir vers\xE3o instalada" })
39724
40059
  ] }),
39725
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { gap: 1, children: [
39726
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { backgroundColor: "gray", color: "white", bold: true, children: [
40060
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { gap: 1, children: [
40061
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { backgroundColor: C.grayBg, color: C.white, bold: true, children: [
39727
40062
  " ",
39728
40063
  "--verbose",
39729
40064
  " "
39730
40065
  ] }),
39731
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: "Exibir detalhes de erro" })
40066
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.dim, children: "Exibir detalhes de erro" })
39732
40067
  ] })
39733
40068
  ] }),
39734
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { marginTop: 1, paddingLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: "Docs: https://repomind.dev \xB7 Dashboard: https://app.repomind.dev" }) })
40069
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginTop: 1, paddingLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: C.dim, children: "Docs: https://repomind.dev \xB7 Dashboard: https://app.repomind.dev" }) })
39735
40070
  ] });
39736
40071
  }
39737
40072
  async function helpCommand() {
39738
- const { waitUntilExit } = render_default(import_react32.default.createElement(HelpApp));
40073
+ const { waitUntilExit } = render_default(import_react34.default.createElement(HelpApp));
39739
40074
  setTimeout(() => process.exit(0), 50);
39740
40075
  await waitUntilExit();
39741
40076
  }
@@ -39826,11 +40161,11 @@ async function openBrowser(url) {
39826
40161
  }
39827
40162
 
39828
40163
  // src/commands/login.ts
39829
- var import_react34 = __toESM(require_react(), 1);
40164
+ var import_react36 = __toESM(require_react(), 1);
39830
40165
 
39831
40166
  // src/ui/login-app.tsx
39832
- var import_react33 = __toESM(require_react(), 1);
39833
- var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
40167
+ var import_react35 = __toESM(require_react(), 1);
40168
+ var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
39834
40169
  var TERMINAL_PHASES2 = [
39835
40170
  "done",
39836
40171
  "error-timeout",
@@ -39843,17 +40178,17 @@ function LoginApp({
39843
40178
  onExit
39844
40179
  }) {
39845
40180
  const { exit } = use_app_default();
39846
- const [phase, setPhase] = (0, import_react33.useState)("opening");
39847
- const [authUrl, setAuthUrl] = (0, import_react33.useState)("");
39848
- const [email, setEmail] = (0, import_react33.useState)("");
39849
- const [errorMsg, setErrorMsg] = (0, import_react33.useState)("");
39850
- (0, import_react33.useEffect)(() => {
40181
+ const [phase, setPhase] = (0, import_react35.useState)("opening");
40182
+ const [authUrl, setAuthUrl] = (0, import_react35.useState)("");
40183
+ const [email, setEmail] = (0, import_react35.useState)("");
40184
+ const [errorMsg, setErrorMsg] = (0, import_react35.useState)("");
40185
+ (0, import_react35.useEffect)(() => {
39851
40186
  if (!TERMINAL_PHASES2.includes(phase)) return;
39852
40187
  const code = phase === "done" ? 0 : 1;
39853
40188
  exit();
39854
40189
  onExit(code);
39855
40190
  }, [phase]);
39856
- (0, import_react33.useEffect)(() => {
40191
+ (0, import_react35.useEffect)(() => {
39857
40192
  async function run2() {
39858
40193
  const port = await deps.getAvailablePort();
39859
40194
  const baseUrl = "https://repomind.dev";
@@ -39894,37 +40229,37 @@ function LoginApp({
39894
40229
  }
39895
40230
  run2();
39896
40231
  }, []);
39897
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", gap: 0, paddingTop: 1, children: [
39898
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "cyan", children: "RepoMind Login" }) }),
39899
- phase === "opening" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { gap: 1, children: [
39900
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(build_default, { type: "dots" }) }),
39901
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "Abrindo browser..." })
40232
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", gap: 0, paddingTop: 1, children: [
40233
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { bold: true, color: C.cyan, children: "RepoMind Login" }) }),
40234
+ phase === "opening" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { gap: 1, children: [
40235
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(build_default, { type: "dots" }) }),
40236
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.dim, children: "Abrindo browser..." })
39902
40237
  ] }),
39903
- authUrl !== "" && phase !== "opening" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
39904
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "Se n\xE3o abrir automaticamente, acesse:" }),
39905
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "blue", children: authUrl })
40238
+ authUrl !== "" && phase !== "opening" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
40239
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.dim, children: "Se n\xE3o abrir automaticamente, acesse:" }),
40240
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.cyan, children: authUrl })
39906
40241
  ] }),
39907
- phase === "waiting" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { gap: 1, children: [
39908
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(build_default, { type: "dots" }) }),
39909
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "Aguardando autentica\xE7\xE3o no browser..." })
40242
+ phase === "waiting" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { gap: 1, children: [
40243
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(build_default, { type: "dots" }) }),
40244
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.dim, children: "Aguardando autentica\xE7\xE3o no browser..." })
39910
40245
  ] }),
39911
- phase === "exchanging" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { gap: 1, children: [
39912
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(build_default, { type: "dots" }) }),
39913
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: "Validando credenciais..." })
40246
+ phase === "exchanging" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { gap: 1, children: [
40247
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(build_default, { type: "dots" }) }),
40248
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.dim, children: "Validando credenciais..." })
39914
40249
  ] }),
39915
- phase === "done" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { gap: 1, children: [
39916
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "green", children: "\u2713" }),
39917
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
40250
+ phase === "done" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { gap: 1, children: [
40251
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.green, children: "\u2713" }),
40252
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { children: [
39918
40253
  "Autenticado como",
39919
40254
  " ",
39920
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "white", children: email })
40255
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { bold: true, color: C.white, children: email })
39921
40256
  ] })
39922
40257
  ] }),
39923
- (phase === "error-timeout" || phase === "error-auth" || phase === "error-api") && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { gap: 1, children: [
39924
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "red", children: "\u2717" }),
39925
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "red", children: errorMsg })
40258
+ (phase === "error-timeout" || phase === "error-auth" || phase === "error-api") && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { gap: 1, children: [
40259
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.red, children: "\u2717" }),
40260
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: C.red, children: errorMsg })
39926
40261
  ] }),
39927
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { marginTop: 1 })
40262
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginTop: 1 })
39928
40263
  ] });
39929
40264
  }
39930
40265
 
@@ -39934,7 +40269,7 @@ var apiClient2 = createApiClient();
39934
40269
  async function loginCommand() {
39935
40270
  let exitCode = 0;
39936
40271
  const { waitUntilExit } = render_default(
39937
- import_react34.default.createElement(LoginApp, {
40272
+ import_react36.default.createElement(LoginApp, {
39938
40273
  deps: {
39939
40274
  getAvailablePort,
39940
40275
  startCallbackServer,
@@ -39953,29 +40288,29 @@ async function loginCommand() {
39953
40288
  }
39954
40289
 
39955
40290
  // src/commands/logout.tsx
39956
- var import_react35 = __toESM(require_react(), 1);
39957
- var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
40291
+ var import_react37 = __toESM(require_react(), 1);
40292
+ var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
39958
40293
  function LogoutApp({ onExit }) {
39959
40294
  const wasLoggedIn = readToken() !== null;
39960
40295
  const deleted = deleteToken();
39961
- (0, import_react35.useEffect)(() => {
40296
+ (0, import_react37.useEffect)(() => {
39962
40297
  onExit(0);
39963
40298
  }, [onExit]);
39964
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, marginBottom: 1, children: [
39965
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { bold: true, color: "cyan", children: "RepoMind Logout" }) }),
39966
- wasLoggedIn && deleted ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { gap: 1, children: [
39967
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "green", children: "\u2713" }),
39968
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: "Sess\xE3o encerrada com sucesso." })
39969
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { gap: 1, children: [
39970
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "yellow", children: "\u25C6" }),
39971
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { dimColor: true, children: "Nenhuma sess\xE3o ativa." })
40299
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, marginBottom: 1, children: [
40300
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { bold: true, color: C.cyan, children: "RepoMind Logout" }) }),
40301
+ wasLoggedIn && deleted ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { gap: 1, children: [
40302
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.green, children: "\u2713" }),
40303
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: "Sess\xE3o encerrada com sucesso." })
40304
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { gap: 1, children: [
40305
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.yellow, children: "\u25C6" }),
40306
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: C.dim, children: "Nenhuma sess\xE3o ativa." })
39972
40307
  ] })
39973
40308
  ] });
39974
40309
  }
39975
40310
  async function logoutCommand() {
39976
40311
  let exitCode = 0;
39977
40312
  const { waitUntilExit } = render_default(
39978
- import_react35.default.createElement(LogoutApp, {
40313
+ import_react37.default.createElement(LogoutApp, {
39979
40314
  onExit: (code) => {
39980
40315
  exitCode = code;
39981
40316
  }
@@ -39985,27 +40320,260 @@ async function logoutCommand() {
39985
40320
  process.exit(exitCode);
39986
40321
  }
39987
40322
 
39988
- // src/commands/split.ts
40323
+ // src/commands/pr.ts
40324
+ var import_react39 = __toESM(require_react(), 1);
40325
+
40326
+ // src/ui/pr-app.tsx
39989
40327
  var import_react38 = __toESM(require_react(), 1);
40328
+ var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
40329
+ var TERMINAL_PHASES3 = [
40330
+ "aborted",
40331
+ "error-auth",
40332
+ "error-api",
40333
+ "error-git",
40334
+ "error-plan"
40335
+ ];
40336
+ function PrApp({
40337
+ deps,
40338
+ onExit
40339
+ }) {
40340
+ const { exit } = use_app_default();
40341
+ const [phase, setPhase] = (0, import_react38.useState)("collecting");
40342
+ const [prTitle, setPrTitle] = (0, import_react38.useState)("");
40343
+ const [prBody, setPrBody] = (0, import_react38.useState)("");
40344
+ const [errorMsg, setErrorMsg] = (0, import_react38.useState)("");
40345
+ (0, import_react38.useEffect)(() => {
40346
+ if (!TERMINAL_PHASES3.includes(phase) && phase !== "copied" && phase !== "aborted")
40347
+ return;
40348
+ const code = phase === "copied" || phase === "aborted" ? 0 : 1;
40349
+ exit();
40350
+ onExit(code);
40351
+ }, [phase]);
40352
+ (0, import_react38.useEffect)(() => {
40353
+ async function run2() {
40354
+ const token = deps.readToken();
40355
+ if (!token) {
40356
+ setErrorMsg("N\xE3o autenticado. Execute repomind login primeiro.");
40357
+ setPhase("error-auth");
40358
+ return;
40359
+ }
40360
+ let diff2;
40361
+ try {
40362
+ diff2 = await deps.getDiffBetweenBranches();
40363
+ } catch (e) {
40364
+ const msg = e instanceof Error ? e.message : "Erro ao obter diff entre branches.";
40365
+ setErrorMsg(msg);
40366
+ setPhase("error-git");
40367
+ return;
40368
+ }
40369
+ if (!diff2 || diff2.trim() === "") {
40370
+ setErrorMsg(
40371
+ "Nenhuma diferen\xE7a encontrada entre esta branch e a base (main/master)."
40372
+ );
40373
+ setPhase("error-git");
40374
+ return;
40375
+ }
40376
+ setPhase("generating");
40377
+ try {
40378
+ const result = await deps.apiPost(
40379
+ "/pr/generate",
40380
+ { diff: diff2 },
40381
+ token
40382
+ );
40383
+ setPrTitle(result.title);
40384
+ setPrBody(result.body);
40385
+ setPhase("result");
40386
+ } catch (e) {
40387
+ if (e instanceof PlanLimitError) {
40388
+ setErrorMsg(
40389
+ `Limite do plano ${e.plan === "free" ? "Free" : "Pro"} atingido (${e.used}/${e.limit} commits este m\xEAs)
40390
+ \u2192 Fa\xE7a upgrade em https://app.repomind.dev/pricing`
40391
+ );
40392
+ setPhase("error-plan");
40393
+ } else if (e instanceof ApiError && e.status === 401) {
40394
+ setErrorMsg("Sess\xE3o expirada. Execute repomind login novamente.");
40395
+ setPhase("error-api");
40396
+ } else {
40397
+ const detail = e instanceof Error ? e.message : "Erro desconhecido";
40398
+ const verbose2 = process.argv.includes("--verbose") || process.argv.includes("-v") || !!process.env.REPOMIND_DEBUG;
40399
+ setErrorMsg(
40400
+ verbose2 ? `Falha ao gerar PR description: ${detail}` : "Falha ao gerar PR description. Tente novamente."
40401
+ );
40402
+ if (verbose2 && e instanceof Error && e.stack) {
40403
+ console.error(e.stack);
40404
+ }
40405
+ setPhase("error-api");
40406
+ }
40407
+ }
40408
+ }
40409
+ run2();
40410
+ }, []);
40411
+ use_input_default(
40412
+ async (input) => {
40413
+ if (phase !== "result") return;
40414
+ if (input.toLowerCase() === "c") {
40415
+ const fullText = `${prTitle}
40416
+
40417
+ ${prBody}`;
40418
+ await deps.copyToClipboard(fullText);
40419
+ setPhase("copied");
40420
+ } else if (input.toLowerCase() === "q") {
40421
+ setPhase("aborted");
40422
+ }
40423
+ },
40424
+ { isActive: phase === "result" }
40425
+ );
40426
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
40427
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Header, { title: "repomind pr" }),
40428
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
40429
+ phase === "collecting" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, marginTop: 1, children: [
40430
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(build_default, { type: "dots" }) }),
40431
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "Coletando diff entre branches..." })
40432
+ ] }),
40433
+ phase === "generating" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, marginTop: 1, children: [
40434
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(build_default, { type: "dots" }) }),
40435
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "Gerando PR description com IA..." })
40436
+ ] }),
40437
+ phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
40438
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
40439
+ Box_default,
40440
+ {
40441
+ flexDirection: "column",
40442
+ borderStyle: "round",
40443
+ borderColor: C.cyan,
40444
+ paddingX: 1,
40445
+ children: [
40446
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, color: C.white, children: prTitle }),
40447
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: prBody }) })
40448
+ ]
40449
+ }
40450
+ ),
40451
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
40452
+ KeyHints,
40453
+ {
40454
+ hints: [
40455
+ { key: "c", label: "copiar" },
40456
+ { key: "q", label: "sair" }
40457
+ ]
40458
+ }
40459
+ )
40460
+ ] }),
40461
+ phase === "copied" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, marginTop: 1, children: [
40462
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.green, children: "\u2713" }),
40463
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "PR description copiada para o clipboard!" })
40464
+ ] }),
40465
+ phase === "aborted" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { gap: 1, marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "Saindo..." }) }),
40466
+ phase === "error-auth" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, children: [
40467
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.red, children: "\u2717" }),
40468
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.red, children: errorMsg })
40469
+ ] }) }),
40470
+ phase === "error-git" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, children: [
40471
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.yellow, children: "\u25B2" }),
40472
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.yellow, children: errorMsg })
40473
+ ] }) }),
40474
+ phase === "error-api" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, children: [
40475
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.red, children: "\u2717" }),
40476
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.red, children: errorMsg })
40477
+ ] }) }),
40478
+ phase === "error-plan" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
40479
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, children: [
40480
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.yellow, children: "\u25B2" }),
40481
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.yellow, children: errorMsg.split("\n")[0] })
40482
+ ] }),
40483
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: errorMsg.split("\n")[1] }) })
40484
+ ] })
40485
+ ] })
40486
+ ] });
40487
+ }
40488
+
40489
+ // src/commands/pr.ts
40490
+ async function detectBaseBranch() {
40491
+ const proc = Bun.spawn(["git", "rev-parse", "--verify", "main"], {
40492
+ stdout: "pipe",
40493
+ stderr: "pipe"
40494
+ });
40495
+ const code = await proc.exited;
40496
+ return code === 0 ? "main" : "master";
40497
+ }
40498
+ async function getDiffBetweenBranches() {
40499
+ const baseBranch = await detectBaseBranch();
40500
+ const mergeBaseProc = Bun.spawn(["git", "merge-base", "HEAD", baseBranch], {
40501
+ stdout: "pipe",
40502
+ stderr: "pipe"
40503
+ });
40504
+ const mergeBaseCode = await mergeBaseProc.exited;
40505
+ if (mergeBaseCode !== 0) {
40506
+ throw new Error(
40507
+ `N\xE3o foi poss\xEDvel encontrar merge-base entre HEAD e ${baseBranch}.`
40508
+ );
40509
+ }
40510
+ const mergeBase = (await new Response(mergeBaseProc.stdout).text()).trim();
40511
+ const diffProc = Bun.spawn(["git", "diff", `${mergeBase}...HEAD`], {
40512
+ stdout: "pipe",
40513
+ stderr: "pipe"
40514
+ });
40515
+ return new Response(diffProc.stdout).text();
40516
+ }
40517
+ async function copyToClipboard(text) {
40518
+ const cmd = process.platform === "darwin" ? "pbcopy" : "xclip";
40519
+ try {
40520
+ const proc = Bun.spawn([cmd], {
40521
+ stdin: new ReadableStream({
40522
+ start(ctrl) {
40523
+ ctrl.enqueue(new TextEncoder().encode(text));
40524
+ ctrl.close();
40525
+ }
40526
+ })
40527
+ });
40528
+ await proc.exited;
40529
+ } catch {
40530
+ console.log(
40531
+ "\n(Clipboard n\xE3o dispon\xEDvel \u2014 copie o texto acima manualmente)"
40532
+ );
40533
+ }
40534
+ }
40535
+ async function prCommand() {
40536
+ let exitCode = 0;
40537
+ enterImmersive();
40538
+ const { waitUntilExit } = render_default(
40539
+ import_react39.default.createElement(PrApp, {
40540
+ deps: {
40541
+ readToken,
40542
+ getDiffBetweenBranches,
40543
+ apiPost: (path, body, token) => apiClient.post(path, body, token),
40544
+ copyToClipboard
40545
+ },
40546
+ onExit: (code) => {
40547
+ exitCode = code;
40548
+ }
40549
+ })
40550
+ );
40551
+ await waitUntilExit();
40552
+ exitImmersive();
40553
+ process.exit(exitCode);
40554
+ }
40555
+
40556
+ // src/commands/split.ts
40557
+ var import_react41 = __toESM(require_react(), 1);
39990
40558
 
39991
40559
  // src/ui/split-app.tsx
39992
- var import_react37 = __toESM(require_react(), 1);
40560
+ var import_react40 = __toESM(require_react(), 1);
39993
40561
 
39994
40562
  // src/ui/components/diff-stats.tsx
39995
- var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
40563
+ var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
39996
40564
  function DiffStats({
39997
40565
  additions,
39998
40566
  deletions,
39999
40567
  showBar = false
40000
40568
  }) {
40001
40569
  if (!showBar) {
40002
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { gap: 0, children: [
40003
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "green", bold: true, children: [
40570
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { gap: 0, children: [
40571
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: C.green, bold: true, children: [
40004
40572
  "+",
40005
40573
  additions
40006
40574
  ] }),
40007
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { dimColor: true, children: " / " }),
40008
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "red", bold: true, children: [
40575
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: C.dim, children: " / " }),
40576
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: C.red, bold: true, children: [
40009
40577
  "-",
40010
40578
  deletions
40011
40579
  ] })
@@ -40015,69 +40583,69 @@ function DiffStats({
40015
40583
  const barWidth = Math.min(total, 20);
40016
40584
  const addBar = total > 0 ? Math.max(1, Math.round(additions / total * barWidth)) : 0;
40017
40585
  const delBar = Math.max(0, barWidth - addBar);
40018
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { gap: 1, children: [
40019
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "green", bold: true, children: [
40586
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { gap: 1, children: [
40587
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: C.green, bold: true, children: [
40020
40588
  "+",
40021
40589
  additions
40022
40590
  ] }),
40023
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "red", bold: true, children: [
40591
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: C.red, bold: true, children: [
40024
40592
  "-",
40025
40593
  deletions
40026
40594
  ] }),
40027
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { gap: 0, children: [
40028
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "green", children: "\u2588".repeat(addBar) }),
40029
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "red", children: "\u2588".repeat(delBar) })
40595
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { gap: 0, children: [
40596
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: C.green, children: "\u2588".repeat(addBar) }),
40597
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: C.red, children: "\u2588".repeat(delBar) })
40030
40598
  ] })
40031
40599
  ] });
40032
40600
  }
40033
40601
 
40034
40602
  // src/ui/components/commit-card.tsx
40035
- var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
40603
+ var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
40036
40604
  function formatSelection(f) {
40037
40605
  if (f.selection === "all") return "all";
40038
40606
  return f.selection.map((h) => `h${h.hunkIndex}`).join(",");
40039
40607
  }
40040
40608
  function CommitCard(props) {
40041
- const borderColor = props.isSkipped ? "yellow" : "cyan";
40042
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
40609
+ const borderColor = props.isSkipped ? C.yellow : C.cyan;
40610
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
40043
40611
  Box_default,
40044
40612
  {
40045
40613
  flexDirection: "column",
40046
- borderStyle: "bold",
40614
+ borderStyle: "round",
40047
40615
  borderColor,
40048
- paddingX: 2,
40049
- paddingY: 1,
40616
+ paddingX: 1,
40617
+ paddingY: 0,
40050
40618
  marginBottom: 0,
40051
40619
  children: [
40052
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { gap: 1, alignItems: "center", children: [
40053
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { dimColor: true, bold: true, children: [
40620
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box_default, { gap: 1, alignItems: "center", children: [
40621
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text, { color: C.dim, bold: true, children: [
40054
40622
  String(props.index).padStart(String(props.total).length),
40055
40623
  "/",
40056
40624
  props.total
40057
40625
  ] }),
40058
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TypeBadge, { type: props.type }),
40059
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { bold: true, color: "white", children: props.description })
40626
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TypeBadge, { type: props.type }),
40627
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { bold: true, color: C.white, children: props.description })
40060
40628
  ] }),
40061
- props.scope && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { marginLeft: 5, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { dimColor: true, italic: true, children: [
40629
+ props.scope && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box_default, { marginLeft: 5, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text, { color: C.dim, italic: true, children: [
40062
40630
  "scope: ",
40063
40631
  props.scope
40064
40632
  ] }) }),
40065
- props.isSkipped && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { backgroundColor: "yellow", color: "black", bold: true, children: [
40633
+ props.isSkipped && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text, { backgroundColor: C.yellow, color: "#000", bold: true, children: [
40066
40634
  " ",
40067
40635
  "PULADO",
40068
40636
  " "
40069
40637
  ] }) }),
40070
- !props.isSkipped && props.body && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { marginTop: 1, marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: "white", children: props.body }) }),
40071
- !props.isSkipped && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: props.files.map((f) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { gap: 1, marginLeft: 1, children: [
40072
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: "cyan", bold: true, children: "\u25B8" }),
40073
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: f.path }),
40074
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { dimColor: true, children: [
40638
+ !props.isSkipped && props.body && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box_default, { marginTop: 1, marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { color: C.white, children: props.body }) }),
40639
+ !props.isSkipped && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: props.files.map((f) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box_default, { gap: 1, marginLeft: 1, children: [
40640
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { color: C.cyan, bold: true, children: "\u25B8" }),
40641
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { children: f.path }),
40642
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text, { color: C.dim, children: [
40075
40643
  "[",
40076
40644
  formatSelection(f),
40077
40645
  "]"
40078
40646
  ] })
40079
40647
  ] }, f.path)) }),
40080
- !props.isSkipped && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { marginTop: 1, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
40648
+ !props.isSkipped && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box_default, { marginTop: 1, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
40081
40649
  DiffStats,
40082
40650
  {
40083
40651
  additions: props.additions,
@@ -40091,215 +40659,32 @@ function CommitCard(props) {
40091
40659
  }
40092
40660
 
40093
40661
  // src/ui/components/commit-row.tsx
40094
- var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
40662
+ var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
40095
40663
  function CommitRow(props) {
40096
40664
  const pad = String(props.total).length;
40097
40665
  const num = `${String(props.index).padStart(pad)}/${props.total}`;
40098
40666
  if (props.isSkipped) {
40099
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, marginLeft: 2, children: [
40100
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: num }),
40101
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, strikethrough: true, children: props.description }),
40102
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { backgroundColor: "yellow", color: "black", children: [
40667
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { gap: 1, marginLeft: 2, children: [
40668
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: C.dim, children: num }),
40669
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: C.dim, strikethrough: true, children: props.description }),
40670
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { backgroundColor: C.yellow, color: "#000", children: [
40103
40671
  " ",
40104
40672
  "skip",
40105
40673
  " "
40106
40674
  ] })
40107
40675
  ] });
40108
40676
  }
40109
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, marginLeft: 2, children: [
40110
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: num }),
40111
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TypeBadge, { type: props.type }),
40112
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: props.description }),
40113
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DiffStats, { additions: props.additions, deletions: props.deletions })
40114
- ] });
40115
- }
40116
-
40117
- // src/ui/components/diff-viewer.tsx
40118
- var import_react36 = __toESM(require_react(), 1);
40119
- var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
40120
- function DiffViewer({ filePath, patch, onClose }) {
40121
- const [scrollOffset, setScrollOffset] = (0, import_react36.useState)(0);
40122
- const termHeight = process.stdout.rows || 24;
40123
- use_input_default((input, key) => {
40124
- if (input === "q" || input === "d" || key.escape) {
40125
- onClose();
40126
- return;
40127
- }
40128
- if (key.upArrow || input === "k") {
40129
- setScrollOffset((prev) => Math.max(0, prev - 1));
40130
- }
40131
- if (key.downArrow || input === "j") {
40132
- setScrollOffset((prev) => prev + 1);
40133
- }
40134
- if (input === " " || key.pageDown) {
40135
- setScrollOffset((prev) => prev + (termHeight - 5));
40136
- }
40137
- if (input === "u" || key.pageUp) {
40138
- setScrollOffset((prev) => Math.max(0, prev - (termHeight - 5)));
40139
- }
40140
- if (input === "g") {
40141
- setScrollOffset(0);
40142
- }
40143
- });
40144
- const allLines = patch.split("\n");
40145
- const contentLines = [];
40146
- for (const line of allLines) {
40147
- if (line.startsWith("diff --git")) {
40148
- const match = line.match(/^diff --git a\/.+ b\/(.+)$/);
40149
- const file = match?.[1] ?? line;
40150
- contentLines.push(`__FILE__${file}`);
40151
- } else if (line.startsWith("index ") || line.startsWith("--- ") || line.startsWith("+++ ") || line.startsWith("old mode") || line.startsWith("new mode") || line.startsWith("new file") || line.startsWith("deleted file") || line.startsWith("similarity")) {
40152
- } else {
40153
- contentLines.push(line);
40154
- }
40155
- }
40156
- const totalLines = contentLines.length;
40157
- const viewportHeight = Math.max(1, termHeight - 5);
40158
- const maxScroll = Math.max(0, totalLines - viewportHeight);
40159
- const clamped = Math.min(scrollOffset, maxScroll);
40160
- const visibleLines = contentLines.slice(clamped, clamped + viewportHeight);
40161
- const scrollPercent = maxScroll > 0 ? Math.round(clamped / maxScroll * 100) : 100;
40162
- const termWidth = process.stdout.columns || 80;
40163
- const fileCount = contentLines.filter((l) => l.startsWith("__FILE__")).length;
40164
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", children: [
40165
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { children: [
40166
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { backgroundColor: "cyan", color: "black", bold: true, children: [
40167
- " ",
40168
- "DIFF",
40169
- " "
40170
- ] }),
40171
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { bold: true, children: [
40172
- " ",
40173
- filePath,
40174
- " "
40175
- ] }),
40176
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { dimColor: true, children: [
40177
- "\xB7 ",
40178
- fileCount > 1 ? `${fileCount} arquivos \xB7 ` : "",
40179
- totalLines,
40180
- " linhas \xB7 ",
40181
- scrollPercent,
40182
- "%"
40183
- ] })
40184
- ] }),
40185
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "\u2500".repeat(Math.min(termWidth, 80)) }),
40186
- visibleLines.map((line, i) => {
40187
- const key = `dl-${clamped + i}`;
40188
- if (line.startsWith("__FILE__")) {
40189
- const file = line.slice(8);
40190
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", marginTop: i > 0 ? 1 : 0, children: [
40191
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "\u2500".repeat(Math.min(termWidth, 80)) }),
40192
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { gap: 1, children: [
40193
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { backgroundColor: "blue", color: "white", bold: true, children: [
40194
- " ",
40195
- "FILE",
40196
- " "
40197
- ] }),
40198
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { bold: true, color: "white", children: file })
40199
- ] }),
40200
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "\u2500".repeat(Math.min(termWidth, 80)) })
40201
- ] }, key);
40202
- }
40203
- const num = String(clamped + i + 1).padStart(4);
40204
- if (line.startsWith("@@")) {
40205
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "cyan", dimColor: true, children: [
40206
- " ",
40207
- " ",
40208
- line
40209
- ] }, key);
40210
- }
40211
- if (line.startsWith("+")) {
40212
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "green", children: [
40213
- num,
40214
- " ",
40215
- line
40216
- ] }, key);
40217
- }
40218
- if (line.startsWith("-")) {
40219
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "red", children: [
40220
- num,
40221
- " ",
40222
- line
40223
- ] }, key);
40224
- }
40225
- if (line.startsWith("\\")) {
40226
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { dimColor: true, children: [
40227
- " ",
40228
- line
40229
- ] }, key);
40230
- }
40231
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { dimColor: true, children: [
40232
- num,
40233
- " ",
40234
- line
40235
- ] }, key);
40236
- }),
40237
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "\u2500".repeat(Math.min(termWidth, 80)) }),
40238
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { gap: 1, children: [
40239
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { backgroundColor: "gray", color: "white", bold: true, children: [
40240
- " ",
40241
- "\u2191\u2193",
40242
- " "
40243
- ] }),
40244
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "rolar" }),
40245
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { backgroundColor: "gray", color: "white", bold: true, children: [
40246
- " ",
40247
- "space",
40248
- " "
40249
- ] }),
40250
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "p\xE1gina" }),
40251
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { backgroundColor: "gray", color: "white", bold: true, children: [
40252
- " ",
40253
- "g",
40254
- " "
40255
- ] }),
40256
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "topo" }),
40257
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { backgroundColor: "gray", color: "white", bold: true, children: [
40258
- " ",
40259
- "q",
40260
- " "
40261
- ] }),
40262
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "sair" }),
40263
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { dimColor: true, children: [
40264
- " ",
40265
- "\u2502 ",
40266
- clamped + 1,
40267
- "-",
40268
- Math.min(clamped + viewportHeight, totalLines),
40269
- "/",
40270
- totalLines
40271
- ] })
40272
- ] })
40273
- ] });
40274
- }
40275
-
40276
- // src/ui/components/progress-bar.tsx
40277
- var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
40278
- function ProgressBar({ current, total, width = 24 }) {
40279
- const ratio = total > 0 ? current / total : 0;
40280
- const filled = Math.round(ratio * width);
40281
- const empty = width - filled;
40282
- const percent = Math.round(ratio * 100);
40283
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box_default, { gap: 1, children: [
40284
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { color: "cyan", bold: true, children: "\u2501".repeat(filled) }),
40285
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { dimColor: true, children: "\u2500".repeat(empty) }),
40286
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text, { bold: true, color: ratio >= 1 ? "green" : "cyan", children: [
40287
- percent,
40288
- "%"
40289
- ] }),
40290
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text, { dimColor: true, children: [
40291
- "(",
40292
- current,
40293
- "/",
40294
- total,
40295
- ")"
40296
- ] })
40677
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { gap: 1, marginLeft: 2, children: [
40678
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: C.dim, children: num }),
40679
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TypeBadge, { type: props.type }),
40680
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: C.dim, children: props.description }),
40681
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DiffStats, { additions: props.additions, deletions: props.deletions })
40297
40682
  ] });
40298
40683
  }
40299
40684
 
40300
40685
  // src/ui/split-app.tsx
40301
- var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
40302
- var TERMINAL_PHASES3 = [
40686
+ var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
40687
+ var TERMINAL_PHASES4 = [
40303
40688
  "done",
40304
40689
  "aborted",
40305
40690
  "error-auth",
@@ -40346,23 +40731,24 @@ function SplitApp({
40346
40731
  onExit
40347
40732
  }) {
40348
40733
  const { exit } = use_app_default();
40349
- const [phase, setPhase] = (0, import_react37.useState)("collecting");
40350
- const [groups, setGroups] = (0, import_react37.useState)([]);
40351
- const [selectedIndex, setSelectedIndex] = (0, import_react37.useState)(0);
40352
- const [skippedGroups, setSkippedGroups] = (0, import_react37.useState)(/* @__PURE__ */ new Set());
40353
- const [commitProgress, setCommitProgress] = (0, import_react37.useState)(0);
40354
- const [errorMsg, setErrorMsg] = (0, import_react37.useState)("");
40355
- const [originalFiles, setOriginalFiles] = (0, import_react37.useState)([]);
40356
- const [hunksMap, setHunksMap] = (0, import_react37.useState)(/* @__PURE__ */ new Map());
40357
- const [patchMap, setPatchMap] = (0, import_react37.useState)(/* @__PURE__ */ new Map());
40358
- const [authToken, setAuthToken] = (0, import_react37.useState)("");
40359
- (0, import_react37.useEffect)(() => {
40360
- if (!TERMINAL_PHASES3.includes(phase)) return;
40734
+ const committedMessagesRef = (0, import_react40.useRef)([]);
40735
+ const [phase, setPhase] = (0, import_react40.useState)("collecting");
40736
+ const [groups, setGroups] = (0, import_react40.useState)([]);
40737
+ const [selectedIndex, setSelectedIndex] = (0, import_react40.useState)(0);
40738
+ const [skippedGroups, setSkippedGroups] = (0, import_react40.useState)(/* @__PURE__ */ new Set());
40739
+ const [commitProgress, setCommitProgress] = (0, import_react40.useState)(0);
40740
+ const [errorMsg, setErrorMsg] = (0, import_react40.useState)("");
40741
+ const [originalFiles, setOriginalFiles] = (0, import_react40.useState)([]);
40742
+ const [hunksMap, setHunksMap] = (0, import_react40.useState)(/* @__PURE__ */ new Map());
40743
+ const [patchMap, setPatchMap] = (0, import_react40.useState)(/* @__PURE__ */ new Map());
40744
+ const [authToken, setAuthToken] = (0, import_react40.useState)("");
40745
+ (0, import_react40.useEffect)(() => {
40746
+ if (!TERMINAL_PHASES4.includes(phase)) return;
40361
40747
  const code = phase === "done" || phase === "aborted" ? 0 : 1;
40362
40748
  exit();
40363
- onExit(code);
40749
+ onExit(code, phase === "done" ? committedMessagesRef.current : void 0);
40364
40750
  }, [phase]);
40365
- (0, import_react37.useEffect)(() => {
40751
+ (0, import_react40.useEffect)(() => {
40366
40752
  async function run2() {
40367
40753
  const token = deps.readToken();
40368
40754
  if (!token) {
@@ -40436,7 +40822,8 @@ function SplitApp({
40436
40822
  const result = await deps.apiPost(
40437
40823
  "/split/analyze",
40438
40824
  body,
40439
- token
40825
+ token,
40826
+ 12e4
40440
40827
  );
40441
40828
  const sortedGroups = result.groups.sort((a, b) => a.order - b.order);
40442
40829
  setGroups(sortedGroups);
@@ -40581,184 +40968,174 @@ function SplitApp({
40581
40968
  return;
40582
40969
  }
40583
40970
  }
40971
+ committedMessagesRef.current = activeGroups2.map((g) => g.message);
40584
40972
  setPhase("done");
40585
40973
  }
40586
40974
  const activeGroups = groups.filter((g) => !skippedGroups.has(g.groupId));
40587
40975
  const activeGroupCount = activeGroups.length;
40588
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { flexDirection: "column", gap: 0, paddingTop: 1, children: [
40589
- phase === "collecting" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
40590
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Header, {}),
40591
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
40592
- StepList,
40976
+ if (phase === "viewing-diff") {
40977
+ const group = groups[selectedIndex];
40978
+ if (group) {
40979
+ const combinedPatch = group.files.map((f) => patchMap.get(f.path) ?? "").filter(Boolean).join("\n");
40980
+ const mainFile = group.files[0]?.path ?? "diff";
40981
+ const label = group.files.length > 1 ? `${mainFile} (+${group.files.length - 1} arquivos)` : mainFile;
40982
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
40983
+ DiffViewer,
40593
40984
  {
40594
- steps: [{ label: "Coletando altera\xE7\xF5es", status: "active" }]
40985
+ filePath: label,
40986
+ patch: combinedPatch,
40987
+ onClose: () => setPhase("review")
40595
40988
  }
40596
- )
40597
- ] }),
40598
- phase === "analyzing" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
40599
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Header, {}),
40600
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
40989
+ );
40990
+ }
40991
+ }
40992
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", gap: 0, children: [
40993
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Header, { title: "repomind split" }),
40994
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
40995
+ (phase === "collecting" || phase === "analyzing") && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
40601
40996
  StepList,
40602
40997
  {
40603
40998
  steps: [
40604
40999
  {
40605
- label: "Altera\xE7\xF5es coletadas",
40606
- status: "done",
40607
- detail: `${originalFiles.length} arquivos`
41000
+ label: "Coletando altera\xE7\xF5es",
41001
+ status: phase === "collecting" ? "active" : "done",
41002
+ detail: phase !== "collecting" ? `${originalFiles.length} arquivos` : void 0
40608
41003
  },
40609
- { label: "Analisando com IA", status: "active" }
41004
+ {
41005
+ label: "Analisando com IA",
41006
+ status: phase === "analyzing" ? "active" : "pending"
41007
+ }
40610
41008
  ]
40611
41009
  }
40612
- )
40613
- ] }),
40614
- phase === "review" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
40615
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Header, {}),
40616
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { bold: true, children: [
40617
- groups.length,
40618
- " commits sugeridos"
40619
- ] }) }),
40620
- groups.map((group, idx) => {
40621
- const isSelected = idx === selectedIndex;
40622
- const isSkipped = skippedGroups.has(group.groupId);
40623
- const stats = computeGroupStats(group.files, originalFiles);
40624
- if (isSelected) {
40625
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
40626
- CommitCard,
41010
+ ),
41011
+ phase === "review" && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
41012
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { bold: true, children: [
41013
+ groups.length,
41014
+ " commits sugeridos"
41015
+ ] }) }),
41016
+ groups.map((group, idx) => {
41017
+ const isSelected = idx === selectedIndex;
41018
+ const isSkipped = skippedGroups.has(group.groupId);
41019
+ const stats = computeGroupStats(group.files, originalFiles);
41020
+ if (isSelected) {
41021
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
41022
+ CommitCard,
41023
+ {
41024
+ index: idx + 1,
41025
+ total: groups.length,
41026
+ type: group.type,
41027
+ scope: group.scope,
41028
+ description: group.description,
41029
+ body: group.body,
41030
+ files: group.files,
41031
+ additions: stats.additions,
41032
+ deletions: stats.deletions,
41033
+ isSkipped
41034
+ },
41035
+ group.groupId
41036
+ );
41037
+ }
41038
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
41039
+ CommitRow,
40627
41040
  {
40628
41041
  index: idx + 1,
40629
41042
  total: groups.length,
40630
41043
  type: group.type,
40631
- scope: group.scope,
40632
41044
  description: group.description,
40633
- body: group.body,
40634
- files: group.files,
40635
41045
  additions: stats.additions,
40636
41046
  deletions: stats.deletions,
40637
- isSkipped
41047
+ isSkipped,
41048
+ isSelected: false
40638
41049
  },
40639
41050
  group.groupId
40640
41051
  );
40641
- }
40642
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
40643
- CommitRow,
41052
+ }),
41053
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
41054
+ KeyHints,
40644
41055
  {
40645
- index: idx + 1,
40646
- total: groups.length,
40647
- type: group.type,
40648
- description: group.description,
40649
- additions: stats.additions,
40650
- deletions: stats.deletions,
40651
- isSkipped,
40652
- isSelected: false
40653
- },
40654
- group.groupId
40655
- );
40656
- }),
40657
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
40658
- KeyHints,
40659
- {
40660
- hints: [
40661
- { key: "\u2191\u2193", label: "navegar" },
40662
- { key: "d", label: "diff" },
40663
- { key: "enter", label: "confirmar" },
40664
- { key: "s", label: "pular" },
40665
- { key: "q", label: "abortar" }
40666
- ]
40667
- }
40668
- )
40669
- ] }),
40670
- phase === "viewing-diff" && (() => {
40671
- const group = groups[selectedIndex];
40672
- if (!group) return null;
40673
- const combinedPatch = group.files.map((f) => patchMap.get(f.path) ?? "").filter(Boolean).join("\n");
40674
- const mainFile = group.files[0]?.path ?? "diff";
40675
- const label = group.files.length > 1 ? `${mainFile} (+${group.files.length - 1} arquivos)` : mainFile;
40676
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
40677
- DiffViewer,
40678
- {
40679
- filePath: label,
40680
- patch: combinedPatch,
40681
- onClose: () => setPhase("review")
40682
- }
40683
- );
40684
- })(),
40685
- phase === "committing" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
40686
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Header, {}),
40687
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
40688
- StepList,
40689
- {
40690
- steps: activeGroups.map((g, i) => ({
40691
- label: g.message,
40692
- status: i < commitProgress ? "done" : i === commitProgress ? "active" : "pending"
40693
- }))
40694
- }
40695
- ),
40696
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box_default, { marginTop: 1, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ProgressBar, { current: commitProgress, total: activeGroupCount }) })
40697
- ] }),
40698
- phase === "done" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
40699
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Header, {}),
40700
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
40701
- StepList,
40702
- {
40703
- steps: activeGroups.map((g) => ({
40704
- label: g.message,
40705
- status: "done"
40706
- }))
40707
- }
40708
- ),
40709
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { marginTop: 1, gap: 1, children: [
40710
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: "green", children: "\u2728" }),
40711
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { bold: true, color: "green", children: [
40712
- activeGroupCount,
40713
- " commit",
40714
- activeGroupCount !== 1 ? "s" : "",
40715
- " ",
40716
- "realizado",
40717
- activeGroupCount !== 1 ? "s" : "",
40718
- " com sucesso"
40719
- ] })
40720
- ] })
40721
- ] }),
40722
- phase === "aborted" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
40723
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Header, {}),
40724
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { gap: 1, children: [
40725
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: "yellow", children: "\u25C6" }),
40726
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { dimColor: true, children: "Abortado. Nenhum commit foi feito." })
40727
- ] })
40728
- ] }),
40729
- phase === "error-commit" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
40730
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Header, {}),
40731
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
40732
- StepList,
40733
- {
40734
- steps: activeGroups.map((g, i) => ({
40735
- label: g.message,
40736
- status: i < commitProgress ? "done" : i === commitProgress ? "error" : "pending"
40737
- }))
40738
- }
40739
- ),
40740
- commitProgress > 0 && commitProgress < activeGroupCount && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { marginTop: 1, gap: 1, children: [
40741
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: "yellow", children: "\u25B2" }),
40742
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { color: "yellow", children: [
41056
+ hints: [
41057
+ { key: "\u2191\u2193", label: "navegar" },
41058
+ { key: "d", label: "diff" },
41059
+ { key: "enter", label: "confirmar" },
41060
+ { key: "s", label: "pular" },
41061
+ { key: "q", label: "abortar" }
41062
+ ]
41063
+ }
41064
+ )
41065
+ ] }),
41066
+ phase === "committing" && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
41067
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: activeGroups.map((g, i) => {
41068
+ const isDone = i < commitProgress;
41069
+ const isActive = i === commitProgress;
41070
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", children: [
41071
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { gap: 1, alignItems: "center", children: [
41072
+ isDone ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.green, children: "\u2713" }) : isActive ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(build_default, { type: "dots" }) }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.dim, children: "\u25CB" }),
41073
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TypeBadge, { type: g.type }),
41074
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
41075
+ Text,
41076
+ {
41077
+ color: isDone ? C.green : isActive ? C.white : C.dim,
41078
+ bold: isActive,
41079
+ children: g.description
41080
+ }
41081
+ )
41082
+ ] }),
41083
+ i < activeGroups.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.dim, children: "\u2502" })
41084
+ ] }, g.groupId);
41085
+ }) }),
41086
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { color: C.dim, children: [
40743
41087
  commitProgress,
40744
41088
  "/",
40745
41089
  activeGroupCount,
40746
- " commits realizados antes do erro"
41090
+ " commit",
41091
+ activeGroupCount !== 1 ? "s" : ""
41092
+ ] }) })
41093
+ ] }),
41094
+ phase === "done" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: activeGroups.map((g, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", children: [
41095
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { gap: 1, alignItems: "center", children: [
41096
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.green, children: "\u2713" }),
41097
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TypeBadge, { type: g.type }),
41098
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.green, children: g.description })
41099
+ ] }),
41100
+ i < activeGroups.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.dim, children: "\u2502" })
41101
+ ] }, g.groupId)) }),
41102
+ phase === "aborted" && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { gap: 1, marginTop: 1, children: [
41103
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.yellow, children: "\u25C6" }),
41104
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { dimColor: true, children: "Abortado. Nenhum commit foi feito." })
41105
+ ] }),
41106
+ phase === "error-commit" && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
41107
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: activeGroups.map((g, i) => {
41108
+ const isDone = i < commitProgress;
41109
+ const isError = i === commitProgress;
41110
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", children: [
41111
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { gap: 1, alignItems: "center", children: [
41112
+ isDone ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.green, children: "\u2713" }) : isError ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.red, children: "\u2717" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.dim, children: "\u25CB" }),
41113
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TypeBadge, { type: g.type }),
41114
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: isDone ? C.green : isError ? C.red : C.dim, children: g.description })
41115
+ ] }),
41116
+ i < activeGroups.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.dim, children: "\u2502" })
41117
+ ] }, g.groupId);
41118
+ }) }),
41119
+ commitProgress > 0 && commitProgress < activeGroupCount && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { marginTop: 1, gap: 1, children: [
41120
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.yellow, children: "\u25B2" }),
41121
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { color: C.yellow, children: [
41122
+ commitProgress,
41123
+ "/",
41124
+ activeGroupCount,
41125
+ " commits realizados antes do erro"
41126
+ ] })
41127
+ ] }),
41128
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { gap: 1, marginTop: 1, children: [
41129
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.red, children: "\u2717" }),
41130
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.red, children: errorMsg })
40747
41131
  ] })
40748
41132
  ] }),
40749
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { gap: 1, marginTop: commitProgress > 0 ? 0 : 1, children: [
40750
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: "red", children: "\u2717" }),
40751
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: "red", children: errorMsg })
40752
- ] })
40753
- ] }),
40754
- (phase === "error-auth" || phase === "error-empty" || phase === "error-git" || phase === "error-api" || phase === "error-plan") && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
40755
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Header, {}),
40756
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { gap: 1, children: [
40757
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: "red", children: "\u2717" }),
40758
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: "red", children: errorMsg })
40759
- ] })
40760
- ] }),
40761
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box_default, { marginTop: 1 })
41133
+ (phase === "error-auth" || phase === "error-empty" || phase === "error-git" || phase === "error-api" || phase === "error-plan") && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { gap: 1, marginTop: 1, children: [
41134
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.red, children: "\u2717" }),
41135
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.red, children: errorMsg })
41136
+ ] }),
41137
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { marginTop: 1 })
41138
+ ] })
40762
41139
  ] });
40763
41140
  }
40764
41141
 
@@ -40774,8 +41151,10 @@ async function splitCommand() {
40774
41151
  const fileConfig = await readRepoConfig();
40775
41152
  const useStaged = !process.argv.includes("--all");
40776
41153
  let exitCode = 0;
41154
+ let completedCommits = [];
41155
+ enterImmersive();
40777
41156
  const { waitUntilExit } = render_default(
40778
- import_react38.default.createElement(SplitApp, {
41157
+ import_react41.default.createElement(SplitApp, {
40779
41158
  deps: {
40780
41159
  readToken,
40781
41160
  getAllChanges,
@@ -40791,27 +41170,35 @@ async function splitCommand() {
40791
41170
  applyPatch,
40792
41171
  validatePatch,
40793
41172
  getFileDiff,
40794
- apiPost: (path, body, tkn) => apiClient.post(path, body, tkn),
41173
+ apiPost: (path, body, tkn, timeoutMs) => apiClient.post(path, body, tkn, timeoutMs),
40795
41174
  runGitCommit: runGitCommit2,
40796
41175
  fileConfig,
40797
41176
  useStaged
40798
41177
  },
40799
- onExit: (code) => {
41178
+ onExit: (code, commits) => {
40800
41179
  exitCode = code;
41180
+ completedCommits = commits ?? [];
40801
41181
  }
40802
41182
  })
40803
41183
  );
40804
41184
  await waitUntilExit();
41185
+ exitImmersive();
41186
+ if (completedCommits.length > 0) {
41187
+ const { waitUntilExit: waitUntilExit2 } = render_default(
41188
+ import_react41.default.createElement(SplitDoneSummary, { commits: completedCommits })
41189
+ );
41190
+ await waitUntilExit2();
41191
+ }
40805
41192
  process.exit(exitCode);
40806
41193
  }
40807
41194
 
40808
41195
  // src/commands/whoami.tsx
40809
- var import_react39 = __toESM(require_react(), 1);
40810
- var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
41196
+ var import_react42 = __toESM(require_react(), 1);
41197
+ var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
40811
41198
  function WhoamiApp({ onExit }) {
40812
41199
  const token = readToken();
40813
41200
  const payload = token ? decodeTokenPayload(token) : null;
40814
- (0, import_react39.useEffect)(() => {
41201
+ (0, import_react42.useEffect)(() => {
40815
41202
  onExit(payload ? 0 : 1);
40816
41203
  }, [onExit, payload]);
40817
41204
  const expiresDate = payload ? new Date(payload.exp * 1e3).toLocaleDateString("pt-BR", {
@@ -40819,26 +41206,26 @@ function WhoamiApp({ onExit }) {
40819
41206
  month: "2-digit",
40820
41207
  year: "numeric"
40821
41208
  }) : null;
40822
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, marginBottom: 1, children: [
40823
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { bold: true, color: "cyan", children: "RepoMind" }) }),
40824
- payload ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", gap: 0, children: [
40825
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { gap: 1, children: [
40826
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: "green", children: "\u2713" }),
40827
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { children: [
41209
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, marginBottom: 1, children: [
41210
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { bold: true, color: C.cyan, children: "RepoMind" }) }),
41211
+ payload ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Box_default, { flexDirection: "column", gap: 0, children: [
41212
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Box_default, { gap: 1, children: [
41213
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { color: C.green, children: "\u2713" }),
41214
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Text, { children: [
40828
41215
  "Autenticado como",
40829
41216
  " ",
40830
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { bold: true, color: "white", children: payload.email })
41217
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { bold: true, color: C.white, children: payload.email })
40831
41218
  ] })
40832
41219
  ] }),
40833
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { gap: 1, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { dimColor: true, children: [
41220
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box_default, { gap: 1, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Text, { color: C.dim, children: [
40834
41221
  "Sess\xE3o v\xE1lida at\xE9 ",
40835
41222
  expiresDate
40836
41223
  ] }) })
40837
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { gap: 1, children: [
40838
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: "yellow", children: "\u25C6" }),
40839
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { dimColor: true, children: [
41224
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Box_default, { gap: 1, children: [
41225
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { color: C.yellow, children: "\u25C6" }),
41226
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Text, { color: C.dim, children: [
40840
41227
  "N\xE3o autenticado. Execute ",
40841
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: "white", children: "repomind login" }),
41228
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { color: C.white, children: "repomind login" }),
40842
41229
  "."
40843
41230
  ] })
40844
41231
  ] })
@@ -40847,7 +41234,7 @@ function WhoamiApp({ onExit }) {
40847
41234
  async function whoamiCommand() {
40848
41235
  let exitCode = 0;
40849
41236
  const { waitUntilExit } = render_default(
40850
- import_react39.default.createElement(WhoamiApp, {
41237
+ import_react42.default.createElement(WhoamiApp, {
40851
41238
  onExit: (code) => {
40852
41239
  exitCode = code;
40853
41240
  }
@@ -40859,6 +41246,56 @@ async function whoamiCommand() {
40859
41246
 
40860
41247
  // src/index.ts
40861
41248
  import { createRequire } from "node:module";
41249
+ var import_react43 = __toESM(require_react(), 1);
41250
+
41251
+ // src/ui/components/command-help.tsx
41252
+ var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
41253
+ function CommandHelp({
41254
+ command: command2,
41255
+ usage,
41256
+ description,
41257
+ details,
41258
+ flags
41259
+ }) {
41260
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box_default, { flexDirection: "column", children: [
41261
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Header, { title: `RepoMind ${command2}` }),
41262
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box_default, { paddingLeft: 1, marginBottom: 1, gap: 1, children: [
41263
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { color: C.dim, children: "Uso:" }),
41264
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { bold: true, children: usage })
41265
+ ] }),
41266
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
41267
+ Box_default,
41268
+ {
41269
+ paddingLeft: 1,
41270
+ marginBottom: 1,
41271
+ borderStyle: "round",
41272
+ borderColor: C.dim,
41273
+ paddingX: 2,
41274
+ paddingY: 0,
41275
+ flexDirection: "column",
41276
+ children: [
41277
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { children: description }),
41278
+ details?.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { color: C.dim, children: detail }, detail))
41279
+ ]
41280
+ }
41281
+ ),
41282
+ flags && flags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
41283
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { color: C.dim, children: "Flags:" }),
41284
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Box_default, { flexDirection: "column", marginTop: 0, paddingLeft: 1, children: flags.map((flag) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box_default, { gap: 1, children: [
41285
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box_default, { width: 20, children: [
41286
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { color: C.cyan, bold: true, children: flag.name }),
41287
+ flag.alias && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text, { color: C.dim, children: [
41288
+ ", ",
41289
+ flag.alias
41290
+ ] })
41291
+ ] }),
41292
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { color: C.dim, children: flag.description })
41293
+ ] }, flag.name)) })
41294
+ ] })
41295
+ ] });
41296
+ }
41297
+
41298
+ // src/index.ts
40862
41299
  function getVersion() {
40863
41300
  try {
40864
41301
  const require2 = createRequire(import.meta.url);
@@ -40884,15 +41321,73 @@ function run(cmd) {
40884
41321
  });
40885
41322
  }
40886
41323
  var COMMAND_HELP = {
40887
- commit: "repomind commit\n\n Gera uma mensagem de commit inteligente a partir do git diff --staged.\n Requer arquivos staged (git add).\n\n Flags:\n --verbose, -v Exibir detalhes de erro\n --help, -h Exibir esta ajuda",
40888
- split: "repomind split [--all]\n\n Analisa altera\xE7\xF5es staged e divide em commits at\xF4micos.\n Por padr\xE3o analisa apenas altera\xE7\xF5es staged (git add).\n\n Flags:\n --all Incluir altera\xE7\xF5es unstaged + untracked\n --verbose, -v Exibir detalhes de erro\n --help, -h Exibir esta ajuda",
40889
- login: "repomind login\n\n Autenticar com sua conta RepoMind via browser.\n Abre o navegador para completar o fluxo OAuth.",
40890
- logout: "repomind logout\n\n Encerrar sess\xE3o atual e remover token local.",
40891
- whoami: "repomind whoami\n\n Exibir o usu\xE1rio autenticado atualmente."
41324
+ commit: {
41325
+ usage: "repomind commit",
41326
+ description: "Gera uma mensagem de commit inteligente a partir do git diff --staged.",
41327
+ details: ["Requer arquivos staged (git add)."],
41328
+ flags: [
41329
+ {
41330
+ name: "--verbose",
41331
+ alias: "-v",
41332
+ description: "Exibir detalhes de erro"
41333
+ },
41334
+ { name: "--help", alias: "-h", description: "Exibir esta ajuda" }
41335
+ ]
41336
+ },
41337
+ split: {
41338
+ usage: "repomind split [--all]",
41339
+ description: "Analisa altera\xE7\xF5es staged e divide em commits at\xF4micos.",
41340
+ details: ["Por padr\xE3o analisa apenas altera\xE7\xF5es staged (git add)."],
41341
+ flags: [
41342
+ { name: "--all", description: "Incluir altera\xE7\xF5es unstaged + untracked" },
41343
+ {
41344
+ name: "--verbose",
41345
+ alias: "-v",
41346
+ description: "Exibir detalhes de erro"
41347
+ },
41348
+ { name: "--help", alias: "-h", description: "Exibir esta ajuda" }
41349
+ ]
41350
+ },
41351
+ pr: {
41352
+ usage: "repomind pr",
41353
+ description: "Gera uma PR description inteligente a partir do diff entre branches.",
41354
+ details: ["Compara HEAD com a branch base (main/master)."],
41355
+ flags: [
41356
+ {
41357
+ name: "--verbose",
41358
+ alias: "-v",
41359
+ description: "Exibir detalhes de erro"
41360
+ },
41361
+ { name: "--help", alias: "-h", description: "Exibir esta ajuda" }
41362
+ ]
41363
+ },
41364
+ login: {
41365
+ usage: "repomind login",
41366
+ description: "Autenticar com sua conta RepoMind via browser.",
41367
+ details: ["Abre o navegador para completar o fluxo OAuth."]
41368
+ },
41369
+ logout: {
41370
+ usage: "repomind logout",
41371
+ description: "Encerrar sess\xE3o atual e remover token local."
41372
+ },
41373
+ whoami: {
41374
+ usage: "repomind whoami",
41375
+ description: "Exibir o usu\xE1rio autenticado atualmente."
41376
+ }
40892
41377
  };
40893
41378
  if (wantsHelp && command && COMMAND_HELP[command]) {
40894
- console.log(COMMAND_HELP[command]);
40895
- process.exit(0);
41379
+ const def = COMMAND_HELP[command];
41380
+ const { waitUntilExit } = render_default(
41381
+ import_react43.default.createElement(CommandHelp, {
41382
+ command,
41383
+ usage: def.usage,
41384
+ description: def.description,
41385
+ details: def.details,
41386
+ flags: def.flags
41387
+ })
41388
+ );
41389
+ setTimeout(() => process.exit(0), 50);
41390
+ await waitUntilExit();
40896
41391
  }
40897
41392
  switch (command) {
40898
41393
  case "login":
@@ -40910,6 +41405,9 @@ switch (command) {
40910
41405
  case "split":
40911
41406
  run(splitCommand);
40912
41407
  break;
41408
+ case "pr":
41409
+ run(prCommand);
41410
+ break;
40913
41411
  default:
40914
41412
  run(helpCommand);
40915
41413
  break;