Skip to content
edwardguevarraPublic

About

Thusfar — "Where was I?" A Windows tray app that captures a short recap the moment you stop playing a game, and shows a get-back-in view next time.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thusfar

Where was I? — a Windows tray app that captures a short, self-authored recap the moment you stop playing a game, and shows you a get-back-in view next time, replacing the 30-minute menu stare.

See BUILD_SPEC.md for the full product spec. This README covers setup and how to run/test the app.


Status — v1 feature-complete (all phases)

All nine steps of the build order (BUILD_SPEC §16) are implemented.

  • Phase 1 — skeleton. Tauri v2 app, SQLite store + full §6 data model (decoupled crates/core), tray + autostart, hide-on-close (§14).
  • Phase 2 — Steam library reading (§7). Registry-locates Steam, parses libraryfolders.vdf across drives and each appmanifest_*.acf, resolves exe hints; upserts idempotently on startup + every 5 min + manual refresh. (crates/steam, fixture-tested.)
  • Phase 3 — process watcher (§8). 5-second poll; maps processes to Steam app ids by install-path, with a launcher/anti-cheat denylist; the pure session state machine applies the 10-minute prompt debounce and the ~45-second grace-merge (launcher→game handoff = one session). (crates/watcher, unit-tested.)
  • Phase 4 — crash recovery (§9). Sessions persist in_progress from the start. On launch, still-running games are adopted (session continues); truly-orphaned ones are closed and offered a late recap.
  • Phase 5 — capture prompt (§10). On a qualifying exit an always-on-top, primary-monitor, focus-grabbing window appears with the game, auto-context, and the three tiers (Skip / one-line / three structured fields). Prompts queue, never stack. Keyboard-friendly (Ctrl+Enter save, Esc skip).
  • Phase 6 — library + recap views (§11, §12). A cover-art grid, and a recap ("get back in") view that centers the player's own words — Where I was / What's next / Don't forget — with playtime, last-played, and session history.
  • Phase 7 — manual logging (§12). + Add game and Log a session (pick an existing game or name a new one) reuse the same write path.
  • Phase 8 — IGDB enrichment (§13). Async, non-blocking cover-art fetch with local caching; needs free Twitch credentials (see below). Degrades to clean placeholders when unconfigured/offline. (crates/enrich; native-TLS via schannel.)
  • Phase 9 — polish. Cover-art grid, placeholder art, empty states, toasts, responsive recap layout, tray UX.

Frontend note. The UI is a polished, build-free vanilla-JS SPA served from src/ (no bundler/Node needed to run). BUILD_SPEC §4 names React+TS; that swap is a self-contained future refinement and doesn't change the Rust core or command surface. Node 26 is installed, so introducing Vite later is trivial.


Prerequisites

Reference setup (recommended for real dev)

  • Rust (stable) with the MSVC toolchain — rustup default stable-msvc.
  • Visual Studio Build Tools with the Desktop development with C++ workload (provides the linker and the C compiler that rusqlite's bundled SQLite needs).
  • WebView2 Runtime — preinstalled on Windows 11; otherwise install the Evergreen runtime from Microsoft.

With that, from src-tauri/:

cargo run          # dev run
cargo test         # store/data-model tests
cargo tauri build  # optional: produce an installer (needs the Tauri CLI)

A frontend build step is intentionally not required — the Phase 1 UI is static HTML/JS under src/, pointed at by frontendDist in tauri.conf.json. withGlobalTauri exposes invoke without a bundler, so Node is not needed to run Phase 1. React + a bundler are introduced in a later UI phase.

This machine (no MSVC / no admin) — GNU toolchain

This repo was scaffolded on a box without Visual Studio. The no-admin path uses Rust's GNU toolchain plus a portable MinGW-w64 (both installed under %USERPROFILE%, no admin required):

  • Rust GNU: rustup-init.exe -y --default-host x86_64-pc-windows-gnu
  • Portable MinGW-w64 (winlibs UCRT) extracted to %USERPROFILE%\tools\mingw64.

Then build/run with the toolchains on PATH:

$env:Path = "$env:USERPROFILE\.cargo\bin;$env:USERPROFILE\tools\mingw64\bin;$env:Path"
cd src-tauri
cargo run

Both paths produce the same app; the only difference is which C toolchain compiles the bundled SQLite and links the binary.


IGDB cover art (optional, Phase 8)

The app is fully functional without this — games just show clean placeholder tiles. To fill in cover art you need free Twitch developer credentials (IGDB is Twitch-owned).

Easiest — in the app: click the ⚙ Settings button → Cover art. It walks you through creating the Twitch app (with a one-click link to the console), you paste the Client ID and Client Secret, and hit Save & connect. It validates the key live and starts filling in art immediately (progress bar shows coverage). A gentle nudge on the library also offers this the first time.

Alternative — headless: set TWITCH_CLIENT_ID / TWITCH_CLIENT_SECRET environment variables, or drop a %APPDATA%\com.thusfar.app\config.json:

{ "twitch_client_id": "xxxx", "twitch_client_secret": "yyyy" }

Art is cached to %APPDATA%\com.thusfar.app\art\, fetched in the background without blocking the UI. Credentials are stored locally and only ever sent to Twitch/IGDB — never hard-coded or shared anywhere else.

How to test

From the repo (with the toolchain on PATH — see below):

1. Unit tests — all four core crates (Tauri-free, so they run cleanly):

cd crates/core   ; cargo test   # store, migrations, capture flow, enrichment
cd ../steam      ; cargo test   # VDF/ACF parsing, exe filtering, discovery
cd ../watcher    ; cargo test   # install-path matching, session state machine
cd ../enrich     ; cargo test   # cover URL + query encoding

19 tests total. Highlights: Steam upsert is idempotent and preserves enrichment; the install-path matcher rejects sibling-prefix false positives (Portal vs Portal 2); the session tracker's grace-merge folds a launcher→game handoff into one session while a different game stays separate.

On the reference MSVC toolchain, cargo test also runs cleanly for the src-tauri crate. Under the improvised GNU toolchain used to scaffold this repo, the Tauri crate's test harness fails to launch (a MinGW resource/manifest quirk — multiple non-default manifests); the app binary itself builds and runs fine. Keeping the store in crates/core sidesteps this entirely for the tests that matter.

2. Run the app

cd src-tauri
cargo run

Expect:

  • The Thusfar window opens to the library. If Steam is installed, your games auto-populate within a second or two (and refresh every 5 min); Refresh Steam re-scans on demand.
  • A tray icon appears: Open / Pause–Resume watching / Quit. Left-click opens the window. Closing the window hides it — only Quit exits, so the watcher keeps running.
  • Click a game → the recap view: cover art, last-played/playtime, the hero notes, and session history.
  • + Add game adds a manual game; Log a session (top bar or on a recap) records a session with notes.
  • The watching pill and the tray Pause/Resume share one flag.

3. See the watcher + capture prompt for real

  • Launch a Steam game, play for >10 minutes, then quit it. Within ~a minute (5 s poll + 45 s grace) a capture prompt appears on top, on the primary monitor, asking where you were. Skip, one-line, or fill the three fields.
  • Sub-10-minute sessions are recorded silently (no prompt), keeping playtime accurate.
  • Crash recovery: if the app (or PC) is killed while a game runs, the next launch offers a late recap for that session — unless the game is still running, in which case the session is simply adopted and continues.

4. Verify persistence & autostart

  • Quit from the tray, relaunch → games/sessions persist (SQLite on disk).
  • Autostart: check HKCU:\Software\Microsoft\Windows\CurrentVersion\Run for a Thusfar entry.

5. Inspect the database directly (optional) — tables games, sessions, notes live in %APPDATA%\com.thusfar.app\thusfar.db.


Project layout

thusfar/
├─ BUILD_SPEC.md            # product spec (source of truth)
├─ src/                     # frontend (no build step) — vanilla-JS SPA
│  ├─ index.html            # main window: library + recap views
│  ├─ main.js
│  ├─ capture.html          # the capture-prompt window (§10)
│  ├─ capture.js
│  └─ styles.css
├─ crates/                  # pure, Tauri-free, independently testable (§5)
│  ├─ core/                 # thusfar-core: the store + §6 data model
│  │  └─ src/{lib,models,schema}.rs
│  ├─ steam/                # thusfar-steam: Steam library reader (§7)
│  │  └─ src/lib.rs
│  ├─ watcher/              # thusfar-watch: process→app-id match + session FSM (§8)
│  │  └─ src/lib.rs
│  └─ enrich/               # thusfar-enrich: IGDB cover-art HTTP client (§13)
│     └─ src/lib.rs
└─ src-tauri/
   ├─ Cargo.toml            # depends on all four crates
   ├─ tauri.conf.json       # windows, asset-protocol scope, bundle
   ├─ build.rs
   ├─ capabilities/default.json
   ├─ icons/
   └─ src/
      ├─ main.rs            # thin launcher
      ├─ lib.rs             # app wiring: state, plugins, tray, background threads
      ├─ commands.rs        # Tauri command surface (store-facing)
      ├─ steam_sync.rs      # Steam discovery → store upserts (§7)
      ├─ watcher.rs         # poll loop, session persistence, crash recovery (§8/§9)
      ├─ capture.rs         # capture queue + prompt window + commands (§10)
      ├─ enrich.rs          # IGDB orchestration: creds, cache, DB writes (§13)
      └─ tray.rs            # system tray (§14)

Notes on the store shape

  • All timestamps are stored as ISO-8601 UTC text (§6); converted to local only for display.
  • sessions identify by Steam app id as the primary key concept (§8); exe_names is a supporting JSON hint.
  • The store exposes start_session (persists in_progress immediately for crash recovery) and log_manual_session (the one-shot manual write path) so both the future watcher and the manual button share exactly one code path (§5).

About

Thusfar — "Where was I?" A Windows tray app that captures a short recap the moment you stop playing a game, and shows a get-back-in view next time.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages