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
Metadata
Release files for ontrack-cli 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ontrack_cli-0.1.2.tar.gz | 51.0 kB | With provenance | Details for ontrack_cli-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ontrack_cli-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for ontrack_cli-0.1.2-py3-none-any.whl |
Total release size: 70.2 kB
Release files / ontrack_cli-0.1.2.tar.gz
| Download URL | ontrack_cli-0.1.2.tar.gz |
|---|---|
| Size | 51.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08b803874699ac89113e3998278a2f647e3655f246d9c5b5813aba4452825ab7
|
|
BLAKE2b-256 checksum How to use checksums |
0589b8e1e851c8bdf5fc85270c3cc89f2323daf4668c841d7adb60d98ac86bc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / ontrack_cli-0.1.2-py3-none-any.whl
| Download URL | ontrack_cli-0.1.2-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c33bf35a79b505b1b4aeb8242634ad3b5e8e33735cbf18cc86fc2353488cfdc4
|
|
BLAKE2b-256 checksum How to use checksums |
bf47c8f8ef75a9992ffb512b0a1bf835716300983e3cceb2b17ae4fa4d96b8af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logSecurity for ontrack-cli 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ontrack_cli-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.