python-kacl 0.6.5__py3-none-any.whl → 0.6.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
kacl/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # Version of the python-kacl package
2
- __version__ = "0.6.5"
2
+ __version__ = "0.6.6"
3
3
 
4
4
  from kacl.document import KACLDocument
5
5
  from kacl.serializer import KACLMarkdownSerializer
@@ -14,14 +14,14 @@ def load(file):
14
14
  with open(file, "r") as f:
15
15
  document = f.read()
16
16
  try:
17
- doc = KACLDocument.parse(document)
17
+ doc = KACLDocument.parse(document, file)
18
18
  finally:
19
19
  f.close()
20
20
  return doc
21
21
 
22
22
 
23
- def parse(text):
24
- return KACLDocument.parse(text)
23
+ def parse(text, file=None):
24
+ return KACLDocument.parse(text, file)
25
25
 
26
26
 
27
27
  def dump(document):
kacl/changes.py CHANGED
@@ -11,6 +11,8 @@ class KACLChanges(KACLElement):
11
11
  line_number=element.line_number(),
12
12
  )
13
13
  self.__items = []
14
+ # initializes
15
+ self.items()
14
16
 
15
17
  def items(self):
16
18
  if not len(self.__items) and len(self.body().strip()):
@@ -45,4 +45,6 @@ kacl:
45
45
  ## 🧭 Reference
46
46
 
47
47
  Code: [Source Code Management System]({link})
48
-
48
+ stash:
49
+ directory: .kacl_stash
50
+ always: False
kacl/config.py CHANGED
@@ -72,6 +72,9 @@ class KACLConfig:
72
72
  if not self.issue_tracker_jira_password:
73
73
  self.issue_tracker_jira_password = os.getenv("JIRA_PASSWORD", None)
74
74
 
75
+ self.stash_dir = self.__config.get("stash", {}).get("dir", ".kacl_stash")
76
+ self.stash_always = self.__config.get("stash", {}).get("always", False)
77
+
75
78
  @staticmethod
76
79
  def merge(a, b, path=None):
77
80
  """merge two dictionaries
kacl/document.py CHANGED
@@ -4,6 +4,7 @@ import os
4
4
  import git
5
5
  import semver
6
6
 
7
+ import kacl
7
8
  from kacl.config import KACLConfig
8
9
  from kacl.element import KACLElement
9
10
  from kacl.exception import KACLException
@@ -28,6 +29,7 @@ class KACLDocument:
28
29
  versions=None,
29
30
  link_references=None,
30
31
  meta_data=None,
32
+ file_path=None,
31
33
  config=KACLConfig(),
32
34
  ):
33
35
  self.__data = data
@@ -38,6 +40,80 @@ class KACLDocument:
38
40
  self.__link_references = dict()
39
41
  self.__meta_data = meta_data
40
42
  self.config = config
43
+ self.stash = []
44
+ self.file_path = file_path
45
+
46
+ @property
47
+ def stash_directory(self):
48
+ return self._ensure_stash_directory()
49
+
50
+ def load_stash(self):
51
+ self._refresh_stash()
52
+ # get all unreleased changes from stash
53
+ for stashed_changelog in self.stash:
54
+ unreleased_stash_version = stashed_changelog.get("Unreleased")
55
+ for title, change in unreleased_stash_version.sections().items():
56
+ for change_item in change.items():
57
+ self.add(section=title, data=change_item)
58
+
59
+ def _refresh_stash(self):
60
+ if not self.file_path:
61
+ return
62
+
63
+ self.stash = []
64
+ if self.file_path is None:
65
+ local_stash_dir = os.path.join(
66
+ os.path.abspath(os.getcwd()), self.config.stash_dir
67
+ )
68
+ else:
69
+ # the stash needs always to be relative to the current file_path
70
+ local_stash_dir = os.path.join(
71
+ os.path.abspath(os.path.dirname(self.file_path)), self.config.stash_dir
72
+ )
73
+
74
+ if not os.path.isdir(local_stash_dir):
75
+ return
76
+
77
+ # read all md files in the stash directory
78
+ for f in os.listdir(local_stash_dir):
79
+ if f.endswith(".md"):
80
+ md_file = os.path.join(local_stash_dir, f)
81
+ with open(md_file, "r") as fh:
82
+ data = fh.read()
83
+ try:
84
+ doc = KACLDocument.parse(data, None)
85
+ self.stash.append(doc)
86
+ except Exception:
87
+ continue
88
+
89
+ def _ensure_stash_directory(self):
90
+ # the stash needs always to be relative to the current file_path
91
+ local_stash_dir = os.path.join(
92
+ os.path.abspath(os.path.dirname(self.file_path)), self.config.stash_dir
93
+ )
94
+
95
+ if not os.path.isdir(local_stash_dir):
96
+ os.makedirs(local_stash_dir, exist_ok=True)
97
+
98
+ return local_stash_dir
99
+
100
+ def _get_stash_file(self):
101
+ # the stash file should be named after the current git branch
102
+ local_stash_dir = self._ensure_stash_directory()
103
+ try:
104
+ repo = git.Repo(
105
+ os.path.abspath(os.path.dirname(self.file_path)),
106
+ search_parent_directories=True,
107
+ )
108
+ branch_name = repo.active_branch.name
109
+ # sanitize branch name for filename
110
+ branch_name = branch_name.replace("/", "__").replace("\\", "_")
111
+ stash_file_name = f"{branch_name}.md"
112
+ except Exception:
113
+ # fallback to with date
114
+ stash_file_name = f"{datetime.datetime.now().strftime('%Y%m%d')}.md"
115
+
116
+ return os.path.join(local_stash_dir, stash_file_name)
41
117
 
42
118
  def validate(self):
43
119
  """Validates the current changelog and returns KACLValidation object containing all information
@@ -46,6 +122,14 @@ class KACLDocument:
46
122
  [KACLValidation] -- object holding all error information
47
123
  """
48
124
  validation = KACLValidation()
125
+
126
+ # first load the stash
127
+ self._refresh_stash()
128
+ for stashed_changelog in self.stash:
129
+ val = stashed_changelog.validate()
130
+ for e in val.errors():
131
+ validation.add(e)
132
+
49
133
  # 1. assert only one header and starts on first line
50
134
  if len(self.__headers) == 0:
51
135
  validation.add_error(
@@ -213,18 +297,38 @@ class KACLDocument:
213
297
 
214
298
  return False
215
299
 
216
- def add(self, section, data):
300
+ def add(self, section, data, stash=False):
217
301
  """adds a new change to a given section in the 'unreleased' version
218
302
 
219
303
  Arguments:
220
304
  section {[str]} -- section to add data to
221
305
  data {[str]} -- change information
306
+ stash {[bool]} -- if true the change will be stashed instead of added to the changelog (default: {False})
222
307
  """
223
- unreleased_version = self.get("Unreleased")
224
- if unreleased_version is None:
225
- unreleased_version = KACLVersion(version="Unreleased")
226
- self.__versions.insert(0, unreleased_version)
227
- unreleased_version.add(section.capitalize(), data)
308
+
309
+ if stash:
310
+ # check if the stash directory already contains the required changelog file, if not initialize it
311
+ stash_file = self._get_stash_file()
312
+
313
+ if not os.path.exists(stash_file):
314
+ kacl_changelog = kacl.new()
315
+ kacl_changelog_content = kacl.dump(kacl_changelog)
316
+ with open(stash_file, "w") as f:
317
+ f.write(kacl_changelog_content)
318
+ f.close()
319
+
320
+ kacl_changelog = kacl.load(stash_file)
321
+ kacl_changelog.add(section.capitalize(), data)
322
+ kacl_changelog_content = kacl.dump(kacl_changelog)
323
+ with open(stash_file, "w") as f:
324
+ f.write(kacl_changelog_content)
325
+ f.close()
326
+ else:
327
+ unreleased_version = self.get("Unreleased")
328
+ if unreleased_version is None:
329
+ unreleased_version = KACLVersion(version="Unreleased")
330
+ self.__versions.insert(0, unreleased_version)
331
+ unreleased_version.add(section.capitalize(), data)
228
332
 
229
333
  def release(
230
334
  self,
@@ -584,7 +688,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
584
688
  )
585
689
 
586
690
  @staticmethod
587
- def parse(data):
691
+ def parse(data, file=None):
588
692
  """Parses a given text object and returns the KACLDocument
589
693
 
590
694
  Arguments:
@@ -624,6 +728,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
624
728
  versions=versions,
625
729
  link_references=link_references,
626
730
  meta_data=meta_data,
731
+ file_path=file,
627
732
  )
628
733
 
629
734
  def __get_link_provider(
kacl/kacl_cli.py CHANGED
@@ -69,6 +69,7 @@ def load_changelog(ctx):
69
69
  # read the changelog
70
70
  kacl_changelog = kacl.load(kacl_config.changelog_file_path)
71
71
  kacl_changelog.config = kacl_config
72
+ kacl_changelog.load_stash()
72
73
 
73
74
  # share the objects
74
75
  return kacl_changelog
@@ -128,14 +129,28 @@ def cli(ctx, version=None, config=None, file=None):
128
129
  is_flag=True,
129
130
  help="This option will add the changes directly into changelog file.",
130
131
  )
131
- def add(ctx, section, message, modify):
132
+ @click.option(
133
+ "-s",
134
+ "--stash",
135
+ is_flag=True,
136
+ help="This option will stash changes instead of applying them.",
137
+ )
138
+ def add(ctx, section, message, modify, stash):
132
139
  """Adds a given message to a specified unreleased section. Use '--modify' to directly modify the changelog file."""
133
140
  kacl_changelog = load_changelog(ctx)
134
141
 
142
+ if not modify:
143
+ stash = False
144
+ else:
145
+ # check if we need to stash
146
+ stash = stash or kacl_changelog.config.stash_always
147
+
135
148
  # add changes to changelog
136
- kacl_changelog.add(section=section, data=message)
149
+ kacl_changelog.add(section=section, data=message, stash=stash)
150
+
137
151
  kacl_changelog_content = kacl.dump(kacl_changelog)
138
- if modify:
152
+ # if stashing is enabled, do not modify the changelog file
153
+ if modify and not stash:
139
154
  with open(kacl_changelog.config.changelog_file_path, "w") as f:
140
155
  f.write(kacl_changelog_content)
141
156
  f.close()
@@ -472,6 +487,13 @@ def release(
472
487
  if no_commit:
473
488
  return
474
489
 
490
+ # delete all file in the stash directory
491
+ stash_files = []
492
+ for f in os.listdir(kacl_changelog.stash_directory):
493
+ stash_file = os.path.join(kacl_changelog.stash_directory, f)
494
+ os.remove(stash_file)
495
+ stash_files.append(stash_file)
496
+
475
497
  if commit or tag or kacl_config.git_create_commit or kacl_config.git_create_tag:
476
498
  vcs_context = {
477
499
  "latest_version": latest_version,
@@ -516,6 +538,11 @@ def release(
516
538
  repo.git.add(kacl_config.changelog_file_path)
517
539
  for f in kacl_config.git_commit_additional_files:
518
540
  repo.git.add(f)
541
+ for f in stash_files:
542
+ try:
543
+ repo.git.add(f)
544
+ except git.GitCommandError:
545
+ pass
519
546
  repo.git.commit("-m", commit_message.format(**vcs_context))
520
547
 
521
548
  if tag or kacl_config.git_create_tag:
@@ -618,6 +645,52 @@ def new(output_file):
618
645
  click.echo(kacl_changelog_content)
619
646
 
620
647
 
648
+ @cli.command()
649
+ @click.option(
650
+ "-f",
651
+ "--force",
652
+ required=False,
653
+ is_flag=True,
654
+ help="Will overwrite existing files.",
655
+ )
656
+ def init(force):
657
+ """Initializes a project with all necessary kacl setting."""
658
+ kacl_changelog = kacl.new()
659
+ kacl_changelog_content = kacl.dump(kacl_changelog)
660
+
661
+ if os.path.exists("CHANGELOG.md") and not force:
662
+ click.echo(
663
+ click.style("Error: ", fg="red")
664
+ + "CHANGELOG.md already exists. Use '--force' to overwrite."
665
+ )
666
+ sys.exit(1)
667
+
668
+ if os.path.exists(".kacl.yml") and not force:
669
+ click.echo(
670
+ click.style("Error: ", fg="red")
671
+ + ".kacl.yml already exists. Use '--force' to overwrite."
672
+ )
673
+ sys.exit(1)
674
+
675
+ with open("CHANGELOG.md", "w") as f:
676
+ f.write(kacl_changelog_content)
677
+ f.close()
678
+
679
+ default_config_file = os.path.join(
680
+ os.path.dirname(os.path.abspath(__file__)), "config", "kacl-default.yml"
681
+ )
682
+
683
+ # copy the default config file
684
+ if os.path.exists(default_config_file):
685
+ with open(default_config_file, "r") as df:
686
+ default_config_content = df.read()
687
+ df.close()
688
+
689
+ with open(".kacl.yml", "w") as cf:
690
+ cf.write(default_config_content)
691
+ cf.close()
692
+
693
+
621
694
  @cli.command("add-comments")
622
695
  @click.pass_context
623
696
  @click.option(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-kacl
3
- Version: 0.6.5
3
+ Version: 0.6.6
4
4
  Summary: Python module and CLI tool for validating and modifying Changelogs in "keep-a-changelog" format"
5
5
  Home-page: https://gitlab.com/schmieder.matthias/python-kacl.git
6
6
  Author: Matthias Schmieder
@@ -47,12 +47,23 @@ A tool for verifying and modifying changelog in the [**K**eep-**A-C**hange-**L**
47
47
  - [Docker](#docker)
48
48
  - [pre-commit](#pre-commit)
49
49
  - [CLI](#cli)
50
+ - [Initialize a new project](#initialize-a-new-project)
50
51
  - [Create a Changelog](#create-a-changelog)
51
52
  - [Verify a Changelog](#verify-a-changelog)
52
53
  - [Print the current release version](#print-the-current-release-version)
53
54
  - [Print a single release changelog](#print-a-single-release-changelog)
54
55
  - [Add an entry to an unreleased section](#add-an-entry-to-an-unreleased-section)
55
56
  - [Prepare a Changelog for a Release](#prepare-a-changelog-for-a-release)
57
+ - [Changelog Fragments](#changelog-fragments)
58
+ - [Configuration](#configuration)
59
+ - [How It Works](#how-it-works)
60
+ - [Usage Patterns](#usage-patterns)
61
+ - [Automatic Fragment Creation](#automatic-fragment-creation)
62
+ - [Manual Fragment Control](#manual-fragment-control)
63
+ - [Fragment Structure](#fragment-structure)
64
+ - [Release Integration](#release-integration)
65
+ - [Workflow Integration](#workflow-integration)
66
+ - [Benefits](#benefits)
56
67
  - [Link Generation](#link-generation)
57
68
  - [Squashing releases](#squashing-releases)
58
69
  - [Example](#example)
@@ -63,6 +74,9 @@ A tool for verifying and modifying changelog in the [**K**eep-**A-C**hange-**L**
63
74
  - [Extensions](#extensions)
64
75
  - [Post-release/Hotfix](#post-releasehotfix)
65
76
  - [Config file](#config-file)
77
+ - [Default Config](#default-config)
78
+ - [Configuration Parameters](#configuration-parameters)
79
+ - [Template Variables](#template-variables)
66
80
  - [Development](#development)
67
81
 
68
82
  ## Installation
@@ -143,10 +157,97 @@ Commands:
143
157
  verify Verifies if the changelog is in "keep-a-changelog" format.
144
158
  ```
145
159
 
160
+ ## Initialize a new project
146
161
 
147
- ## Create a Changelog
162
+ ```bash
163
+ Usage: kacl-cli init [OPTIONS]
164
+
165
+ Initializes a project with all necessary kacl setting.
166
+
167
+ Options:
168
+ -f, --force Will overwrite existing files.
169
+ --help Show this message and exit.
170
+ ```
171
+
172
+ The `init` command provides a quick way to set up a new project with all necessary KACL files and configuration. This command creates two essential files:
173
+
174
+ 1. **CHANGELOG.md** - A new changelog file with the standard Keep a Changelog format
175
+ 2. **.kacl.yml** - A complete configuration file with all available options and sensible defaults
148
176
 
177
+ **Usage**
178
+
179
+ ```bash
180
+ kacl-cli init
181
+ ```
182
+
183
+ This will create both files in the current directory. If either file already exists, the command will fail unless you use the `--force` option:
184
+
185
+ ```bash
186
+ kacl-cli init --force
149
187
  ```
188
+
189
+ **Created Files**
190
+
191
+ The `init` command creates a standard CHANGELOG.md file and copies the complete default configuration. The `.kacl.yml` file includes all available configuration options:
192
+
193
+ ```yaml
194
+ kacl:
195
+ file: CHANGELOG.md
196
+ allowed_header_titles:
197
+ - Changelog
198
+ - Change Log
199
+ allowed_version_sections:
200
+ - Added
201
+ - Changed
202
+ - Deprecated
203
+ - Removed
204
+ - Fixed
205
+ - Security
206
+ default_content:
207
+ - All notable changes to this project will be documented in this file.
208
+ - The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
209
+ git:
210
+ commit: False
211
+ commit_message: "[skip ci] Releasing Changelog version {new_version}"
212
+ commit_additional_files: []
213
+ tag: False
214
+ tag_name: "v{new_version}"
215
+ tag_description: "Version v{new_version} released"
216
+ links:
217
+ auto_generate: False
218
+ compare_versions_template: '{host}/compare/{previous_version}...{version}'
219
+ unreleased_changes_template: '{host}/compare/{latest_version}...master'
220
+ initial_version_template: '{host}/tree/{version}'
221
+ extension:
222
+ post_release_version_prefix: null
223
+ issue_tracker:
224
+ jira:
225
+ host: null
226
+ username: null
227
+ password: null
228
+ issue_patterns: ["[A-Z]+-[0-9]+"]
229
+ comment_template: |
230
+ # 🚀 New version [v{new_version}]({link})
231
+
232
+ A new release has been created referencing this issue. Please check it out.
233
+
234
+ ## 🚧 Changes in this version
235
+
236
+ {changes}
237
+
238
+ ## 🧭 Reference
239
+
240
+ Code: [Source Code Management System]({link})
241
+ stash:
242
+ directory: .kacl_stash
243
+ always: False
244
+ ```
245
+
246
+ You can customize any of these settings according to your project's needs. The configuration provides sensible defaults that work for most projects while offering extensive customization options for advanced use cases.
247
+
248
+ ## Create a Changelog
249
+
250
+ ```bash
150
251
  Usage: kacl-cli new [OPTIONS]
151
252
 
152
253
  Creates a new changelog.
@@ -429,6 +530,102 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
429
530
  [Unreleased]: https://gitlab.com/schmieder.matthias/python-kacl/compare/v1.0.0...HEAD
430
531
  ```
431
532
 
533
+ ## Changelog Fragments
534
+
535
+ **kacl-cli** supports "changelog fragments" starting from version 6.6.0, which provides a powerful solution for managing unreleased changes in collaborative development environments. This feature helps avoid merge conflicts and simplifies changelog management when multiple developers are working on different branches simultaneously.
536
+
537
+ ### Configuration
538
+
539
+ Enable changelog fragments through the `.kacl.yml` configuration file:
540
+
541
+ ```yaml
542
+ kacl:
543
+ stash:
544
+ dir: .kacl_stash
545
+ always: True
546
+ ```
547
+
548
+ **Configuration Options:**
549
+
550
+ - `dir`: Directory where changelog fragments are stored (default: `.kacl_stash`)
551
+ - `always`: When `True`, all `kacl add` commands automatically create fragments instead of modifying the main changelog
552
+
553
+ ### How It Works
554
+
555
+ The stash functionality stores "Unreleased" changes in separate fragment files within the configured stash directory. These fragment files are **git-branch aware**:
556
+
557
+ - **Inside a git repository**: Fragment files are named `{git_branch}.md`
558
+ - **Outside a git repository**: Fragment files use a timestamp-based name
559
+
560
+ This branch-aware naming ensures maximum segregation of changes, preventing merge conflicts and rebase issues that commonly occur when multiple merge requests modify the same changelog file simultaneously.
561
+
562
+ ### Usage Patterns
563
+
564
+ #### Automatic Fragment Creation
565
+
566
+ With `always: True` in your configuration, all changelog additions are automatically directed to fragments:
567
+
568
+ ```bash
569
+ kacl add -m Changed "my new changelog entry"
570
+ ```
571
+
572
+ This command creates or updates a fragment file (e.g., `feature-branch.md`) instead of modifying the main `CHANGELOG.md`.
573
+
574
+ #### Manual Fragment Control
575
+
576
+ With `always: False`, you have explicit control over where changes are added:
577
+
578
+ ```bash
579
+ # Add directly to CHANGELOG.md
580
+ kacl add -m Changed "directly to the CHANGELOG.md"
581
+
582
+ # Add to a fragment file
583
+ kacl add -m --stash Changed "into the fragment"
584
+ ```
585
+
586
+ ### Fragment Structure
587
+
588
+ Each fragment file contains a standard changelog structure:
589
+
590
+ ```markdown
591
+ # Changelog
592
+ All notable changes to this project will be documented in this file.
593
+
594
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
595
+
596
+ ## Unreleased
597
+ ### Changed
598
+ - my new changelog entry
599
+ ```
600
+
601
+ ### Release Integration
602
+
603
+ When executing `kacl release`, the system automatically:
604
+
605
+ 1. **Collects all fragments** from the stash directory
606
+ 2. **Merges fragment content** into the main changelog under the new release version
607
+ 3. **Deletes processed fragments** from the stash directory
608
+ 4. **Stages deletions in git** so fragments are removed when the release is committed
609
+
610
+ This seamless integration ensures that all distributed changes across branches are consolidated into a single release entry.
611
+
612
+ ### Workflow Integration
613
+
614
+ Changelog fragments are fully integrated into all kacl workflows:
615
+
616
+ - **`kacl verify`**: Validates both the main changelog and all fragments
617
+ - **`kacl get`**: Considers fragment content when retrieving version information
618
+ - **Git operations**: Fragment cleanup is automatically handled during release commits
619
+
620
+ ### Benefits
621
+
622
+ - **Eliminates merge conflicts** on changelog files
623
+ - **Enables parallel development** without coordination overhead
624
+ - **Maintains changelog quality** through individual fragment validation
625
+ - **Simplifies release process** with automatic fragment consolidation
626
+ - **Preserves git history** of changelog contributions per branch
627
+
628
+
432
629
  ## Link Generation
433
630
 
434
631
  `kacl-cli` let's you easily generate links to your versions. You can automatically generate all links following the desired patterns using `kacl-cli link generate`.
@@ -581,12 +778,12 @@ Options:
581
778
 
582
779
  The `comment_template` parameter allows various templating options. The following template variables are available:
583
780
 
584
- | Variable | Description |
585
- | -------------- | ---------------------------------------------------------------------------------------------------- |
586
- | `new_version` | The version that was just released |
587
- | `changes` | The markdown content within the change section of your CHANGELOG |
781
+ | Variable | Description |
782
+ | -------------- | ----------------------------------------------------------------------------------------------------- |
783
+ | `new_version` | The version that was just released |
784
+ | `changes` | The markdown content within the change section of your CHANGELOG |
588
785
  | `link` | The link to the version within your source code management system according to the link configuration |
589
- | `env.MYENVVAR` | Any environment variable |
786
+ | `env.MYENVVAR` | Any environment variable |
590
787
 
591
788
  This flexibility allows you to adapt the comment patterns to your needs and dynamically create them. For example, adding CI/CD information can be easily achieved as follows:
592
789
 
@@ -651,11 +848,11 @@ required _default content_.
651
848
  By specifying a `.kacl.yml` with any of those options, the _default config_ will be merged with those local changes. Most options are also available on the CLI which take precedence over the ones
652
849
  within the config files.
653
850
 
654
- **Default Config**
851
+ ### Default Config
655
852
 
656
853
  ```yaml
657
854
  kacl:
658
- changelog_file: CHANGELOG.md
855
+ file: CHANGELOG.md
659
856
  allowed_header_titles:
660
857
  - Changelog
661
858
  - Change Log
@@ -670,19 +867,17 @@ kacl:
670
867
  - All notable changes to this project will be documented in this file.
671
868
  - The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
672
869
  git:
673
- commit: True
870
+ commit: False
674
871
  commit_message: "[skip ci] Releasing Changelog version {new_version}"
675
872
  commit_additional_files: []
676
873
  tag: False
677
874
  tag_name: "v{new_version}"
678
875
  tag_description: "Version v{new_version} released"
679
876
  links:
680
- # The host url is optional and will be automatically determined using your git repository
681
- # host_url: https://github.com/mschmieder/kacl-cli
682
- compare_versions_template: '{host}/compare/{previous_version}...{version}'
683
- unreleased_changes_template: '{host}/compare/{latest_version}...master'
684
- initial_version_template: '{host}/tree/{version}'
685
- auto_generate: True
877
+ auto_generate: False
878
+ compare_versions_template: '{host}/compare/{previous_version}...{version}'
879
+ unreleased_changes_template: '{host}/compare/{latest_version}...master'
880
+ initial_version_template: '{host}/tree/{version}'
686
881
  extension:
687
882
  post_release_version_prefix: null
688
883
  issue_tracker:
@@ -703,7 +898,57 @@ kacl:
703
898
  ## 🧭 Reference
704
899
 
705
900
  Code: [Source Code Management System]({link})
706
- ```
901
+ stash:
902
+ directory: .kacl_stash
903
+ always: False
904
+ ```
905
+
906
+ ### Configuration Parameters
907
+
908
+ | Parameter | Type | Default | Description |
909
+ | --------------------------------------- | ------- | -------------------------------------------------------------------- | -------------------------------------------------------- |
910
+ | **Basic Settings** | | | |
911
+ | `file` | string | `CHANGELOG.md` | Path to the changelog file |
912
+ | `allowed_header_titles` | array | `["Changelog", "Change Log"]` | Valid changelog header titles |
913
+ | `allowed_version_sections` | array | `["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]` | Valid section names within version entries |
914
+ | `default_content` | array | See default config | Default content lines for new changelog files |
915
+ | **Git Integration** | | | |
916
+ | `git.commit` | boolean | `false` | Automatically commit changelog changes during release |
917
+ | `git.commit_message` | string | `"[skip ci] Releasing Changelog version {new_version}"` | Template for commit messages |
918
+ | `git.commit_additional_files` | array | `[]` | Additional files to include in release commits |
919
+ | `git.tag` | boolean | `false` | Automatically create git tags during release |
920
+ | `git.tag_name` | string | `"v{new_version}"` | Template for git tag names |
921
+ | `git.tag_description` | string | `"Version v{new_version} released"` | Template for git tag descriptions |
922
+ | **Link Generation** | | | |
923
+ | `links.auto_generate` | boolean | `false` | Automatically generate version links during release |
924
+ | `links.compare_versions_template` | string | `"{host}/compare/{previous_version}...{version}"` | Template for version comparison links |
925
+ | `links.unreleased_changes_template` | string | `"{host}/compare/{latest_version}...master"` | Template for unreleased changes links |
926
+ | `links.initial_version_template` | string | `"{host}/tree/{version}"` | Template for initial version links |
927
+ | **Extensions** | | | |
928
+ | `extension.post_release_version_prefix` | string | `null` | Prefix for post-release/hotfix versions (non-SemVer) |
929
+ | **Issue Tracker Integration** | | | |
930
+ | `issue_tracker.jira.host` | string | `null` | JIRA instance hostname (also reads `JIRA_HOST` env var) |
931
+ | `issue_tracker.jira.username` | string | `null` | JIRA username (also reads `JIRA_USERNAME` env var) |
932
+ | `issue_tracker.jira.password` | string | `null` | JIRA password (also reads `JIRA_PASSWORD` env var) |
933
+ | `issue_tracker.jira.issue_patterns` | array | `["[A-Z]+-[0-9]+"]` | Regex patterns to identify issue references in changelog |
934
+ | `issue_tracker.jira.comment_template` | string | See default config | Template for comments posted to JIRA issues |
935
+ | **Changelog Fragments** | | | |
936
+ | `stash.directory` | string | `.kacl_stash` | Directory for storing changelog fragments |
937
+ | `stash.always` | boolean | `false` | Always use fragments instead of modifying main changelog |
938
+
939
+ ### Template Variables
940
+
941
+ The following variables are available for templating in commit messages, tag names, descriptions, and JIRA comments:
942
+
943
+ | Variable | Description | Example |
944
+ | -------------------- | --------------------------------- | ------------------------------ |
945
+ | `{new_version}` | The version being released | `1.2.3` |
946
+ | `{latest_version}` | The previous version | `1.2.2` |
947
+ | `{previous_version}` | Same as latest_version | `1.2.2` |
948
+ | `{host}` | Git repository host URL | `https://github.com/user/repo` |
949
+ | `{changes}` | Changelog content for the version | Markdown content |
950
+ | `{link}` | Link to the version in SCM | Generated link URL |
951
+ | `{env.VAR_NAME}` | Environment variable | Value of `VAR_NAME` |
707
952
 
708
953
  ## Development
709
954
 
@@ -1,22 +1,22 @@
1
- kacl/__init__.py,sha256=WUM42QzTkxNY6Yd-x-FEqcO2NFfzXkqDhRoAyqME1EE,644
1
+ kacl/__init__.py,sha256=Xz1MhC4G8ciUa0ezKXgEEYqJkoUeonsA7neF8DS-bYg,667
2
2
  kacl/__main__.py,sha256=cpulIGoFUJNN5ZW9oUoNN1PnBvrOyJ24xwtpf_yRwgQ,91
3
- kacl/changes.py,sha256=A0POz-xFMpFuq7nISnx_K75xOZOMmBuHq6EZ8NOQDsU,661
4
- kacl/config.py,sha256=Glw-1hRqS3AHpZ-2QRGzHRQ-TSLc1xtneb2MEATWFEQ,3966
5
- kacl/document.py,sha256=dzeYCIgLA1WzK04jeeCW_AYSOCampc9x2cAHdbnEMpY,24737
3
+ kacl/changes.py,sha256=Speu1KLMNQVn0U2BMaO8ta4IEaQLTQtpW0IhN0JjGdY,704
4
+ kacl/config.py,sha256=mUPm4W0cW7kvwYG4L20B38V-AvguvD6jvIQtZDO5mPY,4129
5
+ kacl/document.py,sha256=OuVjqSEUTxvO6tiCWggQiNebfjoTwQyIuqlT2y_V9Yc,28712
6
6
  kacl/element.py,sha256=OG02QI8ND5fJpBMceT6dbIHr4uX9gLxK_fPCsOvMDHI,416
7
7
  kacl/exception.py,sha256=MfOVpUvhcQtm10rSY__74-oLo445PG8mLFGJPPIfXH0,41
8
8
  kacl/jira_client.py,sha256=KPE94bZDkJFKw3okFsCgf2DjoyMlUUTMZKtQGKreVQY,989
9
- kacl/kacl_cli.py,sha256=KeCT4DydkHjckt5sbTtTwp2BQf0RllXpBUwLj-G5-U0,19987
9
+ kacl/kacl_cli.py,sha256=SnukzW96DjlPunZ5WOUxlPAsjUI-dg3iMeV1y9pyxKg,22156
10
10
  kacl/link_provider.py,sha256=tgvMYhJe2ErH1m_qXMlQEacq9Cg_KGp_-sF03sVFP6E,1866
11
11
  kacl/parser.py,sha256=EUtRjgaW0beWVqiYaRJ9Rcf6jbuGoTgWzVBdOdUHnv8,2587
12
12
  kacl/serializer.py,sha256=PdR2FFCh9rbBhkxXwUYD0fSjQqTG_Mb6mYws3lNAWQ8,3090
13
13
  kacl/utils.py,sha256=bHiDDmjoYB868Bm732vNjpfML-6xcNQQqS7NQn_Sfm0,2824
14
14
  kacl/validation.py,sha256=b9r_5CyY6Cmi9BePh47IgZ3j64zdVsoB_fFvucieNbw,2125
15
15
  kacl/version.py,sha256=IDYCWIIXzxdYyMptUAidMgf0SXJqoETFVJ8NVyKgA9A,9526
16
- kacl/config/kacl-default.yml,sha256=BdrQytOsx32_vXXBtR3VRp1-nzWrczNVc-gHuCGYuIA,1424
17
- python_kacl-0.6.5.dist-info/licenses/LICENSE,sha256=TRSJOIt7LZuMeZXFleJVL_LHczSxqi70HEiTLT-kI8Q,1075
18
- python_kacl-0.6.5.dist-info/METADATA,sha256=kVBx144zCKsmVBAnZS-RQ1omJ2QiPfIME6DtJRz8loE,24325
19
- python_kacl-0.6.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
- python_kacl-0.6.5.dist-info/entry_points.txt,sha256=rXqqJKfm6Y7fYfioq_7ay2VWOOM9C-hts1IsoGTtojM,76
21
- python_kacl-0.6.5.dist-info/top_level.txt,sha256=BcmQgo67JyGnVZ3Jc0Ag8hKMGVOqXc8ex01zW4Njw5M,5
22
- python_kacl-0.6.5.dist-info/RECORD,,
16
+ kacl/config/kacl-default.yml,sha256=KGOLn-BKj_8J0F3nBpSjH8ywdCjQQelhdDOKZ1pOy_Q,1477
17
+ python_kacl-0.6.6.dist-info/licenses/LICENSE,sha256=TRSJOIt7LZuMeZXFleJVL_LHczSxqi70HEiTLT-kI8Q,1075
18
+ python_kacl-0.6.6.dist-info/METADATA,sha256=OZ-3KPX7dyJYFyO_kBdHuwsI6pLJlNhZS3rWWPVcJa0,37608
19
+ python_kacl-0.6.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
+ python_kacl-0.6.6.dist-info/entry_points.txt,sha256=rXqqJKfm6Y7fYfioq_7ay2VWOOM9C-hts1IsoGTtojM,76
21
+ python_kacl-0.6.6.dist-info/top_level.txt,sha256=BcmQgo67JyGnVZ3Jc0Ag8hKMGVOqXc8ex01zW4Njw5M,5
22
+ python_kacl-0.6.6.dist-info/RECORD,,