One command to heal your repo with configurable open-source best practices
oss-doctor scans your repository for missing OSS essentials and can automatically fix them — optionally opening a pull request with all the improvements.
Key Features:
- ✅ Non-invasive: Never overwrites existing files without
--force - ⚙️ Configurable: Control everything via
.ossdoctor.json - 🔒 Opt-in: Funding and governance packs require explicit enablement
- 📋 Deterministic: See exactly what will change before applying
- 🤖 Changesets ready: Built-in prepare-release & release workflows
# Scan your repo
npx oss-doctor check
# See planned changes
npx oss-doctor plan
# Apply fixes (shows plan first)
npx oss-doctor fix
# Apply fixes without confirmation
npx oss-doctor fix --yes
# Apply fixes and open a PR
npx oss-doctor fix --yes --prnpm install --save-dev oss-doctorScan repository and report missing files.
# Check all enabled packs
npx oss-doctor check
# Check specific packs
npx oss-doctor check --pack community,hygiene
# Output as JSON
npx oss-doctor check --jsonShow what changes would be made (dry-run).
# Show plan
npx oss-doctor plan
# Show plan for specific packs
npx oss-doctor plan --pack workflowsApply fixes to your repository.
# Show plan and require confirmation
npx oss-doctor fix
# Apply without confirmation
npx oss-doctor fix --yes
# Apply and open PR
npx oss-doctor fix --yes --pr
# Overwrite existing files
npx oss-doctor fix --yes --forceOptions:
--yes, -y: Skip confirmation--pr: Create a pull request with changes--force: Overwrite existing files (use with caution)--pack <packs>: Only process specific packs (comma-separated)
Sync labels from your labels file to GitHub.
# Sync labels (create/update only)
npx oss-doctor labels sync
# Sync and remove unknown labels
npx oss-doctor labels sync --pruneRequires project.labels configured in .ossdoctor.json.
Create a .ossdoctor.json configuration file.
npx oss-doctor initCreate .ossdoctor.json in your project root:
{
"packs": ["community", "hygiene", "project", "workflows", "docs"],
"contacts": {
"securityEmail": "security@example.org"
},
"workflows": {
"ciNode": 20,
"changesetsFlow": false
},
"funding": {
"enabled": false,
"providers": {
"github": ["your-username"],
"open_collective": "your-collective",
"ko_fi": "your-kofi"
}
},
"governance": {
"enabled": false,
"codeowners": {
"mode": "explicit",
"owners": ["@org/team-repo"],
"paths": {
"src/**": ["@org/team-repo"]
}
}
},
"project": {
"labels": "./lib/packs/templates/labels.json",
"stale": {
"enabled": false,
"days": 60,
"exceptLabels": ["pinned", "security"]
},
"triage": {
"enabled": true
}
},
"docs": {
"readmeHealth": true
}
}Default packs (enabled by default):
community: CODE_OF_CONDUCT.md, CONTRIBUTING.md, SECURITY.mdhygiene: .editorconfig, .gitattributesproject: Issue templates, PR templateworkflows: CI workflowdocs: README health checks (read-only)
Opt-in packs (must be explicitly enabled):
funding: FUNDING.yml (requiresfunding.enabled: trueAND at least one provider)governance: CODEOWNERS (requiresgovernance.enabled: true)
When workflows.changesetsFlow: true, adds:
.github/workflows/prepare-release.yml- Opens "Prepare x.y.z" PR.github/workflows/release.yml- Publishes to npm on merge
These workflows replicate the Changesets release flow with provenance.
Critical: FUNDING.yml is only generated when:
funding.enabledistrue, AND- At least one provider is configured with a value
{
"funding": {
"enabled": true,
"providers": {
"github": ["username"],
"open_collective": "collective-slug",
"ko_fi": "kofi-name"
}
}
}CODEOWNERS is only generated when:
governance.enabledistrue, ANDcodeowners.modeis"explicit", AND- At least one owner is specified
{
"governance": {
"enabled": true,
"codeowners": {
"mode": "explicit",
"owners": ["@org/team"],
"paths": {
"src/**": ["@org/frontend"],
"docs/**": ["@org/docs-team"]
}
}
}
}CODE_OF_CONDUCT.md- Links to Contributor CovenantCONTRIBUTING.md- Contribution guidelinesSECURITY.md- Security policy (usescontacts.securityEmail)
.editorconfig- Editor configuration.gitattributes- Git line endings
.github/ISSUE_TEMPLATE/bug_report.yml.github/ISSUE_TEMPLATE/feature_request.yml.github/ISSUE_TEMPLATE/question.yml.github/PULL_REQUEST_TEMPLATE.md
Additional workflows (when enabled):
.github/workflows/label-sync.yml(ifproject.labelsconfigured).github/workflows/stale.yml(ifproject.stale.enabled: true).github/workflows/triage.yml(ifproject.triage.enabled: true)
.github/workflows/ci.yml- Basic CI (usesworkflows.ciNode).github/workflows/prepare-release.yml(ifworkflows.changesetsFlow: true).github/workflows/release.yml(ifworkflows.changesetsFlow: true)
- Checks README for required sections: description, install, usage, contributing, license
- Reports missing sections but does not auto-generate
- Suggests running
readme-shields-syncif installed
.github/FUNDING.yml- Only created whenfunding.enabled: trueAND providers configured
CODEOWNERS- Only created whengovernance.enabled: trueAND owners specified
This project uses Changesets for versioning and publishing. You can add the same flow to your project:
-
Enable in config:
{ "workflows": { "changesetsFlow": true } } -
Run oss-doctor:
npx oss-doctor fix --yes
-
Set up secrets:
- Add
NPM_TOKENto your repository secrets (required for publishing) GITHUB_TOKENis provided automatically
- Add
-
Workflow:
- Create changesets:
npm run changeset - Merge to
main prepare-release.ymlopens "Prepare x.y.z" PR automatically- Merge the Prepare PR
release.ymlpublishes to npm with provenance and creates GitHub Release
- Create changesets:
- ✅ Never overwrites existing files unless you use
--force - ✅ Shows plan before applying changes (unless
--yes) - ✅ All generated files include header comment explaining source
- ✅ Funding and governance are strictly opt-in
- ✅ No personal data collected or guessed
- ✅ Deterministic output (same config → same result)
npx oss-doctor init
npx oss-doctor check
npx oss-doctor fix --yesEdit .ossdoctor.json:
{
"packs": ["community", "hygiene", "project", "workflows", "funding"],
"funding": {
"enabled": true,
"providers": {
"github": ["your-username"]
}
}
}npx oss-doctor fix --yes{
"workflows": {
"changesetsFlow": true
}
}npx oss-doctor fix --yes
# Add NPM_TOKEN to repo secrets
# Merge changes and start using Changesets!{
"project": {
"labels": "./labels.json"
}
}Create labels.json:
[
{
"name": "bug",
"color": "d73a4a",
"description": "Something isn't working"
}
]npx oss-doctor labels sync- Node.js >= 18
- Git repository
- GitHub CLI (
gh) for PR creation (optional)
MIT
Contributions welcome! Please read CONTRIBUTING.md.
Report vulnerabilities by opening a private security advisory on GitHub.