Add: just commands for release build

This commit is contained in:
DaZuo0122
2026-02-13 11:22:46 +08:00
parent 3c3ca342c9
commit 55fe53235d
21 changed files with 253 additions and 97 deletions

View File

@@ -18,9 +18,9 @@ Auth: `Authorization: Bearer <token>` required on all endpoints except `/v1/heal
"uptime_seconds": 12,
"active_sprite_pack": "default",
"capabilities": {
"supports_click_through": true,
"supports_click_through": false,
"supports_transparency": true,
"supports_tray": true,
"supports_tray": false,
"supports_global_hotkey": true,
"supports_skip_taskbar": true
}
@@ -70,6 +70,11 @@ Auth: `Authorization: Bearer <token>` required on all endpoints except `/v1/heal
}
```
## Compatibility Notes
- `SetFlags.click_through` is deprecated for compatibility and ignored at runtime.
- Frontend state always reports `flags.click_through = false`.
## Error Response
```json

View File

@@ -45,5 +45,6 @@ backend = "bevy"
- `auth_token` is generated on first run if config does not exist.
- `window.x`, `window.y`, `window.scale`, and flag fields are persisted after matching commands.
- On Windows, `recovery_hotkey` provides click-through recovery even when the window is non-interactive.
- `window.click_through` is deprecated and ignored at runtime; it is always forced to `false`.
- On Windows, `recovery_hotkey` now forces `visible = true` and `always_on_top = true` for recovery.
- `frontend.backend` selects runtime frontend implementation (`bevy` or `tauri`).

View File

@@ -10,7 +10,7 @@
# 1. Overview
The frontend is a **desktop overlay pet renderer** implemented in Rust (Bevy). It presents an animated character in a **transparent, borderless window** that can be **always-on-top** and optionally **click-through**. It receives control instructions from a local backend process via **localhost REST API**, applies them to its animation/state machine, and persists user preferences locally.
The frontend is a **desktop overlay pet renderer** implemented in Rust (Bevy). It presents an animated character in a **transparent, borderless window** that can be **always-on-top**. It receives control instructions from a local backend process via **localhost REST API**, applies them to its animation/state machine, and persists user preferences locally.
The frontend must be able to run standalone (idle animation) even if the backend is not running.
@@ -22,7 +22,7 @@ The frontend must be able to run standalone (idle animation) even if the backend
1. **Render a cute animated character overlay** with smooth sprite animation.
2. Provide a **stable command interface** (REST) for backend control.
3. Offer **essential user controls** (tray/menu + hotkeys optional) to avoid “locking” the pet in click-through mode.
3. Offer **essential user controls** (tray/menu + hotkeys optional) to keep the pet recoverable and visible.
4. Persist **window position, scale, sprite pack choice, and flags**.
5. Be **cross-platform** (Windows/macOS/Linux) with documented degradations, especially on Linux Wayland.
@@ -43,7 +43,6 @@ The frontend must be able to run standalone (idle animation) even if the backend
* As a user, I can see the pet on my desktop immediately after launch.
* As a user, I can drag the pet to a preferred location.
* As a user, I can toggle click-through so the pet doesnt block my mouse.
* As a user, I can toggle always-on-top so the pet stays visible.
* As a user, I can change the character (sprite pack).
@@ -55,7 +54,7 @@ The frontend must be able to run standalone (idle animation) even if the backend
## Safety
* As a user, I can always recover control of the pet even if click-through is enabled (hotkey/tray item).
* As a user, I can always recover the pet visibility/interaction state via hotkey or tray item.
---
@@ -82,22 +81,19 @@ The frontend must be able to run standalone (idle animation) even if the backend
* When ON, window stays above normal windows.
### FR-FW-3 Click-through (mouse pass-through)
### FR-FW-3 Interaction model
* Support enabling/disabling click-through:
* ON: mouse events pass to windows underneath.
* OFF: pet receives mouse input (drag, context menu).
* Must provide a **failsafe** mechanism to disable click-through without clicking the pet.
* Click-through is not required.
* Pet remains interactive while visible.
* Must provide a **failsafe** mechanism to recover visibility and interaction state.
**Acceptance**
* With click-through enabled, user can click apps behind pet.
* User can disable click-through via tray or hotkey reliably.
* Recovery hotkey/tray action restores visible, interactive pet state reliably.
### FR-FW-4 Dragging & anchoring
* When click-through is OFF, user can drag the pet.
* User can drag the pet.
* Dragging updates persisted position in config.
* Optional: snapping to screen edges.
@@ -130,12 +126,12 @@ The frontend must be able to run standalone (idle animation) even if the backend
### Platform notes (requirements)
* **Windows:** click-through uses extended window styles (WS_EX_TRANSPARENT / layered), always-on-top via SetWindowPos.
* **Windows:** always-on-top via SetWindowPos.
* **macOS:** NSWindow level + ignoresMouseEvents.
* **Linux:** best effort:
* X11: possible with shape/input region.
* Wayland: click-through may be unavailable; document limitation.
* Wayland: overlay behavior limitations may apply; document limitation.
---
@@ -273,7 +269,7 @@ Each state maps to a default animation (configurable by sprite pack):
* `PlayAnimation { name, priority, duration_ms?, interrupt? }`
* `SetSpritePack { pack_id_or_path }`
* `SetTransform { x?, y?, anchor?, scale?, opacity? }`
* `SetFlags { click_through?, always_on_top?, visible? }`
* `SetFlags { click_through?, always_on_top?, visible? }` (`click_through` is deprecated/ignored)
* `Toast { text, ttl_ms? }` (optional but recommended)
### FR-API-4 Idempotency & dedupe
@@ -303,7 +299,6 @@ Each state maps to a default animation (configurable by sprite pack):
Provide tray/menu bar items:
* Show/Hide
* Toggle Click-through
* Toggle Always-on-top
* Sprite Pack selection (at least “Default” + “Open sprite folder…”)
* Reload sprite packs
@@ -315,7 +310,7 @@ If tray is too hard on Linux in v0.1, provide a fallback (hotkey + config).
At minimum one global hotkey:
* Toggle click-through OR “enter interactive mode
* Force visible + interactive recovery mode
Example default:
@@ -323,7 +318,7 @@ Example default:
**Acceptance**
* User can recover control even if pet is click-through and cannot be clicked.
* User can recover visibility and interaction state even when the pet was hidden or misplaced.
### FR-CTL-3 Context menu (optional)
@@ -348,7 +343,7 @@ Right click pet (when interactive) to open a minimal menu.
* position (x,y) + monitor id (best-effort)
* scale
* always_on_top
* click_through
* click_through (deprecated/ignored; always false)
* visible
* animation:
@@ -432,10 +427,10 @@ Frontend must expose in logs (and optionally `/v1/health`) capability flags:
Example:
* Windows: all true
* macOS: all true
* Windows: click-through false; others vary by implementation status
* macOS: click-through false; others vary by implementation status
* Linux X11: most true
* Linux Wayland: click-through likely false, skip-taskbar variable
* Linux Wayland: skip-taskbar variable and overlay behavior limitations
---
@@ -444,8 +439,8 @@ Example:
## Window
1. Launch: window appears borderless & transparent.
2. Drag: with click-through OFF, drag updates position; restart restores.
3. Click-through: toggle via hotkey; pet becomes non-interactive; toggle back works.
2. Drag: drag updates position; restart restores.
3. Recovery: hotkey restores visible + always-on-top behavior reliably.
4. Always-on-top: verify staying above typical apps.
## Animation

View File

@@ -11,9 +11,9 @@ Date: 2026-02-12
| Command/state pipeline | Implemented | Command queue, state snapshot updates, transient state TTL rollback |
| Config persistence | Implemented | `config.toml` bootstrap/load/save with generated token |
| Sprite pack contract | Implemented | `manifest.json` loader and selected->default fallback |
| Platform abstraction | Implemented | Windows adapter now applies click-through/top-most/visibility/position using Win32 APIs |
| Platform abstraction | Implemented | Windows adapter applies top-most/visibility/position using Win32 APIs; click-through is disabled by current requirements |
| Overlay rendering | Implemented (MVP) | Bevy runtime with transparent undecorated window, sprite playback, command bridge |
| Global failsafe | Implemented (Windows) | Global recovery hotkey `Ctrl+Alt+P` disables click-through and forces visibility |
| Global failsafe | Implemented (Windows) | Global recovery hotkey `Ctrl+Alt+P` forces visibility and top-most recovery |
| Embedded default pack | Implemented | Bundled under `assets/sprite-packs/default/` using `sprite.png` (8x7, 512x512 frames) |
| Build/package automation | Implemented (Windows) | `justfile` and `scripts/package_windows.py` generate portable ZIP + SHA256 |
| QA/documentation workflow | Implemented | `docs/QA_WORKFLOW.md`, issue/evidence templates, and `scripts/qa_validate.py` with `just qa-validate` |

View File

@@ -14,7 +14,7 @@
- [x] `SetState` updates state and default animation mapping.
- [x] transient state with `ttl_ms` returns to durable state.
- [x] `SetTransform` persists x/y/scale.
- [x] `SetFlags` persists click-through/always-on-top/visible.
- [x] `SetFlags` persists always-on-top/visible and ignores deprecated click-through.
## Config

View File

@@ -4,7 +4,7 @@ Date: 2026-02-12
| Capability | Windows | Linux X11 | Linux Wayland | macOS |
|------------|---------|-----------|---------------|-------|
| `supports_click_through` | true (implemented) | false (current) | false | false (current) |
| `supports_click_through` | false (disabled by product requirement) | false | false | false |
| `supports_transparency` | true | true | true | true |
| `supports_tray` | false (current) | false (current) | false (current) | false (current) |
| `supports_global_hotkey` | true (implemented) | false (current) | false (current) | false (current) |
@@ -12,6 +12,7 @@ Date: 2026-02-12
## Notes
- Current code applies real Win32 operations for click-through, visibility, top-most, and positioning.
- Current code applies real Win32 operations for visibility, top-most, and positioning.
- Click-through is intentionally disabled by current product requirements.
- Non-Windows targets currently use a no-op adapter with conservative flags.
- Wayland limitations remain an expected degradation in v0.1.

View File

@@ -23,13 +23,24 @@ Use `just` for command entry:
```powershell
just check
just test
just build-release
just package-win
just smoke-win
just build-release-bevy
just package-win-bevy
just smoke-win-bevy
just build-release-tauri
just package-win-tauri
just smoke-win-tauri
```
`just package-win` calls `scripts/package_windows.py package`.
`just smoke-win` calls `scripts/package_windows.py smoke`.
Compatibility aliases:
- `just build-release` -> Bevy release build.
- `just package-win` -> Bevy package.
- `just smoke-win` -> Bevy smoke package check.
Packaging script target selection:
- Bevy: `python scripts/package_windows.py package --frontend bevy`
- Tauri: `python scripts/package_windows.py package --frontend tauri`
## Behavior Test Checklist (Packaged App)
@@ -37,8 +48,8 @@ Run tests from an unpacked ZIP folder, not from the workspace run.
1. Launch `sprimo-app.exe`; verify default sprite renders.
2. Verify no terminal window appears when launching release build by double-click.
3. Verify global hotkey recovery (`Ctrl+Alt+P`) forces interactive mode.
4. Verify click-through and always-on-top toggles via API commands.
3. Verify global hotkey recovery (`Ctrl+Alt+P`) forces visibility and top-most recovery.
4. Verify `SetFlags` applies always-on-top and visibility via API commands.
5. Verify `/v1/health` and `/v1/state` behavior with auth.
6. Verify `SetSpritePack`:
- valid pack switches runtime visuals
@@ -46,6 +57,7 @@ Run tests from an unpacked ZIP folder, not from the workspace run.
7. Restart app and verify persisted config behavior.
8. Confirm overlay background is transparent (desktop visible behind non-sprite pixels).
9. Confirm no magenta matte remains around sprite in default pack.
10. Confirm default startup window footprint is reduced (416x416 before runtime pack resize).
## Test Log Template
@@ -90,6 +102,10 @@ Authoritative workflow: `docs/TAURI_RUNTIME_TESTING.md`.
- `/v1/state` with auth
- `/v1/command`
- `/v1/commands`
7. Verify tauri frameless drag:
- left-mouse drag moves window
- window remains non-resizable
- moved position updates runtime snapshot `x/y` and persists after restart
### Packaged Mode (Required Once Tauri Packaging Exists)

View File

@@ -50,6 +50,9 @@ Frontend:
- `runtime:snapshot` event after command application.
- React/Vite frontend now renders sprite atlas frames with PixiJS and updates animation/scale
from runtime snapshot events.
- Tauri window drag is implemented for undecorated mode:
- left-mouse drag starts native window dragging
- moved position is synced into runtime-core snapshot/config state.
- Bevy frontend remains intact.
- Runtime QA workflow is defined in `docs/TAURI_RUNTIME_TESTING.md`.

View File

@@ -68,6 +68,10 @@ An issue touching Tauri runtime behaviors must satisfy all requirements before `
7. Verify sprite-pack loading:
- valid selected pack loads correctly
- invalid pack path failure is surfaced and runtime remains alive
8. Verify frameless window drag behavior:
- left-mouse drag moves the window
- window remains non-resizable
- moved position is reflected in runtime snapshot state (`x`, `y`) and persists after restart
## API + Runtime Contract Checklist