{
  "category": "commit",
  "version": "3.1.2",
  "functions": [
    {
      "name": "analyzeCommits",
      "kind": "function",
      "description": "Analyses a list of commits to suggest a semantic version bump.\n\nEach commit is parsed via `parseConventionalCommit`. The body is also\nscanned for `BREAKING CHANGE:` / `BREAKING-CHANGE:` markers. The bump rule\nis:\n\n- any breaking change → `'major'`\n- otherwise any `feat` → `'minor'`\n- otherwise any `fix` → `'patch'`\n- otherwise (non-empty list of non-conventional commits) → `'patch'`\n- empty list → `'patch'` with reason \"No commits to analyse\"",
      "since": "2.0.0",
      "signatures": [
        {
          "signature": "analyzeCommits(commits: readonly AnalyzableCommit[]): CommitAnalysis",
          "description": "Analyses a list of commits to suggest a semantic version bump.\n\nEach commit is parsed via `parseConventionalCommit`. The body is also\nscanned for `BREAKING CHANGE:` / `BREAKING-CHANGE:` markers. The bump rule\nis:\n\n- any breaking change → `'major'`\n- otherwise any `feat` → `'minor'`\n- otherwise any `fix` → `'patch'`\n- otherwise (non-empty list of non-conventional commits) → `'patch'`\n- empty list → `'patch'` with reason \"No commits to analyse\"",
          "params": [
            {
              "name": "commits",
              "type": "readonly AnalyzableCommit[]",
              "description": "Iterable of commits to analyse. Only `subject` is required."
            }
          ],
          "returns": {
            "type": "CommitAnalysis",
            "description": "Aggregated analysis with the suggested bump and reason."
          }
        }
      ],
      "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'"
        }
      ],
      "sourceFile": "analyzeCommits.ts",
      "relatedTypes": [
        {
          "name": "AnalyzableCommit",
          "description": "Minimal commit shape consumed by `analyzeCommits`. Only the subject line is\nmandatory; the body is scanned for a `BREAKING CHANGE` footer.",
          "typeDefinition": "interface AnalyzableCommit {\n  body?: string;\n  subject: string;\n}"
        },
        {
          "name": "CommitAnalysis",
          "description": "Aggregated result of `analyzeCommits`.",
          "typeDefinition": "interface CommitAnalysis {\n  hasBreakingChanges: boolean;\n  hasFeatures: boolean;\n  hasFixes: boolean;\n  reason: string;\n  suggestedBump: CommitVersionBump;\n}"
        },
        {
          "name": "CommitVersionBump",
          "description": "Bumping suggestion produced by `analyzeCommits`.",
          "typeDefinition": "type CommitVersionBump = 'major' | 'minor' | 'patch'"
        }
      ]
    },
    {
      "name": "buildConventionalCommitRegex",
      "kind": "function",
      "description": "Builds a regular expression matching the **subject line** of a Conventional\nCommits message.\n\nThe returned regex exposes four capture groups:\n\n1. type\n2. scope (or `undefined` when absent)\n3. breaking marker (`'!'` or `undefined`)\n4. description",
      "since": "2.0.0",
      "signatures": [
        {
          "signature": "buildConventionalCommitRegex(options: ConventionalCommitOptions): RegExp",
          "description": "Builds a regular expression matching the **subject line** of a Conventional\nCommits message.\n\nThe returned regex exposes four capture groups:\n\n1. type\n2. scope (or `undefined` when absent)\n3. breaking marker (`'!'` or `undefined`)\n4. description",
          "params": [
            {
              "name": "options",
              "type": "ConventionalCommitOptions",
              "description": "Constrain accepted types/scopes and toggle scope requirement.",
              "defaultValue": "{}"
            }
          ],
          "returns": {
            "type": "RegExp",
            "description": "Regex anchored on `^...$` matching the subject line only."
          }
        }
      ],
      "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"
        }
      ],
      "sourceFile": "buildConventionalCommitRegex.ts",
      "relatedTypes": [
        {
          "name": "ConventionalCommitOptions",
          "description": "Options shared by `buildConventionalCommitRegex`, `parseConventionalCommit`,\nand `isConventionalCommit` to constrain the accepted commit format.",
          "typeDefinition": "interface ConventionalCommitOptions {\n  requireScope?: boolean;\n  scopes?: readonly string[];\n  types?: readonly string[];\n}"
        }
      ]
    },
    {
      "name": "isConventionalCommit",
      "kind": "function",
      "description": "Checks whether a commit message's subject line follows the Conventional\nCommits format constrained by the given options.\n\nOnly the first line is inspected — body and footer are ignored.",
      "since": "2.0.0",
      "signatures": [
        {
          "signature": "isConventionalCommit(message: string, options?: ConventionalCommitOptions): boolean",
          "description": "Checks whether a commit message's subject line follows the Conventional\nCommits format constrained by the given options.\n\nOnly the first line is inspected — body and footer are ignored.",
          "params": [
            {
              "name": "message",
              "type": "string",
              "description": "Full commit message or just its subject line."
            },
            {
              "name": "options",
              "type": "ConventionalCommitOptions",
              "description": "Optional constraints (allowed types/scopes, scope requirement).",
              "optional": true
            }
          ],
          "returns": {
            "type": "boolean",
            "description": "`true` when the subject line matches; `false` otherwise."
          }
        }
      ],
      "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"
        }
      ],
      "sourceFile": "isConventionalCommit.ts",
      "relatedTypes": [
        {
          "name": "ConventionalCommitOptions",
          "description": "Options shared by `buildConventionalCommitRegex`, `parseConventionalCommit`,\nand `isConventionalCommit` to constrain the accepted commit format.",
          "typeDefinition": "interface ConventionalCommitOptions {\n  requireScope?: boolean;\n  scopes?: readonly string[];\n  types?: readonly string[];\n}"
        }
      ]
    },
    {
      "name": "parseConventionalCommit",
      "kind": "function",
      "description": "Parses a Conventional Commits message into a structured object.\n\nThe first line is matched against the regex produced by\n`buildConventionalCommitRegex(options)`. The remaining content is split into\na `body` and an optional trailing `footer` block (lines matching\n`Token: value` / `Token #value`, including `BREAKING CHANGE: ...`).",
      "since": "2.0.0",
      "signatures": [
        {
          "signature": "parseConventionalCommit(message: string, options?: ConventionalCommitOptions): ParsedConventionalCommit | null",
          "description": "Parses a Conventional Commits message into a structured object.\n\nThe first line is matched against the regex produced by\n`buildConventionalCommitRegex(options)`. The remaining content is split into\na `body` and an optional trailing `footer` block (lines matching\n`Token: value` / `Token #value`, including `BREAKING CHANGE: ...`).",
          "params": [
            {
              "name": "message",
              "type": "string",
              "description": "Full commit message (subject + optional body/footer)."
            },
            {
              "name": "options",
              "type": "ConventionalCommitOptions",
              "description": "Optional constraints forwarded to the regex builder.",
              "optional": true
            }
          ],
          "returns": {
            "type": "ParsedConventionalCommit | null",
            "description": "Parsed commit object, or `null` when the subject is not conventional."
          }
        }
      ],
      "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"
        }
      ],
      "sourceFile": "parseConventionalCommit.ts",
      "relatedTypes": [
        {
          "name": "ConventionalCommitOptions",
          "description": "Options shared by `buildConventionalCommitRegex`, `parseConventionalCommit`,\nand `isConventionalCommit` to constrain the accepted commit format.",
          "typeDefinition": "interface ConventionalCommitOptions {\n  requireScope?: boolean;\n  scopes?: readonly string[];\n  types?: readonly string[];\n}"
        },
        {
          "name": "ParsedConventionalCommit",
          "description": "Parsed representation of a Conventional Commit message.",
          "typeDefinition": "interface ParsedConventionalCommit {\n  body: string;\n  breaking: boolean;\n  description: string;\n  footer: string;\n  scope: string | null;\n  type: string;\n}"
        }
      ]
    }
  ]
}