Search files catch and hint when search looks like regex

Aperta Adatta ai principianti
#75 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
cli, tooling

Direzione di ricerca

Leggi internal/tools/search.go e i relativi test in internal/tools/search_test.go per vedere come search_files gestisce l’assenza di corrispondenze. Aggiungi test per i pattern che contengono |, sia quando non ci sono corrispondenze sia quando il pattern corrisponde a un file. Il lavoro è concluso quando la risposta in assenza di corrispondenze fornisce il suggerimento per la ricerca in testo semplice senza «error» iniziale, le corrispondenze continuano a essere restituite normalmente e make check ha esito positivo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

good first issue tools

What

search_files matches plain text on purpose, because small models write regex that is broken or matches the wrong thing. However they might still send regex. For now we want to detect if the model is trying to send regex and push it to instead send plain text matching.

Where

  • internal/tools/search.go
  • internal/tools/search_test.go

Fix

When there are no matches and the pattern contains |, add a hint to the reply, for example:

no matches for "a|b". The pattern is plain text, not a regex: "|" is searched for literally. Search for one word at a time instead.

Keep the reply free of a leading "error". Finding nothing is a valid answer, and it must not trip the guard in internal/agent that stops runaway tool loops.

Done when

  • A pattern containing | with no matches returns the hint.
  • A pattern containing | that does match (it really is in a file) returns the matches normally, with no hint.
  • Tests are added in internal/tools/search_test.go.
  • make check passes.
Lingua principale
Go
Stelle
1
Fork
2
Merge medio
12h 55m
PR unite (30g)
18

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Edwin-metcalf/MetCode

Tutte le issue di Edwin-metcalf/MetCode

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.