feat: bootstrap agent workspace and AGENTS.md

This commit is contained in:
Peter Steinberger
2025-12-14 03:14:51 +00:00
parent 41da61dd6a
commit 073285409b
13 changed files with 351 additions and 31 deletions

View File

@@ -7,6 +7,12 @@ enum ClawdisConfigFile {
.appendingPathComponent("clawdis.json")
}
static func defaultWorkspaceURL() -> URL {
FileManager.default.homeDirectoryForCurrentUser
.appendingPathComponent(".clawdis")
.appendingPathComponent("workspace", isDirectory: true)
}
static func loadDict() -> [String: Any] {
let url = self.url()
guard let data = try? Data(contentsOf: url) else { return [:] }
@@ -37,4 +43,23 @@ enum ClawdisConfigFile {
root["browser"] = browser
self.saveDict(root)
}
static func inboundWorkspace() -> String? {
let root = self.loadDict()
let inbound = root["inbound"] as? [String: Any]
return inbound?["workspace"] as? String
}
static func setInboundWorkspace(_ workspace: String?) {
var root = self.loadDict()
var inbound = root["inbound"] as? [String: Any] ?? [:]
let trimmed = workspace?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
if trimmed.isEmpty {
inbound.removeValue(forKey: "workspace")
} else {
inbound["workspace"] = trimmed
}
root["inbound"] = inbound
self.saveDict(root)
}
}