unused-local-variable / useless-assignment (~30 alerts): - mcp-client: manager.ts (11), connection.ts (3) - acp-link: server.ts (4), rcs-upstream.ts - remote-control-server: 10 files (SessionDetail, acp/client, transports, etc.) - src: constants/tools.ts, attribution.ts, win32.ts, main.tsx, attachments.ts log-injection (2): - chromeNativeHost.ts, rcs-upstream.ts — apply sanitizeLog() indirect-command-line-injection (4): - imagePaste.ts: convert shell:true to explicit sh -c pattern use-before-declaration (4): - query.ts, claude.ts, tools.ts, attachments.ts — move feature() import up comparison-between-incompatible-types (2): - ExitPlanModePermissionRequest.tsx, useTerminalNotification.ts shared: sensitive.ts — sanitizeLog() helper
31 lines
754 B
TypeScript
31 lines
754 B
TypeScript
import { mkdtemp, rm, writeFile, mkdir } from 'node:fs/promises'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
|
|
export async function createTempDir(prefix = 'claude-test-'): Promise<string> {
|
|
return mkdtemp(join(tmpdir(), prefix))
|
|
}
|
|
|
|
export async function cleanupTempDir(dir: string): Promise<void> {
|
|
await rm(dir, { recursive: true, force: true })
|
|
}
|
|
|
|
export async function writeTempFile(
|
|
dir: string,
|
|
name: string,
|
|
content: string,
|
|
): Promise<string> {
|
|
const path = join(dir, name)
|
|
await writeFile(path, content, 'utf-8')
|
|
return path
|
|
}
|
|
|
|
export async function createTempSubdir(
|
|
dir: string,
|
|
name: string,
|
|
): Promise<string> {
|
|
const path = join(dir, name)
|
|
await mkdir(path, { recursive: true })
|
|
return path
|
|
}
|