MCPcopy
hub / github.com/codeaashu/claude-code / getUnconfiguredOptions

Function getUnconfiguredOptions

src/utils/plugins/pluginOptionsStorage.ts:282–310  ·  view source on GitHub ↗
(
  plugin: LoadedPlugin,
)

Source from the content-addressed store, hash-verified

280 * Used by PluginOptionsFlow to decide whether to show the prompt after enable.
281 */
282export function getUnconfiguredOptions(
283 plugin: LoadedPlugin,
284): PluginOptionSchema {
285 const manifestSchema = plugin.manifest.userConfig
286 if (!manifestSchema || Object.keys(manifestSchema).length === 0) {
287 return {}
288 }
289
290 const saved = loadPluginOptions(getPluginStorageId(plugin))
291 const validation = validateUserConfig(saved, manifestSchema)
292 if (validation.valid) {
293 return {}
294 }
295
296 // Return only the fields that failed. validateUserConfig reports errors as
297 // strings keyed by title/key — simpler to just re-check each field here than
298 // parse error strings.
299 const unconfigured: PluginOptionSchema = {}
300 for (const [key, fieldSchema] of Object.entries(manifestSchema)) {
301 const single = validateUserConfig(
302 { [key]: saved[key] } as PluginOptionValues,
303 { [key]: fieldSchema },
304 )
305 if (!single.valid) {
306 unconfigured[key] = fieldSchema
307 }
308 }
309 return unconfigured
310}
311
312/**
313 * Substitute ${CLAUDE_PLUGIN_ROOT} and ${CLAUDE_PLUGIN_DATA} with their paths.

Callers 1

PluginOptionsFlowFunction · 0.85

Calls 4

getPluginStorageIdFunction · 0.85
keysMethod · 0.80
entriesMethod · 0.80
validateUserConfigFunction · 0.70

Tested by

no test coverage detected