Skip to content

Commit fffec99

Browse files
talionwarclaude
andcommitted
fix(analyzer): use word boundaries for auth detection, remove redirect
- auth() now uses \bauth\(\) to avoid matching authToken(), authorize() - getServerSession uses \b boundaries - useSession uses \b boundaries - Removed 'redirect' pattern — too many false positives (redirect URLs, variables) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 60c22e5 commit fffec99

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/analyzers/project-analyzer.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,11 @@ function filePathToRoute(relativePath: string, framework: Framework): string {
278278
function buildPageInfo(file: ParsedFile, framework: Framework): PageInfo {
279279
const routePath = filePathToRoute(file.relativePath, framework);
280280

281-
// Detect auth pattern
281+
// Detect auth pattern — use word boundaries to avoid false positives
282282
let auth = 'None';
283-
if (file.rawContent.includes('auth()')) auth = 'auth()';
284-
else if (file.rawContent.includes('getServerSession')) auth = 'getServerSession';
285-
else if (file.rawContent.includes('useSession')) auth = 'useSession (client)';
286-
else if (file.rawContent.includes('redirect')) auth = 'redirect (conditional)';
283+
if (/\bauth\(\)/.test(file.rawContent)) auth = 'auth()';
284+
else if (/\bgetServerSession\b/.test(file.rawContent)) auth = 'getServerSession';
285+
else if (/\buseSession\b/.test(file.rawContent)) auth = 'useSession (client)';
287286

288287
// Extract data fetching
289288
const dataFetching = file.sideEffects
@@ -360,10 +359,10 @@ function buildApiRouteInfo(file: ParsedFile, framework: Framework): ApiRouteInfo
360359

361360
if (methods.length === 0) methods.push('ALL');
362361

363-
// Detect auth
362+
// Detect auth — use word boundaries to avoid false positives
364363
let auth = 'None';
365-
if (file.rawContent.includes('auth()')) auth = 'auth()';
366-
else if (file.rawContent.includes('getServerSession')) auth = 'getServerSession';
364+
if (/\bauth\(\)/.test(file.rawContent)) auth = 'auth()';
365+
else if (/\bgetServerSession\b/.test(file.rawContent)) auth = 'getServerSession';
367366

368367
// Detect models used
369368
const models: string[] = [];

0 commit comments

Comments
 (0)