Commit Graph

5 Commits

Author SHA1 Message Date
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