pull-request-split-advisor 3.2.9 → 3.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +22 -11
- package/dist/git/git.js +11 -9
- package/dist/output/report.js +6 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -409,7 +409,7 @@ async function main() {
|
|
|
409
409
|
ui.table(["SHA", "Mensaje"], sibling.commits.map((c) => [c.sha, c.subject]), true);
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
ui.subsection(`#${siblings.length + 1} ${currentBranch}
|
|
412
|
+
ui.subsection(`#${siblings.length + 1} ${currentBranch} ✔ rama actual`);
|
|
413
413
|
if (currentBranchCommits.length === 0) {
|
|
414
414
|
ui.muted(" Sin commits detectados.");
|
|
415
415
|
}
|
|
@@ -419,13 +419,30 @@ async function main() {
|
|
|
419
419
|
}
|
|
420
420
|
// ─── Pipeline de análisis ────────────────────────────────────────────────
|
|
421
421
|
ui.spinner.start("Analizando cambios del working tree...");
|
|
422
|
-
const
|
|
423
|
-
if (!
|
|
422
|
+
const allChangedFiles = gatherChangedFiles(config, baseBranch);
|
|
423
|
+
if (!allChangedFiles.length) {
|
|
424
424
|
ui.spinner.stop();
|
|
425
425
|
ui.warn("No hay cambios respecto a la rama base.");
|
|
426
426
|
closeReadlineInterface();
|
|
427
427
|
return;
|
|
428
428
|
}
|
|
429
|
+
// ─── Computar origen de cada archivo en el árbol git ─────────────────────
|
|
430
|
+
// Se calcula ANTES del pipeline para filtrar el análisis a solo cambios
|
|
431
|
+
// del working tree (WIP: sin commitear o nuevos sin rastrear).
|
|
432
|
+
// Archivos ya commiteados (local-commit / pushed) quedan excluidos del
|
|
433
|
+
// plan de PRs, igual que hace el subcomando 'score'.
|
|
434
|
+
resetTrackedFilesCache();
|
|
435
|
+
const origins = computeFileOrigins(allChangedFiles, baseBranch, currentBranch, remote);
|
|
436
|
+
const changedFiles = allChangedFiles.filter((f) => {
|
|
437
|
+
const o = origins.get(f) ?? "working-tree";
|
|
438
|
+
return o === "working-tree" || o === "untracked";
|
|
439
|
+
});
|
|
440
|
+
if (changedFiles.length === 0) {
|
|
441
|
+
ui.spinner.stop();
|
|
442
|
+
ui.info("No hay cambios en el working tree. Solo existen commits locales o publicados.");
|
|
443
|
+
closeReadlineInterface();
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
429
446
|
const fileStats = getFileStats(changedFiles, baseBranch);
|
|
430
447
|
const deps = buildDependencyEdges(changedFiles);
|
|
431
448
|
const blocks = buildBlocks(fileStats, config, deps);
|
|
@@ -437,13 +454,6 @@ async function main() {
|
|
|
437
454
|
const plans = findBestPlan(blocks, currentBranch, config, deps);
|
|
438
455
|
config.testCoveragePercent = computeTestCoveragePercent(fileStats);
|
|
439
456
|
ui.spinner.stop("Analisis completado.");
|
|
440
|
-
// ─── Computar origen de cada archivo en el árbol git ─────────────────────
|
|
441
|
-
// Diferencia entre: ya publicado (REMOTO), commiteado local (LOCAL),
|
|
442
|
-
// cambio sin commitear (WIP) y archivo nuevo sin rastrear (NUEVO).
|
|
443
|
-
// Resetear la caché de tracked files para que computeFileOrigins use
|
|
444
|
-
// un Set fresco (evita stale data si el index cambió durante el análisis).
|
|
445
|
-
resetTrackedFilesCache();
|
|
446
|
-
const origins = computeFileOrigins(changedFiles, baseBranch, currentBranch, remote);
|
|
447
457
|
for (const stat of fileStats) {
|
|
448
458
|
stat.origin = origins.get(stat.path);
|
|
449
459
|
}
|
|
@@ -462,7 +472,8 @@ async function main() {
|
|
|
462
472
|
printBlocks(blocks);
|
|
463
473
|
printPlans(plans, baseBranch, currentBranch, config);
|
|
464
474
|
// ─── Exportar reporte HTML ───────────────────────────────────────────────
|
|
465
|
-
|
|
475
|
+
// Todos los fileStats ya son WIP (filtrado antes del pipeline).
|
|
476
|
+
const wipFileStats = fileStats;
|
|
466
477
|
const reportInput = { currentBranch, baseBranch, config, fileStats, wipFileStats, deps, blocks, plans, cascadeWarning };
|
|
467
478
|
const htmlFile = "pr-split-report.html";
|
|
468
479
|
writeHtmlReport(htmlFile, reportInput);
|
package/dist/git/git.js
CHANGED
|
@@ -294,17 +294,19 @@ function discoverSortedSiblings(currentBranch, baseBranch, familyPrefix) {
|
|
|
294
294
|
!/backup/i.test(name));
|
|
295
295
|
if (candidates.length === 0)
|
|
296
296
|
return [];
|
|
297
|
-
const withAhead = candidates
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
const withAhead = candidates
|
|
298
|
+
.map(({ name, ref }) => ({
|
|
299
|
+
name,
|
|
300
|
+
ref,
|
|
301
|
+
count: parseInt(shSafe(`git rev-list ${q(baseBranch)}..${q(ref)} --count`), 10) || 0,
|
|
302
|
+
}))
|
|
303
|
+
.filter(({ count }) => count > 0);
|
|
301
304
|
if (withAhead.length === 0)
|
|
302
305
|
return [];
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
});
|
|
306
|
+
// Ordenar por nº de commits DESC: más commits = más al final de la cadena de cascada.
|
|
307
|
+
// findCascadeParent toma sorted[0] (más commits = rama más reciente = padre correcto).
|
|
308
|
+
// findCascadeSiblings invierte el array → orden ASC = menos commits (#1) primero.
|
|
309
|
+
return withAhead.sort((a, b) => b.count - a.count);
|
|
308
310
|
}
|
|
309
311
|
/**
|
|
310
312
|
* Busca la rama hermana más reciente de la misma "familia" con commits adelantados
|
package/dist/output/report.js
CHANGED
|
@@ -511,14 +511,18 @@ export function renderHtmlReport(input) {
|
|
|
511
511
|
];
|
|
512
512
|
const cascadeStateHtml = allBranches.map((branch, idx) => {
|
|
513
513
|
const num = idx + 1;
|
|
514
|
-
const color = branch.isCurrent ? "#
|
|
514
|
+
const color = branch.isCurrent ? "#4ade80" : "#94a3b8";
|
|
515
515
|
const commitsHtml = branch.commits.length > 0
|
|
516
516
|
? `<ul style="margin:4px 0 0 0;padding:0;list-style:none">${branch.commits.map((c) => `<li style="font-size:.82em;padding:2px 0">` +
|
|
517
517
|
`<code style="color:#60a5fa;margin-right:8px">${esc(c.sha)}</code>` +
|
|
518
518
|
`<span style="opacity:.9">${esc(c.subject)}</span></li>`).join("")}</ul>`
|
|
519
519
|
: `<div style="font-size:.8em;opacity:.5;margin-top:2px">Sin commits</div>`;
|
|
520
520
|
return `<div style="margin:6px 0;padding:8px 10px;background:rgba(0,0,0,.15);border-radius:5px;border-left:3px solid ${color}">
|
|
521
|
-
<div style="
|
|
521
|
+
<div style="display:flex;align-items:center;gap:6px;margin-bottom:4px">
|
|
522
|
+
<span style="font-size:.75em;font-weight:700;opacity:.5;min-width:22px">#${num}</span>
|
|
523
|
+
<code style="display:inline-block;background:#fff;color:#1e293b;font-size:.8em;font-weight:600;padding:1px 7px;border-radius:4px;letter-spacing:.01em">${esc(branch.name)}</code>
|
|
524
|
+
${branch.isCurrent ? `<span style="font-size:.75em;color:#4ade80;font-weight:600">← rama actual</span>` : ""}
|
|
525
|
+
</div>
|
|
522
526
|
${commitsHtml}
|
|
523
527
|
</div>`;
|
|
524
528
|
}).join("");
|
package/package.json
CHANGED