Skip to content
parthchandak02Public

About

Command-line tracker for MDI MTP training milestones on writable.site, with an offline SQLite cache.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

mtp-cli

MTP milestone tracking, from the terminal.

Checking off a trainee's 21 MDI training goals means clicking through writable.site page by page. This syncs them once and answers from a local copy.

Python API Cache Status License

How it works · Install · Usage



Terminal running mtp-cli get for a demo trainee: name, team, division, mentor, status and note, then all 21 MTP goals with a check mark and completion date for the 10 that are done

Real output from the CLI against a local cache seeded with fictional trainees.


The problem

The MDI Membership Training Program (MTP) tracks each trainee through 21 goals, from "Join MDI" to "Completion Ceremony", and the records live as pages on writable.site. Seeing where one person stands, or how a whole cohort is doing, takes a lot of clicking. mtp-cli pulls every MTP page into SQLite in one sync, answers lookups offline, and can mark a goal done or not done straight from the command line.

How it works

1 · Connect

setup walks you through copying your writable.site token URL from the browser's WebSocket traffic and saves it to ~/.mtp-cli/.env. validate checks it.

2 · Sync

sync opens a streaming view over the Datapages WebSocket API, collects every page with isMTP set, and writes trainees and milestones to ~/.mtp-cli/mtp.db.

3 · Ask and update

list, search, get and stats read the local cache. complete and uncomplete send an update call for one milestone and read it back to confirm.

The whole cohort

Terminal output of mtp-cli list showing six demo trainees with team, division and status, followed by mtp-cli stats counting trainees, milestones and trainees per status
list and stats on the same fictional data.

Install

Not published to PyPI; install from source. Python 3.8+.

git clone https://github.com/parthchandak02/mtp-cli.git
cd mtp-cli
pip install .
mtp-cli setup        # opens writable.site and asks for your token URL

Usage

mtp-cli sync                                  # pull all trainees and milestones
mtp-cli list --status 2                       # everyone in progress (1-5)
mtp-cli search Rivera                         # by name, or by status number
mtp-cli get "Rivera, Sam"                     # one trainee, all 21 goals
mtp-cli complete "Rivera, Sam" 13           # mark goal 13 done today (--date to backdate)
mtp-cli uncomplete "Rivera, Sam" 13           # undo it

Reads come from the local cache, so run sync again to see changes made on the site. Names are matched as exact Last, First, or as a partial first or last name.

All commands
Command
setup First-time setup: find and save your writable.site token URL
validate Test the token and connection
sync Pull all trainees and milestones into the SQLite cache
list [--status N] Cached trainees, optionally filtered by status 1-5
search <query> Trainees by name, or by status number
get <name> Trainee detail with every milestone and its date
complete <name> <goal> [--date] Mark a milestone done (defaults to today)
uncomplete <name> <goal> Mark a milestone not done
stats Counts of trainees and milestones, and trainees per status
Configuration

~/.mtp-cli/.env (or environment variables; see .env.example):

Variable Default
WRITABLE_TOKEN_URL Required. Your token URL, of the form https://writable.site/u/<name>/tokens/<id>#secret=<secret>
WRITABLE_WS_URL wss://b2.writable.site/_API WebSocket endpoint
MTP_DB_PATH ~/.mtp-cli/mtp.db SQLite cache
MTP_CONFIG_DIR ~/.mtp-cli Where .env is read from

Finding the token by hand: log into writable.site, open DevTools, Network tab, filter ws, refresh, open the WebSocket connection's Messages tab and find the frame containing "useToken". The URL in that frame is the token.

Data model
  • Protocol: writable.site Datapages API v0.0 over WebSocket; auth with the useToken call.
  • Trainee pages: isMTP, lastName, firstName, team, division, mentor, status (1 not yet started, 2 in progress, 3 completed program, 4 paused, 5 left), note.
  • Milestone pages: isMTP, goal (1-21), person (page reference), howDone (1 not yet, 2 done as MTP, 3 learned elsewhere, 4 waived), completedDate.
  • Goal names: defined in GOAL_NAMES in mtp_cli/client.py.
  • Cache: SQLite in WAL mode, tables trainees and milestones, each row keeping the raw page JSON.

Built with Python, websockets and SQLite. Not affiliated with MDI or writable.site.

About

Command-line tracker for MDI MTP training milestones on writable.site, with an offline SQLite cache.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages