Package org.machanism.machai.gw.maven


package org.machanism.machai.gw.maven
Provides the Maven-plugin integration layer for Machai Ghostwriter.

This package adapts Maven goal execution to Ghostwriter's guidance and act processors. It binds Maven parameters and execution context, resolves provider configuration from properties files and Maven settings.xml, selects the project paths to process, and supplies Maven project metadata to the processor layer. The package is intentionally an integration boundary: Maven lifecycle concerns remain here, while file traversal and workflow execution remain in the Ghostwriter processor packages.

Goal architecture

AbstractGWMojo contains the shared configuration and scanning infrastructure. It accepts the model, path, instructions, excludes, server, settings, project, session, and configuration-file inputs; loads the selected properties file; optionally merges credentials and XML children from the selected Maven settings server; and finally applies explicit plugin parameters. Consequently, values supplied through params take precedence over values loaded earlier. It also registers ClassFunctionalTools when Maven supplies project context.

GWMojo and GWPerModuleMojo create GuidanceProcessor instances to find files containing Ghostwriter guidance comments and execute the associated workflows. The aggregator goal coordinates recursive project traversal itself, whereas the per-module goal disables nested processor traversal and lets Maven invoke the goal for each reactor module.

AbstractActMojo extends the shared infrastructure for explicit acts. It resolves an inline prompt or reusable act name, supports interactive multi-line input, applies the optional acts location, and delegates execution to ActProcessor. ActMojo exposes the aggregator gw:act goal. AbstractActPerModuleMojo provides the reactor-aware act behavior used by ActPerModuleMojo; that variant also suppresses nested module processing because Maven schedules the individual module executions.

Execution models

gw:gw and gw:act
Thread-safe aggregator goals that can be invoked for a project tree and do not require a pom.xml. Ghostwriter performs recursive traversal in reverse project order, processing child modules before their parents. When a Maven build is parallel, the aggregator processor coordinates its configured worker threads.
gw:gw-per-module and gw:act-per-module
Thread-safe, non-aggregator goals that require a Maven project. Maven invokes them for eligible reactor modules according to the reactor dependency order, and each goal processes its current module without recursively entering child modules.

Configuration

The shared goals support the Ghostwriter properties represented by gw.model, gw.path, gw.instructions, gw.excludes, genai.serverId, and gw.config. Act goals additionally support gw.act and gw.acts. A server identifier selects a matching Maven settings.xml server; its username, password, and custom XML child values are copied into the processor configuration. If no server identifier is supplied, the configured properties file is used, or the default Ghostwriter configuration is attempted. Plugin params are applied last.

Usage examples

# Scan guidance-bearing files in the main source tree.
mvn gw:gw -Dgw.path=src/main/java -Dgw.instructions=docs/guidance.md

# Execute an inline act or a reusable act definition.
mvn gw:act -Dgw.act="Add missing public API Javadocs"
mvn -T 4 gw:act -Dgw.acts=acts -Dgw.act=review

# Let Maven invoke a goal for each selected reactor module.
mvn gw:gw-per-module -Dgw.path=src/main/java
mvn gw:act-per-module -Dgw.act=review

# Resolve provider credentials from settings.xml.
mvn gw:gw -Dgenai.serverId=my-ai-provider
See Also:
  • Classes
    Class
    Description
    Abstract base Maven mojo for goals that execute Ghostwriter acts.
    Base Maven mojo for acts that execute once for every eligible module in a Maven reactor.
    Base class for Maven goals that scan project files for guidance comments and delegate processing to a GuidanceProcessor.
    Maven goal that executes a Ghostwriter act against project files.
    Maven goal gw:act-per-module that runs an action for an eligible project in Maven's standard reactor build context.
    Maven goal that scans project files for Ghostwriter guidance comments and executes the configured AI-assisted processing workflow.
    Maven goal that processes documents for the current Maven module.