Class HashGeneratorMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.intsof.ai.build.integrity.HashGeneratorMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="generate-hashes", defaultPhase=VALIDATE, requiresProject=true) public class HashGeneratorMojo extends org.apache.maven.plugin.AbstractMojoGenerates companion hash files for AI instruction resources (e.g. AGENTS.md, SKILL.md).This mojo walks a base directory using NIO
Files.walkFileTree, finds files matching the configured include globs, and writes a companion hash sidecar file alongside each matched file. The hash captures the file content at build time so that the verify mojo can later detect any unauthorized modifications.Security rationale: AI agent instructions must not change after the build begins or after the artifact is shipped. Generating hashes at build time creates a tamper-evident seal on all instruction files.
Performance: Uses
Files.walkFileTreefor a single-pass directory traversal with directory pruning, a 64 KiB streaming hash buffer, and a lookup-table hex encoder. Handles both single-module projects and large multi-module projects efficiently.
-
-
Constructor Summary
Constructors Constructor Description HashGeneratorMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()
-