Official TeachRepo CLI. Import repos, validate course YAML, and scaffold new courses from your terminal.
npm install -g @teachrepo/cli
teachrepo --helpImport a GitHub repository as a course on TeachRepo.
teachrepo import [options]
Options:
--repo <url> GitHub repository URL (required)
--token <token> TeachRepo API token (or set TEACHREPO_TOKEN env var)
--base-url <url> TeachRepo API base URL (default: https://teachrepo.com)
--dry-run Validate without importing
-h, --help Show help
Examples:
teachrepo import --repo=https://github.com/you/your-course
teachrepo import --repo=https://github.com/you/your-course --dry-run
TEACHREPO_TOKEN=tr_xxx teachrepo import --repo=https://github.com/you/your-courseValidate a course.yml file without importing.
teachrepo validate [options]
Options:
--file <path> Path to course.yml (default: ./course.yml)
--verbose Show detailed validation output
-h, --help Show help
Examples:
teachrepo validate
teachrepo validate --file=./my-course.yml --verboseValidation checks:
- ✅ Required fields present (
title,slug,price_cents,currency,lessons) - ✅ Slug format (lowercase alphanumeric + hyphens)
- ✅ Price is a non-negative integer
- ✅ Currency is a valid 3-letter ISO code
- ✅ All referenced lesson files exist
- ✅ Lesson access is
freeorpaid - ✅ Quiz answer keys are valid (answer must be in options array)
- ✅ Sandbox provider is
stackblitzorcodesandbox
Scaffold a new course from the official template.
teachrepo new <course-name> [options]
Arguments:
course-name Name of the new course (will become the directory name)
Options:
--template <t> Template to use: basic | quiz | sandbox (default: basic)
--slug <slug> URL slug (default: kebab-case of course-name)
-h, --help Show help
Examples:
teachrepo new "Advanced Git for Engineers"
teachrepo new "Python Async" --template=sandbox
teachrepo new "React Patterns" --slug=react-patterns --template=quizShow the authenticated user.
teachrepo whoami
# Output:
# Authenticated as: your@email.com
# Plan: hosted ($19/mo)
# API URL: https://teachrepo.comSet your TeachRepo API token as an environment variable:
export TEACHREPO_TOKEN=tr_your_token_hereOr pass it directly with --token.
Get your token at teachrepo.com/dashboard/settings.
# Global install (recommended)
npm install -g @teachrepo/cli
# Or use with npx (no install)
npx @teachrepo/cli import --repo=https://github.com/you/your-courseThe CLI is designed to run in CI. See the teachrepo-template for the full workflow.
- name: Import course to TeachRepo
env:
TEACHREPO_TOKEN: ${{ secrets.TEACHREPO_TOKEN }}
run: |
npm install -g @teachrepo/cli
teachrepo import --repo="${{ github.repositoryUrl }}"The CLI reads from .teachrepo.json in the project root (optional):
{
"baseUrl": "https://teachrepo.com",
"courseFile": "course.yml"
}Issues and PRs welcome. See CONTRIBUTING.md.
MIT — see LICENSE