codex-plugin-doctor 1.4.0 → 1.6.0
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 +5 -3
- package/dist/core/output-contract.js +12 -0
- package/dist/core/review-bundle.d.ts +77 -0
- package/dist/core/review-bundle.js +327 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/run-cli.js +95 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -218,6 +218,8 @@ codex-plugin-doctor doctor runtime-plan . --json --output runtime-plan.json
|
|
|
218
218
|
codex-plugin-doctor doctor runtime-plan . --markdown --output runtime-plan.md
|
|
219
219
|
codex-plugin-doctor doctor runtime-policy .
|
|
220
220
|
codex-plugin-doctor doctor runtime-policy . --json --output runtime-policy.json
|
|
221
|
+
codex-plugin-doctor doctor review-bundle . --output review-bundle --sign-key-env CODEX_PLUGIN_DOCTOR_SIGNING_KEY
|
|
222
|
+
codex-plugin-doctor doctor review-bundle verify review-bundle --target . --sign-key-env CODEX_PLUGIN_DOCTOR_SIGNING_KEY
|
|
221
223
|
codex-plugin-doctor doctor mcp .
|
|
222
224
|
codex-plugin-doctor doctor mcp . --json --output mcp-healthcheck.json
|
|
223
225
|
codex-plugin-doctor doctor export --bundle .
|
|
@@ -289,7 +291,7 @@ codex-plugin-doctor check . --json --runtime --verbose-runtime
|
|
|
289
291
|
|
|
290
292
|
`self-test` runs the bundled runtime-complete sample through static validation, runtime MCP probes, and the compatibility scorecard. It is the fastest post-install check after `npm install -g codex-plugin-doctor`.
|
|
291
293
|
|
|
292
|
-
`doctor` checks the local environment, including package version, platform, Node version, npm global prefix, Codex home, and Codex plugin cache visibility. The text output also includes recommended next commands for self-test, installed plugin discovery, runtime checks, compatibility scoring, and CI setup. `doctor contract` publishes the machine-readable output contract, including public JSON schema surfaces, stable-through-1.0 compatibility metadata, and a frozen rule catalog digest. Add `--json` for automation or `--output output-contract.json` to write the contract to disk. `doctor corpus` runs the bundled validation corpus against healthy runtime, risky security, starter skill, and generic MCP packages, then reports whether each case matched its expected outcome. Add `--json` for automation or `--output validation-corpus.json` to write the corpus report to disk. `doctor npm <package>` runs a preinstall scan by packing the npm package with scripts disabled, extracting the publish tarball, and running validation, security, trust, and recommendation checks against the shipped contents. Use a published Codex plugin package as the target; scanning `codex-plugin-doctor` itself intentionally reports a missing plugin manifest because this CLI package is not a plugin package. Add `--json` for automation or `--output npm-preinstall.json` to write the report to disk. `doctor attest <path>` creates a local attestation with stable package/report digests, validation/security/compatibility/trust summary, and verification metadata. Add `--sign-key-env NAME` to attach a local HMAC-SHA256 signature without printing the secret, or `--json --output attestation.json` to write the artifact to disk. `doctor attest verify <attestation.json> --target <path> --sign-key-env NAME` recomputes the package fingerprint, report digest, and HMAC signature offline; verification intentionally treats `generatedAt`, `targetPath`, `verification`, and `signature.keyHint` as unsigned display metadata. `doctor runtime-plan <path>` creates a non-executing runtime plan that lists MCP server commands, safe probe methods, risk reasons, and a stable approval digest before any local server is started. Add `--markdown --output runtime-plan.md` to preserve a review-ready approval artifact with the execution boundary, checklist, servers, probes, and risk reasons. `doctor runtime-policy <path>` evaluates the same runtime plan and security signals, then recommends `allow`, `review`, `sandbox_recommended`, or `deny` before local MCP execution starts. `check --runtime --require-runtime-approval --runtime-approval-digest <digest>` refuses to run runtime probes unless the current plan digest matches the approved digest. `doctor release-evidence <path> --sign-key-env NAME` creates one redacted release bundle with signed attestation, offline verification, corpus, performance, security, trust, package metadata, git release gates, and runtime approval status. Strict release evidence requires a clean tagged worktree; use `--allow-dirty` or `--allow-untagged` only for local rehearsal. `doctor release-evidence verify <evidence.json> --target <path> --sign-key-env NAME` verifies a shared release evidence artifact offline against an explicit package path; the artifact target path is treated as display metadata, not trusted input. `doctor release-evidence asset <path> --tag <tag> --output <evidence.json> --sign-key-env NAME` writes a signed release evidence file and prints the `gh release upload` command; add `--upload` to run the upload through GitHub CLI with `--clobber`. `doctor inspector <path>` builds a safe MCP Inspector launch command from a packaged `.mcp.json` file without starting the Inspector proxy automatically. Use `--server <name>` when the package contains multiple MCP server entries. `doctor diff --before <path> --after <path>` compares two package roots and reports new findings, resolved findings, trust score delta, and whether risk increased. `doctor recommend <path>` turns validation, security, and compatibility signals into a prioritized action plan with blocker, high, medium, and info actions. Add `--json` for automation or `--output recommendations.json` to write the report to disk. `doctor trust <path>` creates a local trust score from package lifecycle scripts, dependency specs, and MCP security findings. Use it before release when you want supply-chain risks summarized as one score. `doctor perf <path>` profiles the shared package analysis pipeline and reports per-stage durations for validation, config, security, compatibility, trust, recommendations, and total runtime. Add `--max-total-ms <ms>` or repeatable `--max-stage-ms stage=ms` to fail CI when a budget is exceeded. `doctor mcp <path>` exposes the generic MCP static health report under the doctor command family without starting local MCP servers. `doctor export --bundle <path>` creates a redacted operator handoff bundle that includes validation JSON, security scorecard data, compatibility matrix, recommendations, and trust score in one file. `doctor snapshot` creates a redacted diagnostics bundle with environment health, client config readiness, installed plugin metadata, and next commands. Add `--json` for machine-readable output or `--output doctor-snapshot.json` to write the bundle to disk. `doctor clients` reports local Codex, Claude Desktop, Cursor, Cline, and Windsurf config readiness. `doctor --update-check` compares the installed CLI version with the latest npm version and prints the upgrade command when a newer release is available.
|
|
294
|
+
`doctor` checks the local environment, including package version, platform, Node version, npm global prefix, Codex home, and Codex plugin cache visibility. The text output also includes recommended next commands for self-test, installed plugin discovery, runtime checks, compatibility scoring, and CI setup. `doctor contract` publishes the machine-readable output contract, including public JSON schema surfaces, stable-through-1.0 compatibility metadata, and a frozen rule catalog digest. Add `--json` for automation or `--output output-contract.json` to write the contract to disk. `doctor corpus` runs the bundled validation corpus against healthy runtime, risky security, starter skill, and generic MCP packages, then reports whether each case matched its expected outcome. Add `--json` for automation or `--output validation-corpus.json` to write the corpus report to disk. `doctor npm <package>` runs a preinstall scan by packing the npm package with scripts disabled, extracting the publish tarball, and running validation, security, trust, and recommendation checks against the shipped contents. Use a published Codex plugin package as the target; scanning `codex-plugin-doctor` itself intentionally reports a missing plugin manifest because this CLI package is not a plugin package. Add `--json` for automation or `--output npm-preinstall.json` to write the report to disk. `doctor attest <path>` creates a local attestation with stable package/report digests, validation/security/compatibility/trust summary, and verification metadata. Add `--sign-key-env NAME` to attach a local HMAC-SHA256 signature without printing the secret, or `--json --output attestation.json` to write the artifact to disk. `doctor attest verify <attestation.json> --target <path> --sign-key-env NAME` recomputes the package fingerprint, report digest, and HMAC signature offline; verification intentionally treats `generatedAt`, `targetPath`, `verification`, and `signature.keyHint` as unsigned display metadata. `doctor runtime-plan <path>` creates a non-executing runtime plan that lists MCP server commands, safe probe methods, risk reasons, and a stable approval digest before any local server is started. Add `--markdown --output runtime-plan.md` to preserve a review-ready approval artifact with the execution boundary, checklist, servers, probes, and risk reasons. `doctor runtime-policy <path>` evaluates the same runtime plan and security signals, then recommends `allow`, `review`, `sandbox_recommended`, or `deny` before local MCP execution starts. `doctor review-bundle <path> --output <dir> --sign-key-env NAME` writes a signed review directory with runtime plan, runtime policy, attestation, release evidence, manifest, and Markdown summary files. `doctor review-bundle verify <bundle-dir> --target <path> --sign-key-env NAME` verifies the bundle manifest, expected files, runtime artifacts, signed attestation, and signed release evidence offline before a reviewer trusts the handoff. `check --runtime --require-runtime-approval --runtime-approval-digest <digest>` refuses to run runtime probes unless the current plan digest matches the approved digest. `doctor release-evidence <path> --sign-key-env NAME` creates one redacted release bundle with signed attestation, offline verification, corpus, performance, security, trust, package metadata, git release gates, and runtime approval status. Strict release evidence requires a clean tagged worktree; use `--allow-dirty` or `--allow-untagged` only for local rehearsal. `doctor release-evidence verify <evidence.json> --target <path> --sign-key-env NAME` verifies a shared release evidence artifact offline against an explicit package path; the artifact target path is treated as display metadata, not trusted input. `doctor release-evidence asset <path> --tag <tag> --output <evidence.json> --sign-key-env NAME` writes a signed release evidence file and prints the `gh release upload` command; add `--upload` to run the upload through GitHub CLI with `--clobber`. `doctor inspector <path>` builds a safe MCP Inspector launch command from a packaged `.mcp.json` file without starting the Inspector proxy automatically. Use `--server <name>` when the package contains multiple MCP server entries. `doctor diff --before <path> --after <path>` compares two package roots and reports new findings, resolved findings, trust score delta, and whether risk increased. `doctor recommend <path>` turns validation, security, and compatibility signals into a prioritized action plan with blocker, high, medium, and info actions. Add `--json` for automation or `--output recommendations.json` to write the report to disk. `doctor trust <path>` creates a local trust score from package lifecycle scripts, dependency specs, and MCP security findings. Use it before release when you want supply-chain risks summarized as one score. `doctor perf <path>` profiles the shared package analysis pipeline and reports per-stage durations for validation, config, security, compatibility, trust, recommendations, and total runtime. Add `--max-total-ms <ms>` or repeatable `--max-stage-ms stage=ms` to fail CI when a budget is exceeded. `doctor mcp <path>` exposes the generic MCP static health report under the doctor command family without starting local MCP servers. `doctor export --bundle <path>` creates a redacted operator handoff bundle that includes validation JSON, security scorecard data, compatibility matrix, recommendations, and trust score in one file. `doctor snapshot` creates a redacted diagnostics bundle with environment health, client config readiness, installed plugin metadata, and next commands. Add `--json` for machine-readable output or `--output doctor-snapshot.json` to write the bundle to disk. `doctor clients` reports local Codex, Claude Desktop, Cursor, Cline, and Windsurf config readiness. `doctor --update-check` compares the installed CLI version with the latest npm version and prints the upgrade command when a newer release is available.
|
|
293
295
|
|
|
294
296
|
`audit --installed` runs a local ecosystem audit against every discovered Codex plugin in the installed plugin cache. Add `--security` to include security scorecards, `--compat` to include the all-client compatibility matrix, and `--json --output local-audit.json` when you want a shareable machine-readable report. Add `--cache` to reuse unchanged plugin results between runs; add `--changed` to only report plugins whose fingerprint changed since the last cached audit. Use `--cache-file path/to/audit-cache.json` when CI or scripted runs need an explicit cache location.
|
|
295
297
|
|
|
@@ -355,9 +357,9 @@ jobs:
|
|
|
355
357
|
runs-on: ubuntu-latest
|
|
356
358
|
steps:
|
|
357
359
|
- uses: actions/checkout@v5
|
|
358
|
-
- uses: Esquetta/CodexPluginDoctor@v1.
|
|
360
|
+
- uses: Esquetta/CodexPluginDoctor@v1.6.0
|
|
359
361
|
with:
|
|
360
|
-
version: "1.
|
|
362
|
+
version: "1.6.0"
|
|
361
363
|
path: .
|
|
362
364
|
runtime: "true"
|
|
363
365
|
policy: codex-publish
|
|
@@ -83,6 +83,18 @@ const publicSchemaDefinitions = [
|
|
|
83
83
|
outputKind: "doctor.runtime.policy",
|
|
84
84
|
required: ["schemaVersion", "kind", "generatedAt", "version", "targetPath", "status", "exitCode", "runtimeExecution", "planDigest", "recommendation", "summary", "servers"]
|
|
85
85
|
},
|
|
86
|
+
{
|
|
87
|
+
id: "doctor.review.bundle.json",
|
|
88
|
+
command: "codex-plugin-doctor doctor review-bundle <path> --json",
|
|
89
|
+
outputKind: "doctor.review.bundle",
|
|
90
|
+
required: ["schemaVersion", "kind", "generatedAt", "version", "targetPath", "outputDirectory", "status", "exitCode", "summary", "files"]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "doctor.review.bundle.verification.json",
|
|
94
|
+
command: "codex-plugin-doctor doctor review-bundle verify <bundle-dir> --target <path> --json",
|
|
95
|
+
outputKind: "doctor.review.bundle.verification",
|
|
96
|
+
required: ["schemaVersion", "kind", "generatedAt", "bundleDirectory", "targetPath", "status", "exitCode", "summary", "checks", "attestation", "releaseEvidence"]
|
|
97
|
+
},
|
|
86
98
|
{
|
|
87
99
|
id: "doctor.export.bundle.json",
|
|
88
100
|
command: "codex-plugin-doctor doctor export --bundle <path> --json",
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type DoctorAttestationVerificationReport, type DoctorAttestation } from "./attestation.js";
|
|
2
|
+
import { type DoctorReleaseEvidenceReport, type DoctorReleaseEvidenceVerificationReport } from "./release-evidence.js";
|
|
3
|
+
import { type DoctorRuntimePlan } from "./runtime-plan.js";
|
|
4
|
+
import { type DoctorRuntimePolicyReport } from "./runtime-policy.js";
|
|
5
|
+
export interface BuildDoctorReviewBundleOptions {
|
|
6
|
+
outputDirectory: string;
|
|
7
|
+
signingKey: string;
|
|
8
|
+
signingKeyEnv: string;
|
|
9
|
+
allowDirty?: boolean;
|
|
10
|
+
allowUntagged?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface DoctorReviewBundleManifest {
|
|
13
|
+
schemaVersion: "1.0.0";
|
|
14
|
+
kind: "doctor.review.bundle";
|
|
15
|
+
generatedAt: string;
|
|
16
|
+
version: string;
|
|
17
|
+
targetPath: string;
|
|
18
|
+
outputDirectory: string;
|
|
19
|
+
status: "pass" | "warn" | "fail";
|
|
20
|
+
exitCode: 0 | 1;
|
|
21
|
+
summary: {
|
|
22
|
+
runtimePolicy: DoctorRuntimePolicyReport["recommendation"]["decision"];
|
|
23
|
+
releaseReady: boolean;
|
|
24
|
+
attestation: DoctorAttestation["summary"]["status"];
|
|
25
|
+
releaseEvidence: DoctorReleaseEvidenceReport["status"];
|
|
26
|
+
};
|
|
27
|
+
files: {
|
|
28
|
+
manifest: string;
|
|
29
|
+
summary: string;
|
|
30
|
+
runtimePlanJson: string;
|
|
31
|
+
runtimePlanMarkdown: string;
|
|
32
|
+
runtimePolicyJson: string;
|
|
33
|
+
runtimePolicyText: string;
|
|
34
|
+
attestationJson: string;
|
|
35
|
+
releaseEvidenceJson: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface DoctorReviewBundle {
|
|
39
|
+
manifest: DoctorReviewBundleManifest;
|
|
40
|
+
runtimePlan: DoctorRuntimePlan;
|
|
41
|
+
runtimePolicy: DoctorRuntimePolicyReport;
|
|
42
|
+
attestation: DoctorAttestation;
|
|
43
|
+
releaseEvidence: DoctorReleaseEvidenceReport;
|
|
44
|
+
}
|
|
45
|
+
export interface DoctorReviewBundleVerificationReport {
|
|
46
|
+
schemaVersion: "1.0.0";
|
|
47
|
+
kind: "doctor.review.bundle.verification";
|
|
48
|
+
generatedAt: string;
|
|
49
|
+
bundleDirectory: string;
|
|
50
|
+
targetPath: string;
|
|
51
|
+
status: "pass" | "fail";
|
|
52
|
+
exitCode: 0 | 1;
|
|
53
|
+
summary: {
|
|
54
|
+
manifest: "pass" | "fail";
|
|
55
|
+
files: "pass" | "fail";
|
|
56
|
+
runtimePlan: "pass" | "fail";
|
|
57
|
+
runtimePolicy: "pass" | "fail";
|
|
58
|
+
attestation: "pass" | "fail";
|
|
59
|
+
releaseEvidence: "pass" | "fail";
|
|
60
|
+
};
|
|
61
|
+
checks: Array<{
|
|
62
|
+
id: string;
|
|
63
|
+
status: "pass" | "fail";
|
|
64
|
+
message: string;
|
|
65
|
+
}>;
|
|
66
|
+
attestation: DoctorAttestationVerificationReport | null;
|
|
67
|
+
releaseEvidence: DoctorReleaseEvidenceVerificationReport | null;
|
|
68
|
+
}
|
|
69
|
+
export declare function buildDoctorReviewBundle(targetPath: string, options: BuildDoctorReviewBundleOptions): Promise<DoctorReviewBundle>;
|
|
70
|
+
export declare function renderDoctorReviewBundleJson(bundle: DoctorReviewBundle): string;
|
|
71
|
+
export declare function verifyDoctorReviewBundle(bundleDirectory: string, options: {
|
|
72
|
+
signingKey: string;
|
|
73
|
+
targetPath: string;
|
|
74
|
+
}): Promise<DoctorReviewBundleVerificationReport>;
|
|
75
|
+
export declare function renderDoctorReviewBundleVerificationJson(report: DoctorReviewBundleVerificationReport): string;
|
|
76
|
+
export declare function renderDoctorReviewBundleVerification(report: DoctorReviewBundleVerificationReport): string;
|
|
77
|
+
export declare function renderDoctorReviewBundle(bundle: DoctorReviewBundle): string;
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { mkdir, stat, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { buildDoctorAttestation, renderDoctorAttestationJson, verifyDoctorAttestation } from "./attestation.js";
|
|
4
|
+
import { buildDoctorReleaseEvidenceReport, renderDoctorReleaseEvidenceJson, verifyDoctorReleaseEvidence } from "./release-evidence.js";
|
|
5
|
+
import { buildDoctorRuntimePlan, renderDoctorRuntimePlanJson, renderDoctorRuntimePlanMarkdown } from "./runtime-plan.js";
|
|
6
|
+
import { buildDoctorRuntimePolicyReport, renderDoctorRuntimePolicy, renderDoctorRuntimePolicyJson } from "./runtime-policy.js";
|
|
7
|
+
import { packageVersion } from "../version.js";
|
|
8
|
+
import { readJsonFile } from "./read-json-file.js";
|
|
9
|
+
function isPlainObject(value) {
|
|
10
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11
|
+
}
|
|
12
|
+
function isDoctorReviewBundleManifest(value) {
|
|
13
|
+
return isPlainObject(value) &&
|
|
14
|
+
value.schemaVersion === "1.0.0" &&
|
|
15
|
+
value.kind === "doctor.review.bundle" &&
|
|
16
|
+
typeof value.targetPath === "string" &&
|
|
17
|
+
typeof value.outputDirectory === "string" &&
|
|
18
|
+
isPlainObject(value.summary) &&
|
|
19
|
+
isPlainObject(value.files);
|
|
20
|
+
}
|
|
21
|
+
function relativeBundleFiles() {
|
|
22
|
+
return {
|
|
23
|
+
manifest: "manifest.json",
|
|
24
|
+
summary: "summary.md",
|
|
25
|
+
runtimePlanJson: "runtime-plan.json",
|
|
26
|
+
runtimePlanMarkdown: "runtime-plan.md",
|
|
27
|
+
runtimePolicyJson: "runtime-policy.json",
|
|
28
|
+
runtimePolicyText: "runtime-policy.txt",
|
|
29
|
+
attestationJson: "attestation.json",
|
|
30
|
+
releaseEvidenceJson: "release-evidence.json"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function bundleStatus(runtimePolicy, releaseEvidence) {
|
|
34
|
+
if (runtimePolicy.status === "fail" || releaseEvidence.status === "fail") {
|
|
35
|
+
return "fail";
|
|
36
|
+
}
|
|
37
|
+
if (runtimePolicy.status === "warn") {
|
|
38
|
+
return "warn";
|
|
39
|
+
}
|
|
40
|
+
return "pass";
|
|
41
|
+
}
|
|
42
|
+
function renderSummary(bundle) {
|
|
43
|
+
return [
|
|
44
|
+
"# Codex Plugin Doctor Review Bundle",
|
|
45
|
+
"",
|
|
46
|
+
`- Target: \`${bundle.manifest.targetPath}\``,
|
|
47
|
+
`- Status: **${bundle.manifest.status.toUpperCase()}**`,
|
|
48
|
+
`- Runtime policy: \`${bundle.runtimePolicy.recommendation.decision}\``,
|
|
49
|
+
`- Runtime plan digest: \`${bundle.runtimePlan.digest}\``,
|
|
50
|
+
`- Release ready: ${bundle.releaseEvidence.releaseReady ? "yes" : "no"}`,
|
|
51
|
+
`- Attestation: ${bundle.attestation.summary.status.toUpperCase()}`,
|
|
52
|
+
`- Release evidence: ${bundle.releaseEvidence.status.toUpperCase()}`,
|
|
53
|
+
"",
|
|
54
|
+
"## Files",
|
|
55
|
+
"",
|
|
56
|
+
`- [Runtime plan JSON](${bundle.manifest.files.runtimePlanJson})`,
|
|
57
|
+
`- [Runtime plan Markdown](${bundle.manifest.files.runtimePlanMarkdown})`,
|
|
58
|
+
`- [Runtime policy JSON](${bundle.manifest.files.runtimePolicyJson})`,
|
|
59
|
+
`- [Runtime policy text](${bundle.manifest.files.runtimePolicyText})`,
|
|
60
|
+
`- [Attestation JSON](${bundle.manifest.files.attestationJson})`,
|
|
61
|
+
`- [Release evidence JSON](${bundle.manifest.files.releaseEvidenceJson})`,
|
|
62
|
+
"",
|
|
63
|
+
"## Runtime Policy Actions",
|
|
64
|
+
"",
|
|
65
|
+
...bundle.runtimePolicy.recommendation.actions.map((action) => `- ${action}`)
|
|
66
|
+
].join("\n");
|
|
67
|
+
}
|
|
68
|
+
async function writeBundleFiles(bundle) {
|
|
69
|
+
const outputDirectory = bundle.manifest.outputDirectory;
|
|
70
|
+
const files = bundle.manifest.files;
|
|
71
|
+
await mkdir(outputDirectory, { recursive: true });
|
|
72
|
+
await Promise.all([
|
|
73
|
+
writeFile(path.join(outputDirectory, files.manifest), JSON.stringify(bundle.manifest, null, 2), "utf8"),
|
|
74
|
+
writeFile(path.join(outputDirectory, files.summary), renderSummary(bundle), "utf8"),
|
|
75
|
+
writeFile(path.join(outputDirectory, files.runtimePlanJson), renderDoctorRuntimePlanJson(bundle.runtimePlan), "utf8"),
|
|
76
|
+
writeFile(path.join(outputDirectory, files.runtimePlanMarkdown), renderDoctorRuntimePlanMarkdown(bundle.runtimePlan), "utf8"),
|
|
77
|
+
writeFile(path.join(outputDirectory, files.runtimePolicyJson), renderDoctorRuntimePolicyJson(bundle.runtimePolicy), "utf8"),
|
|
78
|
+
writeFile(path.join(outputDirectory, files.runtimePolicyText), renderDoctorRuntimePolicy(bundle.runtimePolicy), "utf8"),
|
|
79
|
+
writeFile(path.join(outputDirectory, files.attestationJson), renderDoctorAttestationJson(bundle.attestation), "utf8"),
|
|
80
|
+
writeFile(path.join(outputDirectory, files.releaseEvidenceJson), renderDoctorReleaseEvidenceJson(bundle.releaseEvidence), "utf8")
|
|
81
|
+
]);
|
|
82
|
+
}
|
|
83
|
+
export async function buildDoctorReviewBundle(targetPath, options) {
|
|
84
|
+
const outputDirectory = path.resolve(options.outputDirectory);
|
|
85
|
+
const releaseEvidenceOptions = {
|
|
86
|
+
signingKey: options.signingKey,
|
|
87
|
+
signingKeyEnv: options.signingKeyEnv,
|
|
88
|
+
allowDirty: options.allowDirty,
|
|
89
|
+
allowUntagged: options.allowUntagged
|
|
90
|
+
};
|
|
91
|
+
const [runtimePlan, runtimePolicy, attestation, releaseEvidence] = await Promise.all([
|
|
92
|
+
buildDoctorRuntimePlan(targetPath),
|
|
93
|
+
buildDoctorRuntimePolicyReport(targetPath),
|
|
94
|
+
buildDoctorAttestation(targetPath, {
|
|
95
|
+
signingKey: options.signingKey,
|
|
96
|
+
signingKeyHint: `env:${options.signingKeyEnv}`,
|
|
97
|
+
recomputeKeyEnv: options.signingKeyEnv
|
|
98
|
+
}),
|
|
99
|
+
buildDoctorReleaseEvidenceReport(targetPath, releaseEvidenceOptions)
|
|
100
|
+
]);
|
|
101
|
+
const files = relativeBundleFiles();
|
|
102
|
+
const status = bundleStatus(runtimePolicy, releaseEvidence);
|
|
103
|
+
const manifest = {
|
|
104
|
+
schemaVersion: "1.0.0",
|
|
105
|
+
kind: "doctor.review.bundle",
|
|
106
|
+
generatedAt: new Date().toISOString(),
|
|
107
|
+
version: packageVersion,
|
|
108
|
+
targetPath: releaseEvidence.targetPath,
|
|
109
|
+
outputDirectory,
|
|
110
|
+
status,
|
|
111
|
+
exitCode: status === "fail" ? 1 : 0,
|
|
112
|
+
summary: {
|
|
113
|
+
runtimePolicy: runtimePolicy.recommendation.decision,
|
|
114
|
+
releaseReady: releaseEvidence.releaseReady,
|
|
115
|
+
attestation: attestation.summary.status,
|
|
116
|
+
releaseEvidence: releaseEvidence.status
|
|
117
|
+
},
|
|
118
|
+
files
|
|
119
|
+
};
|
|
120
|
+
const bundle = {
|
|
121
|
+
manifest,
|
|
122
|
+
runtimePlan,
|
|
123
|
+
runtimePolicy,
|
|
124
|
+
attestation,
|
|
125
|
+
releaseEvidence
|
|
126
|
+
};
|
|
127
|
+
await writeBundleFiles(bundle);
|
|
128
|
+
return bundle;
|
|
129
|
+
}
|
|
130
|
+
export function renderDoctorReviewBundleJson(bundle) {
|
|
131
|
+
return JSON.stringify(bundle.manifest, null, 2);
|
|
132
|
+
}
|
|
133
|
+
async function readBundleJsonFile(bundleDirectory, relativePath) {
|
|
134
|
+
return readJsonFile(path.join(bundleDirectory, relativePath));
|
|
135
|
+
}
|
|
136
|
+
export async function verifyDoctorReviewBundle(bundleDirectory, options) {
|
|
137
|
+
const resolvedBundleDirectory = path.resolve(bundleDirectory);
|
|
138
|
+
const targetPath = path.resolve(options.targetPath);
|
|
139
|
+
const checks = [];
|
|
140
|
+
let manifest = null;
|
|
141
|
+
let runtimePlanStatus = "fail";
|
|
142
|
+
let runtimePolicyStatus = "fail";
|
|
143
|
+
let attestation = null;
|
|
144
|
+
let releaseEvidence = null;
|
|
145
|
+
try {
|
|
146
|
+
const manifestArtifact = await readBundleJsonFile(resolvedBundleDirectory, "manifest.json");
|
|
147
|
+
if (isDoctorReviewBundleManifest(manifestArtifact)) {
|
|
148
|
+
manifest = manifestArtifact;
|
|
149
|
+
checks.push({
|
|
150
|
+
id: "review_bundle.manifest.valid",
|
|
151
|
+
status: "pass",
|
|
152
|
+
message: "The review bundle manifest has the expected schema and kind."
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
checks.push({
|
|
157
|
+
id: "review_bundle.manifest.valid",
|
|
158
|
+
status: "fail",
|
|
159
|
+
message: "The review bundle manifest is missing or invalid."
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
checks.push({
|
|
165
|
+
id: "review_bundle.manifest.valid",
|
|
166
|
+
status: "fail",
|
|
167
|
+
message: "The review bundle manifest could not be read."
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
const files = manifest?.files ?? relativeBundleFiles();
|
|
171
|
+
for (const [fileKey, relativePath] of Object.entries(files)) {
|
|
172
|
+
try {
|
|
173
|
+
const fileStat = await stat(path.join(resolvedBundleDirectory, relativePath));
|
|
174
|
+
checks.push({
|
|
175
|
+
id: `review_bundle.file.${fileKey}`,
|
|
176
|
+
status: fileStat.isFile() ? "pass" : "fail",
|
|
177
|
+
message: fileStat.isFile()
|
|
178
|
+
? `${relativePath} is present.`
|
|
179
|
+
: `${relativePath} is not a regular file.`
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
checks.push({
|
|
184
|
+
id: `review_bundle.file.${fileKey}`,
|
|
185
|
+
status: "fail",
|
|
186
|
+
message: `${relativePath} is missing.`
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
const runtimePlan = await readBundleJsonFile(resolvedBundleDirectory, files.runtimePlanJson);
|
|
192
|
+
runtimePlanStatus = isPlainObject(runtimePlan) && runtimePlan.kind === "doctor.runtime.plan" ? "pass" : "fail";
|
|
193
|
+
checks.push({
|
|
194
|
+
id: "review_bundle.runtime_plan",
|
|
195
|
+
status: runtimePlanStatus,
|
|
196
|
+
message: runtimePlanStatus === "pass"
|
|
197
|
+
? "The runtime plan artifact has the expected kind."
|
|
198
|
+
: "The runtime plan artifact is invalid."
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
checks.push({
|
|
203
|
+
id: "review_bundle.runtime_plan",
|
|
204
|
+
status: "fail",
|
|
205
|
+
message: "The runtime plan artifact could not be read."
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
try {
|
|
209
|
+
const runtimePolicy = await readBundleJsonFile(resolvedBundleDirectory, files.runtimePolicyJson);
|
|
210
|
+
runtimePolicyStatus = isPlainObject(runtimePolicy) && runtimePolicy.kind === "doctor.runtime.policy" ? "pass" : "fail";
|
|
211
|
+
checks.push({
|
|
212
|
+
id: "review_bundle.runtime_policy",
|
|
213
|
+
status: runtimePolicyStatus,
|
|
214
|
+
message: runtimePolicyStatus === "pass"
|
|
215
|
+
? "The runtime policy artifact has the expected kind."
|
|
216
|
+
: "The runtime policy artifact is invalid."
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
checks.push({
|
|
221
|
+
id: "review_bundle.runtime_policy",
|
|
222
|
+
status: "fail",
|
|
223
|
+
message: "The runtime policy artifact could not be read."
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
try {
|
|
227
|
+
attestation = await verifyDoctorAttestation(path.join(resolvedBundleDirectory, files.attestationJson), targetPath, { signingKey: options.signingKey });
|
|
228
|
+
checks.push({
|
|
229
|
+
id: "review_bundle.attestation",
|
|
230
|
+
status: attestation.status,
|
|
231
|
+
message: attestation.status === "pass"
|
|
232
|
+
? "The bundled attestation verifies against the target package."
|
|
233
|
+
: "The bundled attestation does not verify against the target package."
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
checks.push({
|
|
238
|
+
id: "review_bundle.attestation",
|
|
239
|
+
status: "fail",
|
|
240
|
+
message: "The bundled attestation could not be verified."
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
releaseEvidence = await verifyDoctorReleaseEvidence(path.join(resolvedBundleDirectory, files.releaseEvidenceJson), {
|
|
245
|
+
signingKey: options.signingKey,
|
|
246
|
+
targetPath
|
|
247
|
+
});
|
|
248
|
+
checks.push({
|
|
249
|
+
id: "review_bundle.release_evidence",
|
|
250
|
+
status: releaseEvidence.status,
|
|
251
|
+
message: releaseEvidence.status === "pass"
|
|
252
|
+
? "The bundled release evidence verifies against the target package."
|
|
253
|
+
: "The bundled release evidence does not verify against the target package."
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
catch {
|
|
257
|
+
checks.push({
|
|
258
|
+
id: "review_bundle.release_evidence",
|
|
259
|
+
status: "fail",
|
|
260
|
+
message: "The bundled release evidence could not be verified."
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
const failedChecks = checks.filter((check) => check.status === "fail");
|
|
264
|
+
const fileChecks = checks.filter((check) => check.id.startsWith("review_bundle.file."));
|
|
265
|
+
const manifestStatus = checks.find((check) => check.id === "review_bundle.manifest.valid")?.status ?? "fail";
|
|
266
|
+
return {
|
|
267
|
+
schemaVersion: "1.0.0",
|
|
268
|
+
kind: "doctor.review.bundle.verification",
|
|
269
|
+
generatedAt: new Date().toISOString(),
|
|
270
|
+
bundleDirectory: resolvedBundleDirectory,
|
|
271
|
+
targetPath,
|
|
272
|
+
status: failedChecks.length === 0 ? "pass" : "fail",
|
|
273
|
+
exitCode: failedChecks.length === 0 ? 0 : 1,
|
|
274
|
+
summary: {
|
|
275
|
+
manifest: manifestStatus,
|
|
276
|
+
files: fileChecks.every((check) => check.status === "pass") ? "pass" : "fail",
|
|
277
|
+
runtimePlan: runtimePlanStatus,
|
|
278
|
+
runtimePolicy: runtimePolicyStatus,
|
|
279
|
+
attestation: attestation?.status ?? "fail",
|
|
280
|
+
releaseEvidence: releaseEvidence?.status ?? "fail"
|
|
281
|
+
},
|
|
282
|
+
checks,
|
|
283
|
+
attestation,
|
|
284
|
+
releaseEvidence
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
export function renderDoctorReviewBundleVerificationJson(report) {
|
|
288
|
+
return JSON.stringify(report, null, 2);
|
|
289
|
+
}
|
|
290
|
+
export function renderDoctorReviewBundleVerification(report) {
|
|
291
|
+
const lines = [
|
|
292
|
+
"Doctor Review Bundle Verification",
|
|
293
|
+
"=================================",
|
|
294
|
+
`Bundle: ${report.bundleDirectory}`,
|
|
295
|
+
`Target: ${report.targetPath}`,
|
|
296
|
+
`Status: ${report.status.toUpperCase()}`,
|
|
297
|
+
`Manifest: ${report.summary.manifest.toUpperCase()}`,
|
|
298
|
+
`Files: ${report.summary.files.toUpperCase()}`,
|
|
299
|
+
`Runtime plan: ${report.summary.runtimePlan.toUpperCase()}`,
|
|
300
|
+
`Runtime policy: ${report.summary.runtimePolicy.toUpperCase()}`,
|
|
301
|
+
`Attestation: ${report.summary.attestation.toUpperCase()}`,
|
|
302
|
+
`Release evidence: ${report.summary.releaseEvidence.toUpperCase()}`,
|
|
303
|
+
"",
|
|
304
|
+
"Checks",
|
|
305
|
+
"------"
|
|
306
|
+
];
|
|
307
|
+
for (const check of report.checks) {
|
|
308
|
+
lines.push(`${check.status === "pass" ? "PASS" : "FAIL"} ${check.id}`);
|
|
309
|
+
lines.push(` ${check.message}`);
|
|
310
|
+
}
|
|
311
|
+
return lines.join("\n");
|
|
312
|
+
}
|
|
313
|
+
export function renderDoctorReviewBundle(bundle) {
|
|
314
|
+
return [
|
|
315
|
+
"Doctor Review Bundle",
|
|
316
|
+
"====================",
|
|
317
|
+
`Target: ${bundle.manifest.targetPath}`,
|
|
318
|
+
`Output: ${bundle.manifest.outputDirectory}`,
|
|
319
|
+
`Status: ${bundle.manifest.status.toUpperCase()}`,
|
|
320
|
+
`Runtime policy: ${bundle.manifest.summary.runtimePolicy}`,
|
|
321
|
+
`Release ready: ${bundle.manifest.summary.releaseReady ? "yes" : "no"}`,
|
|
322
|
+
"",
|
|
323
|
+
"Files",
|
|
324
|
+
"-----",
|
|
325
|
+
...Object.values(bundle.manifest.files).map((file) => `- ${file}`)
|
|
326
|
+
].join("\n");
|
|
327
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { buildDoctorExportBundleFromAnalysis, buildDoctorRecommendationsFromAnal
|
|
|
11
11
|
export { buildDoctorPerformanceReport, renderDoctorPerformanceReport, renderDoctorPerformanceReportJson, type BuildDoctorPerformanceReportOptions, type DoctorPerformanceReport, type DoctorPerformanceStage, type DoctorPerformanceStageName } from "./core/performance-report.js";
|
|
12
12
|
export { buildDoctorRuntimePlan, evaluateRuntimeApproval, renderDoctorRuntimePlan, renderDoctorRuntimePlanMarkdown, renderDoctorRuntimePlanJson, runtimeApprovalPassed, type DoctorRuntimePlan, type RuntimeApprovalReport, type RuntimePlanServer } from "./core/runtime-plan.js";
|
|
13
13
|
export { buildDoctorRuntimePolicyReport, renderDoctorRuntimePolicy, renderDoctorRuntimePolicyJson, type DoctorRuntimePolicyReport, type RuntimePolicyDecision, type RuntimePolicyRecommendation } from "./core/runtime-policy.js";
|
|
14
|
+
export { buildDoctorReviewBundle, renderDoctorReviewBundle, renderDoctorReviewBundleJson, renderDoctorReviewBundleVerification, renderDoctorReviewBundleVerificationJson, verifyDoctorReviewBundle, type BuildDoctorReviewBundleOptions, type DoctorReviewBundle, type DoctorReviewBundleManifest, type DoctorReviewBundleVerificationReport } from "./core/review-bundle.js";
|
|
14
15
|
export { buildDoctorReleaseEvidenceAssetReport, buildDoctorReleaseEvidenceReport, renderDoctorReleaseEvidenceAsset, renderDoctorReleaseEvidenceAssetJson, renderDoctorReleaseEvidence, renderDoctorReleaseEvidenceJson, renderDoctorReleaseEvidenceVerification, renderDoctorReleaseEvidenceVerificationJson, verifyDoctorReleaseEvidence, type BuildDoctorReleaseEvidenceOptions, type DoctorReleaseEvidenceAssetReport, type DoctorReleaseEvidenceGitMetadata, type DoctorReleaseEvidencePackageMetadata, type DoctorReleaseEvidenceReport, type DoctorReleaseEvidenceVerificationReport } from "./core/release-evidence.js";
|
|
15
16
|
export { buildDoctorNpmPackageReport, renderDoctorNpmPackageReport, renderDoctorNpmPackageReportJson, type BuildDoctorNpmPackageReportOptions, type DoctorNpmPackageReport } from "./core/npm-package-doctor.js";
|
|
16
17
|
export { buildDoctorRiskDiffReport, renderDoctorRiskDiffReport, renderDoctorRiskDiffReportJson, type BuildDoctorRiskDiffReportOptions, type DoctorRiskDiffReport, type RiskDiffFinding, type RiskFindingCategory } from "./core/risk-diff.js";
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { buildDoctorExportBundleFromAnalysis, buildDoctorRecommendationsFromAnal
|
|
|
11
11
|
export { buildDoctorPerformanceReport, renderDoctorPerformanceReport, renderDoctorPerformanceReportJson } from "./core/performance-report.js";
|
|
12
12
|
export { buildDoctorRuntimePlan, evaluateRuntimeApproval, renderDoctorRuntimePlan, renderDoctorRuntimePlanMarkdown, renderDoctorRuntimePlanJson, runtimeApprovalPassed } from "./core/runtime-plan.js";
|
|
13
13
|
export { buildDoctorRuntimePolicyReport, renderDoctorRuntimePolicy, renderDoctorRuntimePolicyJson } from "./core/runtime-policy.js";
|
|
14
|
+
export { buildDoctorReviewBundle, renderDoctorReviewBundle, renderDoctorReviewBundleJson, renderDoctorReviewBundleVerification, renderDoctorReviewBundleVerificationJson, verifyDoctorReviewBundle } from "./core/review-bundle.js";
|
|
14
15
|
export { buildDoctorReleaseEvidenceAssetReport, buildDoctorReleaseEvidenceReport, renderDoctorReleaseEvidenceAsset, renderDoctorReleaseEvidenceAssetJson, renderDoctorReleaseEvidence, renderDoctorReleaseEvidenceJson, renderDoctorReleaseEvidenceVerification, renderDoctorReleaseEvidenceVerificationJson, verifyDoctorReleaseEvidence } from "./core/release-evidence.js";
|
|
15
16
|
export { buildDoctorNpmPackageReport, renderDoctorNpmPackageReport, renderDoctorNpmPackageReportJson } from "./core/npm-package-doctor.js";
|
|
16
17
|
export { buildDoctorRiskDiffReport, renderDoctorRiskDiffReport, renderDoctorRiskDiffReportJson } from "./core/risk-diff.js";
|
package/dist/run-cli.js
CHANGED
|
@@ -22,6 +22,7 @@ import { buildDoctorValidationCorpusReport, renderDoctorValidationCorpusJson, re
|
|
|
22
22
|
import { buildDoctorPerformanceReport, renderDoctorPerformanceReport, renderDoctorPerformanceReportJson } from "./core/performance-report.js";
|
|
23
23
|
import { buildDoctorRuntimePlan, evaluateRuntimeApproval, renderDoctorRuntimePlan, renderDoctorRuntimePlanMarkdown, renderDoctorRuntimePlanJson, runtimeApprovalPassed } from "./core/runtime-plan.js";
|
|
24
24
|
import { buildDoctorRuntimePolicyReport, renderDoctorRuntimePolicy, renderDoctorRuntimePolicyJson } from "./core/runtime-policy.js";
|
|
25
|
+
import { buildDoctorReviewBundle, renderDoctorReviewBundle, renderDoctorReviewBundleJson, renderDoctorReviewBundleVerification, renderDoctorReviewBundleVerificationJson, verifyDoctorReviewBundle } from "./core/review-bundle.js";
|
|
25
26
|
import { buildDoctorReleaseEvidenceAssetReport, buildDoctorReleaseEvidenceReport, renderDoctorReleaseEvidenceAsset, renderDoctorReleaseEvidenceAssetJson, renderDoctorReleaseEvidence, renderDoctorReleaseEvidenceJson, renderDoctorReleaseEvidenceVerification, renderDoctorReleaseEvidenceVerificationJson, verifyDoctorReleaseEvidence } from "./core/release-evidence.js";
|
|
26
27
|
import { buildDoctorNpmPackageReport, renderDoctorNpmPackageReport, renderDoctorNpmPackageReportJson } from "./core/npm-package-doctor.js";
|
|
27
28
|
import { buildDoctorRiskDiffReport, renderDoctorRiskDiffReport, renderDoctorRiskDiffReportJson } from "./core/risk-diff.js";
|
|
@@ -72,7 +73,7 @@ const defaultIo = {
|
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
75
|
function printUsage(io) {
|
|
75
|
-
io.writeStderr("Usage: codex-plugin-doctor check <path|--installed> [filter] [--policy codex-publish|mcp-strict|security] [--compat] [--json|--markdown|--badge-json|--badge-markdown] [--output <path>] [--history <path>] [--runtime] [--require-runtime-approval --runtime-approval-digest <digest>] [--verbose-runtime] [--explain] [--no-animations] [--ascii]\n codex-plugin-doctor audit --installed [filter] [--policy codex-publish|mcp-strict|security] [--security] [--compat] [--json] [--output <path>] [--cache] [--changed]\n codex-plugin-doctor mcp <path> [--json] [--output <path>]\n codex-plugin-doctor security <path> [--policy security] [--json|--scorecard]\n codex-plugin-doctor compat <path> [--all|--client <client>] [--json] [--scorecard] [--output <path>] [--install-preview|--apply --backup]\n codex-plugin-doctor fix <path> (--dry-run|--interactive --backup|--apply --backup)\n codex-plugin-doctor history <history.jsonl> [--json] [--fail-on-regression]\n codex-plugin-doctor doctor [npm <package>|contract|corpus|runtime-plan <path> [--json|--markdown] [--output <path>]|runtime-policy <path> [--json] [--output <path>]|attest <path> [--sign-key-env NAME]|attest verify <attestation.json> --target <path> --sign-key-env NAME|release-evidence <path> --sign-key-env NAME [--allow-dirty] [--allow-untagged] [--require-runtime-approval --runtime-approval-digest <digest>]|release-evidence verify <evidence.json> --target <path> --sign-key-env NAME|release-evidence asset <path> --tag <tag> --output <evidence.json> --sign-key-env NAME [--upload]|mcp <path>|inspector <path>|diff --before <path> --after <path>|recommend <path>|trust <path>|perf <path> [--max-total-ms <ms>] [--max-stage-ms stage=ms]|export --bundle <path>|snapshot|clients|--json|--update-check]\n codex-plugin-doctor init [path] [--template skill-only|mcp-stdio|mcp-http|full-runtime]\n codex-plugin-doctor init-ci [path]\n codex-plugin-doctor self-test\n codex-plugin-doctor list --installed\n codex-plugin-doctor explain <finding-id>\n codex-plugin-doctor --version\n\nFirst run:\n codex-plugin-doctor doctor\n codex-plugin-doctor self-test\n codex-plugin-doctor init my-plugin\n codex-plugin-doctor check . --runtime --explain");
|
|
76
|
+
io.writeStderr("Usage: codex-plugin-doctor check <path|--installed> [filter] [--policy codex-publish|mcp-strict|security] [--compat] [--json|--markdown|--badge-json|--badge-markdown] [--output <path>] [--history <path>] [--runtime] [--require-runtime-approval --runtime-approval-digest <digest>] [--verbose-runtime] [--explain] [--no-animations] [--ascii]\n codex-plugin-doctor audit --installed [filter] [--policy codex-publish|mcp-strict|security] [--security] [--compat] [--json] [--output <path>] [--cache] [--changed]\n codex-plugin-doctor mcp <path> [--json] [--output <path>]\n codex-plugin-doctor security <path> [--policy security] [--json|--scorecard]\n codex-plugin-doctor compat <path> [--all|--client <client>] [--json] [--scorecard] [--output <path>] [--install-preview|--apply --backup]\n codex-plugin-doctor fix <path> (--dry-run|--interactive --backup|--apply --backup)\n codex-plugin-doctor history <history.jsonl> [--json] [--fail-on-regression]\n codex-plugin-doctor doctor [npm <package>|contract|corpus|runtime-plan <path> [--json|--markdown] [--output <path>]|runtime-policy <path> [--json] [--output <path>]|review-bundle <path> --output <dir> --sign-key-env NAME [--json] [--allow-dirty] [--allow-untagged]|review-bundle verify <bundle-dir> --target <path> --sign-key-env NAME [--json]|attest <path> [--sign-key-env NAME]|attest verify <attestation.json> --target <path> --sign-key-env NAME|release-evidence <path> --sign-key-env NAME [--allow-dirty] [--allow-untagged] [--require-runtime-approval --runtime-approval-digest <digest>]|release-evidence verify <evidence.json> --target <path> --sign-key-env NAME|release-evidence asset <path> --tag <tag> --output <evidence.json> --sign-key-env NAME [--upload]|mcp <path>|inspector <path>|diff --before <path> --after <path>|recommend <path>|trust <path>|perf <path> [--max-total-ms <ms>] [--max-stage-ms stage=ms]|export --bundle <path>|snapshot|clients|--json|--update-check]\n codex-plugin-doctor init [path] [--template skill-only|mcp-stdio|mcp-http|full-runtime]\n codex-plugin-doctor init-ci [path]\n codex-plugin-doctor self-test\n codex-plugin-doctor list --installed\n codex-plugin-doctor explain <finding-id>\n codex-plugin-doctor --version\n\nFirst run:\n codex-plugin-doctor doctor\n codex-plugin-doctor self-test\n codex-plugin-doctor init my-plugin\n codex-plugin-doctor check . --runtime --explain");
|
|
76
77
|
}
|
|
77
78
|
const performanceStageNames = new Set([
|
|
78
79
|
"validation",
|
|
@@ -412,6 +413,99 @@ export async function runCli(args, io = defaultIo, options = {}) {
|
|
|
412
413
|
io.writeStdout(renderedReport);
|
|
413
414
|
return report.exitCode;
|
|
414
415
|
}
|
|
416
|
+
if (maybePath === "review-bundle") {
|
|
417
|
+
if (remainingArgs[0] === "verify") {
|
|
418
|
+
const bundleDirectory = remainingArgs[1] && !remainingArgs[1].startsWith("--")
|
|
419
|
+
? remainingArgs[1]
|
|
420
|
+
: null;
|
|
421
|
+
const verifyFlags = bundleDirectory ? remainingArgs.slice(2) : remainingArgs.slice(1);
|
|
422
|
+
const jsonOutput = verifyFlags.includes("--json");
|
|
423
|
+
const targetIndex = verifyFlags.indexOf("--target");
|
|
424
|
+
const targetPath = targetIndex === -1 ? null : verifyFlags[targetIndex + 1];
|
|
425
|
+
const signKeyEnvIndex = verifyFlags.indexOf("--sign-key-env");
|
|
426
|
+
const signKeyEnv = signKeyEnvIndex === -1 ? null : verifyFlags[signKeyEnvIndex + 1];
|
|
427
|
+
if (!bundleDirectory) {
|
|
428
|
+
io.writeStderr("Missing review bundle directory.");
|
|
429
|
+
return 2;
|
|
430
|
+
}
|
|
431
|
+
if (targetIndex === -1) {
|
|
432
|
+
io.writeStderr("Missing target path. Use --target <path>.");
|
|
433
|
+
return 2;
|
|
434
|
+
}
|
|
435
|
+
if (!targetPath || targetPath.startsWith("--")) {
|
|
436
|
+
io.writeStderr("Missing path after --target.");
|
|
437
|
+
return 2;
|
|
438
|
+
}
|
|
439
|
+
if (signKeyEnvIndex === -1) {
|
|
440
|
+
io.writeStderr("Missing signing key. Use --sign-key-env <name>.");
|
|
441
|
+
return 2;
|
|
442
|
+
}
|
|
443
|
+
if (!signKeyEnv || signKeyEnv.startsWith("--")) {
|
|
444
|
+
io.writeStderr("Missing environment variable name after --sign-key-env.");
|
|
445
|
+
return 2;
|
|
446
|
+
}
|
|
447
|
+
const signingKey = terminalContext.env[signKeyEnv];
|
|
448
|
+
if (!signingKey) {
|
|
449
|
+
io.writeStderr(`Signing key environment variable is not set: ${signKeyEnv}`);
|
|
450
|
+
return 2;
|
|
451
|
+
}
|
|
452
|
+
const report = await verifyDoctorReviewBundle(bundleDirectory, {
|
|
453
|
+
signingKey,
|
|
454
|
+
targetPath
|
|
455
|
+
});
|
|
456
|
+
io.writeStdout(jsonOutput
|
|
457
|
+
? renderDoctorReviewBundleVerificationJson(report)
|
|
458
|
+
: renderDoctorReviewBundleVerification(report));
|
|
459
|
+
return report.exitCode;
|
|
460
|
+
}
|
|
461
|
+
const targetPath = remainingArgs[0] && !remainingArgs[0].startsWith("--")
|
|
462
|
+
? remainingArgs[0]
|
|
463
|
+
: null;
|
|
464
|
+
const reviewBundleFlags = targetPath ? remainingArgs.slice(1) : remainingArgs;
|
|
465
|
+
const jsonOutput = reviewBundleFlags.includes("--json");
|
|
466
|
+
const outputIndex = reviewBundleFlags.indexOf("--output");
|
|
467
|
+
const outputDirectory = outputIndex === -1 ? null : reviewBundleFlags[outputIndex + 1];
|
|
468
|
+
const signKeyEnvIndex = reviewBundleFlags.indexOf("--sign-key-env");
|
|
469
|
+
const signKeyEnv = signKeyEnvIndex === -1 ? null : reviewBundleFlags[signKeyEnvIndex + 1];
|
|
470
|
+
const allowDirty = reviewBundleFlags.includes("--allow-dirty");
|
|
471
|
+
const allowUntagged = reviewBundleFlags.includes("--allow-untagged");
|
|
472
|
+
if (!targetPath) {
|
|
473
|
+
io.writeStderr("Missing target path for review bundle.");
|
|
474
|
+
return 2;
|
|
475
|
+
}
|
|
476
|
+
if (outputIndex === -1) {
|
|
477
|
+
io.writeStderr("Missing output directory. Use --output <dir>.");
|
|
478
|
+
return 2;
|
|
479
|
+
}
|
|
480
|
+
if (!outputDirectory || outputDirectory.startsWith("--")) {
|
|
481
|
+
io.writeStderr("Missing directory after --output.");
|
|
482
|
+
return 2;
|
|
483
|
+
}
|
|
484
|
+
if (signKeyEnvIndex === -1) {
|
|
485
|
+
io.writeStderr("Missing signing key. Use --sign-key-env <name>.");
|
|
486
|
+
return 2;
|
|
487
|
+
}
|
|
488
|
+
if (!signKeyEnv || signKeyEnv.startsWith("--")) {
|
|
489
|
+
io.writeStderr("Missing environment variable name after --sign-key-env.");
|
|
490
|
+
return 2;
|
|
491
|
+
}
|
|
492
|
+
const signingKey = terminalContext.env[signKeyEnv];
|
|
493
|
+
if (!signingKey) {
|
|
494
|
+
io.writeStderr(`Signing key environment variable is not set: ${signKeyEnv}`);
|
|
495
|
+
return 2;
|
|
496
|
+
}
|
|
497
|
+
const bundle = await buildDoctorReviewBundle(targetPath, {
|
|
498
|
+
outputDirectory,
|
|
499
|
+
signingKey,
|
|
500
|
+
signingKeyEnv: signKeyEnv,
|
|
501
|
+
allowDirty,
|
|
502
|
+
allowUntagged
|
|
503
|
+
});
|
|
504
|
+
io.writeStdout(jsonOutput
|
|
505
|
+
? renderDoctorReviewBundleJson(bundle)
|
|
506
|
+
: renderDoctorReviewBundle(bundle));
|
|
507
|
+
return bundle.manifest.exitCode;
|
|
508
|
+
}
|
|
415
509
|
if (maybePath === "release-evidence") {
|
|
416
510
|
if (remainingArgs[0] === "asset") {
|
|
417
511
|
const targetPath = remainingArgs[1] && !remainingArgs[1].startsWith("--")
|
package/package.json
CHANGED