MediaWiki extension to import Labki content packs from Git repositories. Content is stored as .wiki page files, managed through a Vue.js-powered UI with dependency resolution and conflict detection.
Requirements:
- MediaWiki 1.44+
- PHP 8.2+
- Node.js 20+ (for frontend development)
- Git (for repository management)
- 📦 Git-based content repositories - Clone and sync content from GitHub/GitLab/etc.
- 🌳 Multi-ref support - Manage different branches/tags per repository
- 🔗 Dependency resolution - Automatic dependency graph and hierarchy visualization
- 🎨 Modern UI - Vue 3 + Codex components with real-time state management
- ⚡ Background operations - Async repo syncing with progress tracking
- 🔄 Page conflict detection - Prevent overwrites
- 📊 Mermaid graphs - Visual dependency trees
cd /var/www/html/extensions
git clone https://github.com/Aharoni-Lab/LabkiPackManager.gitwfLoadExtension( 'LabkiPackManager' );cd extensions/LabkiPackManager
composer install --no-devphp maintenance/update.phpcd extensions/LabkiPackManager
npm install
npm run buildFor local development with MediaWiki-Docker, use the setup script:
cd ~/dev/LabkiPackManager
chmod +x setup_mw_test_env.sh
./setup_mw_test_env.shNotes:
- Docker must be running
- MediaWiki cloned to platform cache directory:
- Linux:
~/.cache/labki/mediawiki-test - macOS:
~/Library/Caches/labki/mediawiki-test - Windows:
~\AppData\Local\labki\mediawiki-test
- Linux:
- Override with:
MW_DIR=/custom/path ./setup_mw_test_env.sh - Script is idempotent - safe to re-run
Then access:
- Wiki:
http://localhost:8080/w - Special page:
http://localhost:8080/w/index.php/Special:LabkiPackManager
- Visit
Special:LabkiPackManageras an admin - Click "Add Repository" and enter Git URL (e.g.,
https://github.com/Aharoni-Lab/labki-packs) - Wait for initial sync to complete
- Select repository and ref (branch/tag) from dropdowns
- Choose repository and ref
- View dependency hierarchy and select packs
- Customize page titles/prefixes if needed
- Click "Apply" to queue installation
- Monitor progress in operations panel
Add to LocalSettings.php:
// Optional: Global prefix for collision avoidance
// Example: 'Labki' → imports "Page" as "Labki:Page"
$wgLabkiGlobalPrefix = '';
// Optional: Cache directory for Git worktrees
// Default: $IP/cache/labki
$wgLabkiCacheDirectory = "$IP/cache/labki";By default, only users with labkipackmanager-manage right can manage packs (granted to sysop group). Customize in LocalSettings.php:
// Grant to additional groups
$wgGroupPermissions['bureaucrat']['labkipackmanager-manage'] = true;The extension provides action APIs:
labkiReposAdd- Add a new Git repositorylabkiReposList- List repositories and refslabkiReposSync- Sync/fetch repository updateslabkiReposRemove- Remove repository or specific refs
labkiManifestGet- Get parsed manifest datalabkiGraphGet- Get dependency graphlabkiHierarchyGet- Get computed hierarchy tree
labkiPacksList- List installed packslabkiPacksAction- Unified pack interaction endpoint (init/select/rename/apply)
labkiOperationsStatus- Query background operation status
See /includes/API/ for full API documentation.
LabkiPackManager/
├── includes/ # PHP backend
│ ├── API/ # Action API modules
│ ├── Domain/ # Domain models
│ ├── Handlers/ # Command handlers
│ ├── Jobs/ # Background jobs
│ └── Services/ # Business logic
├── resources/
│ ├── src/ # Vue.js frontend source
│ │ ├── ui/ # Components
│ │ ├── state/ # State management
│ │ └── api/ # API client
│ └── modules/ # Built bundles (committed)
└── tests/
├── phpunit/ # PHP tests
│ ├── unit/
│ └── integration/
└── fixtures/ # Shared test data
# Install dependencies
npm install
# Development build (watch mode)
npm run watch
# Production build
npm run build
# Run tests
npm test
# Lint code
npm run lintFrom MediaWiki root directory:
# Unit tests (171 tests)
composer phpunit:entrypoint -- extensions/LabkiPackManager/tests/phpunit/unit
# Integration tests (500 tests)
composer phpunit:entrypoint -- extensions/LabkiPackManager/tests/phpunit/integration
# All tests
composer phpunit:entrypoint -- extensions/LabkiPackManager/tests/phpunitOr using Docker:
cd ~/.cache/labki/mediawiki-test # or your MW_DIR
# Unit tests
docker compose exec mediawiki bash -lc 'composer phpunit:entrypoint -- extensions/LabkiPackManager/tests/phpunit/unit'
# Integration tests
docker compose exec mediawiki bash -lc 'composer phpunit:entrypoint -- extensions/LabkiPackManager/tests/phpunit/integration'- Coverage reports uploaded to Codecov
Your Git repository should have a single manifest.yml at the root with all content pages in a pages/ directory:
your-repo/
├── manifest.yml # Single root manifest (required)
└── pages/ # All .wiki/.lua/.js/.css files
├── page-name.wiki
├── template-publication.wiki
└── module-data.lua
schema_version: "1.0.0"
name: "Repository Display Name"
last_updated: "2025-01-15T10:30:00Z"
# Global page registry (page titles → file paths)
pages:
"Page Name":
file: "pages/page-name.wiki"
last_updated: "2025-01-15T10:30:00Z"
description: "Optional description"
"Template:Publication":
file: "pages/template-publication.wiki"
last_updated: "2025-01-14T08:00:00Z"
"Module:Data":
file: "pages/module-data.lua"
last_updated: "2025-01-10T12:00:00Z"
# Pack registry (pack IDs → metadata and page lists)
packs:
core:
version: "1.0.0"
description: "Core templates and modules"
pages:
- "Template:Publication"
- "Module:Data"
tags:
- "core"
- "templates"
advanced:
version: "1.2.0"
description: "Advanced features"
pages:
- "Page Name"
depends_on:
- "core" # Dependency on other packs
tags:
- "advanced"- schema_version: Semantic version (e.g.,
"1.0.0") - name: Repository display name (letters, digits, spaces, hyphens, colons, underscores)
- pages: Object mapping page titles to file metadata
- Keys: Canonical wiki titles (e.g.,
"Template:Name") file: Path underpages/(lowercase,.wiki/.lua/.js/.css)last_updated: ISO 8601 UTC timestamp
- Keys: Canonical wiki titles (e.g.,
- packs: Object mapping pack IDs to pack metadata
version: Required semantic versionpages: Array of page titles (must exist in globalpagesregistry)depends_on: Optional array of pack IDstags: Optional slugified labels (lowercase, hyphens)- Either
pages(1+) ordepends_on(2+) required
Manifests are validated using JSON Schema. The schema is enforced by CI validation from labki-packs-tools which can be added to your repository's GitHub Actions.
- labki-packs - Main content repository
- labki-base-packs - Base templates
- Ensure Git is installed and accessible to PHP
- Check write permissions on cache directory
- Verify repository URL is accessible
- Run
npm run buildto generate bundles - Check browser console for errors
- Verify Mermaid extension is installed (optional but recommended)
- Run
php maintenance/update.phpto apply migrations - Check tables exist:
labki_content_repo,labki_content_ref,labki_pack,labki_page,labki_operations,labki_pack_session_state
EUPL-1.2
See CONTRIBUTING.md for development guidelines.