Repository navigation
Developers
This document is the technical reference for contributors, maintainers, and automation working inside the repository.
AlphaGSM is a Python CLI that normalises game-server lifecycle management across multiple backends. The core design is:
- one shared command surface
- one persistent per-server datastore
- per-game module implementations for lifecycle details
- GNU screen as the long-running process container
- dedicated test layers for unit, integration, and streamed smoke coverage
At runtime, the user-facing call path is:
./alphagsm ...- src/core/main.py
- server-name parsing, wildcard expansion, and command parsing
-
src/server/server.py
Server(...) - merge of default commands with module-defined commands
- dispatch into default server behaviour or module-specific functions
- process startup through src/screen/screen.py
- alphagsm User-facing CLI entry point.
- alphagsm-internal Internal helper used for multi-server and delegated execution paths.
- alphagsm-downloads Download-user helper for shared artifact retrieval.
- core CLI dispatch, command routing, subprocess orchestration, multiplexer logic.
-
server
Serverabstraction, datastore integration, default command set, module loading. - gamemodules Game-specific implementations.
- downloader Shared artifact cache and download ownership flow.
- downloadermodules Backend-specific download implementations.
- screen GNU screen orchestration and log helpers.
- utils Settings, backup scheduling, SteamCMD helpers, command parsing, filesystem update helpers.
- tests Unit tests.
- integration_tests Pytest-driven end-to-end tests.
- smoke_tests Shell-driven streamed lifecycle runners used by CI and documentation.
- docs User-facing documentation.
The shared command contract is defined in src/server/server.py.
Default commands:
setupstartstopactivatedeactivatestatusmessageconnectdumpsetbackup
Game modules extend this model by exporting module-level data:
commandscommand_argscommand_descriptionscommand_functions
The server object merges these module-level definitions with the defaults at runtime.
A game module typically implements some or all of:
configure(server, ask, ...)install(server, ...)get_start_command(server)do_stop(server, ...)status(server, verbose)message(...)update(...)restart(...)prestart(...)backup(...)
Operational expectations:
-
configure(...)stores resolved user choices inserver.data -
install(...)ensures the server filesystem is in a runnable state -
get_start_command(...)returns the command tuple the defaultstartpath consumes -
prestart(...)is optional and performs just-in-time environment setup
Representative implementations:
- src/gamemodules/minecraft/vanilla.py
- src/gamemodules/teamfortress2.py
- src/gamemodules/counterstrikeglobaloffensive.py
Per-server state is persisted as JSON under the configured server datapath.
Primary files:
Typical persisted keys include:
moduledirportexe_nameurlversionjavapathbackup- Steam app metadata for Steam-backed servers
The download subsystem is split between:
- src/downloader/downloader.py cache lookup, lock handling, and shared-download ownership
- src/downloadermodules/url.py HTTP download and decompression
- src/utils/steamcmd.py SteamCMD bootstrap and Steam app installation
Known exception:
- src/downloadermodules/steamcmd.py is currently legacy parser-broken code and remains outside the maintained lint/doc verification surface
AlphaGSM uses GNU screen as the process supervisor for long-running game servers.
Core helpers:
Lifecycle model:
- build command line
- write
screenrcif needed - start detached session
- inject console commands with
screen ... stuff - inspect screen logs for troubleshooting or readiness
The smoke runners are the best repository examples of the real lifecycle a user should follow:
They are important because they:
- create isolated temporary configs
- show the exact command sequence a real operator would use
- stream command output directly into CI logs
- verify readiness and shutdown using server-aware checks
For documentation changes, prefer the smoke tests over hand-written examples.
Location:
Command:
pytest testsCoverage command:
pytest tests \
--cov=core \
--cov=downloader \
--cov=downloadermodules \
--cov=gamemodules \
--cov=screen \
--cov=server \
--cov=utils \
--cov-report=term-missing \
--cov-report=xmlLocation:
Command:
ALPHAGSM_RUN_INTEGRATION=1 pytest integration_testsLocation:
Command:
bash ./smoke_tests/run_minecraft_vanilla.sh
bash ./smoke_tests/run_tf2.shLint is driven by lint.sh.
Properties of the current lint pipeline:
- enumerates maintained Python files under the primary source trees
- excludes the parser-broken legacy
src/downloadermodules/steamcmd.py - runs pylint through the selected interpreter
- enforces
--fail-under=10
Command:
bash ./lint.shThe GitHub Actions workflow is .github/workflows/unittest.yaml.
Current job layout:
buildlintunit-test- matrix
smoke-test - matrix
integration-test
Triggers:
- push to
master - pull request targeting
master
Current matrix targets:
- Minecraft vanilla
- TF2
There is also a documentation publishing workflow:
That workflow mirrors selected repository docs into the GitHub wiki by pushing to the wiki repository.
Main template:
Important environment variables:
ALPHAGSM_CONFIG_LOCATIONALPHAGSM_USERCONFIG_LOCATIONALPHAGSM_RUN_INTEGRATIONALPHAGSM_DEBUG
The smoke tests rely on temporary config files and ALPHAGSM_CONFIG_LOCATION to isolate state per run.
Documentation is now deliberately split by audience:
- README.md non-technical, copy-paste-first usage
- docs user-facing server guides
- DEVELOPERS.md technical architecture and maintenance notes
When behaviour changes:
- update smoke tests if the real workflow changed
- update server guides if user steps changed
- update
README.mdif first-run commands changed - update
DEVELOPERS.mdif architecture, CI, or maintenance expectations changed
The repository is the source of truth. The wiki is a published mirror generated from tracked docs by scripts/publish_wiki.sh.
Repo-local automation guidance now lives in: