|
1 | 1 | --- |
2 | | -display_name: sourcegraph_amp |
3 | | -description: Describe what this module does |
| 2 | + |
| 3 | +display\_name: Sourcegraph AMP |
4 | 4 | icon: ../../../../.icons/sourcegraph-amp.svg |
5 | | -verified: false |
6 | | -tags: [helper] |
7 | | ---- |
| 5 | +description: Run Sourcegraph AMP CLI in your workspace with AgentAPI integration |
| 6 | +verified: true |
| 7 | +tags: \[agent, sourcegraph, amp, ai, tasks] |
| 8 | +------------------------------------------- |
8 | 9 |
|
9 | | -# sourcegraph_amp |
| 10 | +# Sourcegraph AMP CLI |
10 | 11 |
|
11 | | -<!-- Describes what this module does --> |
| 12 | +Run [Sourcegraph AMP CLI](https://sourcegraph.com/amp) in your workspace to access Sourcegraph's AI-powered code search and analysis tools, with AgentAPI integration for seamless Coder Tasks support. |
12 | 13 |
|
13 | 14 | ```tf |
14 | 15 | module "sourcegraph_amp" { |
15 | | - count = data.coder_workspace.me.start_count |
16 | | - source = "registry.coder.com/harsh9485/sourcegraph_amp/coder" |
17 | | - version = "1.0.0" |
| 16 | + source = "registry.coder.com/harsh9485/sourcegraph-amp/coder" |
| 17 | + version = "1.0.0" |
| 18 | + agent_id = coder_agent.example.id |
| 19 | + sourcegraph_amp_api_key = var.sourcegraph_amp_api_key |
| 20 | + install_sourcegraph-amp = true |
| 21 | + agentapi_version = "latest" |
18 | 22 | } |
19 | 23 | ``` |
20 | 24 |
|
21 | | -<!-- Add a screencast or screenshot here put them in .images directory --> |
| 25 | +## Prerequisites |
22 | 26 |
|
23 | | -## Examples |
| 27 | +* Include the [Coder Login](https://registry.coder.com/modules/coder-login/coder) module in your template |
| 28 | +* Node.js and npm are automatically installed (via NVM) if not already available |
24 | 29 |
|
25 | | -### Example 1 |
26 | | - |
27 | | -Install the Dracula theme from [OpenVSX](https://open-vsx.org/): |
| 30 | +## Usage Example |
28 | 31 |
|
29 | 32 | ```tf |
| 33 | +variable "sourcegraph_amp_api_key" { |
| 34 | + type = string |
| 35 | + description = "Sourcegraph AMP API key" |
| 36 | + sensitive = true |
| 37 | +} |
| 38 | +
|
30 | 39 | module "sourcegraph_amp" { |
31 | | - count = data.coder_workspace.me.start_count |
32 | | - source = "registry.coder.com/NAMESPACE/sourcegraph_amp/coder" |
33 | | - version = "1.0.0" |
34 | | - agent_id = coder_agent.example.id |
35 | | - extensions = [ |
36 | | - "dracula-theme.theme-dracula" |
37 | | - ] |
| 40 | + count = data.coder_workspace.me.start_count |
| 41 | + source = "registry.coder.com/harsh9485/sourcegraph-amp/coder" |
| 42 | + version = "1.0.0" |
| 43 | + agent_id = coder_agent.example.id |
| 44 | + sourcegraph_amp_api_key = var.sourcegraph_amp_api_key # recommended for authenticated usage |
| 45 | + install_sourcegraph-amp = true |
38 | 46 | } |
39 | 47 | ``` |
40 | 48 |
|
41 | | -Enter the `<author>.<name>` into the extensions array and code-server will automatically install on start. |
| 49 | +## How it Works |
42 | 50 |
|
43 | | -### Example 2 |
| 51 | +* **Install**: Installs Sourcegraph AMP CLI using npm (installs Node.js via NVM if required) |
| 52 | +* **Start**: Launches AMP CLI in the specified directory, wrapped with AgentAPI to enable tasks and AI interactions |
| 53 | +* **Environment Variables**: Sets `SOURCEGRAPH_AMP_API_KEY` and `SOURCEGRAPH_AMP_START_DIRECTORY` for the CLI execution |
44 | 54 |
|
45 | | -Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson) file: |
| 55 | +## Troubleshooting |
46 | 56 |
|
47 | | -```tf |
48 | | -module "sourcegraph_amp" { |
49 | | - count = data.coder_workspace.me.start_count |
50 | | - source = "registry.coder.com/NAMESPACE/sourcegraph_amp/coder" |
51 | | - version = "1.0.0" |
52 | | - agent_id = coder_agent.example.id |
53 | | - extensions = ["dracula-theme.theme-dracula"] |
54 | | - settings = { |
55 | | - "workbench.colorTheme" = "Dracula" |
56 | | - } |
57 | | -} |
58 | | -``` |
| 57 | +* If `amp` is not found, ensure `install_sourcegraph-amp = true` and your API key is valid |
| 58 | +* Logs are written under `/home/coder/.sourcegraph-amp-module/` (`install.log`, `agentapi-start.log`) for debugging |
| 59 | +* If AgentAPI fails to start, verify that your container has network access and executable permissions for the scripts |
59 | 60 |
|
60 | | -### Example 3 |
| 61 | +> \[!IMPORTANT] |
| 62 | +> For using **Coder Tasks** with Sourcegraph AMP, make sure to pass the `AI Prompt` parameter and set `sourcegraph_amp_api_key`. |
| 63 | +> This ensures task reporting and status updates work seamlessly. |
61 | 64 |
|
62 | | -Run code-server in the background, don't fetch it from GitHub: |
| 65 | +## References |
63 | 66 |
|
64 | | -```tf |
65 | | -module "sourcegraph_amp" { |
66 | | - source = "registry.coder.com/NAMESPACE/sourcegraph_amp/coder" |
67 | | - version = "1.0.0" |
68 | | - agent_id = coder_agent.example.id |
69 | | - offline = true |
70 | | -} |
71 | | -``` |
| 67 | +* [Sourcegraph AMP Documentation](https://sourcegraph.com/amp) |
| 68 | +* [AgentAPI Documentation](https://github.com/coder/agentapi) |
| 69 | +* [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents) |
0 commit comments