skills/sheet-music: Record chords as syllable markers and compute chord columns, lyric widening and word splits in the generator - #1028
Draft
JoshuaVSherman wants to merge 1 commit into
Conversation
…ut columns (web-jam-tools#1010)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/sheet-music/types.ts: updateChordLyricLinedocumentation to reflect inline chord markers (e.g.re[C/E]member), preserving optional legacy fields for backward compatibility; exportRenderedLineandParseLineOptionsinterfaces.src/sheet-music/builder.ts: implement inline chord marker parsing, chord syntax validation (CHORD_REGEX,isValidChordToken), and guard error handling for performance annotations ([Everybody!],[hold]), malformed brackets ([],[G,G]), and adjacent markers ([G][C]).src/sheet-music/builder.ts: compute chord column positions, lyric widening at markers with-word splitting for intra-word syllables and whitespace expansion for inter-word gaps, and reserved width based onMath.max(guitar.length, bass.length).src/sheet-music/builder.ts: implement automatic line re-breaking at ~75 characters preferring word gaps following punctuation, keeping chords anchored to their syllables.src/sheet-music/builder.ts: addvalidateSongDefinitionto fail closed with clear error identifying offending section/line on non-string lyric fields.test/sheet_music.test.ts: add comprehensive unit tests covering acceptance criteria 1-13 and local verification check 2 assertingC/Ecolumn matches computed column ofminmember.deno.json: bump version from1.38.14to1.38.15per the mandatory first-commit version bump policy.Closes #1010
How to test locally
Run the test suites locally from
/home/joshua/WebJamApps/web-jam-tools:Exercise the change directly:
re[C/E]memberand verify the generated chord-line column forC/Eequals the computed column ofminmember(result[0].lyrics.indexOf("member")).[C/D]O[D]ceans rise,widens with-word splitting to chord lineC/D Dand lyricO - ceans rise,.love's [G/F] notplacesG/Fstrictly within the gap betweenlove'sandnot.willing to pay. [Am7] [C/D]positions both chords afterpay..[Am7b5]dat [Cm/D]da [D]ya-da!widens spaces between words.[G|A]and capo 2 transposed bass[G]and[D/F#].[Everybody!]and[hold]are rejected naming theannotationfield; empty[], unclosed[G, strayG], and adjacent[G][C]are rejected; non-stringlyricsfields fail closed identifying the section and line.Test evidence
Local test suite results:
🤖 Work by Antigravity — Gemini Flash (High)