summaryrefslogtreecommitdiff
path: root/README.md
blob: 65874ca72cb7ef36acc6173f0bd808d63d6b1788 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<div align="center">

<img src="Resources/AppIcon.png" alt="Bubomb App Icon" width="140" height="140" style="border-radius: 28px; box-shadow: 0 10px 30px rgba(255, 107, 0, 0.35);" />

# πŸ’£ BUBOMB

### **Configure the boom.**

*A native, ultra-minimal macOS menu bar utility designed for instant, zero-latency detonation of your most critical action.*

<br/>

[![macOS 14+](https://img.shields.io/badge/macOS-14.0%2B%20Sonoma%20%7C%20Sequoia-FF5A00?style=for-the-badge&logo=apple&logoColor=white)](https://apple.com)
[![Swift 6](https://img.shields.io/badge/Swift-6.0-FA7343?style=for-the-badge&logo=swift&logoColor=white)](https://swift.org)
[![Build & Tests](https://img.shields.io/badge/Tests-29%2F29%20Passing-34C759?style=for-the-badge&logo=githubactions&logoColor=white)](https://github.com/gigagamerchaddhruv-spec/bubomb)
[![Zero Dependencies](https://img.shields.io/badge/Dependencies-0%20(Pure%20Native)-7A5AF8?style=for-the-badge)](https://github.com/gigagamerchaddhruv-spec/bubomb)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue?style=for-the-badge)](LICENSE)

<br/>

> **"One bomb. One configured action. One click. BOOM."**

<br/>

[Key Highlights](#-why-bubomb) β€’
[Menu Bar Experience](#-menu-bar-experience) β€’
[Architecture](#-system-architecture) β€’
[Payload Engines](#-supported-payloads) β€’
[Quick Recipes](#-battle-tested-recipes) β€’
[Installation & Build](#-build--quickstart)

<br/>

---

</div>

<br/>

## ⚑ The Philosophy

Most automation tools on macOS have become bloated command centers. You trigger a hotkey, wait for a spotlight modal to render, type a search query, select an item from a list, press Enter, and wait.

**Bubomb cuts through the noise.**

You configure what matters **once**. When that moment comesβ€”deploying code, launching a deep-work stack, blowing away docker caches, or firing a build pipelineβ€”you simply click the tiny bomb resting quietly in your menu bar. 

**Zero searching. Zero modals. Immediate detonation.**

<br/>

```
  Traditional Menu Bar Tools                     Bubomb
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚ 1. Click menu item        β”‚         β”‚ 1. Click the bomb.      β”‚
 β”‚ 2. Scroll through 15 itemsβ”‚   vs    β”‚                         β”‚
 β”‚ 3. Open sub-menu          β”‚         β”‚ πŸ’₯ BOOM. Done.          β”‚
 β”‚ 4. Confirm dialog         β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
 β”‚ 5. Wait for output...     β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

<br/>

---

## ✨ Why Bubomb?

| Feature | What You Get |
| :--- | :--- |
| 🎯 **Instant Detonation** | Left-click detonates directly with **0ms interaction delay**. No intermediate dropdowns. |
| πŸ”Œ **True macOS Native** | Built in **Swift 6**, **SwiftUI**, and **AppKit** (`NSStatusItem`). 100% Cocoa. |
| πŸͺΆ **Featherweight** | Tiny memory footprint (~18MB RAM), 0% idle CPU, no Electron or web wrappers. |
| 🎨 **Dynamic Vector Bomb** | Silhouette adapts natively to Light and Dark macOS menu bars. Dynamic burning fuse sparks and explosion burst animations. |
| πŸ›‘οΈ **Subprocess Armor** | Pipe deadlock protection, asynchronous stream drains, supervisor timeouts, and SIGKILL safety nets. |
| ⚠️ **Destructive Guard** | Automated heuristic scanning guards against catastrophic patterns (`rm -rf /`, `dd`, fork bombs). |
| πŸ”’ **100% Offline & Sovereign** | No servers, no telemetry, no cloud keys. All logs and scripts stay on your Mac. |

<br/>

---

## πŸ–₯ Menu Bar Experience

Bubomb lives as an unobtrusive status accessory (`LSUIElement = true`), leaving your Dock clean.

```mermaid
flowchart TD
    Click([User Clicks Menu Bar Bomb]) --> Check{Is Payload Armed?}
    
    Check -- No --> Settings[Open Bubomb Settings Window]
    Check -- Yes --> Detonate[Detonate Configured Action]
    
    Detonate --> Ignite[Ignite Fuse Animation]
    Ignite --> Exec[Execute Async in Background]
    Exec --> Result{Execution Success?}
    
    Result -- Yes --> Boom[πŸ’₯ Starburst BOOM & Audio Chime]
    Result -- No --> Fail[❌ Red Alert Indicator & Log Failure]
    
    Boom --> Idle[Return to Armed Idle]
    Fail --> Idle
```

### Direct Clicks vs. Power Menu

* **Normal Left-Click:** Detonates the configured payload immediately. If no payload is armed, opens the Settings window.
* **Right-Click / Control-Click:** Unfurls the utility power menu:
  * πŸ’£ `Bubomb β€” Configure the boom`
  * πŸ’₯ `Detonate Payload (Return)`
  * βš™οΈ `Settings... (Cmd+,)`
  * ⏹️ `Cancel Running Task (during execution)`
  * πŸšͺ `Quit Bubomb (Cmd+Q)`

<br/>

---

## 🎨 Iconography & Animation Engine

Bubomb features original vector artwork designed for crisp rendering at 18Γ—18pt menu bar dimensions:

* **Idle (Template):** Minimalist monochrome bomb silhouette matching your system accents.
* **Detonating (Burning):** High-speed animated fuse ignition with warm orange (`#FF6B00`) and amber (`#FFAA00`) sparks flickering at 120ms intervals.
* **Completion (Success):** Tasteful 8-ray starburst explosion animation, accompanied by a subtle completion sound.
* **Completion (Failure):** Subtle warning badge indicating a non-zero exit status or timeout.
* **Accessibility:** Fully honors macOS `Reduce Motion` preference (`accessibilityDisplayShouldReduceMotion`).

<br/>

---

## 🧩 Supported Payloads

Bubomb includes five typed, extensible payload engines:

### 1. πŸ’» Shell Command
Direct binary execution or explicit shell invocation (`/bin/zsh`, `/bin/bash`, `/bin/sh`).
- Working directory selection with directory picker.
- Parameterized arguments array.
- Custom environment variable key-value table.
- Configurable execution timeouts (5s to 120s or infinite).

### 2. πŸš€ Open Application
Instant native app launching via `NSWorkspace`.
- Pick applications from `/Applications` with macOS file panel.
- Pass custom launch arguments to binaries.

### 3. 🌐 Open Web Destination
Opens validated HTTP and HTTPS destinations in your default macOS browser.
- Live URL scheme and host validator.

### 4. πŸ“œ Run Local Script
Execute scripts (`.sh`, `.py`, `.rb`, `.zsh`, `.pl`) safely.
- Automatic shebang detection (`#!/usr/bin/env python3`).
- Automatic interpreter resolution without silently mutating file permissions.

### 5. ⛓️ Multi-Step Sequence
Chain multiple diverse actions in deterministic order.
- Reorder steps with drag / arrows.
- Live progress reporting (`Step 2 of 4: Running Build...`).
- Configurable failure policy: `stopOnError` or `continueOnError`.

<br/>

---

## πŸ› System Architecture

Bubomb is structured as a decoupled Swift package:

```mermaid
graph LR
    subgraph UI ["BubombUI (SwiftUI + AppKit)"]
        MB["MenuBarController"]
        BV["BombIconRenderer"]
        SV["SettingsView"]
        WM["WindowManager"]
    end

    subgraph Core ["BubombCore (Foundation + Swift Concurrency)"]
        PE["PayloadExecutor (@MainActor)"]
        PR["ProcessRunner (TaskGroup Pipes)"]
        SP["SafetyPolicy (Heuristic Engine)"]
        SS["SettingsStore (UserDefaults + JSON)"]
    end

    MB -->|Click| PE
    PE -->|Evaluate| SP
    PE -->|Run| PR
    PE -->|Persist| SS
    PE -.->|State Broadcast| MB
    PE -.->|Logs & History| SV
```

### Concurrency & Deadlock Elimination
Many macOS apps freeze when subprocesses output large streams because Foundation's `Pipe` buffer (64 KB) fills up before exit. Bubomb uses concurrent non-blocking `readabilityHandler` streams and modern Swift `TaskGroup` routines to drain output buffers in real time, guaranteeing zero UI stalls.

<br/>

---

## 🍳 Battle-Tested Recipes

Here are a few popular payloads Bubomb users keep armed:

### Recipe 1: The "Emergency Production Reset"
```bash
# Type: Shell Command
docker compose down -v && docker compose up -d --build
```

### Recipe 2: The "Deep Work Workspace"
```
Type: Multi-step Sequence
1. Open App: /Applications/Visual Studio Code.app
2. Open App: /System/Applications/Utilities/Terminal.app
3. Open URL: https://linear.app/my-team/inbox
4. Shell Command: cd ~/code/core && git pull --rebase
```

### Recipe 3: The "Flush All macOS Caches"
```bash
# Type: Shell Command
dscacheutil -flushcache && sudo killall -HUP mDNSResponder
```

<br/>

---

## πŸ§ͺ Comprehensive Test Suite

Bubomb includes 29 automated tests verifying every aspect of validation, safety heuristics, process supervision, timeouts, and sequential execution.

```bash
make test
```

```
πŸ’£ Running Bubomb Test Suite...

β€’ PayloadValidationTests
  βœ“ testEmptyPayloadNameThrows (0.000s)
  βœ“ testEmptyCommandThrows (0.000s)
  βœ“ testValidShellCommandPasses (0.000s)
  βœ“ testNonExistentShellThrows (0.000s)
  βœ“ testNonExistentWorkingDirectoryThrows (0.000s)
  βœ“ testInvalidURLThrows (0.000s)
  βœ“ testValidURLPasses (0.000s)
  βœ“ testNonExistentScriptThrows (0.000s)
  βœ“ testEmptySequenceThrows (0.000s)

β€’ SettingsStoreTests
  βœ“ testInitialSettings (0.004s)
  βœ“ testSaveAndRetrieveActivePayload (0.004s)
  βœ“ testExecutionHistoryCap (0.041s)
  βœ“ testClearHistory (0.005s)
  βœ“ testResetToDefaults (0.004s)

β€’ ProcessRunnerTests
  βœ“ testSuccessfulCommandExecution (0.068s)
  βœ“ testShellCommandExecutorWithArguments (0.073s)
  βœ“ testNonZeroExitStatusThrows (0.067s)
  βœ“ testEnvironmentVariablesPassedToProcess (0.083s)
  βœ“ testWorkingDirectory (0.068s)
  βœ“ testProcessTimeout (0.346s)
  βœ“ testProcessCancellation (0.135s)

β€’ URLLauncherTests
  βœ“ testValidURLs (0.000s)
  βœ“ testInvalidURLs (0.000s)

β€’ SafetyPolicyTests
  βœ“ testDestructiveCommandsDetected (0.005s)
  βœ“ testSuspiciousCommandsDetected (0.001s)
  βœ“ testSafeCommandsPass (0.003s)

β€’ SequenceExecutorTests
  βœ“ testSuccessfulSequentialExecution (0.141s)
  βœ“ testSequenceStopsOnErrorWhenConfigured (0.065s)
  βœ“ testSequenceContinuesOnErrorWhenConfigured (0.073s)

--------------------------------------------------
πŸ’₯ All 29 tests passed in 1.19s! BOOM!
```

<br/>

---

## πŸš€ Build & Quickstart

### Prerequisites
* macOS 14.0 (Sonoma) or newer.
* Xcode Command Line Tools or full Xcode.

### 1. Build and Run
```bash
git clone git@github.com:gigagamerchaddhruv-spec/bubomb.git
cd bubomb

# Build and assemble Bubomb.app release bundle
make app

# Launch in your menu bar
make run
```

### 2. Available Make Targets
```bash
make build    # Compile debug build via SwiftPM
make test     # Run all 29 automated test cases
make app      # Package and ad-hoc sign Bubomb.app
make run      # Launch Bubomb.app
make clean    # Remove build artifacts
```

<br/>

---

## ⌨️ Keyboard Shortcuts

| Shortcut | Action |
| :--- | :--- |
| `Cmd + S` | Save active payload configuration |
| `Cmd + Return` | Test / detonate payload from settings |
| `Cmd + 1` | Switch to **Payload** tab |
| `Cmd + 2` | Switch to **Execution Log** tab |
| `Cmd + 3` | Switch to **General** tab |
| `Cmd + W` | Close Settings window (Bubomb stays armed in menu bar) |
| `Cmd + Q` | Quit Bubomb completely |

<br/>

---

## πŸ”’ Security & Privacy Policy

* **No Privileged Escalation:** Bubomb never invokes `sudo` or requests root privileges automatically.
* **No Telemetry:** Bubomb contains zero analytics, tracking beacons, or remote logging.
* **Integrity Guard:** Evaluates shell payloads for destructive triggers (`rm -rf ~`, formatting drives) and requires deliberate user override before detonation.
* **Gatekeeper Friendly:** Ad-hoc signed out-of-the-box, fully compatible with Apple Silicon and modern macOS runtime protections.

<br/>

---

<div align="center">

**Bubomb** is crafted with ❀️ for developers who love speed, simplicity, and clean macOS design.

*"Configure the boom. Click the bomb. Get the result."*

[⭐ Star on GitHub](https://github.com/gigagamerchaddhruv-spec/bubomb) β€’ [Report Issue](https://github.com/gigagamerchaddhruv-spec/bubomb/issues)

</div>