new: autodetect labels and milestones (fuzzy matching) #13

Manually merged
heiko merged 2 commits from issue-12-autodetect-label into master 2026-05-17 08:21:16 +02:00
Owner

Implements issue #12.

--label and --milestone accept inexact input. Resolver scores
candidates by tier (exact > prefix > substring > Levenshtein ≤ 2) and
uses the best tier:

  • unique match → use, stderr note when not exact (label: using "Bug" for "bg")
  • ambiguous → error, list all available with matching ones bolded
  • no match → error, list all available

Within the Levenshtein tier, only minimum-distance candidates qualify,
so v2,1 resolves uniquely to v2.1.

Closes #12

ius:ai:claude-opus-4-7

Implements issue #12. `--label` and `--milestone` accept inexact input. Resolver scores candidates by tier (exact > prefix > substring > Levenshtein ≤ 2) and uses the best tier: - unique match → use, stderr note when not exact (`label: using "Bug" for "bg"`) - ambiguous → error, list all available with matching ones bolded - no match → error, list all available Within the Levenshtein tier, only minimum-distance candidates qualify, so `v2,1` resolves uniquely to `v2.1`. Closes #12 ius:ai:claude-opus-4-7
new: autodetect labels and milestones with fuzzy matching
Some checks failed
mod-nag (Push) / mod-nag (push) Has been cancelled
4a7e27be0e
`--label` and `--milestone` (on both issue and pr, for create/edit/
template paths) now accept inexact input. The resolver scores each
candidate by tier — exact (ci) > prefix (ci) > substring (ci) >
Levenshtein ≤ 2 — and uses the highest-scoring tier:

- unique match (any tier): use it. If the tier is not exact, print a
  stderr note `label: using "Bug" for "bg"`.
- ambiguous: error listing all available, with the matching ones
  emphasised in bold (when color is enabled).
- no match: error listing all available, no emphasis.

Within the Levenshtein tier, only minimum-distance candidates are
considered, so e.g. `v2,1` resolves uniquely to `v2.1` even though
`v2.0` is also within distance 2.

Replaces the old `closestLabel` which silently picked the first
substring hit, regardless of ambiguity, and gave `resolveMilestone`
no fuzzy path at all.

Closes #12

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ius:ai:claude-opus-4-7
chg: restrict autodetect to editor sessions; gate levenshtein on input length
Some checks failed
mod-nag (Push) / mod-nag (push) Has been cancelled
21b2b9bbd4
Three review-driven refinements:

- Auto-correction (prefix/substring/Levenshtein) is now only applied
  when input comes from an interactive editor template. CLI flags
  (`--label`, `--milestone` on issue/pr create/edit) accept only
  exact case-insensitive matches; non-exact hits become an
  `unknown label "X" (did you mean: Y, Z)` error. Scripts stay
  deterministic; humans editing the template still get the
  forgiving path.

- Levenshtein tier now requires `distance < len(input)` so 2-char
  inputs can't match an unrelated 2-char name at distance 2.

- Error messages use a separate `useColorStderr()` gate so ANSI bold
  is suppressed when stderr is piped, even if stdout is a TTY.
  `computeColor` is refactored to take a *os.File; the completion-
  mode override only applies to stdout.

`resolveLabels` and `resolveMilestone` grow an `allowFuzzy bool`
parameter threaded from the call sites that own the editor template
flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ius:ai:claude-opus-4-7
heiko manually merged commit 94e658bbdc into master 2026-05-17 08:21:16 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
heiko/fj!13
No description provided.