Class AgentDocsResolvePlugin

java.lang.Object
io.github.duckasteroid.agentdocs.resolve.AgentDocsResolvePlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>

public class AgentDocsResolvePlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.Project>
Registers the agentDocs extension and resolveAgentDocs task.

For each direct dependency on the configured classpath, the task reads the Agent-Docs manifest attribute (per specification/java-conventions.md) from that dependency's own resolved jar. Dependencies without the attribute are skipped entirely, with no further resolution attempt of any kind. A classpath declaration is extracted directly from that same jar; a maven declaration is resolved as a separate agent-docs sidecar zip.

Gradle plugins applied via plugins {} are discovered separately (see AppliedPluginCollector), since they aren't resolved onto a project dependency configuration the way regular dependencies are — instead, each applied plugin's own class reveals the jar it was loaded from via its classloader. Only the classpath scheme is meaningful for plugins (a maven declaration is skipped with a warning, since it has no consumer-side resolution path), and the plugin id — recovered from that same jar's META-INF/gradle-plugins/ descriptors — stands in for the GAV a regular dependency would have.

When agentDocs.includeSources is true, the task also resolves the sources classifier jar for each declared dependency and unpacks it into a src/ subdirectory of the skill folder. The extracted SKILL.md frontmatter records metadata.sources: src/ when sources are available, or metadata.sources: none when the sources jar is absent from the repository (always none for plugin-sourced skills, since there's no Maven coordinate to resolve a sources jar from).

The task is intentionally configured to run on every invocation so dependency, plugin, and skill-folder clean-up stays current as dependencies and applied plugins change.

  • Constructor Details

    • AgentDocsResolvePlugin

      public AgentDocsResolvePlugin()
  • Method Details

    • apply

      public void apply(org.gradle.api.Project project)
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.Project>