MCPcopy Index your code
hub / github.com/simstudioai/sim / getCanonicalToolDocNames

Function getCanonicalToolDocNames

scripts/generate-docs.ts:2987–3011  ·  view source on GitHub ↗

* Compute the canonical set of stripped block types that should have a * `docs/tools/*.mdx` file — namely every visible `category: 'tools'` block * (matching the writer filter at the top of this script). Any existing MDX * not in this set is stale and gets cleaned up. * * Uses `extractAllBlockC

()

Source from the content-addressed store, hash-verified

2985 * version naturally wins for both generation and cleanup.
2986 */
2987async function getCanonicalToolDocNames(): Promise<Set<string>> {
2988 const validToolDocs = new Set<string>()
2989 const blockFiles = (await glob(`${BLOCKS_PATH}/*.ts`)).sort()
2990
2991 for (const blockFile of blockFiles) {
2992 const fileContent = fs.readFileSync(blockFile, 'utf-8')
2993 const configs = extractAllBlockConfigs(fileContent)
2994
2995 for (const config of configs) {
2996 // Match the writer filter: integration blocks, the documented
2997 // native-resource blocks (category 'blocks'), and trigger-only service
2998 // blocks (category 'triggers') whose pages the trigger pass writes.
2999 const stripped = config.type ? stripVersionSuffix(config.type) : ''
3000 const isDocumentedResource = NATIVE_RESOURCE_BLOCK_TYPES.has(stripped)
3001 const isTriggerService =
3002 config.category === 'triggers' &&
3003 !config.hideFromToolbar &&
3004 stripped !== 'sim_workspace_event'
3005 if (!isIntegrationBlock(config) && !isDocumentedResource && !isTriggerService) continue
3006 validToolDocs.add(stripped)
3007 }
3008 }
3009
3010 return validToolDocs
3011}
3012
3013/**
3014 * Remove any `docs/tools/*.mdx` that no longer corresponds to a visible

Callers 1

generateAllBlockDocsFunction · 0.85

Calls 5

stripVersionSuffixFunction · 0.90
globFunction · 0.85
extractAllBlockConfigsFunction · 0.85
isIntegrationBlockFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected