commit-text-organizer


Namecommit-text-organizer JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://github.com/DK96-OS/cto
SummaryA Text Processor Targeted at Organizing Commit Messages.
upload_time2024-12-03 18:01:24
maintainerNone
docs_urlNone
authorDK96-OS
requires_python>=3.10
licenseGPLv3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Commit Text Organizer
A Text Processor targeted at organizing Commit Messages.

Do you like to organize your commit messages? __CTO does!__ CTO operates on commit messages structured in a simple readable format.

The input messages are cleaned up, condensed, and sorted alphabetically before being returned.

### File Oriented Commit Information (FOCI)
FOCI is inspired by the following statement:

___A Commit may change many files, but it has just one purpose.___

<details>
<summary>FOCI Concepts</summary>

- __Headers__
  - Signify the start of a commit message group
  - Make it easier to categorize and locate related changes
- __Commit Lines__
  - Lines grouped together under each header
  - Detail changes to files or groups of files
  - Enhancing traceability and readability
- __Subjects__
  - The start of a Commit Line
  - Indicating the file or group of files
  - Allowing for quick identification of affected areas
- __Content Details__
  - The end of a Commit Line
  - Comma separated list of text describing specific changes
  - Providing clarity on the nature of the modification.
</details>

CTO and FOCI ensure that commit messages are well-organized and convey the intended changes in a clear, concise manner. This is key to making revision history easy to revisit.

## Commit Message Structure
At a high level, messages are organized into groups.

<details>
<summary>Each group has a unique header name.</summary>

### Headers
Structure your commits using your own set of headers, such as:
- Database Migration 32
- Database Integration
- Test Database Migrations

When writing commits, ensure that you add a colon (:) immediately after the header name.

Then, the lines immediately below the header are included in that group. These are called Commit Lines.
</details>
<details>
<summary>A Commit Line starts with a subject, corresponding to a file, or group of files.</summary>

### Subjects (Files or Groups of Files)
A Subject is the start of a Commit Line in a header Group. It will usually describe a change in a single file, but you can group files into the subject.

#### Subject Matching
Lines in the same Header Group can be merged, but only if the subjects match.

When Content details are merged, they are separated from the Subject, sorted alphabetically, and joined with a comma-space separator.

#### Subject Content Separators
The subject is separated from content details by one of these separators: (+) or (-).

If a separator appears more than once in a Commit Line, it is ignored.
</details>

<details>
<summary>A subject may include a verb, such as "Update", which can be replaced with a prefix shortcut.</summary>

### Commit Line Prefix Shortcuts
To reduce typing the same word for so many file changes (such as "Update", or "Create"), CTO includes a Line Prefix recognition and replacement feature.

     cto/text/commit_line_prefixes.py

It recognizes prefixes (that you can change) and replaces them with the most commonly used words.

#### Commit Line Prefix Shortcuts
| Shortcut | Prefix |
|----------|--------|
| c | Create |
| d | Delete |
| f | Fix |
| m | Move |
| r | Remove |
| t | Test |
| u | Update |
| cr | Create |
| del | Delete |
| mv | Move |
| up | Update |
</details>

#### Important Commit Line Characters
- A header ends with a colon ":"
- A blank line will start a new group
- Commit Lines start with the star (*)
- Subject is separated from content by (+) or (-)
- Content may contain multiple changes that are comma-separated

### Sorting
By default, your squashed PR message will have groups organized alphabetically by their header names.
- Subjects within each group are sorted alphabetically
- Sorting is done after applying Commit Line Prefix Shortcuts.

## Example
__Input:__
```
Header 1:
*u File.c - new method hello_world()
*u File.c - new method foo()

Header 2:
*c NewFile.c

Header 2:
*r OldFile.c
```
__Output:__
```
Header 1:
* Update File.c - new method hello_world(), new method foo()

Header 2:
* Create NewFile.c
* Remove OldFile.c
```

## How To Use It
0. __Install__: Use `python -m pip install commit-text-organizer`, or manage it manually.
1. __Main Script__: Run the script with a file path argument containing the commit messages.
2. __Commit Message Structure__: Commit messages are organized into groups defined by headers (e.g., "Database Migration 32"). Each group contains commit lines starting with a star (*) and details changes to subjects (files or groups of files).
3. __Subject Matching and Content Details__: Commit lines within the same header group can be merged if their subjects match. The tool sorts and joins content details alphabetically, separated by a comma-space.
4. __Line Prefix Shortcuts__: To simplify repetitive prefixes like "Update" or "Create", CTO includes a feature to recognize and replace line prefix shortcuts with their full forms (e.g., "c" for "Create").
5. __Sorting and Output__: The tool sorts groups and lines within groups alphabetically.
6. __Output__: The output is printed to the standard output. Pipe it to a file, or it will be printed on screen.

### Requirements
Python 3.10 or higher is required to run __Commit-Text-Organizer__.
This is because the Union Type Operator is used (not available in 3.9 or earlier).

### Program Architecture
All python modules are contained in the `commit_text_organizer` package. In the following diagram, modules are grouped into symbolic packages for better understanding.

![cto](https://github.com/DK96-OS/cto/assets/69859316/67e1735b-6529-4f4e-9360-a7dfe0264431)

## Project Vision
Enhancements should aim to make CTO more versatile, user-friendly, and integrated with workflows. Examples:
- Run git subprocess and read commit messages from a branch instead of a file
- Allow users to add their own prefix shortcuts in a config file

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DK96-OS/cto",
    "name": "commit-text-organizer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "DK96-OS",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/4b/69/aff768813ac2b0c2db10fcfe1bbb2c246faa9768de256a7c7d2bd9b3bfa2/commit_text_organizer-1.1.2.tar.gz",
    "platform": null,
    "description": "## Commit Text Organizer\nA Text Processor targeted at organizing Commit Messages.\n\nDo you like to organize your commit messages? __CTO does!__ CTO operates on commit messages structured in a simple readable format.\n\nThe input messages are cleaned up, condensed, and sorted alphabetically before being returned.\n\n### File Oriented Commit Information (FOCI)\nFOCI is inspired by the following statement:\n\n___A Commit may change many files, but it has just one purpose.___\n\n<details>\n<summary>FOCI Concepts</summary>\n\n- __Headers__\n  - Signify the start of a commit message group\n  - Make it easier to categorize and locate related changes\n- __Commit Lines__\n  - Lines grouped together under each header\n  - Detail changes to files or groups of files\n  - Enhancing traceability and readability\n- __Subjects__\n  - The start of a Commit Line\n  - Indicating the file or group of files\n  - Allowing for quick identification of affected areas\n- __Content Details__\n  - The end of a Commit Line\n  - Comma separated list of text describing specific changes\n  - Providing clarity on the nature of the modification.\n</details>\n\nCTO and FOCI ensure that commit messages are well-organized and convey the intended changes in a clear, concise manner. This is key to making revision history easy to revisit.\n\n## Commit Message Structure\nAt a high level, messages are organized into groups.\n\n<details>\n<summary>Each group has a unique header name.</summary>\n\n### Headers\nStructure your commits using your own set of headers, such as:\n- Database Migration 32\n- Database Integration\n- Test Database Migrations\n\nWhen writing commits, ensure that you add a colon (:) immediately after the header name.\n\nThen, the lines immediately below the header are included in that group. These are called Commit Lines.\n</details>\n<details>\n<summary>A Commit Line starts with a subject, corresponding to a file, or group of files.</summary>\n\n### Subjects (Files or Groups of Files)\nA Subject is the start of a Commit Line in a header Group. It will usually describe a change in a single file, but you can group files into the subject.\n\n#### Subject Matching\nLines in the same Header Group can be merged, but only if the subjects match.\n\nWhen Content details are merged, they are separated from the Subject, sorted alphabetically, and joined with a comma-space separator.\n\n#### Subject Content Separators\nThe subject is separated from content details by one of these separators: (+) or (-).\n\nIf a separator appears more than once in a Commit Line, it is ignored.\n</details>\n\n<details>\n<summary>A subject may include a verb, such as \"Update\", which can be replaced with a prefix shortcut.</summary>\n\n### Commit Line Prefix Shortcuts\nTo reduce typing the same word for so many file changes (such as \"Update\", or \"Create\"), CTO includes a Line Prefix recognition and replacement feature.\n\n     cto/text/commit_line_prefixes.py\n\nIt recognizes prefixes (that you can change) and replaces them with the most commonly used words.\n\n#### Commit Line Prefix Shortcuts\n| Shortcut | Prefix |\n|----------|--------|\n| c | Create |\n| d | Delete |\n| f | Fix |\n| m | Move |\n| r | Remove |\n| t | Test |\n| u | Update |\n| cr | Create |\n| del | Delete |\n| mv | Move |\n| up | Update |\n</details>\n\n#### Important Commit Line Characters\n- A header ends with a colon \":\"\n- A blank line will start a new group\n- Commit Lines start with the star (*)\n- Subject is separated from content by (+) or (-)\n- Content may contain multiple changes that are comma-separated\n\n### Sorting\nBy default, your squashed PR message will have groups organized alphabetically by their header names.\n- Subjects within each group are sorted alphabetically\n- Sorting is done after applying Commit Line Prefix Shortcuts.\n\n## Example\n__Input:__\n```\nHeader 1:\n*u File.c - new method hello_world()\n*u File.c - new method foo()\n\nHeader 2:\n*c NewFile.c\n\nHeader 2:\n*r OldFile.c\n```\n__Output:__\n```\nHeader 1:\n* Update File.c - new method hello_world(), new method foo()\n\nHeader 2:\n* Create NewFile.c\n* Remove OldFile.c\n```\n\n## How To Use It\n0. __Install__: Use `python -m pip install commit-text-organizer`, or manage it manually.\n1. __Main Script__: Run the script with a file path argument containing the commit messages.\n2. __Commit Message Structure__: Commit messages are organized into groups defined by headers (e.g., \"Database Migration 32\"). Each group contains commit lines starting with a star (*) and details changes to subjects (files or groups of files).\n3. __Subject Matching and Content Details__: Commit lines within the same header group can be merged if their subjects match. The tool sorts and joins content details alphabetically, separated by a comma-space.\n4. __Line Prefix Shortcuts__: To simplify repetitive prefixes like \"Update\" or \"Create\", CTO includes a feature to recognize and replace line prefix shortcuts with their full forms (e.g., \"c\" for \"Create\").\n5. __Sorting and Output__: The tool sorts groups and lines within groups alphabetically.\n6. __Output__: The output is printed to the standard output. Pipe it to a file, or it will be printed on screen.\n\n### Requirements\nPython 3.10 or higher is required to run __Commit-Text-Organizer__.\nThis is because the Union Type Operator is used (not available in 3.9 or earlier).\n\n### Program Architecture\nAll python modules are contained in the `commit_text_organizer` package. In the following diagram, modules are grouped into symbolic packages for better understanding.\n\n![cto](https://github.com/DK96-OS/cto/assets/69859316/67e1735b-6529-4f4e-9360-a7dfe0264431)\n\n## Project Vision\nEnhancements should aim to make CTO more versatile, user-friendly, and integrated with workflows. Examples:\n- Run git subprocess and read commit messages from a branch instead of a file\n- Allow users to add their own prefix shortcuts in a config file\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "A Text Processor Targeted at Organizing Commit Messages.",
    "version": "1.1.2",
    "project_urls": {
        "Homepage": "https://github.com/DK96-OS/cto",
        "Issues": "https://github.com/DK96-OS/cto/issues",
        "Source Code": "https://github.com/DK96-OS/cto"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2fd68e8024934db84b35ae44b0dcdd1ccff1249c4358a440542cf3360e8db2c",
                "md5": "a9783655a3429c84a133cca1777725ae",
                "sha256": "23013fa1440f37bd17cb67bb0f1ab45e06a51f23df6161ff5206566dc649d5c9"
            },
            "downloads": -1,
            "filename": "commit_text_organizer-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a9783655a3429c84a133cca1777725ae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 28806,
            "upload_time": "2024-12-03T18:01:22",
            "upload_time_iso_8601": "2024-12-03T18:01:22.847078Z",
            "url": "https://files.pythonhosted.org/packages/f2/fd/68e8024934db84b35ae44b0dcdd1ccff1249c4358a440542cf3360e8db2c/commit_text_organizer-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4b69aff768813ac2b0c2db10fcfe1bbb2c246faa9768de256a7c7d2bd9b3bfa2",
                "md5": "13111c6e1cf58a51ba57f0749096ed2a",
                "sha256": "d9c675f378342b864022e28fd6789b076565c341e852b73b388f3ae32d6998b3"
            },
            "downloads": -1,
            "filename": "commit_text_organizer-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "13111c6e1cf58a51ba57f0749096ed2a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 29457,
            "upload_time": "2024-12-03T18:01:24",
            "upload_time_iso_8601": "2024-12-03T18:01:24.693584Z",
            "url": "https://files.pythonhosted.org/packages/4b/69/aff768813ac2b0c2db10fcfe1bbb2c246faa9768de256a7c7d2bd9b3bfa2/commit_text_organizer-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-03 18:01:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DK96-OS",
    "github_project": "cto",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "commit-text-organizer"
}
        
Elapsed time: 0.39434s