fix(explore): recognize Wrangler-style "generated by … by running" banners (CG-25)
Cloudflare Wrangler's `worker-configuration.d.ts` (~12k lines of ambient types) carried no banner any GENERATED_CONTENT_PATTERNS entry matched: every existing marker requires `DO NOT EDIT`, a standalone `@generated`, `<auto-generated>`, or the literal `automatically/auto-generated by` phrasings. Wrangler emits a bare `Generated by Wrangler by running `wrangler types``, so the file ranked with pen 1.00 and won 79.4% of an explore envelope on generic token overlap alone (CG-24). The discriminator is the reproduction instruction, not the word "generated": the banner must name a tool AND then say `by running`, i.e. two separate "by" clauses. That keeps prose out — "the nightly summary is generated by running the ETL job" has only one — while catching every CLI-driven emitter that tells you how to regenerate. Precision swept over 441,856 files across the whole local source tree: 5 hits, all genuine Wrangler output, no false positives. Isolated before/after on the CG-24 repro (same query, same index, only the `files.generated` flag differing): before pen 1.00 score 115.0 share 79.4% 3 files rendered after pen 0.30 score 35.4 share 21.1% 4 files rendered The new pattern stays in the existing table position, below the header window the detector scans, so the module still does not classify itself. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
d6d17288be
commit
57e0854213
@@ -181,6 +181,14 @@ const GENERATED_CONTENT_PATTERNS: ReadonlyArray<RegExp> = [
|
||||
// "by" is required — bare "automatically generated" appears in hand-written
|
||||
// prose ("the table below is automatically generated at runtime").
|
||||
/\b(?:automatically generated|auto[- ]?generated|autogenerated) by\b/i,
|
||||
// The "run this command to regenerate" shape: Cloudflare Wrangler
|
||||
// ("Generated by Wrangler by running `wrangler types` (hash: …)"), and the
|
||||
// same phrasing used by other CLI-driven emitters. Bare "generated by" is
|
||||
// deliberately NOT enough — it is ordinary prose — so the reproduction
|
||||
// instruction is the discriminator: the banner must name a tool AND then
|
||||
// say `by running`, i.e. TWO separate "by" clauses. That rules out
|
||||
// "the report is generated by running the nightly job", which has only one.
|
||||
/\bgenerated by\s+\S.{0,80}?\bby running\b/i,
|
||||
// Self-declaring in-house banners that name no tool.
|
||||
/\bthis (?:file|class|code|module) (?:is|was) (?:auto[- ]?)?generated\b/i,
|
||||
// The reverse ordering: "DO NOT EDIT — this is a generated file".
|
||||
|
||||
Reference in New Issue
Block a user