@tarcisiopgs/lisa 1.40.0 → 1.40.2

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.
@@ -212,10 +212,12 @@ function parsePrConfig(raw) {
212
212
  if (!raw) return void 0;
213
213
  const reviewers = isStringArray(raw.reviewers) ? raw.reviewers.filter(isValidPrUsername) : void 0;
214
214
  const assignees = isStringArray(raw.assignees) ? raw.assignees.filter(isValidPrUsername) : void 0;
215
- if (!reviewers?.length && !assignees?.length) return void 0;
215
+ const autoMerge = raw.auto_merge === true;
216
+ if (!reviewers?.length && !assignees?.length && !autoMerge) return void 0;
216
217
  return {
217
218
  reviewers: reviewers?.length ? reviewers : void 0,
218
- assignees: assignees?.length ? assignees : void 0
219
+ assignees: assignees?.length ? assignees : void 0,
220
+ auto_merge: autoMerge || void 0
219
221
  };
220
222
  }
221
223
  function loadConfig(cwd = process.cwd()) {
@@ -1236,17 +1238,48 @@ async function pullBaseBranch(config) {
1236
1238
  }
1237
1239
  }
1238
1240
  }
1241
+ var AUTO_MERGE_CI_TIMEOUT_MS = 10 * 60 * 1e3;
1242
+ var AUTO_MERGE_POLL_MS = 15e3;
1239
1243
  async function autoMergePr(prUrl, issueId, config) {
1240
1244
  if (!config.pr?.auto_merge) return;
1241
- log(`Auto-merging PR for ${issueId}...`);
1242
- const { mergePr } = await import("./merge-NWSEV3FR.js");
1243
- const result = await mergePr(prUrl);
1244
- if (result.success) {
1245
- ok(`Auto-merged: ${prUrl}`);
1246
- kanbanEmitter.emit("issue:merged", issueId);
1247
- } else {
1248
- warn(`Auto-merge failed for ${issueId}: ${result.error}`);
1245
+ const { checkPrCiStatus, mergePr } = await import("./merge-NWSEV3FR.js");
1246
+ log(`Waiting for CI before auto-merge of ${issueId}...`);
1247
+ kanbanEmitter.emit("issue:ci-status", issueId, "pending");
1248
+ const deadline = Date.now() + AUTO_MERGE_CI_TIMEOUT_MS;
1249
+ while (Date.now() < deadline) {
1250
+ if (isShuttingDown() || hasUserQuitFromWatchPrompt()) return;
1251
+ const ciStatus = await checkPrCiStatus(prUrl);
1252
+ if (ciStatus === "passing") {
1253
+ kanbanEmitter.emit("issue:ci-status", issueId, "passing");
1254
+ log(`CI passed for ${issueId}. Auto-merging...`);
1255
+ const result = await mergePr(prUrl);
1256
+ if (result.success) {
1257
+ ok(`Auto-merged: ${prUrl}`);
1258
+ kanbanEmitter.emit("issue:merged", issueId);
1259
+ } else {
1260
+ warn(`Auto-merge failed for ${issueId}: ${result.error}`);
1261
+ }
1262
+ return;
1263
+ }
1264
+ if (ciStatus === "failing") {
1265
+ kanbanEmitter.emit("issue:ci-status", issueId, "failing");
1266
+ warn(`CI failed for ${issueId}. Skipping auto-merge.`);
1267
+ return;
1268
+ }
1269
+ if (ciStatus === "unknown") {
1270
+ log(`No CI checks found for ${issueId}. Auto-merging...`);
1271
+ const result = await mergePr(prUrl);
1272
+ if (result.success) {
1273
+ ok(`Auto-merged: ${prUrl}`);
1274
+ kanbanEmitter.emit("issue:merged", issueId);
1275
+ } else {
1276
+ warn(`Auto-merge failed for ${issueId}: ${result.error}`);
1277
+ }
1278
+ return;
1279
+ }
1280
+ await sleep(AUTO_MERGE_POLL_MS);
1249
1281
  }
1282
+ warn(`CI did not complete within timeout for ${issueId}. Skipping auto-merge.`);
1250
1283
  }
1251
1284
  function appendSessionLog(logFile, result) {
1252
1285
  try {
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  runLoop,
15
15
  saveConfig,
16
16
  validateConfig
17
- } from "./chunk-C2Y2NO6I.js";
17
+ } from "./chunk-BI6MR2UP.js";
18
18
  import {
19
19
  CliError,
20
20
  buildExecutionWaves,
@@ -1861,7 +1861,7 @@ async function reviewAndCreate(plan2, planPath, opts) {
1861
1861
  log("Run `lisa run` when ready.");
1862
1862
  return;
1863
1863
  }
1864
- const { runLoop: runLoop2 } = await import("./loop-Y6YS76TH.js");
1864
+ const { runLoop: runLoop2 } = await import("./loop-RWZJG7BG.js");
1865
1865
  const waves = buildExecutionWaves(plan2.issues);
1866
1866
  const maxWaveSize = Math.max(...waves.map((w) => w.length));
1867
1867
  await runLoop2(config2, {
@@ -4,7 +4,7 @@ import {
4
4
  cleanupEventListeners,
5
5
  runDemoLoop,
6
6
  runLoop
7
- } from "./chunk-C2Y2NO6I.js";
7
+ } from "./chunk-BI6MR2UP.js";
8
8
  import {
9
9
  WATCH_POLL_INTERVAL_MS
10
10
  } from "./chunk-YTUZFCU2.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarcisiopgs/lisa",
3
- "version": "1.40.0",
3
+ "version": "1.40.2",
4
4
  "description": "Autonomous issue resolver",
5
5
  "keywords": [
6
6
  "loop",