feat: detect & link album mentions, not just artists (closes task/album-detection)
Source: task/album-detection (objective/linker-improvements) — project brief asks for artist OR album linking; MVP linked artists only.
- service/lib.js: pickAlbum (the exact-name gate, named for the album path) + linkResult now carries kind:"artist"|"album" (additive; defaults to artist so older clients keep working).
- service/resolver.js: one Spotify type=artist,album search per candidate, exact-match against either; returns {url,kind}; cache key includes the kind hint. resolveOne/resolveAll thread the LLM kind hint through.
- service/llm.js: parseClassification now returns Map(name -> "artist"|"album") so album-kind candidates route to the album path (.has() still works like the old Set).
- extension/extract.js: albumMatchesIn over two precise signals (quoted strings + album cue phrases "the album X", "X LP/EP"), folded into allMatchesIn.
- extension/content.js + styles.css: album links render italicised (.rsl-album) with an album tooltip; artist behavior unchanged.
- Tests: new pure-logic coverage in lib.test.js / llm.test.js / extract.test.cjs (album shaping, Map-kind routing, album candidate extraction). scripts/check.sh green.
- README.md + AGENTS.md: document album linking.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -8,12 +8,18 @@ is tracked in the **towl** work-item store under project **`reddit-spotify-linke
|
||||
|
||||
- `service/` — zero-dependency Node resolver (Node 18+, built-in `fetch`/`http`).
|
||||
`resolver.js` = the HTTP server; `lib.js` = pure, side-effect-free logic (the
|
||||
artist-match precision lever) so it's unit-testable; `llm.js` = pure ollama
|
||||
prompt/parse helpers (the optional local-LLM gate, HTTP-only — no in-process
|
||||
model runtime); `lib.test.js` + `llm.test.js` = `node:test`. The only music API
|
||||
is Spotify (MusicBrainz removed).
|
||||
- `extension/` — Firefox **MV2** content script (`content.js` + `manifest.json` +
|
||||
`styles.css`). No build step.
|
||||
exact-name match precision lever + link shaping) so it's unit-testable; `llm.js` =
|
||||
pure ollama prompt/parse helpers (the optional local-LLM gate, HTTP-only — no
|
||||
in-process model runtime); `lib.test.js` + `llm.test.js` = `node:test`. The only
|
||||
music API is Spotify (MusicBrainz removed). The resolver confirms **both artists
|
||||
and albums**: one `type=artist,album` Spotify search per candidate, exact
|
||||
case-insensitive name match against either; each result carries
|
||||
`kind: "artist" | "album"`.
|
||||
- `extension/` — Firefox **MV2** content script (`content.js` + `extract.js` +
|
||||
`manifest.json` + `styles.css`). No build step. `extract.js` is the pure candidate
|
||||
extractor (Title-Case runs + cue phrases for artists; quoted strings + album cue
|
||||
phrases for albums) — node-testable via `extract.test.cjs`. Album links render
|
||||
italicised (`.rsl-album`).
|
||||
- `scripts/check.sh` — the local check gate.
|
||||
|
||||
## How work lands (IMPORTANT — this is NOT the towl repo)
|
||||
@@ -66,6 +72,8 @@ fixes small things directly.
|
||||
HTTP only, no in-process model runtime. The heuristic + Spotify exact-match is the
|
||||
zero-dep default when no LLM is configured.
|
||||
- Detection precision lever (zero-dep default): a candidate links **only** when
|
||||
Spotify returns an artist whose name matches it case-insensitively. A confirmed
|
||||
name links to its Spotify artist page if available, else a "<name> bandcamp"
|
||||
Google fallback.
|
||||
Spotify returns an **artist or album** whose name matches it case-insensitively. A
|
||||
confirmed name links to its Spotify artist/album page if available, else a
|
||||
"<name> bandcamp" Google fallback. Album candidates are over-generated from precise
|
||||
signals only (quoted strings + album cue phrases) because album free-text is noisier
|
||||
than artist names — the Spotify exact-match (and/or LLM `kind=album`) is the filter.
|
||||
|
||||
Reference in New Issue
Block a user