devcommit 0.1.5.3__tar.gz → 0.1.5.4__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devcommit
3
- Version: 0.1.5.3
3
+ Version: 0.1.5.4
4
4
  Summary: AI-powered git commit message generator
5
5
  License: GNU GENERAL PUBLIC LICENSE
6
6
  Version 3, 29 June 2007
@@ -1150,8 +1150,8 @@ devcommit --stageAll --changelog --files src/
1150
1150
 
1151
1151
  - **With `--stageAll`**: Changelog is generated from unstaged changes **before** staging
1152
1152
  - **Without `--stageAll`**: Changelog is generated from the last commit **after** committing
1153
- - Changelogs are saved as markdown files with datetime-based names (e.g., `2026-01-28_00-55-30.md`)
1154
- - Default directory: `changelogs/` (configurable via `CHANGELOG_DIR` in `.dcommit`)
1153
+ - Changelogs are saved as markdown files with datetime-based names inside `year/month` folders (e.g., `changelogs/2026/01/2026-01-28_00-55-30.md`)
1154
+ - Default base directory: `changelogs/` (configurable via `CHANGELOG_DIR` in `.dcommit`)
1155
1155
  - Uses Keep a Changelog format with AI-generated content
1156
1156
 
1157
1157
  **Example workflow:**
@@ -1163,7 +1163,7 @@ devcommit --stageAll --changelog --files src/
1163
1163
  # Stage all changes and generate changelog before committing
1164
1164
  devcommit --stageAll --changelog
1165
1165
 
1166
- # The changelog file is created in changelogs/ directory
1166
+ # The changelog file is created in changelogs/<year>/<month>/ directory
1167
1167
  # Then changes are staged and committed
1168
1168
  ```
1169
1169
 
@@ -445,8 +445,8 @@ devcommit --stageAll --changelog --files src/
445
445
 
446
446
  - **With `--stageAll`**: Changelog is generated from unstaged changes **before** staging
447
447
  - **Without `--stageAll`**: Changelog is generated from the last commit **after** committing
448
- - Changelogs are saved as markdown files with datetime-based names (e.g., `2026-01-28_00-55-30.md`)
449
- - Default directory: `changelogs/` (configurable via `CHANGELOG_DIR` in `.dcommit`)
448
+ - Changelogs are saved as markdown files with datetime-based names inside `year/month` folders (e.g., `changelogs/2026/01/2026-01-28_00-55-30.md`)
449
+ - Default base directory: `changelogs/` (configurable via `CHANGELOG_DIR` in `.dcommit`)
450
450
  - Uses Keep a Changelog format with AI-generated content
451
451
 
452
452
  **Example workflow:**
@@ -458,7 +458,7 @@ devcommit --stageAll --changelog --files src/
458
458
  # Stage all changes and generate changelog before committing
459
459
  devcommit --stageAll --changelog
460
460
 
461
- # The changelog file is created in changelogs/ directory
461
+ # The changelog file is created in changelogs/<year>/<month>/ directory
462
462
  # Then changes are staged and committed
463
463
  ```
464
464
 
@@ -3,8 +3,9 @@
3
3
 
4
4
  import os
5
5
  from datetime import datetime
6
- from devcommit.utils.logger import config
6
+
7
7
  from devcommit.app.ai_providers import get_ai_provider
8
+ from devcommit.utils.logger import config
8
9
 
9
10
 
10
11
  def generate_changelog_prompt() -> str:
@@ -41,49 +42,50 @@ Only include sections that have changes. Do not add empty sections."""
41
42
 
42
43
  def generate_changelog(diff: str) -> str:
43
44
  """Generate changelog content from git diff using AI.
44
-
45
+
45
46
  Args:
46
47
  diff: Git diff string
47
-
48
+
48
49
  Returns:
49
50
  Formatted markdown changelog content
50
51
  """
51
52
  prompt = generate_changelog_prompt()
52
-
53
- # Get AI provider from config
53
+
54
54
  provider = get_ai_provider(config)
55
-
56
- # Generate changelog using AI
55
+
57
56
  max_tokens = config("MAX_TOKENS", default=8192, cast=int)
58
- changelog_content = provider.generate_commit_message(diff, prompt, max_tokens)
59
-
57
+ changelog_content = provider.generate_commit_message(
58
+ diff, prompt, max_tokens
59
+ )
60
+
60
61
  return changelog_content
61
62
 
62
63
 
63
64
  def save_changelog(content: str, directory: str = None) -> str:
64
65
  """Save changelog content to a file.
65
-
66
+
66
67
  Args:
67
68
  content: Changelog markdown content
68
69
  directory: Directory to save changelog (default from config)
69
-
70
+
70
71
  Returns:
71
72
  Path to the saved changelog file
72
73
  """
73
- # Get directory from config if not provided
74
74
  if directory is None:
75
75
  directory = config("CHANGELOG_DIR", default="changelogs")
76
-
77
- # Create directory if it doesn't exist
78
- os.makedirs(directory, exist_ok=True)
79
-
80
- # Generate filename with current datetime
76
+
81
77
  now = datetime.now()
78
+ year_directory = now.strftime("%Y")
79
+ month_directory = now.strftime("%m")
80
+ target_directory = os.path.join(directory, year_directory, month_directory)
81
+
82
+ # Create the year/month directory structure if it doesn't exist
83
+ os.makedirs(target_directory, exist_ok=True)
84
+
82
85
  filename = now.strftime("%Y-%m-%d_%H-%M-%S.md")
83
- filepath = os.path.join(directory, filename)
84
-
85
- # Write content to file
86
- with open(filepath, 'w', encoding='utf-8') as f:
86
+ filepath = os.path.join(target_directory, filename)
87
+
88
+ with open(filepath, "w", encoding="utf-8") as f:
87
89
  f.write(content)
88
-
90
+
89
91
  return filepath
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "devcommit"
3
- version = "0.1.5.3"
3
+ version = "0.1.5.4"
4
4
  description = "AI-powered git commit message generator"
5
5
  readme = "README.md"
6
6
  license = {file = "COPYING"}
@@ -44,7 +44,7 @@ create-dcommit = "devcommit.create_config:create_dcommit"
44
44
 
45
45
  [tool.poetry]
46
46
  name = "devcommit"
47
- version = "0.1.4.4"
47
+ version = "0.1.5.4"
48
48
  description = "AI-powered git commit message generator"
49
49
  authors = ["Hordunlarmy <Hordunlarmy@gmail.com>"]
50
50
 
File without changes