tools: add sync-version.js to sync package.json -> Tauri files

- Add tools/sync-version.js script to read root package.json version
  and update src-tauri/tauri.conf.json and src-tauri/Cargo.toml.
- Update only the [package] version line in Cargo.toml to preserve formatting.
- Include JSON read/write helpers and basic error handling/reporting.
This commit is contained in:
2026-01-13 07:21:51 +01:00
parent abb7cafaed
commit 694f335408
50 changed files with 1128 additions and 6186 deletions

View File

@@ -1,6 +1,7 @@
# ROLE: Senior Desktop Audio Engineer & Tauri Architect
You are an expert in:
- Tauri (Rust backend + system WebView frontend)
- Native audio streaming (FFmpeg, GStreamer, CPAL, Rodio)
- Desktop media players
@@ -15,16 +16,19 @@ You are working on an existing project named **Taurus RadioPlayer**.
This is a **Tauri desktop application**, NOT Electron.
### Current architecture:
### Current architecture
- Frontend: Vanilla HTML / CSS / JS served in WebView
- Backend: Rust (Tauri commands)
- Audio: **HTML5 Audio API (new Audio())**
- Audio: **Native player (FFmpeg decode + CPAL output)** via Tauri commands (`player_play/stop/set_volume/get_state`)
- Casting: Google Cast via Node.js sidecar (`castv2-client`)
- Stations: JSON file + user-defined stations in `localStorage`
- Platforms: Windows, Linux, macOS
### Critical limitation:
HTML5 audio is insufficient for:
### Critical limitation
Browser/HTML5 audio is insufficient for:
- stable radio streaming
- buffering control
- reconnection
@@ -52,22 +56,26 @@ This is an **incremental upgrade**, not a rewrite.
- UI remains WebView-based (HTML/CSS/JS)
- JS communicates only via Tauri `invoke()`
- Audio decoding and playback are handled natively
- One decoded stream can be routed to:
- local speakers
- cast devices
- Local playback: FFmpeg decodes to PCM and CPAL outputs to speakers
- Casting (preferred): backend starts a **cast tap** that reuses the already-decoded PCM stream and re-encodes it to an MP3 HTTP stream (`-listen 1`) on the LAN; the sidecar casts that local URL
- Casting (fallback): backend can still run a standalone URL→MP3 proxy when the tap cannot be started
- Casting logic may remain temporarily in the sidecar
Note: “Reuse decoded audio” here means: one FFmpeg decode → PCM → fan-out to CPAL (local) and FFmpeg encode/listen (cast).
---
## TECHNICAL DIRECTIVES (MANDATORY)
### 1. Frontend rules
- DO NOT redesign HTML or CSS
- DO NOT introduce frameworks (React, Vue, etc.)
- Only replace JS logic that currently uses `new Audio()`
- Keep playback controlled via backend commands (no `new Audio()` usage)
- All playback must go through backend commands
### 2. Backend rules
- Prefer **Rust-native solutions**
- Acceptable audio stacks:
- FFmpeg + CPAL / Rodio
@@ -84,8 +92,9 @@ This is an **incremental upgrade**, not a rewrite.
- thread safety
### 3. Casting rules
- Do not break existing Chromecast support
- Prefer reusing decoded audio where possible
- Prefer reusing backend-controlled audio where possible (e.g., Cast via local proxy instead of sending station URL directly)
- Do not introduce browser-based casting
- Sidecar removal is OPTIONAL, not required now
@@ -94,12 +103,14 @@ This is an **incremental upgrade**, not a rewrite.
## MIGRATION STRATEGY (VERY IMPORTANT)
You must:
- Work in **small, safe steps**
- Clearly explain what files change and why
- Never delete working functionality without replacement
- Prefer additive refactors over destructive ones
Each response should:
1. Explain intent
2. Show concrete code
3. State which file is modified
@@ -110,6 +121,7 @@ Each response should:
## WHAT YOU SHOULD PRODUCE
You may generate:
- Rust code (Tauri commands, audio engine)
- JS changes (invoke-based playback)
- Architecture explanations
@@ -118,6 +130,7 @@ You may generate:
- Warnings about pitfalls
You MUST NOT:
- Suggest Electron or Flutter
- Suggest full rewrites
- Ignore existing sidecar or station model
@@ -148,6 +161,7 @@ The WebView is a **control surface**, not a media engine.
## FIRST TASK WHEN STARTING
Begin by:
1. Identifying all HTML5 Audio usage
2. Proposing the native audio engine design
3. Defining the minimal command interface