mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 21:05:51 +00:00
- 新增 workflowRuns、remoteTriggerAudit、pipeStatus 等工具 - 增强 permissionSetup: auto mode 和 bypass permissions 始终可用 - 新增多组测试覆盖 (modifiers, teamDiscovery, deepLink 等) - 修复 parseInt 缺少 radix 参数 - 移除多余 biome-ignore 注释 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
924 B
TypeScript
33 lines
924 B
TypeScript
export type ModifierKey = 'shift' | 'command' | 'control' | 'option'
|
|
|
|
let prewarmed = false
|
|
|
|
/**
|
|
* Pre-warm the native module by loading it in advance.
|
|
* Call this early to avoid delay on first use.
|
|
*/
|
|
export function prewarmModifiers(): void {
|
|
if (prewarmed || process.platform !== 'darwin') {
|
|
return
|
|
}
|
|
prewarmed = true
|
|
void import('modifiers-napi').then(({ prewarm }) => prewarm()).catch(() => {})
|
|
}
|
|
|
|
/**
|
|
* Check if a specific modifier key is currently pressed (synchronous).
|
|
*/
|
|
export function isModifierPressed(modifier: ModifierKey): boolean {
|
|
if (process.platform !== 'darwin') {
|
|
return false
|
|
}
|
|
try {
|
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
const { isModifierPressed: nativeIsModifierPressed } =
|
|
require('modifiers-napi') as { isModifierPressed: (m: string) => boolean }
|
|
return nativeIsModifierPressed(modifier)
|
|
} catch {
|
|
return false
|
|
}
|
|
}
|