pull-request-split-advisor 3.2.18 → 3.2.19

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 CHANGED
@@ -86,8 +86,16 @@ async function enrichCommitTickets(plans, config) {
86
86
  const preview = `${commit.suggestedType}(${commit.suggestedScope}): ${commit.suggestedSubject}`;
87
87
  ui.muted(`Commit ${commit.index}`);
88
88
  ui.muted(`Titulo base: ${preview}`);
89
- const enteredNumber = await ui.prompt(`Numero de subtarea para commit ${commit.index}`, baseStoryNumber);
90
- const normalizedNumber = normalizeStoryNumber(enteredNumber) || baseStoryNumber;
89
+ let normalizedNumber;
90
+ if (config.nonInteractive) {
91
+ // Modo no interactivo: usar siempre el número por defecto del plan
92
+ normalizedNumber = normalizeStoryNumber(baseStoryNumber) || baseStoryNumber;
93
+ ui.muted(` Subtarea (default): ${normalizedNumber}`);
94
+ }
95
+ else {
96
+ const enteredNumber = await ui.prompt(`Numero de subtarea para commit ${commit.index}`, baseStoryNumber);
97
+ normalizedNumber = normalizeStoryNumber(enteredNumber) || baseStoryNumber;
98
+ }
91
99
  const finalTicket = `${teamCode}-${normalizedNumber}`;
92
100
  commit.ticketCode = finalTicket;
93
101
  commit.suggestedMessage = buildSuggestedMessage(commit.suggestedType, commit.suggestedScope, commit.suggestedSubject, finalTicket);
@@ -287,6 +295,7 @@ async function main() {
287
295
  .version(APP_VERSION, "-v, --version", "muestra la version actual")
288
296
  .option("-b, --base <branch>", "rama base para analizar cambios del PR")
289
297
  .option("--apply", "aplica el plan: crea ramas y commits (Enter acepta el valor sugerido)")
298
+ .option("-y, --yes", "modo no interactivo: omite todos los prompts y usa los valores por defecto del plan")
290
299
  .option("--stats", "muestra el historial de scores y sale");
291
300
  // ─── Acción principal (análisis de PRs) ─────────────────────────────────
292
301
  // Se registra como .action() del programa raíz para que Commander la ejecute
@@ -528,6 +537,9 @@ async function main() {
528
537
  // para preservar la integridad del plan en cascada.
529
538
  const shouldApply = !branchHasCommits && (!!options.apply || await ui.confirm("¿Deseas aplicar el plan ahora?"));
530
539
  if (shouldApply) {
540
+ if (options.yes) {
541
+ config.nonInteractive = true;
542
+ }
531
543
  await enrichCommitTickets(plans, config);
532
544
  try {
533
545
  await applyPlan(plans, config);
@@ -91,6 +91,7 @@ export const defaultConfig = {
91
91
  runtimeExcludedFiles: [],
92
92
  branchNamingContext: undefined,
93
93
  verbose: false,
94
+ nonInteractive: false,
94
95
  // ── Métricas de scoring ───────────────────────────────────────────────────
95
96
  //
96
97
  // Orden posicional REQUERIDO (no cambiar el orden de las claves):
@@ -219,4 +220,5 @@ export const defaultConfig = {
219
220
  export const RUNTIME_ONLY_FIELDS = [
220
221
  "runtimeExcludedFiles",
221
222
  "branchNamingContext",
223
+ "nonInteractive",
222
224
  ];
@@ -263,7 +263,9 @@ export async function applyPlan(plans, config) {
263
263
  for (let i = 0; i < existingBasePlan.commitPlan.length; i++) {
264
264
  const commit = existingBasePlan.commitPlan[i];
265
265
  let commitMessage = buildCommitMessage(existingBasePlan, i);
266
- commitMessage = await ui.prompt(` Commit ${commit.index} — mensaje`, commitMessage);
266
+ if (!config.nonInteractive) {
267
+ commitMessage = await ui.prompt(` Commit ${commit.index} — mensaje`, commitMessage);
268
+ }
267
269
  ui.subsection(`Commit ${commit.index}`);
268
270
  ui.muted(`Mensaje: ${commitMessage}`);
269
271
  ui.fileList(commit.files, 100);
@@ -285,7 +287,14 @@ export async function applyPlan(plans, config) {
285
287
  // Bug fix 3: mostrar el prompt ANTES de ui.section para que el header
286
288
  // refleje el nombre FINAL elegido por el usuario, no el sugerido.
287
289
  ui.muted(`\n Rama sugerida: ${plan.name} (${totalAssigned} archivos asignados)`);
288
- let targetBranch = await ui.prompt("Nombre de la rama", plan.name);
290
+ let targetBranch;
291
+ if (config.nonInteractive) {
292
+ targetBranch = plan.name;
293
+ ui.muted(` Nombre de la rama (default): ${targetBranch}`);
294
+ }
295
+ else {
296
+ targetBranch = await ui.prompt("Nombre de la rama", plan.name);
297
+ }
289
298
  // Validar unicidad: re-pedir si el nombre ya está reservado en esta sesión
290
299
  // o ya existe como rama local. Evita el crash y rollback por colisión.
291
300
  while (reservedNames.has(targetBranch) || branchExists(targetBranch)) {
@@ -295,7 +304,13 @@ export async function applyPlan(plans, config) {
295
304
  else {
296
305
  ui.warn(`La rama local '${targetBranch}' ya existe. Elíminala primero o elige otro nombre.`);
297
306
  }
298
- targetBranch = await ui.prompt("Nombre de la rama", `${targetBranch}-2`);
307
+ if (config.nonInteractive) {
308
+ targetBranch = `${targetBranch}-2`;
309
+ ui.muted(` Nombre alternativo: ${targetBranch}`);
310
+ }
311
+ else {
312
+ targetBranch = await ui.prompt("Nombre de la rama", `${targetBranch}-2`);
313
+ }
299
314
  }
300
315
  reservedNames.add(targetBranch);
301
316
  ui.section(`RAMA: ${targetBranch}`, "#");
@@ -306,7 +321,9 @@ export async function applyPlan(plans, config) {
306
321
  for (let i = 0; i < plan.commitPlan.length; i++) {
307
322
  const commit = plan.commitPlan[i];
308
323
  let commitMessage = buildCommitMessage(plan, i);
309
- commitMessage = await ui.prompt(` Commit ${commit.index} — mensaje`, commitMessage);
324
+ if (!config.nonInteractive) {
325
+ commitMessage = await ui.prompt(` Commit ${commit.index} — mensaje`, commitMessage);
326
+ }
310
327
  ui.subsection(`Commit ${commit.index}`);
311
328
  ui.muted(`Mensaje: ${commitMessage}`);
312
329
  ui.fileList(commit.files, 100);
@@ -338,7 +355,9 @@ export async function applyPlan(plans, config) {
338
355
  for (const branch of allCreated) {
339
356
  ui.muted(` • ${branch}`);
340
357
  }
341
- const publish = await ui.confirm(`¿Deseas publicar las ${allCreated.length} rama(s) en '${remote}'?`);
358
+ const publish = config.nonInteractive
359
+ ? false
360
+ : await ui.confirm(`¿Deseas publicar las ${allCreated.length} rama(s) en '${remote}'?`);
342
361
  if (publish) {
343
362
  ui.section("PUBLICANDO RAMAS EN REMOTO", "#");
344
363
  for (const branch of allCreated) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pull-request-split-advisor",
3
- "version": "3.2.18",
3
+ "version": "3.2.19",
4
4
  "description": "CLI that analyses your Git working tree and suggests how to split changes into smaller, reviewable pull requests and commits.",
5
5
  "keywords": [
6
6
  "git",