(prompt: string, names: readonly string[])
| 114 | * "what am I looking at"), "detail" for the same asking for detail, undefined otherwise (H1). |
| 115 | * `names` are the selection's: "die Hierarchie von .github" is the view too. */ |
| 116 | export function viewQuestion(prompt: string, names: readonly string[]): 'general' | 'detail' | undefined { |
| 117 | const text = normalize(prompt, names); |
| 118 | const detail = new RegExp(DETAIL.source, 'u').test(text); |
| 119 | const asked = detail ? text.replace(DETAIL, ' ').replace(/\s+/g, ' ').trim() : text; |
| 120 | if (!VIEW_QUESTIONS.some(pattern => pattern.test(asked))) return undefined; |
| 121 | return detail ? 'detail' : 'general'; |
| 122 | } |
| 123 | |
| 124 | /** Greetings and probes: a prompt of only these asks nothing. */ |
| 125 | const GREETINGS = new Set(['hi', 'hey', 'hello', 'hallo', 'moin', 'servus', 'huhu', 'yo', 'test', 'testing', 'tests', 'ok', 'okay', 'danke', 'thanks', 'thank', 'you', |
no test coverage detected