claude-teammate 0.1.35 → 0.1.37
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 +1 -1
- package/src/commands/worker.js +42 -0
- package/src/github.js +24 -1
package/package.json
CHANGED
package/src/commands/worker.js
CHANGED
|
@@ -612,6 +612,25 @@ async function processGitHubIssue({ repo, issue, projectRoot, github, githubBotU
|
|
|
612
612
|
return buildGitHubIssueState(detail, githubIssueMemory, null);
|
|
613
613
|
}
|
|
614
614
|
|
|
615
|
+
if (hasPlusOneReaction(latestComment)) {
|
|
616
|
+
return buildGitHubIssueState(detail, githubIssueMemory, null);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
try {
|
|
620
|
+
const isMember = await github.isRepoCollaborator(repo.url, latestComment.author.login);
|
|
621
|
+
if (!isMember) {
|
|
622
|
+
await github.createIssueCommentReaction(repo.url, latestComment.id, "+1");
|
|
623
|
+
return buildGitHubIssueState(detail, githubIssueMemory, null);
|
|
624
|
+
}
|
|
625
|
+
} catch (error) {
|
|
626
|
+
await logger.error("Failed to check GitHub collaborator status", {
|
|
627
|
+
repo: repo.url,
|
|
628
|
+
author: latestComment.author.login,
|
|
629
|
+
error: String(error)
|
|
630
|
+
});
|
|
631
|
+
return buildGitHubIssueState(detail, githubIssueMemory, null);
|
|
632
|
+
}
|
|
633
|
+
|
|
615
634
|
const approvalComment = isApprovalComment(latestComment.body);
|
|
616
635
|
|
|
617
636
|
if (approvalComment) {
|
|
@@ -837,6 +856,25 @@ async function processTrackedPullRequest({ projectRoot, repo, pullRequest, githu
|
|
|
837
856
|
return buildDraftPrState(detail, currentStatus, null);
|
|
838
857
|
}
|
|
839
858
|
|
|
859
|
+
if (hasPlusOneReaction(latestComment)) {
|
|
860
|
+
return buildDraftPrState(detail, currentStatus, null);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
try {
|
|
864
|
+
const isMember = await github.isRepoCollaborator(repo.url, latestComment.author.login);
|
|
865
|
+
if (!isMember) {
|
|
866
|
+
await github.createIssueCommentReaction(repo.url, latestComment.id, "+1");
|
|
867
|
+
return buildDraftPrState(detail, currentStatus, null);
|
|
868
|
+
}
|
|
869
|
+
} catch (error) {
|
|
870
|
+
await logger.error("Failed to check GitHub collaborator status", {
|
|
871
|
+
repo: repo.url,
|
|
872
|
+
author: latestComment.author.login,
|
|
873
|
+
error: String(error)
|
|
874
|
+
});
|
|
875
|
+
return buildDraftPrState(detail, currentStatus, null);
|
|
876
|
+
}
|
|
877
|
+
|
|
840
878
|
const commentReviewRepoAccess = await buildPullRequestRepoAccessPlan({
|
|
841
879
|
repo,
|
|
842
880
|
pullRequestBody: detail.body || "",
|
|
@@ -1682,6 +1720,10 @@ function hasEyesReaction(comment) {
|
|
|
1682
1720
|
return Number(comment?.reactions?.eyes ?? 0) > 0;
|
|
1683
1721
|
}
|
|
1684
1722
|
|
|
1723
|
+
export function hasPlusOneReaction(comment) {
|
|
1724
|
+
return Number(comment?.reactions?.plusOne ?? 0) > 0;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1685
1727
|
function formatClarificationQuestions(questions) {
|
|
1686
1728
|
const cleanedQuestions = questions.filter(Boolean);
|
|
1687
1729
|
if (cleanedQuestions.length === 0) {
|
package/src/github.js
CHANGED
|
@@ -181,6 +181,28 @@ export function createGitHubClient(config) {
|
|
|
181
181
|
);
|
|
182
182
|
},
|
|
183
183
|
|
|
184
|
+
async isRepoCollaborator(repoUrl, username) {
|
|
185
|
+
const repo = parseGitHubRepoUrl(repoUrl);
|
|
186
|
+
const response = await fetch(
|
|
187
|
+
`https://api.github.com/repos/${repo.owner}/${repo.name}/collaborators/${encodeURIComponent(username)}`,
|
|
188
|
+
{
|
|
189
|
+
headers: {
|
|
190
|
+
Accept: "application/vnd.github+json",
|
|
191
|
+
Authorization: `Bearer ${config.GITHUB_PAT}`,
|
|
192
|
+
"User-Agent": "claude-teammate"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
if (response.status === 204) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
if (response.status === 404) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
const body = await response.text();
|
|
203
|
+
throw new Error(`GitHub collaborator check failed with status ${response.status}: ${body}`);
|
|
204
|
+
},
|
|
205
|
+
|
|
184
206
|
async updatePullRequest(repoUrl, pullNumber, updates) {
|
|
185
207
|
const repo = parseGitHubRepoUrl(repoUrl);
|
|
186
208
|
const payload = await requestGitHub(
|
|
@@ -366,7 +388,8 @@ function mapGitHubComment(payload) {
|
|
|
366
388
|
createdAt: payload.created_at ?? null,
|
|
367
389
|
updatedAt: payload.updated_at ?? null,
|
|
368
390
|
reactions: {
|
|
369
|
-
eyes: Number(payload.reactions?.eyes ?? 0)
|
|
391
|
+
eyes: Number(payload.reactions?.eyes ?? 0),
|
|
392
|
+
plusOne: Number(payload.reactions?.["+1"] ?? 0)
|
|
370
393
|
},
|
|
371
394
|
author: {
|
|
372
395
|
login: payload.user?.login ?? null,
|