Skip to content

refactor(shared): unify fuzzyMatchModel into model-name-matcher.ts#1855

Open
iyoda wants to merge 2 commits intocode-yeongyu:devfrom
iyoda:refactor/pr4-unify-fuzzy-match-model
Open

refactor(shared): unify fuzzyMatchModel into model-name-matcher.ts#1855
iyoda wants to merge 2 commits intocode-yeongyu:devfrom
iyoda:refactor/pr4-unify-fuzzy-match-model

Conversation

@iyoda
Copy link
Contributor

@iyoda iyoda commented Feb 15, 2026

Summary

Make src/shared/model-name-matcher.ts the single canonical source for fuzzyMatchModel and normalizeModelName, removing duplicate implementations from model-availability.ts.

Changes

  • Canonical source: src/shared/model-name-matcher.ts — now exports normalizeModelName (was internal)
  • Removed: Duplicate fuzzyMatchModel and normalizeModelName from src/shared/model-availability.ts (-98 lines)
  • Added: Re-exports in model-availability.ts for backward compatibility — existing consumers don't need import changes

Net: -95 lines removed

Verification

  • bun run typecheck
  • bun test ✅ (2693 pass, 0 fail)
  • bun run build

PR Stack

This is PR 4 of 9 in the code deduplication refactor series. Depends on #1854.

# PR Description
0 #1852 Delete dead code in modules/
2 #1853 Consolidate formatDuration (4→1)
3 #1854 Consolidate getMessageDir (7→1)
4 This PR Unify fuzzyMatchModel
5 (next) Add json-cache utility
6 Apply json-cache to consumers
7 Add ensure-directory utility
8 Apply ensure-directory to production
9 Consolidate ToolContextWithMetadata

Summary by cubic

Unifies model name matching into src/shared/model-name-matcher.ts and consolidates formatDuration into a single source to remove duplicates. Keeps imports working via re-exports and updated paths.

  • Refactors
    • Made src/shared/model-name-matcher.ts the canonical source for fuzzyMatchModel and normalizeModelName; exported normalizeModelName and re-exported both from model-availability.ts for compatibility.
    • Consolidated formatDuration to src/tools/background-task/time-format; removed duplicate implementations in background-agent and delegate-task, and updated imports.

Written for commit 4b20cee. Summary will update on new commits.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 35 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Reviewed by cubic with no issues found; changes are mostly refactors and dependency updates with no regressions.

@iyoda iyoda force-pushed the refactor/pr4-unify-fuzzy-match-model branch 2 times, most recently from 0223b7d to 0e9708b Compare February 15, 2026 08:57
@sisyphus-dev-ai
Copy link
Collaborator

@iyoda Thanks for the refactor! This looks clean and cubic has approved it. However, there are merge conflicts that need to be resolved before we can merge. Could you rebase onto the latest dev branch?

iyoda and others added 2 commits February 17, 2026 17:43
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Make model-name-matcher.ts the canonical source for fuzzyMatchModel and normalizeModelName
- Export normalizeModelName from model-name-matcher.ts (was internal)
- Remove duplicate implementations from model-availability.ts
- Add re-exports in model-availability.ts for backward compatibility
- All existing consumers continue to work via their import paths
- Tests pass, typecheck clean, build succeeds
@iyoda iyoda force-pushed the refactor/pr4-unify-fuzzy-match-model branch from 0e9708b to 4b20cee Compare February 17, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments