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.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat: add macOS menu bar UI — session list, detail, progress bar
libokai47d978796ef6
diff --git a/CodePulse-macOS/App/CodePulseApp.swift b/CodePulse-macOS/App/CodePulseApp.swiftindex 362a47bf..9f017a84 100644--- a/CodePulse-macOS/App/CodePulseApp.swift+++ b/CodePulse-macOS/App/CodePulseApp.swift@@ -1,17 +1,24 @@-//-// CodePulseApp.swift-// CodePulse-//-// Created by 李博凱 on 2026/3/16.-//-import SwiftUI@mainstruct CodePulseApp: App {+ @NSApplicationDelegateAdaptor(AppDelegate.self) var delegate+var body: some Scene {- WindowGroup {- ContentView()- }+ Settings { EmptyView() }+ }+}++@MainActor+final class AppDelegate: NSObject, NSApplicationDelegate {+ var menuBarController: MenuBarController?+ let scanner = SessionScanner()+ var stateManager: SessionStateManager!++ func applicationDidFinishLaunching(_ notification: Notification) {+ NSApp.setActivationPolicy(.accessory)+ stateManager = SessionStateManager(scanner: scanner)+ menuBarController = MenuBarController(stateManager: stateManager)+ scanner.start()}}diff --git a/CodePulse-macOS/App/MenuBarController.swift b/CodePulse-macOS/App/MenuBarController.swiftnew file mode 100644index 00000000..9b6f97f1--- /dev/null+++ b/CodePulse-macOS/App/MenuBarController.swift@@ -0,0 +1,66 @@+import SwiftUI+import Combine+import CodePulseShared++@MainActor+final class MenuBarController: NSObject {+ private var statusItem: NSStatusItem!+ private var popover: NSPopover!+ private let stateManager: SessionStateManager+ private var cancellables = Set<AnyCancellable>()++ init(stateManager: SessionStateManager) {+ self.stateManager = stateManager+ super.init()+ setupStatusItem()+ setupPopover()+ observeSessionCount()+ }++ private func setupStatusItem() {+ statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)+ if let button = statusItem.button {+ button.image = NSImage(systemSymbolName: "waveform.path", accessibilityDescription: "CodePulse")+ button.action = #selector(togglePopover)+ button.target = self+ }+ }++ private func setupPopover() {+ popover = NSPopover()+ popover.contentSize = NSSize(width: 340, height: 400)+ popover.behavior = .transient+ popover.contentViewController = NSHostingController(+ rootView: SessionListView(stateManager: stateManager)+ )+ }++ private func observeSessionCount() {+ stateManager.$sessions+ .receive(on: RunLoop.main)+ .sink { [weak self] sessions in+ let activeCount = sessions.filter { $0.status.isActive }.count+ self?.updateBadge(count: activeCount)+ }+ .store(in: &cancellables)+ }++ private func updateBadge(count: Int) {+ guard let button = statusItem.button else { return }+ if count > 0 {+ button.title = " \(count)"+ } else {+ button.title = ""+ }+ }++ @objc private func togglePopover() {+ guard let button = statusItem.button else { return }+ if popover.isShown {+ popover.performClose(nil)+ } else {+ popover.show(relativeTo: button.bounds, of: button, preferredEdge: .minY)+ popover.contentViewController?.view.window?.makeKey()+ }+ }+}diff --git a/CodePulse-macOS/Views/ContentView.swift b/CodePulse-macOS/Views/ContentView.swiftdeleted file mode 100644index 9a6698f1..00000000--- a/CodePulse-macOS/Views/ContentView.swift+++ /dev/null@@ -1,24 +0,0 @@-//-// ContentView.swift-// CodePulse-//-// Created by 李博凱 on 2026/3/16.-//--import SwiftUI--struct ContentView: View {- var body: some View {- VStack {- Image(systemName: "globe")- .imageScale(.large)- .foregroundStyle(.tint)- Text("Hello, world!")- }- .padding()- }-}--#Preview {- ContentView()-}diff --git a/CodePulse-macOS/Views/ProgressBarView.swift b/CodePulse-macOS/Views/ProgressBarView.swiftnew file mode 100644index 00000000..1195068c--- /dev/null+++ b/CodePulse-macOS/Views/ProgressBarView.swift@@ -0,0 +1,24 @@+import SwiftUI+import CodePulseShared++struct ProgressBarView: View {+ let tasks: [TaskItem]++ var body: some View {+ HStack(spacing: 3) {+ ForEach(tasks) { task in+ RoundedRectangle(cornerRadius: 3)+ .fill(color(for: task.status))+ .frame(height: 6)+ }+ }+ }++ private func color(for status: TaskStatus) -> Color {+ switch status {+ case .completed: return .green+ case .inProgress: return .cyan+ case .pending: return Color(.separatorColor)+ }+ }+}diff --git a/CodePulse-macOS/Views/SessionDetailView.swift b/CodePulse-macOS/Views/SessionDetailView.swiftnew file mode 100644index 00000000..ac42b858--- /dev/null+++ b/CodePulse-macOS/Views/SessionDetailView.swift@@ -0,0 +1,127 @@+import SwiftUI+import CodePulseShared++struct SessionDetailView: View {+ let session: SessionState+ let onBack: () -> Void++ var body: some View {+ VStack(spacing: 0) {+ HStack {+ Button(action: onBack) {+ HStack(spacing: 4) {+ Image(systemName: "chevron.left")+ Text("Sessions")+ }+ .font(.system(size: 12))+ .foregroundStyle(.cyan)+ }+ .buttonStyle(.plain)+ Spacer()+ StatusDotView(status: session.status)+ Text(session.status.label)+ .font(.system(size: 11))+ .foregroundStyle(session.status.color)+ }+ .padding(.horizontal, 10)+ .padding(.vertical, 8)+ .background(Color.black.opacity(0.1))++ Divider()++ ScrollView {+ VStack(alignment: .leading, spacing: 10) {+ VStack(alignment: .leading, spacing: 4) {+ Text(session.summary)+ .font(.system(size: 14, weight: .semibold))+ HStack(spacing: 4) {+ Text(session.projectName)+ Text("·")+ Text(session.gitBranch)+ Text("·")+ Text(session.model)+ }+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ }+ .padding(.horizontal, 12)+ .padding(.top, 8)++ if !session.tasks.isEmpty {+ VStack(alignment: .leading, spacing: 6) {+ HStack {+ Text("TASKS")+ .font(.system(size: 10, weight: .medium))+ .foregroundStyle(.secondary)+ Spacer()+ Text("\(session.completedTaskCount) of \(session.totalTaskCount)")+ .font(.system(size: 10))+ .foregroundStyle(.secondary)+ }++ ProgressBarView(tasks: session.tasks)++ ForEach(session.tasks) { task in+ HStack(spacing: 6) {+ taskIcon(task.status)+ Text(task.content)+ .font(.system(size: 11))+ .foregroundStyle(taskColor(task.status))+ if task.status == .inProgress, let form = task.activeForm {+ Text("— \(form)")+ .font(.system(size: 11))+ .foregroundStyle(.quaternary)+ }+ }+ }+ }+ .padding(.horizontal, 12)+ }++ HStack(spacing: 6) {+ statCard("CONTEXT", "\(session.contextPct)%", .orange)+ statCard("COST", String(format: "$%.2f", session.costUSD), .yellow)+ statCard("DURATION", formatDuration(session.durationSec), .pink)+ }+ .padding(.horizontal, 12)+ .padding(.bottom, 8)+ }+ }+ }+ }++ private func taskIcon(_ status: TaskStatus) -> some View {+ Group {+ switch status {+ case .completed: Text("✓").foregroundStyle(.green)+ case .inProgress: Text("◼").foregroundStyle(.cyan)+ case .pending: Text("◻").foregroundStyle(.quaternary)+ }+ }+ .font(.system(size: 11))+ }++ private func taskColor(_ status: TaskStatus) -> Color {+ switch status {+ case .completed: return .green+ case .inProgress: return .cyan+ case .pending: return Color(.tertiaryLabelColor)+ }+ }++ private func statCard(_ label: String, _ value: String, _ color: Color) -> some View {+ VStack(spacing: 2) {+ Text(label).font(.system(size: 9, weight: .medium)).foregroundStyle(.secondary)+ Text(value).font(.system(size: 12, weight: .semibold)).foregroundStyle(color)+ }+ .frame(maxWidth: .infinity)+ .padding(.vertical, 6)+ .background(RoundedRectangle(cornerRadius: 6).fill(Color.black.opacity(0.15)))+ }++ private func formatDuration(_ seconds: Int) -> String {+ if seconds < 60 { return "\(seconds)s" }+ if seconds < 3600 { return "\(seconds / 60)m" }+ return "\(seconds / 3600)h \((seconds % 3600) / 60)m"+ }+}diff --git a/CodePulse-macOS/Views/SessionListView.swift b/CodePulse-macOS/Views/SessionListView.swiftnew file mode 100644index 00000000..c018645f--- /dev/null+++ b/CodePulse-macOS/Views/SessionListView.swift@@ -0,0 +1,73 @@+import SwiftUI+import CodePulseShared++struct SessionListView: View {+ @ObservedObject var stateManager: SessionStateManager+ @State private var selectedSession: SessionState?++ var body: some View {+ VStack(spacing: 0) {+ if let session = selectedSession {+ SessionDetailView(session: session) {+ withAnimation { selectedSession = nil }+ }+ } else {+ sessionList+ }++ Divider().padding(.horizontal, 8)+ footer+ }+ .frame(width: 340)+ }++ private var sessionList: some View {+ ScrollView {+ LazyVStack(spacing: 0) {+ if stateManager.sessions.isEmpty {+ emptyState+ } else {+ ForEach(stateManager.sessions) { session in+ Button {+ withAnimation { selectedSession = session }+ } label: {+ SessionRowView(session: session)+ }+ .buttonStyle(.plain)++ if session.id != stateManager.sessions.last?.id {+ Divider().padding(.horizontal, 10)+ }+ }+ }+ }+ .padding(.vertical, 4)+ }+ }++ private var emptyState: some View {+ VStack(spacing: 8) {+ Image(systemName: "waveform.path")+ .font(.system(size: 32))+ .foregroundStyle(.tertiary)+ Text("No active Claude Code sessions")+ .font(.system(size: 13))+ .foregroundStyle(.secondary)+ }+ .frame(maxWidth: .infinity, minHeight: 120)+ }++ private var footer: some View {+ HStack {+ Text("CodePulse")+ .font(.system(size: 10))+ .foregroundStyle(.quaternary)+ Spacer()+ Text("⌘.")+ .font(.system(size: 10))+ .foregroundStyle(.quaternary)+ }+ .padding(.horizontal, 10)+ .padding(.vertical, 6)+ }+}diff --git a/CodePulse-macOS/Views/SessionRowView.swift b/CodePulse-macOS/Views/SessionRowView.swiftnew file mode 100644index 00000000..4edddbff--- /dev/null+++ b/CodePulse-macOS/Views/SessionRowView.swift@@ -0,0 +1,54 @@+import SwiftUI+import CodePulseShared++struct SessionRowView: View {+ let session: SessionState+ @State private var isHovered = false++ var body: some View {+ HStack(spacing: 8) {+ StatusDotView(status: session.status)++ VStack(alignment: .leading, spacing: 2) {+ HStack(spacing: 4) {+ Text(session.summary)+ .font(.system(size: 13, weight: isHovered ? .medium : .regular))+ .foregroundStyle(.primary)+ .lineLimit(1)+ .truncationMode(.middle)++ Text("claude")+ .font(.system(size: 9))+ .padding(.horizontal, 5)+ .padding(.vertical, 1)+ .background(Color.purple.opacity(0.15))+ .foregroundStyle(.purple)+ .clipShape(RoundedRectangle(cornerRadius: 3))+ }+ }++ Spacer(minLength: 4)++ Text(relativeTime(session.updatedAt))+ .font(.system(size: 11, design: .rounded))+ .foregroundStyle(.tertiary)+ }+ .padding(.leading, 6)+ .padding(.trailing, 10)+ .padding(.vertical, 5)+ .background(+ RoundedRectangle(cornerRadius: 5, style: .continuous)+ .fill(isHovered ? Color.primary.opacity(0.06) : Color.clear)+ )+ .onHover { isHovered = $0 }+ .contentShape(Rectangle())+ }++ private func relativeTime(_ date: Date) -> String {+ let seconds = -date.timeIntervalSinceNow+ if seconds < 60 { return "now" }+ if seconds < 3600 { return "\(Int(seconds / 60))m ago" }+ if seconds < 86400 { return "\(Int(seconds / 3600))h ago" }+ return "\(Int(seconds / 86400))d ago"+ }+}diff --git a/CodePulse-macOS/Views/StatusDotView.swift b/CodePulse-macOS/Views/StatusDotView.swiftnew file mode 100644index 00000000..f6c8a6f4--- /dev/null+++ b/CodePulse-macOS/Views/StatusDotView.swift@@ -0,0 +1,36 @@+import SwiftUI+import CodePulseShared++struct StatusDotView: View {+ let status: SessionStatus+ @State private var isAnimating = false++ private func animates(_ s: SessionStatus) -> Bool {+ switch s {+ case .working, .needsInput, .error: return true+ default: return false+ }+ }++ var body: some View {+ let dotColor = status.color+ let shadowColor = dotColor.opacity(0.5)+ let shadowRadius: CGFloat = animates(status) ? 3 : 0+ let dotOpacity: Double = isAnimating ? 0.4 : 1.0+ let anim: Animation = animates(status)+ ? .easeInOut(duration: 1.0).repeatForever(autoreverses: true)+ : .default+ return Circle()+ .fill(dotColor)+ .frame(width: 8, height: 8)+ .shadow(color: shadowColor, radius: shadowRadius)+ .opacity(dotOpacity)+ .animation(anim, value: isAnimating)+ .onAppear {+ if animates(status) { isAnimating = true }+ }+ .onChange(of: status) { _, newStatus in+ isAnimating = animates(newStatus)+ }+ }+}diff --git a/CodePulse.xcodeproj/project.pbxproj b/CodePulse.xcodeproj/project.pbxprojindex 3d75eace..0517fc00 100644--- a/CodePulse.xcodeproj/project.pbxproj+++ b/CodePulse.xcodeproj/project.pbxproj@@ -9,7 +9,6 @@/* Begin PBXBuildFile section */0205D611148BDCAB840D0F47 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9580D32B5B29E049090D66C8 /* Assets.xcassets */; };070688CBF55E74F38DC650E3 /* CodePulseShared in Frameworks */ = {isa = PBXBuildFile; productRef = 4BA154F0B1967DCBBB7600E5 /* CodePulseShared */; };- 3037E7D95514810851C96989 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08923E0859DEAE69B93C7C4C /* ContentView.swift */; };804863D604952293533147CF /* CodePulseLiveActivity.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 3B652652FD106495A82565C8 /* CodePulseLiveActivity.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };B575261E2F89280C4805C654 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3935CEE144EC8AFCA3AEAEA3 /* Assets.xcassets */; };BB50434DF1BC51FED1AFED51 /* CodePulseLiveActivityWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A9A7BAE27F6E4CEEDA1B48D /* CodePulseLiveActivityWidget.swift */; };@@ -23,6 +22,14 @@E3C8E587447D41AE9F8BF0CF /* ClaudePaths.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA494301693D443F8FD797D7 /* ClaudePaths.swift */; };CE2560F773384F74989BD043 /* SessionFileParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6B15463A7EE485B8B6C304B /* SessionFileParser.swift */; };311FECFF65054BA2B657AF93 /* JSONLTailReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7582EF7C72A74D8F90599D0D /* JSONLTailReader.swift */; };+ AA11BB22CC33DD44EE550001 /* SessionScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE440001 /* SessionScanner.swift */; };+ AA11BB22CC33DD44EE550002 /* SessionStateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE440002 /* SessionStateManager.swift */; };+ AA11BB22CC33DD44EE550003 /* MenuBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE440003 /* MenuBarController.swift */; };+ AA11BB22CC33DD44EE550004 /* StatusDotView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE440004 /* StatusDotView.swift */; };+ AA11BB22CC33DD44EE550005 /* ProgressBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE440005 /* ProgressBarView.swift */; };+ AA11BB22CC33DD44EE550006 /* SessionRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE440006 /* SessionRowView.swift */; };+ AA11BB22CC33DD44EE550007 /* SessionListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE440007 /* SessionListView.swift */; };+ AA11BB22CC33DD44EE550008 /* SessionDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE440008 /* SessionDetailView.swift */; };/* End PBXBuildFile section *//* Begin PBXContainerItemProxy section */@@ -50,7 +57,6 @@/* End PBXCopyFilesBuildPhase section *//* Begin PBXFileReference section */- 08923E0859DEAE69B93C7C4C /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };3935CEE144EC8AFCA3AEAEA3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };3B652652FD106495A82565C8 /* CodePulseLiveActivity.appex */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "wrapper.app-extension"; path = CodePulseLiveActivity.appex; sourceTree = BUILT_PRODUCTS_DIR; };3BCD1168005B123A7F9ACB37 /* CodePulseLiveActivityBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodePulseLiveActivityBundle.swift; sourceTree = "<group>"; };@@ -68,6 +74,14 @@CA494301693D443F8FD797D7 /* ClaudePaths.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClaudePaths.swift; sourceTree = "<group>"; };B6B15463A7EE485B8B6C304B /* SessionFileParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionFileParser.swift; sourceTree = "<group>"; };7582EF7C72A74D8F90599D0D /* JSONLTailReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONLTailReader.swift; sourceTree = "<group>"; };+ AA11BB22CC33DD44EE440001 /* SessionScanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionScanner.swift; sourceTree = "<group>"; };+ AA11BB22CC33DD44EE440002 /* SessionStateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionStateManager.swift; sourceTree = "<group>"; };+ AA11BB22CC33DD44EE440003 /* MenuBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarController.swift; sourceTree = "<group>"; };+ AA11BB22CC33DD44EE440004 /* StatusDotView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusDotView.swift; sourceTree = "<group>"; };+ AA11BB22CC33DD44EE440005 /* ProgressBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarView.swift; sourceTree = "<group>"; };+ AA11BB22CC33DD44EE440006 /* SessionRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionRowView.swift; sourceTree = "<group>"; };+ AA11BB22CC33DD44EE440007 /* SessionListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionListView.swift; sourceTree = "<group>"; };+ AA11BB22CC33DD44EE440008 /* SessionDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionDetailView.swift; sourceTree = "<group>"; };/* End PBXFileReference section *//* Begin PBXFrameworksBuildPhase section */@@ -170,7 +184,11 @@81EF17B3D3346D74A837F710 /* Views */ = {isa = PBXGroup;children = (- 08923E0859DEAE69B93C7C4C /* ContentView.swift */,+ AA11BB22CC33DD44EE440004 /* StatusDotView.swift */,+ AA11BB22CC33DD44EE440005 /* ProgressBarView.swift */,+ AA11BB22CC33DD44EE440006 /* SessionRowView.swift */,+ AA11BB22CC33DD44EE440007 /* SessionListView.swift */,+ AA11BB22CC33DD44EE440008 /* SessionDetailView.swift */,);path = Views;sourceTree = "<group>";@@ -180,6 +198,7 @@children = (CD5A99B72DC7E1F01D755DF6 /* CodePulse.entitlements */,4A67A3CD19408484AB11BB73 /* CodePulseApp.swift */,+ AA11BB22CC33DD44EE440003 /* MenuBarController.swift */,);path = App;sourceTree = "<group>";@@ -195,6 +214,8 @@isa = PBXGroup;children = (B6B15463A7EE485B8B6C304B /* SessionFileParser.swift */,+ AA11BB22CC33DD44EE440001 /* SessionScanner.swift */,+ AA11BB22CC33DD44EE440002 /* SessionStateManager.swift */,);path = Services;sourceTree = "<group>";@@ -349,11 +370,18 @@buildActionMask = 2147483647;files = (EB132AF39AB968D2DFA6151B /* CodePulseApp.swift in Sources */,- 3037E7D95514810851C96989 /* ContentView.swift in Sources */,+ AA11BB22CC33DD44EE550003 /* MenuBarController.swift in Sources */,C1C1204B22A14AEC955654F0 /* PIDChecker.swift in Sources */,E3C8E587447D41AE9F8BF0CF /* ClaudePaths.swift in Sources */,CE2560F773384F74989BD043 /* SessionFileParser.swift in Sources */,311FECFF65054BA2B657AF93 /* JSONLTailReader.swift in Sources */,+ AA11BB22CC33DD44EE550001 /* SessionScanner.swift in Sources */,+ AA11BB22CC33DD44EE550002 /* SessionStateManager.swift in Sources */,+ AA11BB22CC33DD44EE550004 /* StatusDotView.swift in Sources */,+ AA11BB22CC33DD44EE550005 /* ProgressBarView.swift in Sources */,+ AA11BB22CC33DD44EE550006 /* SessionRowView.swift in Sources */,+ AA11BB22CC33DD44EE550007 /* SessionListView.swift in Sources */,+ AA11BB22CC33DD44EE550008 /* SessionDetailView.swift in Sources */,);runOnlyForDeploymentPostprocessing = 0;};