codex-plugin-doctor 0.1.1 → 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/README.md +11 -1
- package/dist/core/validate-plugin.js +23 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,9 +71,11 @@ Global install from npm:
|
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
73
|
npm install -g codex-plugin-doctor
|
|
74
|
-
codex-plugin-doctor check
|
|
74
|
+
codex-plugin-doctor check path/to/plugin-package
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
Run `codex-plugin-doctor check .` from the root of a Codex plugin package that contains `.codex-plugin/plugin.json`. The Codex Plugin Doctor source repository is not itself a plugin package.
|
|
78
|
+
|
|
77
79
|
Run from source:
|
|
78
80
|
|
|
79
81
|
```bash
|
|
@@ -139,6 +141,8 @@ x plugin.security.hard_coded_secret
|
|
|
139
141
|
|
|
140
142
|
## Useful Commands
|
|
141
143
|
|
|
144
|
+
Run these from a Codex plugin package root:
|
|
145
|
+
|
|
142
146
|
```bash
|
|
143
147
|
codex-plugin-doctor check .
|
|
144
148
|
codex-plugin-doctor check . --json
|
|
@@ -150,6 +154,12 @@ codex-plugin-doctor check . --runtime
|
|
|
150
154
|
codex-plugin-doctor check . --json --runtime --verbose-runtime
|
|
151
155
|
```
|
|
152
156
|
|
|
157
|
+
To self-test this repository after cloning it:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
codex-plugin-doctor check examples/codex-doctor-runtime --runtime --no-animations
|
|
161
|
+
```
|
|
162
|
+
|
|
153
163
|
## Repository Layout
|
|
154
164
|
|
|
155
165
|
```text
|
|
@@ -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