{
  "category": "commit",
  "functions": [
    {
      "name": "analyzeCommits",
      "examples": [
        {
          "title": "Suggest a semver bump from a list of commits",
          "description": "Walks through commits and suggests `major`, `minor`, or `patch` based on Conventional Commits.",
          "code": "analyzeCommits([\n  { subject: 'feat: add login' },\n  { subject: 'fix: handle null' },\n])\n// => { suggestedBump: 'minor', hasFeatures: true, hasFixes: true, ... }"
        },
        {
          "title": "Promote to major on breaking change",
          "description": "A `!` marker or a `BREAKING CHANGE:` footer always promotes the suggestion to `major`.",
          "code": "analyzeCommits([{ subject: 'feat!: drop v1 API' }]).suggestedBump\n// => 'major'"
        }
      ]
    },
    {
      "name": "buildConventionalCommitRegex",
      "examples": [
        {
          "title": "Match the default Conventional Commits format",
          "description": "Returns a regex matching `type(scope)?!?: description` on the subject line.",
          "code": "const regex = buildConventionalCommitRegex();\nregex.test('feat(api): add endpoint') // => true\nregex.test('not a commit') // => false"
        },
        {
          "title": "Restrict accepted types and require a scope",
          "description": "Constrain accepted types and force the scope segment to be present.",
          "code": "const regex = buildConventionalCommitRegex({\n  types: ['feat', 'fix'],\n  requireScope: true,\n});\nregex.test('feat(api): x') // => true\nregex.test('feat: missing scope') // => false\nregex.test('chore(api): wrong type') // => false"
        }
      ]
    },
    {
      "name": "isConventionalCommit",
      "examples": [
        {
          "title": "Validate a commit subject",
          "description": "Returns `true` when the first line follows the Conventional Commits format.",
          "code": "isConventionalCommit('feat(api): add endpoint') // => true\nisConventionalCommit('hello world') // => false"
        },
        {
          "title": "Restrict accepted types",
          "description": "Reject any commit whose type is not in the supplied allowlist.",
          "code": "isConventionalCommit('chore: x', { types: ['feat', 'fix'] }) // => false\nisConventionalCommit('feat: x', { types: ['feat', 'fix'] }) // => true"
        }
      ]
    },
    {
      "name": "parseConventionalCommit",
      "examples": [
        {
          "title": "Parse a Conventional Commits subject",
          "description": "Extracts type, scope, breaking flag, and description.",
          "code": "parseConventionalCommit('feat(api)!: add v2')\n// => { type: 'feat', scope: 'api', breaking: true, description: 'add v2', body: '', footer: '' }"
        },
        {
          "title": "Detect breaking changes from the footer",
          "description": "A `BREAKING CHANGE:` footer flags the commit as breaking even without the `!` marker.",
          "code": "parseConventionalCommit('feat: add option\\n\\nBREAKING CHANGE: drops old config').breaking\n// => true"
        },
        {
          "title": "Returns null on a non-conventional message",
          "description": "Non-matching subjects return `null` rather than throwing.",
          "code": "parseConventionalCommit('hello world') // => null"
        }
      ]
    }
  ]
}