110 lines
2.7 KiB
Markdown
110 lines
2.7 KiB
Markdown
# Rust Tauri MVP Implementation Plan
|
|
|
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
|
|
**Goal:** Build the first usable Rust + Tauri MVP for manual measurement entry and formula-based judgment.
|
|
|
|
**Architecture:** The Rust calculator is a pure library with explicit domain types and tests. Tauri commands and React UI are added after calculator behavior is verified.
|
|
|
|
**Tech Stack:** Rust, Cargo tests, Tauri, React, TypeScript, Ant Design, SQLite later.
|
|
|
|
---
|
|
|
|
### Task 1: Calculator Crate
|
|
|
|
**Files:**
|
|
- Create: `Cargo.toml`
|
|
- Create: `src/lib.rs`
|
|
- Create: `src/domain.rs`
|
|
- Create: `src/calculator.rs`
|
|
- Create: `tests/calculator_tests.rs`
|
|
|
|
- [x] **Step 1: Write failing Rust tests**
|
|
|
|
Write tests that call the desired public API before implementation.
|
|
|
|
- [x] **Step 2: Run test to verify it fails**
|
|
|
|
Run: `cargo test`
|
|
|
|
Expected: fail because the calculator modules and functions are not implemented yet.
|
|
|
|
- [x] **Step 3: Implement domain and calculator**
|
|
|
|
Implement:
|
|
|
|
- `NuclideMeasurements`
|
|
- `CalibrationParams`
|
|
- `SampleInput`
|
|
- `CalculationResult`
|
|
- `Conclusion`
|
|
- `calculate_sample`
|
|
|
|
- [x] **Step 4: Run tests**
|
|
|
|
Run: `cargo test`
|
|
|
|
Expected: all calculator tests pass.
|
|
|
|
### Task 2: Tauri Shell
|
|
|
|
**Files:**
|
|
- Create/modify Tauri scaffold files under the repository root.
|
|
|
|
- [x] **Step 1: Add Tauri + React scaffold**
|
|
|
|
Use a Vite React TypeScript frontend and Tauri Rust backend.
|
|
|
|
- [x] **Step 2: Add calculate command**
|
|
|
|
Expose a command that accepts `SampleInput` JSON and returns `CalculationResult` JSON.
|
|
|
|
- [x] **Step 3: Build check**
|
|
|
|
Run: `npm run build`
|
|
|
|
Expected: frontend builds.
|
|
|
|
Run: `cargo check`
|
|
|
|
Expected: Rust side compiles.
|
|
|
|
### Task 3: MVP UI
|
|
|
|
**Files:**
|
|
- Modify React app files after scaffold exists.
|
|
|
|
- [x] **Step 1: Build input form**
|
|
|
|
Add manual entry fields for Ra, Th, and K repeated values.
|
|
|
|
- [x] **Step 2: Call Rust calculator**
|
|
|
|
Invoke the Tauri command and display returned values.
|
|
|
|
- [x] **Step 3: Show conclusion**
|
|
|
|
Display `OK`, `请增加试验次数至 6 次`, or `校准仪器后重新测量`.
|
|
|
|
- [x] **Step 4: Build verification**
|
|
|
|
Run: `npm run build`
|
|
|
|
Expected: build exits with code 0.
|
|
|
|
### Task 4: Next Stage Backlog
|
|
|
|
After the MVP is verified:
|
|
|
|
- Add SQLite history.
|
|
- Add Excel import/export.
|
|
- Add PDF or HTML report export.
|
|
- Add Windows packaging.
|
|
|
|
## Self-Review
|
|
|
|
- The plan implements the approved MVP only.
|
|
- The formula engine is isolated and testable before GUI work.
|
|
- No first-stage requirement depends on network services or external databases.
|
|
- History and report features are explicitly deferred to keep the first version small.
|