Skip to content

feat(mcp): CLI mirror for loopover_draft_pr_body - #6972

Closed
RealDiligent wants to merge 2 commits into
JSONbored:mainfrom
RealDiligent:feat/draft-pr-body-cli-6741
Closed

feat(mcp): CLI mirror for loopover_draft_pr_body#6972
RealDiligent wants to merge 2 commits into
JSONbored:mainfrom
RealDiligent:feat/draft-pr-body-cli-6741

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Move buildPublicPrBodyDraft into @loopover/engine (host src/services/pr-body-draft.ts becomes a thin re-export).
  • Register loopover_draft_pr_body stdio tool: analyzeCurrentBranch → local draft; optional format=markdown.
  • Bump stdio tool-count pin 76 → 77; add CLI parity tests and enrich the branch-analysis fixture.

Closes #6741.

Test plan

  • CI validate-code / unit tests green
  • codecov/patch ≥ 99%
  • loopover-mcp tools --json reports count 77
  • Stdio draft markdown matches buildPublicPrBodyDraft on the fixture analysis
  • format=markdown returns markdown-focused payload

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 17, 2026 16:46
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

Move buildPublicPrBodyDraft into @loopover/engine and register the stdio tool with optional format=markdown.

Closes JSONbored#6741.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ility

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 8.69565% with 63 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.62%. Comparing base (4966070) to head (49a7b24).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/loopover-engine/src/pr-body-draft.ts 8.69% 63 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6972      +/-   ##
==========================================
- Coverage   93.71%   93.62%   -0.10%     
==========================================
  Files         686      686              
  Lines       68392    68399       +7     
  Branches    18730    18735       +5     
==========================================
- Hits        64093    64037      -56     
- Misses       3302     3365      +63     
  Partials      997      997              
Flag Coverage Δ
shard-1 43.75% <8.69%> (-0.01%) ⬇️
shard-2 36.80% <8.69%> (-0.13%) ⬇️
shard-3 32.90% <8.69%> (+0.09%) ⬆️
shard-4 33.85% <8.69%> (-0.01%) ⬇️
shard-5 32.04% <8.69%> (-0.09%) ⬇️
shard-6 45.67% <8.69%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-engine/src/pr-body-draft.ts 8.69% <8.69%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 17, 2026
@loopover-orb

loopover-orb Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-17 16:59:44 UTC

7 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This is a straightforward move-plus-mirror change: `buildPublicPrBodyDraft` is relocated verbatim into `@​loopover/engine` (I diffed it line-for-line against the deleted `src/services/pr-body-draft.ts` body and the logic is unchanged), the host file becomes a thin re-export preserving existing import paths, and a new `loopover_draft_pr_body` stdio tool wires `analyzeCurrentBranch` → local `buildPublicPrBodyDraft` with an optional `format=markdown` payload. The tool-count bump (76→77) and its two supporting test-count assertions are updated together, and the parity test confirms the CLI mirror's markdown matches the engine function's output on the shared fixture. The main gap is test depth: only two stdio-level scenarios are added, leaving several branches inside the 330-line moved file (stale freshness, `hasOverlap` collisions, `missingTests=true`, non-empty `manifestGuidance`, empty `linkedIssues`) unexercised by any visible test, consistent with the failed `codecov/patch` signal.

Nits — 5 non-blocking
  • packages/loopover-engine/src/pr-body-draft.ts:56-60 hand-duplicates `PUBLIC_UNSAFE_TERMS` from `src/signals/redaction.ts` instead of importing a shared constant; if the canonical list changes later, this copy can silently drift and let unsafe terms leak into a public PR body draft — worth extracting to a small shared package both `src` and `loopover-engine` can import.
  • Only the happy-path and `format=markdown` scenarios are covered by `test/unit/mcp-cli-draft-pr-body.test.ts`; branches like `stale`/`possibly_stale` freshness, non-empty `collisions`, `missingTests === true`, a populated `manifestGuidance.publicNextSteps`, and empty `linkedIssues` in `buildPublicPrBodyDraft` have no visible direct test, which lines up with the low `codecov/patch` number reported for this diff.
  • `PrBodyDraftSource` (packages/loopover-engine/src/pr-body-draft.ts) is now a hand-written structural type instead of `Pick<LocalBranchAnalysis, ...>` / `Pick<LocalDiffPreflightResult, ...>`; a future rename or narrowing in those source types won't be caught by the compiler here since the two are no longer linked, only structurally similar.
  • Slice/limit magic numbers (`.slice(0, 3)` twice in `duplicateSection`, `.slice(0, 8)` in `nextStepsSection`) are unexplained; a short named constant (e.g. `MAX_COLLISION_CLUSTERS`, `MAX_NEXT_STEPS`) would make the caps self-documenting.
  • Add a dedicated unit test file for `buildPublicPrBodyDraft` under `packages/loopover-engine` exercising the untested branches directly (stale/possibly_stale, hasOverlap, missingTests, manifestGuidance.present) rather than relying solely on stdio integration tests.

CI checks failing

  • codecov/patch — 8.69% of diff hit (target 99.00%)

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #6741
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 402 registered-repo PR(s), 201 merged, 34 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 402 PR(s), 34 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR exports buildPublicPrBodyDraft from @​loopover/engine with the host file becoming a thin re-export, registers loopover_draft_pr_body as a stdio tool with a format=markdown option mirroring loopover_prepare_pr_packet's pattern, and adds unit/parity tests plus updates the tool-count pin, satisfying all listed deliverables.

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, Ruby, Svelte, TypeScript, Markdown, MDX
  • Official Gittensor activity: 402 PR(s), 34 issue(s).
  • Related work: Titles/paths share 7 meaningful terms. (issue #6744, issue #6741)
  • Related work: Titles/paths share 7 meaningful terms. (issue #6743, issue #6741)
  • Related work: Titles/paths share 7 meaningful terms. (issue #6747, issue #6741)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 2 steps in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI mirror for loopover_draft_pr_body

1 participant