Skip to content

Commit 7082ede

Browse files
authored
Merge pull request #5 from DoneDeal0/refine-doc
fix: documentation
2 parents 905c00d + 198295a commit 7082ede

File tree

2 files changed

+34
-28
lines changed

2 files changed

+34
-28
lines changed

README.md

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,33 @@
1616

1717
<hr/>
1818

19-
## CODEOWNERS COMPARISON
19+
# CODEOWNERS COMPARISON
2020

21-
**Codefather** can serve as a drop-in replacement for GitHub’s CODEOWNERS—or play alongside it like a trusted consigliere.
21+
GitHub’s [CODEOWNERS](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners) auto-assigns reviewers. But it can’t enforce real rules.
2222

23-
GitHub’s [CODEOWNERS](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners) lets you define file owners in your codebase and automatically assign them as reviewers. No pull request can be merged until an appropriate codeowner has approved it.
23+
**Codefather** gives you absolute control over your repository and can either replace or supercharge CODEOWNERS, like a trusted *consigliere*.
2424

25-
**Codefather** offers more flexibility in assigning codeowners: support for various roles (teams, leads, developers), complex file-match rules, local execution, commit protection, and more. It can prevent unauthorized changes, warn developers, list prohibited files with error levels and contact points, block sensitive merges via GitHub Actions, and auto-assign reviewers when needed.
25+
It blocks unauthorized changes before they waste review time, empowers leads without flooding them with every PR, lets you choose between hard blocking or advisory enforcement, and provides actionable feedback by listing sensitive files touched and who to contact.
2626

27-
**Codefather** is designed to offer a delightful developer experience—a single config file for both CLI and GitHub Action usage, efficient commands to protect your codebase, automatic translation of CODEOWNERS into Codefather config, and over 100 personalized reactions to your commits.
27+
Run it offline and online with a single config, enjoy advanced file-matching patterns, automatically translate your CODEOWNERS file, and get over 100 personalized reactions to your commits.
2828

2929
**Whether you're enforcing strict governance or just want the Don watching over your commits, Codefather brings clarity, control, and charisma to your workflow.**
3030

3131
| FEATURE | CODEFATHER | GITHUB CODEOWNERS |
3232
|--|--|--|
3333
|Files and folders protection |||
34-
|Github Action |||
34+
|GitHub Action |||
3535
|Auto-assign reviewers |||
3636
|Teams support |||
3737
|CLI + pre-commit |||
38+
|Advanced file-matching |||
3839
|Roles hierarchy |||
39-
|Personalized feedbacks |||
40+
|Personalized feedback |||
4041
|Customizable config |||
4142
|Commit blockage |||
42-
|Godfather vibe |||
43+
|Godfather vibe (optional) |||
4344

44-
45-
## SCREENSHOTS
45+
# SCREENSHOTS
4646

4747
<div style="display: flex; flex-wrap: wrap; gap: 8px;">
4848

@@ -57,13 +57,13 @@ GitHub’s [CODEOWNERS](https://docs.github.com/en/repositories/managing-your-re
5757
</div>
5858

5959

60-
## INSTALLATION
60+
# INSTALLATION
6161

6262
```bash
6363
npm install @donedeal0/codefather --save-dev
6464
```
6565

66-
## USAGE
66+
# USAGE
6767

6868
**Codefather** has 3 commands:
6969

@@ -91,9 +91,9 @@ npx codefather-init
9191
npx codefather
9292
```
9393

94-
## CONFIG
94+
# CONFIG
9595

96-
At the root of your repository, add a `codefather.ts` or `codefather.json` file.
96+
At the root of your repository, add a `codefather.ts` or `codefather.json` file (you can also use `npx codefather-init`):
9797

9898
```ts
9999
import type { CodefatherConfig } from "@donedeal0/codefather";
@@ -128,7 +128,7 @@ export default {
128128
} satisfies CodefatherConfig;
129129
```
130130

131-
⚙️ Here's how it works.
131+
## ⚙️ Here's how it works.
132132

133133
> The `CodefatherConfig` allows you to control which users can modify parts of your codebase, and to refine the behavior of `codefather`.
134134
@@ -145,14 +145,14 @@ type CodefatherConfig {
145145
/** If true, all the pull request committers will be checked against the authorized users. Only used in a GitHub Action context. Defaults to true. */
146146
vouchForAllCommitters?: boolean;
147147
};
148-
/** Options to auto assign reviewers on Github */
148+
/** Options to auto assign reviewers on GitHub */
149149
codeReviews?: {
150150
/** If true, goodfellas responsible for modified files will be assigned on relevant pull requests, except the committers. Defaults to true. */
151151
autoAssignGoodfellas: boolean;
152152
/** If true, caporegimes will be assigned on every pull request, except the committers. Defaults to false. */
153153
autoAssignCaporegimes: boolean;
154154
};
155-
/** Group users into teams. Crew names and composition are flexible in CLI mode but should match your github teams if used in a Github Action */
155+
/** Group users into teams. Crew names and composition are flexible in CLI mode but should match your GitHub teams if used in a GitHub Action */
156156
crews?: Record<string, {name: string}[]>;
157157
}
158158
```
@@ -174,7 +174,9 @@ type CodefatherRule {
174174
}
175175
```
176176

177-
The names should match the GitHub usernames (e.g., `tomhagen`). In CLI mode, your name will be retrieved retrieved from your Git configuration. You can set it like this:
177+
## Name format
178+
179+
The names should match the GitHub usernames (e.g., `tomhagen`). In CLI mode, your name will be retrieved from your Git configuration. You can set it like this:
178180

179181
```bash
180182
git config --global user.username "DonCorleone"
@@ -183,12 +185,12 @@ The names should match the GitHub usernames (e.g., `tomhagen`). In CLI mode, you
183185
You can verify the current value like this:
184186

185187
```bash
186-
git config user.username # return DonCorleone
188+
git config user.username # returns DonCorleone
187189
```
188190

189-
In a Github Action, `codefather` will use Github's API, so you don't have to worry about the git config.
191+
In a GitHub Action, `codefather` will use GitHub's API, so you don't have to worry about the git config.
190192

191-
## How to Write Rules
193+
## How to write rules
192194

193195
- Match all files in a folder (recursively): `src/myfolder/`
194196
- Match a specific file: `src/myfolder/file.ts`
@@ -200,11 +202,15 @@ In a Github Action, `codefather` will use Github's API, so you don't have to wor
200202

201203
ℹ️ *More examples are available in the test files. Codefather's matching patterns follow classic file matcher rules, like GitHub CODEOWNERS.*
202204

205+
## Pre-commit
206+
207+
If you have [HUSKY](https://typicode.github.io/husky/) installed, you can add the `npm run codefather` command in the `.husky/pre-commit` file.
208+
203209
<hr/>
204210

205211
# GITHUB ACTION
206212

207-
Add this code in your `.github/workflows/codefather.yml` (the file name is up to you). The `GITHUB_TOKEN` will be automatically injected by Github.
213+
Add this code in your `.github/workflows/codefather.yml` file (the file name is up to you). The `GITHUB_TOKEN` will be automatically injected by GitHub.
208214

209215
```yml
210216
name: Codefather Validation
@@ -264,11 +270,11 @@ We believe open source libraries should be both useful and entertaining. The Don
264270

265271
This being said, if you don't like the gangster movie atmosphere and still want to use `codefather`, you can absolutely opt-out by providing your own custom messages and hiding the Don's face in the terminal.
266272

267-
## CREDITS
273+
# CREDITS
268274

269275
DoneDeal0 | [email protected]
270276

271-
## SUPPORT
277+
# SUPPORT
272278

273279
Show your support for **Codefather** by becoming a sponsor if you or your company uses it! Your name or company logo will be displayed in the `README` and on the website.
274280

@@ -280,6 +286,6 @@ Premium support is also available. https://github.com/sponsors/DoneDeal0
280286
</a>
281287
<br/>
282288

283-
## CONTRIBUTING
289+
# CONTRIBUTING
284290

285291
Issues and pull requests are welcome!

shared/models/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ export interface CodefatherConfig {
2626
options?: {
2727
/** If true, the codefather face will appear in the terminal. Defaults to true. */
2828
showAscii?: boolean;
29-
/** If true, all the pull request committers will be checked against the authorized users. Only used in a Github Action context. Defaults to true. */
29+
/** If true, all the pull request committers will be checked against the authorized users. Only used in a GitHub Action context. Defaults to true. */
3030
vouchForAllCommitters?: boolean;
3131
};
32-
/** Options to auto assign reviewers on Github */
32+
/** Options to auto assign reviewers on GitHub */
3333
codeReviews?: {
3434
/** If true, goodfellas responsible for modified files will be assigned on relevant pull requests, except the committers. Defaults to true. */
3535
autoAssignGoodfellas?: boolean;
3636
/** If true, caporegimes will be assigned on every pull request, except the committers. Defaults to false. */
3737
autoAssignCaporegimes?: boolean;
3838
};
39-
/** Group users in teams. Crew names and composition are flexible in CLI mode but should match your github teams if used in a Github Action */
39+
/** Group users in teams. Crew names and composition are flexible in CLI mode but should match your GitHub teams if used in a Github Action */
4040
crews?: Record<CrewName, GitUser[]>;
4141
}
4242

0 commit comments

Comments
 (0)