MCPcopy Index your code
hub / github.com/codeaashu/claude-code / isCwdChangingCmdlet

Function isCwdChangingCmdlet

src/tools/PowerShellTool/readOnlyValidation.ts:1017–1033  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

1015 * semantically this is "alters path-resolution namespace".
1016 */
1017export function isCwdChangingCmdlet(name: string): boolean {
1018 const canonical = resolveToCanonical(name)
1019 return (
1020 canonical === 'set-location' ||
1021 canonical === 'push-location' ||
1022 canonical === 'pop-location' ||
1023 // New-PSDrive creates a drive mapping that redirects <name>:/... paths
1024 // to an arbitrary filesystem root. Aliases ndr/mount are not in
1025 // COMMON_ALIASES — check them explicitly (finding #21).
1026 canonical === 'new-psdrive' ||
1027 // ndr/mount are PS aliases for New-PSDrive on Windows only. On POSIX,
1028 // 'mount' is the native mount(8) command; treating it as PSDrive-creating
1029 // would false-positive. (bug #15 / review nit)
1030 (getPlatform() === 'windows' &&
1031 (canonical === 'ndr' || canonical === 'mount'))
1032 )
1033}
1034
1035/**
1036 * Checks if a command name (after alias resolution) is a safe output cmdlet.

Callers 3

checkPermissionModeFunction · 0.85
isReadOnlyCommandFunction · 0.85

Calls 2

resolveToCanonicalFunction · 0.85
getPlatformFunction · 0.85

Tested by

no test coverage detected