1#!/usr/bin/env node
2
3import fs from 'node:fs';
4import path from 'node:path';
5import { pathToFileURL, fileURLToPath } from 'node:url';
6
7const __dirname = path.dirname(fileURLToPath(import.meta.url));
8const candidates = [
9 path.join(__dirname, 'detector', 'detect-antipatterns.mjs'),
10 path.join(__dirname, '..', '..', 'cli', 'engine', 'detect-antipatterns.mjs'),
11];
12const detectorPath = candidates.find(p => fs.existsSync(p));
13
14if (!detectorPath) {
15 process.stderr.write('Error: bundled detector not found.\n');
16 process.exit(1);
17}
18
19const { detectCli } = await import(pathToFileURL(detectorPath));
20
21await detectCli();