feat: aggiunge pattern per comando 'cerca file'

This commit is contained in:
opencode committed 2026-03-23 19:00:09 +01:00
1 parent 1e49eff703
commit f8ebfb65ab
1 file changed
+14
+14
View File
@@ -367,6 +367,20 @@ For other questions, just answer normally without tools."""
if any(p in text_lower for p in list_patterns):
return ToolCall(id='intent', name='ls', arguments={'path': '.'})
# Search patterns
search_patterns = [
'cerca', 'cercare', 'trova', 'trovare', 'dove si trova',
'search', 'find', 'file', '*.py', '*.md', '*.txt'
]
# If the message mentions file patterns, use search tool
if 'cerca' in text_lower or 'search' in text_lower or 'find' in text_lower:
# Extract directory and pattern
dir_match = re.search(r'(?:in|alla|nella)\s+([/\w.-]+)', text)
pattern_match = re.search(r'\*\.(\w+)', text)
directory = dir_match.group(1) if dir_match else '.'
pattern = f"*.{pattern_match.group(1)}" if pattern_match else "*"
return ToolCall(id='intent', name='search', arguments={'directory': directory, 'pattern': pattern})
# Read/show file patterns - check for ANY read keyword AND a file path
read_keywords = ['leggi', 'leggere', 'mostrami', 'apri', 'aprimi', 'visualizza',
'vediamo', 'vedi', 'show me', 'show the', 'read', 'open',