Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .githooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
set -euo pipefail

repo_root="$(git rev-parse --show-toplevel)"
"$repo_root/scripts/check-conventional-commits.sh" --message-file "$1"
cd "$repo_root"

git stripspace --strip-comments < "$1" | npm run --silent lint:commit --
7 changes: 0 additions & 7 deletions .github/conventional-commit-baseline.txt

This file was deleted.

17 changes: 12 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install commit message lint dependencies
run: npm ci

- name: Reject tracked ignored files
run: scripts/check-release-pr-integrity.sh HEAD HEAD

Expand All @@ -37,7 +45,7 @@ jobs:
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: scripts/check-conventional-commits.sh "$BASE_SHA..$HEAD_SHA"
run: npm run lint:commit -- --from "$BASE_SHA" --to "$HEAD_SHA"

- name: Validate pushed commit messages
if: github.event_name == 'push'
Expand All @@ -48,14 +56,13 @@ jobs:
set -euo pipefail
if [ "$BEFORE_SHA" = "0000000000000000000000000000000000000000" ]; then
if git rev-parse "${HEAD_SHA}^" >/dev/null 2>&1; then
RANGE="${HEAD_SHA}^..${HEAD_SHA}"
npm run lint:commit -- --from "${HEAD_SHA}^" --to "$HEAD_SHA"
else
RANGE="$HEAD_SHA"
git show --no-patch --format=%B "$HEAD_SHA" | npm run lint:commit --
fi
else
RANGE="${BEFORE_SHA}..${HEAD_SHA}"
npm run lint:commit -- --from "$BEFORE_SHA" --to "$HEAD_SHA"
fi
scripts/check-conventional-commits.sh "$RANGE"

release-version-drift:
name: Release Version Drift
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
/node_modules/
.DS_Store
.codegraph
.tracedecay
Expand Down
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ cargo test-all

## Git

- Every non-merge commit subject must pass `scripts/check-conventional-commits.sh` before push.
- Every non-merge commit subject must pass
`npm run lint:commit -- --from origin/master --to HEAD` before push.
- Use `<type>: <subject>` or `<type>(<scope>): <subject>` with one of:
`build`, `chore`, `ci`, `docs`, `feat`, `fix`, `perf`, `refactor`, `revert`, `style`, `test`.
- Keep the subject at 72 characters or fewer. Example: `fix(doctor): avoid false orphan warnings`.
Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@ scripts/install-git-hooks.sh
CI validates commit subjects with:

```bash
scripts/check-conventional-commits.sh origin/master..HEAD
npm ci
npm run lint:commit -- --from origin/master --to HEAD
```

Run the same command locally before pushing to lint every non-merge commit in a
branch range. Merge commits are skipped to match CI behavior.
branch range. Commitlint exempts merge commits to match CI behavior.

## Pull Requests

Expand Down
32 changes: 32 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const allowedTypes = [
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
];

module.exports = {
defaultIgnores: false,
ignores: [(message) => /^Merge[ \t]/.test(message)],
Comment thread
ScriptedAlchemy marked this conversation as resolved.
parserPreset: {
name: "tracedecay",
parserOpts: {
headerCorrespondence: ["type", "scope", "breaking", "subject"],
headerPattern:
/^(\w*)(?:\(([A-Za-z0-9._/-]+)\))?(!)?: ([^\s].*)$/,
},
},
rules: {
"header-max-length": [2, "always", 72],
"subject-empty": [2, "never"],
"type-empty": [2, "never"],
"type-enum": [2, "always", allowedTypes],
},
};
Loading
Loading