Skip to content

Commit d48028d

Browse files
authored
Merge branch 'develop' into vishal/analyticsguide
2 parents 4381652 + 68cc192 commit d48028d

File tree

8 files changed

+139
-202
lines changed

8 files changed

+139
-202
lines changed

codegen-examples/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dev-dependencies = [
2727
"pre-commit>=4.0.1",
2828
"pre-commit-uv>=4.1.4",
2929
"uv>=0.4.25",
30-
"jupyterlab==4.3.5",
30+
"jupyterlab==4.3.6",
3131
"deptry>=0.22.0",
3232
]
3333

codegen-examples/uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/gen/capabilities.mdx

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: "Capabilities"
3+
icon: "gear"
4+
---
5+
6+
Codegen is built on an [open-source library](/introduction/overiew.mdx) for code manipulation.
7+
8+
It combines "tools" for code editing with powerful integrations, including Github, Linear and Slack.
9+
10+
<Tip>
11+
Learn more about our open source [code agent implementation](/docs/tutorials/build-code-agent)
12+
</Tip>
13+
14+
## Communication Tools
15+
16+
- **SlackSendMessageTool**: Allows Codegen to send messages in Slack channels and threads, providing responses to your queries and sharing information with your team.
17+
18+
## GitHub Integration Tools
19+
20+
Codegen includes a comprehensive set of GitHub tools:
21+
22+
- **GithubCheckoutPRTool**: Checks out pull requests to your local environment for review and testing.
23+
24+
- **GithubCreatePRTool**: Creates new pull requests from your current branch, including title, description, and target branch.
25+
26+
- **GithubCreatePRCommentTool**: Adds comments to pull requests for feedback and team communication.
27+
28+
- **GithubCreatePRReviewCommentTool**: Provides inline comments on specific code changes within pull requests.
29+
30+
- **GithubEditPRTool**: Modifies existing pull requests, including updating titles, descriptions, and other metadata.
31+
32+
- **GithubSearchIssuesTool**: Searches for GitHub issues based on various criteria like status, assignee, or labels.
33+
34+
- **GithubViewPRTool**: Retrieves and displays information about specific pull requests.
35+
36+
- **GithubViewPRCheckTool**: Checks the status of CI/CD and other automated checks on pull requests.
37+
38+
- **GithubViewCommitHistoryTool**: Shows the commit history of a repository or specific branch.
39+
40+
- **GithubViewCommitTool**: Displays details about specific commits, including changes made.
41+
42+
## Linear Integration Tools (Optional)
43+
44+
For teams using Linear for project management, Codegen offers:
45+
46+
- **LinearGetIssueTool**: Retrieves details about specific Linear issues.
47+
48+
- **LinearGetIssueCommentsTool**: Fetches comments on Linear issues for context and history.
49+
50+
- **LinearCommentOnIssueTool**: Adds comments to Linear issues for team communication.
51+
52+
- **LinearSearchIssuesTool**: Searches for Linear issues based on various criteria.
53+
54+
- **LinearCreateIssueTool**: Creates new issues in Linear with appropriate metadata.
55+
56+
- **LinearGetTeamsTool**: Retrieves information about teams in your Linear organization.
57+
58+
## How Codegen Uses These Tools
59+
60+
Codegen's AI brain (powered by Claude 3.7 Sonnet) intelligently selects and combines these tools to:
61+
62+
1. Understand your requests through natural language in Slack
63+
2. Determine the most appropriate tools to fulfill your request
64+
3. Execute the necessary actions across GitHub, Linear, and your codebase
65+
4. Provide clear, helpful responses back in Slack
66+
67+
This seamless integration allows you to manage your entire development workflow through simple conversations, without having to switch between different platforms and interfaces.
68+
69+
## Getting Started
70+
71+
Ready to experience the power of Codegen? Check out our [Quickstart Guide](/docs/gen/quickstart) to set up Codegen for your team, and explore [Common Commands](/docs/gen/common-commands) to see how to interact with these tools through natural language.

docs/gen/faq.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: "Frequently Asked Questions"
3+
sidebarTitle: "FAQ"
4+
icon: "square-question"
5+
iconType: "solid"
6+
---
7+
8+
<AccordionGroup>
9+
<Accordion title="What model does Codegen use?" icon="code">
10+
Claude 3.7. Our code agent is roughly comparable with Claude Code.
11+
</Accordion>
12+
<Accordion title="Is this free?" icon="scale-balanced">
13+
Yes! For now. Get it while it's hot.
14+
</Accordion>
15+
<Accordion title="Where is my data stored?" icon="database">
16+
Codegen stores this data in their private cloud. We are SOC-2 compliant. [Learn more](/introduction/about)
17+
</Accordion>
18+
</AccordionGroup>

docs/gen/introduction.mdx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: "Codegen: AI Development Assistant"
3+
sidebarTitle: "Introduction"
4+
icon: "lightbulb"
5+
---
6+
7+
Codegen is an intelligent code agent powered that seamlessly integrates with Slack, Github and Linear.
8+
9+
<Frame caption="Communicate with codegen via Slack">
10+
<img src="/images/codegen-bot-intro.png" />
11+
</Frame>
12+
13+
<Tip>
14+
Explore our [Capabilities](/docs/gen/capabilities) page to learn more about
15+
Codegen's full feature set and available tools!
16+
</Tip>
17+
18+
19+
# Installation
20+
21+
[Log in with GitHub](https://codegen.sh/start) to install Codegen and set up integrations.
22+
23+
<Card title="Get Started" href={"https://codegen.sh/start"} icon="Gear">
24+
Install codegen via OAuth with Github, Slack and Linear
25+
</Card>
26+
27+
# Common Queries
28+
29+
> *Edit repo X so that the user auth flow uses JWT*
30+
Modify the authentication flow in a specified repository to use JSON Web Tokens. This ensures secure and stateless authentication.
31+
32+
> *Show me the recent activity on my repo X*
33+
Display the latest commits, pull requests, and other activities in a specified repository. This helps you stay updated with ongoing changes.
34+
35+
> *Can you figure out why my tests are failing on `main`?*
36+
Analyze the test failures on the main branch to identify potential issues. This assists in maintaining code quality and stability.
37+
38+
> *Can you review my PR?*
39+
Perform a code review on a specified pull request, providing feedback and suggestions. This ensures code quality and adherence to best practices.
40+
41+
> *Do we have any tickets about Y?*
42+
Search for tickets related to a specific topic or issue. This helps in tracking and managing tasks effectively.
43+

docs/images/codegen-bot-intro.png

148 KB
Loading

docs/mint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,4 @@
378378
"x": "https://x.com/codegen",
379379
"linkedin": "https://linkedin.com/company/codegen-dot-com"
380380
}
381-
}
381+
}

src/codegen/sdk/system-prompt.txt

Lines changed: 1 addition & 196 deletions
Original file line numberDiff line numberDiff line change
@@ -11952,199 +11952,4 @@ LIMIT 20
1195211952

1195311953
<Frame caption="Call graph for a codebase">
1195411954
<img src="/images/neo4j-call-graph.png" />
11955-
</Frame>
11956-
11957-
---
11958-
title: "Code Attributions"
11959-
sidebarTitle: "Code Attributions"
11960-
description: "Learn how to analyze code statistics and attributions using Codegen"
11961-
icon: "network-wired"
11962-
iconType: "solid"
11963-
---
11964-
11965-
# AI Impact Analysis
11966-
11967-
This tutorial shows how to use Codegen's attribution extension to analyze the impact of AI on your
11968-
codebase. You'll learn how to identify which parts of your code were written by AI tools like
11969-
GitHub Copilot, Devin, or other AI assistants.
11970-
11971-
Note: the code is flexible - you can track CI pipeline bots, or any other contributor you want.
11972-
11973-
11974-
## Overview
11975-
11976-
The attribution extension analyzes git history to:
11977-
11978-
1. Identify which symbols (functions, classes, etc.) were authored or modified by AI tools
11979-
2. Calculate the percentage of AI contributions in your codebase
11980-
3. Find high-impact AI-written code (code that many other parts depend on)
11981-
4. Track the evolution of AI contributions over time
11982-
11983-
## Installation
11984-
11985-
The attribution extension is included with Codegen. No additional installation is required.
11986-
11987-
## Basic Usage
11988-
11989-
### Running the Analysis
11990-
11991-
You can run the AI impact analysis using the Codegen CLI:
11992-
11993-
```bash
11994-
codegen analyze-ai-impact
11995-
```
11996-
11997-
Or from Python code:
11998-
11999-
```python
12000-
from codegen import Codebase
12001-
from codegen.extensions.attribution.cli import run
12002-
12003-
# Initialize codebase from current directory
12004-
codebase = Codebase.from_repo("your-org/your-repo", language="python")
12005-
12006-
# Run the analysis
12007-
run(codebase)
12008-
```
12009-
12010-
### Understanding the Results
12011-
12012-
The analysis will print a summary of AI contributions to your console and save detailed results to a JSON file. The summary includes:
12013-
12014-
- List of all contributors (human and AI)
12015-
- Percentage of commits made by AI
12016-
- Number of files and symbols touched by AI
12017-
- High-impact AI-written code (code with many dependents)
12018-
- Top files by AI contribution percentage
12019-
12020-
## Advanced Usage
12021-
12022-
### Accessing Attribution Information
12023-
12024-
After running the analysis, each symbol in your codebase will have attribution information attached to it:
12025-
12026-
```python
12027-
from codegen import Codebase
12028-
from codegen.extensions.attribution.main import add_attribution_to_symbols
12029-
12030-
# Initialize codebase
12031-
codebase = Codebase.from_repo("your-org/your-repo", language="python")
12032-
12033-
# Add attribution information to symbols
12034-
ai_authors = ['github-actions[bot]', 'dependabot[bot]', 'copilot[bot]']
12035-
add_attribution_to_symbols(codebase, ai_authors)
12036-
12037-
# Access attribution information on symbols
12038-
for symbol in codebase.symbols:
12039-
if hasattr(symbol, 'is_ai_authored') and symbol.is_ai_authored:
12040-
print(f"AI-authored symbol: {symbol.name} in {symbol.filepath}")
12041-
print(f"Last editor: {symbol.last_editor}")
12042-
print(f"All editors: {symbol.editor_history}")
12043-
```
12044-
12045-
### Customizing AI Author Detection
12046-
12047-
By default, the analysis looks for common AI bot names in commit authors.
12048-
You can customize this by providing your own list of AI authors:
12049-
12050-
```python
12051-
from codegen import Codebase
12052-
from codegen.extensions.attribution.main import analyze_ai_impact
12053-
12054-
# Initialize codebase
12055-
codebase = Codebase.from_repo("your-org/your-repo", language="python")
12056-
12057-
# Define custom AI authors
12058-
ai_authors = [
12059-
'github-actions[bot]',
12060-
'dependabot[bot]',
12061-
'copilot[bot]',
12062-
'devin[bot]',
12063-
'your-custom-ai-email@example.com'
12064-
]
12065-
12066-
# Run analysis with custom AI authors
12067-
results = analyze_ai_impact(codebase, ai_authors)
12068-
```
12069-
12070-
## Example: Contributor Analysis
12071-
12072-
Here's a complete example that analyzes contributors to your codebase and their impact:
12073-
12074-
```python
12075-
import os
12076-
from collections import Counter
12077-
12078-
from codegen import Codebase
12079-
from codegen.extensions.attribution.main import add_attribution_to_symbols
12080-
from codegen.git.repo_operator.repo_operator import RepoOperator
12081-
from codegen.git.schemas.repo_config import RepoConfig
12082-
from codegen.sdk.codebase.config import ProjectConfig
12083-
from codegen.shared.enums.programming_language import ProgrammingLanguage
12084-
12085-
def analyze_contributors(codebase):
12086-
"""Analyze contributors to the codebase and their impact."""
12087-
print("\n🔍 Contributor Analysis:")
12088-
12089-
# Define which authors are considered AI
12090-
ai_authors = ['devin[bot]', 'codegen[bot]', 'github-actions[bot]', 'dependabot[bot]']
12091-
12092-
# Add attribution information to all symbols
12093-
print("Adding attribution information to symbols...")
12094-
add_attribution_to_symbols(codebase, ai_authors)
12095-
12096-
# Collect statistics about contributors
12097-
contributor_stats = Counter()
12098-
ai_contributor_stats = Counter()
12099-
12100-
print("Analyzing symbol attributions...")
12101-
for symbol in codebase.symbols:
12102-
if hasattr(symbol, 'last_editor') and symbol.last_editor:
12103-
contributor_stats[symbol.last_editor] += 1
12104-
12105-
# Track if this is an AI contributor
12106-
if any(ai in symbol.last_editor for ai in ai_authors):
12107-
ai_contributor_stats[symbol.last_editor] += 1
12108-
12109-
# Print top contributors overall
12110-
print("\n👥 Top Contributors by Symbols Authored:")
12111-
for contributor, count in contributor_stats.most_common(10):
12112-
is_ai = any(ai in contributor for ai in ai_authors)
12113-
ai_indicator = "🤖" if is_ai else "👤"
12114-
print(f" {ai_indicator} {contributor}: {count} symbols")
12115-
12116-
# Print top AI contributors if any
12117-
if ai_contributor_stats:
12118-
print("\n🤖 Top AI Contributors:")
12119-
for contributor, count in ai_contributor_stats.most_common(5):
12120-
print(f" • {contributor}: {count} symbols")
12121-
12122-
# Initialize codebase from current directory
12123-
if os.path.exists(".git"):
12124-
repo_path = os.getcwd()
12125-
repo_config = RepoConfig.from_repo_path(repo_path)
12126-
repo_operator = RepoOperator(repo_config=repo_config)
12127-
12128-
project = ProjectConfig.from_repo_operator(
12129-
repo_operator=repo_operator,
12130-
programming_language=ProgrammingLanguage.PYTHON
12131-
)
12132-
codebase = Codebase(projects=[project])
12133-
12134-
# Run the contributor analysis
12135-
analyze_contributors(codebase)
12136-
```
12137-
12138-
## Conclusion
12139-
12140-
The attribution extension provides valuable insights into how AI tools are being used in your
12141-
development process. By understanding which parts of your codebase are authored by AI, you can:
12142-
12143-
- Track the adoption of AI coding assistants in your team
12144-
- Identify areas where AI is most effective
12145-
- Ensure appropriate review of AI-generated code
12146-
- Measure the impact of AI on developer productivity
12147-
12148-
For more advanced usage, check out the [API reference](/api-reference/extensions/attribution)
12149-
for the attribution extension.
12150-
11955+
</Frame>

0 commit comments

Comments
 (0)