Skip to content

fix(agents): sound scripts exit silently on error conditions#146

Closed
homich1991 wants to merge 13 commits intocodemie-ai:mainfrom
homich1991:sound-script-fix
Closed

fix(agents): sound scripts exit silently on error conditions#146
homich1991 wants to merge 13 commits intocodemie-ai:mainfrom
homich1991:sound-script-fix

Conversation

@homich1991
Copy link
Contributor

Summary

Updates the Claude plugin sound scripts (bash and PowerShell) to exit
silently (with code 0) instead of displaying error messages when optional
conditions fail. This prevents unwanted error output in the CLI when
sound functionality is not available or configured.

Changes

  • Modified both play-random-sound.sh and play-random-sound.ps1 to
    exit with code 0 instead of code 1 for all error conditions
  • Directory not found: exits silently instead of showing error message
  • No audio files found: exits silently instead of showing error message
  • No audio player found: exits silently instead of showing error message
  • Updated comments to clarify silent exit behavior

Impact

Before: When sound directory doesn't exist or audio player is not
installed, users see error messages in CLI output even though sounds are
optional features.

After: Scripts exit gracefully without any error output, providing
cleaner CLI experience when sounds are not configured.

Checklist

  • Self-reviewed
  • Manual testing performed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)

homich1991 and others added 13 commits February 9, 2026 15:05
Introduces the /codemie:sound-hooks-add plugin command that installs audio
feedback for Claude Code hooks. The system plays random sounds on key events
(SessionStart, UserPromptSubmit, PermissionRequest, Stop).

Features:
- Cross-platform audio player detection (afplay, aplay, paplay, mpg123)
- Automatic hook directory creation (~/.claude/hooks/)
- play-random-sound.sh script installation
- settings.json configuration with hooks
- Documentation with sound download resources

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
- Move play-random-sound.sh from plugin scripts to shared addons directory
- Remove sound-hooks-add.md command in favor of programmatic installation
- Create sounds-installer.ts utility for automated hook setup
- Add hook configuration logic to setup command
- Update plugin README to reflect new installation method
- Integrate sound hooks into main setup flow for better UX
- Update SSO plugin tests to reflect new installation flow

Breaking Change: sound-hooks-add command removed, now part of setup flow

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Security & Cross-platform:
- Replace process.env.HOME with os.homedir() for Windows compatibility
- Add Windows installation instructions (mpg123 via Chocolatey)
- Fix misleading "Cross-platform" label on Linux-only command

Error Handling:
- Add logging to script path fallback catch block
- Use createErrorContext() for all error logging (3 locations)
- Add structured error metadata (operation, paths, etc.)

Type Safety:
- Replace 'any' type with ClaudeSettings interface
- Add validation for settings.json structure (object vs array)
- Log warnings for invalid settings structure

Performance:
- Use Promise.all() for parallel directory creation (4 dirs)

Documentation:
- Add JSDoc explaining UI exception in utils layer
- Update error message to reference correct command (setup --sounds)

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Security & Cross-platform:
- Replace process.env.HOME with os.homedir() for Windows compatibility
- Add Windows installation instructions (mpg123 via Chocolatey)
- Fix misleading "Cross-platform" label on Linux-only command

Error Handling:
- Add logging to script path fallback catch block
- Use createErrorContext() for all error logging (3 locations)
- Add structured error metadata (operation, paths, etc.)

Type Safety:
- Replace 'any' type with ClaudeSettings interface
- Add validation for settings.json structure (object vs array)
- Log warnings for invalid settings structure

Performance:
- Use Promise.all() for parallel directory creation (4 dirs)

Documentation:
- Add JSDoc explaining UI exception in utils layer
- Update error message to reference correct command (setup --sounds)

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
# Conflicts:
#	src/cli/commands/setup.ts
# Conflicts:
#	src/cli/commands/setup.ts
- Move sounds-installer from utils to agents/plugins/claude for better organization
- Add play-random-sound.ps1 script for Windows compatibility
- Relocate play-random-sound.sh to plugin/sounds directory
- Add Windows-specific instructions in installation output and README
- Update hooks configuration to support sound playback on multiple events
- Enhance BaseAgentAdapter with sounds installation hooks

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>"
- Directory not found now exits with code 0 instead of error
- No audio files found exits silently
- No audio player found exits silently
- Prevents unwanted error messages in CLI output when sounds are optional
@homich1991 homich1991 closed this Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant