repomind 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +102 -27
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -39386,6 +39386,10 @@ async function* parseSSEStream(stream) {
39386
39386
  try {
39387
39387
  yield JSON.parse(data);
39388
39388
  } catch {
39389
+ yield {
39390
+ type: "error",
39391
+ message: `SSE JSON parse error: ${data.slice(0, 100)}`
39392
+ };
39389
39393
  }
39390
39394
  }
39391
39395
  }
@@ -40177,10 +40181,15 @@ ${bodyParts.join("\n\n")}` : newMsg
40177
40181
  var import_react33 = __toESM(require_react(), 1);
40178
40182
  var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
40179
40183
  function parseType(msg) {
40184
+ if (!msg) return { type: "chore", description: msg ?? "" };
40180
40185
  const match = msg.match(/^(\w+)(?:\([^)]+\))?!?:\s*(.+)/);
40181
40186
  return { type: match?.[1] ?? "chore", description: match?.[2] ?? msg };
40182
40187
  }
40183
- function SplitDoneSummary({ commits }) {
40188
+ function SplitDoneSummary({
40189
+ commits,
40190
+ durationMs,
40191
+ totalFiles
40192
+ }) {
40184
40193
  const { exit } = use_app_default();
40185
40194
  (0, import_react33.useEffect)(() => {
40186
40195
  exit();
@@ -40204,12 +40213,17 @@ function SplitDoneSummary({ commits }) {
40204
40213
  " commit",
40205
40214
  commits.length !== 1 ? "s" : "",
40206
40215
  " realizado",
40207
- commits.length !== 1 ? "s" : ""
40216
+ commits.length !== 1 ? "s" : "",
40217
+ durationMs != null ? ` em ${(durationMs / 1e3).toFixed(1)}s` : "",
40218
+ totalFiles != null ? ` \xB7 ${totalFiles} arquivo${totalFiles !== 1 ? "s" : ""}` : ""
40208
40219
  ] })
40209
40220
  ] })
40210
40221
  ] });
40211
40222
  }
40212
- function CommitDoneSummary({ message }) {
40223
+ function CommitDoneSummary({
40224
+ message,
40225
+ durationMs
40226
+ }) {
40213
40227
  const { exit } = use_app_default();
40214
40228
  (0, import_react33.useEffect)(() => {
40215
40229
  exit();
@@ -40218,7 +40232,12 @@ function CommitDoneSummary({ message }) {
40218
40232
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { paddingLeft: 1, gap: 1, alignItems: "center", children: [
40219
40233
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.green, children: "\u2713" }),
40220
40234
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TypeBadge, { type }),
40221
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.green, children: description })
40235
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: C.green, children: description }),
40236
+ durationMs != null && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: C.dim, children: [
40237
+ "\xB7 ",
40238
+ (durationMs / 1e3).toFixed(1),
40239
+ "s"
40240
+ ] })
40222
40241
  ] });
40223
40242
  }
40224
40243
 
@@ -40609,6 +40628,20 @@ var TERMINAL_PHASES3 = [
40609
40628
  "error-git",
40610
40629
  "error-plan"
40611
40630
  ];
40631
+ function buildSteps(phase) {
40632
+ const phaseOrder = ["collecting", "generating"];
40633
+ const phaseIdx = phaseOrder.indexOf(phase);
40634
+ return [
40635
+ {
40636
+ label: "Coletando diff",
40637
+ status: phase === "collecting" ? "active" : phaseIdx > 0 ? "done" : "pending"
40638
+ },
40639
+ {
40640
+ label: "Gerando PR description",
40641
+ status: phase === "generating" ? "active" : "pending"
40642
+ }
40643
+ ];
40644
+ }
40612
40645
  function PrApp({
40613
40646
  deps,
40614
40647
  onExit
@@ -40702,14 +40735,7 @@ ${prBody}`;
40702
40735
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
40703
40736
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Header, { title: "repomind pr" }),
40704
40737
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
40705
- phase === "collecting" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, marginTop: 1, children: [
40706
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(build_default, { type: "dots" }) }),
40707
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "Coletando diff entre branches..." })
40708
- ] }),
40709
- phase === "generating" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, marginTop: 1, children: [
40710
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(build_default, { type: "dots" }) }),
40711
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "Gerando PR description com IA..." })
40712
- ] }),
40738
+ (phase === "collecting" || phase === "generating") && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(StepList, { steps: buildSteps(phase) }),
40713
40739
  phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
40714
40740
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
40715
40741
  Box_default,
@@ -40736,13 +40762,20 @@ ${prBody}`;
40736
40762
  ] }),
40737
40763
  phase === "copied" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, marginTop: 1, children: [
40738
40764
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.green, children: "\u2713" }),
40739
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "PR description copiada para o clipboard!" })
40765
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "PR description copiada" }),
40766
+ prTitle && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { color: C.dim, children: [
40767
+ "\xB7 ",
40768
+ prTitle
40769
+ ] })
40740
40770
  ] }),
40741
40771
  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..." }) }),
40742
- 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: [
40743
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.red, children: "\u2717" }),
40744
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.red, children: errorMsg })
40745
- ] }) }),
40772
+ phase === "error-auth" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
40773
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, children: [
40774
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.red, children: "\u2717" }),
40775
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.red, children: errorMsg })
40776
+ ] }),
40777
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "\u2192 Execute repomind login" }) })
40778
+ ] }),
40746
40779
  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: [
40747
40780
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.yellow, children: "\u25B2" }),
40748
40781
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.yellow, children: errorMsg })
@@ -41020,6 +41053,7 @@ function SplitApp({
41020
41053
  const [skippedGroups, setSkippedGroups] = (0, import_react41.useState)(/* @__PURE__ */ new Set());
41021
41054
  const [commitProgress, setCommitProgress] = (0, import_react41.useState)(0);
41022
41055
  const [errorMsg, setErrorMsg] = (0, import_react41.useState)("");
41056
+ const [orphanCount, setOrphanCount] = (0, import_react41.useState)(0);
41023
41057
  const [originalFiles, setOriginalFiles] = (0, import_react41.useState)([]);
41024
41058
  const [hunksMap, setHunksMap] = (0, import_react41.useState)(/* @__PURE__ */ new Map());
41025
41059
  const [patchMap, setPatchMap] = (0, import_react41.useState)(/* @__PURE__ */ new Map());
@@ -41052,6 +41086,9 @@ function SplitApp({
41052
41086
  (a, b) => a.order - b.order
41053
41087
  );
41054
41088
  setGroups(sortedGroups);
41089
+ if (stream.result.orphans?.length) {
41090
+ setOrphanCount(stream.result.orphans.length);
41091
+ }
41055
41092
  setPhase("review");
41056
41093
  return;
41057
41094
  }
@@ -41199,7 +41236,7 @@ function SplitApp({
41199
41236
  }
41200
41237
  const currentHunks = deps.parseHunks(currentDiff);
41201
41238
  const originalHunks = hunksMap.get(fileRef.path) ?? [];
41202
- const lineSelections = [];
41239
+ const allLineSelections = [];
41203
41240
  for (const hs of fileRef.selection) {
41204
41241
  const origHunk = originalHunks.find(
41205
41242
  (h) => h.index === hs.hunkIndex
@@ -41219,20 +41256,29 @@ function SplitApp({
41219
41256
  }
41220
41257
  }
41221
41258
  if (matchedIndices.length > 0) {
41222
- lineSelections.push({
41259
+ allLineSelections.push({
41223
41260
  hunkIndex: curHunk.index,
41224
41261
  lineIndices: matchedIndices
41225
41262
  });
41226
41263
  }
41227
41264
  }
41228
- if (lineSelections.length > 0) {
41229
- await deps.stageLines(currentDiff, lineSelections);
41230
- }
41265
+ }
41266
+ if (allLineSelections.length > 0) {
41267
+ await deps.stageLines(currentDiff, allLineSelections);
41231
41268
  }
41232
41269
  }
41233
41270
  }
41271
+ if (!group.message) {
41272
+ await deps.resetStaging();
41273
+ setErrorMsg(
41274
+ `Mensagem vazia no grupo ${i + 1}/${activeGroups2.length}. Abortando.`
41275
+ );
41276
+ setPhase("error-commit");
41277
+ return;
41278
+ }
41234
41279
  const code = await deps.runGitCommit(group.message);
41235
41280
  if (code !== 0) {
41281
+ await deps.resetStaging();
41236
41282
  setErrorMsg(
41237
41283
  `git commit falhou no grupo ${i + 1}/${activeGroups2.length}: "${group.message}"`
41238
41284
  );
@@ -41246,6 +41292,8 @@ function SplitApp({
41246
41292
  }
41247
41293
  setCommitProgress(i + 1);
41248
41294
  } catch (e) {
41295
+ await deps.resetStaging().catch(() => {
41296
+ });
41249
41297
  const detail = e instanceof Error ? e.message : "Erro desconhecido";
41250
41298
  setErrorMsg(`Erro no grupo ${i + 1}/${activeGroups2.length}: ${detail}`);
41251
41299
  setPhase("error-commit");
@@ -41339,6 +41387,23 @@ function SplitApp({
41339
41387
  group.groupId
41340
41388
  );
41341
41389
  }),
41390
+ orphanCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { marginTop: 1, gap: 1, children: [
41391
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.yellow, children: "\u25B2" }),
41392
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { color: C.yellow, children: [
41393
+ orphanCount,
41394
+ " linha",
41395
+ orphanCount !== 1 ? "s" : "",
41396
+ " n\xE3o agrupada",
41397
+ orphanCount !== 1 ? "s" : "",
41398
+ " (ser\xE3o preservadas no working tree)"
41399
+ ] })
41400
+ ] }),
41401
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { color: C.dim, children: [
41402
+ selectedIndex + 1,
41403
+ "/",
41404
+ groups.length,
41405
+ skippedGroups.size > 0 ? ` \xB7 ${skippedGroups.size} pulado${skippedGroups.size !== 1 ? "s" : ""}` : ""
41406
+ ] }) }),
41342
41407
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
41343
41408
  KeyHints,
41344
41409
  {
@@ -41419,9 +41484,19 @@ function SplitApp({
41419
41484
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.red, children: errorMsg })
41420
41485
  ] })
41421
41486
  ] }),
41422
- (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: [
41423
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.red, children: "\u2717" }),
41424
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.red, children: errorMsg })
41487
+ phase === "error-empty" && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
41488
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { gap: 1, children: [
41489
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.yellow, children: "\u25B2" }),
41490
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.yellow, children: errorMsg })
41491
+ ] }),
41492
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.dim, children: "\u2192 Use git add ou remova --staged" }) })
41493
+ ] }),
41494
+ (phase === "error-auth" || phase === "error-git" || phase === "error-api" || phase === "error-plan") && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
41495
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { gap: 1, children: [
41496
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.red, children: "\u2717" }),
41497
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.red, children: errorMsg })
41498
+ ] }),
41499
+ phase === "error-auth" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { color: C.dim, children: "\u2192 Execute repomind login" }) })
41425
41500
  ] }),
41426
41501
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box_default, { marginTop: 1 })
41427
41502
  ] })
@@ -41431,8 +41506,8 @@ function SplitApp({
41431
41506
  // src/commands/split.ts
41432
41507
  async function runGitCommit2(message) {
41433
41508
  const proc = Bun.spawn(["git", "commit", "-m", message], {
41434
- stdout: "inherit",
41435
- stderr: "inherit"
41509
+ stdout: "pipe",
41510
+ stderr: "pipe"
41436
41511
  });
41437
41512
  return proc.exited;
41438
41513
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repomind",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "type": "module",
5
5
  "description": "AI-powered git commit messages and repository insights",
6
6
  "keywords": ["git", "ai", "commit", "cli"],