devcommit 0.1.5.3__py3-none-any.whl → 0.1.5.5__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.
@@ -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
  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
 
@@ -2,7 +2,7 @@ devcommit/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
2
  devcommit/__version__.py,sha256=V-XdLtsUi6WXZQjdiIm5Hd_DM77oCPs6tmPghmb3GbQ,226
3
3
  devcommit/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  devcommit/app/ai_providers.py,sha256=Gqgs03oVfzR830dBSJ_VKn896DpXGWGuaAdsNtvSbI8,11938
5
- devcommit/app/changelog.py,sha256=FDIOqQGTzv2_86zILIlsols5GesiwHW9hNP4IQCBdGk,2451
5
+ devcommit/app/changelog.py,sha256=uUM9mHYnBF2-9x7w5o3SNEGZx79In524qmlvHlfCXb0,2616
6
6
  devcommit/app/gemini_ai.py,sha256=xEn94dt-kKg5fa6Wpxu09eKfN916pfWO_IWEBOGuEQE,3638
7
7
  devcommit/app/prompt.py,sha256=isjyLul4UTWJSW8kL6fSVjTBTTej0x93o5BFKW9LsZE,4325
8
8
  devcommit/create_config.py,sha256=dbW4nobO046t0dVoLbTZOKHMB4p1dATqH4d0K1MxR5g,3978
@@ -11,8 +11,8 @@ devcommit/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  devcommit/utils/git.py,sha256=o32VbzT-0MT-AgfdtZXqn-H9SUINmVRG6AvYIJdcpDU,26858
12
12
  devcommit/utils/logger.py,sha256=HXYOU2Vd3M5O4T6fshcg5FcfWER4kQiKOiJ1vM6_0mw,1597
13
13
  devcommit/utils/parser.py,sha256=VXxHPZ75Jx6aILG1o14y1hGNlcvutQUWkoEtR_RR9Zw,2280
14
- devcommit-0.1.5.3.dist-info/METADATA,sha256=-INMKFsrvaztelOa_crPffMWKZFGwL0zUJmYWKLVzHg,67386
15
- devcommit-0.1.5.3.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
16
- devcommit-0.1.5.3.dist-info/entry_points.txt,sha256=cTvXe20Iqbeo2Jz0wSHEFLFacH4NkYfmy6Sr1THL1Es,103
17
- devcommit-0.1.5.3.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
18
- devcommit-0.1.5.3.dist-info/RECORD,,
14
+ devcommit-0.1.5.5.dist-info/METADATA,sha256=TAlWyhjIdHRs-wYbppzEwhpz8BQDVmDaIzX80zZfvg4,67475
15
+ devcommit-0.1.5.5.dist-info/WHEEL,sha256=Vz2fHgx6HFtSwhs8KvkHLqH5Ea4w1_rner5uNVGCeIE,88
16
+ devcommit-0.1.5.5.dist-info/entry_points.txt,sha256=cTvXe20Iqbeo2Jz0wSHEFLFacH4NkYfmy6Sr1THL1Es,103
17
+ devcommit-0.1.5.5.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
18
+ devcommit-0.1.5.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.3.0
2
+ Generator: poetry-core 2.3.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any