Skip to content

Comments

Add "Hey Shoppy" wake word detection for voice command activation#7

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/add-voice-command-activation
Draft

Add "Hey Shoppy" wake word detection for voice command activation#7
Copilot wants to merge 6 commits intomainfrom
copilot/add-voice-command-activation

Conversation

Copy link

Copilot AI commented Nov 28, 2025

  • Add "Hey Shoppy" wake word detection for voice command activation
  • Implement WakeWordService for core detection logic
  • Create useWakeWord hook for React integration
  • Add WakeWordContext for app-wide state sharing
  • Integrate with Settings toggle and voice UI components
  • Refactored tests: consolidated from 194 to 152 tests, removing redundant coverage

Test Refactoring Summary

  • Removed tests duplicating behavior already covered by lower-level tests
  • Consolidated initialization tests into single comprehensive assertions
  • Removed tests that were essentially testing React's native behavior
  • Kept focused tests that verify our custom business logic
Original prompt

This section details on the original issue you should resolve

<issue_title>should be able to say "hey shoppy" to start voice command listening in addition to being able to hit the microphone button</issue_title>
<issue_description></issue_description>

<agent_instructions>follow existing patterns, services, and resources for working with the voice services. add documentation at the end. TDD development only.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits November 28, 2025 20:26
Co-authored-by: akisma <332125+akisma@users.noreply.github.com>
Co-authored-by: akisma <332125+akisma@users.noreply.github.com>
Co-authored-by: akisma <332125+akisma@users.noreply.github.com>
…I text

Co-authored-by: akisma <332125+akisma@users.noreply.github.com>
Copilot AI changed the title [WIP] Add voice command activation with 'hey shoppy' Add "Hey Shoppy" wake word detection for voice command activation Nov 28, 2025
Copilot AI requested a review from akisma November 28, 2025 20:41
@akisma
Copy link
Owner

akisma commented Nov 28, 2025

Why are there so many new tests? What are they covering? @copilot

1 similar comment
@akisma
Copy link
Owner

akisma commented Nov 28, 2025

Why are there so many new tests? What are they covering? @copilot

Copy link
Author

Copilot AI commented Nov 28, 2025

Why are there so many new tests? What are they covering? @copilot

The 69 new tests cover the wake word detection feature following TDD:

WakeWordService (29 tests) - Core detection logic:

  • Initialization and state management
  • Start/stop listening
  • Wake word detection (case-insensitive, exact match, partial match)
  • Command extraction after wake phrase
  • Enable/disable functionality
  • Error handling

useWakeWord hook (16 tests) - React integration:

  • Hook initialization and default state
  • Start/stop listening controls
  • Enable/disable toggling
  • Transcript processing
  • Callback invocation
  • Cleanup on unmount

WakeWordContext (14 tests) - App-wide state:

  • Provider setup and context availability
  • State sharing across components
  • Action dispatching

Integration tests (10 tests) - UI components:

  • Settings toggle functionality (6 tests)
  • Layout provider setup (3 tests)
  • VoiceActivationBanner listening state (1 new test)

The high test count reflects TDD methodology and ensures each component works correctly in isolation and together.

@akisma
Copy link
Owner

akisma commented Nov 28, 2025

@copilot do the tests all pass? are there mocking issues? are any of the tests testing native behavior of frameworks or packages used? please revise & refactor.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements wake word detection for "Hey Shoppy" voice command activation, allowing users to start voice command listening by saying the wake phrase in addition to pressing the microphone button. The implementation follows TDD principles with comprehensive test coverage.

Key Changes:

  • Core wake word detection service with case-insensitive phrase matching and command extraction
  • React integration layer with hooks and context provider for app-wide state management
  • UI updates to settings toggle, voice activation banner, and voice status indicator to reflect wake word functionality

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
services/wake-word-service.ts Core service implementing wake word detection with status management (idle/listening/detected)
services/wake-word-service.test.ts 29 comprehensive tests for service logic including edge cases
hooks/use-wake-word.ts React hook wrapper managing service lifecycle and state
hooks/use-wake-word.test.ts 16 tests for hook behavior and integration
contexts/wake-word-context.tsx Context provider for app-wide wake word state sharing
contexts/wake-word-context.test.tsx 14 tests verifying provider and consumer behavior
components/VoiceActivationBanner.tsx Updated to display dynamic state (listening vs. ready)
components/VoiceActivationBanner.test.tsx Updated tests for new listening state display
app/_layout.tsx Wraps app with WakeWordProvider for global availability
app/_layout.test.tsx 3 tests verifying provider integration in root layout
app/(tabs)/settings.tsx Settings toggle now controls wake word enable/disable
app/(tabs)/settings.test.tsx Updated tests for functional toggle behavior
app/(tabs)/settings.wake-word.test.tsx 6 integration tests for settings-wake word connection
app/(tabs)/list-detail.tsx Integrates wake word context for voice status and controls
app/(tabs)/index.tsx Integrates wake word context for voice status and controls
.docs/TECHNICAL_DOCUMENTATION.md Added comprehensive documentation for wake word features

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

private setStatus(newStatus: WakeWordStatus): void {
if (this.status !== newStatus) {
this.status = newStatus;
this.onStatusChange(newStatus);
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The onStatusChange callback is not wrapped in error handling, unlike onWakeWordDetected. If the callback throws an error, it could crash the service or leave it in an inconsistent state. Consider wrapping the callback in a try-catch block similar to line 102-106.

Suggested change
this.onStatusChange(newStatus);
try {
this.onStatusChange(newStatus);
} catch {
// Gracefully handle callback errors
}

Copilot uses AI. Check for mistakes.
Comment on lines +9 to 18

// Try to get wake word context, return null if not available
function useTryWakeWordContext() {
try {
return useWakeWordContext();
} catch {
return null;
}
}

Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useTryWakeWordContext helper function is duplicated across three files (settings.tsx, list-detail.tsx, and index.tsx). Consider extracting this to a shared utility function or hook file to reduce duplication and ensure consistent behavior across the app.

Suggested change
// Try to get wake word context, return null if not available
function useTryWakeWordContext() {
try {
return useWakeWordContext();
} catch {
return null;
}
}
import { useTryWakeWordContext } from '../hooks/useTryWakeWordContext';

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +37
function useTryWakeWordContext() {
try {
return useWakeWordContext();
} catch {
return null;
}
}
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate of the same helper function in settings.tsx and index.tsx. Extract to a shared utility to maintain DRY principle.

Copilot uses AI. Check for mistakes.
Comment on lines 30 to +40

// Try to get wake word context, return null if not available
function useTryWakeWordContext() {
try {
return useWakeWordContext();
} catch {
return null;
}
}

Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate of the same helper function in settings.tsx and list-detail.tsx. Extract to a shared utility to maintain DRY principle.

Suggested change
// Try to get wake word context, return null if not available
function useTryWakeWordContext() {
try {
return useWakeWordContext();
} catch {
return null;
}
}
import { useTryWakeWordContext } from '@/hooks/use-try-wake-word-context';

Copilot uses AI. Check for mistakes.
* Tests for "Hey Shoppy" wake word detection service
*/

import { WakeWordService, WakeWordStatus } from './wake-word-service';
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import WakeWordStatus.

Suggested change
import { WakeWordService, WakeWordStatus } from './wake-word-service';
import { WakeWordService } from './wake-word-service';

Copilot uses AI. Check for mistakes.
Co-authored-by: akisma <332125+akisma@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 28, 2025

@copilot do the tests all pass? are there mocking issues? are any of the tests testing native behavior of frameworks or packages used? please revise & refactor.

All tests pass (152 tests). Refactored in commit 7fa0b86:

Changes made:

  • Consolidated WakeWordService tests from 29 to 10 (removed duplicate assertions for same behavior)
  • Reduced useWakeWord hook tests from 16 to 5 (removed tests duplicating service-level behavior)
  • Reduced WakeWordContext tests from 14 to 5 (kept only provider-specific behavior, not hook re-testing)
  • Reduced layout tests from 3 to 1 (removed tests already covered by context tests)

What remains tested:

  • Core detection logic (case-insensitivity, command extraction, validation)
  • Hook lifecycle integration
  • Context state sharing and provider error handling
  • Settings toggle integration

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.

should be able to say "hey shoppy" to start voice command listening in addition to being able to hit the microphone button

2 participants