Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# AGENTS.md

## Project overview
- BandScope is a local-first desktop app for rehearsal prep: a practical song view with likely harmony by section and by instrument or vocal role, form and groove cues, stems, playable ranges, simplification guidance, transposition or setup cues, part-overlap cues, visible confidence, and rehearsal priorities.
- BandScope is a local-first desktop app for rehearsal prep: a practical song view with likely harmony by section and by instrument or vocal role, form and groove cues, stems, playable ranges, new-dropout cues after a leftover return, simplification guidance, transposition or setup cues, part-overlap cues, visible confidence, and rehearsal priorities.
- Authoritative delivery rules live in `ARCHITECTURE.md`, `docs/plans/`, and the root verification scripts.
- Brand, tone, UX copy, and prioritization rules live in `docs/brand-story.md` and must be applied to PRDs, TRDs, UI copy, onboarding, empty states, and error messages.
- App security rules live in `docs/security/app-security.md` and must be applied to file handling, URL intake, subprocesses, IPC, WebView usage, model loading, updates, logging, cache handling, and export behavior.
Expand Down
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Last updated: 2026-03-11
- likely harmony by section and by role
- section roadmap with entries, dropouts, pickups, stops, tags, and handoffs
- groove and timing cues relevant to locking the band together
- playable ranges and density or overlap warnings, with the ready workspace naming tonight's first span and the next instrument check
- playable ranges and density or overlap warnings, with the ready workspace naming tonight's first span and tonight's first new dropout after a leftover return
- simplification, transposition, capo, tuning, or setup cues where applicable
- role-specific rehearsal priorities and confidence flags
- cue-sheet or chart-style exports that summarize the analysis in rehearsal-friendly form
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Added

- Name tonight's first new dropout on the ready rehearsal map and tell the leftover-return parts to count that part out, or the newly sitting-out part to stay out, after leftover parts return.
- Name tonight's first playable range on the ready rehearsal map and tell the player to check that span on their instrument before the section.
- Display the analyzed song tempo (BPM) as a badge in the rehearsal workspace.
- 각 합주 역할(Role)별 개인 연습 진행도를 0~100% 범위로 기록 및 시각화할 수 있는 연습 진척도(`practiceProgress`) 트래커 기능 추가. UI 컨트롤(슬라이더 및 +/- 버튼)과 한/영 다국어 지원 포함.
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ BandScope is a local-first desktop app for rehearsal prep: it turns a song into

Three layers, decoupled through shared contracts:

- `apps/desktop` — Tauri 2 + Vite + React 19 shell (Tailwind 4, Base UI, Storybook). Feature screens live in `src/features/` (home, workspace, chords, ranges, player, settings). The ready workspace names tonight's first playable range and the next instrument check. `src/lib/analysis.ts` and `src/lib/job_runner.ts` call typed Tauri IPC commands, with a browser fallback that serves demo data when not running inside Tauri.
- `apps/desktop` — Tauri 2 + Vite + React 19 shell (Tailwind 4, Base UI, Storybook). Feature screens live in `src/features/` (home, workspace, chords, ranges, player, settings). The ready workspace names tonight's first playable range and tonight's first new dropout after a leftover return. `src/lib/analysis.ts` and `src/lib/job_runner.ts` call typed Tauri IPC commands, with a browser fallback that serves demo data when not running inside Tauri.
- `apps/desktop/src-tauri/src/main.rs` — the Rust orchestration boundary. Tauri commands (`start_analysis_job`, `get_analysis_job_status`, `select_local_audio_source`, `import_youtube_url`) validate untrusted input (project IDs, file paths, URLs) and spawn the Python engine as a subprocess. There is no loopback HTTP listener and no network path for local analysis.
- `services/analysis-engine` — Python package `bandscope_analysis` (librosa/numpy). Entry point `cli.py` reads a JSON job request on stdin and prints a structured job-status JSON envelope on stdout (`--progress-jsonl` streams progress lines). `api.py` orchestrates the pipeline across the `separation`, `sections`, `roles`, `chords`, `ranges`, `temporal`, `transcription`, and `youtube` modules.

Expand Down
184 changes: 184 additions & 0 deletions apps/desktop/src/features/workspace/Workspace.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,190 @@ describe("Workspace", () => {
);
});

it("names tonight's first new dropout after a leftover return", () => {
setNavigatorLanguage("en-US");
const song = createDemoRehearsalSong();
const verse = song.sections[0]!;
song.sections = [
{
...verse,
partGraph: verse.partGraph.map((node) =>
node.role_id === "bass-guitar" || node.role_id === "keys-right"
? { ...node, is_active: false }
: node
)
},
{
...verse,
id: "chorus-1",
label: "chorus",
timeRange: { start: verse.timeRange.end, end: verse.timeRange.end + 20 }
},
{
...verse,
id: "bridge-1",
label: "bridge",
timeRange: {
start: verse.timeRange.end + 20,
end: verse.timeRange.end + 40
},
partGraph: verse.partGraph.map((node) =>
node.role_id === "lead-vocal" ? { ...node, is_active: false } : node
)
}
];

render(<Workspace song={song} />);

const callout = screen.getByTestId("first-new-dropout");
expect(callout).toHaveTextContent("Tonight's first new dropout");
expect(callout).toHaveTextContent(
"Lead Vocal newly sits out at bridge after chorus comes back from verse. Count Lead Vocal out from the top of bridge."
);
expect(screen.getByRole("button", { name: "Open" })).toBeTruthy();
const landing = screen.getByTestId("song-structure-grid").querySelector("[data-section-index='2']");
expect(landing).toBeTruthy();
expect(landing?.getAttribute("id")).toBeNull();
});

it("tells the new dropout to stay out after the leftover return", () => {
setNavigatorLanguage("en-US");
const song = createDemoRehearsalSong();
const verse = song.sections[0]!;
song.sections = [
{
...verse,
partGraph: verse.partGraph.map((node) =>
node.role_id === "bass-guitar" || node.role_id === "keys-right"
? { ...node, is_active: false }
: node
)
},
{
...verse,
id: "chorus-1",
label: "chorus",
timeRange: { start: verse.timeRange.end, end: verse.timeRange.end + 20 }
},
{
...verse,
id: "bridge-1",
label: "bridge",
timeRange: {
start: verse.timeRange.end + 20,
end: verse.timeRange.end + 40
},
partGraph: verse.partGraph.map((node) =>
node.role_id === "lead-vocal" ? { ...node, is_active: false } : node
)
}
];

render(<Workspace song={song} />);
fireEvent.click(screen.getByRole("tab", { name: "Lead Vocal" }));

expect(screen.getByTestId("first-new-dropout")).toHaveTextContent(
"Lead Vocal newly sits out at bridge after chorus comes back from verse. Stay out from the top of bridge."
);
});

it("opens the named new-dropout landing with reduced-motion auto scrolling", () => {
setNavigatorLanguage("en-US");
const song = createDemoRehearsalSong();
const verse = song.sections[0]!;
song.sections = [
{
...verse,
partGraph: verse.partGraph.map((node) =>
node.role_id === "bass-guitar" || node.role_id === "keys-right"
? { ...node, is_active: false }
: node
)
},
{
...verse,
id: "chorus-1",
label: "chorus",
timeRange: { start: verse.timeRange.end, end: verse.timeRange.end + 20 }
},
{
...verse,
id: "bridge-1",
label: "bridge",
timeRange: {
start: verse.timeRange.end + 20,
end: verse.timeRange.end + 40
},
partGraph: verse.partGraph.map((node) =>
node.role_id === "lead-vocal" ? { ...node, is_active: false } : node
)
}
];
const scrollIntoView = vi.fn();
HTMLElement.prototype.scrollIntoView = scrollIntoView;
const matchMedia = vi.spyOn(window, "matchMedia").mockImplementation((query) => ({
matches: query.includes("reduce"),
media: query,
onchange: null,
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn()
}));

render(<Workspace song={song} />);
fireEvent.click(screen.getByRole("button", { name: "Open" }));

expect(matchMedia).toHaveBeenCalledWith("(prefers-reduced-motion: reduce)");
expect(scrollIntoView).toHaveBeenCalledWith({
behavior: "auto",
block: "nearest",
inline: "nearest"
});
});

it("asks the player to confirm the new dropout when leftover evidence is missing", () => {
setNavigatorLanguage("en-US");
const song = createDemoRehearsalSong();
const verse = song.sections[0]!;
song.sections = [
{
...verse,
partGraph: verse.partGraph.map((node) =>
node.role_id === "keys-right" ? { ...node, is_active: false } : node
)
},
{
...verse,
id: "chorus-1",
label: "chorus",
timeRange: { start: verse.timeRange.end, end: verse.timeRange.end + 20 },
partGraph: verse.partGraph.map((node) =>
node.role_id === "keys-right" ? { ...node, is_active: false } : node
)
}
];

render(<Workspace song={song} />);

expect(screen.getByTestId("first-new-dropout")).toHaveTextContent(
"Tonight's first new dropout still needs a named part that newly sits out after a leftover return. Confirm who newly sits out after that return before the first section."
);
expect(screen.queryByRole("button", { name: "Open" })).toBeNull();
});

it("says no new dropout is needed when every named part stays active", () => {
setNavigatorLanguage("en-US");
const song = createDemoRehearsalSong();

render(<Workspace song={song} />);

expect(screen.getByTestId("first-new-dropout")).toHaveTextContent(
"No new dropout is needed: every named part stays active after leftover parts return. Rehearse from the first section without a new sit-out cue."
);
});

it("falls back from blank planning copy and tolerates partial collaboration payloads", () => {
setNavigatorLanguage("en-US");
const song = createDemoRehearsalSong();
Expand Down
66 changes: 64 additions & 2 deletions apps/desktop/src/features/workspace/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SectionRoadmap } from "./SectionRoadmap";
import { GrooveMap } from "./GrooveMap";
import { PracticeProgress } from "./PracticeProgress";
import { fillRangeCopy, firstRangeSqueeze } from "./firstRangeSqueeze";
import { firstNewDropout, hasTrustworthyAllActiveTimeline } from "./firstNewDropout";
import { createTranslator, detectPreferredLocale } from "../../i18n";
import { generateCueSheetCsv, generateChartSummaryJson, generateMetadataHandoffJson, sanitizeFilename } from "../../lib/export";
import { Button } from "@/components/ui/button";
Expand Down Expand Up @@ -91,8 +92,12 @@ const SongStructure = memo(function SongStructure({ sections, t }: { sections: R
data-testid="song-structure-grid"
style={{ gridTemplateColumns: `repeat(${Math.max(1, sections.length)}, minmax(8rem, 1fr))` }}
>
{sections.map((section) => (
<div key={section.id} className="border-r border-white/10 bg-cyan-300/[0.05] px-3 py-3 last:border-r-0">
{sections.map((section, sectionIndex) => (
<div
key={section.id}
data-section-index={sectionIndex}
className="border-r border-white/10 bg-cyan-300/[0.05] px-3 py-3 last:border-r-0"
>
<p className="text-sm font-black text-white">
{section.label} · {formatTimelineTime(section.timeRange.start)}–{formatTimelineTime(section.timeRange.end)}
</p>
Expand Down Expand Up @@ -163,6 +168,44 @@ export function Workspace({ song, sourceBootstrap = null, onSongUpdate }: Worksp
}
)
: t("workspaceFirstRangeMissing");
const namedNewDropout = useMemo(() => firstNewDropout(song, activeRole), [activeRole, song]);
const noNewDropoutNeeded = useMemo(() => hasTrustworthyAllActiveTimeline(song), [song]);
const firstNewDropoutCopy = namedNewDropout
? fillRangeCopy(
t(
activeRole && activeRole === namedNewDropout.dropoutRoleId
? "workspaceFirstNewDropoutStayOut"
: "workspaceFirstNewDropoutNamed"
),
{
dropoutRoleName: namedNewDropout.dropoutRoleName,
sectionLabel: namedNewDropout.sectionLabel,
returnSectionLabel: namedNewDropout.returnSectionLabel,
fromSectionLabel: namedNewDropout.fromSectionLabel
}
)
: t(noNewDropoutNeeded ? "workspaceFirstNewDropoutNone" : "workspaceFirstNewDropoutMissing");

/** Open the named new-dropout landing on the renderer-owned map section. */
const openNamedNewDropout = () => {
if (!namedNewDropout) {
return;
}
const grid = document.querySelector("[data-testid='song-structure-grid']");
if (!(grid instanceof HTMLElement)) {
return;
}
const landing = grid.querySelector(`[data-section-index="${namedNewDropout.sectionIndex}"]`);
if (!(landing instanceof HTMLElement)) {
return;
}
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
landing.scrollIntoView({
behavior: reduceMotion ? "auto" : "smooth",
block: "nearest",
inline: "nearest"
});
Comment on lines +194 to +207

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Scrolling remains renderer-owned

Open targets a renderer-created numeric index. Repeated labels remain distinct, and analysis section IDs never control DOM identifiers.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

};

/** Handle the practice progress change internally by immutably updating the song state. */
const handlePracticeProgressChange = (newProgress: number) => {
Expand Down Expand Up @@ -309,6 +352,25 @@ export function Workspace({ song, sourceBootstrap = null, onSongUpdate }: Worksp
<p className="text-xs font-black uppercase tracking-[0.24em] text-fuchsia-200">{t("workspaceFirstRangeTitle")}</p>
<p className="mt-2 text-sm leading-6 text-slate-100">{firstRangeCopy}</p>
</section>
<section
className="rounded-2xl border border-orange-300/20 bg-orange-300/[0.07] p-4"
data-testid="first-new-dropout"
aria-label={t("workspaceFirstNewDropoutTitle")}
>
<p className="text-xs font-black uppercase tracking-[0.24em] text-orange-200">{t("workspaceFirstNewDropoutTitle")}</p>
<p className="mt-2 text-sm leading-6 text-slate-100">{firstNewDropoutCopy}</p>
{namedNewDropout ? (
<Button
type="button"
variant="outline"
size="sm"
className="mt-3 min-h-10 border-orange-300/30 bg-orange-300/10 font-semibold text-orange-50 hover:bg-orange-300/20 hover:text-white"
onClick={openNamedNewDropout}
>
{t("workspaceFirstNewDropoutOpen")}
</Button>
) : null}
</section>

<div className="grid gap-4 md:grid-cols-2 xl:grid-cols-4">
<section className="rounded-2xl border border-cyan-300/20 bg-cyan-300/[0.06] p-4 md:col-span-2">
Expand Down
Loading
Loading