mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-08 22:21:23 +00:00
refactor: remove unused token validation function and simplify token processing logic
This commit is contained in:
parent
77bc9e6f92
commit
19c2c49281
2 changed files with 2 additions and 15 deletions
|
|
@ -85,11 +85,6 @@ export const CommandPatternSelector: React.FC<CommandPatternSelectorProps> = ({
|
|||
<Info className="size-3.5 text-vscode-descriptionForeground" />
|
||||
</StandardTooltip>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-xs text-vscode-descriptionForeground">
|
||||
<span>{allowedCommands.length} allowed</span>
|
||||
<span>•</span>
|
||||
<span>{deniedCommands.length} denied</span>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
{isExpanded && (
|
||||
|
|
|
|||
|
|
@ -41,10 +41,6 @@ export function extractPatternsFromCommand(command: string): string[] {
|
|||
return Array.from(patterns).sort()
|
||||
}
|
||||
|
||||
function isValidToken(token: string): boolean {
|
||||
return !!token && !token.startsWith("-") && !token.match(/[/\\~:]/) && token !== "." && !token.match(/\.\w+$/)
|
||||
}
|
||||
|
||||
function extractFromTokens(tokens: string[], patterns: Set<string>): void {
|
||||
if (tokens.length === 0) return
|
||||
|
||||
|
|
@ -58,11 +54,7 @@ function extractFromTokens(tokens: string[], patterns: Set<string>): void {
|
|||
patterns.add(pattern)
|
||||
|
||||
for (let i = 1; i < Math.min(tokens.length, 3); i++) {
|
||||
if (isValidToken(tokens[i])) {
|
||||
pattern += ` ${tokens[i]}`
|
||||
patterns.add(pattern)
|
||||
} else {
|
||||
break // Stop at first invalid token
|
||||
}
|
||||
pattern += ` ${tokens[i]}`
|
||||
patterns.add(pattern)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue