@teachrepo/cli
Import repos, validate course YAML, and scaffold new courses from your terminal. Works standalone and in GitHub Actions CI/CD.
Installation
# Global install (recommended) npm install -g @teachrepo/cli # Or use without installing npx @teachrepo/cli --help
Set your TeachRepo API token as an environment variable, or pass it with --token. Get your token at Dashboard → Settings.
export TEACHREPO_TOKEN=tr_your_token_here
teachrepo importImport a GitHub repository as a TeachRepo course.
--repo <url>GitHub repository URL (required)--token <token>TeachRepo API token (or set TEACHREPO_TOKEN)--base-url <url>API base URL (default: https://teachrepo.com)--dry-runValidate course.yml without importingteachrepo 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-course
teachrepo validateValidate a course.yml file without importing.
--file <path>Path to course.yml (default: ./course.yml)--verboseShow detailed validation output including summaryteachrepo validate teachrepo validate --verbose teachrepo validate --file=./my-course.yml
teachrepo new <course-name>Scaffold a new course from the official template.
--template <t>Template: basic | quiz | sandbox (default: basic)--slug <slug>URL slug (default: kebab-case of course-name)teachrepo new "Advanced Git for Engineers" teachrepo new "Python Async" --template=sandbox teachrepo new "React Patterns" --slug=react-patterns --template=quiz
teachrepo whoamiShow the authenticated TeachRepo user.
--token <token>TeachRepo API token (or set TEACHREPO_TOKEN)teachrepo whoami
Add the CLI to your workflow to auto-import on every push to main. The course template includes this workflow pre-configured.
name: Deploy to TeachRepo
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install -g @teachrepo/cli
- run: teachrepo import --repo="${{ github.repositoryUrl }}"
env:
TEACHREPO_TOKEN: ${{ secrets.TEACHREPO_TOKEN }}The CLI is open-source under MIT. Issues and PRs welcome.
⭐ github.com/ErlisK/teachrepo-cli →