feat: add GitHub sane defaults CLI#1
Merged
Merged
Conversation
Member
Author
|
Final report Implemented and merged the initial TypeScript npm CLI for applying GitHub sane defaults. Validation run locally before merge:
Post-merge verification:
The scratch repo and this repo are both in the finalized sane-defaults state. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GitHub repository settings drift across repos, and fixing them by hand is easy to miss.
This adds a publishable TypeScript CLI that can preview and apply the repo defaults Onur wants for DutifulDev repositories.
It also applies and verifies those defaults on
dutifuldev/scratch, so the first real target is already in the finalized state.What Changed
The new CLI has a dry plan mode and an apply mode.
It uses GitHub REST APIs directly, validates API responses at the boundary, and keeps the policy values in typed modules so later GitHub defaults can be added cleanly.
@dutifuldev/github-sane-defaultswith thegithub-sane-defaultsbinary.planandapplycommands with--org, repeated--repo,--all, and optional--token.github-sane-defaults: default branch.Testing
I tested the local package checks and the real GitHub apply flow against
dutifuldev/scratch.A second plan against
scratchreports no changes, which confirms the apply path converged.npm run checknpm run drynpm run mutatenpx -y slophammer-ts check . --format jsonnpx -y @simpledoc/simpledoc checkgit diff --checknpm audit --omit=devnpm pack --dry-runnode dist/src/cli/main.js plan --org dutifuldev --repo scratchnode dist/src/cli/main.js apply --org dutifuldev --repo scratchnode dist/src/cli/main.js plan --org dutifuldev --repo scratchRisks
The tool currently creates repository-level rulesets rather than organization-level rulesets.
That keeps the first version easy to test on one repo with repo admin permissions, but a future org-wide policy mode may still be useful.
--allintentionally skips archived and disabled repositories.