CommitChangelog

Fetch the GitHub commit history of a component or source file with :commit-changelog and show it as a timeline grouped by release. The file path is inferred from the name and can be tuned by directory, extension, casing and author, or cover several files.

CommitChangelog requests the GitHub commits of a file path and groups them by release: released commits go under their version, unreleased ones under Soon. When the site has a releases page, version tags link to it; otherwise they open the GitHub release.

The component does not depend on the componentDocs flag; it only needs the GitHub integration.

Prerequisites

  • Repository: github.owner, github.name, github.url and github.branch are inferred from the local git remote. Set them in app/app.config.ts when inference fails, see the app.config reference
  • Access token: set NUXT_GITHUB_TOKEN in the environment
.env
NUXT_GITHUB_TOKEN=<your-github-token>
The token must be able to read commits: a read-only fine-grained token works for public repositories, private repositories need Contents read access.
Without a token, or with github: false, the component shows No recent changes and the build does not fail.

Usage

Inferred file path

:commit-changelog

The path is built as {commitPath}/{prefix}/{name}.{suffix}:

PartSource
commitPathThe component's commitPath, then github.commitPath, defaults to src
prefixThe component's prefix, empty by default
nameThe component's name, defaults to the last segment of the current route
suffixThe component's suffix, then github.suffix, defaults to vue

name is converted according to casing: the default auto uses PascalCase for .vue files and camelCase for others; kebab, camel and pascal force that style. On /docs/components/accordion, for example, the line above resolves to src/Accordion.vue.

A specific file

:commit-changelog{name="useUser" suffix="ts" commitPath="src/composables"}

If all files use kebab-case, set it once in app/app.config.ts instead of on every component:

app/app.config.ts
export default defineAppConfig({
  github: {
    commitPath: 'src/composables',
    suffix: 'ts',
    casing: 'kebab'
  }
})

Multiple files

Each entry in files overrides the top-level fields (commitPath, prefix, suffix, name, casing); missing fields fall back to the top-level values. Commits from all files are merged, deduplicated and sorted newest first:

::commit-changelog
---
commitPath: layer/app/composables
suffix: ts
files:
  - name: useHeader
  - name: useNavigation
---
::

Filter by author

Pass a GitHub username or commit email to author:

:commit-changelog{author="octocat"}
The range is controlled by github.since, github.until and github.perPage: no date limit by default and at most 100 commits per file.

AI and raw markdown

In /raw/**.md and the Markdown returned by MCP, the component is replaced with links to the GitHub commit history using the same path rules; without name, the page title is used.

API

Props

Prop Default Type
commitPath'src' string

仓库中的文件路径

prefix string

文件路径的前缀

suffix'vue' string

文件扩展名

name string

要获取更新日志的组件或文件名

author string

按作者筛选提交

casing'auto' "auto" | "kebab" | "camel" | "pascal"

文件名的命名格式

  • 'auto': Vue 文件使用 PascalCase,其他使用 camelCase(默认)
  • 'kebab': 保持 kebab-case(如 use-user.ts)
  • 'camel': 转换为 camelCase(如 useUser.ts)
  • 'pascal': 转换为 PascalCase(如 UseUser.ts)
files CommitChangelogFile[]

关联多个文件:每一项与顶层 props 合并后各自解析出一个文件路径, 对应的提交记录会合并去重并按时间倒序展示

  • PageLastCommit: shows the latest commit of the current page in the header

Changelog

No recent changes
Copyright © 2024 - 2026