1719b4841SAndreas Gohr# AGENTS.md 2719b4841SAndreas Gohr 3719b4841SAndreas GohrThis file provides guidance to AI agents when working with code in this repository. 4719b4841SAndreas Gohr 5719b4841SAndreas Gohr**Always update this file automatically when you learn new things about the code base!** 6719b4841SAndreas Gohr 7719b4841SAndreas Gohr## Project Overview 8719b4841SAndreas Gohr 9719b4841SAndreas GohrThis is the @@PLUGIN_NAME@@ DokuWiki plugin. 10719b4841SAndreas Gohr 11719b4841SAndreas GohrIt's for @@PLUGIN_DESC@@ 12719b4841SAndreas Gohr 13719b4841SAndreas Gohr**FIXME** replace this section with a more detailled description when you first inspect or extend the codebase. 14719b4841SAndreas Gohr 15*1b4ead2dSAndreas Gohr## Automated Testing 16719b4841SAndreas Gohr 17*1b4ead2dSAndreas GohrTests run via DokuWiki's PHPUnit-based testing framework. The calls MUST be made from within the plugin's repository root using a relative path to the `bin/plugin.php` script! 18719b4841SAndreas Gohr 19719b4841SAndreas Gohr```bash 20719b4841SAndreas Gohr# Tests must be run from repository root 21719b4841SAndreas Gohr../../../bin/plugin.php dev test 22719b4841SAndreas Gohr 23719b4841SAndreas Gohr# run individual test file 24719b4841SAndreas Gohr../../../bin/plugin.php dev test _test/GeneralTest.php 25719b4841SAndreas Gohr 26719b4841SAndreas Gohr# create a new test file 27719b4841SAndreas Gohr../../../bin/plugin.php dev addTest MyClass 28719b4841SAndreas Gohr``` 29719b4841SAndreas Gohr 30719b4841SAndreas GohrDokuWiki provides useful helper methods for testing: 31719b4841SAndreas Gohr 32719b4841SAndreas Gohr* `DokuWikiTest::getInaccessibleProperty()` to access private/protected properties 33719b4841SAndreas Gohr* `DokuWikiTest::callInaccessibleMethod` to execute private/protected methods 34719b4841SAndreas Gohr* read `../../../_test/core/DokuWikiTest.php` for more helper methods 35719b4841SAndreas Gohr* use `../../../_test/TestRequest.php` to simulate HTTP requests for integration tests 36719b4841SAndreas Gohr* use `../../../_test/phpQuery-onefile.php` if you need to parse HTML in tests 37719b4841SAndreas Gohr 38719b4841SAndreas GohrEach test run will provide a fresh DokuWiki instance in a temporary directory via the default setupBeforeClass methods. 39719b4841SAndreas Gohr 40*1b4ead2dSAndreas Gohr**Important:** Test classes that need the plugin must set `protected $pluginsEnabled = ['@@PLUGIN_NAME@@'];` to enable it in the test environment. 41*1b4ead2dSAndreas Gohr 42*1b4ead2dSAndreas Gohr**Important:** `setUp()` and `tearDown()` methods must be `public` (not `protected`) to match the `DokuWikiTest` base class. 43*1b4ead2dSAndreas Gohr 44*1b4ead2dSAndreas Gohr 45*1b4ead2dSAndreas Gohr## Caching 46*1b4ead2dSAndreas Gohr 47*1b4ead2dSAndreas GohrDokuWiki may cache JavaScript, CSS and rendered output. To reset the cache just touch the config file 48*1b4ead2dSAndreas Gohr 49*1b4ead2dSAndreas Gohr```bash 50*1b4ead2dSAndreas Gohrtouch ../../../conf/local.php 51*1b4ead2dSAndreas Gohr``` 52*1b4ead2dSAndreas Gohr 53719b4841SAndreas Gohr## Linting, Formatting and Conventions 54719b4841SAndreas Gohr 55719b4841SAndreas GohrAdhere to PSR-12 coding standards. Always add proper docblocks with descriptions, parameter types, and return types to all classes, methods and functions. 56719b4841SAndreas Gohr 57719b4841SAndreas Gohr```bash 58719b4841SAndreas Gohr# Lint PHP files using PHP_CodeSniffer (must be run from repo root) 59719b4841SAndreas Gohr../../../bin/plugin.php dev check 60719b4841SAndreas Gohr 61719b4841SAndreas Gohr# Auto-Fix formatting issues using PHP_CBF and Rector (must be run from repo root) 62719b4841SAndreas Gohr../../../bin/plugin.php dev fix 63719b4841SAndreas Gohr``` 64719b4841SAndreas Gohr 65719b4841SAndreas Gohr## Plugin Architecture 66719b4841SAndreas Gohr 67719b4841SAndreas GohrInspect the base plugin classes in `../../../inc/Extension/` to learn about the plugin system architecture. 68719b4841SAndreas Gohr 69719b4841SAndreas Gohr```bash 70719b4841SAndreas Gohr# add new plugin components (must be run from repo root) 71719b4841SAndreas Gohr../../../bin/plugin.php dev addComponent <type> 72719b4841SAndreas Gohr# e.g. 73719b4841SAndreas Gohr../../../bin/plugin.php dev addComponent action 74719b4841SAndreas Gohr# if multiple of the same type are needed, give a name: 75719b4841SAndreas Gohr../../../bin/plugin.php dev addComponent action foobar 76719b4841SAndreas Gohr# -> creates action/foobar.php 77719b4841SAndreas Gohr``` 78719b4841SAndreas Gohr 79719b4841SAndreas GohrAdditional classes are autoloaded when using the `dokuwiki\plugin\@@PLUGIN_NAME@@` namespace. 80