* 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
()
| 2985 | * version naturally wins for both generation and cleanup. |
| 2986 | */ |
| 2987 | async 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 |
no test coverage detected