Skip to content

Variator (with example)

ComfyHome™ edited this page May 11, 2026 · 4 revisions

What is the VARIATOR?

It is used to make the workflow smooth by enabling user to store the most used commit message definitions on per-project basis.

👉    C l i c k    H E R E    f o r    m o r e    i n f o    👈

If you haven't yet, it is recommended to have a look at the "Simple Example" below first, to get the context...

USAGE:

Command Description
cg var List all defined variators
cg var set <variator_id> "<value>" Define a new variator
cg var clear <id> Remove specific variator(s)
cg var clear all Remove all variators
cg var clear 1,2 To remove variators with id 1 and 2
cg var + help or -h or --help To show help

SETTING VARIATORS

e.g. cg var set tpaw "(Top Picks - Auto Wrap)" or cg var set nftpaw "@.feat(Top Picks - Auto Wrap)"

CALLING VARIATORS:

Use (!id) or (!variator_id) in commit messages:

  • @.feat(!tpaw): <message>@.feat(Top Picks - Auto Wrap): <message>
  • (!nftpaw): <message>@.feat(Top Picks - Auto Wrap): <message>

NOTE:

  • Numeric IDs are auto-assigned (1, 2, 3...)
  • (!id) is different from ! at start (breaking change)USAGE:

A simple example

Note

  • This example is based on the real-life use.
  • Exactly as I used the variator for the first time in this repo, with step-by-step description

Flow:

  1. I just finished the variator implementation, and its testing, including edge-case scenarios.

  2. Let's variate then!

  3. CLI: cg var

    No variators defined.
    
    Use 'cg var set <id> "<value>"' to create one.
    

    Okay! Let's add one...

  4. I have several files that are ready to be commited, and I know that...

    1. I want to use @.feat changelog modifier to group and announce the brand new ComfyGit feature
    2. I want the header to be "V A R I A T O R !", so I'll be adding (Specific) to modifier in the following format: (V A R I A T O R !)
    3. Hence, I know that my commit message definition part will be @.feat(V A R I A T O R !): , and it will repeat itself quite a lot.
    4. Let's do it...
  5. CLI: cg var v "@.feat(V A R I A T O R !)"

    • I used just a simple v as the variator caller (variator_id), so the variator should listen to (!v) command
    • Variator is always invoked with (!<id|variator_id>)
  6. CLI: cg var, just to confirm...

    === Variators ===
    
    ID    Variator_ID     Value
    ------------------------------------------------------------
    1     v               @.feat(V A R I A T O R !)
    

    Here we go!

  7. Now I can start all my variator-related commit messages with (!v): , let's see how it goes...

  8. Adding...

    1. 08ec87a - (!v): streamline default initialization in ProjectEditDialog and ProjectWizard to enhance test reliability
    2. 29a7e72 - (!v): refactor changelog document building to utilize variator storage and streamline default initialization in tests
    3. 642cd56 - (!v): add chl_vrtr module for enhanced functionality integration
    4. 06daeaf - (!v): ensure default values are set for RepoConfig in test cases
    5. 9a3dbe2 - (!v): add variator_storage field to ProjectConfig with default initialization
    6. 72bb355 - (!v): add variator command support for listing, setting, and clearing variators
    7. 3a57e15 - (!v): enhance changelog generation by integrating variator storage into parsing and document building functions
    8. a6b5392 - (!v): integrate variator storage into release notes generation for enhanced commit message management
    9. 66f785d - (!v): introduce variator storage for managing commit message configurations with auto-assigned IDs

    Let's check the changelog to see if it got parsed correctly...

  9. CLI: cg --> ENTER --> [SELECT PROJECT] --> C (already looks good in preview) --> [SAVE] --> 👣 to repo root --> check changelog_temp.md --> 👇


✨ New Feature: V A R I A T O R !

  • introduce variator storage for managing commit message configurations with auto-assigned IDs 66f785d

  • integrate variator storage into release notes generation for enhanced commit message management a6b5392

  • enhance changelog generation by integrating variator storage into parsing and document building functions 3a57e15

  • add variator command support for listing, setting, and clearing variators 72bb355

  • add variator_storage field to ProjectConfig with default initialization 9a3dbe2

  • ensure default values are set for RepoConfig in test cases 06daeaf

  • add chl_vrtr module for enhanced functionality integration 642cd56

  • refactor changelog document building to utilize variator storage and streamline default initialization in tests 29a7e72

  • streamline default initialization in ProjectEditDialog and ProjectWizard to enhance test reliability 08ec87a


  1. Nice! 🎉