1+ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime" ;
2+
13const REQUIRED_DISCOVERY_REFS = [
24 "repo/qa/seed-scenarios.json" ,
35 "repo/qa/QA_KICKOFF_TASK.md" ,
46 "repo/extensions/qa-lab/src/suite.ts" ,
57 "repo/docs/help/testing.md" ,
68] as const ;
79
10+ const REQUIRED_DISCOVERY_REFS_LOWER = REQUIRED_DISCOVERY_REFS . map ( normalizeLowercaseStringOrEmpty ) ;
11+
812const DISCOVERY_SCOPE_LEAK_PHRASES = [
913 "all mandatory scenarios" ,
1014 "final qa tally" ,
@@ -15,8 +19,8 @@ const DISCOVERY_SCOPE_LEAK_PHRASES = [
1519] as const ;
1620
1721function confirmsDiscoveryFileRead ( text : string ) {
18- const lower = text . toLowerCase ( ) ;
19- const mentionsAllRefs = REQUIRED_DISCOVERY_REFS . every ( ( ref ) => lower . includes ( ref . toLowerCase ( ) ) ) ;
22+ const lower = normalizeLowercaseStringOrEmpty ( text ) ;
23+ const mentionsAllRefs = REQUIRED_DISCOVERY_REFS_LOWER . every ( ( ref ) => lower . includes ( ref ) ) ;
2024 const confirmsRead =
2125 / (?: r e a d | r e t r i e v e d | i n s p e c t e d | l o a d e d | a c c e s s e d | d i g e s t e d ) \s + a l l \s + (?: f o u r | 4 ) \s + (?: (?: r e q u e s t e d | r e q u i r e d | m a n d a t e d | s e e d e d ) \s + ) ? f i l e s / . test (
2226 lower ,
@@ -29,7 +33,7 @@ function confirmsDiscoveryFileRead(text: string) {
2933}
3034
3135export function hasDiscoveryLabels ( text : string ) {
32- const lower = text . toLowerCase ( ) ;
36+ const lower = normalizeLowercaseStringOrEmpty ( text ) ;
3337 return (
3438 lower . includes ( "worked" ) &&
3539 lower . includes ( "failed" ) &&
@@ -39,7 +43,7 @@ export function hasDiscoveryLabels(text: string) {
3943}
4044
4145export function reportsMissingDiscoveryFiles ( text : string ) {
42- const lower = text . toLowerCase ( ) ;
46+ const lower = normalizeLowercaseStringOrEmpty ( text ) ;
4347 if ( confirmsDiscoveryFileRead ( text ) ) {
4448 return false ;
4549 }
@@ -52,6 +56,6 @@ export function reportsMissingDiscoveryFiles(text: string) {
5256}
5357
5458export function reportsDiscoveryScopeLeak ( text : string ) {
55- const lower = text . toLowerCase ( ) ;
59+ const lower = normalizeLowercaseStringOrEmpty ( text ) ;
5660 return DISCOVERY_SCOPE_LEAK_PHRASES . some ( ( phrase ) => lower . includes ( phrase ) ) ;
5761}
0 commit comments