Pawtograder CLI (Beta)
The Pawtograder CLI provides command-line tools for instructors and site administrators to manage courses, copy assignments between semesters, import rubrics and submission data, and perform bulk repository operations.
The CLI is in beta. Commands and options may change in future releases.
Installation
The CLI ships inside the platform repository and runs via npm scripts. Run it from the repository root:
For repository commands, use the shortcut:
Prerequisites
- Node.js 18 or later
- SSH access to GitHub (for repository operations)
- A Pawtograder API token with CLI access
Authentication
Before using the CLI, authenticate with an API token.
Creating an API token
- Log in to the Pawtograder web app.
- Navigate to User Menu → API Tokens.
- Create a new token with type “CLI” or “MCP + CLI”.
- Copy the token. It starts with
mcp_.
Logging in
You’ll be prompted to enter your API token. The token is stored securely in ~/.pawtograder/credentials.json.
You can also provide the token directly:
For custom deployments, specify the API URL:
Checking authentication
Logging out
Commands
Classes
List all classes you have access to:
Show details for a specific class:
The identifier can be a class ID, slug, or name.
Assignments
List assignments for a class:
Show assignment details:
Copy assignments
Copy assignments between classes. Supports single-assignment copy, full-course copy, and schedule-driven copy:
The copy command handles:
- Assignment record creation
- Rubrics (deep copy)
- Autograder configuration
- Self-review settings
- Handout and solution repository content (via local SSH git)
--workdir is required for repository content copying. The CLI uses local SSH git operations to avoid Supabase timeout limits.
Options:
Create a CSV with assignment slugs and new due dates:
Delete an assignment
Add --force to skip the confirmation prompt.
Rubrics
Import and export rubrics in YAML format.
List rubrics for an assignment:
Export a rubric to YAML:
Import a rubric from YAML:
Use --dry-run to preview the import without making changes.
Surveys
Copy surveys between classes:
List surveys for a class:
Flashcards
List flashcard decks:
Copy flashcard decks between classes:
Submissions
List submissions for an assignment:
Batch import submission comments from autograder results:
Use --rubric-part-id instead of --author-profile-id to attribute comments to review assignment assignees.
Import artifacts
Upload submission artifact blobs from a manifest:
Options:
--overwrite – Replace existing artifacts with the same name
--dry-run – Preview counts only
--batch-size <n> – Artifacts per API request (default 5)
The manifest is a JSON file with this structure:
You can use content_file instead of content_base64 to reference an external file:
Help requests
List office hours help requests:
Discussions
List discussion board threads:
Reviews
List peer and grading review assignments:
Repository operations
Repository commands use local SSH git operations for reliability and performance.
Repository commands require SSH access to GitHub. Ensure your SSH keys are configured and you have access to the course organization.
List repositories
Sync grade workflow
Synchronize .github/workflows/grade.yml from the handout repository to all student repositories:
This command:
- Fetches the canonical
.github/workflows/grade.yml from the handout repository.
- Clones all student repositories locally via SSH.
- Updates the workflow file in each repository.
- Commits and pushes changes.
Options:
--dry-run – Preview which repos would be updated
--concurrency <n> – Parallel git operations (1-8, default 2)
--delay-ms <n> – Delay between clone batches
Cross-assignment copy
Copy files from source assignment repositories to target assignment repositories after the source due date. This is useful for sequential assignments where students build on previous work:
The CLI:
- Verifies the source assignment due date has passed.
- Clones source and target repositories for each student or group.
- Copies files using rsync (excluding
.git).
- Commits and pushes to target repositories.
Options:
--dry-run – Preview with rsync -n only
--mirror-delete – Pass rsync --delete (still excludes .git)
--concurrency <n> – Parallel operations (1-8, default 2)
--delay-ms <n> – Delay between batches
Common options
Most commands support these options:
--dry-run – Preview changes without making them
--help – Show command-specific help
--class or -c – Specify a class by ID, slug, or name
--assignment or -a – Specify an assignment by ID or slug
Environment variables
API token scopes
CLI tokens require specific scopes:
cli:read – Read-only operations (list, show, export)
cli:write – Write operations (copy, import, delete)
Create tokens with appropriate scopes in the web UI under User Menu → API Tokens.
Common workflows
Semester rollover
Copy an entire course to a new semester:
Bulk rubric updates
Repository maintenance
Best practices
- Use dry-run first. Preview changes with
--dry-run before executing.
- Export backups. Export rubrics before importing new versions.
- Batch size. For artifact imports, reduce
--batch-size if requests time out.
- Dedicated workdir. Use a dedicated directory for
--workdir to avoid conflicts.
- Concurrency. Start with the default and adjust based on network performance.
Troubleshooting
Authentication errors
If you see “Not logged in” or “Authentication failed”:
- Run
npm run cli -- login to re-authenticate.
- Verify your token is valid in the web UI (User Menu → API Tokens).
- Ensure your token has the correct scopes (
cli:read or cli:write).
Common HTTP errors:
- 401 Unauthorized – Token expired or revoked. Log in again.
- 403 Forbidden – Token lacks required scopes.
- 504 Gateway Timeout – Operation took too long. Increase the timeout or use smaller batches.
Command not found
Run the CLI from the platform repository root and make sure dependencies are installed with npm install.
Timeout errors
For large operations (copying many assignments, importing large artifacts):
- Set a longer timeout:
PAWTOGRADER_HTTP_TIMEOUT_MS=600000 npm run cli -- ...
- Use smaller batch sizes (for example,
--batch-size 1 for artifact imports).
- Use
--dry-run first to validate before running the full operation.
For assignment copy operations, the CLI validates and fixes existing assignments on retry, so you can safely re-run failed commands.
Repository clone failures
If SSH git operations fail:
- Verify SSH keys are configured:
ssh -T git@github.com
- Check that you’re a member of the course’s GitHub organization.
- Retry with lower
--concurrency (try 2 or 1).
- Use
--delay-ms 1000 to add delays between batches.
Connection reset errors
The CLI automatically retries git operations that fail due to connection resets. If failures persist:
- Check your network connection.
- Verify GitHub is accessible.
- Reduce
--concurrency to avoid rate limits.
Getting help
For detailed help on any command:
For example: