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

Function pluginListHandler

src/cli/handlers/plugins.ts:153–440  ·  view source on GitHub ↗
(options: {
  json?: boolean
  available?: boolean
  cowork?: boolean
})

Source from the content-addressed store, hash-verified

151
152// plugin list (lines 5217–5416)
153export async function pluginListHandler(options: {
154 json?: boolean
155 available?: boolean
156 cowork?: boolean
157}): Promise<void> {
158 if (options.cowork) setUseCoworkPlugins(true)
159 logEvent('ncode_plugin_list_command', {})
160
161 const installedData = loadInstalledPluginsV2()
162 const { getPluginEditableScopes } = await import(
163 '../../utils/plugins/pluginStartupCheck.js'
164 )
165 const enabledPlugins = getPluginEditableScopes()
166
167 const pluginIds = Object.keys(installedData.plugins)
168
169 // Load all plugins once. The JSON and human paths both need:
170 // - loadErrors (to show load failures per plugin)
171 // - inline plugins (session-only via --plugin-dir, source='name@inline')
172 // which are NOT in installedData.plugins (V2 bookkeeping) — they must
173 // be surfaced separately or `plugin list` silently ignores --plugin-dir.
174 const {
175 enabled: loadedEnabled,
176 disabled: loadedDisabled,
177 errors: loadErrors,
178 } = await loadAllPlugins()
179 const allLoadedPlugins = [...loadedEnabled, ...loadedDisabled]
180 const inlinePlugins = allLoadedPlugins.filter(p =>
181 p.source.endsWith('@inline'),
182 )
183 // Path-level inline failures (dir doesn't exist, parse error before
184 // manifest is read) use source='inline[N]'. Plugin-level errors after
185 // manifest read use source='name@inline'. Collect both for the session
186 // section — these are otherwise invisible since they have no pluginId.
187 const inlineLoadErrors = loadErrors.filter(
188 e => e.source.endsWith('@inline') || e.source.startsWith('inline['),
189 )
190
191 if (options.json) {
192 // Create a map of plugin source to loaded plugin for quick lookup
193 const loadedPluginMap = new Map(allLoadedPlugins.map(p => [p.source, p]))
194
195 const plugins: Array<{
196 id: string
197 version: string
198 scope: string
199 enabled: boolean
200 installPath: string
201 installedAt?: string
202 lastUpdated?: string
203 projectPath?: string
204 mcpServers?: Record<string, unknown>
205 errors?: string[]
206 }> = []
207
208 for (const pluginId of pluginIds.sort()) {
209 const installations = installedData.plugins[pluginId]
210 if (!installations || installations.length === 0) continue

Callers 1

runFunction · 0.85

Calls 15

setUseCoworkPluginsFunction · 0.85
loadInstalledPluginsV2Function · 0.85
getPluginEditableScopesFunction · 0.85
loadAllPluginsFunction · 0.85
parsePluginIdentifierFunction · 0.85
loadPluginMcpServersFunction · 0.85
getPluginErrorMessageFunction · 0.85
getInstallCountsFunction · 0.85
createPluginIdFunction · 0.85
isPluginInstalledFunction · 0.85

Tested by

no test coverage detected