You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cli: add JSON output and distinct exit codes to doctor #19
Add machine-readable payload-components doctor --json output and distinct exit codes so humans and CI can tell healthy projects, recoverable install drift, and unsupported project shapes apart.
Current Baseline
payload-components doctor exists and prints concise human-readable diagnostics.
The command checks supported project shape, required post-install scripts, recorded install state, missing files, missing dependencies, missing Payload fragments, stale manifest metadata, and partial install state.
The CLI currently sets exit code 1 for every unhealthy result; unsupported project shape and recoverable drift are not separated.
There is no --json flag yet.
Scope
Add payload-components doctor --json without changing the default human output.
Return exit 0 for healthy projects, 1 for recoverable drift or partial install state, and 2 for unsupported project shape or fatal diagnostic failure.
Include project summary, checked components, findings, severity, suggested next action, and state-file path where relevant in JSON output.
Document the exit code and JSON contract in the install or registry docs.
Keep doctor read-only.
Out Of Scope
Automatic repair or rollback.
New supported project shapes.
Private registry, entitlement, or token checks.
Replacing the existing human output.
Acceptance Criteria
Healthy supported projects exit 0 and report no findings.
Recoverable drift exits 1 with component name, issue type, details, and retry guidance.
Unsupported project shape exits 2 with a concise reason.
--json output is stable enough for CI and documented.
Human output remains concise and actionable.
Doctor does not create or modify .payload-components/state.json.
changed the title [-]PK-22 Productize doctor exit codes and CI mode[/-][+]PK-22 Productize payload-kit doctor exit codes and JSON output[/+]on Jun 15, 2026
Status reset on 2026-06-15: keeping this open. PR #57 contains prior doctor work, but it is still open and the current dev baseline keeps payload-kit doctor as a placeholder.
changed the title [-]PK-22 Productize payload-kit doctor exit codes and JSON output[/-][+]cli: add JSON output and distinct exit codes to doctor[/+]on Jun 18, 2026
Shipped. Verified against `dev` (63a195f) — every acceptance criterion is met:
Exit codes — `DoctorExitCode = 0 | 1 | 2` in `tools/payload-components/commands/doctor.ts`. `resolveExitCode` returns `2` when any error carries a project scope (`project`/`scripts`/`state`), `1` for remaining component-level errors, `0` when clean — so "your repo is wrong" is distinguishable from "one component drifted".
`--json` — parsed in `tools/payload-components/cli.ts` (allow-listed for `doctor` alongside `list`/`diff`/`templates`, rejected if repeated) and rendered at the end of `doctorCommand`. Default human output is unchanged: `renderText` walks the same findings in emission order.
Structured report — `DoctorReport` carries `components`, `findings`, `exitCode`, and `healthy`; every finding has a `scope` so consumers group without parsing prose.
Read-only — doctor still only reads state; nothing writes `.payload-components/state.json`.
Documented — `content/docs/cli.mdx` covers `doctor --json` (line 301) and has a dedicated `## Exit codes` section (line 367).
Tested — `tests/int/payload-components-doctor-command.int.spec.ts` and `tests/int/payload-components-doctor-orchestration.int.spec.ts`.
Activity
Ducksss commentedon Jun 12, 2026
PR #57 implements
payload-kit doctorfor the Fumadocs baseline.Implemented behavior:
--jsonmachine-readable output.0for supported targets with no recoverable drift.1for partial installs, missing installed files, missing dependencies, stale state, direct shadcn copies, or missing Payload registration.2for unsupported project shape or fatal project detection/doctor failure.Validation: new
tests/int/payload-kit-doctor.int.spec.tspluspnpm test:releasepassed.[-]PK-22 Productize doctor exit codes and CI mode[/-][+]PK-22 Productize payload-kit doctor exit codes and JSON output[/+]Ducksss commentedon Jun 15, 2026
Status reset on 2026-06-15: keeping this open. PR #57 contains prior doctor work, but it is still open and the current dev baseline keeps payload-kit doctor as a placeholder.
[-]PK-22 Productize payload-kit doctor exit codes and JSON output[/-][+]cli: add JSON output and distinct exit codes to doctor[/+]Ducksss commentedon Aug 9, 2026
Shipped. Verified against `dev` (63a195f) — every acceptance criterion is met:
Closing as completed.