Skip to content

Commit 904d4c8

Browse files
authored
Merge pull request #4 from MishaKav/feature/one-time-commands
Add one-time commands, scripts directory, and native notifications
2 parents f1c5277 + 66fa9b4 commit 904d4c8

File tree

19 files changed

+1306
-288
lines changed

19 files changed

+1306
-288
lines changed

AGENTS.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
- Emit logs through `log`/`oslog` with concise context fields so Console filtering remains effective.
3232

3333
## Architecture & Design Patterns
34-
- **Core components:** `main.rs` (Cocoa setup, initialization, run loop), `app.rs` (main state with `TunnelManager` and status item wrapper), `config.rs` (TOML config load/manage), `menu.rs` (NSStatusItem + NSMenu creation and icon handling), `tunnel.rs` (SSH/port-forward lifecycle), `logger.rs` (oslog configuration).
35-
- **Key patterns:** thread-safe global state via `OnceLock<App>`, thread-safe Cocoa wrappers, Objective-C bridge class for menu callbacks, async threads for long-running tunnel commands.
34+
- **Core components:** `main.rs` (Cocoa setup, initialization, run loop), `app.rs` (main state with `TunnelManager`, `CommandRunner`, and status item wrapper), `config.rs` (TOML config load/manage, script auto-discovery), `command.rs` (one-time command execution with silent/notify/terminal output modes), `menu.rs` (NSStatusItem + NSMenu creation and icon handling), `tunnel.rs` (SSH/port-forward lifecycle), `logger.rs` (oslog configuration).
35+
- **Key patterns:** thread-safe global state via `OnceLock<App>`, thread-safe Cocoa wrappers, Objective-C bridge class for menu callbacks, async threads for long-running tunnel commands, callback-based cross-platform dispatch in `CommandRunner`.
3636
- **Dependencies:** cocoa/objc2, core-foundation, log/oslog, libc, toml, serde; patched `objc` fork for compatibility.
3737

3838
## Tunnel Configuration
@@ -41,6 +41,13 @@
4141
- Supports any command-line tool that can be started/stopped; config uses `#[serde(default)]` on optional fields for backward compatibility.
4242
- Default seed tunnels: `example-ssh`, `k8s-example`, and `colima`.
4343

44+
## One-Time Commands
45+
- `[commands]` config section for fire-and-forget commands (no kill_command needed).
46+
- Each command defines `name`, `command`, `args`, and optional `output` mode (`"silent"` | `"notify"` | `"terminal"`).
47+
- `CommandRunner` in `core/src/command.rs` dispatches execution based on output mode using platform-specific callbacks (notify and terminal).
48+
- `scripts_dir` config option auto-discovers `*.sh` files and adds them as commands with `"notify"` output mode.
49+
- Menu order: Tunnels → Commands → Scheduled Tasks → system items.
50+
4451
## Configuration Management
4552
- If config loading fails, fall back to hardcoded defaults.
4653
- `path` config entry controls PATH used for child processes; defaults include Homebrew locations.

0 commit comments

Comments
 (0)