Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: add tab articulation legend (#3218)

[._.]/ Adam Eivya3966ddae344
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index ab90e5046d..6e872dc5ac 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -41,6 +41,8 @@
- **Tap a note on a drum chart to find out what it's asking for.** The kit grid is PortOS's own notation, so there was nowhere to look up what an × with a chevron over it on the crash row actually means. Tapping any note now opens a readout naming the piece, the articulation ("Crash — Accent"), where it falls ("bar 6, count \"2 e\""), how hard it's struck relative to a full stroke, and how to strike that piece. The tapped note is boxed on the sheet so it's clear which one is being described, a near-miss on a tight groove still answers rather than dismissing, and tapping empty grid closes it. A new Legend button lists all six cell characters plus how to play each piece the chart uses, and the sheet takes keyboard focus so ←/→ walk the hits for anyone not using a touchscreen.
+- **[issue-3218] Tab sheets now explain their articulation characters.** When an arrangement includes a tab staff, a Legend button defines hammer-ons, pull-offs, slides, bends, releases, vibrato, and muted notes, including how to play each technique. Chord-over-lyrics and plain-text sheets stay uncluttered when that notation is absent.
+
## Quota burn
- **[issue-3179] Quota-burn no longer spends window budget on runs that never happened** — a scheduled quota-burn run counted against the family's per-window dispatch cap as soon as it was considered, even when it was subsequently skipped and no agent was ever started. Those phantom dispatches ate the budget, so a family configured for e.g. 5 burns per reset window could fire far fewer — and a family capped at 1 could never fire at all, because the skipped run consumed the only slot before the next gate re-read it. A burn is now counted once its agent has actually run, and a burn that is queued or in progress holds its slot in the meantime, so the cap stays accurate without letting a second app or a repeated "Run" overshoot it.
diff --git a/client/src/components/songbook/TabSheetView.jsx b/client/src/components/songbook/TabSheetView.jsx
index 69195f617e..356fa4c418 100644
--- a/client/src/components/songbook/TabSheetView.jsx
+++ b/client/src/components/songbook/TabSheetView.jsx
@@ -1,9 +1,10 @@
-import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
+import { memo, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
import { ChevronDown, ChevronRight } from 'lucide-react';
-import { parseTabSheet } from '../../lib/tabNotation.js';
+import { parseTabSheet, TAB_ARTICULATIONS } from '../../lib/tabNotation.js';
import { splitJoinedChords } from '../../lib/chordShapes.js';
import usePopoverPosition from '../../hooks/usePopoverPosition.js';
import ChordDiagram from './ChordDiagram.jsx';
+import { activeCtrlClass, ctrlBtnClass } from './constants.js';
/**
* Rendered tab/chord sheet — the shared display surface for the SongBook
@@ -105,6 +106,23 @@ const ChordSegments = ({ segments, blockKey, activeKey, onTap }) =>
);
});
+const TabLegend = ({ id }) => (
+ <div id={id} className="mb-3 rounded-lg border border-port-border bg-port-bg/60 px-3 py-2 text-xs font-sans">
+ <dl className="grid gap-x-4 gap-y-1 sm:grid-cols-2">
+ {TAB_ARTICULATIONS.map((articulation) => (
+ <div key={articulation.char} className="flex items-start gap-2">
+ <dt className="shrink-0 rounded border border-port-border bg-port-card px-1.5 font-mono text-sm text-port-accent">
+ {articulation.char}
+ </dt>
+ <dd className="min-w-0 text-gray-300">
+ <span className="font-semibold text-white">{articulation.name}</span> — {articulation.detail}
+ </dd>
+ </div>
+ ))}
+ </dl>
+ </div>
+);
+
function TabSheetView({
text,
format = 'tab',
@@ -134,6 +152,9 @@ function TabSheetView({
}
return out;
}, [lines]);
+ const hasTabstaff = format === 'tab' && lines.some((line) => line.type === 'tabstaff');
+ const [legendOpen, setLegendOpen] = useState(false);
+ const legendId = useId();
// Unique chord names in order of first appearance (chords-used strip).
// Dash-joined quick changes split into their segments FIRST, so "Am-Am7"
@@ -251,6 +272,21 @@ function TabSheetView({
</div>
)}
+ {hasTabstaff && (
+ <div className="mb-1.5 flex justify-end font-sans">
+ <button
+ type="button"
+ onClick={() => setLegendOpen((open) => !open)}
+ aria-expanded={legendOpen}
+ aria-controls={legendId}
+ className={`px-3 ${ctrlBtnClass} ${legendOpen ? activeCtrlClass : ''}`}
+ >
+ Legend
+ </button>
+ </div>
+ )}
+ {hasTabstaff && legendOpen && <TabLegend id={legendId} />}
+
{blocks.map((block, bi) => {
if (block.type === 'tabstaff') {
// Collapse staffs that don't belong to the active view: a ≥5-line
diff --git a/client/src/components/songbook/TabSheetView.test.jsx b/client/src/components/songbook/TabSheetView.test.jsx
index 28812fcecb..4393997a91 100644
--- a/client/src/components/songbook/TabSheetView.test.jsx
+++ b/client/src/components/songbook/TabSheetView.test.jsx
@@ -38,6 +38,36 @@ describe('TabSheetView', () => {
expect(staffBlocks[0].textContent).toContain('B|--0-----|');
});
+ it('toggles the tab articulation legend when a tab staff is present', () => {
+ render(<TabSheetView text={SAMPLE} format="tab" />);
+ const toggle = screen.getByRole('button', { name: 'Legend' });
+ const panelId = toggle.getAttribute('aria-controls');
+ expect(toggle.getAttribute('aria-expanded')).toBe('false');
+ expect(document.getElementById(panelId)).toBeNull();
+
+ fireEvent.click(toggle);
+ expect(toggle.getAttribute('aria-expanded')).toBe('true');
+ const panel = document.getElementById(panelId);
+ expect(panel).toBeTruthy();
+ expect(panel.textContent).toContain('Hammer-on');
+ expect(panel.textContent).toContain('Muted note');
+
+ fireEvent.click(toggle);
+ expect(toggle.getAttribute('aria-expanded')).toBe('false');
+ expect(document.getElementById(panelId)).toBeNull();
+ });
+
+ it('only offers the articulation legend for tab-format sheets with a tab staff', () => {
+ const { rerender } = render(<TabSheetView text={'C G\nNonsense lyric line'} format="tab" />);
+ expect(screen.queryByRole('button', { name: 'Legend' })).toBeNull();
+
+ rerender(<TabSheetView text={SAMPLE} format="chordpro" />);
+ expect(screen.queryByRole('button', { name: 'Legend' })).toBeNull();
+
+ rerender(<TabSheetView text={SAMPLE} format="plain" />);
+ expect(screen.queryByRole('button', { name: 'Legend' })).toBeNull();
+ });
+
it('renders chordlyric lines as a chord row above the bare lyric', () => {
const { container } = render(<TabSheetView text={SAMPLE} />);
// Bare lyric (brackets stripped)
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index 231e9069ed..9ac19352c6 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -152,7 +152,7 @@ grep -i "what you want to do" client/src/lib/README.md
| `tribeCadence.js` | Mirror of `server/lib/tribeCadence.js` — the single authoritative Tribe care-cadence rules shared by the page, the Care dashboard widget, and the proactive alert: `cadenceStatus(entity)` → `{ state, daysRemaining, daysOverdue }`, `daysSinceDate(dateStr)`, `DEFAULT_CADENCE_DAYS`, `SOON_WINDOW_DAYS`. A cross-boundary contract test asserts it never drifts from the server copy. |
| `streakGlyph.js` | `streakGlyph(streak)` — the single POST streak emoji (✨ / ⚡ / 🔥 by day count) shared by the POST launcher, Morse trainer, daily widget, and dashboard streak widget. |
| `syncCounts.js` | Directional pending-sync counts for the Instances federation cards. `directionalCounts({ localMax, peerMax, ourCursor, peerCursorForUs })` → `{ toPull, toPush }` (each a non-negative Number, or `null` when unknown) from monotonic change-log seqs; `diffSeq(ahead, behind)` is the BigInt-safe clamp-at-zero subtraction (handles numeric strings past `MAX_SAFE_INTEGER`); `describeDirectional({ toPull, toPush })` renders the plain-language `{ state, text }` ("in sync" / "N to pull · M to push" / "checking…"). No React — `SyncStatusBadge` drives it. |
-| `tabNotation.js` | Guitar-tab / chord-sheet / ChordPro text parser for SongBook (`/songbook`). `parseTabSheet(text)` → `{ lines, meta, errors }` classifying each line (`section`/`chords`/`lyric`/`tabstaff`/`chordlyric`/`blank`/`text`) with chord names + column offsets, plus ChordPro meta (`{title:}`/`{artist:}`/`{key:}`/`{capo:}`); `detectFormat(text)` → `'chordpro' \| 'tab' \| 'plain'`; `normalizePastedTab(text)` cleans HTML remnants/entities, CRLF, tabs→spaces, blank-line runs; `transposeChordName(name, n)` / `transposeText(text, n)` transpose chord symbols (slash chords, sensible sharp/flat spelling, column-preserving on chord lines); `CHORD_TOKEN_RE` exported for reuse, plus `NOTE_TO_PC` / `spellPitchClass` exported minimally so `chordShapes.js` derives voicings from the same pitch-class tables. Forgiving — never throws, unknown lines classify as `text`. NOT the lead-sheet parser (`scoreNotation.js`). |
+| `tabNotation.js` | Guitar-tab / chord-sheet / ChordPro text parser for SongBook (`/songbook`). `parseTabSheet(text)` → `{ lines, meta, errors }` classifying each line (`section`/`chords`/`lyric`/`tabstaff`/`chordlyric`/`blank`/`text`) with chord names + column offsets, plus ChordPro meta (`{title:}`/`{artist:}`/`{key:}`/`{capo:}`); `detectFormat(text)` → `'chordpro' \| 'tab' \| 'plain'`; `normalizePastedTab(text)` cleans HTML remnants/entities, CRLF, tabs→spaces, blank-line runs; `transposeChordName(name, n)` / `transposeText(text, n)` transpose chord symbols (slash chords, sensible sharp/flat spelling, column-preserving on chord lines); `TAB_ARTICULATIONS` documents tab-staff technique characters for the viewer legend; `CHORD_TOKEN_RE` exported for reuse, plus `NOTE_TO_PC` / `spellPitchClass` exported minimally so `chordShapes.js` derives voicings from the same pitch-class tables. Forgiving — never throws, unknown lines classify as `text`. NOT the lead-sheet parser (`scoreNotation.js`). |
| `terminalTheme.js` | Pure xterm.js palette builder for the Shell terminal. `buildTerminalTheme({ bg, fg, accent, card, error, success, warning }, mode)` assembles the xterm `theme` object — base ANSI colors from the active theme's CSS vars, the rest from mode-tuned literals (`ANSI_NIGHT` bright/pastel for dark backgrounds, `ANSI_DAY` darkened/saturated so colored CLI output stays legible on daytime themes). `parseCssColorToHex(raw, fallback)` normalizes both the `15 15 15` triple form and the `rgb(7 7 7 / 0.86)` function form (used by `--port-terminal-*` tokens) to `#rrggbb`, dropping alpha. No DOM reads — `Shell.jsx` resolves CSS vars and re-applies on theme switch. |
| `universeBuilderShared.js` | Shared constants + pure category/trunk/composite helpers for the Universe Builder page and its extracted tab/editor components (#2374): `TRUNK_TABS`/`TRUNK_BY_ID`/`TRUNK_BY_KIND`, `TAB_*` + `BUCKET_CANON`, `CATEGORY_LABELS`, `DEFAULT_RENDER_OPTS`, `COMPOSITE_BOARD_KINDS`; and helpers `groupBucketsByKind`, `normalizeCategoryKey`, `humanizeCategory`, `ensureDraftCategories`, `getCategoryKeys`, `compositeKindLabel`. No React state — safe to import from the page or any tab component without a cycle. |
| `universeBuilderCounts.js` | Pure prompt-count helpers for the Universe Builder render buttons (#2374), mirroring the server's compile/skip rules so inline counts match what `/render` will enqueue: `totalVariationCount`, `canonEntryHasContent`, `countCanonWithContent`, `renderPromptCount`, `scopedPromptCount`. The server `compilePrompts`/`synthesizeCanonPrompt` copy is authoritative — keep in sync. |
diff --git a/client/src/lib/tabNotation.js b/client/src/lib/tabNotation.js
index de7169e174..913f1985a8 100644
--- a/client/src/lib/tabNotation.js
+++ b/client/src/lib/tabNotation.js
@@ -16,6 +16,7 @@
// transposeChordName(name, n) → transposed chord symbol
// transposeText(text, n) → text with chord lines transposed in place
// CHORD_TOKEN_RE → anchored single-token chord matcher
+// TAB_ARTICULATIONS → tab-staff character legend
//
// Line = { type, text, chords?, label? } where type is one of:
// 'section' — [Verse 1], {start_of_chorus}/{soc}, or a bare "Chorus:" line
@@ -33,6 +34,52 @@
// Chord tokens
// ---------------------------------------------------------------------------
+// Standard articulation characters accepted inside tab-staff lines. Kept
+// beside the parser so the renderer's legend and the notation contract cannot
+// drift into separate vocabularies.
+export const TAB_ARTICULATIONS = [
+ {
+ char: 'h',
+ name: 'Hammer-on',
+ detail: 'Pick the first note, then press a higher fret without picking again.',
+ },
+ {
+ char: 'p',
+ name: 'Pull-off',
+ detail: 'Sound a lower fretted note by pulling the higher fretting finger away.',
+ },
+ {
+ char: '/',
+ name: 'Slide up',
+ detail: 'Keep the string sounding while sliding to a higher fret.',
+ },
+ {
+ char: '\\',
+ name: 'Slide down',
+ detail: 'Keep the string sounding while sliding to a lower fret.',
+ },
+ {
+ char: 'b',
+ name: 'Bend',
+ detail: 'Push or pull the string sideways to raise the pitch.',
+ },
+ {
+ char: 'r',
+ name: 'Release',
+ detail: 'Let a bent string return to the written fret and pitch.',
+ },
+ {
+ char: '~',
+ name: 'Vibrato',
+ detail: 'Gently vary the pitch while the note sustains.',
+ },
+ {
+ char: 'x',
+ name: 'Muted note',
+ detail: 'Touch the string lightly and pick a short, unpitched sound.',
+ },
+];
+
// Anchored matcher for ONE chord symbol (test whitespace-split tokens against
// it). Root A–G + optional #/b, then any run of quality/extension parts, then
// an optional /bass. Deliberate anti-word choices: roots are uppercase-only,
diff --git a/client/src/lib/tabNotation.test.js b/client/src/lib/tabNotation.test.js
index 992b826070..d08296a968 100644
--- a/client/src/lib/tabNotation.test.js
+++ b/client/src/lib/tabNotation.test.js
@@ -1,6 +1,7 @@
import { describe, it, expect } from 'vitest';
import {
CHORD_TOKEN_RE,
+ TAB_ARTICULATIONS,
detectFormat,
parseTabSheet,
normalizePastedTab,
@@ -11,6 +12,18 @@ import {
// All fixture content is invented ("Example Song" by "The Placeholders") —
// never real lyrics or real records.
+describe('TAB_ARTICULATIONS', () => {
+ it('documents every supported tab-staff articulation character', () => {
+ expect(TAB_ARTICULATIONS.map(({ char }) => char)).toEqual([
+ 'h', 'p', '/', '\\', 'b', 'r', '~', 'x',
+ ]);
+ for (const articulation of TAB_ARTICULATIONS) {
+ expect(articulation.name.trim()).not.toBe('');
+ expect(articulation.detail.trim()).not.toBe('');
+ }
+ });
+});
+
describe('CHORD_TOKEN_RE', () => {
const CHORDS = [
'C', 'A', 'G7', 'Am', 'Am7', 'Bm', 'F#', 'Bb', 'F#m', 'Bbm7',