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

Function upgradeNoDiffPullRequestReport

src/clawsweeper.ts:12180–12208  ·  view source on GitHub ↗
(markdown: string, item: Item)

Source from the content-addressed store, hash-verified

12178}
12179
12180function upgradeNoDiffPullRequestReport(markdown: string, item: Item): string {
12181 const command = `gh api repos/${item.repo}/pulls/${item.number} --jq '{state:.state,changed_files:.changed_files,base:.base.ref,head:.head.sha}'`;
12182 let upgraded = markdown;
12183 upgraded = replaceFrontMatterValue(upgraded, "decision", "close");
12184 upgraded = replaceFrontMatterValue(upgraded, "close_reason", "duplicate_or_superseded");
12185 upgraded = replaceFrontMatterValue(upgraded, "confidence", "high");
12186 upgraded = replaceFrontMatterValue(upgraded, "action_taken", "proposed_close");
12187 upgraded = replaceFrontMatterValue(upgraded, "pr_close_coverage_proof_fallback_refs", "false");
12188 upgraded = replaceFrontMatterValue(upgraded, "work_cluster_refs", "[]");
12189 upgraded = replaceFrontMatterValue(upgraded, "merge_risk_options", "[]");
12190 upgraded = replaceFrontMatterValue(upgraded, "work_candidate", "none");
12191 upgraded = replaceFrontMatterValue(upgraded, "work_status", "none");
12192 upgraded = replaceSectionValue(
12193 upgraded,
12194 REVIEW_SECTIONS.bestSolution,
12195 "Close this PR: GitHub reports no changed files against the current base branch, so the branch is already empty or superseded by `main`.",
12196 );
12197 upgraded = replaceSectionValue(
12198 upgraded,
12199 REVIEW_SECTIONS.evidence,
12200 `- **live no-diff PR:** GitHub reports \`changed_files: 0\` for this open PR, so there is no remaining branch diff to merge.\n - command: \`${command}\``,
12201 );
12202 upgraded = replaceSectionValue(
12203 upgraded,
12204 REVIEW_SECTIONS.closeComment,
12205 renderCloseCommentFromReport(upgraded, "duplicate_or_superseded"),
12206 );
12207 return upgraded;
12208}
12209
12210interface PullRequestClosePromotion {
12211 bestSolution: string;

Callers 1

applyDecisionsCommandFunction · 0.85

Calls 3

replaceFrontMatterValueFunction · 0.85
replaceSectionValueFunction · 0.85

Tested by

no test coverage detected