This commit is contained in:
2026-02-25 08:24:05 +01:00
parent 914d608d35
commit 3997f3feee
7 changed files with 504 additions and 105 deletions

View File

@@ -528,6 +528,99 @@ It's better to admit "I need more information" or "I cannot do that" than to fak
}
// Anytype integration UI hidden (work in progress see AnytypeMCPService.swift)
// MARK: Bash Execution
Divider()
VStack(alignment: .leading, spacing: 8) {
HStack(spacing: 8) {
Image(systemName: "terminal.fill")
.font(.title2)
.foregroundStyle(.orange)
Text("Bash Execution")
.font(.system(size: 18, weight: .semibold))
}
Text("Allow the AI to run shell commands on your machine. Commands are executed via /bin/zsh. Enable approval mode to review each command before it runs.")
.font(.system(size: 14))
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
}
.padding(.bottom, 4)
VStack(alignment: .leading, spacing: 6) {
sectionHeader("Status")
formSection {
row("Enable Bash Execution") {
Toggle("", isOn: $settingsService.bashEnabled)
.toggleStyle(.switch)
}
}
}
HStack(spacing: 4) {
Image(systemName: settingsService.bashEnabled ? "checkmark.circle.fill" : "circle")
.foregroundStyle(settingsService.bashEnabled ? .orange : .secondary)
.font(.system(size: 13))
Text(settingsService.bashEnabled ? "Active — AI can run shell commands" : "Disabled")
.font(.system(size: 13))
.foregroundStyle(.secondary)
}
.padding(.horizontal, 4)
if settingsService.bashEnabled {
VStack(alignment: .leading, spacing: 6) {
sectionHeader("Settings")
formSection {
row("Require Approval") {
Toggle("", isOn: $settingsService.bashRequireApproval)
.toggleStyle(.switch)
}
rowDivider()
row("Working Directory") {
TextField("~", text: $settingsService.bashWorkingDirectory)
.textFieldStyle(.plain)
.font(.system(size: 13, design: .monospaced))
.multilineTextAlignment(.trailing)
.frame(width: 200)
}
rowDivider()
row("Timeout (seconds)") {
HStack(spacing: 8) {
Stepper("", value: $settingsService.bashTimeout, in: 5...300, step: 5)
.labelsHidden()
Text("\(settingsService.bashTimeout)s")
.font(.system(size: 13))
.foregroundStyle(.secondary)
.frame(width: 36, alignment: .trailing)
}
}
}
}
if settingsService.bashRequireApproval {
HStack(spacing: 6) {
Image(systemName: "hand.raised.fill")
.font(.system(size: 12))
.foregroundStyle(.orange)
Text("Each command will require your approval before running.")
.font(.system(size: 13))
.foregroundStyle(.secondary)
}
.padding(.horizontal, 4)
} else {
HStack(alignment: .top, spacing: 6) {
Image(systemName: "exclamationmark.triangle.fill")
.font(.system(size: 12))
.foregroundStyle(.red)
.padding(.top, 1)
Text("Auto-execute mode: commands run without approval. Use with caution.")
.font(.system(size: 13))
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
}
.padding(.horizontal, 4)
}
}
}
// MARK: - Appearance Tab