MCPcopy Index your code
hub / github.com/liuup/claude-code-analysis / stripModulePrefix

Function stripModulePrefix

src/utils/powershell/parser.ts:814–826  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

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

Callers 3

stripModulePrefixForRuleFunction · 0.85
transformCommandAstFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected