MCPcopy Create free account
hub / github.com/Noumena-Network/code / isNormalizedCdCommand

Function isNormalizedCdCommand

src/tools/BashTool/bashPermissions.ts:2604–2612  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

2602 * DIRECTORY_CHANGE_ALIASES (src/utils/powershell/parser.ts).
2603 */
2604export function isNormalizedCdCommand(command: string): boolean {
2605 const stripped = stripSafeWrappers(command)
2606 const parsed = tryParseShellCommand(stripped)
2607 if (parsed.success && parsed.tokens.length > 0) {
2608 const cmd = parsed.tokens[0]
2609 return cmd === 'cd' || cmd === 'pushd' || cmd === 'popd'
2610 }
2611 return /^(?:cd|pushd|popd)(?:\s|$)/.test(stripped)
2612}
2613
2614/**
2615 * Checks if a compound command contains any cd command,

Callers 2

bashToolHasPermissionFunction · 0.85
commandHasAnyCdFunction · 0.85

Calls 2

stripSafeWrappersFunction · 0.85
tryParseShellCommandFunction · 0.85

Tested by

no test coverage detected