{ "$schema": "https://raw.githubusercontent.com/machanism-org/bindex-core/refs/heads/main/src/main/resources/schema/bindex-schema-v2.json", "id": "org.machanism.machai:gw-maven-plugin:1.4.2", "name": "org.machanism.machai:gw-maven-plugin", "version": "1.4.2", "location": { "repositoryType": "Maven", "repositoryUrl": "https://central.sonatype.com/artifact/org.machanism.machai/gw-maven-plugin", "coordinates": { "group": "org.machanism.machai", "artifactId": "gw-maven-plugin", "version": "1.4.2", "extension": "jar" } }, "description": "GW Maven Plugin is a Java 8 Maven plugin that connects Maven projects to the Machai Ghostwriter AI-assisted guided file-processing workflow. It scans selected project content for embedded guidance comments or executes a named act or direct prompt. The plugin supplies four Maven goals for project-wide and reactor-module workflows: gw:gw, gw:act, gw:gw-per-module, and gw:act-per-module. It resolves Maven project, module, settings, dependency, and parallel-build context; accepts paths, exclusions, additional instructions, provider/model settings, acts, and configuration inputs; and can obtain provider credentials from Maven settings. It also exposes Java class discovery and reflection tools that locate classes by simple-name regular expression and return declared member, annotation, source, classpath, and Maven-artifact metadata. It is intended for documentation maintenance, source and configuration analysis, repeatable guided transformations, and Maven-integrated AI automation.", "authors": [ { "name": "Machanism", "website": "https://machai.machanism.org/" } ], "license": "Apache License, Version 2.0", "classification": { "type": "Maven plugin", "domains": [ "Developer Tools", "Build Automation", "Documentation Automation", "Artificial Intelligence", "Source Code Analysis" ], "languages": [ { "name": "Java", "version": "8" } ], "layers": [ "Infrastructure", "Adapters", "Utils" ], "usageContext": [ "Maven builds", "Guided file processing", "AI-assisted documentation generation", "Multi-module Java projects", "Classpath introspection" ], "targetEnvironment": [ "Java", "Maven" ], "integrations": [ "Machai Ghostwriter", "Maven settings.xml" ] }, "constructors": [ { "package": "org.machanism.machai.gw.maven.tools", "signature": "public org.machanism.machai.gw.maven.tools.ClassFunctionalTools(org.apache.maven.project.MavenProject project)", "description": "Creates class-discovery tools and registers the supplied Maven project. The project compile classpath and output directories are used for subsequent class lookup and reflective inspection.", "examples": [ { "snippet": "org.apache.maven.project.MavenProject project = obtainMavenProject();\norg.machanism.machai.gw.maven.tools.ClassFunctionalTools tools = new org.machanism.machai.gw.maven.tools.ClassFunctionalTools(project);", "description": "Create the integration with the current MavenProject before requesting class discovery or class metadata. The obtainMavenProject helper represents Maven-plugin context supplied by the caller." } ] }, { "package": "org.machanism.machai.gw.maven.tools", "signature": "public org.machanism.machai.gw.maven.tools.ClassFunctionalTools()", "description": "Creates an empty class-tool registry. Register each Maven project with scanProjectClasses before calling findClass or getClassInfo.", "examples": [ { "snippet": "org.machanism.machai.gw.maven.tools.ClassFunctionalTools tools = new org.machanism.machai.gw.maven.tools.ClassFunctionalTools();\ntools.scanProjectClasses(project);", "description": "Use the empty constructor when one tool instance must serve several Maven projects, then register the active project explicitly." } ] }, { "package": "org.machanism.machai.gw.maven.tools", "signature": "public org.machanism.machai.gw.maven.tools.ClassInfoHolder(org.apache.maven.project.MavenProject project)", "description": "Creates metadata storage for one Maven project. The holder builds a project-aware URL class loader and resolves visible classes, source files, output paths, and dependency artifact coordinates.", "examples": [ { "snippet": "org.machanism.machai.gw.maven.tools.ClassInfoHolder holder = new org.machanism.machai.gw.maven.tools.ClassInfoHolder(project);\njava.lang.Class type = holder.loadClass(\"com.example.orders.OrderService\");", "description": "Create a holder for a Maven project and load a known fully qualified application class from its configured classpath." } ] } ], "features": [ { "package": "org.machanism.machai.gw.maven", "name": "gw:gw", "signature": "public void org.machanism.machai.gw.maven.GWMojo.execute() throws org.apache.maven.plugin.MojoExecutionException", "description": "Runs the aggregator guidance workflow. It creates a Ghostwriter GuidanceProcessor, derives effective Maven and provider configuration, scans the selected project content for guidance comments, and supports project-wide, multi-module, and parallel execution.", "examples": [ { "snippet": "\n org.machanism.machai\n gw-maven-plugin\n 1.4.2\n \n your-provider:model\n src/main/java\n docs/guidance.md\n \n\n\nmvn gw:gw -Dgw.path=src/main/java -Dgw.excludes=target", "description": "Step 1: add the plugin to the Maven build. Step 2: configure a provider/model and the source path or instruction file. Step 3: run gw:gw from the project root to process guidance-bearing Java files while skipping build output." } ] }, { "package": "org.machanism.machai.gw.maven", "name": "gw:act", "signature": "public void org.machanism.machai.gw.maven.ActMojo.execute() throws org.apache.maven.plugin.MojoExecutionException", "description": "Runs an explicit Ghostwriter act or prompt. The aggregator act workflow supports selected files or paths, named act definitions, instructions, exclusions, Maven settings credentials, and reverse module ordering with submodules processed before parents.", "examples": [ { "snippet": "mvn org.machanism.machai:gw-maven-plugin:1.4.2:act -Dgw.act=review\nmvn gw:act -Dgw.act='>Update public API documentation' -Dgw.path=src/main/java\nmvn gw:act -Dgw.acts=.ghostwriter/acts -Dgw.act=review", "description": "Step 1: invoke the installed plugin by coordinates, or configure it in the build for the short goal form. Step 2: provide a named act, or prefix a prompt-only act with >. Step 3: optionally point gw.acts at local act definitions and restrict processing with gw.path." } ] }, { "package": "org.machanism.machai.gw.maven.tools", "name": "find_class", "signature": "public java.util.List org.machanism.machai.gw.maven.tools.ClassFunctionalTools.findClass(java.lang.String className, java.io.File projectDir)", "description": "Finds fully qualified Java class names whose simple names completely match a regular expression. The lookup uses the registered Maven project's compile classpath and output directories and rejects result sets larger than ten entries.", "examples": [ { "snippet": "java.util.List matches = tools.findClass(\".*Service\", project.getBasedir());", "description": "After registering the Maven project, search for service classes without knowing their packages. Pass an exact returned fully qualified name to getClassInfo." } ] }, { "package": "org.machanism.machai.gw.maven.tools", "name": "get_class_info", "signature": "public java.util.Map org.machanism.machai.gw.maven.tools.ClassFunctionalTools.getClassInfo(java.lang.String className, java.io.File projectDir) throws java.lang.ClassNotFoundException", "description": "Loads a fully qualified class through the registered project's class loader and returns structured metadata for modifiers, direct superclass and interfaces, declared non-private fields and methods, constructors, annotations, source path, classpath location, and dependency artifact.", "examples": [ { "snippet": "java.util.Map info = tools.getClassInfo(\"com.example.orders.OrderService\", project.getBasedir());\njava.lang.Object methods = info.get(\"methods\");", "description": "Inspect a discovered application class and use the methods property to document or analyze its declared accessible API." } ] }, { "package": "org.machanism.machai.gw.maven.tools", "name": "scanProjectClasses", "signature": "public void org.machanism.machai.gw.maven.tools.ClassFunctionalTools.scanProjectClasses(org.apache.maven.project.MavenProject project)", "description": "Registers or refreshes class metadata for a Maven project base directory. Re-register a project after source, dependency, or build-output changes because discovery metadata is cached.", "examples": [ { "snippet": "tools.scanProjectClasses(project);\njava.util.List classes = tools.findClass(\"OrderController\", project.getBasedir());", "description": "Refresh class metadata after a build, then search the refreshed project registry for an exact controller simple name." } ] } ], "examples": [ { "title": "Install, configure, and run guidance processing", "steps": [ "Add org.machanism.machai:gw-maven-plugin:1.4.2 to the build plugins section of pom.xml.", "Configure the AI provider/model and, if needed, configure a Maven settings.xml server referenced by genai.serverId so credentials remain outside the project POM.", "Place guidance comments in project files and run mvn gw:gw with gw.path and gw.excludes appropriate to the target content.", "Review the generated changes, then run the normal Maven test lifecycle." ], "command": "mvn gw:gw -Dgw.path=src/main/java -Dgw.excludes=target -Dgenai.serverId=my-ai-provider" }, { "title": "Run a focused documentation act", "steps": [ "Configure the plugin and provider credentials as for guidance processing.", "Choose a predefined act name or supply a direct prompt prefixed with >.", "Run gw:act against the API source directory and inspect the resulting documentation changes.", "Use Maven parallel execution only when project workflow and provider capacity permit it." ], "command": "mvn -T 4 gw:act -Dgw.act='>Document public API methods' -Dgw.path=src/main/java" } ], "dependencies": [ "org.machanism.machai:ghostwriter:1.4.2", "org.apache.maven:maven-core", "org.apache.maven.plugin-tools:maven-plugin-annotations:3.15.2", "com.google.guava:guava", "org.apache.commons:commons-lang3", "org.apache.maven.shared:maven-shared-utils", "org.codehaus.plexus:plexus-interactivity-api:1.5.1" ] }