import * as React from 'react' import { Text } from '@anthropic/ink' import { BashTool } from '@claude-code-best/builtin-tools/tools/BashTool/BashTool.js' import type { PermissionRuleValue } from '../../../utils/permissions/PermissionRule.js' type RuleSubtitleProps = { ruleValue: PermissionRuleValue } export function PermissionRuleDescription({ ruleValue, }: RuleSubtitleProps): React.ReactNode { switch (ruleValue.toolName) { case BashTool.name: { if (ruleValue.ruleContent) { if (ruleValue.ruleContent.endsWith(':*')) { return ( Any Bash command starting with{' '} {ruleValue.ruleContent.slice(0, -2)} ) } else { return ( The Bash command {ruleValue.ruleContent} ) } } else { return Any Bash command } } default: { if (!ruleValue.ruleContent) { return ( Any use of the {ruleValue.toolName} tool ) } else { return null } } } }