devcommit 0.1.5.3__tar.gz → 0.1.5.5__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.5
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 inside `branch/year/month/day` folders with time-based names (e.g., `changelogs/staging/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/<branch>/<year>/<month>/<day>/ 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 inside `branch/year/month/day` folders with time-based names (e.g., `changelogs/staging/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/<branch>/<year>/<month>/<day>/ directory
462
462
  # Then changes are staged and committed
463
463
  ```
464
464
 
@@ -3,8 +3,10 @@
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.git import get_current_branch
9
+ from devcommit.utils.logger import config
8
10
 
9
11
 
10
12
  def generate_changelog_prompt() -> str:
@@ -41,49 +43,54 @@ Only include sections that have changes. Do not add empty sections."""
41
43
 
42
44
  def generate_changelog(diff: str) -> str:
43
45
  """Generate changelog content from git diff using AI.
44
-
46
+
45
47
  Args:
46
48
  diff: Git diff string
47
-
49
+
48
50
  Returns:
49
51
  Formatted markdown changelog content
50
52
  """
51
53
  prompt = generate_changelog_prompt()
52
-
53
- # Get AI provider from config
54
+
54
55
  provider = get_ai_provider(config)
55
-
56
- # Generate changelog using AI
56
+
57
57
  max_tokens = config("MAX_TOKENS", default=8192, cast=int)
58
- changelog_content = provider.generate_commit_message(diff, prompt, max_tokens)
59
-
58
+ changelog_content = provider.generate_commit_message(
59
+ diff, prompt, max_tokens
60
+ )
61
+
60
62
  return changelog_content
61
63
 
62
64
 
63
65
  def save_changelog(content: str, directory: str = None) -> str:
64
66
  """Save changelog content to a file.
65
-
67
+
66
68
  Args:
67
69
  content: Changelog markdown content
68
70
  directory: Directory to save changelog (default from config)
69
-
71
+
70
72
  Returns:
71
73
  Path to the saved changelog file
72
74
  """
73
- # Get directory from config if not provided
74
75
  if directory is None:
75
76
  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
77
+
81
78
  now = datetime.now()
82
- 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:
79
+ branch_name = get_current_branch().replace("/", "-")
80
+ year_directory = now.strftime("%Y")
81
+ month_directory = now.strftime("%m")
82
+ day_directory = now.strftime("%d")
83
+ target_directory = os.path.join(
84
+ directory, branch_name, year_directory, month_directory, day_directory
85
+ )
86
+
87
+ # Create the branch/year/month/day directory structure if it doesn't exist
88
+ os.makedirs(target_directory, exist_ok=True)
89
+
90
+ filename = now.strftime("%H-%M-%S.md")
91
+ filepath = os.path.join(target_directory, filename)
92
+
93
+ with open(filepath, "w", encoding="utf-8") as f:
87
94
  f.write(content)
88
-
95
+
89
96
  return filepath
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "devcommit"
3
- version = "0.1.5.3"
3
+ version = "0.1.5.5"
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.5"
48
48
  description = "AI-powered git commit message generator"
49
49
  authors = ["Hordunlarmy <Hordunlarmy@gmail.com>"]
50
50
 
File without changes