Skip to content

feat(mcp): add REST + CLI + stdio surfaces for loopover_plan_repo_issues - #7890

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
xfodev:feat/plan-repo-issues-three-surfaces-7764
Jul 21, 2026
Merged

feat(mcp): add REST + CLI + stdio surfaces for loopover_plan_repo_issues#7890
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
xfodev:feat/plan-repo-issues-three-surfaces-7764

Conversation

@xfodev

@xfodev xfodev commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

loopover_plan_repo_issues (generateIssuePlanDrafts, src/services/issue-plan-draft.ts) shipped only as a remote MCP tool and never got the REST + CLI + local-stdio mirror surfaces its repo-scoped, requireRepoManageAccess-gated siblings all have. Mirrors loopover_generate_contributor_issue_drafts exactly:

  • REST routePOST /v1/repos/:owner/:repo/issue-plan-drafts/generate in src/api/routes.ts, calling generateIssuePlanDrafts (required goal from the body), gated identically to the contributor sibling, plus the canSessionAccessPath matcher and the OpenAPI registerPath.
  • CLI commandloopover-mcp maintain plan-issues (dry-run by default; --create opts in).
  • Local stdio MCP toolloopover_plan_repo_issues, calling the new CLI logic.

generateIssuePlanDrafts, the remote tool, and src/services/** are unchanged. Rebased onto latest main (incl. #7705 — mcp/miner no longer commit the compiled .js; this PR touches only the tracked .ts).

Tests

  • test/unit/routes-issue-plan-draft.test.ts: success, both auth-gate branches incl. write-granted create fall-through, invalid-JSON, invalid-body, explicit-create guard, cross-repo/forbidden — the new routes.ts lines are 100% statement + branch covered.
  • test/unit/mcp-cli-plan-issues.test.ts: in-process coverage of the CLI command + stdio tool via the .ts source.

UI Evidence

The only apps/loopover-ui/** change is the regenerated public/openapi.json (required by ui:openapi:check for the new backend route). Its sole rendered effect is that the new POST …/issue-plan-drafts/generate operation now appears in the API reference (/api) endpoint list + sidebar. loopover-ui is a dark-only build.

Viewport × Theme Before (no route) After (route listed)
Desktop · Dark Desktop · Dark before Desktop · Dark after
Tablet · Dark Tablet · Dark before Tablet · Dark after
Mobile · Dark Mobile · Dark before Mobile · Dark after

Validation

  • Root tsc --noEmit clean (my files); new route/CLI/stdio + mcp-cli-completion-spec (CLI_COMMAND_SPEC parity) tests pass; ui:openapi:check, command-reference:check, docs:drift-check green; OpenAPI regenerated; rebased on latest main.
  • Auth/CORS negative-path tests included (forbidden / cross-repo / unauthorized). No wallet/hotkey/trust-score/reward terms in route output or CLI text.

Closes #7764

@xfodev
xfodev requested a review from JSONbored as a code owner July 21, 2026 16:13
@superagent-security

Copy link
Copy Markdown
Contributor

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

…lan_repo_issues

loopover_plan_repo_issues (generateIssuePlanDrafts) shipped only as a remote MCP
tool and never got the REST + CLI + local-stdio mirror surfaces its repo-scoped,
requireRepoManageAccess-gated siblings all have. Mirrors
loopover_generate_contributor_issue_drafts exactly: a POST
/v1/repos/:owner/:repo/issue-plan-drafts/generate route (same gate), a
maintain plan-issues CLI command calling it, and a loopover_plan_repo_issues
stdio tool. generateIssuePlanDrafts and the remote tool are unchanged.

Closes JSONbored#7764
@xfodev
xfodev force-pushed the feat/plan-repo-issues-three-surfaces-7764 branch from 6f23f79 to 6bc8c7f Compare July 21, 2026 16:18
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.24%. Comparing base (e7e10e7) to head (6bc8c7f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7890      +/-   ##
==========================================
- Coverage   91.39%   83.24%   -8.16%     
==========================================
  Files         730       91     -639     
  Lines       74774    26032   -48742     
  Branches    22818     5326   -17492     
==========================================
- Hits        68343    21671   -46672     
+ Misses       5389     4054    -1335     
+ Partials     1042      307     -735     
Flag Coverage Δ
shard-1 18.49% <6.12%> (-40.08%) ⬇️
shard-2 33.04% <57.14%> (-18.80%) ⬇️
shard-3 40.32% <48.97%> (-9.89%) ⬇️

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

Files with missing lines Coverage Δ
packages/loopover-mcp/bin/loopover-mcp.ts 13.26% <100.00%> (+13.26%) ⬆️
src/api/routes.ts 95.16% <100.00%> (+0.04%) ⬆️
src/openapi/spec.ts 99.48% <100.00%> (+<0.01%) ⬆️

... and 639 files with indirect coverage changes

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

loopover-orb Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-21 16:45:38 UTC

10 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR mirrors the existing generate-issue-drafts pattern (REST route, CLI subcommand, stdio tool) to add loopover_plan_repo_issues surfaces, reusing the identical requireAppRole/requireSessionRepoAccess/requireRepoWriteAccess gate and the same explicit_create_requires_dry_run_false safety contract as the contributor-issue-draft sibling. The new isProcessEntrypoint() guard in loopover-mcp.ts is a sound, already-precedented technique (mirrors bin/loopover-miner-mcp.ts) that lets in-process tests exercise the CLI dispatcher and stdio server without hijacking argv or binding stdin — the new tests genuinely drive the real dispatcher/tool code, not fabricated payloads. Wiring is complete end-to-end: schema (src/api/routes.ts), path matcher (isRepoIssuePlanDraftGeneratePath/canSessionAccessPath), OpenAPI (spec.ts + regenerated openapi.json), CLI dispatch table, stdio descriptor list, and the tool-count test (80→81) are all updated together.

Nits — 6 non-blocking
  • The screenshot evidence for this PR reportedly shows the before/after API-docs images as visually identical, which doesn't demonstrate the new /issue-plan-drafts/generate route actually rendering in the UI — worth asking the contributor to regenerate the screenshot pair even though the diff itself (openapi.json + spec.ts) correctly adds the route.
  • packages/loopover-mcp/bin/loopover-mcp.ts: the stdio tool's planRepoIssuesShape uses z.string().min(1).max(2000) for goal without .trim(), while the REST schema (src/api/routes.ts issuePlanDraftGenerateSchema) and the CLI both trim — a whitespace-only goal from the stdio path would pass client-side validation and only get rejected server-side; consider aligning for a faster client-side error.
  • test/unit/mcp-cli-plan-issues.test.ts:31 sets process.env.LOOPOVER_API_TOKEN to a placeholder test string flagged by secret scanning — verify it's just a dummy in-process value (it is, per the surrounding fixture setup) and not an actual leaked credential.
  • The several new magic numbers (2000 char goal cap, limit min/max of 1/10, HTTP status literals) mirror the existing sibling schema's style, so no action needed beyond what the codebase already does elsewhere.
  • Trim the stdio tool's `goal` field client-side (packages/loopover-mcp/bin/loopover-mcp.ts's planRepoIssuesShape) to match the CLI/REST behavior and fail fast on whitespace-only input.
  • Possible secret-shaped assignment in the diff (generic_secret_assignment) — Verify the value is not a real credential.

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 #7764
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low 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: 80 registered-repo PR(s), 46 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor xfodev; Gittensor profile; 80 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Addressed
The diff adds a REST route (POST /v1/repos/:owner/:repo/issue-plan-drafts/generate) gated with requireAppRole/requireSessionRepoAccess mirroring the contributor-issue-drafts route, a CLI command (maintain plan-issues) that calls this route, and a registerStdioTool block for loopover_plan_repo_issues that proxies the CLI logic, matching the three-surface pattern requested.

Review context
  • Author: xfodev
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, TypeScript
  • Official Gittensor activity: 80 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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.

Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before /
before /
after /
after /
diff /
diff /
/ mobile before / (mobile)
before / (mobile)
after / (mobile)
after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy · Diff highlights exactly what changed.

Scroll preview
Route Before (production) After (this PR's preview)
/ before / (scroll)
before / (scroll)
after / (scroll)
after / (scroll)

A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show.

🟩 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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit b3e1bc3 into JSONbored:main Jul 21, 2026
13 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 21, 2026
12 tasks
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.

loopover_plan_repo_issues has no REST route, CLI command, or local stdio MCP tool

1 participant