Repository navigation
Add reg-canvas: Canvas API support for grades, roster and content - #41
Merged
Merged
Conversation
CSULB ATS issued a personal Canvas token on 2026-10-21. Until now every Canvas step was a manual export, upload or paste. canvas_api is the only module that reads the token. It reads it from a mode-600 file, sends it only to the configured host, refuses redirects and scrubs it from errors. It uses only the standard library. reg-canvas adds read commands (whoami, courses --bind, grades-export, roster-check) and write commands (grades-push, announce, discussion, assignment, syllabus). Every write is a dry run until --apply. grades-export keeps only score fields from the submissions endpoint and writes exports mode 600. The README, SKILL.md, AGENTS.md and docs describe the API path. The dry-run rule is repeated in each of them on purpose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N64GRxn3cQDJKAJLdfrso2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
reg-canvas, so lectern can use the Canvas API instead of manual exports, uploads and pastes. CSULB ATS issued a personal token on 2026-10-21.Read commands
whoamichecks the token.courses --bindwrites each section'scanvas.course-idinto its class note. When a class number recurs across years, the Canvas term name decides.grades-exportwrites the gradebook in Canvas's own export layout, soreg-lms-grades-importandreg-gradebook export-canvas --templatetake it unchanged. The per-group subtotal columns are left out; no tool reads them.roster-checkcompares Canvas enrolments with the registrar roster, for census week.Write commands (each is a dry run until
--apply)grades-pushapplies an overlay CSV, changed cells only. A blank cell never clears a grade, and a file whose assignment IDs belong to another course is refused.announceposts announcements, such as the filesreg-c50 postwrites.discussionandassignmentcreate items unpublished.assignment --lab Ntakes its name and points from the vault.syllabusrefuses a file without the class note's serial.Token and data handling
canvas_apiis the only module that reads the token. It reads~/.config/lectern/canvas-tokenand refuses the file if group or other can read it. It never takes the token from argv or the environment.Authorizationheader. The token is scrubbed from every error.Docs
New runbook
docs/canvas-api.md: how the pieces fit, setup, every command, data scope and troubleshooting. The README,SKILL.md,AGENTS.mdanddocs/canvas-grades-workflow.mddescribe the API path, and each repeats the dry-run rule on purpose.Testing
pytest: 680 passed, including 28 new tests intests/test_canvas.py(fake transport, no network).grades-pushandannouncehave unit tests only. The sandbox has no students to grade, and an announcement notifies students immediately.🤖 Generated with Claude Code
https://claude.ai/code/session_01N64GRxn3cQDJKAJLdfrso2