Skip to content

Add preferred_labels config so non-canonical good-first-issue labels are caught #1

@cdhagmann

Description

@cdhagmann

Background

gem-contribute scan currently filters open issues by the single canonical label "good first issue" (see Scan::DEFAULT_LABEL). Many repos use slight variants of this label and are silently dropped from the ranked list.

Concrete example: rainbow's issue #112 is labeled "Good first issue :tada:" (note the suffix and capitalization). It does not match "good first issue" exactly and never appears in scan output, even though it's a perfect contribution target.

ADR-0005 deliberately rejects label normalization (don't rewrite "easy""beginner-friendly") — but it explicitly carves out preferred_labels as the user-controlled escape valve:

preferred_labels matches case-insensitively against the raw label text. Hyphens and spaces are treated as equivalent.

We have not implemented preferred_labels yet. This issue is that work.

Desired behavior

  1. Add preferred_labels to Config with a sensible default. Suggested default:
    preferred_labels:
      - good first issue
      - good-first-issue
      - help wanted
  2. gem-contribute config set preferred_labels "label1,label2" (comma-separated; YAML list under the hood).
  3. Scan runs one API request per preferred label, dedupes by issue number, and ranks the union.
  4. Matching is case-insensitive; - and are interchangeable. The label "Good first issue :tada:" matches "good first issue" if (and only if) we widen the comparison to a substring or normalize the suffix away — discuss in the PR which semantics you choose.

Acceptance criteria

  • preferred_labels is read from ~/.config/gem-contribute/config.yml.
  • Scan queries each label and merges results, deduping by (owner, repo, number).
  • Cache key in GitHubAdapter#issues continues to work for the multi-label case (already keyed on sorted label list).
  • Scanning a lockfile that includes rainbow surfaces issue #112 (or whatever the current set is) by default, without further configuration.
  • Specs cover: empty config falls back to defaults, custom config overrides defaults, dedupe is by number not label.
  • No regression in gem-contribute issues <gem> (which uses the same label list).

Out of scope

  • Synonym tables ("easy" ≈ "beginner") — that's the normalization ADR-0005 rejects.
  • A full label-discovery UI in the TUI — Stage 3 territory.

Files likely to touch

  • lib/gem_contribute/config.rb — add the key, default
  • lib/gem_contribute/cli/scan.rb — replace DEFAULT_LABEL with the configured list
  • lib/gem_contribute/cli/issues.rb — same
  • spec/gem_contribute/cli/scan_spec.rb, spec/gem_contribute/cli/issues_spec.rb, spec/gem_contribute/config_spec.rb

How to pick this up

gem-contribute fix gem-contribute/<this-issue-number>

This is a workshop-friendly first contribution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions