claude-teammate 0.1.38 → 0.1.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-teammate",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "description": "CLI bootstrapper for Claude Teammate.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -362,57 +362,61 @@ export async function runWorkerCommand({ projectRoot }) {
362
362
  state.lastReviewPollAt = new Date().toISOString();
363
363
 
364
364
  try {
365
- const repos = await listKnownRepos(projectRoot);
366
365
  const processedPrs = [];
367
- let reviewedPrCount = 0;
366
+ const prs = await github.listPrsNeedingReview();
367
+ let reviewedPrCount = prs.length;
368
+
369
+ for (const pr of prs) {
370
+ if (!pr.repoUrl) {
371
+ await logger.error("PR review skipped because repository URL is missing", {
372
+ pr: pr.number,
373
+ title: pr.title
374
+ });
375
+ reviewedPrCount -= 1;
376
+ continue;
377
+ }
368
378
 
369
- for (const repo of repos) {
370
- const prs = await github.listPrsNeedingReview(repo.url, githubBotUser.login);
371
- reviewedPrCount += prs.length;
372
-
373
- for (const pr of prs) {
374
- try {
375
- const repoPath = await ensureReviewRepo(repo.url, runtimePaths.reviewReposDir);
376
- const prDetail = await github.fetchPullRequest(repo.url, pr.number);
377
- await checkoutPullRequestBranch(repoPath, prDetail.headRef, prDetail.headRepoCloneUrl);
378
-
379
- const diff = await github.fetchPullRequestDiff(repo.url, pr.number);
380
- const result = await runClaudePrReview({
381
- diff,
382
- repoPath,
383
- pr: prDetail,
384
- timeoutMs: parseOptionalInt(values.CLAUDE_TIMEOUT_MS)
385
- });
379
+ try {
380
+ const repoPath = await ensureReviewRepo(pr.repoUrl, runtimePaths.reviewReposDir);
381
+ const prDetail = await github.fetchPullRequest(pr.repoUrl, pr.number);
382
+ await checkoutPullRequestBranch(repoPath, prDetail.headRef, prDetail.headRepoCloneUrl);
383
+
384
+ const diff = await github.fetchPullRequestDiff(pr.repoUrl, pr.number);
385
+ const result = await runClaudePrReview({
386
+ diff,
387
+ repoPath,
388
+ pr: prDetail,
389
+ timeoutMs: parseOptionalInt(values.CLAUDE_TIMEOUT_MS)
390
+ });
386
391
 
387
- await github.createPullRequestReview(
388
- repo.url,
389
- pr.number,
390
- result.summary,
391
- result.suggestions,
392
- "COMMENT"
393
- );
394
-
395
- await github.addLabelsToPullRequest(repo.url, pr.number, ["AI-reviewed"]);
396
-
397
- processedPrs.push({
398
- repoUrl: repo.url,
399
- pullRequestNumber: String(pr.number),
400
- pullRequestUrl: prDetail.url,
401
- suggestionsCount: result.suggestions.length
402
- });
392
+ await github.createPullRequestReview(
393
+ pr.repoUrl,
394
+ pr.number,
395
+ result.summary,
396
+ result.suggestions,
397
+ "COMMENT"
398
+ );
399
+
400
+ await github.addLabelsToPullRequest(pr.repoUrl, pr.number, ["AI-reviewed"]);
401
+
402
+ processedPrs.push({
403
+ repoUrl: pr.repoUrl,
404
+ pullRequestNumber: String(pr.number),
405
+ pullRequestUrl: prDetail.url,
406
+ suggestionsCount: result.suggestions.length
407
+ });
403
408
 
404
- await logger.info("PR review submitted", {
405
- repo: repo.url,
406
- pr: pr.number,
407
- suggestions: result.suggestions.length
408
- });
409
- } catch (error) {
410
- await logger.error("PR review failed", {
411
- repo: repo.url,
412
- pr: pr.number,
413
- error
414
- });
415
- }
409
+ await logger.info("PR review submitted", {
410
+ repo: pr.repoUrl,
411
+ pr: pr.number,
412
+ suggestions: result.suggestions.length
413
+ });
414
+ } catch (error) {
415
+ await logger.error("PR review failed", {
416
+ repo: pr.repoUrl,
417
+ pr: pr.number,
418
+ error
419
+ });
416
420
  }
417
421
  }
418
422
 
package/src/github.js CHANGED
@@ -290,16 +290,16 @@ export function createGitHubClient(config) {
290
290
  return payload.default_branch;
291
291
  },
292
292
 
293
- async listPrsNeedingReview(repoUrl, botLogin) {
294
- const repo = parseGitHubRepoUrl(repoUrl);
295
- const query = `repo:${repo.owner}/${repo.name}+is:pr+is:open+review-requested:${botLogin}+-label:AI-reviewed`;
293
+ async listPrsNeedingReview() {
294
+ const query = "is:pr+is:open+user-review-requested:@me+-label:AI-reviewed";
296
295
  const url = new URL("https://api.github.com/search/issues");
297
296
  url.searchParams.set("q", query);
298
297
  url.searchParams.set("per_page", "10");
299
298
 
300
- const payload = await requestGitHub(url, config, { method: "GET" }, repo);
299
+ const payload = await requestGitHub(url, config, { method: "GET" });
301
300
  return Array.isArray(payload.items)
302
301
  ? payload.items.map((item) => ({
302
+ repoUrl: mapRepositoryApiUrlToHtmlUrl(item.repository_url),
303
303
  number: item.number,
304
304
  title: item.title ?? ""
305
305
  }))
@@ -395,6 +395,21 @@ export function createGitHubClient(config) {
395
395
  };
396
396
  }
397
397
 
398
+ function mapRepositoryApiUrlToHtmlUrl(repositoryApiUrl) {
399
+ const value = String(repositoryApiUrl || "").trim();
400
+
401
+ if (!value) {
402
+ return "";
403
+ }
404
+
405
+ const match = value.match(/^https:\/\/api\.github\.com\/repos\/([^/]+)\/([^/]+)$/u);
406
+ if (!match) {
407
+ return value;
408
+ }
409
+
410
+ return `https://github.com/${match[1]}/${match[2]}`;
411
+ }
412
+
398
413
  function mapGitHubIssue(payload, comments = []) {
399
414
  return {
400
415
  number: payload.number,