()
| 22 | if ($[0] !== onComplete || $[1] !== path) { |
| 23 | t1 = () => { |
| 24 | const runValidation = async function runValidation() { |
| 25 | if (!path) { |
| 26 | onComplete("Usage: /plugin validate <path>\n\nValidate a plugin or marketplace manifest file or directory.\n\nExamples:\n /plugin validate .claude-plugin/plugin.json\n /plugin validate /path/to/plugin-directory\n /plugin validate .\n\nWhen given a directory, automatically validates .claude-plugin/marketplace.json\nor .claude-plugin/plugin.json (prefers marketplace if both exist).\n\nOr from the command line:\n claude plugin validate <path>"); |
| 27 | return; |
| 28 | } |
| 29 | ; |
| 30 | try { |
| 31 | const result = await validateManifest(path); |
| 32 | let output = ""; |
| 33 | output = output + `Validating ${result.fileType} manifest: ${result.filePath}\n\n`; |
| 34 | output; |
| 35 | if (result.errors.length > 0) { |
| 36 | output = output + `${figures.cross} Found ${result.errors.length} ${plural(result.errors.length, "error")}:\n\n`; |
| 37 | output; |
| 38 | result.errors.forEach(error_0 => { |
| 39 | output = output + ` ${figures.pointer} ${error_0.path}: ${error_0.message}\n`; |
| 40 | output; |
| 41 | }); |
| 42 | output = output + "\n"; |
| 43 | output; |
| 44 | } |
| 45 | if (result.warnings.length > 0) { |
| 46 | output = output + `${figures.warning} Found ${result.warnings.length} ${plural(result.warnings.length, "warning")}:\n\n`; |
| 47 | output; |
| 48 | result.warnings.forEach(warning => { |
| 49 | output = output + ` ${figures.pointer} ${warning.path}: ${warning.message}\n`; |
| 50 | output; |
| 51 | }); |
| 52 | output = output + "\n"; |
| 53 | output; |
| 54 | } |
| 55 | if (result.success) { |
| 56 | if (result.warnings.length > 0) { |
| 57 | output = output + `${figures.tick} Validation passed with warnings\n`; |
| 58 | output; |
| 59 | } else { |
| 60 | output = output + `${figures.tick} Validation passed\n`; |
| 61 | output; |
| 62 | } |
| 63 | process.exitCode = 0; |
| 64 | } else { |
| 65 | output = output + `${figures.cross} Validation failed\n`; |
| 66 | output; |
| 67 | process.exitCode = 1; |
| 68 | } |
| 69 | onComplete(output); |
| 70 | } catch (t3) { |
| 71 | const error = t3; |
| 72 | process.exitCode = 2; |
| 73 | logError(error); |
| 74 | onComplete(`${figures.cross} Unexpected error during validation: ${errorMessage(error)}`); |
| 75 | } |
| 76 | }; |
| 77 | runValidation(); |
| 78 | }; |
| 79 | t2 = [onComplete, path]; |
no test coverage detected