Skip to content

feat(cli): export DockerDoctorConfig type and defineConfig helper#33

Merged
PunGrumpy merged 2 commits into
mainfrom
feat/config-type-export
Jul 25, 2026
Merged

feat(cli): export DockerDoctorConfig type and defineConfig helper#33
PunGrumpy merged 2 commits into
mainfrom
feat/config-type-export

Conversation

@PunGrumpy

Copy link
Copy Markdown
Owner

What

docker-doctor.config.ts can now be typed. @docker-doctor/cli exports:

  • DockerDoctorConfig (+ RuleCategory) — for the npx-safe pattern:
    import type { DockerDoctorConfig } from "@docker-doctor/cli";
    
    export default {
      rules: { "docker-doctor/no-root-user": "error" },
    } satisfies DockerDoctorConfig;
    Type-only imports are erased at load time, so this works even when the package isn't installed (npx-only projects).
  • defineConfig — identity helper for projects with the package as a devDependency. Docs call out that it's a runtime import and fails to load without the install, steering npx users to satisfies.

Bug fix folded in

DockerDoctorConfig.categories was Record<RuleCategory, RuleSeverity> — a full record requiring all five categories, which made the documented example (categories: { "Image Size": "off" }) type-invalid. Now Partial<Record<…>>, matching what the validator has always accepted at runtime. Widening only — existing configs stay valid.

Docs

Configuration reference gains a "Typed config" section covering both patterns and when to use which; README's config example now uses satisfies.

Testing

  • Typecheck + 82 core / 15 CLI tests pass; ultracite check clean.
  • E2E against the packed tarball installed in a fixture: a defineConfig config loads through the real CLI, rules override drops pin-image-version, partial categories: { "Image Size": "off" } drops prefer-slim, untouched rules still fire.
  • satisfies form typechecks against the shipped .d.ts (strict), and an invalid category errors with 'Bogus' does not exist in type 'Partial<Record<RuleCategory, RuleSeverity>>'.

Changeset: patch bump for @docker-doctor/cli.

🤖 Generated with Claude Code

Users can now type docker-doctor.config.ts either with
`satisfies DockerDoctorConfig` (type-only — safe for npx-only projects)
or the `defineConfig` identity helper (requires the package as a
devDependency). Also fix the config type's `categories` to
Partial<Record<…>> — the validator always accepted a subset, and the
documented examples were type-invalid under the old full-Record shape.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docker-doctor Skipped Skipped Jul 25, 2026 3:34pm

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@PunGrumpy
PunGrumpy merged commit e6e7e88 into main Jul 25, 2026
9 checks passed
@PunGrumpy
PunGrumpy deleted the feat/config-type-export branch July 25, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant