native macOS codings agent orchestrator prowl.onev.cat
Something went wrong. Try again.
Swift
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980import ComposableArchitectureimport ProwlCLISharedimport SwiftUI
struct WorkflowBundleReviewView: View { let review: WorkflowBundleReview? let selectFile: (String) -> Void let approve: () -> Void let reveal: () -> Void let close: () -> Void
var body: some View { if let review { VStack(alignment: .leading, spacing: 16) { Text("Review Workflow Bundle").font(.title2.bold()) Text(review.snapshot.source.path).font(.callout.monospaced()).textSelection(.enabled) Text( """ Scripts can read and change files, use the network, and run programs with your permissions. Approval applies to every file in this version of the bundle. """ ) .fixedSize(horizontal: false, vertical: true) ForEach(review.scripts, id: \.id) { script in LabeledContent(script.name, value: "\(script.interpreter) · actions/\(script.id)/\(script.entrypoint)") .font(.callout) } if !review.changes.isEmpty { Text("\(review.changes.count) file change(s). Previous approval does not cover this version.") .foregroundStyle(.secondary) } HSplitView { List(review.filePaths, id: \.self) { path in Button { selectFile(path) } label: { HStack { Text(path).fontWeight(path == review.selectedFile ? .semibold : .regular) Spacer() if let change = review.changes.first(where: { $0.path == path }) { Text(change.kind.rawValue).foregroundStyle(.secondary) } } } .buttonStyle(.plain) .help("Review \(path)") } .frame(minWidth: 180, idealWidth: 220) ScrollView([.horizontal, .vertical]) { Text(review.preview).font(.body.monospaced()).textSelection(.enabled) .frame(maxWidth: .infinity, alignment: .topLeading).padding(8) } .frame(minWidth: 340) } .frame(minHeight: 260) if let error = review.error { Text(error).foregroundStyle(.red).fixedSize(horizontal: false, vertical: true) } if review.approved { Label("Approved. Start the workflow when you are ready.", systemImage: "checkmark.shield") } HStack { Button("Reveal Bundle") { reveal() } .help("Open the bundle location in Finder") Spacer() Button("Close") { close() }.keyboardShortcut(.cancelAction) .help("Close this review (Escape)") if !review.approved { Button("Approve This Version") { approve() } .buttonStyle(.borderedProminent) .disabled(review.scripts.isEmpty) .help("Approve this source and content version; this does not start the workflow") } } } .padding(24) .frame(minWidth: 720, idealWidth: 820, minHeight: 520) .accessibilityIdentifier("workflow-bundle-review") } }}