This document defines the initial reference architecture and feature scope for the next SBaGenX GUI effort.
The GUI is not to be a frontend for the sbagenx CLI. It is to be a
desktop application built directly on sbagenxlib, with the CLI kept as
an independent host/frontend.
- Provide a polished desktop editor for
.sbgand.sbgffiles. - Use
sbagenxlibdirectly for all core behavior. - Support real-time validation and diagnostics while editing.
- Support direct playback and export from the loaded document.
- Keep the architecture aligned with the library-first direction of the project.
The first GUI milestone is not intended to:
- embed the
sbagenxCLI as its runtime engine, - depend on a remote Node.js server,
- act as a general IDE,
- replace every existing CLI feature on day one,
- duplicate parser or renderer math outside
sbagenxlib.
The GUI must integrate with sbagenxlib directly for core behavior.
That includes:
- sequence loading/parsing,
.sbgfloading and preparation,- immediate-mode parsing where needed,
- built-in program generation,
- runtime activation,
- audio export,
- plot data generation.
The GUI must not shell out to sbagenx for these tasks.
CLI-only behavior may still remain host-side elsewhere in the project, but the GUI is to be a true library-backed frontend.
The recommended starting stack is:
Tauri 2SvelteMonaco Editor- Rust bridge layer calling
sbagenxlib
Why this stack:
Taurigives a desktop shell without the weight of an IDE stack.Sveltekeeps the frontend small and direct.Monacogives a proven code-editor surface with syntax coloring, markers, and navigation.- Rust is a good bridge layer for desktop commands and for binding to the C library.
The packaged GUI is to be a self-contained desktop app.
node/npmare build-time tools only.- The installed app does not require a remote Node.js server.
- The installed app uses the bundled frontend assets, the Tauri host,
and
sbagenxlib.
The GUI should be split into three layers:
- Frontend
- editor,
- diagnostics pane,
- transport controls,
- export controls,
- plot/inspection views,
- settings.
- Native bridge
- Tauri commands/events,
- file dialogs,
- state coordination,
sbagenxlibFFI boundary,- host-side orchestration where still needed.
- Core engine
sbagenxlib,- source of truth for parsing, timing, runtime behavior, rendering, and plot data.
Host-side orchestration may still be used for:
- Python/Cairo plotting backend invocation,
ffmpeginvocation,- desktop file dialogs and window behavior.
But those are to wrap sbagenxlib, not the CLI.
The first useful GUI version should be editor-centric.
Required features:
- Document handling
- open
.sbgfiles, - open
.sbgffiles, - support multiple open documents in tabs,
- save current document,
- save as,
- dirty-state tracking.
- Editor
- syntax highlighting for
.sbg, - syntax highlighting for
.sbgf, - line numbers,
- monospace editing surface,
- sensible undo/redo behavior.
- Validation
- real-time validation on a short debounce,
- diagnostics list,
- line-based navigation to errors,
- clear display of library/native parse failures.
- Transport
- Play,
- Stop,
- Export.
- Native integration
- validation performed through
sbagenxlib, - playback initiated through a library-backed runtime path,
- export performed through
sbagenxlib, - no CLI process execution for these actions.
If the basic milestone lands cleanly, the next additions should be:
- plot preview for the active document,
- beat/frequency inspector,
- document tabs,
- recent files,
- export presets,
- structured status panel for runtime/export activity.
The editor is the center of the first GUI version.
The GUI should treat .sbg and .sbgf as first-class editable
documents, not as files hidden behind forms.
Multi-document editing should be a first-class feature. In practical
terms, that means separate tabs for multiple open .sbg and .sbgf
files, each with its own editor model, diagnostics, path, and dirty
state.
Minimum editor expectations:
- syntax-colored text,
- fast scrolling,
- stable large-file editing behavior,
- visible current line/column,
- jump-to-diagnostic behavior,
- future support for hover/help is desirable but not required for v0.1.
Validation should run on a debounce rather than every keystroke.
Validation output should be structured as:
- severity,
- message,
- line,
- column when available,
- source document type (
.sbgor.sbgf).
If sbagenxlib does not yet expose structured diagnostics for all
cases, the bridge layer may temporarily normalize library error strings
into editor markers. The long-term goal should still be library-owned
diagnostics where practical.
The first playback goal is functional correctness, not a full transport studio.
Required:
- Play current document,
- Stop playback,
- surface runtime errors clearly,
- avoid blocking the UI while playing.
Playback is to use sbagenxlib directly.
The first export goal is direct library-backed export of the active document.
Required:
- export current document to audio,
- choose output path,
- surface progress/error state cleanly.
Advanced export options can follow later.
The GUI should use sbagenxlib as the source of plot data.
If host-side rendering is required at first, that is acceptable, but the plot semantics and sampled data should still come from the library.
This preserves the project rule that core math should not be duplicated in frontends.
The GUI should be a real desktop application on:
- Windows
- Linux
Windows presentation quality matters from the beginning. That means the frontend should be designed as a desktop application, not as a generic web dashboard dropped into a window.
- No core audio/program logic in the GUI layer.
- No parser duplication in the GUI layer.
sbagenxlibremains the source of truth.- CLI behavior may be used as a reference during development, but not as a runtime dependency for the GUI.
- Host-side utilities are acceptable only where they are truly host concerns.
A reasonable starting layout is:
gui/
package.json
src/
app/
components/
editor/
state/
styles/
src-tauri/
src/
commands/
ffi/
state/
- Scaffold
Tauri + Svelte. - Integrate
Monaco. - Add open/save for
.sbgand.sbgf. - Add debounced validation bridge to
sbagenxlib. - Add diagnostics panel.
- Add Play/Stop.
- Add Export.
- Add plot preview.
The first GUI milestone is successful if a user can:
- open an
.sbgor.sbgffile, - keep multiple
.sbgand.sbgffiles open in tabs, - edit them in a syntax-colored editor,
- see validation errors in real time,
- play the active document,
- export the active document,
- do all of the above through
sbagenxlib, not through the CLI.