Commit Graph

23 Commits

Author SHA1 Message Date
96c5a1edef Freshness gate: use utils origin/main snapshot
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:58:01 +01:00
4bab8f156d Freshness gate: fail closed on an old utils
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:37:56 +01:00
b0a2113e10 Drop unused test imports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:10:42 +01:00
c4ca111cd4 Send a User-Agent; libibus without partial upgrade
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:02:55 +01:00
c1b6fdd16f Map safe games to a FOSS Proton
Install the pinned proton-cachyos-native build (signature and
sha256 checked, .INSTALL never run), decide per game whether it
is safe, write the CompatToolMapping as text, add --map-installed
and --valve-proton, and drop steamcmd from install.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:57:48 +01:00
e2fc518624 Read app info from Steam's cache, drop steamcmd
Write the 15-key manifest from scratch when none exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:42:45 +01:00
ed03bf76e7 Put my logo everywhere
Todo: 7808ee0a
2026-11-21 08:55:44 +01:00
6b67fcc4f1 Add scripts/deploy.sh and declare it in CLAUDE.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:47:35 +01:00
16cb05f3a6 get rid of github ci/cd version check of package…
Todo: 2556952d
2026-11-19 17:37:12 +01:00
817447a09c Add todo app git hooks
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-02 13:55:44 +01:00
4d9e845f32 Finish a completed download: skip placeholder depots, prove the build from gids
A 160 GB Baldur's Gate 3 download (2026-10-23) was refused at the finish:
- it demanded depots 1419654/5/6, which app info lists with no public
  manifest -- nothing depotdownloader can fetch. The depot plan now skips
  depots without a manifest on the public branch.
- the enforcer's stub manifest said build 0. Every required depot (own-app
  DLC included) whose cached manifest matches the public branch's gid now
  proves the current build, which is what the finished manifest records; a
  stale gid is refused.

The installdir is also corrected as soon as Steam is closed, so a stub named
after the display name never sends Steam's resumed download elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GYmCezqhUjUmMisF5YtM4F
2026-10-24 08:36:40 +02:00
13510d3a0d repo contract: CLAUDE.md commands, test_changed, CI gate, .gitignore update
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-04 16:45:43 +02:00
8f641e235d Fetch owned DLC with depotdownloader too; split recognize.py; enforce the 250-line cap
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-25 18:41:55 +02:00
15f647f639 Install any game from an appid, a URL or a name; adopt Steam's partial downloads
`./run.sh <anything>` is now the entry point. It installs its own dependencies
(steamcmd via yay, DepotDownloader from the SteamRE release, a local .venv) and
works out what the argument is: an appid, a Steam URL, an exact title, or part
of a title. Every route is confirmed through steamcmd's own app_info before
anything acts on it.

Name search moves to steamcommunity.com/actions/SearchApps, which works, with
the storefront API kept as a fallback -- it TLS-rejects scripted clients here,
so search had been effectively dead. DNS on this box fails transiently about one
lookup in three, so each backend is retried before giving up. An exact title now
wins over Steam's own ranking, which puts "Portal 2" above "Portal"; an
ambiguous name shows a picker, or exits 2 rather than guessing.

Two problems found while building this, both now handled:

Anonymous steamcmd has no licence for a paid app and does not say so. It
transfers nothing, prints "Success! App '284160' fully installed.", exits 0, and
writes StateFlags=4 with SizeOnDisk=0 and no depots. A running Steam client then
reads that, decides the app is installed but stale, and downloads the whole game
by itself. `ghost.py` detects that state -- validated read-only against all ten
manifests in a real library, where the nine genuine installs are untouched and
only the fabricated one matches -- and `--repair-ghosts` clears it away. Repair
uses rmdir, never rmtree, so a non-empty directory survives a wrong diagnosis.

And Steam's own in-progress downloads are no longer wasted. `takeover.py`
hardlinks `steamapps/downloading/<appid>/` into the install directory before
depotdownloader runs; depotdownloader hash-checks what is already on disk
(ContentDownloader.cs skips a file when neededChunks is empty) and fetches only
the remainder. Nothing is deleted up front -- the staging tree is cleared only
after the install is verified -- so a failed run still leaves Steam able to
resume. The trees share inodes, so an in-place chunk patch corrects both.

cli.py drops from 311 to 244 lines, back under the repo's 250-line cap, by
moving the install flow to flow.py and the manifest finish to finalize.py.

install.sh had a latent bug: `pip install -e .[dev]` only warns about a missing
extra and exits 0, so the `|| fallback` that installed pytest and coverage never
ran. A fresh venv had no test tools at all; the existing one only worked because
they had been installed by hand earlier. Now named outright and asserted.

246 tests, 100% statement and branch coverage. Verified live: all four input
forms resolve to 284160, an exact "Portal" resolves to 400 and not 620, an
ambiguous name exits 2, ghost detection flags nothing on nine real installs, and
a from-scratch venv bootstraps and runs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sgkb3wH6MU9fYquX328ovT
2026-09-11 21:38:16 +02:00
4c35dc9b63 Re-point paths for the ~ reorganisation (home-tidy)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AwtowrowDXx6ccmWVPkCaF
2026-09-11 18:46:33 +02:00
0f2609fc52 One Python, always the newest; cover the credited-steamcmd branch
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 19:38:25 +02:00
a93043c694 Add the dependency-freshness gate
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 16:34:14 +02:00
a4813b09bc Add the removal marker to every TODO file
The rename commit staged the git mv but not the accompanying content
edit, so these TODO files landed without the "REMOVE ME AFTER FINISH"
line the md-naming gate requires. Repos whose hook was already live
refused that commit; repos without it accepted a file the gate would
now reject.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A47aX5DJwmA3QFn3pkEWi7
2026-08-24 15:56:24 +02:00
0815708e02 Adopt the four markdown namespaces and gate them
Renames this repo's markdown onto README.md / CLAUDE*.md / DOCS*.md /
TODO*.md so a future session can tell a live task from a finished
record without reading the file to find out.

TODO files carry the literal "REMOVE ME AFTER FINISH" and are deleted
when the work lands. Enforced by the md-naming pre-commit hook and CI
workflow, both delegating to the shared gate in kuhyx/utils so this
repo's idea of a valid name cannot drift from every other repo's.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A47aX5DJwmA3QFn3pkEWi7
2026-08-24 15:53:43 +02:00
1b11de131b Add refactor_claude_todo.md: 250-line file-length cap
A ready-to-use prompt describing the goal (every file at most 250 lines,
code and prose alike), this repo's actual violations ranked by Fowler ROI
(lines x commits/yr), how to split each kind, and the requirement to wire in
the shared pre-commit gate so files stay small permanently.

Generated from a measured survey of every repo; the gate itself lives in
~/utils (file_length/ + scripts/check_file_length.sh).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C7yZz45ezmzCB89Cv5gAtZ
2026-08-14 14:25:41 +02:00
aaf9c18a8a fix(recognize): stop Steam re-downloading after a hand-finished install
The KCD2 run reported success but Steam re-downloaded 90 GB anyway. Two
independent causes, plus a defect that hid both.

force_install_dir sets a Steam *library root*, not an install directory.
Pointing it at the game folder made steamcmd search <game>/steamapps/ for
manifests ("Loaded 0 apps from install folder"), create that stray dir, and
fail the app with "Invalid platform" for lack of depot context. Dropped it;
the app already lives in a registered library. Separately, a Linux steamcmd
needs +@sSteamCmdForcePlatformType windows for a Windows-only title.

Steam then discarded the manifest because it was self-contradictory:
StateFlags=4 while BytesDownloaded (22 GB) != BytesToDownload (92 GB), with
tens of GB still staged under steamapps/downloading/. Across every genuinely
installed manifest the byte counters are equal in pairs, StagingSize is 0 and
staging is empty; DownloadType is kept, not dropped. Settle all of it, and
refuse to call an install real until it holds.

The defect that hid this: steamcmd exited 8 having done nothing and the tool
still wrote StateFlags=4, printed a success line and returned 0. Now gated on
depotdownloader succeeding, every required depot being cached, real game
content on disk, a matching buildid and no running Steam client -- and it
re-reads the manifest after writing.

Also fixes data corruption found in review: vdf.dumps never re-escaped
backslashes, so each parse/dump cycle halved them and silently mangled the
Windows paths in appmanifest_228980.acf's InstallScripts. Manifest writes are
now atomic with a preserved pristine .acf.bak.

Adds per-run logging to ~/.local/state/steam-game-installer (argv, exit codes,
full subprocess output, manifest before/after), teed through a pty so
steamcmd's password prompt still works.

Verified end-to-end on KCD2: Steam logged "Fully Installed, App Running" and
the game launched with no download queued. Coverage 100% statements+branches,
enforced by fail_under.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EK4urCmbTqN4Vrc3nGBcXF
2026-08-05 10:11:34 +02:00
f9e91bba17 fix(recognize): verify manifest state instead of trusting steamcmd's exit code
Confirmed live against a real install: steamcmd's app_update can exit 0
without actually finishing -- it left installdir pointing at a stale,
unrelated folder name (from an earlier corrupted manifest state) and
InstalledDepots empty despite a "clean" exit. Relaunching the Steam
client then read that same stale field and wiped the correctly-downloaded
folder as orphaned while starting a fresh download into the wrong one --
real data loss, not a hypothetical.

- manifest_reflects_real_install() checks StateFlags/installdir/
  InstalledDepots directly instead of trusting the return code.
- ensure_installdir_correct() patches a stale installdir BEFORE running
  steamcmd, not just in the crash-fallback path after.
- run_steamcmd_validate() no longer captures stdout/stderr: steamcmd
  prompts for a password (and Steam Guard) on stdin, and prompt text
  written to a captured/buffered stdout never reached the terminal --
  the process looked hung with no visible request for input. Output
  now inherits the parent terminal, matching depotdownloader's own
  interactive login. The confirmed install-script segfault is detected
  via the SIGSEGV exit signal instead of grepping captured text.
- finish_manifest_manually() now also corrects installdir (previously
  only fixed by ensure_installdir_correct, not the crash-fallback path)
  and no longer lets a "0" buildid sentinel short-circuit past a real
  TargetBuildID via a bare `or` chain.
- cli.py gains --skip-steamcmd: go straight from depotdownloader's
  download to a direct manifest write, bypassing steamcmd's app_update
  entirely. It has now shown two separate failure modes (the segfault,
  and a silent no-op run) -- this is the same direct-write approach
  already confirmed to work standalone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-25 15:51:20 +02:00
72390acc2c Initial implementation: fast Steam installs via depotdownloader + steamcmd
Wraps depotdownloader for the bulk content pull (bypasses Steam's own
capped download speed) and steamcmd's app_update --validate to make Steam
recognize the result, with a manual-manifest fallback for the confirmed
steamcmd install-script segfault bug when no fix is available. Name search
via store.steampowered.com is best-effort since that endpoint TLS-rejects
scripted clients on this network; --appid plus steamcmd's own app_info_print
is the reliable primary path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 12:50:26 +02:00