Terminal-first CLI for Moodle LMS
Project description
moodle-cli
Terminal-first CLI for Moodle LMS that reuses an authenticated browser session.
Features
- No API token setup required
- Reuses
MoodleSessionfromokta-auth, your browser, orMOODLE_SESSION - Works with Moodle AJAX APIs and falls back to authenticated page scraping when needed
- Upcoming timeline items for student-facing deadlines and actions
- Terminal output plus
--jsonand--yaml
Requirements
- Python 3.10+
uv- One of:
okta-auth-cliconfigured for your Moodle site- An active Moodle browser session
- A
MOODLE_SESSIONenvironment variable
Install
# Recommended: uv tool
uv tool install moodle-cli
# Optional: automatic Okta login and session reuse
uv tool install okta-auth-cli
okta config
# Alternative: pipx
pipx install moodle-cli
Agent Skill
Install the agent skill with the shared skills CLI spec:
npx skills add https://github.com/bunizao/moodle-cli
If you already installed moodle, the CLI exposes the same thing as a thin alias:
moodle skills add
If npx is not available, the alias falls back to npm exec.
Install from source:
git clone https://github.com/bunizao/moodle-cli.git
cd moodle-cli
uv sync
Usage
moodle --help
moodle user
moodle alerts
moodle todo
moodle overview
moodle courses
moodle grades 34637
moodle activities 34637
moodle https://school.example.edu/course/view.php?id=34637
moodle https://school.example.edu/mod/forum/discuss.php?d=9001#p9101 --json
moodle skills
moodle skills add
moodle update
moodle update --check-only
You can also paste supported Moodle page URLs directly as the first argument. The CLI routes forum discussion, forum view, assignment, quiz, resource, link, page, folder, course, and grade report URLs to the shortest matching command.
To check without applying an upgrade:
moodle update --check-only
moodle update now tries to upgrade directly with uv tool upgrade moodle-cli and falls back to pipx upgrade moodle-cli when needed.
To upgrade manually after an update is available:
uv tool upgrade moodle-cli
# or
pipx upgrade moodle-cli
Configuration
On first run, if no base_url is configured, the CLI will prompt you and write it to config.yaml in the project directory or in ~/.config/moodle-cli/:
base_url: https://school.example.edu
Required format:
- Use a full root URL such as
https://school.example.edu - Do not include paths, query strings, or fragments
- Do not use URLs like
/login/index.phpor/my/ - The CLI validates the URL against Moodle's token endpoint and asks again if it does not look valid
You can also set MOODLE_BASE_URL instead of using the interactive prompt.
You can copy from config.example.yaml.
Environment overrides:
MOODLE_BASE_URLMOODLE_SESSION
Development
uv run python -m compileall moodle_cli
uv build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moodle_cli-0.4.0.tar.gz.
File metadata
- Download URL: moodle_cli-0.4.0.tar.gz
- Upload date:
- Size: 101.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73412b616d4c3e52af20d60af458edb7f61f886c8b147df03ed4f91735f31a9b
|
|
| MD5 |
0b31227e65dc1d208314364da7e7f8d5
|
|
| BLAKE2b-256 |
873765b3ad1dd9361f0c4c7b49b8b82a844ba63d23755ec0bbeba27458787668
|
Provenance
The following attestation bundles were made for moodle_cli-0.4.0.tar.gz:
Publisher:
publish.yml on bunizao/moodle-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moodle_cli-0.4.0.tar.gz -
Subject digest:
73412b616d4c3e52af20d60af458edb7f61f886c8b147df03ed4f91735f31a9b - Sigstore transparency entry: 1338838304
- Sigstore integration time:
-
Permalink:
bunizao/moodle-cli@380a9cbe4afc47b5491b8939fa9399be1cad0c7f -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/bunizao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@380a9cbe4afc47b5491b8939fa9399be1cad0c7f -
Trigger Event:
push
-
Statement type:
File details
Details for the file moodle_cli-0.4.0-py3-none-any.whl.
File metadata
- Download URL: moodle_cli-0.4.0-py3-none-any.whl
- Upload date:
- Size: 45.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1aff3f23aa3ed1cbc96bbe59e0d74e8b76f9b05a64639e49c644c06d185acde
|
|
| MD5 |
4fc97f092b4f95e72869bdfc52d371ee
|
|
| BLAKE2b-256 |
dbf9044bad014cff3cd3562c450f72980054a76f5465c0cb3fc923993397128d
|
Provenance
The following attestation bundles were made for moodle_cli-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on bunizao/moodle-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moodle_cli-0.4.0-py3-none-any.whl -
Subject digest:
e1aff3f23aa3ed1cbc96bbe59e0d74e8b76f9b05a64639e49c644c06d185acde - Sigstore transparency entry: 1338838309
- Sigstore integration time:
-
Permalink:
bunizao/moodle-cli@380a9cbe4afc47b5491b8939fa9399be1cad0c7f -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/bunizao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@380a9cbe4afc47b5491b8939fa9399be1cad0c7f -
Trigger Event:
push
-
Statement type: