feat(release): scaffold v2 parser package (annotate-based pipeline)

New package alfred/domain/release/parser/ lays the foundation for the
release parser refactor (specs in memory). Exposes:

- Token: frozen VO carrying text + stream index + TokenRole + extra dict.
  with_role() returns a new instance (no mutation).
- TokenRole: str-backed enum split into structural (TITLE/YEAR/SEASON_EP/
  GROUP), technical (RESOLUTION/SOURCE/CODEC/AUDIO_*/BIT_DEPTH/HDR/
  EDITION/LANGUAGE), and meta (SITE_TAG/UNKNOWN) families.
- pipeline.strip_site_tag(): pulls a [site.tag] prefix or suffix.
- pipeline.tokenize(): release name -> list[Token] (all UNKNOWN),
  string-ops split on kb.separators (no regex, per CLAUDE.md).
- pipeline.annotate(): documented stub. Walk order recorded in docstring
  (group right-to-left, then season/episode, year, tech, title).

Legacy parse_release in release.services remains the live implementation
until the annotate step lands. Scaffolding tests verify Token API,
site-tag stripping (prefix/suffix), and tokenize output shape.

Refs: project_release_parser_v2_specs (memory)
This commit is contained in:
2026-05-20 00:12:33 +02:00
parent 9f10f4e0ad
commit a2c917618f
6 changed files with 323 additions and 0 deletions
+10
View File
@@ -17,6 +17,16 @@ callers).
### Added
- **Release parser v2 scaffolding** (`alfred/domain/release/parser/`):
new package laying the foundation for an annotate-based pipeline
(tokenize → annotate → assemble). Exposes `Token` (frozen VO with
`index` + `role` + `extra`), `TokenRole` enum (structural / technical /
meta families), and a `pipeline.py` module with working `strip_site_tag`
+ `tokenize` and a documented `annotate` stub. Legacy `parse_release`
in `release.services` remains the live implementation until the
annotate step is wired in. Scaffolding tests in
`tests/domain/release/test_parser_v2_scaffolding.py`.
- **Real-world release fixtures** under `tests/fixtures/releases/{easy,shitty,path_of_pain}/`,
each documenting an expected `ParsedRelease` plus the future `routing`
(library / torrents / seed_hardlinks) for the upcoming `organize_media`