Instructions for AI agents working in this repo.
Single-module Kotlin IntelliJ Platform plugin (ru.panteleev.bitrix-idea) for PhpStorm.
It creates Bitrix CMS module/template/component file sets and exposes the bundled Bitrix core
as a PHP library for navigation.
- Target platform: IntelliJ IDEA
2025.2.6.2(build 252), configured inbuild.gradle.kts. - Toolchain: JDK 21 (CI), Gradle wrapper 9.9.2, Kotlin 2.4.21, IntelliJ Platform Gradle Plugin 2.20.1.
- Kotlin package is
com.github.saundefined.bitrix_idea(underscore). Icons live in the top-leveliconspackage.
The Bitrix core is a git submodule:
git submodule update --init --recursivesrc/main/resources/bitrix-idea-library is the qq-agency/bxApiDocs submodule. It is bundled
into the plugin and registered via com.jetbrains.php <libraryRoot> in src/main/resources/META-INF/plugin.xml.
Do not edit or commit files inside it; update it by bumping the submodule pointer.
./gradlew runIde # launch sandbox IDE for manual testing
./gradlew buildPlugin # build installable ZIP in build/distributions/
./gradlew check # compile and run unit tests
./gradlew test # run unit tests only
./gradlew test -PpsiTests=true # also run PSI tests (downloads tests-bootstrap)
./gradlew test --tests 'com.github.saundefined.bitrix_idea.validation.ValidationTest'
./gradlew verifyPlugin # JetBrains plugin verifier (slow, downloads IDE builds)CI (build.yml calls the reusable .github/workflows/build-and-test.yml) validates the Gradle
wrapper, then runs ./gradlew buildPlugin check and ./gradlew verifyPlugin. Run these before
finishing a change. build/, .gradle/, .intellijPlatform/, .kotlin/, and .idea/ are ignored
build/IDE artifacts. There are no separate lint/format/typecheck tasks; Kotlin compilation is the
type check. Unit tests live in src/test/kotlin and use JUnit 4.
runIde starts IntelliJ IDEA, not PhpStorm, so PHP-specific behavior needs manual testing in PhpStorm.
The Bitrix core is attached via the platform AdditionalLibraryRootsProvider, so the provider is
evaluated per project rather than globally.
plugin.xml is the wiring point: actions, file-template groups, settings, and the startup
notification are all registered there. A new action/extension requires a plugin.xml entry.
Creation flow: CreateBitrixFileAction resolves the project and target directory, then calls
Create*Action.perform → Create*DialogWrapper → J2EE file templates. Dialogs extend
AbstractCreateDialogWrapper, which owns the shared fields and runs createFiles in a write action.
BitrixTemplateWriter creates files from a private copy of the IDE default properties. The language
editor is shared via ui/LocalizationTable, which is also used by the settings page.
File templates are coupled in two places and must stay in sync:
- Template file:
src/main/resources/fileTemplates/j2ee/<exact name>.ft(names include spaces and leading dots, e.g.Bitrix Module .settings.php.ft). - Constant in
templates/BitrixTemplateNames.kt, used by both the template group factories and the creation dialogs.
- Комментарии в коде (KDoc, строчные комментарии и комментарии в шаблонах) пишутся на русском.
- User-visible dialog/notification text goes through
BitrixIdeaBundle.message("key"); add keys tosrc/main/resources/messages/BitrixIdeaBundle.properties. Existing values use Unicode escapes (\u0415...) and are Russian. Action labels inplugin.xmlare inline Russian. - Settings are application-wide:
AppSettingsStateis an application service registered inplugin.xml, obtained viaAppSettingsState.getInstance(), and persisted under the nameTestBitrixIdeaSettingsPlugin.xml. - The bundled Bitrix library is attached when the project-level
PHP > Frameworks > Bitrixsetting is enabled. This is implemented bylibrary/BitrixLibraryRootsProvider; do not re-add a static<libraryRoot>toplugin.xml. The setting is persisted in.idea/bitrixIdea.xml; a startup notification offers to enable it whenbitrixorlocaldirectories are found anywhere in the project. - The ORM entity generator lives in
orm/(OrmEntityGeneratoris pure and unit-tested),dialogs/CreateOrmEntityDialogWrapper, and theBitrix ORM Entity.php.fttemplate. It supports scalar fields, Enum/Json/Array, and Reference/OneToMany/ManyToMany relations. ManyToMany requires a mediator table name. Namespace inference treatslocal/modulesandbitrix/modulesthe same: module codevendor.module->Vendor\Module,vendor->Vendor; the field remains editable. - Validation rules are plain Kotlin objects in
validation/(no platform dependencies) and are covered bysrc/test/kotlin/.../validation/ValidationTest.kt. - Do not hand-edit
since-build/until-buildinplugin.xml; the Gradle plugin injects them from the target platform. Change the platform version inbuild.gradle.ktsinstead.
- Version lives in
gradle.properties(version=2026.1.0). - Release notes come from the
## [Unreleased]section ofCHANGELOG.md; add entries there. - Pushing a tag matching
<version>orv<version>triggers.github/workflows/release.yml. The workflow validates that the tag matchesgradle.properties, then builds, verifies, and publishes a GitHub release frombuild/distributions/*.zip. - When the supported PhpStorm line changes, also update the version table in
README.md.