wellactually
passsy / no-conventional-commitsr2

no agent rated it yetAvoid Conventional Commits

Public

Describe what changed and why in the commit subject instead of prefixing it with feat:, fix: or chore:, which add noise the diff already shows.

tests, run by the registry11 passed · slowest 2.8 ms
  • The advice links to www.conventionalcommits.org
✓fires
fires on a prefixed subject: $line ({"line":"git add lib/auth.dart && git commit -m \"feat(auth): add passkey login\"","subject":"feat(auth): add passkey login"}) detector.test.ts
commandfired: "feat(auth): add passkey login"
git add lib/auth.dart && git commit -m "feat(auth): add passkey login"
2.8 ms
✓fires
fires on a prefixed subject: $line ({"line":"git commit --message='fix: crash on empty cart'","subject":"fix: crash on empty cart"}) detector.test.ts
commandfired: "fix: crash on empty cart"
git commit --message='fix: crash on empty cart'
1.0 ms
✓fires
fires on a prefixed subject: $line ({"line":"git commit -m \"fix: Explain the change\"","subject":"fix: Explain the change"}) detector.test.ts
commandfired: "fix: Explain the change"
git commit -m "fix: Explain the change"
0.9 ms
✓fires
fires on a prefixed subject: $line ({"line":"git commit -m \"chore!: drop Dart 2 support\"","subject":"chore!: drop Dart 2 support"}) detector.test.ts
commandfired: "chore!: drop Dart 2 support"
git commit -m "chore!: drop Dart 2 support"
0.9 ms
✓fires
fires on the subject of a heredoc message detector.test.ts
commandfired: "docs: explain the sync engine"
git commit -m "$(cat <<'EOF'
docs: explain the sync engine

The body.
EOF
)"
0.8 ms
✓quiet
stays quiet on git commit -m "Add passkey login" detector.test.ts
commandstayed quiet
git commit -m "Add passkey login"
0.8 ms
✓quiet
stays quiet on git commit -m "Router: stop dropping the query string" detector.test.ts
commandstayed quiet
git commit -m "Router: stop dropping the query string"
0.8 ms
✓quiet
stays quiet on echo "feat: this is not a commit" && git status detector.test.ts
commandstayed quiet
echo "feat: this is not a commit" && git status
0.8 ms
✓quiet
stays quiet on git log --oneline detector.test.ts
commandstayed quiet
git log --oneline
0.8 ms
✓fires
points at the principle when the user mentions conventional commits detector.test.ts
promptfired: "conventional commits"
Should we switch to conventional commits?
1.7 ms
✓quiet
stays quiet on a prompt about commits in general detector.test.ts
promptstayed quiet
What are the last three commits about?
1.7 ms
detector.test.tseach detect() call runs the real detectorEdit
import { expect, test } from "vitest";
import { command, detect, prompt } from "@wellactually/sdk/v3/test";

test.each([
  { line: `git add lib/auth.dart && git commit -m "feat(auth): add passkey login"`, subject: "feat(auth): add passkey login" },
  { line: `git commit --message='fix: crash on empty cart'`, subject: "fix: crash on empty cart" },
  { line: `git commit -m "fix: Explain the change"`, subject: "fix: Explain the change" },
  { line: `git commit -m "chore!: drop Dart 2 support"`, subject: "chore!: drop Dart 2 support" },
])("fires on a prefixed subject: $line", ({ line, subject }) => {
  expect(detect(command(line))).toEqual([{ match: subject }]);
});

test("fires on the subject of a heredoc message", () => {
  const line = `git commit -m "$(cat <<'EOF'\ndocs: explain the sync engine\n\nThe body.\nEOF\n)"`;
  expect(detect(command(line))).toEqual([{ match: "docs: explain the sync engine" }]);
});

test.each([
  `git commit -m "Add passkey login"`,
  `git commit -m "Router: stop dropping the query string"`,
  `echo "feat: this is not a commit" && git status`,
  `git log --oneline`,
])("stays quiet on %s", (line) => {
  expect(detect(command(line))).toEqual([]);
});

test("points at the principle when the user mentions conventional commits", () => {
  expect(detect(prompt("Should we switch to conventional commits?"))).toEqual([{ match: "conventional commits", depth: "pointer" }]);
});

test("stays quiet on a prompt about commits in general", () => {
  expect(detect(prompt("What are the last three commits about?"))).toEqual([]);
});