Skip to content

cz-git (Commitizen Git)

เครื่องมือช่วยเขียน commit message แบบ standardized

Installation

bash
npm install -g czg
bash
yarn global add czg
bash
pnpm add -g czg

Benefits

FeatureDescriptionExample
มาตรฐาน Commit Messageช่วยให้ทีมเขียน commit message ที่สม่ำเสมอตาม Conventional Commits specificationfeat: add login feature
Interactive Promptมีระบบถามคำถามแบบขั้นตอนเพื่อช่วยกรอกข้อมูล commit message ที่ครบถ้วนprompt-demo
Type Validationตรวจสอบประเภทของ commit (feat, fix, docs, etc.) ให้ถูกต้องตามมาตรฐานfix:, feat:, docs:
Scope Suggestionsแนะนำ scope จากไฟล์ที่แก้ไขอัตโนมัติfeat(login): add button
Breaking Changes Detectionช่วยระบุและจัดรูปแบบ breaking changes ให้ถูกต้องfeat!: remove deprecated API
Issue Referenceเชื่อมโยงกับ issue tracker อัตโนมัติCloses #123
Customizableสามารถปรับแต่งประเภท commit, scope และข้อความ prompt ได้types: ['feat', 'fix', 'custom']
Git Hook Supportใช้งานร่วมกับ git hooks เช่น commit-msg ได้ง่ายhusky + commit-msg hook
Multi-languageรองรับหลายภาษา รวมทั้งภาษาไทยข้อความ prompt ภาษาไทย
Integrationทำงานร่วมกับ tools อื่นๆ เช่น commitlint, husky ได้สะดวกcommitlint.config.js

Configuration

ตัวอย่างการตั้งค่าในไฟล์ cz.config.ts:

cz.config.ts
ts
import type { UserConfig } from 'cz-git'

export default {
  path: 'cz-git',
  useEmoji: true,
  scopes: ['component', 'page', 'api'],
  types: [
    { value: 'feat', name: 'feat: A new feature' },
    { value: 'fix', name: 'fix: A bug fix' },
    { value: 'docs', name: 'docs: Documentation only changes' }
  ],
  messages: {
    type: "Select the type of change that you're committing:",
    subject: "Write a short, imperative tense description of the change:"
  }
} satisfies UserConfig

Usage

พิมพ์ czg ai เพื่อใช้งาน

cz-git demo

Last updated: