mirror of
https://github.com/yamadashy/repomix.git
synced 2026-05-30 11:18:53 +02:00
c82accf641
Replace hand-rolled bot regex with the isbot package (~6.5 KB ESM, zero deps) to match server-side detection. Eliminates divergence between client and server bot detection logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
13 lines
317 B
TypeScript
13 lines
317 B
TypeScript
import { isbot } from 'isbot';
|
|
|
|
/**
|
|
* Detects whether the current user agent is a bot/crawler.
|
|
* Used to prevent automatic API calls when bots render pages with JavaScript.
|
|
*/
|
|
export function isBot(): boolean {
|
|
if (typeof navigator === 'undefined') {
|
|
return false;
|
|
}
|
|
return isbot(navigator.userAgent);
|
|
}
|