chore: rename project to clawdbot
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
struct AgentWorkspaceTests {
|
||||
@@ -29,7 +29,7 @@ struct AgentWorkspaceTests {
|
||||
@Test
|
||||
func bootstrapCreatesAgentsFileWhenMissing() throws {
|
||||
let tmp = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-ws-\(UUID().uuidString)", isDirectory: true)
|
||||
.appendingPathComponent("clawdbot-ws-\(UUID().uuidString)", isDirectory: true)
|
||||
defer { try? FileManager.default.removeItem(at: tmp) }
|
||||
|
||||
let agentsURL = try AgentWorkspace.bootstrap(workspaceURL: tmp)
|
||||
@@ -52,7 +52,7 @@ struct AgentWorkspaceTests {
|
||||
@Test
|
||||
func bootstrapSafetyRejectsNonEmptyFolderWithoutAgents() throws {
|
||||
let tmp = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-ws-\(UUID().uuidString)", isDirectory: true)
|
||||
.appendingPathComponent("clawdbot-ws-\(UUID().uuidString)", isDirectory: true)
|
||||
defer { try? FileManager.default.removeItem(at: tmp) }
|
||||
try FileManager.default.createDirectory(at: tmp, withIntermediateDirectories: true)
|
||||
let marker = tmp.appendingPathComponent("notes.txt")
|
||||
@@ -70,7 +70,7 @@ struct AgentWorkspaceTests {
|
||||
@Test
|
||||
func bootstrapSafetyAllowsExistingAgentsFile() throws {
|
||||
let tmp = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-ws-\(UUID().uuidString)", isDirectory: true)
|
||||
.appendingPathComponent("clawdbot-ws-\(UUID().uuidString)", isDirectory: true)
|
||||
defer { try? FileManager.default.removeItem(at: tmp) }
|
||||
try FileManager.default.createDirectory(at: tmp, withIntermediateDirectories: true)
|
||||
let agents = tmp.appendingPathComponent(AgentWorkspace.agentsFilename)
|
||||
@@ -88,7 +88,7 @@ struct AgentWorkspaceTests {
|
||||
@Test
|
||||
func bootstrapSkipsBootstrapFileWhenWorkspaceHasContent() throws {
|
||||
let tmp = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-ws-\(UUID().uuidString)", isDirectory: true)
|
||||
.appendingPathComponent("clawdbot-ws-\(UUID().uuidString)", isDirectory: true)
|
||||
defer { try? FileManager.default.removeItem(at: tmp) }
|
||||
try FileManager.default.createDirectory(at: tmp, withIntermediateDirectories: true)
|
||||
let marker = tmp.appendingPathComponent("notes.txt")
|
||||
@@ -103,7 +103,7 @@ struct AgentWorkspaceTests {
|
||||
@Test
|
||||
func needsBootstrapFalseWhenIdentityAlreadySet() throws {
|
||||
let tmp = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-ws-\(UUID().uuidString)", isDirectory: true)
|
||||
.appendingPathComponent("clawdbot-ws-\(UUID().uuidString)", isDirectory: true)
|
||||
defer { try? FileManager.default.removeItem(at: tmp) }
|
||||
try FileManager.default.createDirectory(at: tmp, withIntermediateDirectories: true)
|
||||
let identityURL = tmp.appendingPathComponent(AgentWorkspace.identityFilename)
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,13 +1,13 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
struct AnthropicAuthResolverTests {
|
||||
@Test
|
||||
func prefersOAuthFileOverEnv() throws {
|
||||
let dir = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-oauth-\(UUID().uuidString)", isDirectory: true)
|
||||
.appendingPathComponent("clawdbot-oauth-\(UUID().uuidString)", isDirectory: true)
|
||||
try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
|
||||
let oauthFile = dir.appendingPathComponent("oauth.json")
|
||||
let payload = [
|
||||
@@ -21,7 +21,7 @@ struct AnthropicAuthResolverTests {
|
||||
let data = try JSONSerialization.data(withJSONObject: payload, options: [.prettyPrinted, .sortedKeys])
|
||||
try data.write(to: oauthFile, options: [.atomic])
|
||||
|
||||
let status = ClawdisOAuthStore.anthropicOAuthStatus(at: oauthFile)
|
||||
let status = ClawdbotOAuthStore.anthropicOAuthStatus(at: oauthFile)
|
||||
let mode = AnthropicAuthResolver.resolve(environment: [
|
||||
"ANTHROPIC_API_KEY": "sk-ant-ignored",
|
||||
], oauthStatus: status)
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
struct AnthropicOAuthCodeStateTests {
|
||||
@@ -1,8 +1,8 @@
|
||||
import ClawdisProtocol
|
||||
import ClawdbotProtocol
|
||||
import Foundation
|
||||
import Testing
|
||||
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct AnyCodableEncodingTests {
|
||||
@Test func encodesSwiftArrayAndDictionaryValues() throws {
|
||||
@@ -12,7 +12,7 @@ import Testing
|
||||
"null": NSNull(),
|
||||
]
|
||||
|
||||
let data = try JSONEncoder().encode(Clawdis.AnyCodable(payload))
|
||||
let data = try JSONEncoder().encode(Clawdbot.AnyCodable(payload))
|
||||
let obj = try #require(JSONSerialization.jsonObject(with: data) as? [String: Any])
|
||||
|
||||
#expect(obj["tags"] as? [String] == ["node", "ios"])
|
||||
@@ -25,7 +25,7 @@ import Testing
|
||||
"items": [1, "two", NSNull(), ["ok": true]],
|
||||
]
|
||||
|
||||
let data = try JSONEncoder().encode(ClawdisProtocol.AnyCodable(payload))
|
||||
let data = try JSONEncoder().encode(ClawdbotProtocol.AnyCodable(payload))
|
||||
let obj = try #require(JSONSerialization.jsonObject(with: data) as? [String: Any])
|
||||
|
||||
let items = try #require(obj["items"] as? [Any])
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
struct BridgeServerTests {
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -8,17 +8,17 @@ struct CLIInstallerTests {
|
||||
@Test func installedLocationOnlyAcceptsEmbeddedHelper() throws {
|
||||
let fm = FileManager.default
|
||||
let root = fm.temporaryDirectory.appendingPathComponent(
|
||||
"clawdis-cli-installer-\(UUID().uuidString)")
|
||||
"clawdbot-cli-installer-\(UUID().uuidString)")
|
||||
defer { try? fm.removeItem(at: root) }
|
||||
|
||||
let embedded = root.appendingPathComponent("Relay/clawdis")
|
||||
let embedded = root.appendingPathComponent("Relay/clawdbot")
|
||||
try fm.createDirectory(at: embedded.deletingLastPathComponent(), withIntermediateDirectories: true)
|
||||
fm.createFile(atPath: embedded.path, contents: Data())
|
||||
try fm.setAttributes([.posixPermissions: 0o755], ofItemAtPath: embedded.path)
|
||||
|
||||
let binDir = root.appendingPathComponent("bin")
|
||||
try fm.createDirectory(at: binDir, withIntermediateDirectories: true)
|
||||
let link = binDir.appendingPathComponent("clawdis")
|
||||
let link = binDir.appendingPathComponent("clawdbot")
|
||||
try fm.createSymbolicLink(at: link, withDestinationURL: embedded)
|
||||
|
||||
let found = CLIInstaller.installedLocation(
|
||||
@@ -28,7 +28,7 @@ struct CLIInstallerTests {
|
||||
#expect(found == link.path)
|
||||
|
||||
try fm.removeItem(at: link)
|
||||
let other = root.appendingPathComponent("Other/clawdis")
|
||||
let other = root.appendingPathComponent("Other/clawdbot")
|
||||
try fm.createDirectory(at: other.deletingLastPathComponent(), withIntermediateDirectories: true)
|
||||
fm.createFile(atPath: other.path, contents: Data())
|
||||
try fm.setAttributes([.posixPermissions: 0o755], ofItemAtPath: other.path)
|
||||
@@ -1,6 +1,6 @@
|
||||
import Testing
|
||||
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct CameraCaptureServiceTests {
|
||||
@Test func normalizeSnapDefaults() {
|
||||
@@ -1,4 +1,4 @@
|
||||
import ClawdisIPC
|
||||
import ClawdbotIPC
|
||||
import Foundation
|
||||
import Testing
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import Foundation
|
||||
import os
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized) struct CanvasFileWatcherTests {
|
||||
private func makeTempDir() throws -> URL {
|
||||
let base = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
|
||||
let dir = base.appendingPathComponent("clawdis-canvaswatch-\(UUID().uuidString)", isDirectory: true)
|
||||
let dir = base.appendingPathComponent("clawdbot-canvaswatch-\(UUID().uuidString)", isDirectory: true)
|
||||
try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
|
||||
return dir
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import ClawdisIPC
|
||||
import ClawdbotIPC
|
||||
import Foundation
|
||||
import Testing
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import AppKit
|
||||
import ClawdisIPC
|
||||
import ClawdbotIPC
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
struct CanvasWindowSmokeTests {
|
||||
@Test func panelControllerShowsAndHides() async throws {
|
||||
let root = FileManager.default.temporaryDirectory.appendingPathComponent("clawdis-canvas-test-\(UUID().uuidString)")
|
||||
let root = FileManager.default.temporaryDirectory.appendingPathComponent("clawdbot-canvas-test-\(UUID().uuidString)")
|
||||
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
|
||||
defer { try? FileManager.default.removeItem(at: root) }
|
||||
|
||||
@@ -30,7 +30,7 @@ struct CanvasWindowSmokeTests {
|
||||
}
|
||||
|
||||
@Test func windowControllerShowsAndCloses() async throws {
|
||||
let root = FileManager.default.temporaryDirectory.appendingPathComponent("clawdis-canvas-test-\(UUID().uuidString)")
|
||||
let root = FileManager.default.temporaryDirectory.appendingPathComponent("clawdbot-canvas-test-\(UUID().uuidString)")
|
||||
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
|
||||
defer { try? FileManager.default.removeItem(at: root) }
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
struct ClawdisConfigFileTests {
|
||||
struct ClawdbotConfigFileTests {
|
||||
@Test
|
||||
func configPathRespectsEnvOverride() {
|
||||
let override = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-config-\(UUID().uuidString)")
|
||||
.appendingPathComponent("clawdis.json")
|
||||
.appendingPathComponent("clawdbot-config-\(UUID().uuidString)")
|
||||
.appendingPathComponent("clawdbot.json")
|
||||
.path
|
||||
|
||||
self.withEnv("CLAWDIS_CONFIG_PATH", value: override) {
|
||||
#expect(ClawdisConfigFile.url().path == override)
|
||||
self.withEnv("CLAWDBOT_CONFIG_PATH", value: override) {
|
||||
#expect(ClawdbotConfigFile.url().path == override)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func stateDirOverrideSetsConfigPath() {
|
||||
let dir = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-state-\(UUID().uuidString)", isDirectory: true)
|
||||
.appendingPathComponent("clawdbot-state-\(UUID().uuidString)", isDirectory: true)
|
||||
.path
|
||||
|
||||
self.withEnv("CLAWDIS_CONFIG_PATH", value: nil) {
|
||||
self.withEnv("CLAWDIS_STATE_DIR", value: dir) {
|
||||
#expect(ClawdisConfigFile.stateDirURL().path == dir)
|
||||
#expect(ClawdisConfigFile.url().path == "\(dir)/clawdis.json")
|
||||
self.withEnv("CLAWDBOT_CONFIG_PATH", value: nil) {
|
||||
self.withEnv("CLAWDBOT_STATE_DIR", value: dir) {
|
||||
#expect(ClawdbotConfigFile.stateDirURL().path == dir)
|
||||
#expect(ClawdbotConfigFile.url().path == "\(dir)/clawdbot.json")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
struct ClawdisOAuthStoreTests {
|
||||
struct ClawdbotOAuthStoreTests {
|
||||
@Test
|
||||
func returnsMissingWhenFileAbsent() {
|
||||
let url = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-oauth-\(UUID().uuidString)")
|
||||
.appendingPathComponent("clawdbot-oauth-\(UUID().uuidString)")
|
||||
.appendingPathComponent("oauth.json")
|
||||
#expect(ClawdisOAuthStore.anthropicOAuthStatus(at: url) == .missingFile)
|
||||
#expect(ClawdbotOAuthStore.anthropicOAuthStatus(at: url) == .missingFile)
|
||||
}
|
||||
|
||||
@Test
|
||||
func usesEnvOverrideForClawdisOAuthDir() throws {
|
||||
let key = "CLAWDIS_OAUTH_DIR"
|
||||
func usesEnvOverrideForClawdbotOAuthDir() throws {
|
||||
let key = "CLAWDBOT_OAUTH_DIR"
|
||||
let previous = ProcessInfo.processInfo.environment[key]
|
||||
defer {
|
||||
if let previous {
|
||||
@@ -25,10 +25,10 @@ struct ClawdisOAuthStoreTests {
|
||||
}
|
||||
|
||||
let dir = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-oauth-\(UUID().uuidString)", isDirectory: true)
|
||||
.appendingPathComponent("clawdbot-oauth-\(UUID().uuidString)", isDirectory: true)
|
||||
setenv(key, dir.path, 1)
|
||||
|
||||
#expect(ClawdisOAuthStore.oauthDir().standardizedFileURL == dir.standardizedFileURL)
|
||||
#expect(ClawdbotOAuthStore.oauthDir().standardizedFileURL == dir.standardizedFileURL)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -42,7 +42,7 @@ struct ClawdisOAuthStoreTests {
|
||||
],
|
||||
])
|
||||
|
||||
#expect(ClawdisOAuthStore.anthropicOAuthStatus(at: url).isConnected)
|
||||
#expect(ClawdbotOAuthStore.anthropicOAuthStatus(at: url).isConnected)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -55,7 +55,7 @@ struct ClawdisOAuthStoreTests {
|
||||
],
|
||||
])
|
||||
|
||||
#expect(ClawdisOAuthStore.anthropicOAuthStatus(at: url).isConnected)
|
||||
#expect(ClawdbotOAuthStore.anthropicOAuthStatus(at: url).isConnected)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -68,7 +68,7 @@ struct ClawdisOAuthStoreTests {
|
||||
],
|
||||
])
|
||||
|
||||
#expect(ClawdisOAuthStore.anthropicOAuthStatus(at: url) == .missingProviderEntry)
|
||||
#expect(ClawdbotOAuthStore.anthropicOAuthStatus(at: url) == .missingProviderEntry)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -81,12 +81,12 @@ struct ClawdisOAuthStoreTests {
|
||||
],
|
||||
])
|
||||
|
||||
#expect(ClawdisOAuthStore.anthropicOAuthStatus(at: url) == .missingTokens)
|
||||
#expect(ClawdbotOAuthStore.anthropicOAuthStatus(at: url) == .missingTokens)
|
||||
}
|
||||
|
||||
private func writeOAuthFile(_ json: [String: Any]) throws -> URL {
|
||||
let dir = FileManager.default.temporaryDirectory
|
||||
.appendingPathComponent("clawdis-oauth-\(UUID().uuidString)", isDirectory: true)
|
||||
.appendingPathComponent("clawdbot-oauth-\(UUID().uuidString)", isDirectory: true)
|
||||
try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
|
||||
|
||||
let url = dir.appendingPathComponent("oauth.json")
|
||||
@@ -1,7 +1,7 @@
|
||||
import Darwin
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized) struct CommandResolverTests {
|
||||
private func makeDefaults() -> UserDefaults {
|
||||
@@ -24,18 +24,18 @@ import Testing
|
||||
try FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: path.path)
|
||||
}
|
||||
|
||||
@Test func prefersClawdisBinary() async throws {
|
||||
@Test func prefersClawdbotBinary() async throws {
|
||||
let defaults = self.makeDefaults()
|
||||
defaults.set(AppState.ConnectionMode.local.rawValue, forKey: connectionModeKey)
|
||||
|
||||
let tmp = try makeTempDir()
|
||||
CommandResolver.setProjectRoot(tmp.path)
|
||||
|
||||
let clawdisPath = tmp.appendingPathComponent("node_modules/.bin/clawdis")
|
||||
try self.makeExec(at: clawdisPath)
|
||||
let clawdbotPath = tmp.appendingPathComponent("node_modules/.bin/clawdbot")
|
||||
try self.makeExec(at: clawdbotPath)
|
||||
|
||||
let cmd = CommandResolver.clawdisCommand(subcommand: "gateway", defaults: defaults)
|
||||
#expect(cmd.prefix(2).elementsEqual([clawdisPath.path, "gateway"]))
|
||||
let cmd = CommandResolver.clawdbotCommand(subcommand: "gateway", defaults: defaults)
|
||||
#expect(cmd.prefix(2).elementsEqual([clawdbotPath.path, "gateway"]))
|
||||
}
|
||||
|
||||
@Test func fallsBackToNodeAndScript() async throws {
|
||||
@@ -46,13 +46,13 @@ import Testing
|
||||
CommandResolver.setProjectRoot(tmp.path)
|
||||
|
||||
let nodePath = tmp.appendingPathComponent("node_modules/.bin/node")
|
||||
let scriptPath = tmp.appendingPathComponent("bin/clawdis.js")
|
||||
let scriptPath = tmp.appendingPathComponent("bin/clawdbot.js")
|
||||
try self.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 self.makeExec(at: scriptPath)
|
||||
|
||||
let cmd = CommandResolver.clawdisCommand(
|
||||
let cmd = CommandResolver.clawdbotCommand(
|
||||
subcommand: "rpc",
|
||||
defaults: defaults,
|
||||
searchPaths: [tmp.appendingPathComponent("node_modules/.bin").path])
|
||||
@@ -75,9 +75,9 @@ import Testing
|
||||
let pnpmPath = tmp.appendingPathComponent("node_modules/.bin/pnpm")
|
||||
try self.makeExec(at: pnpmPath)
|
||||
|
||||
let cmd = CommandResolver.clawdisCommand(subcommand: "rpc", defaults: defaults)
|
||||
let cmd = CommandResolver.clawdbotCommand(subcommand: "rpc", defaults: defaults)
|
||||
|
||||
#expect(cmd.prefix(4).elementsEqual([pnpmPath.path, "--silent", "clawdis", "rpc"]))
|
||||
#expect(cmd.prefix(4).elementsEqual([pnpmPath.path, "--silent", "clawdbot", "rpc"]))
|
||||
}
|
||||
|
||||
@Test func pnpmKeepsExtraArgsAfterSubcommand() async throws {
|
||||
@@ -90,12 +90,12 @@ import Testing
|
||||
let pnpmPath = tmp.appendingPathComponent("node_modules/.bin/pnpm")
|
||||
try self.makeExec(at: pnpmPath)
|
||||
|
||||
let cmd = CommandResolver.clawdisCommand(
|
||||
let cmd = CommandResolver.clawdbotCommand(
|
||||
subcommand: "health",
|
||||
extraArgs: ["--json", "--timeout", "5"],
|
||||
defaults: defaults)
|
||||
|
||||
#expect(cmd.prefix(5).elementsEqual([pnpmPath.path, "--silent", "clawdis", "health", "--json"]))
|
||||
#expect(cmd.prefix(5).elementsEqual([pnpmPath.path, "--silent", "clawdbot", "health", "--json"]))
|
||||
#expect(cmd.suffix(2).elementsEqual(["--timeout", "5"]))
|
||||
}
|
||||
|
||||
@@ -112,17 +112,17 @@ import Testing
|
||||
defaults.set(AppState.ConnectionMode.remote.rawValue, forKey: connectionModeKey)
|
||||
defaults.set("clawd@example.com:2222", forKey: remoteTargetKey)
|
||||
defaults.set("/tmp/id_ed25519", forKey: remoteIdentityKey)
|
||||
defaults.set("/srv/clawdis", forKey: remoteProjectRootKey)
|
||||
defaults.set("/srv/clawdbot", forKey: remoteProjectRootKey)
|
||||
|
||||
let cmd = CommandResolver.clawdisCommand(subcommand: "status", extraArgs: ["--json"], defaults: defaults)
|
||||
let cmd = CommandResolver.clawdbotCommand(subcommand: "status", extraArgs: ["--json"], defaults: defaults)
|
||||
|
||||
#expect(cmd.first == "/usr/bin/ssh")
|
||||
#expect(cmd.contains("clawd@example.com"))
|
||||
#expect(cmd.contains("-i"))
|
||||
#expect(cmd.contains("/tmp/id_ed25519"))
|
||||
if let script = cmd.last {
|
||||
#expect(script.contains("cd '/srv/clawdis'"))
|
||||
#expect(script.contains("clawdis"))
|
||||
#expect(script.contains("cd '/srv/clawdbot'"))
|
||||
#expect(script.contains("clawdbot"))
|
||||
#expect(script.contains("status"))
|
||||
#expect(script.contains("--json"))
|
||||
#expect(script.contains("CLI="))
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -41,7 +41,7 @@ struct ConnectionsSettingsSmokeTests {
|
||||
status: 200,
|
||||
error: nil,
|
||||
elapsedMs: 120,
|
||||
bot: ProvidersStatusSnapshot.TelegramBot(id: 123, username: "clawdisbot"),
|
||||
bot: ProvidersStatusSnapshot.TelegramBot(id: 123, username: "clawdbotbot"),
|
||||
webhook: ProvidersStatusSnapshot.TelegramWebhook(
|
||||
url: "https://example.com/hook",
|
||||
hasCustomCert: false)),
|
||||
@@ -1,6 +1,6 @@
|
||||
import AppKit
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
struct CronModelsTests {
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
struct DeviceModelCatalogTests {
|
||||
@@ -5,7 +5,7 @@ import Testing
|
||||
@Test func sourcesAvoidLegacyNonThrowingFileHandleReadAPIs() throws {
|
||||
let testFile = URL(fileURLWithPath: #filePath)
|
||||
let packageRoot = testFile
|
||||
.deletingLastPathComponent() // ClawdisIPCTests
|
||||
.deletingLastPathComponent() // ClawdbotIPCTests
|
||||
.deletingLastPathComponent() // Tests
|
||||
.deletingLastPathComponent() // apps/macos
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct FileHandleSafeReadTests {
|
||||
@Test func readToEndSafelyReturnsEmptyForClosedHandle() {
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct GatewayAgentChannelTests {
|
||||
@Test func shouldDeliverBlocksWebChat() {
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
struct GatewayAutostartPolicyTests {
|
||||
@@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import os
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct GatewayConnectionTests {
|
||||
private final class FakeWebSocketTask: WebSocketTasking, @unchecked Sendable {
|
||||
@@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import os
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct GatewayChannelConnectTests {
|
||||
private enum FakeResponse {
|
||||
@@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import os
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct GatewayChannelRequestTests {
|
||||
private final class FakeWebSocketTask: WebSocketTasking, @unchecked Sendable {
|
||||
@@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import os
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct GatewayChannelShutdownTests {
|
||||
private final class FakeWebSocketTask: WebSocketTasking, @unchecked Sendable {
|
||||
@@ -1,6 +1,6 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import ClawdisIPC
|
||||
@testable import Clawdbot
|
||||
@testable import ClawdbotIPC
|
||||
|
||||
@Suite(.serialized) struct GatewayConnectionControlTests {
|
||||
@Test func statusFailsWhenProcessMissing() async {
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
@MainActor
|
||||
@@ -35,7 +35,7 @@ struct GatewayDiscoveryModelTests {
|
||||
#expect(GatewayDiscoveryModel.isLocalGateway(
|
||||
lanHost: nil,
|
||||
tailnetDns: nil,
|
||||
displayName: "Peter's Mac Studio (Clawdis)",
|
||||
displayName: "Peter's Mac Studio (Clawdbot)",
|
||||
serviceName: nil,
|
||||
local: local))
|
||||
}
|
||||
@@ -69,12 +69,12 @@ struct GatewayDiscoveryModelTests {
|
||||
"lanHost": " studio.local ",
|
||||
"tailnetDns": " peters-mac-studio-1.ts.net ",
|
||||
"sshPort": " 2222 ",
|
||||
"cliPath": " /opt/clawdis "
|
||||
"cliPath": " /opt/clawdbot "
|
||||
])
|
||||
#expect(parsed.lanHost == "studio.local")
|
||||
#expect(parsed.tailnetDns == "peters-mac-studio-1.ts.net")
|
||||
#expect(parsed.sshPort == 2222)
|
||||
#expect(parsed.cliPath == "/opt/clawdis")
|
||||
#expect(parsed.cliPath == "/opt/clawdbot")
|
||||
}
|
||||
|
||||
@Test func parsesGatewayTXTDefaults() {
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct GatewayEndpointStoreTests {
|
||||
private final class ModeBox: @unchecked Sendable {
|
||||
@@ -108,7 +108,7 @@ import Testing
|
||||
"remote": ["password": "remote"],
|
||||
],
|
||||
]
|
||||
let env = ["CLAWDIS_GATEWAY_PASSWORD": " env "]
|
||||
let env = ["CLAWDBOT_GATEWAY_PASSWORD": " env "]
|
||||
|
||||
#expect(GatewayEndpointStore._testResolveGatewayPassword(
|
||||
isRemote: false,
|
||||
@@ -127,7 +127,7 @@ import Testing
|
||||
"remote": ["password": "\n\t"],
|
||||
],
|
||||
]
|
||||
let env = ["CLAWDIS_GATEWAY_PASSWORD": " "]
|
||||
let env = ["CLAWDBOT_GATEWAY_PASSWORD": " "]
|
||||
|
||||
#expect(GatewayEndpointStore._testResolveGatewayPassword(
|
||||
isRemote: false,
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct GatewayEnvironmentTests {
|
||||
@Test func semverParsesCommonForms() {
|
||||
@@ -1,4 +1,4 @@
|
||||
import ClawdisProtocol
|
||||
import ClawdbotProtocol
|
||||
import Foundation
|
||||
import Testing
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct HealthDecodeTests {
|
||||
private let sampleJSON: String = // minimal but complete payload
|
||||
@@ -1,6 +1,6 @@
|
||||
import AppKit
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import ClawdisProtocol
|
||||
import ClawdbotProtocol
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct InstancesStoreTests {
|
||||
@Test
|
||||
@@ -8,7 +8,7 @@ import Testing
|
||||
func presenceEventPayloadDecodesViaJSONEncoder() {
|
||||
// Build a payload that mirrors the gateway's presence event shape:
|
||||
// { "presence": [ PresenceEntry ] }
|
||||
let entry: [String: ClawdisProtocol.AnyCodable] = [
|
||||
let entry: [String: ClawdbotProtocol.AnyCodable] = [
|
||||
"host": .init("gw"),
|
||||
"ip": .init("10.0.0.1"),
|
||||
"version": .init("2.0.0"),
|
||||
@@ -18,10 +18,10 @@ import Testing
|
||||
"text": .init("Gateway node"),
|
||||
"ts": .init(1_730_000_000),
|
||||
]
|
||||
let payloadMap: [String: ClawdisProtocol.AnyCodable] = [
|
||||
"presence": .init([ClawdisProtocol.AnyCodable(entry)]),
|
||||
let payloadMap: [String: ClawdbotProtocol.AnyCodable] = [
|
||||
"presence": .init([ClawdbotProtocol.AnyCodable(entry)]),
|
||||
]
|
||||
let payload = ClawdisProtocol.AnyCodable(payloadMap)
|
||||
let payload = ClawdbotProtocol.AnyCodable(payloadMap)
|
||||
|
||||
let store = InstancesStore(isPreview: true)
|
||||
store.handlePresenceEventPayload(payload)
|
||||
@@ -2,7 +2,7 @@ import AppKit
|
||||
import Foundation
|
||||
import Testing
|
||||
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
struct LowCoverageHelperTests {
|
||||
@@ -93,8 +93,8 @@ struct LowCoverageHelperTests {
|
||||
}
|
||||
|
||||
@Test func gatewayLaunchAgentHelpers() {
|
||||
let keyBind = "CLAWDIS_GATEWAY_BIND"
|
||||
let keyToken = "CLAWDIS_GATEWAY_TOKEN"
|
||||
let keyBind = "CLAWDBOT_GATEWAY_BIND"
|
||||
let keyToken = "CLAWDBOT_GATEWAY_TOKEN"
|
||||
let previousBind = ProcessInfo.processInfo.environment[keyBind]
|
||||
let previousToken = ProcessInfo.processInfo.environment[keyToken]
|
||||
defer {
|
||||
@@ -118,7 +118,7 @@ struct LowCoverageHelperTests {
|
||||
GatewayLaunchAgentManager._testEscapePlistValue("a&b<c>\"'") ==
|
||||
"a&b<c>"'")
|
||||
|
||||
#expect(GatewayLaunchAgentManager._testGatewayExecutablePath(bundlePath: "/App") == "/App/Contents/Resources/Relay/clawdis")
|
||||
#expect(GatewayLaunchAgentManager._testGatewayExecutablePath(bundlePath: "/App") == "/App/Contents/Resources/Relay/clawdbot")
|
||||
#expect(GatewayLaunchAgentManager._testRelayDir(bundlePath: "/App") == "/App/Contents/Resources/Relay")
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import AppKit
|
||||
import SwiftUI
|
||||
import Testing
|
||||
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,13 +1,13 @@
|
||||
import ClawdisChatUI
|
||||
import ClawdisProtocol
|
||||
import ClawdbotChatUI
|
||||
import ClawdbotProtocol
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct MacGatewayChatTransportMappingTests {
|
||||
@Test func snapshotMapsToHealth() {
|
||||
let snapshot = Snapshot(
|
||||
presence: [],
|
||||
health: ClawdisProtocol.AnyCodable(["ok": ClawdisProtocol.AnyCodable(false)]),
|
||||
health: ClawdbotProtocol.AnyCodable(["ok": ClawdbotProtocol.AnyCodable(false)]),
|
||||
stateversion: StateVersion(presence: 1, health: 1),
|
||||
uptimems: 123,
|
||||
configpath: nil,
|
||||
@@ -35,7 +35,7 @@ import Testing
|
||||
let frame = EventFrame(
|
||||
type: "event",
|
||||
event: "health",
|
||||
payload: ClawdisProtocol.AnyCodable(["ok": ClawdisProtocol.AnyCodable(true)]),
|
||||
payload: ClawdbotProtocol.AnyCodable(["ok": ClawdbotProtocol.AnyCodable(true)]),
|
||||
seq: 1,
|
||||
stateversion: nil)
|
||||
|
||||
@@ -58,10 +58,10 @@ import Testing
|
||||
}
|
||||
|
||||
@Test func chatEventMapsToChat() {
|
||||
let payload = ClawdisProtocol.AnyCodable([
|
||||
"runId": ClawdisProtocol.AnyCodable("run-1"),
|
||||
"sessionKey": ClawdisProtocol.AnyCodable("main"),
|
||||
"state": ClawdisProtocol.AnyCodable("final"),
|
||||
let payload = ClawdbotProtocol.AnyCodable([
|
||||
"runId": ClawdbotProtocol.AnyCodable("run-1"),
|
||||
"sessionKey": ClawdbotProtocol.AnyCodable("main"),
|
||||
"state": ClawdbotProtocol.AnyCodable("final"),
|
||||
])
|
||||
let frame = EventFrame(type: "event", event: "chat", payload: payload, seq: 1, stateversion: nil)
|
||||
let mapped = MacGatewayChatTransport.mapPushToTransportEvent(.event(frame))
|
||||
@@ -80,7 +80,7 @@ import Testing
|
||||
let frame = EventFrame(
|
||||
type: "event",
|
||||
event: "unknown",
|
||||
payload: ClawdisProtocol.AnyCodable(["a": ClawdisProtocol.AnyCodable(1)]),
|
||||
payload: ClawdbotProtocol.AnyCodable(["a": ClawdbotProtocol.AnyCodable(1)]),
|
||||
seq: 1,
|
||||
stateversion: nil)
|
||||
let mapped = MacGatewayChatTransport.mapPushToTransportEvent(.event(frame))
|
||||
@@ -2,18 +2,18 @@ import Darwin
|
||||
import Foundation
|
||||
import Network
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct MacNodeBridgeDiscoveryTests {
|
||||
@MainActor
|
||||
@Test func loopbackBridgePortDefaultsAndOverrides() {
|
||||
withEnv("CLAWDIS_BRIDGE_PORT", value: nil) {
|
||||
withEnv("CLAWDBOT_BRIDGE_PORT", value: nil) {
|
||||
#expect(MacNodeModeCoordinator.loopbackBridgePort() == 18790)
|
||||
}
|
||||
withEnv("CLAWDIS_BRIDGE_PORT", value: "19991") {
|
||||
withEnv("CLAWDBOT_BRIDGE_PORT", value: "19991") {
|
||||
#expect(MacNodeModeCoordinator.loopbackBridgePort() == 19991)
|
||||
}
|
||||
withEnv("CLAWDIS_BRIDGE_PORT", value: "not-a-port") {
|
||||
withEnv("CLAWDBOT_BRIDGE_PORT", value: "not-a-port") {
|
||||
#expect(MacNodeModeCoordinator.loopbackBridgePort() == 18790)
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import Testing
|
||||
listener.newConnectionHandler = { connection in
|
||||
connection.cancel()
|
||||
}
|
||||
listener.start(queue: DispatchQueue(label: "com.clawdis.tests.bridge-listener"))
|
||||
listener.start(queue: DispatchQueue(label: "com.clawdbot.tests.bridge-listener"))
|
||||
try await waitForListenerReady(listener, timeoutSeconds: 1.0)
|
||||
|
||||
guard let port = listener.port else {
|
||||
@@ -1,7 +1,7 @@
|
||||
import ClawdisKit
|
||||
import ClawdbotKit
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
struct MacNodeRuntimeTests {
|
||||
@@ -14,19 +14,19 @@ struct MacNodeRuntimeTests {
|
||||
|
||||
@Test func handleInvokeRejectsEmptySystemRun() async throws {
|
||||
let runtime = MacNodeRuntime()
|
||||
let params = ClawdisSystemRunParams(command: [])
|
||||
let params = ClawdbotSystemRunParams(command: [])
|
||||
let json = String(data: try JSONEncoder().encode(params), encoding: .utf8)
|
||||
let response = await runtime.handleInvoke(
|
||||
BridgeInvokeRequest(id: "req-2", command: ClawdisSystemCommand.run.rawValue, paramsJSON: json))
|
||||
BridgeInvokeRequest(id: "req-2", command: ClawdbotSystemCommand.run.rawValue, paramsJSON: json))
|
||||
#expect(response.ok == false)
|
||||
}
|
||||
|
||||
@Test func handleInvokeRejectsEmptyNotification() async throws {
|
||||
let runtime = MacNodeRuntime()
|
||||
let params = ClawdisSystemNotifyParams(title: "", body: "")
|
||||
let params = ClawdbotSystemNotifyParams(title: "", body: "")
|
||||
let json = String(data: try JSONEncoder().encode(params), encoding: .utf8)
|
||||
let response = await runtime.handleInvoke(
|
||||
BridgeInvokeRequest(id: "req-3", command: ClawdisSystemCommand.notify.rawValue, paramsJSON: json))
|
||||
BridgeInvokeRequest(id: "req-3", command: ClawdbotSystemCommand.notify.rawValue, paramsJSON: json))
|
||||
#expect(response.ok == false)
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ struct MacNodeRuntimeTests {
|
||||
|
||||
let runtime = MacNodeRuntime()
|
||||
let response = await runtime.handleInvoke(
|
||||
BridgeInvokeRequest(id: "req-4", command: ClawdisCameraCommand.list.rawValue))
|
||||
BridgeInvokeRequest(id: "req-4", command: ClawdbotCameraCommand.list.rawValue))
|
||||
#expect(response.ok == false)
|
||||
#expect(response.error?.message.contains("CAMERA_DISABLED") == true)
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import AppKit
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
struct ModelCatalogLoaderTests {
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct NodeManagerPathsTests {
|
||||
private func makeTempDir() throws -> URL {
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct NodePairingReconcilePolicyTests {
|
||||
@Test func policyPollsOnlyWhenActive() {
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,7 +1,7 @@
|
||||
import SwiftUI
|
||||
import Testing
|
||||
import ClawdisProtocol
|
||||
@testable import Clawdis
|
||||
import ClawdbotProtocol
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import Testing
|
||||
import ClawdisIPC
|
||||
@testable import Clawdis
|
||||
import ClawdbotIPC
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
#if canImport(Darwin)
|
||||
import Darwin
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct RuntimeLocatorTests {
|
||||
private func makeTempExecutable(contents: String) throws -> URL {
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
struct ScreenshotSizeTests {
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct SemverTests {
|
||||
@Test func comparisonOrdersByMajorMinorPatch() {
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
struct SessionDataTests {
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -8,7 +8,7 @@ struct SettingsViewSmokeTests {
|
||||
@Test func cronSettingsBuildsBody() {
|
||||
let store = CronJobsStore(isPreview: true)
|
||||
store.schedulerEnabled = false
|
||||
store.schedulerStorePath = "/tmp/clawdis-cron-store.json"
|
||||
store.schedulerStorePath = "/tmp/clawdbot-cron-store.json"
|
||||
|
||||
let job1 = CronJob(
|
||||
id: "job-1",
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -11,7 +11,7 @@ struct SkillsSettingsSmokeTests {
|
||||
SkillStatus(
|
||||
name: "Needs Setup",
|
||||
description: "Missing bins and env",
|
||||
source: "clawdis-managed",
|
||||
source: "clawdbot-managed",
|
||||
filePath: "/tmp/skills/needs-setup",
|
||||
baseDir: "/tmp/skills",
|
||||
skillKey: "needs-setup",
|
||||
@@ -38,7 +38,7 @@ struct SkillsSettingsSmokeTests {
|
||||
SkillStatus(
|
||||
name: "Ready Skill",
|
||||
description: "All set",
|
||||
source: "clawdis-bundled",
|
||||
source: "clawdbot-bundled",
|
||||
filePath: "/tmp/skills/ready",
|
||||
baseDir: "/tmp/skills",
|
||||
skillKey: "ready",
|
||||
@@ -58,7 +58,7 @@ struct SkillsSettingsSmokeTests {
|
||||
SkillStatus(
|
||||
name: "Disabled Skill",
|
||||
description: "Disabled in config",
|
||||
source: "clawdis-extra",
|
||||
source: "clawdbot-extra",
|
||||
filePath: "/tmp/skills/disabled",
|
||||
baseDir: "/tmp/skills",
|
||||
skillKey: "disabled",
|
||||
@@ -89,7 +89,7 @@ struct SkillsSettingsSmokeTests {
|
||||
SkillStatus(
|
||||
name: "Local Skill",
|
||||
description: "Local ready",
|
||||
source: "clawdis-workspace",
|
||||
source: "clawdbot-workspace",
|
||||
filePath: "/tmp/skills/local",
|
||||
baseDir: "/tmp/skills",
|
||||
skillKey: "local",
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -17,7 +17,7 @@ struct TailscaleIntegrationSectionTests {
|
||||
let service = TailscaleService(
|
||||
isInstalled: true,
|
||||
isRunning: true,
|
||||
tailscaleHostname: "clawdis.tailnet.ts.net",
|
||||
tailscaleHostname: "clawdbot.tailnet.ts.net",
|
||||
tailscaleIP: "100.64.0.1")
|
||||
var view = TailscaleIntegrationSection(connectionMode: .local, isPaused: false)
|
||||
view.setTestingService(service)
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized) struct TalkAudioPlayerTests {
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized) struct UtilitiesTests {
|
||||
@Test func ageStringsCoverCommonWindows() {
|
||||
@@ -46,7 +46,7 @@ import Testing
|
||||
let tmp = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
|
||||
.appendingPathComponent(UUID().uuidString, isDirectory: true)
|
||||
let dist = tmp.appendingPathComponent("dist/index.js")
|
||||
let bin = tmp.appendingPathComponent("bin/clawdis.js")
|
||||
let bin = tmp.appendingPathComponent("bin/clawdbot.js")
|
||||
try FileManager.default.createDirectory(at: dist.deletingLastPathComponent(), withIntermediateDirectories: true)
|
||||
try FileManager.default.createDirectory(at: bin.deletingLastPathComponent(), withIntermediateDirectories: true)
|
||||
FileManager.default.createFile(atPath: dist.path, contents: Data())
|
||||
@@ -58,11 +58,11 @@ import Testing
|
||||
|
||||
@Test func logLocatorPicksNewestLogFile() throws {
|
||||
let fm = FileManager.default
|
||||
let dir = URL(fileURLWithPath: "/tmp/clawdis", isDirectory: true)
|
||||
let dir = URL(fileURLWithPath: "/tmp/clawdbot", isDirectory: true)
|
||||
try? fm.createDirectory(at: dir, withIntermediateDirectories: true)
|
||||
|
||||
let older = dir.appendingPathComponent("clawdis-old-\(UUID().uuidString).log")
|
||||
let newer = dir.appendingPathComponent("clawdis-new-\(UUID().uuidString).log")
|
||||
let older = dir.appendingPathComponent("clawdbot-old-\(UUID().uuidString).log")
|
||||
let newer = dir.appendingPathComponent("clawdbot-new-\(UUID().uuidString).log")
|
||||
fm.createFile(atPath: older.path, contents: Data("old".utf8))
|
||||
fm.createFile(atPath: newer.path, contents: Data("new".utf8))
|
||||
try fm.setAttributes([.modificationDate: Date(timeIntervalSinceNow: -100)], ofItemAtPath: older.path)
|
||||
@@ -1,6 +1,6 @@
|
||||
import AppKit
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized) struct VoicePushToTalkHotkeyTests {
|
||||
actor Counter {
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct VoicePushToTalkTests {
|
||||
@Test func deltaTrimsCommittedPrefix() {
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized) struct VoiceWakeForwarderTests {
|
||||
@Test func prefixedTranscriptUsesMachineName() {
|
||||
@@ -1,7 +1,7 @@
|
||||
import ClawdisProtocol
|
||||
import ClawdbotProtocol
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized) struct VoiceWakeGlobalSettingsSyncTests {
|
||||
@Test func appliesVoiceWakeChangedEventToAppState() async {
|
||||
@@ -11,7 +11,7 @@ import Testing
|
||||
AppStateStore.shared.applyGlobalVoiceWakeTriggers(["before"])
|
||||
}
|
||||
|
||||
let payload = ClawdisProtocol.AnyCodable(["triggers": ["clawd", "computer"]])
|
||||
let payload = ClawdbotProtocol.AnyCodable(["triggers": ["clawd", "computer"]])
|
||||
let evt = EventFrame(
|
||||
type: "event",
|
||||
event: "voicewake.changed",
|
||||
@@ -36,7 +36,7 @@ import Testing
|
||||
AppStateStore.shared.applyGlobalVoiceWakeTriggers(["before"])
|
||||
}
|
||||
|
||||
let payload = ClawdisProtocol.AnyCodable(["unexpected": 123])
|
||||
let payload = ClawdbotProtocol.AnyCodable(["unexpected": 123])
|
||||
let evt = EventFrame(
|
||||
type: "event",
|
||||
event: "voicewake.changed",
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
struct VoiceWakeHelpersTests {
|
||||
@Test func sanitizeTriggersTrimsAndDropsEmpty() {
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct VoiceWakeOverlayTests {
|
||||
@Test func guardTokenDropsWhenNoActive() {
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
import SwabbleKit
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct VoiceWakeRuntimeTests {
|
||||
@Test func trimsAfterTriggerKeepsPostSpeech() {
|
||||
@@ -1,12 +1,12 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite struct WebChatMainSessionKeyTests {
|
||||
@Test func configGetSnapshotMainKeyFallsBackToMainWhenMissing() throws {
|
||||
let json = """
|
||||
{
|
||||
"path": "/Users/pete/.clawdis/clawdis.json",
|
||||
"path": "/Users/pete/.clawdbot/clawdbot.json",
|
||||
"exists": true,
|
||||
"raw": null,
|
||||
"parsed": {},
|
||||
@@ -22,7 +22,7 @@ import Testing
|
||||
@Test func configGetSnapshotMainKeyTrimsAndUsesValue() throws {
|
||||
let json = """
|
||||
{
|
||||
"path": "/Users/pete/.clawdis/clawdis.json",
|
||||
"path": "/Users/pete/.clawdbot/clawdbot.json",
|
||||
"exists": true,
|
||||
"raw": null,
|
||||
"parsed": {},
|
||||
@@ -1,5 +1,5 @@
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
@@ -1,18 +1,18 @@
|
||||
import AppKit
|
||||
import ClawdisChatUI
|
||||
import ClawdbotChatUI
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
struct WebChatSwiftUISmokeTests {
|
||||
private struct TestTransport: ClawdisChatTransport, Sendable {
|
||||
func requestHistory(sessionKey: String) async throws -> ClawdisChatHistoryPayload {
|
||||
private struct TestTransport: ClawdbotChatTransport, Sendable {
|
||||
func requestHistory(sessionKey: String) async throws -> ClawdbotChatHistoryPayload {
|
||||
let json = """
|
||||
{"sessionKey":"\(sessionKey)","sessionId":null,"messages":[],"thinkingLevel":"off"}
|
||||
"""
|
||||
return try JSONDecoder().decode(ClawdisChatHistoryPayload.self, from: Data(json.utf8))
|
||||
return try JSONDecoder().decode(ClawdbotChatHistoryPayload.self, from: Data(json.utf8))
|
||||
}
|
||||
|
||||
func sendMessage(
|
||||
@@ -20,17 +20,17 @@ struct WebChatSwiftUISmokeTests {
|
||||
message _: String,
|
||||
thinking _: String,
|
||||
idempotencyKey _: String,
|
||||
attachments _: [ClawdisChatAttachmentPayload]) async throws -> ClawdisChatSendResponse
|
||||
attachments _: [ClawdbotChatAttachmentPayload]) async throws -> ClawdbotChatSendResponse
|
||||
{
|
||||
let json = """
|
||||
{"runId":"\(UUID().uuidString)","status":"ok"}
|
||||
"""
|
||||
return try JSONDecoder().decode(ClawdisChatSendResponse.self, from: Data(json.utf8))
|
||||
return try JSONDecoder().decode(ClawdbotChatSendResponse.self, from: Data(json.utf8))
|
||||
}
|
||||
|
||||
func requestHealth(timeoutMs _: Int) async throws -> Bool { true }
|
||||
|
||||
func events() -> AsyncStream<ClawdisChatTransportEvent> {
|
||||
func events() -> AsyncStream<ClawdbotChatTransportEvent> {
|
||||
AsyncStream { continuation in
|
||||
continuation.finish()
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import AppKit
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
@MainActor
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Clawdis
|
||||
@testable import Clawdbot
|
||||
|
||||
@Suite
|
||||
@MainActor
|
||||
@@ -67,7 +67,7 @@ struct WorkActivityStoreTests {
|
||||
meta: nil,
|
||||
args: [
|
||||
"command": AnyCodable("echo hi\necho bye"),
|
||||
"path": AnyCodable("\(home)/Projects/clawdis"),
|
||||
"path": AnyCodable("\(home)/Projects/clawdbot"),
|
||||
])
|
||||
|
||||
#expect(store.current?.label == "bash: echo hi")
|
||||
Reference in New Issue
Block a user