steam-backlog-enforcer/steam_backlog_enforcer/_command_help.py
Krzysztof kuhy Rudnicki 5d5aa3e773
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / web-coverage (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Add Librarian-only research window to total block
kuhy 2026-11-11: game-design research needs Librarian (app 4197610)
actually played during the 6-day total block. New root command
total-block-research --until T opens ONE window per lock: <= 48 h,
never past the lock end, a rerun never extends it.

The command only validates and records (/var/lib/steam-backlog-
enforcer, root 0700; lock id + deadline + two latches). The daemon
opens and closes everything: Steam hosts names, the store block, the
total-block chain (IP cache kept) and the steam package, reinstalled
with only guard-lib's package-block hook masked for that one pacman
call (--hookdir, proved in a guest). Lock file, hook and end date are
never touched. Browser-game sites stay null-routed.

Only Librarian may run: loop-local allowed set, strict mode (no
whitelist exceptions, no zero-achievement games), launchers and
counted games killed; state.json is never read or written.

Expiry latches the record, then the ordinary tick re-applies hosts
(now reconciled each tick), chain, uninstall and purge; the normal
store block is restored once, unconditionally.

Failure modes: missing/corrupt/unparseable record = no window and a
corrupt one also refuses a new window (fail closed); a clock set
back cannot reopen a latched window.

Checked: 3290 tests at 100% coverage; whole-tree pylint 10/10 run in
three parts (the hook exceeds the 60 s cap, so SKIP=pylint here); vmbox
guest with real guardctl package-block and the real unit, window
opened, Librarian-only enforced, clock moved past the deadline and the
full block re-applied. Not verified on the host.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWzuCEg1m87jpKyRrw
2026-11-11 14:29:58 +01:00

53 lines
2.5 KiB
Python

"""One-line descriptions of every CLI command, in help order.
The CLI's usage text and the web command catalog (``GET /api/commands``)
both read these. They live outside ``main`` so the catalog, which the web
server loads from inside ``main`` (``main`` → ``misc`` → ``_web_server``),
can import them at the top without a cycle.
"""
from __future__ import annotations
from typing import Final
from steam_backlog_enforcer._allowed_games import MANUAL_LOCK_DAYS
# Commands dispatched through ``main.COMMANDS`` (handler takes config, state).
COMMAND_DESCRIPTIONS: Final[dict[str, str]] = {
"scan": "Scan library & assign a game",
"check": "Check assigned game for a new achievement",
"status": "Show current status",
"list": "List games from snapshot",
"install": "Install an allowed game (fast installer first)",
"hide": "Hide all non-assigned games in library",
"unhide": "Unhide all games in library",
"buy-dlc": "Unblock the store for 15 min to buy a game/DLC",
"reset": "Reset all state",
"installed": "List installed games",
"uninstall": "Uninstall all non-assigned games",
"setup": "Run first-time setup",
"done": "Move on after a new achievement, pick next",
"pick": "Pick another game from candidates (keeps current; --replace swaps)",
"stats": "Show backlog completion-time estimates",
"gaming-status": "Show today's gaming time and block state",
"gaming-reset": "Reset today's gaming counter (root + phrase)",
}
# Commands with non-standard arg handling (shown in help but not in COMMANDS).
EXTRA_COMMAND_DESCRIPTIONS: Final[dict[str, str]] = {
"add-exception": "Whitelist a game immediately (phrase + --reason)",
"unblock": "Unblock the store for [minutes] (default 15, max 30)",
"serve": "Start the web UI (--port N; replaces a stale server)",
"pick-manual": f"Pick a game by app_id, lock enforcer for {MANUAL_LOCK_DAYS} days",
"abandon-pick": "Undo a manual pick at any time (needs app_id)",
"block-gaming": "Block ALL gaming for <days> days, no in-app undo",
"enforce": "Run enforcer: block, uninstall, kill, hide (--demo for a 60s budget)",
"gaming-unblock": "Force-release playtime bind mounts (root; recovery hatch)",
"total-block-refresh": "Apply the current domain list to a live total block (root)",
"total-block-research": "One Librarian-only Steam window per total block (root)",
}
ALL_COMMAND_DESCRIPTIONS: Final[dict[str, str]] = (
COMMAND_DESCRIPTIONS | EXTRA_COMMAND_DESCRIPTIONS
)