# Command reference

Every command, what it needs, and where it's documented. Run
`syncjar <command> --help` for its full list of options. From a clone, the
same command is `npm run <command> -- <options>`.

**Credentials:** *v1* is `SKILLJAR_API_KEY`, *v2* a v2 client with the
scopes on [Configuration](https://westerling.nu/syncjar/configuration.md#which-commands-need-which),
and *none* runs locally.

---

## Content

| Command | Does | Writes to Skilljar | Credentials |
|---|---|---|---|
| [`pull`](https://westerling.nu/syncjar/content/pulling.md) | Courses, lessons, content items and quizzes to files | no | v1 |
| [`pull:slugs`](https://westerling.nu/syncjar/content/pulling.md#slugs-pullslugs) | Per-domain slugs and visibility flags to `published.json` | no | v1 |
| [`pull:paths`](https://westerling.nu/syncjar/content/pulling.md#learning-paths-pullpaths) | Learning paths to files | no | v1 |
| [`push`](https://westerling.nu/syncjar/content/pushing.md) | Course titles, lesson titles and HTML content items | yes, with prompts | v1 |
| [`push:quizzes`](https://westerling.nu/syncjar/content/quizzes.md) | New quizzes, and edits to pulled ones | yes, with prompts | v1 |
| [`push:course-settings`](https://westerling.nu/syncjar/content/settings.md#course-settings) | Course settings from `details.json` | yes, one prompt | v1 |
| [`push:paths`](https://westerling.nu/syncjar/content/settings.md#path-details-lesson-settings-and-visibility) | Path details from `details.json` | yes, one prompt | v1 |
| [`push:lesson-settings`](https://westerling.nu/syncjar/content/settings.md#path-details-lesson-settings-and-visibility) | Lesson settings from `lessons-meta.json` | yes, one prompt | v1 |
| [`push:published-settings`](https://westerling.nu/syncjar/content/settings.md#path-details-lesson-settings-and-visibility) | `hidden` and strict enforcement from `published.json` | yes, one prompt | v1 |

## Preview (from a clone only)

| Command | Does | Credentials |
|---|---|---|
| [`build:preview`](https://westerling.nu/syncjar/content/previewing.md) | `pull`, then `generate:courses` | v1 |
| [`generate:courses`](https://westerling.nu/syncjar/content/previewing.md) | Rebuilds the preview index from the content files | none |
| [`serve`](https://westerling.nu/syncjar/content/previewing.md) | Serves the preview at `http://localhost:3000` | none |
| [`export:plaintext`](https://westerling.nu/syncjar/content/previewing.md#export-to-markdown-exportplaintext) | One Markdown file per course | none |

`export:plaintext` also runs from the global command.

## Checks

All read-only.

| Command | Does | Credentials |
|---|---|---|
| [`check:drift`](https://westerling.nu/syncjar/checks/drift.md) | Dashboard edits since the last pull; exits `2` if any | v2 |
| [`check:visibility`](https://westerling.nu/syncjar/checks/visibility.md) | Who can see each published course and path, and likely mistakes | v2 |
| [`check:settings`](https://westerling.nu/syncjar/checks/settings.md) | Settings that differ from the rest of the catalog | v1 |
| [`check:links`](https://westerling.nu/syncjar/checks/settings.md#broken-links-checklinks) | Broken links in the preview's content; clone only | none |
| [`check:membership`](https://westerling.nu/syncjar/students/groups.md#checking-membership-checkmembership) | Whether people are in a group, and active on a domain | v1 |

## Students

| Command | Does | Writes to Skilljar | Credentials |
|---|---|---|---|
| [`group:add`](https://westerling.nu/syncjar/students/groups.md) | Adds students to a group, by email | with `--confirm` | v2 |
| [`group:remove`](https://westerling.nu/syncjar/students/groups.md) | Removes students from a group, by email | with `--confirm` | v2 |
| [`group:domains`](https://westerling.nu/syncjar/students/groups.md#auto-add-email-domains-groupdomains) | Lists or changes a group's auto-add email domains; `--check-existing` offers to add students already at them | with `--confirm` | v2 |
| [`group:audit`](https://westerling.nu/syncjar/students/groups.md#auditing-a-group-against-a-roster-groupaudit) | Group members who aren't on a roster | no | v1 |
| [`group:revoke`](https://westerling.nu/syncjar/students/groups.md#revoking-access-grouprevoke) | Removes reviewed users from a group, or deactivates them on a domain | with `--confirm` | v1 |
| [`enroll:add`](https://westerling.nu/syncjar/students/enrollments.md) | Enrolls students in a course, by email | with `--confirm` | v2 |
| [`enroll:remove`](https://westerling.nu/syncjar/students/enrollments.md) | Deactivates students' enrollments in a course | with `--confirm` | v2 |

## Exports

All read-only, writing to `public/data/` by default.

| Command | Does | Credentials |
|---|---|---|
| [`export:students`](https://westerling.nu/syncjar/students/exports.md#students-exportstudents) | The student list | v1 |
| [`export:enrollments`](https://westerling.nu/syncjar/students/exports.md#enrollments-exportenrollments) | One row per enrollment | v2 |
| [`export:analytics`](https://westerling.nu/syncjar/students/exports.md#course-analytics-exportanalytics) | Per-course totals, optionally per domain | v2 |
| [`sync:users`](https://westerling.nu/syncjar/students/exports.md#activity-reports-syncusers-exportusers-exportmetrics) | Caches every student's progress locally | v1 |
| [`export:users`](https://westerling.nu/syncjar/students/exports.md#activity-reports-syncusers-exportusers-exportmetrics) | Students with activity, from the cache | none |
| [`export:metrics`](https://westerling.nu/syncjar/students/exports.md#activity-reports-syncusers-exportusers-exportmetrics) | Monthly registrations and completions, from the cache | none |

## The `syncjar` command itself

| Command | Does |
|---|---|
| `syncjar help` | Lists commands, the installed version and commit, and where credentials are read from |
| `syncjar --version` | Prints the version |
| [`syncjar update`](https://westerling.nu/syncjar/getting-started.md#updating) | Installs the latest release, or `--ref <ref>`, unless that commit is already installed |
| [`syncjar whoami`](https://westerling.nu/syncjar/configuration.md#checking-a-client-whoami) | Shows the v2 client's scopes and which commands it can run |
