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: iOS dark-only Vercel/Cursor theme + CloudKit sync fix

libokaiba132352776c
diff --git a/.gitignore b/.gitignore
index bac3270c..39a1d25d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ build/
.build/
.swiftpm/
Package.resolved
+.firecrawl/
diff --git a/CodePulse-iOS/Services/CloudKitReceiver.swift b/CodePulse-iOS/Services/CloudKitReceiver.swift
index 3ba02ca0..9660ad01 100644
--- a/CodePulse-iOS/Services/CloudKitReceiver.swift
+++ b/CodePulse-iOS/Services/CloudKitReceiver.swift
@@ -38,8 +38,8 @@ final class CloudKitReceiver: ObservableObject {
func startPolling() {
guard pollTimer == nil else { return }
- logger.info("Starting CloudKit polling (5s interval)")
- pollTimer = Timer.scheduledTimer(withTimeInterval: 5, repeats: true) { [weak self] _ in
+ logger.info("Starting CloudKit polling (3s interval)")
+ pollTimer = Timer.scheduledTimer(withTimeInterval: 3, repeats: true) { [weak self] _ in
Task { @MainActor in
await self?.fetch()
}
diff --git a/CodePulse-iOS/Views/IOSOnboardingView.swift b/CodePulse-iOS/Views/IOSOnboardingView.swift
index d3842f37..8026dc88 100644
--- a/CodePulse-iOS/Views/IOSOnboardingView.swift
+++ b/CodePulse-iOS/Views/IOSOnboardingView.swift
@@ -1,37 +1,171 @@
import SwiftUI
+import CloudKit
struct IOSOnboardingView: View {
@Environment(\.theme) private var theme
+ @State private var iCloudStatus: ICloudStatus = .checking
var body: some View {
- VStack(spacing: 24) {
+ VStack(spacing: 0) {
Spacer()
Image(systemName: "waveform.path")
.font(.system(size: 56, weight: .light))
- .foregroundStyle(theme.secondaryText.opacity(0.6))
-
- VStack(spacing: 8) {
- Text("CodePulse")
- .font(.system(size: 28, weight: .semibold, design: .rounded))
- .foregroundStyle(theme.primaryText)
- Text("Install CodePulse on your Mac\nto start monitoring Claude Code sessions")
- .multilineTextAlignment(.center)
- .font(.system(size: 15))
- .foregroundStyle(theme.secondaryText)
+ .foregroundStyle(theme.primaryText.opacity(0.4))
+ .padding(.bottom, 20)
+
+ Text("CodePulse")
+ .font(.system(size: 28, weight: .semibold, design: .rounded))
+ .foregroundStyle(theme.primaryText)
+ .padding(.bottom, 6)
+
+ Text("Monitor your Claude Code sessions\nin real time from your iPhone")
+ .multilineTextAlignment(.center)
+ .font(.system(size: 15))
+ .foregroundStyle(theme.secondaryText)
+ .padding(.bottom, 28)
+
+ VStack(alignment: .leading, spacing: 16) {
+ stepRow(
+ icon: "icloud",
+ title: "iCloud Sync",
+ subtitle: iCloudSubtitle,
+ isOK: iCloudStatus == .available,
+ isError: iCloudStatus.isError,
+ isLoading: iCloudStatus == .checking
+ )
+ stepRow(
+ icon: "desktopcomputer",
+ title: "Install on Mac",
+ subtitle: "Install CodePulse on your Mac to sync sessions",
+ isOK: false,
+ isError: false,
+ isLoading: false
+ )
}
+ .padding(.horizontal, 24)
+ .padding(.vertical, 20)
+ .background(
+ RoundedRectangle(cornerRadius: 12, style: .continuous)
+ .fill(theme.cardBackground)
+ .overlay(
+ RoundedRectangle(cornerRadius: 12, style: .continuous)
+ .stroke(theme.border, lineWidth: 1)
+ )
+ )
+ .padding(.horizontal, 24)
+
+ Spacer()
HStack(spacing: 6) {
ClaudeSparkleView()
.frame(width: 14, height: 14)
Text("Waiting for sessions…")
.font(.system(size: 14))
+ .foregroundStyle(theme.tertiaryText)
+ }
+ .padding(.bottom, 32)
+ }
+ .background(theme.background)
+ .task {
+ await checkICloudStatus()
+ }
+ }
+
+ private var iCloudSubtitle: String {
+ switch iCloudStatus {
+ case .checking: return "Checking iCloud status…"
+ case .available: return "iCloud is ready"
+ case .noAccount: return "Sign in to iCloud in Settings"
+ case .restricted: return "iCloud is restricted on this device"
+ case .quotaExceeded: return "iCloud storage is full — free up space"
+ case .error(let msg): return msg
+ }
+ }
+
+ private func stepRow(
+ icon: String, title: String, subtitle: String,
+ isOK: Bool, isError: Bool, isLoading: Bool
+ ) -> some View {
+ let iconColor = isOK ? theme.primaryText : isError ? theme.primaryText : theme.tertiaryText
+
+ return HStack(spacing: 12) {
+ Image(systemName: icon)
+ .font(.system(size: 16))
+ .foregroundStyle(iconColor)
+ .frame(width: 32, height: 32)
+ .background(
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
+ .fill(iconColor.opacity(0.1))
+ )
+
+ VStack(alignment: .leading, spacing: 2) {
+ HStack(spacing: 6) {
+ Text(title)
+ .font(.system(size: 15, weight: .medium))
+ .foregroundStyle(theme.primaryText)
+ if isLoading {
+ ProgressView()
+ .scaleEffect(0.6)
+ .frame(width: 14, height: 14)
+ } else if isOK {
+ Image(systemName: "checkmark.circle.fill")
+ .font(.system(size: 13))
+ .foregroundStyle(theme.primaryText.opacity(0.7))
+ } else if isError {
+ Image(systemName: "exclamationmark.circle.fill")
+ .font(.system(size: 13))
+ .foregroundStyle(theme.primaryText.opacity(0.7))
+ } else {
+ Circle()
+ .fill(theme.tertiaryText)
+ .frame(width: 8, height: 8)
+ }
+ }
+ Text(subtitle)
+ .font(.system(size: 13))
.foregroundStyle(theme.secondaryText)
+ .lineLimit(2)
}
- .padding(.top, 12)
+ }
+ }
- Spacer()
+ private func checkICloudStatus() async {
+ do {
+ let status = try await CKContainer.default().accountStatus()
+ await MainActor.run {
+ switch status {
+ case .available: iCloudStatus = .available
+ case .noAccount: iCloudStatus = .noAccount
+ case .restricted: iCloudStatus = .restricted
+ default: iCloudStatus = .error("iCloud unavailable")
+ }
+ }
+ } catch {
+ let nsError = error as NSError
+ await MainActor.run {
+ if nsError.code == CKError.quotaExceeded.rawValue {
+ iCloudStatus = .quotaExceeded
+ } else {
+ iCloudStatus = .error("iCloud: \(error.localizedDescription)")
+ }
+ }
+ }
+ }
+}
+
+private enum ICloudStatus: Equatable {
+ case checking
+ case available
+ case noAccount
+ case restricted
+ case quotaExceeded
+ case error(String)
+
+ var isError: Bool {
+ switch self {
+ case .noAccount, .restricted, .quotaExceeded, .error: return true
+ default: return false
}
- .padding()
}
}
diff --git a/CodePulse-iOS/Views/IOSRootView.swift b/CodePulse-iOS/Views/IOSRootView.swift
index 9ad0c537..a8a67347 100644
--- a/CodePulse-iOS/Views/IOSRootView.swift
+++ b/CodePulse-iOS/Views/IOSRootView.swift
@@ -4,9 +4,8 @@ import CodePulseShared
struct IOSRootView: View {
@ObservedObject var receiver: CloudKitReceiver
@ObservedObject var liveActivityManager: LiveActivityManager
- @AppStorage("codepulse_darkMode") private var isDarkMode = true
- private var theme: CodePulseTheme { CodePulseTheme(isDark: isDarkMode) }
+ private let theme = CodePulseTheme()
var body: some View {
NavigationStack {
@@ -20,20 +19,9 @@ struct IOSRootView: View {
)
}
}
- .toolbar {
- ToolbarItem(placement: .topBarTrailing) {
- Button {
- withAnimation(.easeInOut(duration: 0.2)) { isDarkMode.toggle() }
- } label: {
- Image(systemName: isDarkMode ? "moon.fill" : "sun.max.fill")
- .font(.system(size: 14))
- .foregroundStyle(theme.secondaryText)
- }
- }
- }
}
.environment(\.theme, theme)
- .preferredColorScheme(isDarkMode ? .dark : .light)
+ .preferredColorScheme(.dark)
.onChange(of: receiver.sessions) { _, sessions in
liveActivityManager.updateSessions(sessions)
}
diff --git a/CodePulse-iOS/Views/IOSSessionDetailView.swift b/CodePulse-iOS/Views/IOSSessionDetailView.swift
index f61d7b51..ff4482ee 100644
--- a/CodePulse-iOS/Views/IOSSessionDetailView.swift
+++ b/CodePulse-iOS/Views/IOSSessionDetailView.swift
@@ -20,6 +20,7 @@ struct IOSSessionDetailView: View {
.background(theme.background)
.navigationTitle(session.summary)
.navigationBarTitleDisplayMode(.inline)
+ .toolbarColorScheme(.dark, for: .navigationBar)
}
private var headerSection: some View {
@@ -28,11 +29,12 @@ struct IOSSessionDetailView: View {
SessionStatusView(
status: session.status,
completedTasks: session.completedTaskCount,
- totalTasks: session.totalTaskCount
+ totalTasks: session.totalTaskCount,
+ waitingReason: session.waitingReason
)
- Text(session.status.label)
+ Text(statusLabel)
.font(.system(size: 14, weight: .medium))
- .foregroundStyle(session.status == .needsInput ? theme.warning : theme.secondaryText)
+ .foregroundStyle(statusLabelColor)
Spacer()
if !session.model.isEmpty {
SessionTagView(tag: session.model)
@@ -40,7 +42,7 @@ struct IOSSessionDetailView: View {
}
HStack(spacing: 6) {
Label(session.projectName, systemImage: "folder")
- if !session.gitBranch.isEmpty {
+ if !session.gitBranch.isEmpty && session.gitBranch != "unknown" {
Text("·")
Text(session.gitBranch)
}
@@ -53,15 +55,19 @@ struct IOSSessionDetailView: View {
private var statsCard: some View {
HStack(spacing: 0) {
statItem("\(session.contextPct)%", "Context")
- Divider().frame(height: 28)
+ Divider().frame(height: 28).overlay(theme.separator)
statItem(String(format: "$%.2f", session.costUSD), "Cost")
- Divider().frame(height: 28)
+ Divider().frame(height: 28).overlay(theme.separator)
statItem(formatDuration(session.durationSec), "Duration")
}
.padding(.vertical, 10)
.background(
RoundedRectangle(cornerRadius: 10, style: .continuous)
.fill(theme.cardBackground)
+ .overlay(
+ RoundedRectangle(cornerRadius: 10, style: .continuous)
+ .stroke(theme.border, lineWidth: 1)
+ )
)
}
@@ -97,15 +103,25 @@ struct IOSSessionDetailView: View {
}
}
+ private var statusLabel: String {
+ guard session.status == .needsInput else { return session.status.label }
+ return session.waitingReason?.label ?? "Needs Input"
+ }
+
+ private var statusLabelColor: Color {
+ guard session.status == .needsInput else { return theme.secondaryText }
+ return theme.waitingColor(for: session.waitingReason)
+ }
+
private func taskIcon(_ status: TaskStatus) -> some View {
Group {
switch status {
case .completed:
- Image(systemName: "checkmark.circle.fill").foregroundStyle(.blue)
+ Image(systemName: "checkmark.circle.fill").foregroundStyle(theme.primaryText.opacity(0.7))
case .inProgress:
- Image(systemName: "circlebadge.fill").foregroundStyle(.blue)
+ Image(systemName: "circlebadge.fill").foregroundStyle(theme.accent)
case .pending:
- Image(systemName: "circle").foregroundStyle(theme.secondaryText)
+ Image(systemName: "circle").foregroundStyle(theme.tertiaryText)
}
}
.font(.system(size: 14))
@@ -114,11 +130,11 @@ struct IOSSessionDetailView: View {
private func statItem(_ value: String, _ label: String) -> some View {
VStack(spacing: 3) {
Text(value)
- .font(.system(size: 16, weight: .semibold, design: .rounded))
+ .font(.system(size: 16, weight: .semibold, design: .monospaced))
.foregroundStyle(theme.primaryText)
Text(label)
.font(.system(size: 11))
- .foregroundStyle(theme.secondaryText)
+ .foregroundStyle(theme.tertiaryText)
}
.frame(maxWidth: .infinity)
}
@@ -135,6 +151,7 @@ struct IOSSessionDetailView: View {
private struct DetailProgressRing: View {
let completed: Int
let total: Int
+ @Environment(\.theme) private var theme
@State private var animatedProgress: Double = 0
private var progress: Double {
@@ -143,14 +160,14 @@ private struct DetailProgressRing: View {
var body: some View {
ZStack {
- Circle().stroke(Color.primary.opacity(0.06), lineWidth: 3.5)
+ Circle().stroke(theme.secondaryText.opacity(0.15), lineWidth: 3.5)
Circle()
.trim(from: 0, to: animatedProgress)
- .stroke(Color.blue, style: StrokeStyle(lineWidth: 3.5, lineCap: .round))
+ .stroke(theme.primaryText.opacity(0.7), style: StrokeStyle(lineWidth: 3.5, lineCap: .round))
.rotationEffect(.degrees(-90))
Text("\(Int(progress * 100))%")
- .font(.system(size: 12, weight: .semibold, design: .rounded))
- .foregroundStyle(.primary)
+ .font(.system(size: 12, weight: .semibold, design: .monospaced))
+ .foregroundStyle(theme.primaryText)
}
.frame(width: 44, height: 44)
.onAppear { withAnimation(.easeOut(duration: 0.6)) { animatedProgress = progress } }
diff --git a/CodePulse-iOS/Views/IOSSessionListView.swift b/CodePulse-iOS/Views/IOSSessionListView.swift
index 14f03e03..ec31d37e 100644
--- a/CodePulse-iOS/Views/IOSSessionListView.swift
+++ b/CodePulse-iOS/Views/IOSSessionListView.swift
@@ -7,59 +7,57 @@ struct IOSSessionListView: View {
@Environment(\.theme) private var theme
var body: some View {
- List {
- trackingModeSection
- sessionsSection
+ ScrollView {
+ LazyVStack(spacing: 1) {
+ trackingModeRow
+ .padding(.horizontal, 16)
+ .padding(.top, 8)
+ .padding(.bottom, 4)
+
+ ForEach(sessions) { session in
+ NavigationLink(destination: IOSSessionDetailView(session: session)) {
+ SessionRowContent(
+ session: session,
+ trackingMode: liveActivityManager.trackingMode,
+ isTracking: liveActivityManager.isTracking(sessionId: session.sessionId),
+ isPinned: liveActivityManager.isPinned(sessionId: session.sessionId),
+ onTogglePin: { liveActivityManager.togglePin(session) }
+ )
+ }
+ .buttonStyle(.plain)
+ }
+ }
}
- .listStyle(.plain)
+ .background(theme.background)
.navigationTitle("CodePulse")
+ .toolbarColorScheme(.dark, for: .navigationBar)
}
- private var trackingModeSection: some View {
- Section {
- HStack(spacing: 8) {
- Image(systemName: liveActivityManager.trackingMode.icon)
- .font(.system(size: 13))
- .foregroundStyle(theme.accent)
- .frame(width: 20)
+ private var trackingModeRow: some View {
+ HStack(spacing: 8) {
+ Image(systemName: liveActivityManager.trackingMode.icon)
+ .font(.system(size: 13))
+ .foregroundStyle(theme.accent)
+ .frame(width: 20)
- Text("Live Activity")
- .font(.system(size: 14, weight: .medium))
- .foregroundStyle(theme.primaryText)
+ Text("Live Activity")
+ .font(.system(size: 14, weight: .medium))
+ .foregroundStyle(theme.primaryText)
- Spacer()
+ Spacer()
- Picker("", selection: $liveActivityManager.trackingMode) {
- ForEach(TrackingMode.allCases, id: \.self) { mode in
- Text(mode.label).tag(mode)
- }
- }
- .pickerStyle(.segmented)
- .frame(width: 140)
- .onChange(of: liveActivityManager.trackingMode) { _, _ in
- liveActivityManager.onModeChanged(sessions: sessions)
+ Picker("", selection: $liveActivityManager.trackingMode) {
+ ForEach(TrackingMode.allCases, id: \.self) { mode in
+ Text(mode.label).tag(mode)
}
}
- .padding(.vertical, 2)
- }
- .listRowBackground(Color.clear)
- .listRowSeparator(.hidden)
- }
-
- private var sessionsSection: some View {
- ForEach(sessions) { session in
- NavigationLink(destination: IOSSessionDetailView(session: session)) {
- SessionRowContent(
- session: session,
- trackingMode: liveActivityManager.trackingMode,
- isTracking: liveActivityManager.isTracking(sessionId: session.sessionId),
- isPinned: liveActivityManager.isPinned(sessionId: session.sessionId),
- onTogglePin: { liveActivityManager.togglePin(session) }
- )
+ .pickerStyle(.segmented)
+ .frame(width: 140)
+ .onChange(of: liveActivityManager.trackingMode) { _, _ in
+ liveActivityManager.onModeChanged(sessions: sessions)
}
- .listRowBackground(Color.clear)
- .listRowSeparator(.hidden)
}
+ .padding(.vertical, 6)
}
}
@@ -76,7 +74,8 @@ private struct SessionRowContent: View {
SessionStatusView(
status: session.status,
completedTasks: session.completedTaskCount,
- totalTasks: session.totalTaskCount
+ totalTasks: session.totalTaskCount,
+ waitingReason: session.waitingReason
)
VStack(alignment: .leading, spacing: 3) {
@@ -94,18 +93,18 @@ private struct SessionRowContent: View {
if let subtitle = session.lastEvent ?? session.currentTask {
Text(subtitle)
.font(.system(size: 13))
- .foregroundStyle(session.status == .needsInput ? theme.warning : theme.secondaryText)
+ .foregroundStyle(subtitleColor)
.lineLimit(1)
} else {
- Text("\(session.projectName) · \(session.status.label)")
+ Text("\(session.projectName) · \(statusLabel)")
.font(.system(size: 13))
.foregroundStyle(theme.secondaryText)
.lineLimit(1)
}
Spacer()
Text(relativeTime(session.startedAt))
- .font(.system(size: 12, design: .rounded))
- .foregroundStyle(theme.secondaryText)
+ .font(.system(size: 12, design: .monospaced))
+ .foregroundStyle(theme.tertiaryText)
}
if !session.tasks.isEmpty {
MiniProgressBar(tasks: session.tasks)
@@ -114,26 +113,30 @@ private struct SessionRowContent: View {
liveActivityIndicator
}
- .padding(.vertical, 4)
+ .padding(.horizontal, 16)
+ .padding(.vertical, 8)
+ }
+
+ private var statusLabel: String {
+ guard session.status == .needsInput else { return session.status.label }
+ return session.waitingReason?.label ?? "Needs Input"
+ }
+
+ private var subtitleColor: Color {
+ guard session.status == .needsInput else { return theme.secondaryText }
+ return theme.waitingColor(for: session.waitingReason)
}
@ViewBuilder
private var liveActivityIndicator: some View {
switch trackingMode {
case .auto:
- // Auto mode: just show indicator, no interaction
- if isTracking {
- Image(systemName: "dot.radiowaves.up.forward")
- .font(.system(size: 13))
- .foregroundStyle(theme.accent)
- .frame(width: 24, height: 24)
- }
+ EmptyView()
case .manual:
- // Manual mode: tappable pin button
Button(action: onTogglePin) {
Image(systemName: isPinned ? "pin.fill" : "pin")
.font(.system(size: 13))
- .foregroundStyle(isPinned ? theme.accent : theme.secondaryText.opacity(0.4))
+ .foregroundStyle(isPinned ? theme.primaryText : theme.tertiaryText)
.frame(width: 28, height: 28)
.contentShape(Rectangle())
}
@@ -144,10 +147,10 @@ private struct SessionRowContent: View {
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" }
- if seconds < 604800 { return "\(Int(seconds / 86400))d ago" }
- return "\(Int(seconds / 604800))w ago"
+ if seconds < 3600 { return "\(Int(seconds / 60))m" }
+ if seconds < 86400 { return "\(Int(seconds / 3600))h" }
+ if seconds < 604800 { return "\(Int(seconds / 86400))d" }
+ return "\(Int(seconds / 604800))w"
}
}
@@ -168,9 +171,9 @@ private struct MiniProgressBar: View {
private func color(for status: TaskStatus) -> Color {
switch status {
- case .completed: return .blue
- case .inProgress: return .blue.opacity(0.4)
- case .pending: return theme.secondaryText.opacity(0.2)
+ case .completed: return theme.accent
+ case .inProgress: return theme.accent.opacity(0.4)
+ case .pending: return theme.secondaryText.opacity(0.15)
}
}
}
diff --git a/CodePulse-iOS/Views/IOSSessionTagView.swift b/CodePulse-iOS/Views/IOSSessionTagView.swift
index 8fe35aa7..1bc9436c 100644
--- a/CodePulse-iOS/Views/IOSSessionTagView.swift
+++ b/CodePulse-iOS/Views/IOSSessionTagView.swift
@@ -2,16 +2,17 @@ import SwiftUI
struct SessionTagView: View {
let tag: String
+ @Environment(\.theme) private var theme
var body: some View {
Text(tag)
.font(.system(size: 10, weight: .medium, design: .monospaced))
- .foregroundStyle(.secondary)
- .padding(.horizontal, 4)
+ .foregroundStyle(theme.tertiaryText)
+ .padding(.horizontal, 5)
.padding(.vertical, 2)
.background(
RoundedRectangle(cornerRadius: 4, style: .continuous)
- .fill(Color.primary.opacity(0.06))
+ .fill(theme.border)
)
}
}
diff --git a/CodePulse-iOS/Views/IOSStatusIndicator.swift b/CodePulse-iOS/Views/IOSStatusIndicator.swift
index 0243b398..8ec7227d 100644
--- a/CodePulse-iOS/Views/IOSStatusIndicator.swift
+++ b/CodePulse-iOS/Views/IOSStatusIndicator.swift
@@ -5,6 +5,8 @@ struct SessionStatusView: View {
let status: SessionStatus
let completedTasks: Int
let totalTasks: Int
+ var waitingReason: WaitingReason?
+ @Environment(\.theme) private var theme
private var hasTasks: Bool { totalTasks > 0 }
private var progress: Double {
@@ -13,13 +15,13 @@ struct SessionStatusView: View {
var body: some View {
if hasTasks {
- ProgressRingView(progress: progress, status: status)
+ ProgressRingView(progress: progress, status: status, waitingReason: waitingReason)
.frame(width: 22, height: 22)
} else if status == .working {
ClaudeSparkleView()
.frame(width: 18, height: 18)
} else {
- MinimalDotView(status: status)
+ MinimalDotView(status: status, waitingReason: waitingReason)
}
}
}
@@ -27,6 +29,8 @@ struct SessionStatusView: View {
private struct ProgressRingView: View {
let progress: Double
let status: SessionStatus
+ var waitingReason: WaitingReason?
+ @Environment(\.theme) private var theme
@State private var isPulsing = false
private var isWorking: Bool { status == .working }
@@ -35,22 +39,22 @@ private struct ProgressRingView: View {
var body: some View {
ZStack {
Circle()
- .stroke(Color.primary.opacity(0.08), lineWidth: 2.5)
+ .stroke(theme.secondaryText.opacity(0.15), lineWidth: 2.5)
Circle()
.trim(from: 0, to: progress)
- .stroke(Color.blue, style: StrokeStyle(lineWidth: 2.5, lineCap: .round))
+ .stroke(theme.primaryText.opacity(0.7), style: StrokeStyle(lineWidth: 2.5, lineCap: .round))
.rotationEffect(.degrees(-90))
if isWorking {
Circle()
.trim(from: max(0, progress - 0.08), to: progress)
- .stroke(Color.blue.opacity(0.6), style: StrokeStyle(lineWidth: 3.5, lineCap: .round))
+ .stroke(theme.primaryText.opacity(0.4), style: StrokeStyle(lineWidth: 3.5, lineCap: .round))
.rotationEffect(.degrees(-90))
.blur(radius: 1.5)
.opacity(isPulsing ? 1.0 : 0.3)
}
if needsAttention {
Circle()
- .fill(Color.orange)
+ .fill(theme.waitingColor(for: waitingReason))
.frame(width: 6, height: 6)
.offset(x: 7, y: -7)
}
@@ -66,6 +70,8 @@ private struct ProgressRingView: View {
private struct MinimalDotView: View {
let status: SessionStatus
+ var waitingReason: WaitingReason?
+ @Environment(\.theme) private var theme
@State private var isPulsing = false
private var needsPulse: Bool { status == .needsInput || status == .error }
@@ -74,7 +80,7 @@ private struct MinimalDotView: View {
ZStack {
if needsPulse {
Circle()
- .fill(Color.orange.opacity(0.3))
+ .fill(dotColor.opacity(0.3))
.frame(width: 20, height: 20)
.scaleEffect(isPulsing ? 1.4 : 0.8)
.opacity(isPulsing ? 0 : 0.6)
@@ -95,11 +101,12 @@ private struct MinimalDotView: View {
private var dotColor: Color {
switch status {
- case .needsInput, .error: return .orange
- case .compacting: return .purple
- case .idle: return .secondary.opacity(0.4)
- case .completed: return .secondary.opacity(0.3)
- default: return .secondary.opacity(0.4)
+ case .needsInput, .error:
+ return theme.waitingColor(for: waitingReason)
+ case .compacting: return theme.accent
+ case .idle: return theme.tertiaryText
+ case .completed: return theme.tertiaryText.opacity(0.7)
+ default: return theme.tertiaryText
}
}
}
@@ -107,13 +114,14 @@ private struct MinimalDotView: View {
struct ClaudeSparkleView: View {
private static let phases: [String] = ["·", "✢", "✳", "✶", "✻", "✽"]
private static let cycle: [String] = phases + phases.dropFirst().dropLast().reversed()
+ @Environment(\.theme) private var theme
@State private var currentIndex = 0
private let timer = Timer.publish(every: 0.22, on: .main, in: .common).autoconnect()
var body: some View {
Text(Self.cycle[currentIndex])
.font(.system(size: 14))
- .foregroundStyle(.secondary.opacity(opacity))
+ .foregroundStyle(theme.primaryText.opacity(opacity))
.onReceive(timer) { _ in
currentIndex = (currentIndex + 1) % Self.cycle.count
}
diff --git a/CodePulse-iOS/Views/IOSTheme.swift b/CodePulse-iOS/Views/IOSTheme.swift
index 75a47e08..1c3b1441 100644
--- a/CodePulse-iOS/Views/IOSTheme.swift
+++ b/CodePulse-iOS/Views/IOSTheme.swift
@@ -1,29 +1,43 @@
import SwiftUI
+import CodePulseShared
+/// CodePulse iOS design system — Vercel/Cursor inspired, dark-only.
+/// Pure black background + #ededed foreground with opacity hierarchy.
struct CodePulseTheme: Sendable {
- let isDark: Bool
+ // Single-source foreground — #ededed varied by opacity
+ private static let fg = Color(red: 0.93, green: 0.93, blue: 0.93)
- var background: Color {
- isDark ? Color(red: 0.11, green: 0.11, blue: 0.12) : .white
- }
- var cardBackground: Color {
- isDark ? Color.white.opacity(0.05) : Color.black.opacity(0.03)
- }
- var primaryText: Color {
- isDark ? Color(red: 0.96, green: 0.96, blue: 0.97) : Color(red: 0.11, green: 0.11, blue: 0.12)
- }
- var secondaryText: Color {
- isDark ? Color(red: 0.56, green: 0.56, blue: 0.58) : Color(red: 0.53, green: 0.53, blue: 0.55)
- }
- var separator: Color {
- isDark ? Color.white.opacity(0.1) : Color.black.opacity(0.08)
+ // MARK: - Backgrounds
+
+ var background: Color { Color(red: 0.06, green: 0.06, blue: 0.07) }
+ var cardBackground: Color { Color.white.opacity(0.05) }
+ var hoverBackground: Color { Color.white.opacity(0.06) }
+ var rowBackground: Color { Color.white.opacity(0.03) }
+
+ // MARK: - Text hierarchy
+
+ var primaryText: Color { Self.fg }
+ var secondaryText: Color { Self.fg.opacity(0.55) }
+ var tertiaryText: Color { Self.fg.opacity(0.35) }
+
+ // MARK: - Borders
+
+ var separator: Color { Color.white.opacity(0.08) }
+ var border: Color { Color.white.opacity(0.08) }
+
+ // MARK: - Semantic
+
+ var accent: Color { Color(red: 0.35, green: 0.56, blue: 1.0) }
+ var warning: Color { Self.fg }
+ var danger: Color { Self.fg }
+
+ func waitingColor(for reason: WaitingReason?) -> Color {
+ reason?.isPermission == true ? danger : warning
}
- var accent: Color { .blue }
- var warning: Color { .orange }
}
private struct ThemeKey: EnvironmentKey {
- static let defaultValue = CodePulseTheme(isDark: false)
+ static let defaultValue = CodePulseTheme()
}
extension EnvironmentValues {
diff --git a/CodePulse-macOS/Services/CloudKitSync.swift b/CodePulse-macOS/Services/CloudKitSync.swift
index 003dcb34..f17b8a53 100644
--- a/CodePulse-macOS/Services/CloudKitSync.swift
+++ b/CodePulse-macOS/Services/CloudKitSync.swift
@@ -25,7 +25,7 @@ final class CloudKitSync {
init(stateManager: SessionStateManager) {
self.stateManager = stateManager
stateManager.$sessions
- .throttle(for: .seconds(5), scheduler: RunLoop.main, latest: true)
+ .throttle(for: .seconds(2), scheduler: RunLoop.main, latest: true)
.sink { [weak self] sessions in
self?.syncToCloud(sessions)
}
@@ -35,21 +35,22 @@ final class CloudKitSync {
private func syncToCloud(_ sessions: [SessionState]) {
guard !isSyncing else { return }
- // Respect quota backoff
if let backoff = quotaBackoffUntil, Date() < backoff { return }
quotaBackoffUntil = nil
let currentIds = Set(sessions.map(\.sessionId))
- // Sessions that disappeared or completed since last sync → delete from CloudKit
- let completedIds = sessions.filter { $0.status == .completed }.map(\.sessionId)
+ // DELETE only when session disappears from the list entirely.
+ // This means the PID is dead and SessionScanner dropped it.
+ // Status changes (working → idle → needsInput → completed) are always SAVED, never deleted.
let disappearedIds = previousSessionIds.subtracting(currentIds)
- let toDelete = Array(Set(completedIds).union(disappearedIds))
+ let toDelete = Array(disappearedIds)
- // Active sessions with changed content → save to CloudKit
+ // SAVE any session whose state changed
let toSave = sessions.filter { session in
- session.status != .completed
- && previousStates[session.sessionId]?.updatedAt != session.updatedAt
+ previousStates[session.sessionId]?.updatedAt != session.updatedAt
+ || previousStates[session.sessionId]?.status != session.status
+ || previousStates[session.sessionId]?.waitingReason != session.waitingReason
}
guard !toDelete.isEmpty || !toSave.isEmpty else {
@@ -67,7 +68,7 @@ final class CloudKitSync {
do {
if !toDelete.isEmpty {
- Self.log("deleteByIds \(toDelete.count) sessions")
+ Self.log("deleteByIds \(toDelete.count) sessions (PID dead)")
try await CloudKitManager.shared.deleteByIds(toDelete)
Self.log("SUCCESS: deleted \(toDelete.count)")
for id in toDelete {