Help:Ephemera Agent/Bulk Import

From Encyclopedia Ephemera

The WIKI tab contains a BULK IMPORT section for loading many pages at once without making AI calls (except optionally for formatting). This is the primary way to populate the Instructions: namespace.

JSON Import

Supported Formats

The importer accepts three JSON structures automatically:

Flat array (simplest)
<syntaxhighlight lang="json">

[

 { "title": "Instructions:Foo", "content": "raw wikitext here" },
 { "title": "Instructions:Bar", "content": "more wikitext", "summary": "Initial import" }

] </syntaxhighlight>

Instruction namespace schema
<syntaxhighlight lang="json">

{

 "pages": [
   {
     "title": "Instructions:Create/Source (Base Workflow)",
     "meta": { "id": "create-source-base", "type": "workflow" },
     "sections": {
       "Summary": "Base workflow for creating a new source page.",
       "Procedure": ["Step one", "Step two", "Step three"],
       "Output": ["Sources page", "Talk page"]
     }
   }
 ]

} </syntaxhighlight>

The sections object is automatically converted to wikitext:

  • String values → paragraphs
  • Arrays → bullet lists (*)
  • Nested objects → definition lists (; / :)

No AI call is needed for this conversion.

Conflict Handling

The On Conflict dropdown controls what happens when a page already exists:

Option Behaviour
Skip existing pages The page is left unchanged and marked as skipped in the log
Overwrite existing pages The page is replaced silently
Ask for each conflict A browser dialog prompts you to confirm or skip each conflict individually

AI Formatting

If a page has no content field and no sections object, it cannot be imported without formatting help. Enable Use AI to format wikitext to have the generator model convert the raw JSON structure to wikitext. This costs tokens and requires an API key to be loaded.

Running an Import

  1. Click 📄 Choose JSON file and select your file
  2. A preview shows how many pages were found and flags any that need AI formatting
  3. Set your conflict preference
  4. Click IMPORT PAGES
  5. The progress bar and log show status for each page as it is created

A CSRF token is fetched once and reused for the whole batch. A 300ms pause between pages respects MediaWiki rate limits.

XML Dump Import

Overview

Accepts standard MediaWiki XML export format — the same file produced by Special:Export or any MediaWiki dump tool. The XML is posted as a multipart file upload to proxy.php, which forwards it to the wiki's action=import API.

Required Permission

The importupload right is required on your bot account. This is typically restricted to sysops. To grant it:

Add to LocalSettings.php: <syntaxhighlight lang="php"> $wgGroupPermissions['bot']['importupload'] = true; </syntaxhighlight>

Then grant Import pages from file uploads at Special:BotPasswords when creating or editing your bot password.

Options

Import full revision history
Checked — all revisions from the XML are imported, preserving the full edit history. Unchecked — only the latest revision of each page is imported.


Warning
XML import can overwrite existing pages and histories depending on the dump. Test with a small file first.

Running an XML Import

  1. Click 🗂 Choose XML dump and select your .xml file
  2. The tool sniffs the first 512 bytes to confirm it looks like a MediaWiki export
  3. The file size is displayed — confirm before proceeding for large dumps
  4. Set the revision history option
  5. Click IMPORT XML DUMP
  6. The log shows each imported page and its revision count