spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / sec-default / hooks / policy / managed-tools-restored / is-org-tool / spellings-of / spellings-of.ts
GitHub Actions (publish-mods)chore: Update mods/ 3deb873 · 15 days ago History
16 lines · 639 BRaw
1/**
2 * How the engine spells a server's name inside its tools' names: every
3 * character that is not a letter, digit, `_` or `-` becomes `_`.
4 *
5 * A claude.ai connector's runs of `_` are also joined and trimmed, so both
6 * spellings are answered; one that comes out empty is left out.
7 *
8 * @param server the server's name as the policy spells it
9 * @returns the spellings, without repeats
10 */
11export function spellingsOf(server: string): string[] {
12 const spelt = server.replace(/[^a-zA-Z0-9_-]/g, '_')
13 const joined = spelt.replace(/_+/g, '_').replace(/^_|_$/g, '')
14
15 return [...new Set([spelt, joined])].filter(one => one !== '')
16}