codegpt-ai 1.25.0 → 1.26.0
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.
- package/chat.py +34 -0
- package/package.json +1 -1
package/chat.py
CHANGED
|
@@ -2986,8 +2986,12 @@ def build_codegpt_context(messages=None):
|
|
|
2986
2986
|
"pipe_dir": str(MSG_PIPE_DIR),
|
|
2987
2987
|
"unread_messages": bus_unread("codegpt"),
|
|
2988
2988
|
|
|
2989
|
+
# Tool roles
|
|
2990
|
+
"tool_roles": TOOL_ROLES,
|
|
2991
|
+
|
|
2989
2992
|
"instructions": (
|
|
2990
2993
|
"You are connected to CodeGPT, a local AI assistant hub. "
|
|
2994
|
+
"Check $CODEGPT_TOOL_ROLE for your specific job. "
|
|
2991
2995
|
"The user's name is shown above. Their memories contain persistent context. "
|
|
2992
2996
|
"Recent messages show what they were discussing before launching you. "
|
|
2993
2997
|
"Project files are Python source in the project_dir. "
|
|
@@ -3003,12 +3007,38 @@ def build_codegpt_context(messages=None):
|
|
|
3003
3007
|
return context_file
|
|
3004
3008
|
|
|
3005
3009
|
|
|
3010
|
+
# Tool role descriptions — what each tool's job is when launched from CodeGPT
|
|
3011
|
+
TOOL_ROLES = {
|
|
3012
|
+
"claude": "You are Claude Code, the primary coding assistant. Edit files, run commands, debug code. You have full access to the CodeGPT project.",
|
|
3013
|
+
"openclaw": "You are OpenClaw, a personal AI assistant. Help with tasks, answer questions, manage workflows. You're running inside CodeGPT's sandbox.",
|
|
3014
|
+
"codex": "You are Codex, OpenAI's coding agent. Write and edit code, fix bugs, refactor. You have access to the CodeGPT project files.",
|
|
3015
|
+
"gemini": "You are Gemini CLI, Google's AI. Help with coding, research, and analysis. You have access to the CodeGPT project.",
|
|
3016
|
+
"copilot": "You are GitHub Copilot. Suggest code completions, write functions, help with git workflows.",
|
|
3017
|
+
"cline": "You are Cline, an autonomous coding agent. Plan and implement features, fix bugs, refactor code across multiple files.",
|
|
3018
|
+
"aider": "You are Aider, an AI pair programmer. Edit files based on user instructions. Focus on clean, working code changes.",
|
|
3019
|
+
"interpreter": "You are Open Interpreter. Run code, install packages, manage files. Execute the user's instructions step by step.",
|
|
3020
|
+
"shellgpt": "You are ShellGPT. Generate shell commands from natural language. Be precise and safe.",
|
|
3021
|
+
"opencode": "You are OpenCode, a terminal IDE. Help write, edit, and manage code projects.",
|
|
3022
|
+
"llm": "You are LLM CLI. Chat with various AI models. Help the user with questions and tasks.",
|
|
3023
|
+
"litellm": "You are LiteLLM. Provide a unified interface to 100+ AI models. Help route requests to the best model.",
|
|
3024
|
+
"gorilla": "You are Gorilla CLI. Generate accurate CLI commands from natural language descriptions.",
|
|
3025
|
+
"chatgpt": "You are ChatGPT CLI. Have helpful conversations, answer questions, write content.",
|
|
3026
|
+
"opencommit": "You are OpenCommit. Generate clear, descriptive git commit messages from staged changes.",
|
|
3027
|
+
"aipick": "You are AIPick. Help select and craft the best git commits with AI assistance.",
|
|
3028
|
+
"cursor": "You are Cursor CLI. Help with code editing, navigation, and AI-powered development.",
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
|
|
3006
3032
|
def build_tool_env(tool_name):
|
|
3007
3033
|
"""Build environment variables for a launched tool."""
|
|
3008
3034
|
project_dir = str(Path(__file__).parent)
|
|
3009
3035
|
env = os.environ.copy()
|
|
3010
3036
|
profile = load_profile()
|
|
3011
3037
|
|
|
3038
|
+
# Tool's specific role/job
|
|
3039
|
+
role = TOOL_ROLES.get(tool_name, f"You are {tool_name}, launched from CodeGPT. Help the user with their task.")
|
|
3040
|
+
tool_info = AI_TOOLS.get(tool_name, {})
|
|
3041
|
+
|
|
3012
3042
|
# Inject CodeGPT context into every tool
|
|
3013
3043
|
env["CODEGPT_HOME"] = str(Path.home() / ".codegpt")
|
|
3014
3044
|
env["CODEGPT_PROJECT"] = project_dir
|
|
@@ -3018,11 +3048,15 @@ def build_tool_env(tool_name):
|
|
|
3018
3048
|
env["CODEGPT_TRAINING"] = str(Path.home() / ".codegpt" / "training")
|
|
3019
3049
|
env["CODEGPT_CHATS"] = str(Path.home() / ".codegpt" / "chats")
|
|
3020
3050
|
env["CODEGPT_TOOL"] = tool_name
|
|
3051
|
+
env["CODEGPT_TOOL_ROLE"] = role
|
|
3052
|
+
env["CODEGPT_TOOL_DESC"] = tool_info.get("desc", "")
|
|
3021
3053
|
env["CODEGPT_USER"] = profile.get("name", "")
|
|
3022
3054
|
env["CODEGPT_MODEL"] = profile.get("model", MODEL)
|
|
3023
3055
|
env["CODEGPT_PERSONA"] = profile.get("persona", "default")
|
|
3024
3056
|
env["CODEGPT_SESSIONS"] = str(profile.get("total_sessions", 0))
|
|
3025
3057
|
env["CODEGPT_TOTAL_MSGS"] = str(profile.get("total_messages", 0))
|
|
3058
|
+
env["CODEGPT_APP"] = "CodeGPT — Local AI Assistant Hub"
|
|
3059
|
+
env["CODEGPT_VERSION"] = "2.0"
|
|
3026
3060
|
|
|
3027
3061
|
return env
|
|
3028
3062
|
|