1*719b4841SAndreas Gohr# AGENTS.md 2*719b4841SAndreas Gohr 3*719b4841SAndreas GohrThis file provides guidance to AI agents when working with code in this repository. 4*719b4841SAndreas Gohr 5*719b4841SAndreas Gohr**Always update this file automatically when you learn new things about the code base!** 6*719b4841SAndreas Gohr 7*719b4841SAndreas Gohr## Project Overview 8*719b4841SAndreas Gohr 9*719b4841SAndreas GohrThis is the @@PLUGIN_NAME@@ DokuWiki plugin. 10*719b4841SAndreas Gohr 11*719b4841SAndreas GohrIt's for @@PLUGIN_DESC@@ 12*719b4841SAndreas Gohr 13*719b4841SAndreas Gohr**FIXME** replace this section with a more detailled description when you first inspect or extend the codebase. 14*719b4841SAndreas Gohr 15*719b4841SAndreas Gohr## Testing 16*719b4841SAndreas Gohr 17*719b4841SAndreas GohrTests run via DokuWiki's PHPUnit-based testing framework: 18*719b4841SAndreas Gohr 19*719b4841SAndreas Gohr```bash 20*719b4841SAndreas Gohr# Tests must be run from repository root 21*719b4841SAndreas Gohr../../../bin/plugin.php dev test 22*719b4841SAndreas Gohr 23*719b4841SAndreas Gohr# run individual test file 24*719b4841SAndreas Gohr../../../bin/plugin.php dev test _test/GeneralTest.php 25*719b4841SAndreas Gohr 26*719b4841SAndreas Gohr# create a new test file 27*719b4841SAndreas Gohr../../../bin/plugin.php dev addTest MyClass 28*719b4841SAndreas Gohr``` 29*719b4841SAndreas Gohr 30*719b4841SAndreas GohrDokuWiki provides useful helper methods for testing: 31*719b4841SAndreas Gohr 32*719b4841SAndreas Gohr* `DokuWikiTest::getInaccessibleProperty()` to access private/protected properties 33*719b4841SAndreas Gohr* `DokuWikiTest::callInaccessibleMethod` to execute private/protected methods 34*719b4841SAndreas Gohr* read `../../../_test/core/DokuWikiTest.php` for more helper methods 35*719b4841SAndreas Gohr* use `../../../_test/TestRequest.php` to simulate HTTP requests for integration tests 36*719b4841SAndreas Gohr* use `../../../_test/phpQuery-onefile.php` if you need to parse HTML in tests 37*719b4841SAndreas Gohr 38*719b4841SAndreas GohrEach test run will provide a fresh DokuWiki instance in a temporary directory via the default setupBeforeClass methods. 39*719b4841SAndreas Gohr 40*719b4841SAndreas Gohr## Linting, Formatting and Conventions 41*719b4841SAndreas Gohr 42*719b4841SAndreas GohrAdhere to PSR-12 coding standards. Always add proper docblocks with descriptions, parameter types, and return types to all classes, methods and functions. 43*719b4841SAndreas Gohr 44*719b4841SAndreas Gohr```bash 45*719b4841SAndreas Gohr# Lint PHP files using PHP_CodeSniffer (must be run from repo root) 46*719b4841SAndreas Gohr../../../bin/plugin.php dev check 47*719b4841SAndreas Gohr 48*719b4841SAndreas Gohr# Auto-Fix formatting issues using PHP_CBF and Rector (must be run from repo root) 49*719b4841SAndreas Gohr../../../bin/plugin.php dev fix 50*719b4841SAndreas Gohr``` 51*719b4841SAndreas Gohr 52*719b4841SAndreas Gohr## Plugin Architecture 53*719b4841SAndreas Gohr 54*719b4841SAndreas GohrInspect the base plugin classes in `../../../inc/Extension/` to learn about the plugin system architecture. 55*719b4841SAndreas Gohr 56*719b4841SAndreas Gohr```bash 57*719b4841SAndreas Gohr# add new plugin components (must be run from repo root) 58*719b4841SAndreas Gohr../../../bin/plugin.php dev addComponent <type> 59*719b4841SAndreas Gohr# e.g. 60*719b4841SAndreas Gohr../../../bin/plugin.php dev addComponent action 61*719b4841SAndreas Gohr# if multiple of the same type are needed, give a name: 62*719b4841SAndreas Gohr../../../bin/plugin.php dev addComponent action foobar 63*719b4841SAndreas Gohr# -> creates action/foobar.php 64*719b4841SAndreas Gohr``` 65*719b4841SAndreas Gohr 66*719b4841SAndreas GohrAdditional classes are autoloaded when using the `dokuwiki\plugin\@@PLUGIN_NAME@@` namespace. 67