codex-plugin-doctor 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/validate-plugin.js +23 -4
- package/package.json +1 -1
|
@@ -38,6 +38,26 @@ async function fileExists(targetPath) {
|
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
async function readPackageName(rootPath) {
|
|
42
|
+
const packageJsonPath = path.join(rootPath, "package.json");
|
|
43
|
+
try {
|
|
44
|
+
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
|
|
45
|
+
return typeof packageJson.name === "string" ? packageJson.name : null;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function buildMissingManifestFailure(rootPath) {
|
|
52
|
+
const packageName = await readPackageName(rootPath);
|
|
53
|
+
if (packageName === "codex-plugin-doctor") {
|
|
54
|
+
return buildFailure("plugin.manifest.missing", "This looks like the Codex Plugin Doctor source repo, not a Codex plugin package.", "Codex Plugin Doctor validates plugin package roots that contain `.codex-plugin/plugin.json`; the tool source repo intentionally does not expose that manifest.", "For a local self-test, run `codex-plugin-doctor check examples/codex-doctor-runtime --runtime --no-animations`. To check your own plugin, pass that plugin package root instead.");
|
|
55
|
+
}
|
|
56
|
+
if (packageName) {
|
|
57
|
+
return buildFailure("plugin.manifest.missing", "This directory has a `package.json`, but it does not look like a Codex plugin package.", "Codex cannot treat a normal project directory as a plugin package without the required `.codex-plugin/plugin.json` entry point.", "Run from a Codex plugin package root, or pass the path to a directory that contains `.codex-plugin/plugin.json`.");
|
|
58
|
+
}
|
|
59
|
+
return buildFailure("plugin.manifest.missing", "This directory does not look like a Codex plugin package.", "Codex cannot treat this directory as a plugin package without the required `.codex-plugin/plugin.json` manifest entry point.", "Create `.codex-plugin/plugin.json` with at least `name`, `version`, and `description`, or pass the path to an existing Codex plugin package.");
|
|
60
|
+
}
|
|
41
61
|
function isPlainObject(value) {
|
|
42
62
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
43
63
|
}
|
|
@@ -299,13 +319,12 @@ async function validateMcpConfig(discoveredPackage) {
|
|
|
299
319
|
export async function validatePlugin(targetPath, options = {}) {
|
|
300
320
|
const discoveredPackage = await discoverPackage(targetPath);
|
|
301
321
|
if (!discoveredPackage) {
|
|
322
|
+
const rootPath = path.resolve(targetPath);
|
|
302
323
|
return {
|
|
303
|
-
targetPath:
|
|
324
|
+
targetPath: rootPath,
|
|
304
325
|
status: "fail",
|
|
305
326
|
exitCode: 1,
|
|
306
|
-
findings: [
|
|
307
|
-
buildFailure("plugin.manifest.missing", "Missing required `.codex-plugin/plugin.json` manifest.", "Codex cannot treat this directory as a plugin package without the required manifest entry point.", "Create `.codex-plugin/plugin.json` with at least `name`, `version`, and `description`.")
|
|
308
|
-
]
|
|
327
|
+
findings: [await buildMissingManifestFailure(rootPath)]
|
|
309
328
|
};
|
|
310
329
|
}
|
|
311
330
|
const runtimeResult = options.runtime
|
package/package.json
CHANGED