MCPcopy Index your code
hub / github.com/codeaashu/claude-code / ValidatePlugin

Function ValidatePlugin

src/commands/plugin/ValidatePlugin.tsx:14–97  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

12 path?: string;
13};
14export function ValidatePlugin(t0) {
15 const $ = _c(5);
16 const {
17 onComplete,
18 path
19 } = t0;
20 let t1;
21 let t2;
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;

Callers

nothing calls this directly

Calls 1

runValidationFunction · 0.85

Tested by

no test coverage detected