Skip to content

Command replacements not applied to Bash commands for TTS #11

@Helmi

Description

@Helmi

Description

Command replacements configured in replacements.json are not being applied when generating TTS for Bash commands, resulting in incorrect pronunciation of commands like "gh", "uvx", etc.

Context

  • Project Area: Core notification logic
  • Complexity: 2/10 (Simple fix)
  • User Impact: Commands are pronounced incorrectly in voice notifications

Current Behavior

When a Bash command like gh pr create is executed:

  • The notification displays correctly
  • The TTS says "gh" instead of "github CLI"
  • Other configured replacements (uvx → "U V X", etc.) are also not applied

Technical Details

Affected File: src/ccnotify/notify.py

Root Cause: The apply_command_replacement() function exists (line 573) but is never called when processing Bash commands.

Location: Lines 762-885 in the PreToolUse handler for Bash commands

  • Line 876: audio_desc is generated for the command
  • Line 885: custom_tts is created using audio_desc
  • Missing: Call to apply_command_replacement() between these steps

Requirements

  1. Apply command replacements to the audio description before creating TTS message
  2. Ensure all command replacements from replacements.json work correctly
  3. Maintain existing functionality for other notification types

Implementation Steps

  • Add call to apply_command_replacement(audio_desc, replacements) after line 876
  • Test with various commands (gh, uvx, uv, npm, etc.)
  • Verify pronunciations match replacements.json configuration

Acceptance Criteria

  • Commands like "gh" pronounce as "github CLI" in TTS
  • Commands like "uvx" pronounce as "U V X" in TTS
  • All command replacements from replacements.json are applied
  • No regression in other notification types

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions