Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
263 changes: 136 additions & 127 deletions docs/docs.json
Original file line number Diff line number Diff line change
@@ -1,129 +1,138 @@
{
"$schema": "https://mintlify.com/docs.json",
"theme": "maple",
"name": "Codegen Documentation",
"colors": {
"primary": "#a277ff",
"light": "#a277ff",
"dark": "#a277ff"
},
"favicon": "/favicon.svg",
"navigation": {
"tabs": [
{
"tab": "Documentation",
"groups": [
{
"group": "Overview",
"pages": [
"introduction/overview",
"introduction/api",
"introduction/prompting",
"introduction/community",
"introduction/about",
"introduction/faq"
]
},
{
"group": "Capabilities",
"pages": ["capabilities/capabilities", "capabilities/wake-up", "capabilities/interrupts"]
},
{
"group": "Integrations",
"pages": [
"integrations/github",
"integrations/slack",
"integrations/linear",
"integrations/jira",
"integrations/notion",
"integrations/figma",
"integrations/circleci",
"integrations/web-search",
"integrations/postgres",
"integrations/mcp"
]
},
{
"group": "Sandboxes",
"pages": [
"sandboxes/overview",
"sandboxes/setup-commands",
"sandboxes/image-snapshots",
"sandboxes/environment-variables",
"sandboxes/secrets",
"sandboxes/editor",
"sandboxes/web-preview"
]
},
{
"group": "Settings",
"pages": ["settings/repo-rules", "settings/model-configuration"]
}
]
},
{
"tab": "API Reference",
"groups": [
{
"group": "Endpoints",
"openapi": {
"source": "/api-reference/openapi3.json",
"directory": "api-reference"
}
},
{
"group": "Guides",
"pages": ["api-reference/agent-run-logs", "api-reference/github-actions"]
}
]
}
]
},
"logo": {
"light": "https://cdn.prod.website-files.com/67070304751b9b01bf6a161c/679bcf45bf55446746125835_Codegen_Logomark_Light.svg",
"dark": "https://cdn.prod.website-files.com/67070304751b9b01bf6a161c/679bcf45a3e32761c42b324b_Codegen_Logomark_Dark.svg"
},
"appearance": {
"default": "dark"
},
"background": {
"decoration": "gradient"
},
"navbar": {
"primary": {
"type": "button",
"label": "GitHub",
"href": "https://github.com/codegen-sh/codegen-sdk"
}
},
"seo": {
"metatags": {
"og:site_name": "Codegen Documentation",
"og:title": "Codegen Documentation - 10x Your Engineering",
"og:description": "Complete documentation for Codegen, the AI-powered software engineering agent. Learn how to integrate with GitHub, Slack, Linear, and more.",
"og:url": "https://docs.codegen.com",
"og:locale": "en_US",
"og:logo": "https://i.imgur.com/f4OVOqI.png",
"article:publisher": "Codegen, Inc.",
"twitter:site": "@codegen"
},
"indexing": "navigable"
},
"footer": {
"socials": {
"x": "https://x.com/codegen",
"linkedin": "https://linkedin.com/company/codegen-dot-com"
}
},
"integrations": {
"posthog": {
"apiKey": "phc_GLxaINoQJnuyCyxDmTciQqzdKBYFVDkY7bRBO4bDdso"
}
},
"head": [
{
"tag": "script",
"content": "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-T7G5S78D');"
}
]
"$schema": "https://mintlify.com/docs.json",
"theme": "maple",
"name": "Codegen",
"colors": {
"primary": "#a277ff",
"light": "#a277ff",
"dark": "#a277ff"
},
"favicon": "/favicon.svg",
"navigation": {
"tabs": [
{
"tab": "Documentation",
"groups": [
{
"group": "Overview",
"pages": [
"introduction/overview",
"introduction/api",
"introduction/prompting",
"introduction/community",
"introduction/about",
"introduction/faq"
]
},
{
"group": "Capabilities",
"pages": ["capabilities/capabilities", "capabilities/wake-up"]
},
{
"group": "Integrations",
"pages": [
"integrations/github",
"integrations/slack",
"integrations/linear",
"integrations/notion",
"integrations/figma",
"integrations/circleci",
"integrations/web-search",
"integrations/postgres"
]
},
{
"group": "Sandboxes",
"pages": [
"sandboxes/overview",
"sandboxes/setup-commands",
"sandboxes/environment-variables",
"sandboxes/secrets",
"sandboxes/editor",
"sandboxes/web-preview"
]
},
{
"group": "Settings",
"pages": ["settings/repo-rules", "settings/model-configuration"]
}
]
},
{
"tab": "API Reference",
"groups": [
{
"group": "Endpoints",
"openapi": {
"source": "/api-reference/openapi3.json",
"directory": "api-reference"
}
},
{
"group": "Guides",
"pages": ["api-reference/agent-run-logs"]
}
]
},
{
"tab": "Blog",
"groups": [
{
"group": "Blog",
"pages": ["blog/posts", "blog/devin", "blog/act-via-code"]
}
]
},
{
"tab": "Changelog",
"groups": [
{
"group": "Changelog",
"pages": ["changelog/changelog"]
}
]
}
]
},
"logo": {
"light": "https://cdn.prod.website-files.com/67070304751b9b01bf6a161c/679bcf45bf55446746125835_Codegen_Logomark_Light.svg",
"dark": "https://cdn.prod.website-files.com/67070304751b9b01bf6a161c/679bcf45a3e32761c42b324b_Codegen_Logomark_Dark.svg"
},
"appearance": {
"default": "dark"
},
"background": {
"decoration": "gradient"
},
"navbar": {
"primary": {
"type": "button",
"label": "GitHub",
"href": "https://github.com/codegen-sh/codegen-sdk"
}
},
"seo": {
"metatags": {
"og:site_name": "Codegen",
"og:title": "Codegen - The SWE that Never Sleeps",
"og:description": "Code agents accessible via API, Slack, Linear, Github, and more.",
"og:url": "https://docs.codegen.com",
"og:locale": "en_US",
"og:logo": "https://i.imgur.com/f4OVOqI.png",
"article:publisher": "Codegen, Inc.",
"twitter:site": "@codegen"
},
"indexing": "navigable"
},
"footer": {
"socials": {
"x": "https://x.com/codegen",
"linkedin": "https://linkedin.com/company/codegen-dot-com"
}
},
"integrations": {
"posthog": {
"apiKey": "phc_GLxaINoQJnuyCyxDmTciQqzdKBYFVDkY7bRBO4bDdso"
}
}
}
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/codegen/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from codegen_api_client.models.create_agent_run_input import CreateAgentRunInput

from codegen.agents.constants import CODEGEN_BASE_API_URL
from codegen.cli.utils.org import resolve_org_id


class AgentTask:
Expand Down Expand Up @@ -53,7 +54,11 @@ def __init__(self, token: str | None, org_id: int | None = None, base_url: str |
org_id: Optional organization ID. If not provided, default org will be used.
"""
self.token = token
self.org_id = org_id or int(os.environ.get("CODEGEN_ORG_ID", "1")) # Default to org ID 1 if not specified
resolved_org = resolve_org_id(org_id)
if resolved_org is None:
# Keep previous behavior only as last resort to avoid exceptions in legacy paths
resolved_org = int(os.environ.get("CODEGEN_ORG_ID", "1"))
self.org_id = resolved_org

# Configure API client
config = Configuration(host=base_url, access_token=token)
Expand Down
7 changes: 6 additions & 1 deletion src/codegen/agents/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
CODEGEN_BASE_API_URL = "https://codegen-sh--rest-api.modal.run"
import os

from codegen.cli.api.endpoints import API_ENDPOINT

# Prefer explicit override; fall back to the CLI's unified API endpoint
CODEGEN_BASE_API_URL = os.environ.get("CODEGEN_API_BASE_URL", API_ENDPOINT.rstrip("/"))
6 changes: 0 additions & 6 deletions src/codegen/cli/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,3 @@ def _make_request(
except requests.RequestException as e:
msg = f"Network error: {e!s}"
raise ServerError(msg)

def identify(self) -> Identity:
"""Get user identity information."""
# TODO: Implement actual API call to identity endpoint
# For now, return a mock identity with active status
return Identity(auth_context=AuthContext(status="active"))
7 changes: 7 additions & 0 deletions src/codegen/cli/api/endpoints.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from codegen.cli.api.modal import MODAL_PREFIX

RUN_ENDPOINT = f"https://{MODAL_PREFIX}--cli-run.modal.run"
Expand All @@ -11,3 +13,8 @@
PR_LOOKUP_ENDPOINT = f"https://{MODAL_PREFIX}--cli-pr-lookup.modal.run"
CODEGEN_SYSTEM_PROMPT_URL = "https://gist.githubusercontent.com/jayhack/15681a2ceaccd726f19e6fdb3a44738b/raw/17c08054e3931b3b7fdf424458269c9e607541e8/codegen-system-prompt.txt"
IMPROVE_ENDPOINT = f"https://{MODAL_PREFIX}--cli-improve.modal.run"
MCP_SERVER_ENDPOINT = f"https://{MODAL_PREFIX}--codegen-mcp-server.modal.run/mcp"

# API ENDPOINT
# Prefer explicit override via CODEGEN_API_BASE_URL; fallback to Modal-derived URL for current ENV
API_ENDPOINT = os.environ.get("CODEGEN_API_BASE_URL", f"https://{MODAL_PREFIX}--rest-api.modal.run/")
11 changes: 1 addition & 10 deletions src/codegen/cli/auth/token_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
import os
from pathlib import Path

from codegen.cli.api.client import RestAPI
from codegen.cli.auth.constants import AUTH_FILE, CONFIG_DIR
from codegen.cli.errors import AuthError


class TokenManager:
Expand All @@ -22,14 +20,7 @@ def _ensure_config_dir(self):
Path(self.config_dir).mkdir(parents=True, exist_ok=True)

def authenticate_token(self, token: str) -> None:
"""Authenticate the token with the api."""
identity = RestAPI(token).identify()
if not identity:
msg = "No identity found for session"
raise AuthError(msg)
if identity.auth_context.status != "active":
msg = "Current session is not active. API Token may be invalid or may have expired."
raise AuthError(msg)
"""Store the token locally."""
self.save_token(token)

def save_token(self, token: str) -> None:
Expand Down
1 change: 1 addition & 0 deletions src/codegen/cli/claude/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Claude Code proxy server and utilities."""
12 changes: 9 additions & 3 deletions src/codegen/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@

from codegen import __version__

# Import the actual command functions
from codegen.cli.commands.claude.main import claude

# Import config command (still a Typer app)
from codegen.cli.commands.config.main import config_command

# Import the actual command functions
from codegen.cli.commands.init.main import init
from codegen.cli.commands.integrations.main import integrations_app
from codegen.cli.commands.login.main import login
from codegen.cli.commands.logout.main import logout
from codegen.cli.commands.mcp.main import mcp
from codegen.cli.commands.profile.main import profile
from codegen.cli.commands.style_debug.main import style_debug
from codegen.cli.commands.tools.main import tools
from codegen.cli.commands.update.main import update

install(show_locals=True)
Expand All @@ -29,16 +32,19 @@ def version_callback(value: bool):
main = typer.Typer(name="codegen", help="Codegen CLI - Transform your code with AI.", rich_markup_mode="rich")

# Add individual commands to the main app
main.command("claude", help="Run Claude Code with OpenTelemetry monitoring and logging.")(claude)
main.command("init", help="Initialize or update the Codegen folder.")(init)
main.command("login", help="Store authentication token.")(login)
main.command("logout", help="Clear stored authentication token.")(logout)
main.command("mcp", help="Start the Codegen MCP server.")(mcp)
main.command("profile", help="Display information about the currently authenticated user.")(profile)
main.command("style-debug", help="Debug command to visualize CLI styling (spinners, etc).")(style_debug)
main.command("tools", help="List available tools from the Codegen API.")(tools)
main.command("update", help="Update Codegen to the latest or specified version")(update)

# Config is a group, so add it as a typer
# Add Typer apps as sub-applications
main.add_typer(config_command, name="config")
main.add_typer(integrations_app, name="integrations")


@main.callback()
Expand Down
Loading
Loading