MCPcopy Create free account
hub / github.com/openai/plugins / evaluatePlugin

Function evaluatePlugin

plugins/plugin-eval/src/evaluators/plugin.js:12–291  ·  view source on GitHub ↗
(pluginRoot)

Source from the content-addressed store, hash-verified

10}
11
12export async function evaluatePlugin(pluginRoot) {
13 const manifestPath = path.join(pluginRoot, ".codex-plugin", "plugin.json");
14 const targetPath = relativePath(process.cwd(), pluginRoot);
15 const checks = [];
16 const metrics = [];
17 const artifacts = [];
18
19 if (!(await pathExists(manifestPath))) {
20 checks.push(
21 createCheck({
22 id: "plugin-manifest-missing",
23 category: "manifest",
24 severity: "error",
25 status: "fail",
26 message: "The plugin root is missing .codex-plugin/plugin.json.",
27 evidence: [targetPath],
28 remediation: ["Add .codex-plugin/plugin.json to the plugin root."],
29 targetPath,
30 }),
31 );
32 return { checks, metrics, artifacts };
33 }
34
35 let manifest;
36 try {
37 manifest = await readJson(manifestPath);
38 } catch (error) {
39 checks.push(
40 createCheck({
41 id: "plugin-manifest-invalid-json",
42 category: "manifest",
43 severity: "error",
44 status: "fail",
45 message: "plugin.json could not be parsed as JSON.",
46 evidence: [error instanceof Error ? error.message : String(error)],
47 remediation: ["Fix the JSON syntax in .codex-plugin/plugin.json."],
48 targetPath,
49 }),
50 );
51 return { checks, metrics, artifacts };
52 }
53
54 const requiredFields = ["name", "version", "description", "author", "interface"];
55 for (const field of requiredFields) {
56 if (!(field in manifest)) {
57 checks.push(
58 createCheck({
59 id: `manifest-missing-${field}`,
60 category: "manifest",
61 severity: "error",
62 status: "fail",
63 message: `plugin.json is missing the required \`${field}\` field.`,
64 evidence: [manifestPath],
65 remediation: [`Add \`${field}\` to plugin.json.`],
66 targetPath,
67 }),
68 );
69 }

Callers 1

analyzePathFunction · 0.90

Calls 11

relativePathFunction · 0.90
pathExistsFunction · 0.90
createCheckFunction · 0.90
readJsonFunction · 0.90
evaluateSkillFunction · 0.90
createMetricFunction · 0.90
createArtifactFunction · 0.90
filterMethod · 0.80
mapMethod · 0.80
isHyphenCaseFunction · 0.70

Tested by

no test coverage detected