In a terminalPreview · 0.1.1

MoodlIA Sync

Copy course content from one Moodle site to another without backups, after you approve a plan.

MoodlIA Sync reads a source course and writes a plan with the exact changes the target course needs. Nothing is written until you approve that plan; then it applies it and verifies the result. It works with Moodle's standard web services and, where installed, the MoodlIA plugin, choosing per feature.

What it does

  • Plan, approve, apply, and verify, as separate steps.
  • Stops if either course changed after the plan was made.
  • Keeps tokens in environment variables, never in plans or state.

What you need

  • Node.js 22.13 or newer.
  • Tokens for both Moodle sites (standard web services and/or the MoodlIA plugin).

Installation

Install

  1. Install the command globally:

    npm install -g moodlia-sync
  2. If your npm policy blocks install scripts, approve and build the database driver once:

    npm approve-scripts better-sqlite3
    npm rebuild better-sqlite3
  3. Describe both sites in .moodle-profiles.json; each token is read from the environment variable you name:

    {
      "schema_version": 1,
      "profiles": {
        "school_a": { "url": "https://moodle-a.example.edu",
          "credentials": { "core": { "token_env": "SCHOOL_A_CORE_TOKEN" } } },
        "school_b": { "url": "https://moodle-b.example.edu",
          "credentials": { "core": { "token_env": "SCHOOL_B_CORE_TOKEN" } } }
      }
    }

First use

  1. Plan (read-only) and review plan.json:

    moodlia-sync plan --source-profile school_a --source-course-id 42 \
      --target-profile school_b --target-course-id 108 --plan-file plan.json
  2. Approve that exact plan, apply it, and verify:

    moodlia-sync approve plan.json --yes
    moodlia-sync apply plan.json --plan-digest <sha256:...> --allow-write
    moodlia-sync verify --plan-id <plan_id>

Good to know

  • Preview: only the content types verified for each site pairing are synchronized; the rest is reported in the plan.
  • Try it with test courses before using it with real ones.

Other apps

On your Moodle siteAvailable · 0.1.215

MoodlIA Moodle Plugin

Let AI assistants and scripts work with Moodle safely, within Moodle's own permissions.

In a terminalAvailable · 0.4.1

MoodlIA CLI

Run every MoodlIA plugin operation from a terminal, a script, or an AI agent's shell.

In a terminalAvailable · 0.4.1

Moodle Core CLI

Automate Moodle through its standard web services, with nothing to install on Moodle.

Need help?

Questions about installing or using any MoodlIA app, or ideas for new ones: write to us.

contact@moodlia.com