Skip to content

Commit bff6ec1

Browse files
docs: cleanup readme, and align with other ai modules
1 parent fac2803 commit bff6ec1

File tree

1 file changed

+9
-92
lines changed
  • registry/coder-labs/modules/copilot-cli

1 file changed

+9
-92
lines changed

registry/coder-labs/modules/copilot-cli/README.md

Lines changed: 9 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ module "copilot_cli" {
2727
- **Node.js v22+** and **npm v10+**
2828
- **Active Copilot subscription** (GitHub Copilot Pro, Pro+, Business, or Enterprise)
2929
- **GitHub authentication** via one of:
30-
- Direct token via `github_token` variable (highest priority)
30+
- Direct token via `github_token` variable
3131
- Coder external authentication (recommended)
32-
- GitHub CLI (`gh auth login`)
33-
- Or use interactive login in Copilot CLI
32+
- Interactive login in Copilot CLI
3433

3534
## Examples
3635

@@ -53,6 +52,7 @@ module "copilot_cli" {
5352
agent_id = coder_agent.example.id
5453
workdir = "/home/coder/project"
5554
55+
github_token = "your_github_token_here" # Or use data.coder_external_auth.github.access_token
5656
ai_prompt = data.coder_parameter.ai_prompt.value
5757
copilot_model = "claude-sonnet-4.5"
5858
allow_all_tools = true
@@ -102,8 +102,6 @@ module "copilot_cli" {
102102

103103
### Direct Token Authentication
104104

105-
Use a GitHub token directly (OAuth token or Personal Access Token):
106-
107105
```tf
108106
module "copilot_cli" {
109107
source = "registry.coder.com/coder-labs/copilot-cli/coder"
@@ -114,15 +112,6 @@ module "copilot_cli" {
114112
}
115113
```
116114

117-
## Configuration Files
118-
119-
This module creates and manages configuration files in `~/.copilot/`:
120-
121-
- `config.json` - Copilot CLI settings (banner, theme, trusted directories)
122-
- `mcp-config.json` - Model Context Protocol server definitions
123-
124-
The module automatically configures GitHub and Coder MCP servers, and merges any custom MCP servers you provide via `mcp_config`.
125-
126115
### Standalone Mode
127116

128117
Run and configure Copilot CLI as a standalone tool in your workspace.
@@ -160,98 +149,26 @@ module "copilot_cli" {
160149
}
161150
```
162151

163-
### System Prompt Configuration
164-
165-
You can customize the behavior of Copilot CLI by providing a system prompt that will be combined with task prompts:
166-
167-
```tf
168-
module "copilot_cli" {
169-
source = "registry.coder.com/coder-labs/copilot-cli/coder"
170-
version = "1.0.0"
171-
agent_id = coder_agent.example.id
172-
workdir = "/home/coder/project"
173-
174-
system_prompt = <<-EOT
175-
You are a senior software engineer helping with code development.
176-
Always prioritize:
177-
- Code quality and best practices
178-
- Security considerations
179-
- Performance optimization
180-
- Clear documentation and comments
181-
182-
When suggesting changes, explain the reasoning behind your recommendations.
183-
Send a task status update to notify the user that you are ready for input, and then wait for user input.
184-
EOT
185-
}
186-
```
187-
188152
## Authentication
189153

190-
This module works with multiple GitHub authentication methods in priority order:
191-
192-
**1. Direct Token :**
193-
194-
- **`github_token` variable**: Provide a GitHub OAuth token or Personal Access Token directly to the module
154+
The module supports multiple authentication methods (in priority order):
195155

196-
**2. Automatic detection:**
197-
198-
- **Coder External Auth**: OAuth tokens from GitHub external authentication configured in Coder
199-
- **GitHub CLI**: OAuth tokens from `gh auth login` in the workspace
200-
201-
**3. Interactive fallback:**
202-
203-
- **Interactive login**: If no authentication is found, Copilot CLI will prompt users to login via the `/login` slash command
204-
205-
**No setup required** for automatic methods - the module detects and uses whatever authentication is available.
156+
1. **Direct Token** - Pass `github_token` variable (OAuth or Personal Access Token)
157+
2. **Coder External Auth** - Automatic if GitHub external auth is configured in Coder
158+
3. **Interactive** - Copilot CLI prompts for login via `/login` command if no auth found
206159

207160
> **Note**: OAuth tokens work best with Copilot CLI. Personal Access Tokens may have limited functionality.
208161
209162
## Session Resumption
210163

211-
By default (`resume_session = true`), this module automatically resumes the latest Copilot CLI session when the workspace is restarted. This provides a seamless experience where:
212-
213-
- **Previous conversations continue** - No need to re-establish context
214-
- **No duplicate prompts** - Initial prompts are only sent on first workspace creation
215-
- **Workspace restart handling** - Automatically detects and resumes existing sessions
216-
217-
```tf
218-
module "copilot_cli" {
219-
source = "registry.coder.com/coder-labs/copilot-cli/coder"
220-
version = "1.0.0"
221-
agent_id = coder_agent.example.id
222-
workdir = "/home/coder/project"
223-
224-
resume_session = true # Default: automatically resume sessions
225-
# resume_session = false # Always start fresh sessions
226-
}
227-
```
164+
By default, the module resumes the latest Copilot CLI session when the workspace restarts. Set `resume_session = false` to always start fresh sessions.
228165

229166
## Task Reporting
230167

231-
When `report_tasks = true` (default), this module automatically configures and starts the **Coder MCP server** for task reporting integration:
232-
233-
- **Automatic Configuration**: The Coder MCP server is added to the MCP configuration automatically
234-
235-
- **Task Status Updates**: Copilot CLI can report task progress to the Coder UI
236-
- **No Manual Setup**: Works out-of-the-box with Coder's task reporting system
237-
- **Custom MCP Compatible**: If you provide custom `mcp_config`, the Coder MCP server is added alongside your custom servers
238-
239-
The Coder MCP server enables Copilot CLI to:
240-
241-
- Report task status (working, complete, failure)
242-
- Send progress updates to the Coder dashboard
243-
- Integrate with Coder's AI task workflow system
168+
When enabled (default), Copilot CLI can report task progress to the Coder UI using [AgentAPI](https://github.com/coder/agentapi). Custom MCP servers provided via `mcp_config` are merged with the Coder MCP server automatically.
244169

245170
To disable task reporting, set `report_tasks = false`.
246171

247-
### MCP Server Configuration
248-
249-
This module automatically configures MCP servers by:
250-
251-
1. **Writing MCP Configuration**: Creates `~/.copilot/mcp-config.json` with the correct format
252-
2. **Wrapper Script**: Creates `/tmp/coder-mcp-server.sh` that sets environment variables and runs `coder exp mcp server`
253-
3. **Merging Custom Servers**: Adds any custom MCP servers you provide via the `mcp_config` variable
254-
255172
## Troubleshooting
256173

257174
If you encounter any issues, check the log files in the `~/.copilot-module` directory within your workspace for detailed information.

0 commit comments

Comments
 (0)