fix: improve error handling in extractPatternsFromCommand function

This commit is contained in:
Daniel Riccio 2025-07-24 12:57:51 -05:00
parent d819ae57b7
commit ea360590af
No known key found for this signature in database
GPG key ID: FFD5FD825F8E8209

View file

@ -31,7 +31,8 @@ export function extractPatternsFromCommand(command: string): string[] {
if (currentTokens.length > 0) {
extractFromTokens(currentTokens, patterns)
}
} catch (_error) {
} catch (error) {
console.warn("Failed to parse command:", error)
// Fallback: just extract the first word
const firstWord = command.trim().split(/\s+/)[0]
if (firstWord) patterns.add(firstWord)