Terminal-first CLI for the OnTrack/Doubtfire teaching platform
Project description
ontrack-cli
Terminal-first CLI for OnTrack that reuses your authenticated browser session.
ontrack-cli targets Doubtfire / OnTrack deployments and is designed for quick terminal access to your projects, tasks, and teaching roles without building a separate login flow.
Features
- No manual API token setup in the common case
- Reads browser auth state from Chrome, Firefox, Brave, or Edge when available
- Prompts for
base_urlon first run and saves it likemoodle-cli - Lists projects, merged task views, and teaching roles
- Supports terminal output plus
--jsonand--yaml
Requirements
- Python 3.10+
uvorpipx- An authenticated OnTrack browser session, or explicit credentials
Install
# Recommended: uv tool
uv tool install ontrack-cli
# Alternative: pipx
pipx install ontrack-cli
Install from source:
git clone https://github.com/bunizao/ontrack-cli.git
cd ontrack-cli
uv sync
Usage
ontrack --help
ontrack user
ontrack auth check
ontrack projects
ontrack project 12345
ontrack tasks 12345
ontrack roles
Structured output:
ontrack projects --json
ontrack project 12345 --yaml
To upgrade after a new release:
uv tool upgrade ontrack-cli
# or
pipx upgrade ontrack-cli
Configuration
On first run, if no base_url is configured, the CLI prompts for it and writes it to config.yaml in the project directory or in ~/.config/ontrack-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
/home,/#/projects, or/api/auth - The CLI validates the URL against
/api/auth/methodand asks again if it does not look like an OnTrack site
You can also set ONTRACK_BASE_URL instead of using the interactive prompt.
You can copy from config.example.yaml.
Environment overrides:
ONTRACK_BASE_URLONTRACK_USERNAMEONTRACK_AUTH_TOKENONTRACK_DOUBTFIRE_USER_JSON
Authentication
Default behavior:
- Resolve
base_url - Try browser cookies
- Exchange OnTrack's browser
refresh_tokenfor an API auth token when supported - Fall back to explicit environment variables or config values
If browser auto-auth does not work, you can still provide credentials manually:
export ONTRACK_BASE_URL='https://school.example.edu'
export ONTRACK_USERNAME='your_username'
export ONTRACK_AUTH_TOKEN='your_auth_token'
You can also reuse the front-end cached user object:
- Open an authenticated OnTrack page
- Open DevTools Console
- Run:
copy(localStorage.getItem('doubtfire_user'))
- Export it:
export ONTRACK_DOUBTFIRE_USER_JSON='{"id":123,"username":"your_username","authenticationToken":"..."}'
Commands
ontrack user: show the resolved signed-in userontrack auth check: validate access and show a quick auth summaryontrack projects: list the current user's projectsontrack project <project_id>: show a project with merged task definition metadataontrack tasks <project_id>: list task rows for a projectontrack roles: list teaching roles for the current user
Development
uv run pytest -q
uv run python -m compileall ontrack_cli
uv build
Notes
- The CLI is built around Doubtfire / OnTrack API behavior
- Browser-based auto-auth works best when you are already signed in to the target site
- Some deployments expose
POST /api/auth/access-token, which allows clean browser-session reuse
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 ontrack_cli-0.1.0.tar.gz.
File metadata
- Download URL: ontrack_cli-0.1.0.tar.gz
- Upload date:
- Size: 50.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
613cb0bd2ce7bcb098086bf78b15ef52fa5ed2f7f86cdd2941c60db66d9339d9
|
|
| MD5 |
82dd78a0209f6c51cc673fc0ee604f7c
|
|
| BLAKE2b-256 |
84a4a3f6cb29a4a5e07edb4249d4fbf1f1a54a94e8715585286ae755a1dfa3d8
|
Provenance
The following attestation bundles were made for ontrack_cli-0.1.0.tar.gz:
Publisher:
publish.yml on bunizao/ontrack-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ontrack_cli-0.1.0.tar.gz -
Subject digest:
613cb0bd2ce7bcb098086bf78b15ef52fa5ed2f7f86cdd2941c60db66d9339d9 - Sigstore transparency entry: 1081399816
- Sigstore integration time:
-
Permalink:
bunizao/ontrack-cli@d76074e606b43b252971a4102c80a8b9ee4b7a3c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bunizao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d76074e606b43b252971a4102c80a8b9ee4b7a3c -
Trigger Event:
push
-
Statement type:
File details
Details for the file ontrack_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ontrack_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b5fe4543cb01c994ae577bcd2414795f748844df74be24c3721fb6dcd638d4e
|
|
| MD5 |
c83cfa79ff69c850ef154b5d46b59bdd
|
|
| BLAKE2b-256 |
70853f300071d5d275c8259b6c69222929dab26d241e70c703d257f81ddcb7c8
|
Provenance
The following attestation bundles were made for ontrack_cli-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on bunizao/ontrack-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ontrack_cli-0.1.0-py3-none-any.whl -
Subject digest:
4b5fe4543cb01c994ae577bcd2414795f748844df74be24c3721fb6dcd638d4e - Sigstore transparency entry: 1081399915
- Sigstore integration time:
-
Permalink:
bunizao/ontrack-cli@d76074e606b43b252971a4102c80a8b9ee4b7a3c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bunizao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d76074e606b43b252971a4102c80a8b9ee4b7a3c -
Trigger Event:
push
-
Statement type: