Skip to main content

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_url on first run and saves it like moodle-cli
  • Lists projects, merged task views, and teaching roles
  • Supports terminal output plus --json and --yaml

Requirements

  • Python 3.10+
  • uv or pipx
  • 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/method and 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_URL
  • ONTRACK_USERNAME
  • ONTRACK_AUTH_TOKEN
  • ONTRACK_DOUBTFIRE_USER_JSON

Authentication

Default behavior:

  1. Resolve base_url
  2. Try browser cookies
  3. Exchange OnTrack's browser refresh_token for an API auth token when supported
  4. 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:

  1. Open an authenticated OnTrack page
  2. Open DevTools Console
  3. Run:
copy(localStorage.getItem('doubtfire_user'))
  1. Export it:
export ONTRACK_DOUBTFIRE_USER_JSON='{"id":123,"username":"your_username","authenticationToken":"..."}'

Commands

  • ontrack user: show the resolved signed-in user
  • ontrack auth check: validate access and show a quick auth summary
  • ontrack projects: list the current user's projects
  • ontrack project <project_id>: show a project with merged task definition metadata
  • ontrack tasks <project_id>: list task rows for a project
  • ontrack 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ontrack_cli-0.1.2.tar.gz (51.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ontrack_cli-0.1.2-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file ontrack_cli-0.1.2.tar.gz.

File metadata

  • Download URL: ontrack_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 51.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ontrack_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 08b803874699ac89113e3998278a2f647e3655f246d9c5b5813aba4452825ab7
MD5 e1eaacb8b583fc7cee3ea57b683431ba
BLAKE2b-256 0589b8e1e851c8bdf5fc85270c3cc89f2323daf4668c841d7adb60d98ac86bc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ontrack_cli-0.1.2.tar.gz:

Publisher: publish.yml on bunizao/ontrack-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ontrack_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ontrack_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ontrack_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c33bf35a79b505b1b4aeb8242634ad3b5e8e33735cbf18cc86fc2353488cfdc4
MD5 ba05a17c8d3e9c624bf2406ddf3c920d
BLAKE2b-256 bf47c8f8ef75a9992ffb512b0a1bf835716300983e3cceb2b17ae4fa4d96b8af

See more details on using hashes here.

Provenance

The following attestation bundles were made for ontrack_cli-0.1.2-py3-none-any.whl:

Publisher: publish.yml on bunizao/ontrack-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page