refactor: rename clawdbot to moltbot with legacy compat

This commit is contained in:
Peter Steinberger
2026-01-27 12:19:58 +00:00
parent 83460df96f
commit 6d16a658e5
1839 changed files with 11250 additions and 11199 deletions

View File

@@ -1,18 +1,18 @@
import Foundation
import Testing
@testable import Clawdbot
@testable import Moltbot
@Suite(.serialized)
struct ClawdbotConfigFileTests {
struct MoltbotConfigFileTests {
@Test
func configPathRespectsEnvOverride() async {
let override = FileManager().temporaryDirectory
.appendingPathComponent("clawdbot-config-\(UUID().uuidString)")
.appendingPathComponent("clawdbot.json")
.appendingPathComponent("moltbot-config-\(UUID().uuidString)")
.appendingPathComponent("moltbot.json")
.path
await TestIsolation.withEnvValues(["CLAWDBOT_CONFIG_PATH": override]) {
#expect(ClawdbotConfigFile.url().path == override)
#expect(MoltbotConfigFile.url().path == override)
}
}
@@ -20,22 +20,22 @@ struct ClawdbotConfigFileTests {
@Test
func remoteGatewayPortParsesAndMatchesHost() async {
let override = FileManager().temporaryDirectory
.appendingPathComponent("clawdbot-config-\(UUID().uuidString)")
.appendingPathComponent("clawdbot.json")
.appendingPathComponent("moltbot-config-\(UUID().uuidString)")
.appendingPathComponent("moltbot.json")
.path
await TestIsolation.withEnvValues(["CLAWDBOT_CONFIG_PATH": override]) {
ClawdbotConfigFile.saveDict([
MoltbotConfigFile.saveDict([
"gateway": [
"remote": [
"url": "ws://gateway.ts.net:19999",
],
],
])
#expect(ClawdbotConfigFile.remoteGatewayPort() == 19999)
#expect(ClawdbotConfigFile.remoteGatewayPort(matchingHost: "gateway.ts.net") == 19999)
#expect(ClawdbotConfigFile.remoteGatewayPort(matchingHost: "gateway") == 19999)
#expect(ClawdbotConfigFile.remoteGatewayPort(matchingHost: "other.ts.net") == nil)
#expect(MoltbotConfigFile.remoteGatewayPort() == 19999)
#expect(MoltbotConfigFile.remoteGatewayPort(matchingHost: "gateway.ts.net") == 19999)
#expect(MoltbotConfigFile.remoteGatewayPort(matchingHost: "gateway") == 19999)
#expect(MoltbotConfigFile.remoteGatewayPort(matchingHost: "other.ts.net") == nil)
}
}
@@ -43,20 +43,20 @@ struct ClawdbotConfigFileTests {
@Test
func setRemoteGatewayUrlPreservesScheme() async {
let override = FileManager().temporaryDirectory
.appendingPathComponent("clawdbot-config-\(UUID().uuidString)")
.appendingPathComponent("clawdbot.json")
.appendingPathComponent("moltbot-config-\(UUID().uuidString)")
.appendingPathComponent("moltbot.json")
.path
await TestIsolation.withEnvValues(["CLAWDBOT_CONFIG_PATH": override]) {
ClawdbotConfigFile.saveDict([
MoltbotConfigFile.saveDict([
"gateway": [
"remote": [
"url": "wss://old-host:111",
],
],
])
ClawdbotConfigFile.setRemoteGatewayUrl(host: "new-host", port: 2222)
let root = ClawdbotConfigFile.loadDict()
MoltbotConfigFile.setRemoteGatewayUrl(host: "new-host", port: 2222)
let root = MoltbotConfigFile.loadDict()
let url = ((root["gateway"] as? [String: Any])?["remote"] as? [String: Any])?["url"] as? String
#expect(url == "wss://new-host:2222")
}
@@ -65,15 +65,15 @@ struct ClawdbotConfigFileTests {
@Test
func stateDirOverrideSetsConfigPath() async {
let dir = FileManager().temporaryDirectory
.appendingPathComponent("clawdbot-state-\(UUID().uuidString)", isDirectory: true)
.appendingPathComponent("moltbot-state-\(UUID().uuidString)", isDirectory: true)
.path
await TestIsolation.withEnvValues([
"CLAWDBOT_CONFIG_PATH": nil,
"CLAWDBOT_STATE_DIR": dir,
]) {
#expect(ClawdbotConfigFile.stateDirURL().path == dir)
#expect(ClawdbotConfigFile.url().path == "\(dir)/clawdbot.json")
#expect(MoltbotConfigFile.stateDirURL().path == dir)
#expect(MoltbotConfigFile.url().path == "\(dir)/moltbot.json")
}
}
}