GW Maven Plugin 1.1.4-SNAPSHOT API

GW Maven Plugin

Ghostwriter Maven Plugin is an advanced documentation automation tool for Java projects. It automatically scans, analyzes, and assembles project documentation using embedded guidance tags and AI-powered synthesis. The plugin streamlines the creation and maintenance of high-quality, consistent documentation, ensuring best practices and up-to-date information across all modules.

Purpose

GW Maven Plugin integrates the MachAI Ghostwriter guided document-processing workflow into a Maven build. It scans a configured directory tree for files containing embedded @guidance: blocks and applies guided, in-place updates.

How it fits into a build

The plugin contributes Maven goals (Mojos) that configure and invoke Ghostwriter processors. A typical execution:

  1. Select a scan root (commonly src/site).
  2. Walk the directory tree, applying configured excludes.
  3. Detect files that contain one or more @guidance: blocks.
  4. Compose effective instructions from embedded guidance and goal parameters.
  5. Invoke the Ghostwriter engine and apply updates to the scanned files.

Key concepts

Guidance blocks
Embedded @guidance: sections inside project files that define requirements and constraints for content generation or transformation.
Scan root
The directory tree searched for files containing guidance blocks. The scan root is configurable via goal parameters and/or system properties.
Processors
Ghostwriter engine components that interpret guidance blocks, invoke the configured GenAI provider, and apply updates to the scanned files.

Packages

org.machanism.machai.gw.maven

Maven plugin goals (Mojos) for running MachAI Ghostwriter (GW) guided document processing. The goals in this package provide Maven integrations around the Ghostwriter document-processing workflow. They scan documentation trees (commonly src/site) for embedded @guidance: blocks and apply guided transformations using the GW processors.

Goals

  • gw:gw (org.machanism.machai.gw.maven.GWMojo) — Aggregator goal that can run without a pom.xml. Processes modules in reverse order (sub-modules first, then parent modules), similar to the Ghostwriter CLI.
  • gw:gw-per-module (org.machanism.machai.gw.maven.GWPerModuleMojo) — Processes modules using standard Maven reactor dependency ordering.
  • gw:act (org.machanism.machai.gw.maven.ActMojo) — Interactive goal for running a predefined action prompt over scanned documents.
  • gw:act-per-module (org.machanism.machai.gw.maven.ActPerModuleMojo) — Reactor-friendly variant of gw:act intended to run in the execution-root project context.
  • gw:clean (org.machanism.machai.gw.maven.CleanMojo) — Deletes temporary artifacts created by GW processing (typically bound to Maven's clean lifecycle).

Credentials

Provider credentials can optionally be sourced from ~/.m2/settings.xml by providing -Dgenai.serverId=<serverId>. When set, the plugin reads the matching <server> entry and forwards credentials and/or additional configuration fields to the workflow.

Usage examples

mvn gw:gw
mvn gw:gw-per-module -Dgw.scanDir=src\\site

Class diagram

The following diagram summarizes the main goals and shared infrastructure.

Class diagram for GW Maven Plugin

Packages
Package
Description
Maven plugin goals (Mojos) for running MachAI Ghostwriter (GWMojo) guided document processing.
Provides helper types that expose Java class discovery and reflection metadata as function tools for the Ghostwriter Maven plugin.