MCPcopy Create free account
hub / github.com/freecodexyz/free-code / sortHookEnvFiles

Function sortHookEnvFiles

src/utils/sessionEnvironment.ts:155–166  ·  view source on GitHub ↗
(a: string, b: string)

Source from the content-addressed store, hash-verified

153 /^(setup|sessionstart|cwdchanged|filechanged)-hook-(\d+)\.sh$/
154
155function sortHookEnvFiles(a: string, b: string): number {
156 const aMatch = a.match(HOOK_ENV_REGEX)
157 const bMatch = b.match(HOOK_ENV_REGEX)
158 const aType = aMatch?.[1] || ''
159 const bType = bMatch?.[1] || ''
160 if (aType !== bType) {
161 return (HOOK_ENV_PRIORITY[aType] ?? 99) - (HOOK_ENV_PRIORITY[bType] ?? 99)
162 }
163 const aIndex = parseInt(aMatch?.[2] || '0', 10)
164 const bIndex = parseInt(bMatch?.[2] || '0', 10)
165 return aIndex - bIndex
166}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected