MCPcopy Create free account
hub / github.com/codeaashu/claude-code / generateExtensionId

Function generateExtensionId

src/utils/dxt/helpers.ts:67–88  ·  view source on GitHub ↗
(
  manifest: McpbManifest,
  prefix?: 'local.unpacked' | 'local.dxt',
)

Source from the content-addressed store, hash-verified

65 * Uses the same algorithm as the directory backend for consistency.
66 */
67export function generateExtensionId(
68 manifest: McpbManifest,
69 prefix?: 'local.unpacked' | 'local.dxt',
70): string {
71 const sanitize = (str: string) =>
72 str
73 .toLowerCase()
74 .replace(/\s+/g, '-')
75 .replace(/[^a-z0-9-_.]/g, '')
76 .replace(/-+/g, '-')
77 .replace(/^-+|-+$/g, '')
78
79 const authorName = manifest.author.name
80 const extensionName = manifest.name
81
82 const sanitizedAuthor = sanitize(authorName)
83 const sanitizedName = sanitize(extensionName)
84
85 return prefix
86 ? `${prefix}.${sanitizedAuthor}.${sanitizedName}`
87 : `${sanitizedAuthor}.${sanitizedName}`
88}
89

Callers

nothing calls this directly

Calls 1

sanitizeFunction · 0.85

Tested by

no test coverage detected