Package com.intsof.ai.build.integrity
Class HashVerifyMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.intsof.ai.build.integrity.HashVerifyMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="verify-hashes", defaultPhase=TEST, requiresProject=true) public class HashVerifyMojo extends org.apache.maven.plugin.AbstractMojoVerifies that AI instruction resource files have not been modified since their hashes were generated.This mojo finds all companion hash sidecar files under the base directory using NIO
Files.walkFileTree, recomputes the hash of the corresponding source file, and compares the two. If any mismatch is detected, the build fails with aMojoExecutionException.Security rationale: AI agent instructions must not change once a build has begun or after the artifact is shipped. This verification step ensures that no instruction file has been tampered with between the generate phase and the verification phase.
Performance: Uses
Files.walkFileTreefor a single-pass directory traversal with directory pruning. Handles both single-module projects and large multi-module projects efficiently.
-
-
Constructor Summary
Constructors Constructor Description HashVerifyMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()
-