Skip to main content
Every Klyx extension must declare a plugin entry class annotated with @PluginManifest. The Klyx Kotlin compiler plugin reads this annotation at compile time, validates it, and generates the plugin.json descriptor and a PluginDescriptor companion property for you automatically. You never hand-author plugin.json — it is generated from the annotation.

Declaration

Annotate your KlyxPlugin implementation class:

Author annotation

The Author annotation provides information about the plugin’s author:
The Links annotation provides useful links associated with the extension:

Field reference

id (required)

Unique plugin identifier in reverse-DNS notation. Must match the regex pattern of lowercase letters, digits, dots, and hyphens, starting with a letter.

version (default: "0.1.0")

Semantic version string. Klyx uses this to determine if an update is available.

name (default: "<auto>", falls back to id)

Human-readable display name shown in Klyx’s plugin manager. If left blank or set to "<auto>", it defaults to the id.

minAppVersion (default: "4.2.0")

The minimum version of Klyx required to run this extension. Must be a valid semver string. Version 4.2.0 introduced the plugin system.

maxAppVersion (default: "", meaning no upper limit)

If set, the extension will not load on newer versions of Klyx. Use this when a Klyx major version breaks your extension’s API. Must be a valid semver string if non-empty.

description (default: "")

A short description of what the extension does.

icon (default: "")

Path (relative to the project root) to the plugin’s icon file. The Gradle plugin can auto-detect icon.png or icon.jpg from the project root if this is left blank.

license (default: "")

SPDX license identifier or a short license name.

author (default: Author(name = ""))

Information about the extension author. See the Author annotation above. The name field is required if the author annotation is present. Useful links related to the extension. See the Links annotation above. All fields are optional.

permissions (default: [])

A list of permission strings the extension requires. Currently reserved for future use.

Compile-time validation

The Klyx compiler plugin validates the @PluginManifest annotation at compile time and reports errors as compile errors (not runtime failures). It checks:

Generated artifacts

After compilation, the following is generated in build/klyx/generated/:
  1. plugin.json — A JSON file consumed by the Klyx Gradle plugin when assembling the .klyx bundle
  2. PluginDescriptor companion property — Accessible as MyExtension.descriptor, this is a PluginDescriptor instance that the PluginManager can read at runtime for integrity verification. The compiled descriptor is compared against the plugin.json from the bundle to detect tampering or corruption.

Example

Here is an example of using @PluginManifest on a plugin entry class: