How prasannakulal/failorpass works
Purpose and Entry Points
FailOrWin is a VS Code extension that monitors integrated-terminal output and emits audio alerts for configured success or failure text patterns. The authored extension entry point is src/extension.ts; the distributable compiled entry is out/extension.js, packaged as terminal-sound-alert-0.0.1.vsix. Extension commands, settings contributions, and activation metadata are expected in package.json.
VS Code Integration Layer
The extension runs in the VS Code extension host and integrates with:
• Integrated terminal output observation and lifecycle events.
• Command Palette commands for cue selection, alert-mode changes, toggling, quick switching, and imports.
• An Activity Bar/sidebar control surface for interactive configuration.
• VS Code configuration APIs for the terminalSound.* settings namespace.
The primary implementation boundary is src/extension.ts, which connects VS Code APIs, detection logic, configuration, and playback.
Detection and Alert Control
Terminal text is evaluated against independently configurable success and error keyword lists. Detection is gated by a master enable switch and separate success/error trigger switches. A cooldown prevents repetitive playback from noisy or repeated terminal output; configuration defines a minimum delay of 500 ms. Alert mode selection and quick switching provide a user-facing control path distinct from raw keyword configuration.
Relevant implementation and package-definition paths: src/extension.ts, package.json, out/extension.js.
Audio Cue Resolution and Playback
Playback supports MP3, WAV, and OGG files. Cue selection can resolve explicit configured paths—absolute, workspace-relative, or home-relative—or bundled preset names. The extension includes general fallback cues in sounds/success.mp3 and sounds/error.mp3, plus selectable bundled media under default/, such as default/chala-ja-bsdk.mp3.
A TypeScript declaration at src/types/play-sound.d.ts indicates playback is mediated through a sound-playing dependency/API rather than browser audio. Volume is requested through settings, subject to the capabilities of the underlying playback runtime and host OS.
Data and Control Flow
1. VS Code activates the extension and registers terminal listeners, commands, sidebar integration, and configuration access from src/extension.ts.
2. Terminal output enters the keyword-detection stage.
3. Enable flags, alert mode, trigger category, and cooldown decide whether an event can fire.
4. The selected success/failure cue is resolved from custom path, preset, or bundled asset.
5. The playback adapter invokes local audio playback; optional debug logging is routed through the extension’s VS Code output/logging facilities.
No remote backend is indicated: terminal data, settings, imported cues, and playback remain local to the VS Code/Node extension-host environment.
Build and Distribution Boundary
TypeScript source in src/extension.ts is compiled into out/extension.js with source mapping in out/extension.js.map. package.json, tsconfig.json, and package-lock.json define the Node/TypeScript build and dependency boundary. The resulting VS Code package artifact is terminal-sound-alert-0.0.1.vsix, while bundled audio directories (sounds/ and default/) are extension-local runtime assets.
Main entry points: extension.js Compiled extension · extension.ts Cue resolver · package.json terminalSound settings · terminal-sound-alert-0.0.1.vsix VSIX package
Components 18
VS Code extension host
- VS Code
- Extension manifest · Defines activation, commands, and terminalSound settings.
package.json - Extension integration · Registers VS Code integrations and connects the alert flow.
src/extension.ts - Integrated terminal
- Commands and sidebar
Alert runtime
- terminalSound settings · Controls keywords, modes, switches, cooldown, paths, and volume.
package.json - Keyword detection · Classifies terminal text as configured success or error matches.
src/extension.ts - Alert gate · Applies enable flags, alert mode, category switches, and cooldown.
src/extension.ts - Cue resolver · Resolves custom absolute, workspace, home, preset, or fallback cues.
src/extension.ts - Playback adapter · Invokes host-local audio playback.
src/types/play-sound.d.ts - VS Code output logging
src/extension.ts
Local audio assets
- Fallback cues
sounds/success.mp3 - Preset cues
Build and distribution
- Compiled extension
out/extension.js - Source map
out/extension.js.map - TypeScript build config
tsconfig.json - Dependency lockfile
package-lock.json - VSIX package
terminal-sound-alert-0.0.1.vsix
Connections 23
- Extension manifest → VS Code: contributes to
- VS Code → Compiled extension: activates
- Compiled extension → Extension integration: compiled from
- Extension integration → Integrated terminal: observes output and lifecycle
- Extension integration → Commands and sidebar: registers
- Commands and sidebar → terminalSound settings: updates
- Integrated terminal → Keyword detection: output text
- terminalSound settings → Keyword detection: success/error keywords
- Keyword detection → Alert gate: matched category
- terminalSound settings → Alert gate: mode, switches, cooldown
- Alert gate → Cue resolver: permitted alert
- terminalSound settings → Cue resolver: cue and path selection
- Fallback cues → Cue resolver: fallback assets
- Preset cues → Cue resolver: preset assets
- Cue resolver → Playback adapter: resolved local cue
- Playback adapter → VS Code output logging: debug status
- TypeScript build config → Compiled extension: compiles
- Compiled extension → Source map: maps to source
- Dependency lockfile → Compiled extension: pins dependencies
- Extension manifest → VSIX package: packaged with
- Compiled extension → VSIX package: included in
- Fallback cues → VSIX package: bundled in
- Preset cues → VSIX package: bundled in