bosun 0.40.4 → 0.40.5

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/README.md CHANGED
@@ -183,8 +183,15 @@ npm run hooks:install
183
183
 
184
184
  If you find this project useful or would like to stay up to date with new releases, a star is appreciated!
185
185
 
186
- [![Star History Chart](https://api.star-history.com/image?repos=VirtEngine/Bosun&type=date&legend=top-left)](https://www.star-history.com/?repos=VirtEngine%2FBosun&type=date&legend=top-left)
187
-
186
+ ## Star History
187
+
188
+ <a href="https://www.star-history.com/?repos=VirtEngine%2FBosun&type=date&legend=top-left">
189
+ <picture>
190
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/image?repos=VirtEngine/Bosun&type=date&theme=dark&legend=top-left" />
191
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/image?repos=VirtEngine/Bosun&type=date&legend=top-left" />
192
+ <img alt="Star History Chart" src="https://api.star-history.com/image?repos=VirtEngine/Bosun&type=date&legend=top-left" />
193
+ </picture>
194
+ </a>
188
195
  ---
189
196
 
190
197
  ## License
@@ -122,24 +122,36 @@ function extractRepoSlug(prUrl) {
122
122
 
123
123
  /**
124
124
  * Get the PR diff using `gh pr diff` or `git diff`.
125
- * @param {{ prUrl?: string, branchName?: string }} opts
125
+ * @param {{ prUrl?: string, prNumber?: number|string, repoSlug?: string, branchName?: string, cwd?: string|null }} opts
126
126
  * @returns {{ diff: string, truncated: boolean }}
127
127
  */
128
- function getPrDiff({ prUrl, branchName }) {
128
+ function getPrDiff({ prUrl, prNumber, repoSlug, branchName, cwd }) {
129
129
  let diff = "";
130
+ const commandOptions = {
131
+ encoding: "utf8",
132
+ timeout: 30_000,
133
+ stdio: ["pipe", "pipe", "pipe"],
134
+ ...(cwd ? { cwd } : {}),
135
+ };
130
136
 
131
137
  // Strategy 1: gh pr diff
132
- const prNumber = extractPrNumber(prUrl);
133
- const repoSlug = extractRepoSlug(prUrl);
134
- if (prNumber && repoSlug) {
138
+ const resolvedPrNumber = Number.isFinite(Number(prNumber))
139
+ ? Number(prNumber)
140
+ : extractPrNumber(prUrl);
141
+ const resolvedRepoSlug = String(repoSlug || "").trim() || extractRepoSlug(prUrl);
142
+ if (resolvedPrNumber) {
135
143
  try {
136
- const result = spawnSync(
137
- "gh",
138
- ["pr", "diff", String(prNumber), "--repo", repoSlug],
139
- { encoding: "utf8", timeout: 30_000, stdio: ["pipe", "pipe", "pipe"] },
140
- );
141
- if (result.status === 0 && result.stdout?.trim()) {
142
- diff = result.stdout;
144
+ const attempts = [];
145
+ if (resolvedRepoSlug) {
146
+ attempts.push(["pr", "diff", String(resolvedPrNumber), "--repo", resolvedRepoSlug]);
147
+ }
148
+ attempts.push(["pr", "diff", String(resolvedPrNumber)]);
149
+ for (const args of attempts) {
150
+ const result = spawnSync("gh", args, commandOptions);
151
+ if (result.status === 0 && result.stdout?.trim()) {
152
+ diff = result.stdout;
153
+ break;
154
+ }
143
155
  }
144
156
  } catch {
145
157
  /* fall through to git diff */
@@ -149,13 +161,16 @@ function getPrDiff({ prUrl, branchName }) {
149
161
  // Strategy 2: git diff main...<branch>
150
162
  if (!diff && branchName) {
151
163
  try {
152
- const result = spawnSync("git", ["diff", `main...${branchName}`], {
153
- encoding: "utf8",
154
- timeout: 30_000,
155
- stdio: ["pipe", "pipe", "pipe"],
156
- });
157
- if (result.status === 0 && result.stdout?.trim()) {
158
- diff = result.stdout;
164
+ const attempts = [
165
+ ["diff", `origin/main...${branchName}`],
166
+ ["diff", `main...${branchName}`],
167
+ ];
168
+ for (const args of attempts) {
169
+ const result = spawnSync("git", args, commandOptions);
170
+ if (result.status === 0 && result.stdout?.trim()) {
171
+ diff = result.stdout;
172
+ break;
173
+ }
159
174
  }
160
175
  } catch {
161
176
  /* ignore */
@@ -343,6 +358,17 @@ export class ReviewAgent {
343
358
  console.warn(`${TAG} queueReview called without task id — skipping`);
344
359
  return;
345
360
  }
361
+ const hasReviewReference = Boolean(
362
+ String(task.prUrl || "").trim() ||
363
+ String(task.prNumber || "").trim() ||
364
+ String(task.branchName || "").trim(),
365
+ );
366
+ if (!hasReviewReference) {
367
+ console.warn(
368
+ `${TAG} queueReview skipped for ${task.id}: no prUrl, prNumber, or branchName`,
369
+ );
370
+ return;
371
+ }
346
372
 
347
373
  if (this.#seen.has(task.id)) {
348
374
  console.log(`${TAG} task ${task.id} already queued/in-flight — skipping`);
@@ -463,7 +489,10 @@ export class ReviewAgent {
463
489
  // 1. Get PR diff
464
490
  const { diff, truncated } = getPrDiff({
465
491
  prUrl: task.prUrl,
492
+ prNumber: task.prNumber,
493
+ repoSlug: task.repoSlug,
466
494
  branchName: task.branchName,
495
+ cwd: task.worktreePath || null,
467
496
  });
468
497
 
469
498
  if (!diff) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bosun",
3
- "version": "0.40.4",
3
+ "version": "0.40.5",
4
4
  "description": "Bosun Autonomous Engineering — manages AI agent executors with failover, extremely powerful workflow builder, and a massive amount of included default workflow templates for autonomous engineering, creates PRs via Vibe-Kanban API, and sends Telegram notifications. Supports N executors with weighted distribution, multi-repo projects, and auto-setup.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -129,6 +129,7 @@
129
129
  "bench:swebench:import": "node bench/swebench/bosun-swebench.mjs import",
130
130
  "bench:swebench:export": "node bench/swebench/bosun-swebench.mjs export",
131
131
  "bench:swebench:eval": "node bench/swebench/bosun-swebench.mjs eval",
132
+ "bench:library:resolver": "node bench/library/library-resolver-bench.mjs",
132
133
  "mutate": "npx stryker run",
133
134
  "mutate:incremental": "npx stryker run --incremental",
134
135
  "mutate:report": "node scripts/mutation-report.mjs",