Add named local build variants
This commit is contained in:
@@ -82,6 +82,10 @@ pub fn main(init: std.process.Init) !u8 {
|
||||
return 69;
|
||||
}
|
||||
if (std.mem.eql(u8, arg, "mimctl")) {
|
||||
if (!profile.local_socket) {
|
||||
try printProfileStub(init.io, stderr, "mimctl");
|
||||
return 69;
|
||||
}
|
||||
const sub = args.next() orelse {
|
||||
try stderr.writeStreamingAll(init.io, "mim: mimctl requires a subcommand\n");
|
||||
return 64;
|
||||
@@ -101,6 +105,10 @@ pub fn main(init: std.process.Init) !u8 {
|
||||
}
|
||||
|
||||
if (std.mem.eql(u8, arg, "--mimctl")) {
|
||||
if (!profile.local_socket) {
|
||||
try printProfileStub(init.io, stderr, "mimctl");
|
||||
return 69;
|
||||
}
|
||||
const socket_path = args.next() orelse {
|
||||
try stderr.writeStreamingAll(init.io, "mim: --mimctl requires a socket path\n");
|
||||
return 64;
|
||||
@@ -152,6 +160,7 @@ fn printProfile(allocator: std.mem.Allocator, io: std.Io, stdout: std.Io.File) !
|
||||
|
||||
fn isProfileStub(arg: []const u8) bool {
|
||||
return std.mem.eql(u8, arg, "remote") or
|
||||
std.mem.eql(u8, arg, "mimctl") or
|
||||
std.mem.eql(u8, arg, "plugin") or
|
||||
std.mem.eql(u8, arg, "plugins") or
|
||||
std.mem.eql(u8, arg, "background-agent") or
|
||||
@@ -243,6 +252,7 @@ test "regular: help text names the binary and smoke boundary" {
|
||||
|
||||
test "regular: excluded profile capabilities have explicit stubs" {
|
||||
try std.testing.expect(isProfileStub("remote"));
|
||||
try std.testing.expect(isProfileStub("mimctl"));
|
||||
try std.testing.expect(isProfileStub("plugin"));
|
||||
try std.testing.expect(isProfileStub("background-agent"));
|
||||
try std.testing.expect(!isProfileStub("context"));
|
||||
|
||||
+8
-7
@@ -1,4 +1,5 @@
|
||||
const std = @import("std");
|
||||
const build_options = @import("build_options");
|
||||
|
||||
// Explicit v1 build/profile fences.
|
||||
// req: governance/002, governance/003, testing/001, testing/002
|
||||
@@ -7,12 +8,12 @@ test {
|
||||
_ = statusAlloc;
|
||||
}
|
||||
|
||||
pub const active_profile = "dev-local";
|
||||
pub const local_socket = true;
|
||||
pub const remote_transport_built = false;
|
||||
pub const plugin_host_built = false;
|
||||
pub const bundled_pi_built = false;
|
||||
pub const background_agent_built = false;
|
||||
pub const active_profile = build_options.active_profile;
|
||||
pub const local_socket = build_options.local_socket;
|
||||
pub const remote_transport_built = build_options.remote_transport_built;
|
||||
pub const plugin_host_built = build_options.plugin_host_built;
|
||||
pub const bundled_pi_built = build_options.bundled_pi_built;
|
||||
pub const background_agent_built = build_options.background_agent_built;
|
||||
|
||||
pub fn statusAlloc(allocator: std.mem.Allocator) ![]u8 {
|
||||
var out = std.ArrayList(u8).empty;
|
||||
@@ -24,7 +25,7 @@ pub fn statusAlloc(allocator: std.mem.Allocator) ![]u8 {
|
||||
try appendKV(allocator, &out, "plugin_host", if (plugin_host_built) "built" else "not_built");
|
||||
try appendKV(allocator, &out, "bundled_pi", if (bundled_pi_built) "built" else "not_built");
|
||||
try appendKV(allocator, &out, "background_agent", if (background_agent_built) "built" else "not_built");
|
||||
try appendKV(allocator, &out, "tool_mutation", "protocol_logged");
|
||||
try appendKV(allocator, &out, "tool_mutation", build_options.tool_mutation);
|
||||
return out.toOwnedSlice(allocator);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user