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