6 Commits

Author SHA1 Message Date
44r0n7 ad46ad6b14 refactor: deduplicate and clean up across all source modules
- Extract canonical date algorithm to src/date.rs; remove duplicates in log.rs and detect.rs
- Extract build_std_command in launch.rs; unify needs_host_library_injection via pub(crate) delegation
- Add missing unknown-setting warning to parse_imported_config in share.rs
- Extract format_with_hint helper in error.rs; set_proton_no_sync helper in env.rs
- Remove dead match in completion.rs shell_path_literal; use parse_fps for FpsCap in keys.rs
- Replace six as_str() impls with impl_as_str! macro in schema.rs
- Collapse ResolvedSettings::apply (~110 lines) with apply_scalar!/apply_opt!/apply_clone! macros
- Replace six color functions with color_fn! macro in color.rs

89/89 tests passing, zero clippy warnings.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-14 11:08:43 -04:00
44r0n7 76ab5351a9 test: comprehensive coverage sweep — 34 new tests
Groups added:
- Help topics (all valid topics, bad topic, bad settings group filter)
- version/help flags
- status command
- All 16 toggle settings reject invalid values (maybe/yes/1/ON/empty)
- All 6 enum settings reject bad values
- 14 numeric bad-value cases (fps=0, sharpness=21, abc, negatives, floats)
- 5 numeric boundary-valid cases (sharpness 0/20, fps 1, native, pixels)
- Unknown/wrong-case setting names rejected
- Alias round-trips: host-libs → steam-host-libs, laa → large-address-aware
- config reset edge cases (no args, --all conflict, unknown name)
- config export to stdout and to file (sparse)
- config import error cases (missing file, bad TOML, missing-profile binding)
- profile reserved name "default" rejected in create/export/import
- profile duplicate edge cases (nonexistent src, existing dest, reserved dest, valid copy)
- profile import error cases (missing file, duplicate name)
- profile delete nonexistent
- profile reset edge cases (no-op on unset field, nonexistent profile)
- profile env edge cases (unset missing key, list/clear when empty)
- game command error cases (show/unbind/forget/rename nonexistent, bind to missing profile)
- game list empty state
- game note multiword
- game list --full flag
- dry-run with nonexistent binary (exit 4)
- dry-run shows gamescope flags in plan
- launch with option-like target rejected (exit 2)
- launch with no command
- pre-hook fail mode does NOT trigger post-hook
- both hooks run in order on success
- post-hook runs when binary is missing (fixed bug)
- missing dependency errors for mangohud/gamemoderun/gamescope/mangoapp
- last command with no history
- last shows most recently launched game
- config settings / profile settings list all names
- completion edge cases (no args, bash/zsh/fish output)

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-14 10:14:52 -04:00
44r0n7 e7c3b2eee7 fix: post-hook now runs when game binary does not exist
validate_launch() rejects missing executables in build_plan(), causing an
early return via `?` before the post-hook block was ever reached. Fix by
separating the dry-run path (still fails fast with `?`) from the real-launch
path, where build_plan() result is captured without `?` and chained into
execute_wait() via and_then(). The post-hook fires for both plan-validation
failures and execute_wait() spawn failures.

Also skips the pre-launch hook when the plan is invalid (no binary to set up
for), and skips state recording in the same case.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-14 09:51:57 -04:00
44r0n7 f984acf0e3 feat: hook reliability, hook-errors setting, sparse config, and logging
Hook reliability:
- Add hook-errors = "warn" | "fail" setting (default: warn); in fail
  mode, abort launch when pre-launch hook exits nonzero or can't execute
- Ensure post-launch hook runs unconditionally, even when execute_wait()
  fails to spawn the game
- Propagate game's real exit status via std::process::exit(); report
  post-hook failures clearly to stderr
- Centralize hook execution via run_hook() helper (sh -c)

New features in this batch:
- Sparse config and profile support: only configured fields are written;
  unset fields fall back through profile → global chain
- config show --effective flag: renders the fully-resolved view
- Config migration: upgrades legacy flat config to current schema
- Structured decision logging (src/log.rs) for session-level audit trail
- Gamescope improvements: additional flags and validation
- CHANGELOG.md tracking template releases

Schema / UX:
- HookErrors enum (Warn/Fail) added to Settings and ResolvedSettings
- hook-errors key in keys.rs, mod.rs rendering, completion candidates,
  doctor output, help text, README, and dry-run display
- 9 focused tests covering warn/fail behavior, exit propagation,
  round-trip (set/show/reset), profile round-trip, export/import

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-14 09:35:24 -04:00
44r0n7 a2364b1692 docs: update roadmap with repo location and post-1.0 dependency notes
Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-31 22:14:18 -04:00
44r0n7 9e2431e58a Initial release: gamewrap v1.0.0
Steam-first Linux game launcher wrapper for MangoHud and GameMode.
Manages launch behavior via TOML config with named profiles, per-game
bindings, and full diagnostics. All v1 criteria validated.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-31 22:13:20 -04:00