Skip to content

Commit e190971

Browse files
feat(docs): Changelog generation (#341)
# Motivation Generates a high level overview of changes in a release to publish on mintlify. # Content Logic that uses `python-semantic-release` to parse past git commits and releases and uses the parsed information to generate a higher level changelog that will be shown in the mintlify docs. New release update can be added to`docs/changelog/changelog.mdx`: `python src/codegen/gscli/cli.py generate changelog --anthropic-key <anthropic_key>` # Testing tested by running locally # Please check the following before marking your PR as ready for review - [x] I have updated the documentation or added new documentation as needed --------- Co-authored-by: semantic-release <semantic-release>
1 parent 188ae63 commit e190971

File tree

5 files changed

+688
-5
lines changed

5 files changed

+688
-5
lines changed

docs/changelog/changelog.mdx

Lines changed: 225 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,229 @@ icon: "clock"
44
iconType: "solid"
55
---
66

7-
<Update label="2024-10-12" description="v0.1.1">
8-
Changelog first generated
7+
<Update label="v0.5.26" description="February 06, 2025">
8+
### [Simplified Slack notifications](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.26)
9+
- Simplified Slack notifications by removing description field
10+
</Update>
11+
12+
13+
<Update label="v0.5.25" description="February 06, 2025">
14+
### [JSX parsing improvements and workflow optimizations](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.25)
15+
- Fixed JSX prop parsing mechanism
16+
- Added semantic release workflow improvements
17+
- Fixed handling of empty collections
18+
- Added performance optimizations with Mypyc/Cython
19+
- Improved CI/CD pipeline configuration
20+
</Update>
21+
22+
23+
<Update label="v0.5.24" description="February 05, 2025">
24+
### [Adds Python 3.13 and ARM64 support with feature improvements](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.24)
25+
- Added support for Python 3.13 and ARM64 architecture builds
26+
- Added documentation for incremental recomputation
27+
- Introduced feature flag for generics support
28+
- Fixed issues with duplicate edge creation
29+
- Improved pre-commit hook functionality and stability
30+
</Update>
31+
32+
33+
<Update label="v0.5.23" description="February 04, 2025">
34+
### [Adds symbol flags and improves debugging capabilities](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.23)
35+
- Added new symbol flag functionality for Python and TypeScript
36+
- Introduced duplicate dependencies strategy for file movement
37+
- Enhanced debugging capabilities and server health monitoring
38+
- Improved documentation with new guides and usage examples
39+
- Fixed various issues with codemod file creation and sandbox server
40+
</Update>
41+
42+
43+
<Update label="v0.5.22" description="February 04, 2025">
44+
### [Improves testing and fixes release-related issues](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.22)
45+
- Fixed changelog generation and wheel release issues
46+
- Improved test suite with timeouts and standardized move_to_file tests
47+
- Enhanced CI/CD pipeline configuration
48+
</Update>
49+
50+
51+
<Update label="v0.5.21" description="February 03, 2025">
52+
### [Adds ephemeral server and improves documentation](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.21)
53+
- Added ephemeral server functionality
54+
- Improved documentation generation with better type resolution and class docstrings
55+
- Enhanced CI/CD workflows and testing infrastructure
56+
</Update>
57+
58+
59+
<Update label="v0.5.19" description="February 03, 2025">
60+
### [ARM support for Linux](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.19)
61+
- Added ARM support for Linux platforms
62+
- Enhanced documentation with architecture docs and improved docstrings
63+
- Updated OpenAI dependency to version 1.61.0
64+
</Update>
65+
66+
67+
<Update label="v0.5.18" description="January 30, 2025">
68+
### [Adds system prompt generation and improves core functionality](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.18)
69+
- Added automatic system prompt generation and gist client integration
70+
- Restored namespace module support functionality
71+
- Removed dynamic widget component from home page
72+
- Fixed parse error handling
73+
- Enhanced documentation and workflow improvements
74+
</Update>
75+
76+
77+
<Update label="v0.5.17" description="January 30, 2025">
78+
### [Platform and file handling improvements](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.17)
79+
- Enhanced file handling with improved TSourceFile return type
80+
- Updated platform support capabilities
81+
- Added community resources for contributors
82+
</Update>
83+
84+
85+
<Update label="v0.5.16" description="January 30, 2025">
86+
### [Pydantic v2 migration and documentation updates](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.16)
87+
- Update to Pydantic v2 imports and config handling
88+
- Documentation and example improvements
89+
- Configuration file updates
90+
</Update>
91+
92+
93+
<Update label="v0.5.15" description="January 30, 2025">
94+
### [Removes auth requirement and fixes path handling](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.15)
95+
- Remove authentication requirement for create command
96+
- Fix path handling and directory creation
97+
- Resolve validator import issues
98+
</Update>
99+
100+
101+
<Update label="v0.5.14" description="January 29, 2025">
102+
### [Validation system improvements](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.14)
103+
- Updated validation system to use BeforeValidator instead of PlainValidator
104+
</Update>
105+
106+
107+
<Update label="v0.5.13" description="January 29, 2025">
108+
### [Updates to Pydantic v2 and documentation improvements](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.13)
109+
- Updated to Pydantic v2 for span handling
110+
- Added documentation for import loops
111+
- Improved IDE installation instructions
112+
</Update>
113+
114+
115+
<Update label="v0.5.12" description="January 29, 2025">
116+
### [Documentation improvements and module resolution fixes](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.12)
117+
- Enhanced documentation with improved visualization linking and codebase examples
118+
- Fixed module resolution issues
119+
- Updated VSCode installation guide with Python extensions
120+
- Improved documentation metadata and thumbnail images
121+
</Update>
122+
123+
124+
<Update label="v0.5.11" description="January 29, 2025">
125+
### [Adds graph disabling feature and fixes command handling](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.11)
126+
- Add disable_graph feature flag to reduce memory usage and parsing time
127+
- Fix bug in create command response handling
128+
</Update>
129+
130+
131+
<Update label="v0.5.10" description="January 29, 2025">
132+
### [Adds language detection and improves file handling](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.10)
133+
- Added package.json-based repository language detection
134+
- Improved file editing capabilities with new raw text edit features
135+
- Enhanced documentation with function decorator guide and codebase visualization tutorial
136+
- Fixed GitHub 404 error handling
137+
- Added type fixes for codebase initialization
138+
</Update>
139+
140+
141+
<Update label="v0.5.9" description="January 28, 2025">
142+
### [Documentation improvements and dynamic import support](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.9)
143+
- Improved documentation with new guides and clarifications on file types
144+
- Added support for dynamic import detection
145+
- Added reset command to CLI
146+
- Improved integration tests for better contributor experience
147+
- Fixed widget URLs and various documentation improvements
148+
</Update>
149+
150+
151+
<Update label="v0.5.8" description="January 28, 2025">
152+
### [Fixes branch sync and improves documentation](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.8)
153+
- Fix branch synchronization clone URL issue
154+
- Enhance documentation guides
155+
- Update development dependencies
156+
</Update>
157+
158+
159+
<Update label="v0.5.7" description="January 27, 2025">
160+
### [Improves runner functionality and build process](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.7)
161+
- Enhanced runner module functionality and synchronization
162+
- Added automatic function imports generation during build process
163+
- Updated documentation and README
164+
</Update>
165+
166+
167+
<Update label="v0.5.6" description="January 27, 2025">
168+
### [New codebase initialization workflow and analytics integration](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.6)
169+
- Introduced new codebase initialization workflow
170+
- Added PostHog integration and override functionality
171+
- Enhanced documentation for session options
172+
- Improved sandbox runner synchronization
173+
</Update>
174+
175+
176+
<Update label="v0.5.5" description="January 27, 2025">
177+
### [Adds create flag and improves Git repository handling](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.5)
178+
- Added `-d` flag to `codegen create` command
179+
- Fixed Gradio integration issues
180+
- Improved automatic base path detection for Git repositories
181+
- Enhanced codebase reset functionality to only affect SDK changes
182+
- Updated documentation and README
183+
</Update>
184+
185+
186+
<Update label="v0.5.4" description="January 27, 2025">
187+
### [Adds venv management and TypeScript export support](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.4)
188+
- Added virtual environment creation and persistence for `codegen init`
189+
- Added support for codebase exports in TypeScript projects
190+
- Reorganized test structure for better maintainability
191+
- Updated graph widget configuration and URLs
192+
</Update>
193+
194+
195+
<Update label="v0.5.3" description="January 27, 2025">
196+
### [Graph widget and system prompt features added](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.3)
197+
- Added graph widget visualization feature
198+
- Enhanced documentation with improved readability and new guides
199+
- Added system prompt functionality
200+
- Fixed core commands: codegen run and create
201+
- Various internal code cleanup and reorganization
202+
</Update>
203+
204+
205+
<Update label="v0.5.2" description="January 24, 2025">
206+
### [Adds notebook functionality and improves documentation](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.2)
207+
- Added new codegen notebook functionality
208+
- Fixed several documentation rendering issues and broken links
209+
- Added function call parameter documentation helpers
210+
- Fixed various type annotations and AST-related bugs
211+
- Added README files for codegen modules
212+
</Update>
213+
214+
215+
<Update label="v0.5.1" description="January 24, 2025">
216+
### [Adds remote codebase support and improves documentation](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.1)
217+
- Added support for fetching remote codebases
218+
- Fixed documentation and GitHub link parsing issues
219+
- Improved test organization and coverage
220+
- Added missing documentation pages
221+
- Resolved repository configuration issues
222+
</Update>
223+
224+
225+
<Update label="v0.5.0" description="January 24, 2025">
226+
### [Major documentation overhaul and API improvements](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.0)
227+
- New documentation system with MDX support and interactive codemod widget
228+
- Simplified API with improved module organization and naming
229+
- Added Codebase and CLI functionality for easier code manipulation
230+
- Introduced fetch_codebase feature for remote repository handling
231+
- Enhanced documentation with new guides and examples
9232
</Update>

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ dependencies = [
6060
"starlette<1.0.0,>=0.16.0",
6161
"tqdm>=4.67.1",
6262
"tomlkit>=0.13.2",
63+
"python-semantic-release",
6364
"uvicorn[standard]>=0.30.0",
6465
]
6566

@@ -143,6 +144,7 @@ dev-dependencies = [
143144
"emoji>=2.14.0",
144145
"pytest-benchmark[histogram]>=5.1.0",
145146
"loguru>=0.7.3",
147+
"httpx<0.28.0,>=0.25.1",
146148
]
147149

148150

@@ -233,3 +235,20 @@ manylinux-aarch64-image = "quay.io/pypa/manylinux_2_34_aarch64"
233235
[tool.cibuildwheel.linux]
234236
before-all = "curl -sSf https://sh.rustup.rs | sh -s -- -y"
235237
environment = { "PATH" = "$HOME/.cargo/bin:$PATH" }
238+
239+
[tool.semantic_release]
240+
assets = []
241+
build_command_env = []
242+
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
243+
commit_parser = "angular"
244+
logging_use_named_masks = false
245+
major_on_zero = true
246+
allow_zero_version = true
247+
repo_dir = "."
248+
no_git_verify = false
249+
tag_format = "v{version}"
250+
251+
[tool.semantic_release.branches.develop]
252+
match = "develop"
253+
prerelease_token = "rc"
254+
prerelease = false

src/codegen/gscli/generate/commands.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from codegen.gscli.generate.runner_imports import _generate_runner_imports
1212
from codegen.gscli.generate.system_prompt import get_system_prompt
1313
from codegen.gscli.generate.utils import LanguageType, generate_builtins_file
14+
from codegen.sdk.ai.helpers import AnthropicHelper
15+
from codegen.sdk.code_generation.changelog_generation import generate_changelog
1416
from codegen.sdk.code_generation.codegen_sdk_codebase import get_codegen_sdk_codebase
1517
from codegen.sdk.code_generation.doc_utils.generate_docs_json import generate_docs_json
1618
from codegen.sdk.code_generation.mdx_docs_generation import render_mdx_page_for_class
@@ -195,3 +197,46 @@ def generate_codegen_sdk_docs(docs_dir: str) -> None:
195197
json.dump(mint_data, mint_file, indent=2)
196198

197199
print(colored("Updated mint.json with new page sets", "green"))
200+
201+
202+
@generate.command()
203+
@click.option("--docs-dir", default="docs", required=False)
204+
@click.option("--anthropic-key", required=True)
205+
@click.option("--complete", is_flag=True, help="Generate a complete changelog for the codegen_sdk API")
206+
def changelog(docs_dir: str, anthropic_key: str, complete: bool = False) -> None:
207+
"""Generate the changelog for the codegen_sdk API and update the changelog.mdx file"""
208+
print(colored("Generating changelog", "green"))
209+
header = """---
210+
title: "Codegen Updates"
211+
icon: "clock"
212+
iconType: "solid"
213+
---
214+
"""
215+
# Generate the changelog for the codegen_sdk API and update the changelog.mdx file
216+
client = AnthropicHelper(anthropic_key=anthropic_key, cache=True, openai_anthropic_translation=False)
217+
218+
if complete:
219+
entire_release_history = generate_changelog(client)
220+
new_changelog = header + entire_release_history
221+
else:
222+
# Read existing changelog and append new releases
223+
with open(os.path.join(docs_dir, "changelog/changelog.mdx")) as f:
224+
# read the existing changelog
225+
existing_changelog = f.read()
226+
# Remove header from existing changelog
227+
existing_changelog = existing_changelog.split(header)[1]
228+
# find the latest existing version
229+
latest_existing_version = re.search(r'label="(v[\d.]+)"', existing_changelog)
230+
# if there is a latest existing version, generate new releases
231+
if latest_existing_version:
232+
# generate new releases
233+
new_releases = generate_changelog(client, latest_existing_version.group(1))
234+
# append new releases to the existing changelog
235+
new_changelog = header + new_releases + existing_changelog
236+
else:
237+
# if there is no latest existing version, generate a complete changelog
238+
new_releases = generate_changelog(client)
239+
new_changelog = header + new_releases
240+
241+
with open(os.path.join(docs_dir, "changelog/changelog.mdx"), "w") as f:
242+
f.write(new_changelog)

0 commit comments

Comments
 (0)