chore: single-source working state from agent events

This commit is contained in:
Peter Steinberger
2025-12-09 01:17:01 +01:00
parent 5b5a79b90b
commit f965e1c3ff
5 changed files with 28 additions and 73 deletions

View File

@@ -1,3 +1,4 @@
import Darwin
import Foundation
import Testing
@testable import Clawdis
@@ -35,8 +36,20 @@ import Testing
let nodePath = tmp.appendingPathComponent("node_modules/.bin/node")
let scriptPath = tmp.appendingPathComponent("bin/clawdis.js")
try makeExec(at: nodePath)
try "#!/bin/sh\necho v22.0.0\n".write(to: nodePath, atomically: true, encoding: .utf8)
try FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: nodePath.path)
try makeExec(at: scriptPath)
let previous = getenv("CLAWDIS_RUNTIME").flatMap { String(validatingCString: $0) }
setenv("CLAWDIS_RUNTIME", "node", 1)
defer {
if let previous {
setenv("CLAWDIS_RUNTIME", previous, 1)
} else {
unsetenv("CLAWDIS_RUNTIME")
}
}
let cmd = CommandResolver.clawdisCommand(subcommand: "rpc")
#expect(cmd.count >= 3)