Skip to content

Comments

feat: add manual mappings and ignore system#49

Merged
bigspawn merged 14 commits intomainfrom
feat/manual-mappings
Feb 16, 2026
Merged

feat: add manual mappings and ignore system#49
bigspawn merged 14 commits intomainfrom
feat/manual-mappings

Conversation

@bigspawn
Copy link
Owner

Summary

  • Add MappingsConfig with manual AniList↔MAL ID mappings and ignore rules via mappings.yaml
  • Add ManualMappingStrategy as the first strategy in the chain for user-defined overrides
  • Support ignoring entries by AniList ID or title from mappings config
  • Add MappingsFilePath config field with env var MAPPINGS_FILE_PATH

Test plan

  • go build ./... compiles
  • go test ./... -v passes (7 new ManualMappingStrategy tests + mappings_test.go)
  • make lint — 0 issues

Add support for user-defined AniList↔MAL mappings and ignore rules
via mappings.yaml file. Includes ManualMappingStrategy as the first
strategy in the chain, ignore filtering by AniList ID and title,
and configurable mappings file path.
Refactor updater into resolve → deduplicate → process phases.
Detect N:1 conflicts when multiple sources map to the same target
and resolve by strategy priority. Add FindTargetWithMeta for
match metadata, strategy name constants, and DuplicateConflict
reporting in global summary.
Pre-allocate `resolved` and `kept` slices in updater.go with known
capacity to avoid unnecessary reallocations.
Add CLI command 'unmapped' to view and manage entries that could not
be mapped during sync. Supports --fix for interactive resolution and
--ignore-all to bulk-ignore. Saves unmapped state between runs and
displays unmapped summary in global sync report.
Add manual mappings and ignore rules documentation, unmapped command
reference, MAPPINGS_FILE_PATH env var, and updated strategy chains
with ManualMappingStrategy.
Add MALIDs field and malMeta map to IgnoreConfig for reverse sync
ignore support. Add IsIgnoredByMALID() and AddIgnoreByMALID() methods.
Previously, the ignore system only stored AniList IDs, making it
impossible to ignore entries when syncing MAL → AniList.
Extract buildIgnoreIDsNode helper to avoid code duplication between
anilist_ids and mal_ids sections. Update MarshalYAML to emit mal_ids
with inline comments, matching the existing anilist_ids format.
Add SyncDirectionForward/SyncDirectionReverse constants and Direction
field to UnmappedEntry. Set direction in trackUnmapped based on the
reverseDirection flag during sync. This allows the unmapped command
to distinguish forward vs reverse entries without relying on the
reverseDirection flag (which is always false when unmapped runs).
Forward updaters (AniList→MAL) now use ignoreAniListIDs, while
reverse updaters (MAL→AniList) use ignoreMALIDs. Previously all
updaters shared the same AniList-only ignore map, which meant
isIgnored() compared AniList IDs against MAL source IDs in reverse
sync and never matched.
Use entry.Direction instead of *reverseDirection flag (which is always
false when unmapped runs separately from sync). Forward entries ignore
by AniList ID and map to MAL ID; reverse entries ignore by MAL ID and
map to AniList ID. Extract helpers: isReverseEntry, addIgnoreEntry,
logIgnoredEntry, applyIgnoreAction, applyMapAction, promptID.
Add SaveAndLoad_WithMALIDs and MarshalYAML_CombinedIgnore tests for
mappings round-trip with both AniList and MAL ignore IDs. Add
DirectionField and MixedDirections tests for unmapped state JSON
serialization with forward and reverse entries.
Strategy chains now show all 4 direction-specific variants,
main components table includes all .go files (hato, jikan,
logger, service, cmd_* files), logging section documents the
Logger struct instead of deprecated DPrintf, and dependencies
list is complete.
feat: add unmapped entries management CLI command
feat: add duplicate target detection and 3-phase updater
@bigspawn bigspawn merged commit 156868b into main Feb 16, 2026
3 checks passed
@bigspawn bigspawn deleted the feat/manual-mappings branch February 16, 2026 19:53
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.

1 participant