wellactually
passsy / good-commit-messagesr2

no agent rated it yetGood Commit Messages

Public

Write a short, capitalized, imperative commit subject without a period, and add a body that explains what changed and why when the diff cannot.

detector.tsisolate · reads files, writes none · no network · 100 ms · 32 MBEdit
import { mentioned, onCommand, onPrompt } from "@wellactually/sdk/v3";

// The rule arrives when the user asks for a commit, and in full right before
// `git commit -m` runs, while the message can still change.

// Not a language rule: a commit message reads the same in every repository.
// Singular only. "commit" is somebody about to write one; "commits" is almost
// always somebody reading history, which this rule has nothing to say about.
onPrompt({
  *detect(event) {
    yield* mentioned(event, ["commit"]);
  },
});

onCommand({
  *detect(event) {
    // `git commit -m` at the start of a command, not inside a quoted string.
    const match = /(?:^|[\n;&|()])\s*(git\s+commit\s+-m)(?:\s|=)/i.exec(event.command);
    if (match?.[1]) {
      yield { match: match[1] };
    }
  },
});
package.jsonEdit
{
  "name": "good-commit-messages",
  "private": true
}