MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / hasCommandNamed

Function hasCommandNamed

source code/utils/powershell/parser.ts:1547–1573  ·  view source on GitHub ↗
(
  parsed: ParsedPowerShellCommand,
  name: string,
)

Source from the content-addressed store, hash-verified

1545 * Handles common aliases too.
1546 */
1547export function hasCommandNamed(
1548 parsed: ParsedPowerShellCommand,
1549 name: string,
1550): boolean {
1551 const lowerName = name.toLowerCase()
1552 const canonicalFromAlias = COMMON_ALIASES[lowerName]?.toLowerCase()
1553
1554 for (const cmdName of getAllCommandNames(parsed)) {
1555 if (cmdName === lowerName) {
1556 return true
1557 }
1558 // Check if the command is an alias that resolves to the requested name
1559 const canonical = COMMON_ALIASES[cmdName]?.toLowerCase()
1560 if (canonical === lowerName) {
1561 return true
1562 }
1563 // Check if the requested name is an alias and the command is its canonical form
1564 if (canonicalFromAlias && cmdName === canonicalFromAlias) {
1565 return true
1566 }
1567 // Check if both resolve to the same canonical cmdlet (alias-to-alias match)
1568 if (canonical && canonicalFromAlias && canonical === canonicalFromAlias) {
1569 return true
1570 }
1571 }
1572 return false
1573}
1574
1575/**
1576 * Check if the command contains any directory-changing commands.

Callers 2

checkInvokeExpressionFunction · 0.85
checkAddTypeFunction · 0.85

Calls 1

getAllCommandNamesFunction · 0.85

Tested by

no test coverage detected