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)
This commit is contained in:
AgentSeal 2026-04-15 05:35:11 -07:00
parent 94762ca1f4
commit 2afab5f71a
4 changed files with 20 additions and 20 deletions

View file

@ -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'])

View file

@ -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 }

View file

@ -23,6 +23,16 @@ const ORANGE = '#FF8C42'
const DIM = '#555555'
const GOLD = '#FFD700'
const LANG_DISPLAY_NAMES: Record<string, string> = {
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
<Text dimColor wrap="truncate-end">{''.padEnd(bw + 1 + nw)}{'calls'.padStart(7)}</Text>
{sorted.slice(0, 10).map(([tool, calls]) => {
const raw = filterPrefix ? tool.slice(filterPrefix.length) : tool
const LANG_NAMES: Record<string, string> = {
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 (
<Text key={tool} wrap="truncate-end">
<HBar value={calls} max={maxCalls} width={bw} />

View file

@ -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')