pull-request-split-advisor 3.2.8 → 3.2.10
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 +25 -13
- package/dist/git/git.js +13 -10
- package/dist/output/report.js +9 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -399,8 +399,9 @@ async function main() {
|
|
|
399
399
|
], "red");
|
|
400
400
|
// ─── Estado de la cascada en terminal ───────────────────────────────────
|
|
401
401
|
ui.section("ESTADO DE LA CASCADA", "#");
|
|
402
|
-
for (
|
|
403
|
-
|
|
402
|
+
for (let i = 0; i < siblings.length; i++) {
|
|
403
|
+
const sibling = siblings[i];
|
|
404
|
+
ui.subsection(`#${i + 1} ${sibling.name}`);
|
|
404
405
|
if (sibling.commits.length === 0) {
|
|
405
406
|
ui.muted(" Sin commits detectados.");
|
|
406
407
|
}
|
|
@@ -408,7 +409,7 @@ async function main() {
|
|
|
408
409
|
ui.table(["SHA", "Mensaje"], sibling.commits.map((c) => [c.sha, c.subject]), true);
|
|
409
410
|
}
|
|
410
411
|
}
|
|
411
|
-
ui.subsection(
|
|
412
|
+
ui.subsection(`#${siblings.length + 1} ${currentBranch} ← rama actual`);
|
|
412
413
|
if (currentBranchCommits.length === 0) {
|
|
413
414
|
ui.muted(" Sin commits detectados.");
|
|
414
415
|
}
|
|
@@ -418,13 +419,30 @@ async function main() {
|
|
|
418
419
|
}
|
|
419
420
|
// ─── Pipeline de análisis ────────────────────────────────────────────────
|
|
420
421
|
ui.spinner.start("Analizando cambios del working tree...");
|
|
421
|
-
const
|
|
422
|
-
if (!
|
|
422
|
+
const allChangedFiles = gatherChangedFiles(config, baseBranch);
|
|
423
|
+
if (!allChangedFiles.length) {
|
|
423
424
|
ui.spinner.stop();
|
|
424
425
|
ui.warn("No hay cambios respecto a la rama base.");
|
|
425
426
|
closeReadlineInterface();
|
|
426
427
|
return;
|
|
427
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
|
+
}
|
|
428
446
|
const fileStats = getFileStats(changedFiles, baseBranch);
|
|
429
447
|
const deps = buildDependencyEdges(changedFiles);
|
|
430
448
|
const blocks = buildBlocks(fileStats, config, deps);
|
|
@@ -436,13 +454,6 @@ async function main() {
|
|
|
436
454
|
const plans = findBestPlan(blocks, currentBranch, config, deps);
|
|
437
455
|
config.testCoveragePercent = computeTestCoveragePercent(fileStats);
|
|
438
456
|
ui.spinner.stop("Analisis completado.");
|
|
439
|
-
// ─── Computar origen de cada archivo en el árbol git ─────────────────────
|
|
440
|
-
// Diferencia entre: ya publicado (REMOTO), commiteado local (LOCAL),
|
|
441
|
-
// cambio sin commitear (WIP) y archivo nuevo sin rastrear (NUEVO).
|
|
442
|
-
// Resetear la caché de tracked files para que computeFileOrigins use
|
|
443
|
-
// un Set fresco (evita stale data si el index cambió durante el análisis).
|
|
444
|
-
resetTrackedFilesCache();
|
|
445
|
-
const origins = computeFileOrigins(changedFiles, baseBranch, currentBranch, remote);
|
|
446
457
|
for (const stat of fileStats) {
|
|
447
458
|
stat.origin = origins.get(stat.path);
|
|
448
459
|
}
|
|
@@ -461,7 +472,8 @@ async function main() {
|
|
|
461
472
|
printBlocks(blocks);
|
|
462
473
|
printPlans(plans, baseBranch, currentBranch, config);
|
|
463
474
|
// ─── Exportar reporte HTML ───────────────────────────────────────────────
|
|
464
|
-
|
|
475
|
+
// Todos los fileStats ya son WIP (filtrado antes del pipeline).
|
|
476
|
+
const wipFileStats = fileStats;
|
|
465
477
|
const reportInput = { currentBranch, baseBranch, config, fileStats, wipFileStats, deps, blocks, plans, cascadeWarning };
|
|
466
478
|
const htmlFile = "pr-split-report.html";
|
|
467
479
|
writeHtmlReport(htmlFile, reportInput);
|
package/dist/git/git.js
CHANGED
|
@@ -290,20 +290,23 @@ function discoverSortedSiblings(currentBranch, baseBranch, familyPrefix) {
|
|
|
290
290
|
seenNames.add(name.toUpperCase());
|
|
291
291
|
}
|
|
292
292
|
const candidates = branches.filter(({ name }) => name !== currentBranch &&
|
|
293
|
-
name.toUpperCase().startsWith(familyPrefix.toUpperCase())
|
|
293
|
+
name.toUpperCase().startsWith(familyPrefix.toUpperCase()) &&
|
|
294
|
+
!/backup/i.test(name));
|
|
294
295
|
if (candidates.length === 0)
|
|
295
296
|
return [];
|
|
296
|
-
const withAhead = candidates
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
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);
|
|
300
304
|
if (withAhead.length === 0)
|
|
301
305
|
return [];
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
});
|
|
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);
|
|
307
310
|
}
|
|
308
311
|
/**
|
|
309
312
|
* Busca la rama hermana más reciente de la misma "familia" con commits adelantados
|
package/dist/output/report.js
CHANGED
|
@@ -509,14 +509,20 @@ export function renderHtmlReport(input) {
|
|
|
509
509
|
...cw.siblings,
|
|
510
510
|
{ name: currentBranch, commits: cw.currentBranchCommits, isCurrent: true }
|
|
511
511
|
];
|
|
512
|
-
const cascadeStateHtml = allBranches.map((branch) => {
|
|
512
|
+
const cascadeStateHtml = allBranches.map((branch, idx) => {
|
|
513
|
+
const num = idx + 1;
|
|
514
|
+
const color = branch.isCurrent ? "#e2e8f0" : "#94a3b8";
|
|
513
515
|
const commitsHtml = branch.commits.length > 0
|
|
514
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">` +
|
|
515
517
|
`<code style="color:#60a5fa;margin-right:8px">${esc(c.sha)}</code>` +
|
|
516
518
|
`<span style="opacity:.9">${esc(c.subject)}</span></li>`).join("")}</ul>`
|
|
517
519
|
: `<div style="font-size:.8em;opacity:.5;margin-top:2px">Sin commits</div>`;
|
|
518
|
-
return `<div style="margin:6px 0;padding:8px 10px;background:rgba(0,0,0,.15);border-radius:5px;border-left:3px solid ${
|
|
519
|
-
<div style="
|
|
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="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:#e2e8f0;opacity:.7">← rama actual</span>` : ""}
|
|
525
|
+
</div>
|
|
520
526
|
${commitsHtml}
|
|
521
527
|
</div>`;
|
|
522
528
|
}).join("");
|
package/package.json
CHANGED