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

Function sortHookEnvFiles

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

Source from the content-addressed store, hash-verified

179 /^(setup|sessionstart|cwdchanged|filechanged)-hook-(\d+)\.sh$/
180
181function sortHookEnvFiles(a: string, b: string): number {
182 const aMatch = a.match(HOOK_ENV_REGEX)
183 const bMatch = b.match(HOOK_ENV_REGEX)
184 const aType = aMatch?.[1] || ''
185 const bType = bMatch?.[1] || ''
186 if (aType !== bType) {
187 return (HOOK_ENV_PRIORITY[aType] ?? 99) - (HOOK_ENV_PRIORITY[bType] ?? 99)
188 }
189 const aIndex = parseInt(aMatch?.[2] || '0', 10)
190 const bIndex = parseInt(bMatch?.[2] || '0', 10)
191 return aIndex - bIndex
192}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected