add feature toggles
This commit is contained in:
@@ -16,12 +16,14 @@ The tool integrates with Claude Code's hook system to send real-time notificatio
|
||||
|
||||
The entire implementation is a single Babashka script (`iamwaiting`) with these key functions:
|
||||
|
||||
- `load-config` - Loads webhook URL from config file or environment variable
|
||||
- `load-config` - Loads webhook URL and toggles from config file or environment variable
|
||||
- `send-discord-webhook` - Makes HTTP POST request to Discord webhook API
|
||||
- `format-waiting-message` - Formats the notification message with project context
|
||||
- `setup-config` - Interactive setup wizard for webhook configuration
|
||||
- `test-webhook` - Sends a test message to verify configuration
|
||||
- `send-waiting-notification` - Main function that sends the notification
|
||||
- `send-waiting-notification` - Main function that sends the notification (respects toggles)
|
||||
- `toggle-feature` - Toggle notification features on or off via CLI
|
||||
- `show-toggle-status` - Display current toggle status
|
||||
- `-main` - CLI argument parsing and entry point
|
||||
|
||||
### Configuration
|
||||
@@ -30,13 +32,46 @@ Configuration is stored in `~/.iamwaiting/config.edn` with the following structu
|
||||
|
||||
```clojure
|
||||
{:webhook-url "https://discord.com/api/webhooks/..."
|
||||
:user-id "123456789012345678"} ; Optional: Discord user ID for @mentions
|
||||
:user-id "123456789012345678" ; Optional: Discord user ID for @mentions
|
||||
:toggles {:idle-prompt true ; Enable idle prompt notifications
|
||||
:permission-prompt true}} ; Enable permission prompt notifications
|
||||
```
|
||||
|
||||
Alternatively, configuration can be set via environment variables:
|
||||
- `IAMWAITING_WEBHOOK_URL` - Discord webhook URL (required)
|
||||
- `IAMWAITING_USER_ID` - Discord user ID for @mentions (optional)
|
||||
|
||||
### Notification Toggles
|
||||
|
||||
Control which types of notifications are sent using the `:toggles` configuration key. If toggles are not specified, both notification types are enabled by default (backwards compatible).
|
||||
|
||||
**Managing toggles via CLI:**
|
||||
```bash
|
||||
# Show current toggle status
|
||||
iamwaiting toggle status
|
||||
|
||||
# Disable idle prompt notifications
|
||||
iamwaiting toggle idle-prompt off
|
||||
|
||||
# Enable permission prompt notifications
|
||||
iamwaiting toggle permission-prompt on
|
||||
```
|
||||
|
||||
**Manually editing config file:**
|
||||
```clojure
|
||||
;; Only get notified for permission prompts
|
||||
{:webhook-url "https://discord.com/api/webhooks/..."
|
||||
:toggles {:idle-prompt false
|
||||
:permission-prompt true}}
|
||||
|
||||
;; Disable all notifications
|
||||
{:webhook-url "https://discord.com/api/webhooks/..."
|
||||
:toggles {:idle-prompt false
|
||||
:permission-prompt false}}
|
||||
```
|
||||
|
||||
**Default behavior:** If toggles are not specified in the config file, both notification types are enabled.
|
||||
|
||||
## Installation
|
||||
|
||||
Install via bbin (recommended):
|
||||
@@ -71,6 +106,25 @@ iamwaiting
|
||||
iamwaiting '{"cwd": "/path/to/project"}'
|
||||
```
|
||||
|
||||
### Toggle Management
|
||||
|
||||
```bash
|
||||
# Show current toggle status
|
||||
iamwaiting toggle status
|
||||
|
||||
# Disable idle prompt notifications
|
||||
iamwaiting toggle idle-prompt off
|
||||
|
||||
# Enable permission prompt notifications
|
||||
iamwaiting toggle permission-prompt on
|
||||
|
||||
# Enable idle prompt notifications
|
||||
iamwaiting toggle idle-prompt on
|
||||
|
||||
# Disable permission prompt notifications
|
||||
iamwaiting toggle permission-prompt off
|
||||
```
|
||||
|
||||
### Running via Babashka Tasks
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user