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.
- 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
- Python 3.10+
uvorpipx- An authenticated OnTrack browser session, or explicit credentials
# Recommended: uv tool
uv tool install ontrack-cli
# Alternative: pipx
pipx install ontrack-cliInstall from source:
git clone https://github.com/bunizao/ontrack-cli.git
cd ontrack-cli
uv syncontrack --help
ontrack user
ontrack auth check
ontrack projects
ontrack project 12345
ontrack tasks 12345
ontrack rolesStructured output:
ontrack projects --json
ontrack project 12345 --yamlTo upgrade after a new release:
uv tool upgrade ontrack-cli
# or
pipx upgrade ontrack-cliOn 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.eduRequired 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
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":"..."}'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
uv run pytest -q
uv run python -m compileall ontrack_cli
uv build- 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