mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
ab913c9720
* feat: strengthen agent help benchmarks * fix: harden help benchmark review findings * fix: close help benchmark validation bypasses * fix: make selector scoring quote-insensitive
22 lines
807 B
JavaScript
22 lines
807 B
JavaScript
export function opensAndCloses({ commands }) {
|
|
return hasAgentDeviceCommand(commands, 'open') && hasAgentDeviceCommand(commands, 'close');
|
|
}
|
|
|
|
export function usesValidationPrep({ commands }) {
|
|
const buildIndex = commands.findIndex(isSupportedBuildCommand);
|
|
if (buildIndex < 0) return false;
|
|
return commands.slice(buildIndex + 1).some((command) => isPnpmScript(command, 'clean:daemon'));
|
|
}
|
|
|
|
function hasAgentDeviceCommand(commands, command) {
|
|
return commands.some((line) => new RegExp(`^agent-device\\s+${command}(?:\\s|$)`).test(line));
|
|
}
|
|
|
|
function isSupportedBuildCommand(command) {
|
|
return isPnpmScript(command, 'build') || isPnpmScript(command, 'build:android');
|
|
}
|
|
|
|
function isPnpmScript(command, script) {
|
|
return new RegExp(`^pnpm\\s+(?:run\\s+)?${script}(?:\\s|$)`).test(command ?? '');
|
|
}
|