This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm i # Install dependencies
npm run debug # Run dev server (Parcel, hot reload)
npm run test # Run all tests
npm run test:debug # Run tests with Node inspector
npm run build # Build to dist/To run a single test file:
npx mocha --require ts-node/register test/specs/test.traktor.tsThis is a client-side TypeScript web app (no backend) built with Parcel. The entry point is src/index.html / src/index.ts.
- User uploads a playlist file in the browser
parseArchive()inindex.tstries each parser in order until onesupports()the file- The matching parser returns a canonical
Archiveobject (defined insrc/parsers/archive.ts) - The
Archiveis rendered viasrc/formatter.tsusing a user-configurable format string
Archive— top-level object:{ collection, playlists[], format }Collection— map of key →ArchiveTrack(track metadata: title, artist)Playlist/CPlaylist— named list ofPlaylistTrack[], with afilter(startIndex, playedLive)methodPlaylistTrack— joins a playlist entry to itscollectionEntryin the Collection; carries optional timing data (startTimeJS,timeOffset,timeOffsetString)Parserinterface —supports(): boolean+parse(): Archive | null
Each parser implements the Parser interface and exposes a static extensions array used to populate the file input's accept attribute:
| File | Format | Key notes |
|---|---|---|
traktor.ts |
Traktor NML (.nml) | XML; collection key built from LOCATION volume+dir+file; computes timeOffset per track relative to first track; extends CPlaylist to call computeTrackOffsets on filter |
rekordbox.ts |
RekordBox XML (.xml) | XML |
rekordboxtxt.ts |
RekordBox TXT (.txt) | Plain text |
m3u8.ts |
M3U8 (.m3u8) | Line-based |
cue.ts |
CUE sheet (.cue) | Line-based |
common.ts provides querySelectorAllParents() — a workaround for jsdom's lack of > CSS child combinator support, used in XML parsers.
TRACK_FIELDS— map of token name → substitution function. Available tokens:${INDEX},${INDEX_PADDED},${TITLE},${ARTIST},${OFFSET}playlistToReadable()— outputs artist hashtags block followed by numbered track listbuildTags()— splits artists on commas and generates#lowercasenospacehashtags
Tests use Mocha + Chai with ts-node (configured in .mocharc.yml). XML parsers require jsdom:
require('jsdom-global')()
global.DOMParser = window.DOMParserTest fixtures live in test/files/ (real NML, XML, CUE, M3U8, TXT files).