feat: add protocol compatibility diagnostics and historical readers

This commit is contained in:
2026-11-16 10:13:05 +00:00
parent a8a8faf5d8
commit f10c237d44
48 changed files with 1382 additions and 13 deletions
@@ -17,7 +17,7 @@ import java.nio.file.Files;
import java.util.List;
@Command(name = "ai-engineering", description = "Portable engineering protocol for humans and AI agents.",
mixinStandardHelpOptions = true, version = "ai-engineering 0.1.0")
mixinStandardHelpOptions = true, version = "ai-engineering " + ProtocolContract.CLI_VERSION)
public final class EngineeringCli implements Runnable {
private final Path cwd;
private final ProjectService projects = new ProjectService();
@@ -55,7 +55,10 @@ public final class EngineeringCli implements Runnable {
command.getSubcommands().values().forEach(child -> configure(child, out, err));
}
@Override public void run() { commandLine.usage(output); }
private Path root() { return projects.discover(cwd, project == null ? null : resolve(project)); }
private Path discoveredRoot() { return projects.discover(cwd, project == null ? null : resolve(project)); }
private Path root() {
Path root = discoveredRoot(); ProtocolGuide.requireSupportedVersion(root); return root;
}
private Path resolve(Path path) { return path.isAbsolute() ? path : cwd.resolve(path); }
enum Format { markdown, json }
private int emit(Object value, Format format) {
@@ -123,6 +126,12 @@ public final class EngineeringCli implements Runnable {
@Option(names = "--format", defaultValue = "markdown") Format format) { return emit(verification.nextActions(root(), id), format); }
@Command(name = "project", mixinStandardHelpOptions = true, description = "Inspect and validate the engineering project.")
public class ProjectCommands {
@Command(name = "compatibility", mixinStandardHelpOptions = true,
description = "Inspect contract and stored formats without writing or migrating historical Works.")
int compatibility(@Option(names = "--format", defaultValue = "markdown") Format format) {
var result = new CompatibilityService().inspect(discoveredRoot());
emit(result, format); return result.readable() ? 0 : 4;
}
@Command(name = "show", mixinStandardHelpOptions = true)
int show(@Option(names = "--format", defaultValue = "markdown") Format format) { return emit(projects.load(root()), format); }
@Command(name = "validate", mixinStandardHelpOptions = true)