cslcmgr
CodeSpace LifeCycle Manager: a tool that can be used to start and stop GitHub Codespaces using a GitHub PAT (Personal Access Token).
This can be used in two ways:
app.py: Web API server (with optional Web UI frontend), meant to be run locally on your PC, or behind a reverse proxy with authenticationmain.py: CLI application
Usage
Important: this has been tested with Python 3.13.5 on Debian 13 (trixie).
First of all you need to generate one or more GitHub PATs (Personal Access Tokens) to be able to control your Codespaces using the GitHub API. The tokens must have the following permissions:
- "Codespaces" repository permissions (read)
- "Codespaces lifecycle admin" repository permissions (write)
Note: for more information on why these permissions are needed, see https://docs.github.com/en/rest/codespaces/codespaces?apiVersion=2026-03-10
Set up a Python venv (virtual environment) and install some packages inside it:
Then set the necessary configuration environment variables. Example:
| Bash | |
|---|---|
Note: for more details about the supported environment variables, see code in the
lib/config.pyfile.
Then you can run the web app either in a development or production configuration.
Development:
| Bash | |
|---|---|
Production:
| Bash | |
|---|---|
Note: for more information about running a Flask application with Gunicorn, see https://flask.palletsprojects.com/en/stable/deploying/gunicorn/
If you want to use the CLI app instead, please refer to its help message:
| Bash | |
|---|---|