Skip to content

CLI reference

Clipboard icons

Commands and prompts on this page use fenced blocks with a copy button (top-right). Click to copy the full text for Terminal, Claude, or Cursor.

v0.6.4 ยท Requires Node.js 18 or 20 and @lxpack/cli on your PATH.

Copy-paste commands

Install LXPack CLI (Node.js 18 or 20)
npm install -g @lxpack/cli
Verify lxpack is installed
lxpack --version
Update LXPack CLI
npm update -g @lxpack/cli
Create a new course and enter its folder
lxpack init my-course
cd my-course
Open course in Cursor
cursor .
Validate course (run from course folder)
lxpack validate
Validate for xAPI/cmi5 export
lxpack validate --target xapi
Start local preview server
lxpack preview
Build SCORM 1.2 package (most LMS)
lxpack build --target scorm12
Build SCORM 2004 package
lxpack build --target scorm2004
Build xAPI package
lxpack build --target xapi
Build cmi5 package
lxpack build --target cmi5
Typical workflow after editing files
lxpack validate
lxpack preview
lxpack build --target scorm12

Commands discover the course by walking up from the current directory until they find course.yaml.

Commands

Command Description
lxpack init <name> Create a new course (-d, --dir, -f, --force)
lxpack preview Local preview server (-p, --port, -H, --host, -t, --target, --lessonkit)
lxpack validate Validate structure (-t, --target, --lessonkit for interchange)
lxpack build Package for LMS (-t, --target, -o, --output, --dir, --lessonkit)

init

lxpack init my-course
lxpack init my-course
lxpack init my-course --dir ./courses/my-course
lxpack init my-course --force

--dir must stay inside the current working directory.

preview

lxpack preview
lxpack preview
lxpack preview -p 4000 -H 0.0.0.0
lxpack preview --target xapi

Default: http://127.0.0.1:3847

Uses the same defaultTarget resolution as build when --target is omitted. Warns when --host is not loopback (embedded assessment keys). Fails if validation fails (same as build).

LessonKit interchange preview (same flags as build --lessonkit):

lxpack preview --lessonkit
lxpack preview --lessonkit ./lessonkit.json \
  --spa-lesson spa1=/abs/path/to/dist

validate

lxpack validate
lxpack validate
lxpack validate --target scorm12
lxpack validate --target xapi
lxpack validate --lessonkit ./lessonkit.json --spa-lesson spa1=/abs/path/to/dist

LessonKit interchange validation (same SPA flags as build --lessonkit):

lxpack validate --lessonkit
lxpack validate --lessonkit ./lessonkit.json \
  --spa-lesson spa1=/abs/path/to/dist
Target Extra checks
scorm12 SCORM 1.2 packaging rules
scorm2004 Multi-SCO / sequencing
standalone Standalone layout
xapi tracking.xapi.activityIri (HTTPS)
cmi5 cmi5 + xAPI tracking

build

lxpack build
lxpack build
lxpack build --target scorm12
lxpack build --target scorm2004 -o ./out/course.zip
lxpack build --target standalone --dir -o ./out/standalone
Option Description
-t, --target scorm12 (default), scorm2004, standalone, xapi, cmi5
-o, --output Output ZIP or directory path (relative paths resolve inside the materialized course for --lessonkit)
--dir Unpacked directory instead of ZIP
--lessonkit <path> Build from lessonkit.json interchange instead of course.yaml
--spa-lesson <id=path> SPA lesson id and absolute path to dist folder with index.html (repeatable)
--spa-dist <path> Shorthand when the interchange has a single SPA lesson

LessonKit interchange build (no course.yaml in cwd):

lxpack build --lessonkit
lxpack build --lessonkit ./lessonkit.json \
  --spa-lesson spa1=/abs/path/to/spa/dist \
  --target scorm12

See lessonkit.json interchange and LessonKit interoperability.

React / LessonKit authors

For LessonKit 1.0 projects, prefer lessonkit package --target scorm12 (via @lessonkit/lxpack). Use lxpack build --lessonkit for interchange-only workflows without the LessonKit CLI.

Default output directory: .lxpack/ (or output.dir in lxpack.config.json).

Exit codes

Code Meaning
0 Success
1 Validation or build error