-
Notifications
You must be signed in to change notification settings - Fork 55
feat: refactor claude code to use agentapi module #402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # registry/coder/modules/claude-code/README.md # registry/coder/modules/claude-code/main.tf # registry/coder/modules/claude-code/scripts/agentapi-start.sh # registry/coder/modules/claude-code/scripts/agentapi-wait-for-start.sh # registry/coder/modules/claude-code/testdata/agentapi-mock.js
@@ -1,117 +1,160 @@ | |||
--- | |||
display_name: Claude Code | |||
description: Run Claude Code in your workspace | |||
description: Run the Claude Code agent in your workspace to generate code and perform tasks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description: Run the Claude Code agent in your workspace to generate code and perform tasks. | |
description: Run the Claude Code agent in your workspace. |
- You must add the [Coder Login](https://registry.coder.com/modules/coder-login) module to your template | ||
|
||
The `codercom/oss-dogfood:latest` container image can be used for testing on container-based workspaces. | ||
- You must add the [Coder Login](https://registry.coder.com/modules/coder-login) module to your template for task reporting features. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- You must add the [Coder Login](https://registry.coder.com/modules/coder-login) module to your template for task reporting features. |
Not needed but please test.
|
||
The `codercom/oss-dogfood:latest` container image can be used for testing on container-based workspaces. | ||
- You must add the [Coder Login](https://registry.coder.com/modules/coder-login) module to your template for task reporting features. | ||
- An **Anthropic API key** is required for tasks. You can get one from the [Anthropic Console](https://console.anthropic.com/dashboard). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make Tasks also work with CLAUDE_SESSION_TOKEN. For Claude.ai Pro and Max plan users.
Here is community member talking about it.
https://discord.com/channels/747933592273027093/1404654368745193492/1404692501268529206
data "coder_parameter" "task_prompt" { | ||
type = "string" | ||
name = "AI Prompt" | ||
name = "AI Task Prompt" | ||
default = "" | ||
description = "Write a prompt for Claude Code" | ||
description = "Initial task prompt for Claude Code." | ||
mutable = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't we moving this into the module?
module "coder-login" { | ||
count = data.coder_workspace.me.start_count | ||
source = "registry.coder.com/coder/coder-login/coder" | ||
version = "1.0.31" # Use a recent version | ||
agent_id = coder_agent.example.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
module "coder-login" { | |
count = data.coder_workspace.me.start_count | |
source = "registry.coder.com/coder/coder-login/coder" | |
version = "1.0.31" # Use a recent version | |
agent_id = coder_agent.example.id |
This is not required.
claude_api_key = var.anthropic_api_key # required for tasks | ||
|
||
# --- Versioning --- | ||
claude_code_version = "1.0.82" # Pin to a specific version | ||
agentapi_version = "v0.6.1" | ||
|
||
# --- Task Configuration --- | ||
task_prompt = data.coder_parameter.task_prompt.value | ||
continue = true # will fail in a new workspace with no conversation/session to continue | ||
model = "sonnet" | ||
|
||
# --- Permissions & Tools --- | ||
permission_mode = "plan" | ||
|
||
# --- MCP Configuration --- | ||
mcp = <<-EOF | ||
{ | ||
"mcpServers": { | ||
"my-custom-tool": { | ||
"command": "my-tool-server" | ||
"args": ["--port", "8080"] | ||
} | ||
} | ||
} | ||
EOF | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please consult the doc I shared for the structure we want.
| `CODER_MCP_CLAUDE_CODER_PROMPT` | A custom coder prompt for Claude. | `""` | | ||
| `CODER_MCP_CLAUDE_CONFIG_PATH` | Path to the Claude configuration file. | `~/.claude.json` | | ||
| `CODER_MCP_CLAUDE_MD_PATH` | Path to a `CLAUDE.md` file for project-specific instructions. | `~/.claude/CLAUDE.md` | | ||
| `CLAUDE_CODE_USE_BEDROCK` | Set to `"true"` to use Amazon Bedrock. Requires additional AWS configuration. | `""` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets make Bedrock and Vertex configuration its own example.
env = { | ||
CLAUDE_API_KEY = var.anthropic_api_key | ||
CODER_MCP_CLAUDE_SYSTEM_PROMPT = <<-EOT | ||
You are a helpful assistant that can help with code. | ||
EOT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? can't we handle them through the module.
Closes #
Description
Type of Change
Module Information
Path:
registry/[namespace]/modules/[module-name]
New version:
v3.0.0
Breaking change: [ ] Yes [ ] No
Testing & Validation
bun test
)bun run fmt
)Related Issues