Skip to main content

Command Line Interface (Beta)

The Pawtograder CLI is a command-line tool for instructors and site administrators to automate course management tasks. It provides programmatic access to Pawtograder’s core functionality, enabling bulk operations, scripting, and integration with other tools.
The CLI is currently in beta. Commands and options may change in future releases.

Installation

The CLI is included in the Pawtograder platform repository. To use it:

Authentication

Before using the CLI, you must authenticate with an API token.

Creating an API Token

  1. Log in to Pawtograder
  2. Navigate to your account settings
  3. Go to the “API Tokens” section
  4. Click “Create New Token”
  5. Give your token a descriptive name and select appropriate scopes
  6. Copy the generated token (you won’t be able to see it again)

Logging In

Managing Authentication

Available Commands

Classes

Manage course classes.

Assignments

Manage assignments across classes:

Assignment copy options

  • --assignment <slug>: Copy a single assignment
  • --all: Copy all assignments from source class
  • --schedule <file>: Copy assignments with date overrides from CSV
  • --dry-run: Preview changes without making them
  • --skip-repos: Skip repository operations
  • --skip-rubrics: Skip rubric copying
  • --skip-surveys: Skip survey copying
  • --workdir <path>: Local directory for git clones (required for repo operations)
  • --concurrency <n>: Parallel operations (1-8, default 4)
  • --delay-ms <ms>: Delay between clone batches in milliseconds

Rubrics

Import and export rubrics in YAML format:
Rubric types: grading, self_review, meta

Surveys

Copy surveys between classes:

Flashcards

Copy flashcard decks between classes:

Submissions

Import comments and artifacts:

Repository maintenance

The CLI provides local git/rsync workflows for student repository operations. These commands fetch metadata from the API and perform git operations via SSH on your machine.

List repositories

Sync grade workflow

Sync .github/workflows/grade.yml from handout to all student repos:
Options:
  • --dry-run: Preview changes only
  • --concurrency <n>: Parallel operations (1-8, default 2)
  • --delay-ms <ms>: Delay between batches

Cross-assignment copy

Copy files from source assignment repos to target assignment repos after source due date:
Options:
  • --dry-run: Preview with rsync -n only
  • --mirror-delete: Pass rsync —delete (excludes .git)
  • --concurrency <n>: Parallel operations (1-8, default 2)

Environment variables

  • PAWTOGRADER_HTTP_TIMEOUT_MS: HTTP timeout in milliseconds (default: system default)
  • DEBUG=1: Enable verbose HTTP logging
  • PAWTOGRADER_VERBOSE=1: Alternative verbose flag

Common workflows

Copy course to new semester

Bulk update grade workflows

Export and modify rubrics

Error handling

The CLI provides detailed error messages and exit codes:
  • 0: Success
  • 1: General error
  • 2: Authentication error
  • 3: Not found error
  • 4: Validation error
Use --help with any command to see detailed usage information:

Best practices

  1. Use dry-run mode: Always test with --dry-run before running destructive operations
  2. Backup data: Export important data before making bulk changes
  3. Use workdir: Specify a dedicated working directory for git operations to avoid conflicts
  4. Monitor progress: The CLI provides detailed logging for long-running operations
  5. Secure tokens: Store API tokens securely and never commit them to version control
  6. Use specific identifiers: Prefer slugs or IDs over names for reliability

Troubleshooting

Authentication issues

If you encounter authentication errors:
  1. Verify your token is valid: npm run cli -- whoami
  2. Check token scopes match the required permissions
  3. Ensure you’re connecting to the correct instance

Repository operations

If git operations fail:
  1. Ensure you have SSH access to GitHub
  2. Verify the workdir has sufficient disk space
  3. Check network connectivity
  4. Try reducing --concurrency for rate-limited operations

Performance

For large operations:
  • Use --concurrency to control parallel operations
  • Add --delay-ms to avoid rate limiting
  • Consider running operations during off-peak hours