Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(macos): add a debug-only reset that starts codync over

leepokai8b71bc13c247
diff --git a/apps/macos/App/CodyncMacApp.swift b/apps/macos/App/CodyncMacApp.swift
index 34fe5145..e44f980c 100644
--- a/apps/macos/App/CodyncMacApp.swift
+++ b/apps/macos/App/CodyncMacApp.swift
@@ -136,6 +136,13 @@ struct MenuView: View {
Button("Open log") { NSWorkspace.shared.open(host.logURL) }
Divider()
Button("Uninstall host service") { host.uninstall() }
+ #if DEBUG
+ Divider()
+ Button("Reset all data…") {
+ host.confirmsReset = true
+ open("chat")
+ }
+ #endif
}
if let version = host.version { Text("Version \(version)") }
Button("Quit Codync") { NSApp.terminate(nil) }
diff --git a/apps/macos/App/HostController.swift b/apps/macos/App/HostController.swift
index 070769eb..3af2a4ba 100644
--- a/apps/macos/App/HostController.swift
+++ b/apps/macos/App/HostController.swift
@@ -275,6 +275,29 @@ final class HostController {
}
}
+ #if DEBUG
+ /// Debug builds: the menu asks the chat window to confirm a full reset.
+ var confirmsReset = false
+
+ /// Debug builds: back to a first launch. Signs out every account, stops the host, deletes
+ /// its data folder (bots, transcripts, keys) and this app's settings, then relaunches.
+ func resetAllData() async {
+ let accountIDs = account.accounts.map(\.id)
+ await account.signOutAll()
+ for id in accountIDs + [nil] { SharedStore.Context(accountID: id).erase() }
+ streamTask?.cancel()
+ if let bin = binaryURL { _ = await Self.run(bin, ["uninstall"]) }
+ try? FileManager.default.removeItem(at: Self.dataDir)
+ UserDefaults(suiteName: SharedStore.appGroup)?.removePersistentDomain(forName: SharedStore.appGroup)
+ if let bundleID = Bundle.main.bundleIdentifier { UserDefaults.standard.removePersistentDomain(forName: bundleID) }
+ let relaunch = Process()
+ relaunch.executableURL = URL(filePath: "/bin/sh")
+ relaunch.arguments = ["-c", "sleep 1; /usr/bin/open -n \"$0\"", Bundle.main.bundlePath]
+ try? relaunch.run()
+ NSApp.terminate(nil)
+ }
+ #endif
+
func setLaunchAtLogin(_ on: Bool) {
do {
if on { try SMAppService.mainApp.register() } else { try SMAppService.mainApp.unregister() }
diff --git a/apps/macos/Views/ChatWindow.swift b/apps/macos/Views/ChatWindow.swift
index ecd06235..467ea9a7 100644
--- a/apps/macos/Views/ChatWindow.swift
+++ b/apps/macos/Views/ChatWindow.swift
@@ -52,6 +52,12 @@ struct ChatWindow: View {
.background(Palette.background)
.tint(Palette.accent)
.ignoresSafeArea(.container, edges: .top)
+ #if DEBUG
+ .codyncDialog("Reset all data?", isPresented: Bindable(host).confirmsReset,
+ message: "Signs out every account and deletes this Mac's bots, conversations, keys and settings. Codync then starts over from the welcome screen.") {
+ [DialogAction("Reset everything", destructive: true) { Task { await host.resetAllData() } }]
+ }
+ #endif
// Approving a device: the code the device shows must match (spec §4.2 B).
// It closes when the request is decided or put off (both change `currentApproval`);
// closing it puts the request off.