graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
test: prove local-tool exec and skip posix chdir cases on Windows
Cursor Agent03f219e8da14
diff --git a/src/libgraff.zig b/src/libgraff.zigindex 0abc696b..28ffebee 100644--- a/src/libgraff.zig+++ b/src/libgraff.zig@@ -99,6 +99,8 @@ test "C ABI create / feed speaks ACP without a child process" {const init_out = graff_acp_out_ptr()[0..graff_acp_out_len()];try std.testing.expect(std.mem.indexOf(u8, init_out, "\"protocolVersion\":1") != null);try std.testing.expect(std.mem.indexOf(u8, init_out, "\"name\":\"graff\"") != null);+ try std.testing.expect(std.mem.indexOf(u8, init_out, "graff-login") != null);+ try std.testing.expect(std.mem.indexOf(u8, init_out, "\"type\":\"terminal\"") != null);graff_acp_out_consume();const new_line = "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"session/new\"}";diff --git a/src/local_tools.zig b/src/local_tools.zigindex 8fdfa251..dbb83f4a 100644--- a/src/local_tools.zig+++ b/src/local_tools.zig@@ -2,10 +2,11 @@//! this is the executable half: `.graff/tools/<name>/` with a manifest +//! script, validated at install, registered on every later session.//!-//! Runner is a subprocess speaking a one-shot JSON contract (stdin args,-//! stdout text or `{"text","is_error"}`). Not MCP, not a skill.+//! Runner is a subprocess speaking a one-shot JSON contract (JSON args as+//! argv, stdout text or `{"text","is_error"}`). Not MCP, not a skill.const std = @import("std");+const builtin = @import("builtin");const Io = std.Io;const Allocator = std.mem.Allocator;const Value = std.json.Value;@@ -234,6 +235,7 @@ test "nameOk / runnerOk / entryOk / schemaOk" {}test "install then load registers local__name" {+ if (builtin.os.tag == .windows) return error.SkipZigTest;const io = std.testing.io;const gpa = std.testing.allocator;var tmp = std.testing.tmpDir(.{});@@ -275,3 +277,34 @@ test "install then load registers local__name" {try std.testing.expect(g_loaded[0].entry_path.len > 0);g_loaded = &.{};}++test "exec runs the script and returns stdout" {+ if (builtin.os.tag == .windows) return error.SkipZigTest;+ const io = std.testing.io;+ const gpa = std.testing.allocator;+ var tmp = std.testing.tmpDir(.{});+ defer tmp.cleanup();+ try tmp.dir.writeFile(io, .{ .sub_path = "run.sh", .data = "printf '%s' \"$1\"\n" });+ var path_buf: [std.fs.max_path_bytes]u8 = undefined;+ const n = try tmp.dir.realPath(io, &path_buf);+ const script = try std.fmt.allocPrint(gpa, "{s}/run.sh", .{path_buf[0..n]});+ defer gpa.free(script);+ var arena_state = std.heap.ArenaAllocator.init(gpa);+ defer arena_state.deinit();+ const arena = arena_state.allocator();+ const one = try arena.alloc(Installed, 1);+ one[0] = .{+ .spec = .{ .name = "local__ping", .desc = "ping", .schema = "{\"type\":\"object\"}" },+ .runner = "sh",+ .entry_path = script,+ };+ g_loaded = one;+ defer {+ g_loaded = &.{};+ }+ const input = try std.json.parseFromSliceLeaky(Value, arena, "{\"k\":1}", .{});+ const out = try exec(gpa, io, "local__ping", input);+ defer gpa.free(out.text);+ try std.testing.expect(!out.is_error);+ try std.testing.expect(std.mem.indexOf(u8, out.text, "k") != null);+}diff --git a/src/schedule.zig b/src/schedule.zigindex f96480c8..f6cb7dcc 100644--- a/src/schedule.zig+++ b/src/schedule.zig@@ -3,6 +3,7 @@//! job_notify. `/loop` stays the standing-goal controller; this is cron.const std = @import("std");+const builtin = @import("builtin");const Io = std.Io;const Allocator = std.mem.Allocator;const Value = std.json.Value;@@ -156,6 +157,7 @@ pub fn slashCommand(root: *Agent, arena: Allocator, line: []const u8, out: *Io.W}test "add then claimDue only yields past-due unclaimed records" {+ if (builtin.os.tag == .windows) return error.SkipZigTest;const io = std.testing.io;const gpa = std.testing.allocator;var tmp = std.testing.tmpDir(.{});@@ -196,6 +198,7 @@ pub fn takeWake(io: Io, buf: []u8) ?[]const u8 {}test "slashCommand and takeWake share the due-claim store" {+ if (builtin.os.tag == .windows) return error.SkipZigTest;const io = std.testing.io;const gpa = std.testing.allocator;var tmp = std.testing.tmpDir(.{});