build / jvm (push) Waiting to run
build / native (macos-15, macos-arm64) (push) Waiting to run
build / native (ubuntu-24.04, linux-x86_64) (push) Waiting to run
build / native (windows-2025, windows-x86_64) (push) Waiting to run
Test / Tests and coverage
Intrepid/AI Engineering/pipeline/head This commit looks good
Keep Spring in a persistent project server with lightweight clients, managed start/stop, bounded SSE subscriptions, cursor recovery and durable mutation outcomes. Preserve SQLite authority and transaction limits, and document reproducible native measurements. Validation: 269 tests, 11 pipeline scenarios, full native/SSE smoke, native package verification and 17 installer tests passed. Implements WRK-000E / DEC-0001 / DEC-0002.
33 lines
1.8 KiB
Java
33 lines
1.8 KiB
Java
package net.intrepid.aiengineering.localserver;
|
|
|
|
import picocli.CommandLine;
|
|
import java.util.*;
|
|
|
|
/** Routing comes from the actual Picocli parse, never from scanning option values for keywords. */
|
|
public final class InvocationPolicy {
|
|
private InvocationPolicy() {}
|
|
private static final Set<String> LOCAL = Set.of("init", "guide", "agent list", "agent doctor");
|
|
private static final Set<String> READS = Set.of(
|
|
"status", "next-actions", "project show", "project validate", "project compatibility", "repo list",
|
|
"work show", "work list", "work context", "work check", "work validate",
|
|
"discussion list", "discussion show", "decision list", "decision show", "decision history",
|
|
"plan list", "plan show", "plan history", "plan experiment list", "plan experiment show",
|
|
"artifact list", "topic list", "topic show", "survey list", "survey show", "survey history",
|
|
"agent show", "agent history", "epic show", "epic check", "epic history", "gate status", "gate history");
|
|
public static String path(CommandLine.ParseResult parse) {
|
|
var parts = new ArrayList<String>();
|
|
for (var child = parse.subcommand(); child != null; child = child.subcommand())
|
|
parts.add(child.commandSpec().name());
|
|
return String.join(" ", parts);
|
|
}
|
|
public static boolean local(CommandLine.ParseResult parse) {
|
|
if (path(parse).isEmpty() || LOCAL.contains(path(parse))) return true;
|
|
for (var current = parse; current != null; current = current.subcommand())
|
|
if (current.isUsageHelpRequested() || current.isVersionHelpRequested()) return true;
|
|
return false;
|
|
}
|
|
public static boolean readOnly(CommandLine.ParseResult parse) {
|
|
return READS.contains(path(parse)); // Unknown/new commands conservatively count as mutations.
|
|
}
|
|
}
|