Imported from dg/adminer (
AGENTS.md). Install upstream withnpx skills add dg/adminer. Copyright stays with the author.
To My Agents!
It is my fervent wish that this file guide every AI coding agent working with code in this repository.
Project Overview
Composer package dg/adminer — a customized distribution of Adminer with custom plugins and UI for the Nette ecosystem. Not a standalone application; users install via composer require dg/adminer and create a wrapper index.php.
Architecture
Entry Point (index.php)
Dual purpose: serves static assets (CSS/JS) via ?file=...&version=N query parameters with cache headers, and loads the core adminer.php binary.
Asset URLs are rewritten on-the-fly using output buffering — ASSETS_VERSION constant controls cache busting.
Plugin Loading Chain
index.php → adminer.php (core binary) → adminer-plugins.php → private.php (returns plugin instance array)
- Plugins live in
adminer-plugins/— each is a PHP class prefixed withAdminer(e.g.,AdminerSqlWizard) - Plugins hook into Adminer's extension points via method names:
head(),csp(),login(),loginForm(),dumpFormat(),dumpHeaders(),dumpTable(),dumpData(),syntaxHighlighting(),tablesPrint(),backwardKeys(),backwardKeysPrint() - Active plugins are instantiated in
private.phpand returned as an array private.phpalso holds API keys (e.g., OpenAI key for sql-wizard)
Frontend Code
No build system. All assets are pre-built and committed:
- JavaScript is embedded inline in plugin PHP files using
<script<?= Adminer\nonce() ?>>for CSP compliance - PHP data is passed to JS via
json_encode() - ACE editor bundles in
static/ace/, Prism.js instatic/ - Custom CSS in
adminer.css(standard CSS, no preprocessors)
Key Cross-File Interactions
autocomplete.phpreplaces the standard.sqlareatextarea with an ACE editor and monkey-patches thevalueproperty for transparent form integrationsql-wizard.phpprepends a prompt textarea + button before the.sqlareaform element and writes generated SQL into it — this interacts with the ACE editor override fromautocomplete.phpremoteColor.phpadds CSS classremoteto<html>element;adminer.cssstyles.remotewith a red top borderdump-php-prototype.phpanddump-json.phpregister custom export formats viadumpFormat()/dumpHeaders()/dumpTable()/dumpData()hooks
Development Workflow
No automated tests. Manual testing only:
- Create a wrapper
index.phpin a test project pointing to this package - Open Adminer in browser and test database operations
To add a new plugin:
- Create
adminer-plugins/new-feature.phpwith classAdminerNewFeature - Add
new AdminerNewFeature()to the array inprivate.php
Coding Conventions
Follow existing patterns in adminer-plugins/. Key points:
- Class name:
AdminerFeatureName - Inline JS/CSS in PHP files using
Adminer\nonce()for CSP - Use
json_encode()to pass PHP data to JavaScript - CSS targets Adminer's existing DOM structure
Commit Message Style
- Plugin changes:
sql-wizard: updated model - Core updates:
update to Adminer 5.4.1 - CSS changes:
css tweaks - WIP:
wip