@socketsecurity/lib
Version:
Core utilities and infrastructure for Socket.dev security tools
69 lines (68 loc) • 2.35 kB
TypeScript
/**
* Get the OS home directory.
* Can be overridden in tests using setPath('homedir', ...) from paths/rewire.
*/
export declare function getOsHomeDir(): string;
/**
* Get the OS temporary directory.
* Can be overridden in tests using setPath('tmpdir', ...) from paths/rewire.
*/
export declare function getOsTmpDir(): string;
/**
* Get the Socket home directory (~/.socket).
* Alias for getSocketUserDir() for consistency across Socket projects.
*/
export declare function getSocketHomePath(): string;
/**
* Get the Socket user directory (~/.socket).
* Result is memoized for performance.
*/
export declare function getSocketUserDir(): string;
/**
* Get a Socket app directory (~/.socket/_<appName>).
*/
export declare function getSocketAppDir(appName: string): string;
/**
* Get the Socket cacache directory (~/.socket/_cacache).
* Can be overridden with SOCKET_CACACHE_DIR environment variable for testing.
* Result is memoized for performance.
*/
export declare function getSocketCacacheDir(): string;
/**
* Get the Socket DLX directory (~/.socket/_dlx).
* Can be overridden with SOCKET_DLX_DIR environment variable for testing.
*/
export declare function getSocketDlxDir(): string;
/**
* Get a Socket app cache directory (~/.socket/_<appName>/cache).
*/
export declare function getSocketAppCacheDir(appName: string): string;
/**
* Get a Socket app TTL cache directory (~/.socket/_<appName>/cache/ttl).
*/
export declare function getSocketAppCacheTtlDir(appName: string): string;
/**
* Get the Socket CLI directory (~/.socket/_socket).
*/
export declare function getSocketCliDir(): string;
/**
* Get the Socket Registry directory (~/.socket/_registry).
*/
export declare function getSocketRegistryDir(): string;
/**
* Get the Socket Registry GitHub cache directory (~/.socket/_registry/cache/ttl/github).
*/
export declare function getSocketRegistryGithubCacheDir(): string;
/**
* Get the user's home directory.
* Uses environment variables directly to support test mocking.
* Falls back to os.homedir() if env vars not set.
*/
export declare function getUserHomeDir(): string;
/**
* Invalidate all cached path values.
* Called automatically by the paths/rewire module when setPath/clearPath/resetPaths are used.
*
* @internal Used for test rewiring
*/
export declare function invalidateCache(): void;