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>
This commit is contained in:
+31
-17
@@ -37,17 +37,19 @@ Representative flow:
|
||||
| `src/config/mod.rs` | Config/state I/O | XDG path discovery, TOML load/save, CLI rendering of config/profile views. |
|
||||
| `src/config/schema.rs` | Persistent structs | `Settings`, `ResolvedSettings`, `ProfileConfig`, `ConfigFile`, `ObservedGame`, `StateFile`. |
|
||||
| `src/config/keys.rs` | Setting mutation helpers | Friendly key parsing and value application/reset logic. |
|
||||
| `src/profile.rs` | Resolution + validation | Resolves inherited profiles and validates parent chains/binding targets. |
|
||||
| `src/config/migrate.rs` | Config migration logic | Renames retired setting keys in raw config/profile TOML before typed deserialization. |
|
||||
| `src/profile.rs` | Resolution + validation | Applies global defaults plus one named profile and validates binding targets. |
|
||||
| `src/bindings.rs` | Binding operations | Matching logic, set/remove binding, resolve profile for executable/observed game. |
|
||||
| `src/detect.rs` | Executable detection | Pulls real game executable out of Steam/Proton wrapper shapes and records observed launches. |
|
||||
| `src/launch.rs` | Launch planning/execution | Dependency checks, dry-run rendering, final command execution. |
|
||||
| `src/env.rs` | Env shaping | Steam-context detection, host-library injection decisions, env var construction. |
|
||||
| `src/log.rs` | Decision log | Best-effort timestamped launch, hook, exit, and playtime logging. |
|
||||
| `src/doctor.rs` | Doctor rendering | Formats preflight results. |
|
||||
| `src/status.rs` | Status rendering | Formats dependency/config/state summary. |
|
||||
| `src/help.rs` | Long-form help text | Shared topic help and top-level examples. |
|
||||
| `src/error.rs` | Error model | Exit-code-bearing error categories and constructors. |
|
||||
| `src/notify.rs` | GUI failure notifier | `zenity` / `kdialog` / `xmessage` / `notify-send` selection and popup logic. |
|
||||
| `src/share.rs` | Share/import formats | Resolved full-config and single-profile portable TOML formats. |
|
||||
| `src/share.rs` | Share/import formats | Sparse full-config and single-profile portable TOML formats. |
|
||||
| `tests/cli_matrix.rs` | Integration CLI coverage | End-to-end command validation in isolated XDG temp envs. |
|
||||
|
||||
Skip `target/` and other generated artifacts when extending this map.
|
||||
@@ -89,12 +91,12 @@ Skip `target/` and other generated artifacts when extending this map.
|
||||
|
||||
## 🔑 Key Concepts & Domain Terms
|
||||
- **Defaults**: global baseline settings from config
|
||||
- **Profile**: reusable settings bundle; may inherit from another named profile
|
||||
- **Profile**: reusable game-specific settings bundle applied directly over global defaults
|
||||
- **Binding**: matcher string mapping a known executable/path to a profile
|
||||
- **Observed game**: recorded launch entry with executable, path, last launched profile, optional note/display name, launch count, and last launch timestamp
|
||||
- **Resolved settings**: effective values after applying defaults + inheritance + explicit overrides
|
||||
- **Resolved settings**: effective values after applying global defaults + explicit profile overrides
|
||||
- **Steam context**: environment where implicit launch mode and GUI failure notifications are enabled
|
||||
- **Share format**: portable resolved export file, distinct from the sparse internal config layout
|
||||
- **Share format**: portable sparse export matching the internal defaults/profile layout
|
||||
|
||||
---
|
||||
|
||||
@@ -103,18 +105,20 @@ Skip `target/` and other generated artifacts when extending this map.
|
||||
### Internal local files
|
||||
- Config path: `~/.config/gamewrap/config.toml`
|
||||
- State path: `~/.local/state/gamewrap/state.toml`
|
||||
- Default decision log path: `~/.local/state/gamewrap/gamewrap.log` when `log-file` is enabled
|
||||
- Config file is sparse/raw:
|
||||
- stores only explicit overrides
|
||||
- profiles may be empty and may inherit from parents
|
||||
- profiles may be empty and always apply directly over global defaults
|
||||
- bindings are stored separately
|
||||
- gamescope output width/height accept an integer or `native`; window mode is one of `windowed`, `borderless`, or `fullscreen`
|
||||
|
||||
### Portable share files
|
||||
- Full config export suffix: `.gamewrap.toml`
|
||||
- Profile export suffix: `.gamewrap-profile.toml`
|
||||
- Export commands write resolved values, not sparse internal overrides
|
||||
- Profile import creates a standalone explicit profile with no inheritance
|
||||
- Per-profile env overrides are stored as an optional `env-vars` map on profile settings and merge through inheritance; child keys override parent keys
|
||||
- Pre/post launch hook commands are stored as optional string settings; pre-launch runs before exec, while post-launch is persisted/displayed but deferred until wrapped launching exists
|
||||
- Export commands preserve sparse defaults and profile overrides
|
||||
- Profile import preserves explicitly configured settings; unset values use the receiving config's global defaults
|
||||
- Per-profile env overrides are stored as an optional `env-vars` map on profile settings and apply over global env defaults
|
||||
- Pre/post launch hook commands are stored as optional string settings; setting post-launch switches execution to spawn/wait so the hook can run after the game exits
|
||||
- Config import accepts:
|
||||
- current resolved share format
|
||||
- legacy raw config format as fallback
|
||||
@@ -137,29 +141,28 @@ Skip `target/` and other generated artifacts when extending this map.
|
||||
- `completion`
|
||||
|
||||
### `config`
|
||||
- `show`
|
||||
- `show [--effective]`
|
||||
- `edit`
|
||||
- `set <setting> <value>`
|
||||
- `reset <setting>`
|
||||
- `reset <setting>` / `reset --all`
|
||||
- `export [name-or-path]`
|
||||
- `import <name-or-path>`
|
||||
- `migrate`
|
||||
|
||||
### `profile`
|
||||
- `list`
|
||||
- `tree`
|
||||
- `create <name>`
|
||||
- `duplicate <src> <dst>`
|
||||
- `show <name>`
|
||||
- `export <name> [name-or-path]`
|
||||
- `import <name-or-path>`
|
||||
- `migrate <file> [--dry-run]`
|
||||
- `env set <name> <key> <value>`
|
||||
- `env unset <name> <key>`
|
||||
- `env list <name>`
|
||||
- `env clear <name>`
|
||||
- `set <name> <setting> <value>`
|
||||
- `reset <name> <setting>`
|
||||
- `inherit <name> <parent>`
|
||||
- `clear-inherit <name>`
|
||||
- `delete <name>`
|
||||
|
||||
### `game`
|
||||
@@ -190,14 +193,14 @@ If you change:
|
||||
- command surface -> update `tests/cli_matrix.rs`
|
||||
- share/import/export formats -> update `tests/cli_matrix.rs` and `src/share.rs` tests
|
||||
- completion install/candidates -> update `tests/cli_matrix.rs` and `src/completion.rs` tests
|
||||
- profile inheritance logic -> update `src/profile.rs` tests and related CLI matrix cases
|
||||
- profile resolution logic -> update `src/profile.rs` tests and related CLI matrix cases
|
||||
|
||||
---
|
||||
|
||||
## 🧩 Feature Areas & Ownership Map
|
||||
- **CLI / UX**: `src/cli.rs`, `src/help.rs`, `README.md`
|
||||
- **Persistence**: `src/config/*`, `src/share.rs`
|
||||
- **Profiles / inheritance**: `src/profile.rs`
|
||||
- **Profiles / resolution**: `src/profile.rs`
|
||||
- **Game observation / matching / bindings**: `src/detect.rs`, `src/bindings.rs`
|
||||
- **Launch execution**: `src/launch.rs`, `src/env.rs`
|
||||
- **Diagnostics**: `src/doctor.rs`, `src/status.rs`
|
||||
@@ -235,6 +238,17 @@ Do not update this file for:
|
||||
- [2026-05-31] Added TTY/NO_COLOR-aware ANSI output helpers for doctor and status rendering.
|
||||
- [2026-05-31] Added game forget, config edit, profile list/tree improvements, and notify test commands.
|
||||
- [2026-05-31] Added gamescope settings, launch wrapping, dependency diagnostics, completion candidates, and docs.
|
||||
- [2026-06-06] Removed retired setting aliases and added automatic and explicit TOML migration for configs and profile exports.
|
||||
- [2026-05-31] Added observed-game display names, launch timestamps/counts, `last`, `game rename`, and `fps-cap`.
|
||||
- [2026-05-31] Added per-profile env overrides, vkBasalt support, and Proton esync/fsync compatibility controls.
|
||||
- [2026-05-31] Added pre-launch shell hooks plus persisted/dry-run/doctor visibility for deferred post-launch hooks.
|
||||
- [2026-06-05] Expanded gamescope config surface: nested-width/height, unfocused-fps, scaler (-S), filter (-F), sharpness, fullscreen, borderless, adaptive-sync, hdr, steam, expose-wayland. Added gamescope-mangoapp for native MangoHud overlay integration (--mangoapp flag); doctor warns when mangohud prefix is used inside gamescope without mangoapp.
|
||||
- [2026-06-06] Added optional vkbasalt-config profile/default setting and gated VKBASALT_CONFIG_FILE launch environment support.
|
||||
- [2026-06-06] Replaced gamescope fullscreen/borderless toggles with `gamescope-mode` and added native display resolution detection for output width/height.
|
||||
- [2026-06-06] Clarified unset values in `config show` and added `config reset --all` for restoring built-in defaults.
|
||||
- [2026-06-06] Added gamewrap decision logging plus MangoHud session logging and vkBasalt log-level settings.
|
||||
- [2026-06-06] Made `config show` display only explicitly configured defaults, with `--effective` for the full computed view.
|
||||
- [2026-06-06] Added --effective flag to `profile show` and profile sections of `config show`; default now shows only explicitly configured profile settings.
|
||||
- [2026-06-06] Renamed the MangoHud/GameMode settings to `mangohud`/`gamemode` with legacy aliases, and grouped settings help with per-tool filters.
|
||||
- [2026-06-06] Removed profile inheritance, flattened resolution to defaults plus one profile, and made config/profile exports sparse.
|
||||
- [2026-06-14] Added hook-errors setting (warn/fail) to control pre-launch hook failure behavior; ensured post-hook runs after game spawn failures; propagated game exit codes; centralized hook execution via run_hook().
|
||||
|
||||
Reference in New Issue
Block a user