Skip to content

Development ​

Requirements ​

  • Rust (stable toolchain) and Cargo;
  • Node.js and pnpm for the frontend and desktop app;
  • WebView2 for Windows builds (usually installed on Windows 10 and 11).

Common commands ​

powershell
# Rust (repository root)
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test
cargo run -p sbsave-cli -- --version

# Frontend / desktop app (apps/desktop)
pnpm install
pnpm dev            # frontend only
pnpm build          # vue-tsc --noEmit + vite build
pnpm test           # vitest: locale key parity and interpolation
pnpm tauri dev      # desktop app development
pnpm tauri build    # Windows installers (NSIS + MSI)

Project structure ​

text
crates/sbsave-core/    # Rust core: GVAS/EVAS parsing, save extraction, catalog, diff analysis, report rendering
crates/sbsave-cli/     # clap CLI (binary sbsave); commands and output follow the original Python conventions
crates/sbsave-tools/   # Build-time data pipeline (binary sbsave-tools): catalog build / mine-names
apps/desktop/          # Tauri 2 desktop app: Vue 3 + Vite + TS + Tailwind CSS v4 frontend (project root)
apps/desktop/src-tauri # Tauri shell: list_saves / save_sources / inspect_save / open_save_dir / analyze_save / export_report / guide_links / list_browsers
data/raw/              # Committed data snapshots (including the hand-maintained crosswalk.json); no network access at runtime
data/catalog.json      # Catalog generated by sbsave-tools catalog build; do not edit manually

crates/sbsave-core contains the following modules: gvas (GVAS/EVAS parsing), savegame (save discovery and extraction), catalog, analyze (diff and NG+/DLC logic), report (JSON contract, Markdown, and console output), and i18n (localized interface messages). For the desktop app's structure and commands, see apps/desktop/README.md.

Data pipeline ​

powershell
# Regenerate data/catalog.json
cargo run -p sbsave-tools -- catalog build
cargo run -p sbsave-cli -- catalog check

# Integration test: compare the generated output byte for byte with the committed file
cargo test -p sbsave-tools

After changing catalog data sources, run catalog build first and then catalog check. Manual alias mappings are maintained in data/raw/crosswalk.json (the single source of truth for collectible data, including the camp-to-guide-entry mappings). Guide translations are in data/raw/api/i18n/, and fish acquisition instructions are in data/raw/fish_obtain.json.

Data health check (offline, never reads a save):

powershell
cargo run -p sbsave-tools -- doctor             # writes target/doctor.md and target/doctor.json
cargo run -p sbsave-tools -- doctor --strict    # exits non-zero on new unregistered site entries

It reports the two-way site/catalog diff, guide links, low-confidence or duplicate entries, missing obtain text, alias coverage, and missable/region/quest data. Materials and core upgrades excluded by design are handled by data/raw/doctor_allowlist.json and a file exclusion list in code; CI runs --strict as a non-blocking step so new guide entries are noticed early.

To update the game name mappings, you need a local installation of the game plus cue4parse.exe and repak.exe. See data/raw/README.md for details:

powershell
cargo run -p sbsave-tools -- mine-names `
  --game "H:\SteamLibrary\steamapps\common\StellarBlade" `
  --tools path\to\tools

Tests and acceptance ​

  • Tests use synthetic saves constructed byte by byte and never modify real saves.
  • The GVAS parser is read-only and defensive: structs, arrays, maps, and sets that cannot be parsed fall back to RawValue, and the reader always resynchronizes to tag_start + size.
  • Migration acceptance (2026-09-14): Output matched the original Python report --json node for node and matched its Markdown character for character after normalization. The Python reference implementation was removed on 2026-09-15; its history is preserved in Git (commit 33cb981).
  • For catalog regression checks, see data.md.

Testing tips ​

To test the desktop app's "no save found" screen on a computer that already has saves, set SBSAVE_SAVE_DIRS (semicolon-separated directories) to replace the default save discovery directories. This applies to both the desktop app and the CLI:

powershell
$env:SBSAVE_SAVE_DIRS = "$env:TEMP\sbsave-empty"   # Use existing and nonexistent directories to test both messages
cd apps/desktop
pnpm tauri dev

This variable is for local testing only. Because the app remembers the last selected save, click Switch to automatic or Reset to defaults in Settings before testing the empty state.

Documentation site ​

The online documentation is built with VitePress from docs/. Chinese is the default language, and English pages are under docs/en/. To preview and build the site locally:

powershell
cd docs
pnpm dev        # local preview (http://localhost:5173 by default)
pnpm build      # build; dead links fail the build (the same command used by CI and Netlify)

When adding or changing a page, update both languages. After editing a Chinese page, update its counterpart in docs/en/. English pages should use the UI terminology from apps/desktop/src/locales/en.ts, with internal links using /en/... or relative paths within the same directory. Language switching, navigation, sidebars, and footers are configured in the top-level locales[...].themeConfig in docs/.vitepress/config.ts.

CI and releases ​

There are two GitHub Actions workflows in .github/workflows/:

WorkflowTriggerDescription
ci.ymlPush to main / pull request / manualRust job (windows-latest): cargo fmt --all --check, clippy --workspace --all-targets -- -D warnings, cargo test --workspace, and a CLI smoke test; frontend job (Ubuntu): pnpm install --frozen-lockfile + pnpm build + pnpm test; documentation job (Ubuntu, docs/): pnpm install --frozen-lockfile + pnpm build, which builds the VitePress site and fails on dead links; Netlify handles deployment
release.ymlPush a v* tag / manualRuns the full ci.yml checks, verifies that the tag matches the version in tauri.conf.json, builds the portable desktop and CLI ZIP archives, and creates a draft Release with gh release create; the release is published after manual review

Release procedure:

powershell
cd apps/desktop
pnpm bump 0.2.0        # sync tauri.conf.json / package.json / Cargo.toml and refresh Cargo.lock
cd ..\..
git commit -am ":bookmark: 发布 v0.2.0"
git tag v0.2.0
git push origin main v0.2.0

Releases use lightweight tags, consistent with v0.1.0 and v0.2.0. git push --follow-tags does not push lightweight tags, so you must specify the tag explicitly in the push command. You can use --follow-tags only if you switch to annotated tags (git tag -a v0.2.0 -m ":bookmark: 发布 v0.2.0").

release.yml verifies that the tag matches the version in tauri.conf.json and fails if they differ.

Version numbers follow SemVer. pnpm bump accepts x.y.z and x.y.z-prerelease (for example, 1.0.0-rc.1 for test builds), but not build metadata (+...). The process is the same for prereleases; simply use a tag such as v1.0.0-rc.1.

The Rust job must run on Windows because the sbsave-tools integration test compares data/catalog.json byte for byte, and the generated file uses platform-specific line endings (CRLF on Windows). .gitattributes pins this file to CRLF.

Layout invariants ​

Observe these constraints before changing the directory layout:

  • crates/ must remain directly under the repository root because sbsave-tools::repo_root() walks up two levels;
  • data/catalog.json must remain three levels above crates/sbsave-core so it can be embedded at compile time with include_str!;
  • apps/desktop/src-tauri must be listed in the workspace members because tauri-action relies on it to resolve the workspace target/ directory.

Not affiliated with Shift Up or Sony Interactive Entertainment; for personal save analysis only.