Skip to content

Commit a42eee5

Browse files
committed
Add README file for the module
1 parent 83b002a commit a42eee5

File tree

4 files changed

+47
-61
lines changed

4 files changed

+47
-61
lines changed

registry/harsh9485/modules/README.md

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,69 @@
11
---
2-
display_name: sourcegraph_amp
3-
description: Describe what this module does
2+
3+
display\_name: Sourcegraph AMP
44
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+
-------------------------------------------
89

9-
# sourcegraph_amp
10+
# Sourcegraph AMP CLI
1011

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.
1213

1314
```tf
1415
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"
1822
}
1923
```
2024

21-
<!-- Add a screencast or screenshot here put them in .images directory -->
25+
## Prerequisites
2226

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
2429

25-
### Example 1
26-
27-
Install the Dracula theme from [OpenVSX](https://open-vsx.org/):
30+
## Usage Example
2831

2932
```tf
33+
variable "sourcegraph_amp_api_key" {
34+
type = string
35+
description = "Sourcegraph AMP API key"
36+
sensitive = true
37+
}
38+
3039
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
3846
}
3947
```
4048

41-
Enter the `<author>.<name>` into the extensions array and code-server will automatically install on start.
49+
## How it Works
4250

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
4454

45-
Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson) file:
55+
## Troubleshooting
4656

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
5960

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.
6164

62-
Run code-server in the background, don't fetch it from GitHub:
65+
## References
6366

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)

registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ function install_sourcegraph_amp() {
3030
ensure_node
3131
printf "%b Installing Sourcegraph AMP CLI...%b\n" "$BOLD"
3232
npm install -g @sourcegraph/amp
33-
export AMP_API_KEY="$SOURCEGRAPH_AMP_API_KEY"
3433
printf "%b Installation complete.%b\n" "$BOLD"
3534
fi
3635
}

registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ else
2323
mkdir -p "$dir"
2424
fi
2525
cd "$dir"
26-
26+
echo "Add AMP API key"
27+
export AMP_API_KEY=$SOURCEGRAPH_AMP_API_KEY
2728
# Launch AgentAPI server with AMP
2829
agentapi server --term-width=67 --term-height=1190 -- amp

0 commit comments

Comments
 (0)