MCPcopy
hub / github.com/openclaw/clawsweeper / postOrUpdateVisualComment

Function postOrUpdateVisualComment

src/clawsweeper.ts:7560–7592  ·  view source on GitHub ↗
(
  number: number,
  lens: string,
  headSha: string,
  body: string,
)

Source from the content-addressed store, hash-verified

7558}
7559
7560function postOrUpdateVisualComment(
7561 number: number,
7562 lens: string,
7563 headSha: string,
7564 body: string,
7565): void {
7566 const marker = visualCommentMarker(number, lens, headSha);
7567 const existing = ghPaged<unknown>(`repos/${targetRepo()}/issues/${number}/comments?per_page=100`)
7568 .map(asRecord)
7569 .find((comment) => typeof comment.body === "string" && comment.body.includes(marker));
7570 const payload = writeCommentPayload(number, body);
7571 const existingId =
7572 typeof existing?.id === "number" || typeof existing?.id === "string" ? existing.id : null;
7573 if (existingId) {
7574 ghWithRetry([
7575 "api",
7576 `repos/${targetRepo()}/issues/comments/${existingId}`,
7577 "--method",
7578 "PATCH",
7579 "--input",
7580 payload,
7581 ]);
7582 return;
7583 }
7584 ghWithRetry([
7585 "api",
7586 `repos/${targetRepo()}/issues/${number}/comments`,
7587 "--method",
7588 "POST",
7589 "--input",
7590 payload,
7591 ]);
7592}
7593
7594function closeReasonText(reason: CloseReason): string {
7595 switch (reason) {

Callers 1

assistCommandFunction · 0.85

Calls 5

visualCommentMarkerFunction · 0.85
targetRepoFunction · 0.85
writeCommentPayloadFunction · 0.85
ghWithRetryFunction · 0.85
ghPagedFunction · 0.70

Tested by

no test coverage detected