feat(tooling): pure issue-drafting core + CLI to expand a loose prompt into a gate-ready draft - #8148
Merged
Merged
Conversation
…t into a gate-ready draft (#8103) The gate only enforces what an issue explicitly says, so publishable issues need exact file/function/pattern citations -- repeated, real maintainer work today. The new pure core (src/services/issue-drafting.ts) extracts tiered grounding terms from a loose prompt (backticked > path > identifier > word), searches a caller-supplied corpus for real precedent (definition lines first, live code above tests, word-tier restricted to path-named files so vocabulary never grounds to random comment prose), and assembles the heavy-template draft with per-anchor-file Requirements bullets, explicit UNGROUNDED markers wherever no precedent exists, and MAINTAINER markers for every section a human must fill -- never inventing an unverified requirement. Adapter-agnostic per the issue's required shape: no argv/fs/IO in the core (the corpus is data, so a future ORB dashboard API route -- a Worker with no filesystem -- can be a second thin consumer unchanged). scripts/draft-issue.ts is the first thin consumer: walks the checkout, calls the core, writes a local file for the maintainer to edit and publish BY HAND. Never publishes; labels/ milestone/relationships stay maintainer decisions (#8103's hard boundary). 100% line+branch coverage on the core (24 tests), including determinism and the body-text-only boundary.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8148 +/- ##
=======================================
Coverage 92.03% 92.04%
=======================================
Files 764 765 +1
Lines 77540 77634 +94
Branches 23436 23458 +22
=======================================
+ Hits 71366 71460 +94
Misses 5062 5062
Partials 1112 1112
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Contributor
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 LoopOver is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
This was referenced Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/services/issue-drafting.ts) required by the issue'sprocess.argv, no fs, no IO — the searchable corpus is caller-supplied data, so a future ORB dashboard API route (a Worker with no filesystem) can be a second thin consumer of the identical entrypoint. Mirrors thesignal-tracking.ts/signal-tracking-wire.tspure-core/host-adapter split.exact>path>identifier> plainword, each tier consumed before the next scans so fragments never double-extract), case-insensitive corpus search with definition-lines-first / live-code-above-tests ranking, andword-tier terms restricted to files whose path contains them — plain vocabulary can never ground to random comment prose.path:linecitations, one Requirements bullet per anchor file (not per term), the> ⚠️ Required patterncallout, an explicit⚠️ UNGROUNDEDmarker at the exact spot any specific term found no precedent, and<!-- MAINTAINER: ... -->markers on every section a human must fill — it never invents an unverified requirement.scripts/draft-issue.tsis the first thin consumer: reads the prompt (--prompt/--prompt-file), walks the checkout for the corpus, writes the draft to a local file. Never publishes; labels/milestone/relationships stay maintainer decisions (the issue's hard boundary).Closes #8103
Performance note (the issue's own acceptance bar)
Ran against one-line prompts approximating two real, recently-shipped sub-issues of #8082:
computeRegressedVerdictTrackRecord, printed by a read-only CLI mirroring scripts/backtest-corpus-export.ts"): top citations werepackages/loopover-engine/src/calibration/backtest-track-record.ts:27(the exact function definition), the real track-record CLI, andbacktest-corpus-export.ts's usage lines — the same anchors the real calibration: compute REGRESSED-verdict track-record statistics from ORB's persisted backtest results #8140 issue body cited. 0 UNGROUNDED markers.scoreBacktest's definition,backtest-threshold.ts's own "logic/regex-change backtesting needs raw context" comment line, and thelinked_issue_scope_mismatchrule-id constant — again the anchors the real spec used.Honest limits: it grounds and cites; it does not decompose scope or write Deliverables — those stay explicit MAINTAINER markers. Word-tier matches can still surface plausible-but-tangential anchors (e.g. "verdict" →
gate-verdict-calibration.ts); they're real files with definition lines, and the maintainer edit pass is the filter. A deliberate non-goal: no AI/model call anywhere — output is deterministic (same prompt + corpus ⇒ byte-identical draft, tested).Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #123) — a linked open issue is required for every contributor PR.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
npm run test:ciran green end-to-end (includes every box above). The core has 100% line AND branch coverage (24 tests, scoped v8 report: 58/58 branches).scripts/draft-issue.tsis thin IO glue (arg parsing, checkout walk, file write) under the establishedexport-d1-data.tsexemption.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.The core is a pure string transformer over caller-supplied data — no network, no env, no model call, no publish path. The body-text-only boundary has its own test.
UI Evidence
Not applicable — no UI change.
Notes
IssueDraftOptionsbag is the intended seam.