repomind 0.9.1 → 0.10.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 +59 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -77070,9 +77070,20 @@ function parseDiffStats(diff2) {
77070
77070
  if (currentPath !== null) {
77071
77071
  files.push({ path: currentPath, additions, deletions });
77072
77072
  }
77073
- const totalAdditions = files.reduce((s, f) => s + f.additions, 0);
77074
- const totalDeletions = files.reduce((s, f) => s + f.deletions, 0);
77075
- return { files, totalAdditions, totalDeletions };
77073
+ const byPath = /* @__PURE__ */ new Map();
77074
+ for (const f of files) {
77075
+ const existing = byPath.get(f.path);
77076
+ if (existing) {
77077
+ existing.additions += f.additions;
77078
+ existing.deletions += f.deletions;
77079
+ } else {
77080
+ byPath.set(f.path, { ...f });
77081
+ }
77082
+ }
77083
+ const merged = [...byPath.values()];
77084
+ const totalAdditions = merged.reduce((s, f) => s + f.additions, 0);
77085
+ const totalDeletions = merged.reduce((s, f) => s + f.deletions, 0);
77086
+ return { files: merged, totalAdditions, totalDeletions };
77076
77087
  }
77077
77088
  function verifyCommitIntegrity(originalDiff, committedDiff) {
77078
77089
  const original = parseDiffStats(originalDiff);
@@ -77117,16 +77128,21 @@ function verifyCommitIntegrity(originalDiff, committedDiff) {
77117
77128
  }
77118
77129
  return { match: true };
77119
77130
  }
77120
- async function captureCommittedDiff(cwd2, commitCount) {
77121
- return runGitAt(cwd2, ["diff", `HEAD~${commitCount}..HEAD`]);
77131
+ async function captureCommittedDiff(wtPath, commitCount, repoRoot) {
77132
+ return runGitAt(repoRoot, [
77133
+ "-C",
77134
+ wtPath,
77135
+ "diff",
77136
+ `HEAD~${commitCount}..HEAD`
77137
+ ]);
77122
77138
  }
77123
77139
 
77124
77140
  // ../../packages/git/src/worktree.ts
77125
- async function applyPatchInWorktree(wtPath, patch) {
77141
+ async function applyPatchInWorktree(wtPath, patch, repoRoot) {
77126
77142
  const normalizedPatch = patch.endsWith("\n") ? patch : `${patch}
77127
77143
  `;
77128
- const proc = Bun.spawn(["git", "apply", "--index", "--3way"], {
77129
- cwd: wtPath,
77144
+ const proc = Bun.spawn(["git", "-C", wtPath, "apply", "--index", "--3way"], {
77145
+ cwd: repoRoot,
77130
77146
  stdin: "pipe",
77131
77147
  stdout: "pipe",
77132
77148
  stderr: "pipe"
@@ -77167,6 +77183,8 @@ async function commitViaWorktree(repoRoot, groups, options) {
77167
77183
  log4(`creating worktree at: ${wtPath}`);
77168
77184
  await runGitAt(repoRoot, ["worktree", "add", "--detach", wtPath, "HEAD"]);
77169
77185
  try {
77186
+ let actualCommitCount = 0;
77187
+ const appliedPatches = [];
77170
77188
  for (let i = 0; i < groups.length; i++) {
77171
77189
  const group = groups[i];
77172
77190
  log4(
@@ -77180,17 +77198,21 @@ async function commitViaWorktree(repoRoot, groups, options) {
77180
77198
  log4(
77181
77199
  ` applying patch ${j + 1}/${group.patches.length} (${group.patches[j].length} chars)`
77182
77200
  );
77183
- await applyPatchInWorktree(wtPath, group.patches[j]);
77201
+ await applyPatchInWorktree(wtPath, group.patches[j], repoRoot);
77202
+ appliedPatches.push(group.patches[j]);
77184
77203
  }
77185
- await runGitAt(wtPath, ["commit", "-m", group.message]);
77204
+ await runGitAt(repoRoot, ["-C", wtPath, "commit", "-m", group.message]);
77205
+ actualCommitCount++;
77186
77206
  log4(" committed");
77187
77207
  }
77188
- if (options?.originalDiff && !options?.skipVerification) {
77189
- const committedDiff = await captureCommittedDiff(wtPath, groups.length);
77190
- const verification = verifyCommitIntegrity(
77191
- options.originalDiff,
77192
- committedDiff
77208
+ if (actualCommitCount > 0 && !options?.skipVerification) {
77209
+ const expectedDiff = appliedPatches.join("\n");
77210
+ const committedDiff = await captureCommittedDiff(
77211
+ wtPath,
77212
+ actualCommitCount,
77213
+ repoRoot
77193
77214
  );
77215
+ const verification = verifyCommitIntegrity(expectedDiff, committedDiff);
77194
77216
  log4(
77195
77217
  `verification: match=${verification.match}${verification.details ? ` (${verification.details})` : ""}`
77196
77218
  );
@@ -77200,7 +77222,7 @@ async function commitViaWorktree(repoRoot, groups, options) {
77200
77222
  );
77201
77223
  }
77202
77224
  }
77203
- const wtHead = (await runGitAt(wtPath, ["rev-parse", "HEAD"])).trim();
77225
+ const wtHead = (await runGitAt(repoRoot, ["-C", wtPath, "rev-parse", "HEAD"])).trim();
77204
77226
  log4(`fast-forward: ${branchRef} -> ${wtHead}`);
77205
77227
  await runGitAt(repoRoot, ["update-ref", branchRef, wtHead]);
77206
77228
  await runGitAt(repoRoot, ["reset", "HEAD"]);
@@ -89506,11 +89528,15 @@ ${prefixed}`);
89506
89528
  setPhase("error-commit");
89507
89529
  return;
89508
89530
  }
89509
- if (deps.captureCommittedDiff && deps.verifyCommitIntegrity && deps.getRepoRoot && deps.runGitReset) {
89531
+ if (!deps.skipVerification && deps.captureCommittedDiff && deps.verifyCommitIntegrity && deps.getRepoRoot && deps.runGitReset) {
89510
89532
  setPhase("verifying");
89511
89533
  try {
89512
89534
  const repoRoot = await deps.getRepoRoot();
89513
- const committedDiff = await deps.captureCommittedDiff(repoRoot, 1);
89535
+ const committedDiff = await deps.captureCommittedDiff(
89536
+ repoRoot,
89537
+ 1,
89538
+ repoRoot
89539
+ );
89514
89540
  const verification = deps.verifyCommitIntegrity(
89515
89541
  rawDiff,
89516
89542
  committedDiff
@@ -89830,6 +89856,7 @@ async function commitCommand() {
89830
89856
  }
89831
89857
  const fileConfig = await readRepoConfig();
89832
89858
  const instructions = await resolveInstructions("commit");
89859
+ const skipVerification = process.argv.includes("--no-verify");
89833
89860
  let exitCode = 0;
89834
89861
  let completedMessage = "";
89835
89862
  let errorMessage = "";
@@ -89848,7 +89875,8 @@ async function commitCommand() {
89848
89875
  getRepoRoot,
89849
89876
  runGitReset,
89850
89877
  fileConfig,
89851
- instructionsOverride: instructions
89878
+ instructionsOverride: instructions,
89879
+ skipVerification
89852
89880
  },
89853
89881
  onExit: (code, message, error4) => {
89854
89882
  exitCode = code;
@@ -91440,12 +91468,9 @@ ${body}`;
91440
91468
  const repoRoot = await deps.getRepoRoot();
91441
91469
  log4(`repoRoot: ${repoRoot}`);
91442
91470
  setPhase("verifying");
91443
- const hasSkippedGroups = worktreeGroups.some(
91444
- (g) => g.patches.length === 0
91445
- );
91446
91471
  await deps.commitViaWorktree(repoRoot, worktreeGroups, {
91447
91472
  originalDiff: originalRawDiff,
91448
- skipVerification: hasSkippedGroups
91473
+ skipVerification: deps.skipVerification
91449
91474
  });
91450
91475
  log4("commitViaWorktree done (verified)");
91451
91476
  let hashes = [];
@@ -91776,6 +91801,7 @@ async function runGitCommit2(message) {
91776
91801
  async function splitCommand() {
91777
91802
  const fileConfig = await readRepoConfig();
91778
91803
  const useStaged = !process.argv.includes("--all");
91804
+ const skipVerification = process.argv.includes("--no-verify");
91779
91805
  const instructions = await resolveInstructions("split");
91780
91806
  let exitCode = 0;
91781
91807
  let completedCommits = [];
@@ -91805,7 +91831,8 @@ async function splitCommand() {
91805
91831
  getRepoRoot,
91806
91832
  fileConfig,
91807
91833
  instructionsOverride: instructions,
91808
- useStaged
91834
+ useStaged,
91835
+ skipVerification
91809
91836
  },
91810
91837
  onExit: (code, commits, error4) => {
91811
91838
  exitCode = code;
@@ -92002,6 +92029,10 @@ var COMMAND_HELP = {
92002
92029
  name: "--instructions [texto]",
92003
92030
  description: 'Instru\xE7\xF5es pontuais para esta gera\xE7\xE3o (ex: "foca na parte de auth"). Sem texto abre um editor interativo.'
92004
92031
  },
92032
+ {
92033
+ name: "--no-verify",
92034
+ description: "Pular verifica\xE7\xE3o de integridade do diff p\xF3s-commit"
92035
+ },
92005
92036
  {
92006
92037
  name: "--verbose",
92007
92038
  alias: "-v",
@@ -92020,6 +92051,10 @@ var COMMAND_HELP = {
92020
92051
  name: "--instructions [texto]",
92021
92052
  description: 'Instru\xE7\xF5es pontuais para esta gera\xE7\xE3o (ex: "separa migration do model"). Sem texto abre um editor interativo.'
92022
92053
  },
92054
+ {
92055
+ name: "--no-verify",
92056
+ description: "Pular verifica\xE7\xE3o de integridade do diff p\xF3s-commit"
92057
+ },
92023
92058
  {
92024
92059
  name: "--verbose",
92025
92060
  alias: "-v",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repomind",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "AI-powered git commit messages and repository insights",
6
6
  "keywords": [