From 162634cb7a8f094b87d1de5800d34e02de43412c Mon Sep 17 00:00:00 2001 From: slhx agent Date: Sun, 21 Jun 2026 05:23:11 +0200 Subject: [PATCH] Add server install verification steps --- AGENTS.md | 6 ++++++ INSTALL.md | 24 ++++++++++++++++++++++++ build.zig | 33 +++++++++++++++++++++++++++------ 3 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 INSTALL.md diff --git a/AGENTS.md b/AGENTS.md index 3fd3f50..efc88b4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,6 +37,12 @@ zig build test zig build run -- --help ``` +Canonical server install verification for a selected profile: + +```sh +zig build verify-install-code --prefix /tmp/mim-install +``` + ## Work tracking diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..9795b66 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,24 @@ +# Install mim on an SSH server + +`mim` is installed by copying one named local build profile to a server-side `bin/mim` path. There is no package manager integration, runtime config, plugin installer, or hidden bootstrap step. + +From a clean checkout on the target server: + +```sh +zig build install-code --prefix "$HOME/.local" +"$HOME/.local/bin/mim" --version +``` + +Choose the smallest profile that matches the server job: + +- `zig build install-min --prefix "$HOME/.local"` installs `mim-min` as `$HOME/.local/bin/mim`. +- `zig build install-code --prefix "$HOME/.local"` installs `mim-code` as `$HOME/.local/bin/mim`. +- `zig build install-full --prefix "$HOME/.local"` installs `mim-full` as `$HOME/.local/bin/mim`. + +For CI or agent verification without relying on the shell to execute the copied path directly, use the matching verification step: + +```sh +zig build verify-install-code --prefix /tmp/mim-install +``` + +That step installs the selected binary to `/tmp/mim-install/bin/mim` and runs the installed artifact with `--version`. diff --git a/build.zig b/build.zig index d53de2e..e3af08b 100644 --- a/build.zig +++ b/build.zig @@ -71,12 +71,8 @@ pub fn build(b: *std.Build) void { .root_module = profileModule(b, target, optimize, profile), }); b.installArtifact(profile_exe); - const run_profile = b.addRunArtifact(profile_exe); - run_profile.step.dependOn(b.getInstallStep()); - if (b.args) |args| run_profile.addArgs(args); - const step_name = if (std.mem.eql(u8, profile.exe_name, "mim-min")) "run-min" else if (std.mem.eql(u8, profile.exe_name, "mim-code")) "run-code" else "run-full"; - const run_profile_step = b.step(step_name, "Run profile variant"); - run_profile_step.dependOn(&run_profile.step); + addRunProfileStep(b, profile, profile_exe); + addServerInstallSteps(b, profile, profile_exe); } const run_cmd = b.addRunArtifact(exe); @@ -95,6 +91,31 @@ pub fn build(b: *std.Build) void { test_step.dependOn(&test_cmd.step); } +fn addRunProfileStep(b: *std.Build, profile: Profile, exe: *std.Build.Step.Compile) void { + const run_profile = b.addRunArtifact(exe); + run_profile.step.dependOn(b.getInstallStep()); + if (b.args) |args| run_profile.addArgs(args); + const step_name = if (std.mem.eql(u8, profile.exe_name, "mim-min")) "run-min" else if (std.mem.eql(u8, profile.exe_name, "mim-code")) "run-code" else "run-full"; + const run_profile_step = b.step(step_name, "Run profile variant"); + run_profile_step.dependOn(&run_profile.step); +} + +fn addServerInstallSteps(b: *std.Build, profile: Profile, exe: *std.Build.Step.Compile) void { + const suffix = if (std.mem.eql(u8, profile.exe_name, "mim-min")) "min" else if (std.mem.eql(u8, profile.exe_name, "mim-code")) "code" else "full"; + const install_name = b.fmt("install-{s}", .{suffix}); + const verify_name = b.fmt("verify-install-{s}", .{suffix}); + + const install_file = b.addInstallBinFile(exe.getEmittedBin(), "mim"); + const install_step = b.step(install_name, "Install selected profile binary as bin/mim"); + install_step.dependOn(&install_file.step); + + const installed_path = b.getInstallPath(.bin, "mim"); + const verify_cmd = b.addSystemCommand(&.{ installed_path, "--version" }); + verify_cmd.step.dependOn(&install_file.step); + const verify_step = b.step(verify_name, "Verify installed selected profile binary"); + verify_step.dependOn(&verify_cmd.step); +} + fn profileModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, profile: Profile) *std.Build.Module { const options = b.addOptions(); options.addOption([]const u8, "active_profile", profile.name);