From 2afab5f71ae27101faa66b9eaff61f1da83fe49e Mon Sep 17 00:00:00 2001 From: AgentSeal Date: Wed, 15 Apr 2026 05:35:11 -0700 Subject: [PATCH] fix: final review cleanup - Remove unused vi import from cursor test - Move LANG_DISPLAY_NAMES to module scope (was re-created per render) - Remove redundant 'script' regex (scrip?t already covers it) - Unexport getDbFingerprint (internal to cache module) - Move beforeEach inside describe block (only cursor tests need it) --- src/classifier.ts | 2 +- src/cursor-cache.ts | 2 +- src/dashboard.tsx | 21 +++++++++++---------- tests/providers/cursor.test.ts | 15 +++++++-------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/classifier.ts b/src/classifier.ts index 2c2937c..33b52b2 100644 --- a/src/classifier.ts +++ b/src/classifier.ts @@ -12,7 +12,7 @@ const BRAINSTORM_KEYWORDS = /\b(brainstorm|idea|what\s+if|explore|think\s+about| const RESEARCH_KEYWORDS = /\b(research|investigate|look\s+into|find\s+out|check|search|analyze|review|understand|explain|how\s+does|what\s+is|show\s+me|list|compare)\b/i const FILE_PATTERNS = /\.(py|js|ts|tsx|jsx|json|yaml|yml|toml|sql|sh|go|rs|java|rb|php|css|html|md|csv|xml)\b/i -const SCRIPT_PATTERNS = /\b(run\s+\S+\.\w+|execute|script|scrip?t|curl|api\s+\S+|endpoint|request\s+url|fetch\s+\S+|query|database|db\s+\S+)\b/i +const SCRIPT_PATTERNS = /\b(run\s+\S+\.\w+|execute|scrip?t|curl|api\s+\S+|endpoint|request\s+url|fetch\s+\S+|query|database|db\s+\S+)\b/i const URL_PATTERN = /https?:\/\/\S+/i const EDIT_TOOLS = new Set(['Edit', 'Write', 'FileEditTool', 'FileWriteTool', 'NotebookEdit', 'cursor:edit']) diff --git a/src/cursor-cache.ts b/src/cursor-cache.ts index afcf3c4..e743020 100644 --- a/src/cursor-cache.ts +++ b/src/cursor-cache.ts @@ -20,7 +20,7 @@ function getCachePath(): string { return join(getCacheDir(), CACHE_FILE) } -export async function getDbFingerprint(dbPath: string): Promise<{ mtimeMs: number; size: number } | null> { +async function getDbFingerprint(dbPath: string): Promise<{ mtimeMs: number; size: number } | null> { try { const s = await stat(dbPath) return { mtimeMs: s.mtimeMs, size: s.size } diff --git a/src/dashboard.tsx b/src/dashboard.tsx index 1108277..7513683 100644 --- a/src/dashboard.tsx +++ b/src/dashboard.tsx @@ -23,6 +23,16 @@ const ORANGE = '#FF8C42' const DIM = '#555555' const GOLD = '#FFD700' +const LANG_DISPLAY_NAMES: Record = { + javascript: 'JavaScript', typescript: 'TypeScript', python: 'Python', + rust: 'Rust', go: 'Go', java: 'Java', cpp: 'C++', c: 'C', csharp: 'C#', + ruby: 'Ruby', php: 'PHP', swift: 'Swift', kotlin: 'Kotlin', + html: 'HTML', css: 'CSS', scss: 'SCSS', json: 'JSON', yaml: 'YAML', + sql: 'SQL', shell: 'Shell', shellscript: 'Shell Script', bash: 'Bash', + typescriptreact: 'TSX', javascriptreact: 'JSX', + markdown: 'Markdown', dockerfile: 'Dockerfile', toml: 'TOML', +} + const PANEL_COLORS = { overview: '#FF8C42', daily: '#5B9EF5', @@ -325,16 +335,7 @@ function ToolBreakdown({ projects, pw, bw, title, filterPrefix }: { projects: Pr {''.padEnd(bw + 1 + nw)}{'calls'.padStart(7)} {sorted.slice(0, 10).map(([tool, calls]) => { const raw = filterPrefix ? tool.slice(filterPrefix.length) : tool - const LANG_NAMES: Record = { - javascript: 'JavaScript', typescript: 'TypeScript', python: 'Python', - rust: 'Rust', go: 'Go', java: 'Java', cpp: 'C++', c: 'C', csharp: 'C#', - ruby: 'Ruby', php: 'PHP', swift: 'Swift', kotlin: 'Kotlin', - html: 'HTML', css: 'CSS', scss: 'SCSS', json: 'JSON', yaml: 'YAML', - sql: 'SQL', shell: 'Shell', shellscript: 'Shell Script', bash: 'Bash', - typescriptreact: 'TSX', javascriptreact: 'JSX', - markdown: 'Markdown', dockerfile: 'Dockerfile', toml: 'TOML', - } - const display = filterPrefix ? (LANG_NAMES[raw] ?? raw) : raw + const display = filterPrefix ? (LANG_DISPLAY_NAMES[raw] ?? raw) : raw return ( diff --git a/tests/providers/cursor.test.ts b/tests/providers/cursor.test.ts index 6a6ddb1..2e1f758 100644 --- a/tests/providers/cursor.test.ts +++ b/tests/providers/cursor.test.ts @@ -1,15 +1,14 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest' +import { describe, it, expect, beforeEach } from 'vitest' import { getAllProviders } from '../../src/providers/index.js' import type { Provider } from '../../src/providers/types.js' -let cursorProvider: Provider - -beforeEach(async () => { - const all = await getAllProviders() - cursorProvider = all.find(p => p.name === 'cursor')! -}) - describe('cursor provider', () => { + let cursorProvider: Provider + + beforeEach(async () => { + const all = await getAllProviders() + cursorProvider = all.find(p => p.name === 'cursor')! + }) it('is registered', () => { expect(cursorProvider).toBeDefined() expect(cursorProvider.name).toBe('cursor')