# sengqt/aoooterminalerrorsound architecture

> Architecture diagram of the GitHub repository sengqt/aoooterminalerrorsound, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sengqt/aoooterminalerrorsound
- Repository: https://github.com/sengqt/aoooterminalerrorsound

## Overview

A VS Code extension that reacts to failed commands in the integrated terminal by playing the Chowayo sound, and—when shell integration reports the failure—showing a notification. Users can also trigger playback from the Command Palette or disable sound in settings. The README describes WebView-based cross-platform audio, but the sampled implementation instead invokes platform audio players through child processes; the graph reflects that source evidence. Both failure-detection paths and playback logic reside in one source file, so they are represented as distinct responsibilities sharing that path.

Main entry points: [`src/extension.ts`](https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts) (Platform audio dispatch), [`media/chowayo.mp3`](https://github.com/sengqt/aoooterminalerrorsound/blob/main/media/chowayo.mp3) (Chowayo audio), [`package.json`](https://github.com/sengqt/aoooterminalerrorsound/blob/main/package.json) (Enable Sound setting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_detection["Failure detection"]
  node_shell_events["Shell failure listener<br/>[extension.ts]"]
  node_close_fallback["Terminal close fallback<br/>[extension.ts]"]
  node_failure_notice["Failure notification<br/>[extension.ts]"]
end

subgraph group_playback["Sound playback"]
  node_audio_dispatch["Platform audio dispatch<br/>[extension.ts]"]
  node_sound_asset["Chowayo audio<br/>[chowayo.mp3]"]
end

subgraph group_controls["User controls"]
  node_playback_gate["Sound setting gate<br/>[extension.ts]"]
  node_setting["Enable Sound setting<br/>[package.json]"]
  node_manual_command["Manual play command<br/>[extension.ts]"]
end

node_user(("Extension user"))
node_terminal["Integrated terminal"]
node_audio_player["Platform audio player"]

node_user -->|"runs command"| node_terminal
node_terminal -->|"reports exit code"| node_shell_events
node_terminal -->|"reports closure"| node_close_fallback
node_shell_events -->|"plays on failure"| node_audio_dispatch
node_shell_events -->|"shows alert"| node_failure_notice
node_close_fallback -->|"plays on failure"| node_audio_dispatch
node_user -->|"triggers playback"| node_manual_command
node_manual_command -->|"calls playback"| node_audio_dispatch
node_audio_dispatch -->|"checks setting"| node_playback_gate
node_playback_gate -->|"reads configuration"| node_setting
node_audio_dispatch -->|"uses audio file"| node_sound_asset
node_audio_dispatch -->|"invokes platform player"| node_audio_player

click node_shell_events "https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts"
click node_close_fallback "https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts"
click node_playback_gate "https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts"
click node_setting "https://github.com/sengqt/aoooterminalerrorsound/blob/main/package.json"
click node_manual_command "https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts"
click node_audio_dispatch "https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts"
click node_sound_asset "https://github.com/sengqt/aoooterminalerrorsound/blob/main/media/chowayo.mp3"
click node_failure_notice "https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_shell_events,node_close_fallback,node_failure_notice,node_user toneBlue
class node_audio_dispatch,node_sound_asset toneAmber
class node_playback_gate,node_setting,node_manual_command toneMint
class node_terminal,node_audio_player toneIndigo
```

## Components

### Failure detection

- [Shell failure listener](https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts): `src/extension.ts`
- [Terminal close fallback](https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts): `src/extension.ts`
- [Failure notification](https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts): `src/extension.ts`

### Sound playback

- [Platform audio dispatch](https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts): `src/extension.ts`
- [Chowayo audio](https://github.com/sengqt/aoooterminalerrorsound/blob/main/media/chowayo.mp3): `media/chowayo.mp3`

### User controls

- [Sound setting gate](https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts): `src/extension.ts`
- [Enable Sound setting](https://github.com/sengqt/aoooterminalerrorsound/blob/main/package.json): `package.json`
- [Manual play command](https://github.com/sengqt/aoooterminalerrorsound/blob/main/src/extension.ts): `src/extension.ts`

### Other components

- **Extension user**
- **Integrated terminal**
- **Platform audio player**

## Connections

- Extension user → Integrated terminal: runs command (evidence: `README.md`)
- Integrated terminal → Shell failure listener: reports exit code (evidence: `src/extension.ts`)
- Integrated terminal → Terminal close fallback: reports closure (evidence: `src/extension.ts`)
- Shell failure listener → Platform audio dispatch: plays on failure (evidence: `src/extension.ts`)
- Shell failure listener → Failure notification: shows alert (evidence: `src/extension.ts`)
- Terminal close fallback → Platform audio dispatch: plays on failure (evidence: `src/extension.ts`)
- Extension user → Manual play command: triggers playback (evidence: `README.md`)
- Manual play command → Platform audio dispatch: calls playback (evidence: `src/extension.ts`)
- Platform audio dispatch → Sound setting gate: checks setting (evidence: `src/extension.ts`)
- Sound setting gate → Enable Sound setting: reads configuration (evidence: `src/extension.ts`)
- Platform audio dispatch → Chowayo audio: uses audio file (evidence: `src/extension.ts`)
- Platform audio dispatch → Platform audio player: invokes platform player (evidence: `src/extension.ts`)
