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

Function collectBundledSkillRows

scripts/generate_slash_command_appendix.mjs:684–734  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

682}
683
684async function collectBundledSkillRows() {
685 const source = await fs.readFile(bundledSkillsIndexPath, 'utf8')
686 const importMap = parseRelativeImports(source)
687 const blocks = findIfBlocks(source)
688 const seen = new Set()
689 const rows = []
690
691 for (const block of blocks) {
692 const blockImportMap = new Map([
693 ...importMap,
694 ...parseRelativeRequires(block.body),
695 ])
696 for (const row of parseRegistrationCalls(block.body, blockImportMap, block.gate)) {
697 const key = `${row.symbol}:${row.gate}`
698 if (seen.has(key)) continue
699 seen.add(key)
700 rows.push(row)
701 }
702 }
703
704 const topLevelSource = stripRanges(source, blocks)
705 for (const row of parseRegistrationCalls(topLevelSource, importMap, 'always')) {
706 const key = `${row.symbol}:${row.gate}`
707 if (seen.has(key)) continue
708 seen.add(key)
709 rows.push(row)
710 }
711
712 const detailedRows = []
713 for (const row of rows) {
714 const resolvedPath = await resolveExistingModuleFrom(bundledSkillsIndexPath, row.specifier)
715 const moduleSource = resolvedPath ? await fs.readFile(resolvedPath, 'utf8') : ''
716 const definitionSource = moduleSource ? findCallObjectSource(moduleSource, 'registerBundledSkill') : null
717 const metadata = definitionSource ? parseBundledSkillMetadata(definitionSource) : null
718 detailedRows.push({
719 kind: 'bundled_skill',
720 symbol: row.symbol,
721 item: metadata?.name ? `/${metadata.name}` : inferFamilyName(row.specifier) ? `/${inferFamilyName(row.specifier)}` : '(unknown)',
722 modulePath: resolvedPath ? cleanPath(resolvedPath) : '(missing)',
723 rawStatus: resolvedPath ? 'present_module' : 'missing_module',
724 aliases: (metadata?.aliases ?? []).join(', '),
725 userInvocable: metadata?.userInvocable || 'default_true',
726 disableModelInvocation: metadata?.disableModelInvocation || 'false',
727 hasIsEnabled: metadata?.hasIsEnabled ? 'yes' : '',
728 gate: row.gate,
729 })
730 }
731
732 detailedRows.sort((a, b) => a.item.localeCompare(b.item) || a.symbol.localeCompare(b.symbol))
733 return detailedRows
734}
735
736async function collectBuiltinPluginRows() {
737 const source = await fs.readFile(builtinPluginsInitPath, 'utf8')

Calls 13

parseRelativeImportsFunction · 0.85
findIfBlocksFunction · 0.85
parseRelativeRequiresFunction · 0.85
parseRegistrationCallsFunction · 0.85
stripRangesFunction · 0.85
findCallObjectSourceFunction · 0.85
inferFamilyNameFunction · 0.85
cleanPathFunction · 0.85
readFileMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected