feat: bootstrap agent workspace and AGENTS.md
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user