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

Function stripModulePrefix

source code/utils/powershell/parser.ts:816–828  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

814/** Strip module prefix from command name (e.g. "Microsoft.PowerShell.Utility\\Invoke-Expression" -> "Invoke-Expression") */
815// exported for testing
816export function stripModulePrefix(name: string): string {
817 const idx = name.lastIndexOf('\\')
818 if (idx < 0) return name
819 // Don't strip file paths: drive letters (C:\...), UNC paths (\\server\...), or relative paths (.\, ..\)
820 if (
821 /^[A-Za-z]:/.test(name) ||
822 name.startsWith('\\\\') ||
823 name.startsWith('.\\') ||
824 name.startsWith('..\\')
825 )
826 return name
827 return name.substring(idx + 1)
828}
829
830/** Transform a raw CommandAst pipeline element into ParsedCommandElement */
831// exported for testing

Callers 3

stripModulePrefixForRuleFunction · 0.85
transformCommandAstFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected