MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / pluginValidateHandler

Function pluginValidateHandler

source code/cli/handlers/plugins.ts:103–156  ·  view source on GitHub ↗
(
  manifestPath: string,
  options: { cowork?: boolean },
)

Source from the content-addressed store, hash-verified

101
102// plugin validate
103export async function pluginValidateHandler(
104 manifestPath: string,
105 options: { cowork?: boolean },
106): Promise<void> {
107 if (options.cowork) setUseCoworkPlugins(true)
108 try {
109 const result = await validateManifest(manifestPath)
110
111 // biome-ignore lint/suspicious/noConsole:: intentional console output
112 console.log(`Validating ${result.fileType} manifest: ${result.filePath}\n`)
113 printValidationResult(result)
114
115 // If this is a plugin manifest located inside a .claude-plugin directory,
116 // also validate the plugin's content files (skills, agents, commands,
117 // hooks). Works whether the user passed a directory or the plugin.json
118 // path directly.
119 let contentResults: ValidationResult[] = []
120 if (result.fileType === 'plugin') {
121 const manifestDir = dirname(result.filePath)
122 if (basename(manifestDir) === '.claude-plugin') {
123 contentResults = await validatePluginContents(dirname(manifestDir))
124 for (const r of contentResults) {
125 // biome-ignore lint/suspicious/noConsole:: intentional console output
126 console.log(`Validating ${r.fileType}: ${r.filePath}\n`)
127 printValidationResult(r)
128 }
129 }
130 }
131
132 const allSuccess = result.success && contentResults.every(r => r.success)
133 const hasWarnings =
134 result.warnings.length > 0 ||
135 contentResults.some(r => r.warnings.length > 0)
136
137 if (allSuccess) {
138 cliOk(
139 hasWarnings
140 ? `${figures.tick} Validation passed with warnings`
141 : `${figures.tick} Validation passed`,
142 )
143 } else {
144 // biome-ignore lint/suspicious/noConsole:: intentional console output
145 console.log(`${figures.cross} Validation failed`)
146 process.exit(1)
147 }
148 } catch (error) {
149 logError(error)
150 // biome-ignore lint/suspicious/noConsole:: intentional console output
151 console.error(
152 `${figures.cross} Unexpected error during validation: ${errorMessage(error)}`,
153 )
154 process.exit(2)
155 }
156}
157
158// plugin list (lines 5217–5416)
159export async function pluginListHandler(options: {

Callers 1

runFunction · 0.85

Calls 8

setUseCoworkPluginsFunction · 0.85
printValidationResultFunction · 0.85
validatePluginContentsFunction · 0.85
cliOkFunction · 0.85
validateManifestFunction · 0.50
logErrorFunction · 0.50
errorMessageFunction · 0.50
errorMethod · 0.45

Tested by

no test coverage detected