From 8c438154557d7d1ad238de6e97f448d749597f58 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Tue, 29 Jul 2025 10:13:23 +0530 Subject: [PATCH 01/24] Add main files for Sourcegraph Amp module --- registry/harsh9485/modules/README.md | 12 ++ .../modules/sourcegraph_amp/README.md | 71 ++++++++ .../modules/sourcegraph_amp/main.test.ts | 28 +++ .../harsh9485/modules/sourcegraph_amp/main.tf | 162 ++++++++++++++++++ .../sourcegraph_amp/scripts/install.sh | 38 ++++ .../modules/sourcegraph_amp/scripts/start.sh | 28 +++ 6 files changed, 339 insertions(+) create mode 100644 registry/harsh9485/modules/README.md create mode 100644 registry/harsh9485/modules/sourcegraph_amp/README.md create mode 100644 registry/harsh9485/modules/sourcegraph_amp/main.test.ts create mode 100644 registry/harsh9485/modules/sourcegraph_amp/main.tf create mode 100644 registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh create mode 100644 registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh diff --git a/registry/harsh9485/modules/README.md b/registry/harsh9485/modules/README.md new file mode 100644 index 000000000..9f16b7187 --- /dev/null +++ b/registry/harsh9485/modules/README.md @@ -0,0 +1,12 @@ +--- +display_name: "harsh9485" +bio: "Brief description of what you do" +avatar: "./.images/avatar.png" +website: "https://your-website.com" +support_email: "panwarharshwardhan67@gmail.com" +status: "community" +--- + +# Your Name + +Brief description of who you are and what you do. diff --git a/registry/harsh9485/modules/sourcegraph_amp/README.md b/registry/harsh9485/modules/sourcegraph_amp/README.md new file mode 100644 index 000000000..aa898a298 --- /dev/null +++ b/registry/harsh9485/modules/sourcegraph_amp/README.md @@ -0,0 +1,71 @@ +--- +display_name: sourcegraph_amp +description: Describe what this module does +icon: ../../../../.icons/sourcegraph-amp.svg +verified: false +tags: [helper] +--- + +# sourcegraph_amp + + + +```tf +module "sourcegraph_amp" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/harsh9485/sourcegraph_amp/coder" + version = "1.0.0" +} +``` + + + +## Examples + +### Example 1 + +Install the Dracula theme from [OpenVSX](https://open-vsx.org/): + +```tf +module "sourcegraph_amp" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/NAMESPACE/sourcegraph_amp/coder" + version = "1.0.0" + agent_id = coder_agent.example.id + extensions = [ + "dracula-theme.theme-dracula" + ] +} +``` + +Enter the `.` into the extensions array and code-server will automatically install on start. + +### Example 2 + +Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson) file: + +```tf +module "sourcegraph_amp" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/NAMESPACE/sourcegraph_amp/coder" + version = "1.0.0" + agent_id = coder_agent.example.id + extensions = ["dracula-theme.theme-dracula"] + settings = { + "workbench.colorTheme" = "Dracula" + } +} +``` + +### Example 3 + +Run code-server in the background, don't fetch it from GitHub: + +```tf +module "sourcegraph_amp" { + source = "registry.coder.com/NAMESPACE/sourcegraph_amp/coder" + version = "1.0.0" + agent_id = coder_agent.example.id + offline = true +} +``` diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.test.ts b/registry/harsh9485/modules/sourcegraph_amp/main.test.ts new file mode 100644 index 000000000..891614266 --- /dev/null +++ b/registry/harsh9485/modules/sourcegraph_amp/main.test.ts @@ -0,0 +1,28 @@ +import { describe, it, expect } from "bun:test"; +import { + runTerraformInit, + runTerraformApply, + testRequiredVariables, + findResourceInstance, +} from "~test"; +import path from "path"; + +const moduleDir = path.resolve(__dirname); +const requiredVars = { agent_id: "dummy-agent-id" }; + +describe("sourcegraph-amp module", () => { + it("initializes and applies without errors", async () => { + await runTerraformInit(moduleDir); + testRequiredVariables(moduleDir, requiredVars); + + const state = await runTerraformApply(moduleDir, requiredVars); + const script = findResourceInstance(state, "coder_script"); + + expect(script).toBeDefined(); + expect(script.agent_id).toBe(requiredVars.agent_id); + expect(script.script).toContain("ARG_INSTALL_SOURCEGRAPH_AMP='true'"); + expect(script.script).toContain("ARG_AGENTAPI_VERSION='v0.3.0'"); + expect(script.script).toMatch(/\/tmp\/install\.sh/); + expect(script.script).toMatch(/\/tmp\/start\.sh/); + }); +}); \ No newline at end of file diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.tf b/registry/harsh9485/modules/sourcegraph_amp/main.tf new file mode 100644 index 000000000..b980ff961 --- /dev/null +++ b/registry/harsh9485/modules/sourcegraph_amp/main.tf @@ -0,0 +1,162 @@ +terraform { + required_version = ">= 1.0" + + required_providers { + coder = { + source = "coder/coder" + version = ">= 2.7" + } + } +} + +variable "agent_id" { + type = string + description = "The ID of a Coder agent." +} + +data "coder_workspace" "me" {} + +data "coder_workspace_owner" "me" {} + + +variable "order" { + type = number + description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)." + default = null +} + +variable "group" { + type = string + description = "The name of a group that this app belongs to." + default = null +} + +variable "icon" { + type = string + description = "The icon to use for the app." + default = "/icon/sourcegraph-amp.svg" +} + +variable "folder" { + type = string + description = "The folder to run sourcegraph-amp in." + default = "/home/coder/sourcegraph-amp" +} + +variable "install_sourcegraph-amp" { + type = bool + description = "Whether to install sourcegraph-amp." + default = true +} + +variable "sourcegraph-amp_api_key" { + type = string + description = "sourcegraph-amp API Key" + default = "" +} + +resource "coder_env" "sourcegraph-amp_api_key" { + agent_id = var.agent_id + name = "SOURCEGRAPH_AMP_API_KEY" + value = var.sourcegraph-amp_api_key +} + +variable "install_agentapi" { + type = bool + description = "Whether to install AgentAPI." + default = true +} + +variable "agentapi_version" { + type = string + description = "The version of AgentAPI to install." + default = "v0.3.0" +} + +variable "pre_install_script" { + type = string + description = "Custom script to run before installing sourcegraph-amp" + default = null +} + +variable "post_install_script" { + type = string + description = "Custom script to run after installing sourcegraph-amp." + default = null +} + +locals { + base_extensions = <<-EOT +{ + "coder": { + "args": [ + "exp", + "mcp", + "server" + ], + "command": "coder", + "description": "Report ALL tasks and statuses (in progress, done, failed) you are working on.", + "enabled": true, + "env": { + "CODER_MCP_APP_STATUS_SLUG": "${local.app_slug}", + "CODER_MCP_AI_AGENTAPI_URL": "http://localhost:3284" + }, + "name": "Coder", + "timeout": 3000, + "type": "stdio", + "trust": true + } +} +EOT + + app_slug = "sourcegraph-amp" + install_script = file("${path.module}/scripts/install.sh") + start_script = file("${path.module}/scripts/start.sh") + module_dir_name = ".sourcegraph-amp-module" +} + +module "agentapi" { + source = "registry.coder.com/coder/agentapi/coder" + version = "1.0.1" + + agent_id = var.agent_id + web_app_slug = local.app_slug + web_app_order = var.order + web_app_group = var.group + web_app_icon = var.icon + web_app_display_name = "Sourcegraph Amp" + cli_app_slug = "${local.app_slug}-cli" + cli_app_display_name = "Sourcegraph Amp CLI" + module_dir_name = local.module_dir_name + install_agentapi = var.install_agentapi + agentapi_version = var.agentapi_version + pre_install_script = var.pre_install_script + post_install_script = var.post_install_script + start_script = <<-EOT + #!/bin/bash + set -o errexit + set -o pipefail + + echo -n '${base64encode(local.start_script)}' | base64 -d > /tmp/start.sh + chmod +x /tmp/start.sh + SOURCEGRAPH_AMP_API_KEY='${var.sourcegraph-amp_api_key}' \ + SOURCEGRAPH_AMP_START_DIRECTORY='${var.folder}' \ + /tmp/start.sh + EOT + + install_script = <<-EOT + #!/bin/bash + set -o errexit + set -o pipefail + + echo -n '${base64encode(local.install_script)}' | base64 -d > /tmp/install.sh + chmod +x /tmp/install.sh + ARG_INSTALL_SOURCEGRAPH_AMP='${var.install_sourcegraph-amp}' \ + SOURCEGRAPH_AMP_START_DIRECTORY='${var.folder}' \ + SOURCEGRAPH_AMP_API_KEY='${var.sourcegraph-amp_api_key}' \ + BASE_EXTENSIONS='${replace(local.base_extensions, "'", "'\\''")}' \ + /tmp/install.sh + EOT +} + + diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh new file mode 100644 index 000000000..033d5a015 --- /dev/null +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -euo pipefail + +# ANSI colors +BOLD='\033[1m' +RESET='\033[0m' + +# Print arguments +echo "--------------------------------" +echo "Install flag: $ARG_INSTALL_SOURCEGRAPH_AMP" +echo "Workspace: $SOURCEGRAPH_AMP_START_DIRECTORY" +echo "--------------------------------" + +# Check for npm/node and install via nvm if missing +function ensure_node() { + if ! command -v npm &>/dev/null; then + echo "npm not found. Installing Node.js via NVM..." + export NVM_DIR="$HOME/.nvm" + mkdir -p "$NVM_DIR" + curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash + # shellcheck source=/dev/null + source "$NVM_DIR/nvm.sh" + nvm install --lts + nvm alias default node + fi +} + +function install_sourcegraph_amp() { + if [[ "$ARG_INSTALL_SOURCEGRAPH_AMP" == "true" ]]; then + ensure_node + printf "%b Installing Sourcegraph AMP CLI...%b\n" "$BOLD" "$RESET" + npm install -g @sourcegraph/amp + export AMP_API_KEY="$SOURCEGRAPH_AMP_API_KEY" + printf "%b Installation complete.%b\n" "$BOLD" "$RESET" + fi +} + +install_sourcegraph_amp \ No newline at end of file diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh new file mode 100644 index 000000000..004eeeafd --- /dev/null +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Load user environment +# shellcheck source=/dev/null +source "$HOME/.bashrc" +# shellcheck source=/dev/null +source "$HOME/.nvm/nvm.sh" + +function ensure_command() { + command -v "$1" &>/dev/null || { echo "Error: '$1' not found." >&2; exit 1; } +} + +ensure_command amp +echo "AMP version: $(amp --version)" + + +dir="$SOURCEGRAPH_AMP_START_DIRECTORY" +if [[ -d "$dir" ]]; then + echo "Using existing directory: $dir" +else + echo "Creating directory: $dir" + mkdir -p "$dir" +fi +cd "$dir" + +# Launch AgentAPI server with AMP +agentapi server --term-width=67 --term-height=1190 -- amp \ No newline at end of file From 807650f5883dcb86e3c85cccc1aefc25e9bc85bc Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Thu, 31 Jul 2025 21:30:17 +0530 Subject: [PATCH 02/24] LF-error-solved --- .icons/sourcegraph-amp.svg | 7 +++ .../harsh9485/modules/sourcegraph_amp/main.tf | 43 +++++++++---------- .../sourcegraph_amp/scripts/install.sh | 8 ++-- .../modules/sourcegraph_amp/scripts/start.sh | 2 +- 4 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 .icons/sourcegraph-amp.svg diff --git a/.icons/sourcegraph-amp.svg b/.icons/sourcegraph-amp.svg new file mode 100644 index 000000000..cdcae4f21 --- /dev/null +++ b/.icons/sourcegraph-amp.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.tf b/registry/harsh9485/modules/sourcegraph_amp/main.tf index b980ff961..d755b5abc 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/main.tf +++ b/registry/harsh9485/modules/sourcegraph_amp/main.tf @@ -18,7 +18,6 @@ data "coder_workspace" "me" {} data "coder_workspace_owner" "me" {} - variable "order" { type = number description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)." @@ -40,7 +39,7 @@ variable "icon" { variable "folder" { type = string description = "The folder to run sourcegraph-amp in." - default = "/home/coder/sourcegraph-amp" + default = "/home/coder" } variable "install_sourcegraph-amp" { @@ -87,26 +86,26 @@ variable "post_install_script" { locals { base_extensions = <<-EOT -{ - "coder": { - "args": [ - "exp", - "mcp", - "server" - ], - "command": "coder", - "description": "Report ALL tasks and statuses (in progress, done, failed) you are working on.", - "enabled": true, - "env": { - "CODER_MCP_APP_STATUS_SLUG": "${local.app_slug}", - "CODER_MCP_AI_AGENTAPI_URL": "http://localhost:3284" - }, - "name": "Coder", - "timeout": 3000, - "type": "stdio", - "trust": true - } -} +coder: + args: + - exp + - mcp + - server + cmd: coder + description: Report ALL tasks and statuses (in progress, done, failed) you are working on. + enabled: true + envs: + CODER_MCP_APP_STATUS_SLUG: ${local.app_slug} + CODER_MCP_AI_AGENTAPI_URL: http://localhost:3284 + name: Coder + timeout: 3000 + type: stdio +developer: + display_name: Developer + enabled: true + name: developer + timeout: 300 + type: builtin EOT app_slug = "sourcegraph-amp" diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh index 033d5a015..de77cfedb 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh @@ -1,9 +1,9 @@ -#!/usr/bin/env bash +#!/bin/bash set -euo pipefail # ANSI colors BOLD='\033[1m' -RESET='\033[0m' + # Print arguments echo "--------------------------------" @@ -28,10 +28,10 @@ function ensure_node() { function install_sourcegraph_amp() { if [[ "$ARG_INSTALL_SOURCEGRAPH_AMP" == "true" ]]; then ensure_node - printf "%b Installing Sourcegraph AMP CLI...%b\n" "$BOLD" "$RESET" + printf "%b Installing Sourcegraph AMP CLI...%b\n" "$BOLD" npm install -g @sourcegraph/amp export AMP_API_KEY="$SOURCEGRAPH_AMP_API_KEY" - printf "%b Installation complete.%b\n" "$BOLD" "$RESET" + printf "%b Installation complete.%b\n" "$BOLD" fi } diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh index 004eeeafd..71c57c335 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash set -euo pipefail # Load user environment From a42eee526519a1e3dc9b6a363503b4a4fdcbd25a Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Sat, 2 Aug 2025 13:03:52 +0530 Subject: [PATCH 03/24] Add README file for the module --- registry/harsh9485/modules/README.md | 12 --- .../modules/sourcegraph_amp/README.md | 92 +++++++++---------- .../sourcegraph_amp/scripts/install.sh | 1 - .../modules/sourcegraph_amp/scripts/start.sh | 3 +- 4 files changed, 47 insertions(+), 61 deletions(-) delete mode 100644 registry/harsh9485/modules/README.md diff --git a/registry/harsh9485/modules/README.md b/registry/harsh9485/modules/README.md deleted file mode 100644 index 9f16b7187..000000000 --- a/registry/harsh9485/modules/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -display_name: "harsh9485" -bio: "Brief description of what you do" -avatar: "./.images/avatar.png" -website: "https://your-website.com" -support_email: "panwarharshwardhan67@gmail.com" -status: "community" ---- - -# Your Name - -Brief description of who you are and what you do. diff --git a/registry/harsh9485/modules/sourcegraph_amp/README.md b/registry/harsh9485/modules/sourcegraph_amp/README.md index aa898a298..2de73e41e 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/README.md +++ b/registry/harsh9485/modules/sourcegraph_amp/README.md @@ -1,71 +1,69 @@ --- -display_name: sourcegraph_amp -description: Describe what this module does + +display\_name: Sourcegraph AMP icon: ../../../../.icons/sourcegraph-amp.svg -verified: false -tags: [helper] ---- +description: Run Sourcegraph AMP CLI in your workspace with AgentAPI integration +verified: true +tags: \[agent, sourcegraph, amp, ai, tasks] +------------------------------------------- -# sourcegraph_amp +# Sourcegraph AMP CLI - +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. ```tf module "sourcegraph_amp" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/harsh9485/sourcegraph_amp/coder" - version = "1.0.0" + source = "registry.coder.com/harsh9485/sourcegraph-amp/coder" + version = "1.0.0" + agent_id = coder_agent.example.id + sourcegraph_amp_api_key = var.sourcegraph_amp_api_key + install_sourcegraph-amp = true + agentapi_version = "latest" } ``` - +## Prerequisites -## Examples +* Include the [Coder Login](https://registry.coder.com/modules/coder-login/coder) module in your template +* Node.js and npm are automatically installed (via NVM) if not already available -### Example 1 - -Install the Dracula theme from [OpenVSX](https://open-vsx.org/): +## Usage Example ```tf +variable "sourcegraph_amp_api_key" { + type = string + description = "Sourcegraph AMP API key" + sensitive = true +} + module "sourcegraph_amp" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/NAMESPACE/sourcegraph_amp/coder" - version = "1.0.0" - agent_id = coder_agent.example.id - extensions = [ - "dracula-theme.theme-dracula" - ] + count = data.coder_workspace.me.start_count + source = "registry.coder.com/harsh9485/sourcegraph-amp/coder" + version = "1.0.0" + agent_id = coder_agent.example.id + sourcegraph_amp_api_key = var.sourcegraph_amp_api_key # recommended for authenticated usage + install_sourcegraph-amp = true } ``` -Enter the `.` into the extensions array and code-server will automatically install on start. +## How it Works -### Example 2 +* **Install**: Installs Sourcegraph AMP CLI using npm (installs Node.js via NVM if required) +* **Start**: Launches AMP CLI in the specified directory, wrapped with AgentAPI to enable tasks and AI interactions +* **Environment Variables**: Sets `SOURCEGRAPH_AMP_API_KEY` and `SOURCEGRAPH_AMP_START_DIRECTORY` for the CLI execution -Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson) file: +## Troubleshooting -```tf -module "sourcegraph_amp" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/NAMESPACE/sourcegraph_amp/coder" - version = "1.0.0" - agent_id = coder_agent.example.id - extensions = ["dracula-theme.theme-dracula"] - settings = { - "workbench.colorTheme" = "Dracula" - } -} -``` +* If `amp` is not found, ensure `install_sourcegraph-amp = true` and your API key is valid +* Logs are written under `/home/coder/.sourcegraph-amp-module/` (`install.log`, `agentapi-start.log`) for debugging +* If AgentAPI fails to start, verify that your container has network access and executable permissions for the scripts -### Example 3 +> \[!IMPORTANT] +> For using **Coder Tasks** with Sourcegraph AMP, make sure to pass the `AI Prompt` parameter and set `sourcegraph_amp_api_key`. +> This ensures task reporting and status updates work seamlessly. -Run code-server in the background, don't fetch it from GitHub: +## References -```tf -module "sourcegraph_amp" { - source = "registry.coder.com/NAMESPACE/sourcegraph_amp/coder" - version = "1.0.0" - agent_id = coder_agent.example.id - offline = true -} -``` +* [Sourcegraph AMP Documentation](https://sourcegraph.com/amp) +* [AgentAPI Documentation](https://github.com/coder/agentapi) +* [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents) diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh index de77cfedb..a9c58ed21 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh @@ -30,7 +30,6 @@ function install_sourcegraph_amp() { ensure_node printf "%b Installing Sourcegraph AMP CLI...%b\n" "$BOLD" npm install -g @sourcegraph/amp - export AMP_API_KEY="$SOURCEGRAPH_AMP_API_KEY" printf "%b Installation complete.%b\n" "$BOLD" fi } diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh index 71c57c335..df8ec7ef9 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh @@ -23,6 +23,7 @@ else mkdir -p "$dir" fi cd "$dir" - +echo "Add AMP API key" +export AMP_API_KEY=$SOURCEGRAPH_AMP_API_KEY # Launch AgentAPI server with AMP agentapi server --term-width=67 --term-height=1190 -- amp \ No newline at end of file From 667b1c1c499cf55a0d834fd18b2f13083f1826c6 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Mon, 4 Aug 2025 15:49:44 +0530 Subject: [PATCH 04/24] Add test suite --- .../modules/sourcegraph_amp/README.md | 2 +- .../modules/sourcegraph_amp/main.test.ts | 150 +++++++++++++++--- .../harsh9485/modules/sourcegraph_amp/main.tf | 1 - .../sourcegraph_amp/scripts/install.sh | 63 +++++--- .../sourcegraph_amp/testdata/amp-mock.sh | 14 ++ 5 files changed, 182 insertions(+), 48 deletions(-) create mode 100644 registry/harsh9485/modules/sourcegraph_amp/testdata/amp-mock.sh diff --git a/registry/harsh9485/modules/sourcegraph_amp/README.md b/registry/harsh9485/modules/sourcegraph_amp/README.md index 2de73e41e..66e43ba7c 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/README.md +++ b/registry/harsh9485/modules/sourcegraph_amp/README.md @@ -5,7 +5,7 @@ icon: ../../../../.icons/sourcegraph-amp.svg description: Run Sourcegraph AMP CLI in your workspace with AgentAPI integration verified: true tags: \[agent, sourcegraph, amp, ai, tasks] -------------------------------------------- +--- # Sourcegraph AMP CLI diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.test.ts b/registry/harsh9485/modules/sourcegraph_amp/main.test.ts index 891614266..5f92ffd03 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/main.test.ts +++ b/registry/harsh9485/modules/sourcegraph_amp/main.test.ts @@ -1,28 +1,126 @@ -import { describe, it, expect } from "bun:test"; import { - runTerraformInit, - runTerraformApply, - testRequiredVariables, - findResourceInstance, -} from "~test"; -import path from "path"; - -const moduleDir = path.resolve(__dirname); -const requiredVars = { agent_id: "dummy-agent-id" }; - -describe("sourcegraph-amp module", () => { - it("initializes and applies without errors", async () => { - await runTerraformInit(moduleDir); - testRequiredVariables(moduleDir, requiredVars); - - const state = await runTerraformApply(moduleDir, requiredVars); - const script = findResourceInstance(state, "coder_script"); - - expect(script).toBeDefined(); - expect(script.agent_id).toBe(requiredVars.agent_id); - expect(script.script).toContain("ARG_INSTALL_SOURCEGRAPH_AMP='true'"); - expect(script.script).toContain("ARG_AGENTAPI_VERSION='v0.3.0'"); - expect(script.script).toMatch(/\/tmp\/install\.sh/); - expect(script.script).toMatch(/\/tmp\/start\.sh/); + test, + afterEach, + describe, + setDefaultTimeout, + beforeAll, + expect, +} from "bun:test"; +import { execContainer, readFileContainer, runTerraformInit } from "~test"; +import { + loadTestFile, + writeExecutable, + setup as setupUtil, + execModuleScript, + expectAgentAPIStarted, +} from "../../../coder/modules/agentapi/test-util"; + +let cleanupFunctions: (() => Promise)[] = []; +const registerCleanup = (cleanup: () => Promise) => { + cleanupFunctions.push(cleanup); +}; +afterEach(async () => { + const cleanupFnsCopy = cleanupFunctions.slice().reverse(); + cleanupFunctions = []; + for (const cleanup of cleanupFnsCopy) { + try { + await cleanup(); + } catch (error) { + console.error("Error during cleanup:", error); + } + } +}); + +interface SetupProps { + skipAgentAPIMock?: boolean; + skipAmpMock?: boolean; + moduleVariables?: Record; + agentapiMockScript?: string; +} + +const setup = async (props?: SetupProps): Promise<{ id: string }> => { + const projectDir = "/home/coder/project"; + const { id } = await setupUtil({ + moduleDir: import.meta.dir, + moduleVariables: { + install_sourcegraph_amp: props?.skipAmpMock ? "true" : "false", + install_agentapi: props?.skipAgentAPIMock ? "true" : "false", + sourcegraph_amp_model: "test-model", + ...props?.moduleVariables, + }, + registerCleanup, + projectDir, + skipAgentAPIMock: props?.skipAgentAPIMock, + agentapiMockScript: props?.agentapiMockScript, + }); + + // Place the AMP mock CLI binary inside the container + if (!props?.skipAmpMock) { + await writeExecutable({ + containerId: id, + filePath: "/usr/bin/amp", + content: await loadTestFile(`${import.meta.dir}`, "amp-mock.sh"), + }); + } + + return { id }; +}; + +setDefaultTimeout(60 * 1000 * 8); + +describe("Sourcegraph AMP Module", async () => { + beforeAll(async () => { + await runTerraformInit(import.meta.dir); + }); + + test("happy-path", async () => { + const { id } = await setup(); + await execModuleScript(id); + await expectAgentAPIStarted(id); + }); + + test("sourcegraph-amp-api-key", async () => { + const apiKey = "test-api-key-123"; + const { id } = await setup({ + moduleVariables: { + sourcegraph_amp_api_key: apiKey, + }, + }); + await execModuleScript(id); + const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/agentapi-start.log"); + expect(resp).toContain("AMP version: AMP CLI mock version v1.0.0"); + }); + + test("custom-folder", async () => { + const folder = "/tmp/sourcegraph-amp-test"; + const { id } = await setup({ + moduleVariables: { + folder, + }, + }); + await execModuleScript(id); + const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/install.log"); + expect(resp).toContain(folder); + }); + + test("pre-post-install-scripts", async () => { + const { id } = await setup({ + moduleVariables: { + pre_install_script: "#!/bin/bash\necho 'pre-install-script'", + post_install_script: "#!/bin/bash\necho 'post-install-script'", + }, + }); + await execModuleScript(id); + const preLog = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/pre_install.log"); + expect(preLog).toContain("pre-install-script"); + const postLog = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/post_install.log"); + expect(postLog).toContain("post-install-script"); + }); + + test("amp-not-installed", async () => { + const { id } = await setup({ skipAmpMock: true }); + await execModuleScript(id); + const log = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/install.log"); + expect(log).toContain("Error"); }); -}); \ No newline at end of file +}); diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.tf b/registry/harsh9485/modules/sourcegraph_amp/main.tf index d755b5abc..0cd6d1d5c 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/main.tf +++ b/registry/harsh9485/modules/sourcegraph_amp/main.tf @@ -152,7 +152,6 @@ module "agentapi" { chmod +x /tmp/install.sh ARG_INSTALL_SOURCEGRAPH_AMP='${var.install_sourcegraph-amp}' \ SOURCEGRAPH_AMP_START_DIRECTORY='${var.folder}' \ - SOURCEGRAPH_AMP_API_KEY='${var.sourcegraph-amp_api_key}' \ BASE_EXTENSIONS='${replace(local.base_extensions, "'", "'\\''")}' \ /tmp/install.sh EOT diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh index a9c58ed21..0f7ba84d7 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh @@ -4,34 +4,57 @@ set -euo pipefail # ANSI colors BOLD='\033[1m' - -# Print arguments echo "--------------------------------" echo "Install flag: $ARG_INSTALL_SOURCEGRAPH_AMP" echo "Workspace: $SOURCEGRAPH_AMP_START_DIRECTORY" echo "--------------------------------" -# Check for npm/node and install via nvm if missing -function ensure_node() { - if ! command -v npm &>/dev/null; then - echo "npm not found. Installing Node.js via NVM..." - export NVM_DIR="$HOME/.nvm" - mkdir -p "$NVM_DIR" - curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash - # shellcheck source=/dev/null - source "$NVM_DIR/nvm.sh" - nvm install --lts - nvm alias default node - fi +function install_node() { + if ! command_exists npm; then + printf "npm not found, checking for Node.js installation...\n" + if ! command_exists node; then + printf "Node.js not found, installing Node.js via NVM...\n" + export NVM_DIR="$HOME/.nvm" + if [ ! -d "$NVM_DIR" ]; then + mkdir -p "$NVM_DIR" + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + else + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + fi + + nvm install --lts + nvm use --lts + nvm alias default node + + printf "Node.js installed: %s\n" "$(node --version)" + printf "npm installed: %s\n" "$(npm --version)" + else + printf "Node.js is installed but npm is not available. Please install npm manually.\n" + exit 1 + fi + fi } function install_sourcegraph_amp() { - if [[ "$ARG_INSTALL_SOURCEGRAPH_AMP" == "true" ]]; then - ensure_node - printf "%b Installing Sourcegraph AMP CLI...%b\n" "$BOLD" - npm install -g @sourcegraph/amp - printf "%b Installation complete.%b\n" "$BOLD" - fi + if [ "${ARG_INSTALL_SOURCEGRAPH_AMP}" = "true" ]; then + install_node + + # If nvm is not used, set up user npm global directory + if ! command_exists nvm; then + mkdir -p "$HOME/.npm-global" + npm config set prefix "$HOME/.npm-global" + export PATH="$HOME/.npm-global/bin:$PATH" + if ! grep -q "export PATH=$HOME/.npm-global/bin:\$PATH" ~/.bashrc; then + echo "export PATH=$HOME/.npm-global/bin:\$PATH" >> ~/.bashrc + fi + fi + + printf "%s Installing Sourcegraph AMP CLI...\n" "${BOLD}" + npm install -g @sourcegraph/amp + export AMP_API_KEY="$SOURCEGRAPH_AMP_API_KEY" + printf "%s Successfully installed Sourcegraph AMP CLI. Version: %s\n" "${BOLD}" "$(amp --version)" + fi } install_sourcegraph_amp \ No newline at end of file diff --git a/registry/harsh9485/modules/sourcegraph_amp/testdata/amp-mock.sh b/registry/harsh9485/modules/sourcegraph_amp/testdata/amp-mock.sh new file mode 100644 index 000000000..259db57ad --- /dev/null +++ b/registry/harsh9485/modules/sourcegraph_amp/testdata/amp-mock.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Mock behavior of the AMP CLI +if [[ "$1" == "--version" ]]; then + echo "AMP CLI mock version v1.0.0" + exit 0 +fi + +# Simulate AMP running in a loop for AgentAPI to connect +set -e +while true; do + echo "$(date) - AMP mock is running..." + sleep 15 +done From b32dd64811f732feab7ad4061fe64bb785b61320 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Wed, 6 Aug 2025 17:20:50 +0530 Subject: [PATCH 05/24] Add support for the system prompt --- .../modules/sourcegraph_amp/README.md | 12 ++++++++++++ .../modules/sourcegraph_amp/main.test.ts | 2 +- .../sourcegraph_amp/scripts/install.sh | 19 ++++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/registry/harsh9485/modules/sourcegraph_amp/README.md b/registry/harsh9485/modules/sourcegraph_amp/README.md index 66e43ba7c..ab62f8e9a 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/README.md +++ b/registry/harsh9485/modules/sourcegraph_amp/README.md @@ -36,6 +36,18 @@ variable "sourcegraph_amp_api_key" { sensitive = true } +# Set system prompt for Sourcegraph Amp via environment variables +resource "coder_agent" "main" { + # ... + env = { + SOURCEGRAPH_AMP_SYSTEM_PROMPT = <<-EOT + You are an AMP assistant that helps developers debug and write code efficiently. + + Always log task status to Coder. + EOT + } +} + module "sourcegraph_amp" { count = data.coder_workspace.me.start_count source = "registry.coder.com/harsh9485/sourcegraph-amp/coder" diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.test.ts b/registry/harsh9485/modules/sourcegraph_amp/main.test.ts index 5f92ffd03..542ab521d 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/main.test.ts +++ b/registry/harsh9485/modules/sourcegraph_amp/main.test.ts @@ -66,7 +66,7 @@ const setup = async (props?: SetupProps): Promise<{ id: string }> => { return { id }; }; -setDefaultTimeout(60 * 1000 * 8); +setDefaultTimeout(60 * 1000); describe("Sourcegraph AMP Module", async () => { beforeAll(async () => { diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh index 0f7ba84d7..9ae6d850f 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh @@ -9,6 +9,11 @@ echo "Install flag: $ARG_INSTALL_SOURCEGRAPH_AMP" echo "Workspace: $SOURCEGRAPH_AMP_START_DIRECTORY" echo "--------------------------------" +# Helper function to check if a command exists +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + function install_node() { if ! command_exists npm; then printf "npm not found, checking for Node.js installation...\n" @@ -57,4 +62,16 @@ function install_sourcegraph_amp() { fi } -install_sourcegraph_amp \ No newline at end of file +function setup_system_prompt() { + if [ -n "${SOURCEGRAPH_AMP_SYSTEM_PROMPT:-}" ]; then + echo "Setting Sourcegraph AMP system prompt..." + mkdir -p "$HOME/.sourcegraph-amp" + echo "$SOURCEGRAPH_AMP_SYSTEM_PROMPT" > "$HOME/.sourcegraph-amp/SYSTEM_PROMPT.md" + echo "System prompt saved to $HOME/.sourcegraph-amp/SYSTEM_PROMPT.md" + else + echo "No system prompt provided for Sourcegraph AMP." + fi +} + +install_sourcegraph_amp +setup_system_prompt From 2e5fd30819a2af4aad829901a3bae05a73b94d17 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Fri, 8 Aug 2025 18:08:21 +0530 Subject: [PATCH 06/24] Fix DNS limitation issue --- .../modules/sourcegraph_amp/README.md | 18 ++++++++++++++---- .../harsh9485/modules/sourcegraph_amp/main.tf | 2 +- .../modules/sourcegraph_amp/scripts/install.sh | 5 ++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/registry/harsh9485/modules/sourcegraph_amp/README.md b/registry/harsh9485/modules/sourcegraph_amp/README.md index ab62f8e9a..f6a8b3972 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/README.md +++ b/registry/harsh9485/modules/sourcegraph_amp/README.md @@ -30,10 +30,13 @@ module "sourcegraph_amp" { ## Usage Example ```tf -variable "sourcegraph_amp_api_key" { - type = string - description = "Sourcegraph AMP API key" - sensitive = true +data "coder_parameter" "ai_prompt" { + name = "AI Prompt" + description = "Write an initial prompt for Aider to work on." + type = "string" + default = "" + mutable = true + ephemeral = true } # Set system prompt for Sourcegraph Amp via environment variables @@ -45,9 +48,16 @@ resource "coder_agent" "main" { Always log task status to Coder. EOT + SOURCEGRAPH_AMP_TASK_PROMPT = data.coder_parameter.ai_prompt.value } } +variable "sourcegraph_amp_api_key" { + type = string + description = "Sourcegraph AMP API key" + sensitive = true +} + module "sourcegraph_amp" { count = data.coder_workspace.me.start_count source = "registry.coder.com/harsh9485/sourcegraph-amp/coder" diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.tf b/registry/harsh9485/modules/sourcegraph_amp/main.tf index 0cd6d1d5c..66b9a9744 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/main.tf +++ b/registry/harsh9485/modules/sourcegraph_amp/main.tf @@ -108,7 +108,7 @@ developer: type: builtin EOT - app_slug = "sourcegraph-amp" + app_slug = "amp" install_script = file("${path.module}/scripts/install.sh") start_script = file("${path.module}/scripts/start.sh") module_dir_name = ".sourcegraph-amp-module" diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh index 9ae6d850f..473b98e3e 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh @@ -28,9 +28,12 @@ function install_node() { [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" fi + # Temporarily disable nounset (-u) for nvm to avoid PROVIDED_VERSION error + set +u nvm install --lts nvm use --lts nvm alias default node + set -u printf "Node.js installed: %s\n" "$(node --version)" printf "npm installed: %s\n" "$(npm --version)" @@ -56,7 +59,7 @@ function install_sourcegraph_amp() { fi printf "%s Installing Sourcegraph AMP CLI...\n" "${BOLD}" - npm install -g @sourcegraph/amp + npm install -g @sourcegraph/amp@0.0.1754179307-gba1f97 export AMP_API_KEY="$SOURCEGRAPH_AMP_API_KEY" printf "%s Successfully installed Sourcegraph AMP CLI. Version: %s\n" "${BOLD}" "$(amp --version)" fi From dc60cc73e85ff20db6eb0a9915e24b7529ad2422 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Sat, 9 Aug 2025 16:19:27 +0530 Subject: [PATCH 07/24] Add task prompt support --- .../modules/sourcegraph_amp/scripts/start.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh index df8ec7ef9..46de59714 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh @@ -25,5 +25,14 @@ fi cd "$dir" echo "Add AMP API key" export AMP_API_KEY=$SOURCEGRAPH_AMP_API_KEY -# Launch AgentAPI server with AMP -agentapi server --term-width=67 --term-height=1190 -- amp \ No newline at end of file + +if [ -n "$SOURCEGRAPH_AMP_TASK_PROMPT" ]; then + printf "Running the task prompt: %s\n" "$SOURCEGRAPH_AMP_TASK_PROMPT" + PROMPT="Every step of the way, report tasks to Coder with proper descriptions and statuses. Your task at hand: $SOURCEGRAPH_AMP_TASK_PROMPT" + + # Pipe the prompt into amp, which will be run inside agentapi + agentapi server --term-width=67 --term-height=1190 -- bash -c "echo \"$PROMPT\" | amp" +else + printf "No task prompt given.\n" + agentapi server --term-width=67 --term-height=1190 -- amp +fi \ No newline at end of file From 88613b62845cee33d1d95492988932cd0d098cbf Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Tue, 12 Aug 2025 16:25:45 +0530 Subject: [PATCH 08/24] Fix all typos and the test suite. --- .../modules/sourcegraph_amp/README.md | 43 +++++++++---------- .../modules/sourcegraph_amp/main.test.ts | 29 +++++++++---- .../harsh9485/modules/sourcegraph_amp/main.tf | 18 ++++---- .../sourcegraph_amp/scripts/install.sh | 1 - .../modules/sourcegraph_amp/scripts/start.sh | 19 +++++--- 5 files changed, 65 insertions(+), 45 deletions(-) diff --git a/registry/harsh9485/modules/sourcegraph_amp/README.md b/registry/harsh9485/modules/sourcegraph_amp/README.md index f6a8b3972..e787547df 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/README.md +++ b/registry/harsh9485/modules/sourcegraph_amp/README.md @@ -1,7 +1,6 @@ --- - display\_name: Sourcegraph AMP -icon: ../../../../.icons/sourcegraph-amp.svg +icon: ../../../../.icons/sourcegraph_amp.svg description: Run Sourcegraph AMP CLI in your workspace with AgentAPI integration verified: true tags: \[agent, sourcegraph, amp, ai, tasks] @@ -13,19 +12,19 @@ Run [Sourcegraph AMP CLI](https://sourcegraph.com/amp) in your workspace to acce ```tf module "sourcegraph_amp" { - source = "registry.coder.com/harsh9485/sourcegraph-amp/coder" + source = "registry.coder.com/harsh9485/sourcegraph_amp/coder" version = "1.0.0" agent_id = coder_agent.example.id sourcegraph_amp_api_key = var.sourcegraph_amp_api_key - install_sourcegraph-amp = true + install_sourcegraph_amp = true agentapi_version = "latest" } ``` ## Prerequisites -* Include the [Coder Login](https://registry.coder.com/modules/coder-login/coder) module in your template -* Node.js and npm are automatically installed (via NVM) if not already available +- Include the [Coder Login](https://registry.coder.com/modules/coder-login/coder) module in your template +- Node.js and npm are automatically installed (via NVM) if not already available ## Usage Example @@ -48,7 +47,7 @@ resource "coder_agent" "main" { Always log task status to Coder. EOT - SOURCEGRAPH_AMP_TASK_PROMPT = data.coder_parameter.ai_prompt.value + SOURCEGRAPH_AMP_TASK_PROMPT = data.coder_parameter.ai_prompt.value } } @@ -59,26 +58,26 @@ variable "sourcegraph_amp_api_key" { } module "sourcegraph_amp" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/harsh9485/sourcegraph-amp/coder" - version = "1.0.0" - agent_id = coder_agent.example.id - sourcegraph_amp_api_key = var.sourcegraph_amp_api_key # recommended for authenticated usage - install_sourcegraph-amp = true + count = data.coder_workspace.me.start_count + source = "registry.coder.com/harsh9485/sourcegraph_amp/coder" + version = "1.0.0" + agent_id = coder_agent.example.id + sourcegraph_amp_api_key = var.sourcegraph_amp_api_key # recommended for authenticated usage + install_sourcegraph_amp = true } ``` ## How it Works -* **Install**: Installs Sourcegraph AMP CLI using npm (installs Node.js via NVM if required) -* **Start**: Launches AMP CLI in the specified directory, wrapped with AgentAPI to enable tasks and AI interactions -* **Environment Variables**: Sets `SOURCEGRAPH_AMP_API_KEY` and `SOURCEGRAPH_AMP_START_DIRECTORY` for the CLI execution +- **Install**: Installs Sourcegraph AMP CLI using npm (installs Node.js via NVM if required) +- **Start**: Launches AMP CLI in the specified directory, wrapped with AgentAPI to enable tasks and AI interactions +- **Environment Variables**: Sets `SOURCEGRAPH_AMP_API_KEY` and `SOURCEGRAPH_AMP_START_DIRECTORY` for the CLI execution ## Troubleshooting -* If `amp` is not found, ensure `install_sourcegraph-amp = true` and your API key is valid -* Logs are written under `/home/coder/.sourcegraph-amp-module/` (`install.log`, `agentapi-start.log`) for debugging -* If AgentAPI fails to start, verify that your container has network access and executable permissions for the scripts +- If `amp` is not found, ensure `install_sourcegraph_amp = true` and your API key is valid +- Logs are written under `/home/coder/.sourcegraph_amp-module/` (`install.log`, `agentapi-start.log`) for debugging +- If AgentAPI fails to start, verify that your container has network access and executable permissions for the scripts > \[!IMPORTANT] > For using **Coder Tasks** with Sourcegraph AMP, make sure to pass the `AI Prompt` parameter and set `sourcegraph_amp_api_key`. @@ -86,6 +85,6 @@ module "sourcegraph_amp" { ## References -* [Sourcegraph AMP Documentation](https://sourcegraph.com/amp) -* [AgentAPI Documentation](https://github.com/coder/agentapi) -* [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents) +- [Sourcegraph AMP Documentation](https://sourcegraph.com/amp) +- [AgentAPI Documentation](https://github.com/coder/agentapi) +- [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents) diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.test.ts b/registry/harsh9485/modules/sourcegraph_amp/main.test.ts index 542ab521d..00ba91bba 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/main.test.ts +++ b/registry/harsh9485/modules/sourcegraph_amp/main.test.ts @@ -68,7 +68,7 @@ const setup = async (props?: SetupProps): Promise<{ id: string }> => { setDefaultTimeout(60 * 1000); -describe("Sourcegraph AMP Module", async () => { +describe("sourcegraph-amp", async () => { beforeAll(async () => { await runTerraformInit(import.meta.dir); }); @@ -79,7 +79,7 @@ describe("Sourcegraph AMP Module", async () => { await expectAgentAPIStarted(id); }); - test("sourcegraph-amp-api-key", async () => { + test("api-key", async () => { const apiKey = "test-api-key-123"; const { id } = await setup({ moduleVariables: { @@ -88,7 +88,7 @@ describe("Sourcegraph AMP Module", async () => { }); await execModuleScript(id); const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/agentapi-start.log"); - expect(resp).toContain("AMP version: AMP CLI mock version v1.0.0"); + expect(resp).toContain("sourcegraph_amp_api_key provided !"); }); test("custom-folder", async () => { @@ -117,10 +117,23 @@ describe("Sourcegraph AMP Module", async () => { expect(postLog).toContain("post-install-script"); }); - test("amp-not-installed", async () => { - const { id } = await setup({ skipAmpMock: true }); - await execModuleScript(id); - const log = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/install.log"); - expect(log).toContain("Error"); + test("system-prompt", async () => { + const prompt = "this is a system prompt for AMP"; + const {id} = await setup(); + await execModuleScript(id, { + SOURCEGRAPH_AMP_SYSTEM_PROMPT : prompt, + }); + const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp/SYSTEM_PROMPT.md"); + expect(resp).toContain(prompt); }); + + test("task-prompt", async () => { + const prompt = "this is a task prompt for AMP"; + const {id} = await setup(); + await execModuleScript(id, { + SOURCEGRAPH_AMP_TASK_PROMPT : prompt, + }); + const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/agentapi-start.log"); + expect(resp).toContain(`sourcegraph amp task prompt provided : ${prompt}`); + }) }); diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.tf b/registry/harsh9485/modules/sourcegraph_amp/main.tf index 66b9a9744..0a7634218 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/main.tf +++ b/registry/harsh9485/modules/sourcegraph_amp/main.tf @@ -38,26 +38,26 @@ variable "icon" { variable "folder" { type = string - description = "The folder to run sourcegraph-amp in." + description = "The folder to run sourcegraph_amp in." default = "/home/coder" } -variable "install_sourcegraph-amp" { +variable "install_sourcegraph_amp" { type = bool description = "Whether to install sourcegraph-amp." default = true } -variable "sourcegraph-amp_api_key" { +variable "sourcegraph_amp_api_key" { type = string description = "sourcegraph-amp API Key" default = "" } -resource "coder_env" "sourcegraph-amp_api_key" { +resource "coder_env" "sourcegraph_amp_api_key" { agent_id = var.agent_id name = "SOURCEGRAPH_AMP_API_KEY" - value = var.sourcegraph-amp_api_key + value = var.sourcegraph_amp_api_key } variable "install_agentapi" { @@ -74,13 +74,13 @@ variable "agentapi_version" { variable "pre_install_script" { type = string - description = "Custom script to run before installing sourcegraph-amp" + description = "Custom script to run before installing sourcegraph_amp" default = null } variable "post_install_script" { type = string - description = "Custom script to run after installing sourcegraph-amp." + description = "Custom script to run after installing sourcegraph_amp." default = null } @@ -138,7 +138,7 @@ module "agentapi" { echo -n '${base64encode(local.start_script)}' | base64 -d > /tmp/start.sh chmod +x /tmp/start.sh - SOURCEGRAPH_AMP_API_KEY='${var.sourcegraph-amp_api_key}' \ + SOURCEGRAPH_AMP_API_KEY='${var.sourcegraph_amp_api_key}' \ SOURCEGRAPH_AMP_START_DIRECTORY='${var.folder}' \ /tmp/start.sh EOT @@ -150,7 +150,7 @@ module "agentapi" { echo -n '${base64encode(local.install_script)}' | base64 -d > /tmp/install.sh chmod +x /tmp/install.sh - ARG_INSTALL_SOURCEGRAPH_AMP='${var.install_sourcegraph-amp}' \ + ARG_INSTALL_SOURCEGRAPH_AMP='${var.install_sourcegraph_amp}' \ SOURCEGRAPH_AMP_START_DIRECTORY='${var.folder}' \ BASE_EXTENSIONS='${replace(local.base_extensions, "'", "'\\''")}' \ /tmp/install.sh diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh index 473b98e3e..79b2fb064 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh @@ -60,7 +60,6 @@ function install_sourcegraph_amp() { printf "%s Installing Sourcegraph AMP CLI...\n" "${BOLD}" npm install -g @sourcegraph/amp@0.0.1754179307-gba1f97 - export AMP_API_KEY="$SOURCEGRAPH_AMP_API_KEY" printf "%s Successfully installed Sourcegraph AMP CLI. Version: %s\n" "${BOLD}" "$(amp --version)" fi } diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh b/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh index 46de59714..6fed2a39d 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh +++ b/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh @@ -5,7 +5,11 @@ set -euo pipefail # shellcheck source=/dev/null source "$HOME/.bashrc" # shellcheck source=/dev/null -source "$HOME/.nvm/nvm.sh" +if [ -f "$HOME/.nvm/nvm.sh" ]; then + source "$HOME"/.nvm/nvm.sh +else + export PATH="$HOME/.npm-global/bin:$PATH" +fi function ensure_command() { command -v "$1" &>/dev/null || { echo "Error: '$1' not found." >&2; exit 1; } @@ -23,11 +27,16 @@ else mkdir -p "$dir" fi cd "$dir" -echo "Add AMP API key" -export AMP_API_KEY=$SOURCEGRAPH_AMP_API_KEY -if [ -n "$SOURCEGRAPH_AMP_TASK_PROMPT" ]; then - printf "Running the task prompt: %s\n" "$SOURCEGRAPH_AMP_TASK_PROMPT" +if [ -n "$SOURCEGRAPH_AMP_API_KEY" ]; then + printf "sourcegraph_amp_api_key provided !\n" + export AMP_API_KEY=$SOURCEGRAPH_AMP_API_KEY +else + printf "sourcegraph_amp_api_key not provided\n" +fi + +if [ -n "${SOURCEGRAPH_AMP_TASK_PROMPT:-}" ]; then + printf "sourcegraph amp task prompt provided : $SOURCEGRAPH_AMP_TASK_PROMPT" PROMPT="Every step of the way, report tasks to Coder with proper descriptions and statuses. Your task at hand: $SOURCEGRAPH_AMP_TASK_PROMPT" # Pipe the prompt into amp, which will be run inside agentapi From dcb3e6598d5ed603c79af302ca7226f66920eee4 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Tue, 12 Aug 2025 17:57:01 +0530 Subject: [PATCH 09/24] Add an avatar and a README file --- registry/harsh9485/.images/Avatar.jpg | Bin 0 -> 18598 bytes registry/harsh9485/README.md | 13 +++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 registry/harsh9485/.images/Avatar.jpg create mode 100644 registry/harsh9485/README.md diff --git a/registry/harsh9485/.images/Avatar.jpg b/registry/harsh9485/.images/Avatar.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d99b36e2b89da960b8a4003f076962565548739b GIT binary patch literal 18598 zcmbUIbySo8A3qKc=@QX_G!oJ%vC)k*qehNUnvIZ75u}}TGY}BQV5CS%DbgUh!BE1W zLrOpd5q|Ui`ToA={`0=?opW*3&JNG(S&!G_@w~1+T`d6O08|tdloaGtl$4az)KoNd zKzce_S~}L7w-|t&Y}{O&Y#bbS`0okc;T7ZK;1H4(7L$+!fk51X^2%~jO82BeQY6&W z)O56TEcEm&Qal_yQvW}Hu6h8BR3u|0W27X!fNP8-q>Ln2{Ul`o00}wCe;>gA`H);A zB_pSxq@t#wy#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GgaGzKobcu-lP-z)e^>|X&85=BUDU1YE_(i)-uT1>r$+Z>r4%$n0nNr zLF-v4?dwyljq5=z8U^X4_^P3fI@0bYff76W)pu`tS7T8VlT1XACz&!YsjZIHonQyr zGw3TuyYTV%Zh82pd00bCG~-O~T?Z)AX@;C>rhpo0hMd(KPy%O~CxH6@SQ9Kl Date: Tue, 12 Aug 2025 18:35:16 +0530 Subject: [PATCH 10/24] fix typos --- .../harsh9485/.images/{Avatar.jpg => avatr.jpg} | Bin registry/harsh9485/README.md | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename registry/harsh9485/.images/{Avatar.jpg => avatr.jpg} (100%) diff --git a/registry/harsh9485/.images/Avatar.jpg b/registry/harsh9485/.images/avatr.jpg similarity index 100% rename from registry/harsh9485/.images/Avatar.jpg rename to registry/harsh9485/.images/avatr.jpg diff --git a/registry/harsh9485/README.md b/registry/harsh9485/README.md index 37453ec79..67e9d12b1 100644 --- a/registry/harsh9485/README.md +++ b/registry/harsh9485/README.md @@ -10,4 +10,4 @@ status: "community" # Your Name -I'm a Software Engineer :) \ No newline at end of file +I'm a Software Engineer :) From 90af1e720cfaabb313769b7e587182acdf088f81 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Wed, 13 Aug 2025 10:57:43 +0530 Subject: [PATCH 11/24] Fix Readme file --- registry/harsh9485/modules/sourcegraph_amp/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/registry/harsh9485/modules/sourcegraph_amp/README.md b/registry/harsh9485/modules/sourcegraph_amp/README.md index e787547df..4f130edbc 100644 --- a/registry/harsh9485/modules/sourcegraph_amp/README.md +++ b/registry/harsh9485/modules/sourcegraph_amp/README.md @@ -2,8 +2,8 @@ display\_name: Sourcegraph AMP icon: ../../../../.icons/sourcegraph_amp.svg description: Run Sourcegraph AMP CLI in your workspace with AgentAPI integration -verified: true -tags: \[agent, sourcegraph, amp, ai, tasks] +verified: false +tags: [agent, sourcegraph, amp, ai, tasks] --- # Sourcegraph AMP CLI @@ -31,11 +31,11 @@ module "sourcegraph_amp" { ```tf data "coder_parameter" "ai_prompt" { name = "AI Prompt" - description = "Write an initial prompt for Aider to work on." + description = "Write an initial prompt for AMP to work on." type = "string" default = "" mutable = true - ephemeral = true + } # Set system prompt for Sourcegraph Amp via environment variables @@ -79,12 +79,12 @@ module "sourcegraph_amp" { - Logs are written under `/home/coder/.sourcegraph_amp-module/` (`install.log`, `agentapi-start.log`) for debugging - If AgentAPI fails to start, verify that your container has network access and executable permissions for the scripts -> \[!IMPORTANT] +> [!IMPORTANT] > For using **Coder Tasks** with Sourcegraph AMP, make sure to pass the `AI Prompt` parameter and set `sourcegraph_amp_api_key`. > This ensures task reporting and status updates work seamlessly. ## References -- [Sourcegraph AMP Documentation](https://sourcegraph.com/amp) +- [Sourcegraph AMP Documentation](https://ampcode.com/manual) - [AgentAPI Documentation](https://github.com/coder/agentapi) - [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents) From 66a82edae1d91ae1a98ea783e61ededbf2abfde7 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Wed, 13 Aug 2025 22:16:10 +0530 Subject: [PATCH 12/24] Move module into coder-labs --- .../{harsh9485 => coder-labs}/modules/sourcegraph_amp/README.md | 0 .../modules/sourcegraph_amp/main.test.ts | 0 .../{harsh9485 => coder-labs}/modules/sourcegraph_amp/main.tf | 0 .../modules/sourcegraph_amp/scripts/install.sh | 0 .../modules/sourcegraph_amp/scripts/start.sh | 0 .../modules/sourcegraph_amp/testdata/amp-mock.sh | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename registry/{harsh9485 => coder-labs}/modules/sourcegraph_amp/README.md (100%) rename registry/{harsh9485 => coder-labs}/modules/sourcegraph_amp/main.test.ts (100%) rename registry/{harsh9485 => coder-labs}/modules/sourcegraph_amp/main.tf (100%) rename registry/{harsh9485 => coder-labs}/modules/sourcegraph_amp/scripts/install.sh (100%) rename registry/{harsh9485 => coder-labs}/modules/sourcegraph_amp/scripts/start.sh (100%) rename registry/{harsh9485 => coder-labs}/modules/sourcegraph_amp/testdata/amp-mock.sh (100%) diff --git a/registry/harsh9485/modules/sourcegraph_amp/README.md b/registry/coder-labs/modules/sourcegraph_amp/README.md similarity index 100% rename from registry/harsh9485/modules/sourcegraph_amp/README.md rename to registry/coder-labs/modules/sourcegraph_amp/README.md diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.test.ts b/registry/coder-labs/modules/sourcegraph_amp/main.test.ts similarity index 100% rename from registry/harsh9485/modules/sourcegraph_amp/main.test.ts rename to registry/coder-labs/modules/sourcegraph_amp/main.test.ts diff --git a/registry/harsh9485/modules/sourcegraph_amp/main.tf b/registry/coder-labs/modules/sourcegraph_amp/main.tf similarity index 100% rename from registry/harsh9485/modules/sourcegraph_amp/main.tf rename to registry/coder-labs/modules/sourcegraph_amp/main.tf diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh similarity index 100% rename from registry/harsh9485/modules/sourcegraph_amp/scripts/install.sh rename to registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh diff --git a/registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh b/registry/coder-labs/modules/sourcegraph_amp/scripts/start.sh similarity index 100% rename from registry/harsh9485/modules/sourcegraph_amp/scripts/start.sh rename to registry/coder-labs/modules/sourcegraph_amp/scripts/start.sh diff --git a/registry/harsh9485/modules/sourcegraph_amp/testdata/amp-mock.sh b/registry/coder-labs/modules/sourcegraph_amp/testdata/amp-mock.sh similarity index 100% rename from registry/harsh9485/modules/sourcegraph_amp/testdata/amp-mock.sh rename to registry/coder-labs/modules/sourcegraph_amp/testdata/amp-mock.sh From 223a0bb3d84c124d24d10313efeb9cf865662d00 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Wed, 13 Aug 2025 22:32:46 +0530 Subject: [PATCH 13/24] Fix README file typo --- registry/coder-labs/modules/sourcegraph_amp/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/sourcegraph_amp/README.md b/registry/coder-labs/modules/sourcegraph_amp/README.md index 4f130edbc..b6a533ccf 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/README.md +++ b/registry/coder-labs/modules/sourcegraph_amp/README.md @@ -1,5 +1,5 @@ --- -display\_name: Sourcegraph AMP +display_name: Sourcegraph AMP icon: ../../../../.icons/sourcegraph_amp.svg description: Run Sourcegraph AMP CLI in your workspace with AgentAPI integration verified: false From 6b3e7102ea81b125cb65e7e8972f366ec7b5b0d8 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Wed, 13 Aug 2025 23:33:51 +0530 Subject: [PATCH 14/24] Remove old references --- registry/coder-labs/modules/sourcegraph_amp/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/registry/coder-labs/modules/sourcegraph_amp/README.md b/registry/coder-labs/modules/sourcegraph_amp/README.md index b6a533ccf..6b480d368 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/README.md +++ b/registry/coder-labs/modules/sourcegraph_amp/README.md @@ -12,7 +12,7 @@ Run [Sourcegraph AMP CLI](https://sourcegraph.com/amp) in your workspace to acce ```tf module "sourcegraph_amp" { - source = "registry.coder.com/harsh9485/sourcegraph_amp/coder" + source = "registry.coder.com/coder-labs/sourcegraph_amp/coder" version = "1.0.0" agent_id = coder_agent.example.id sourcegraph_amp_api_key = var.sourcegraph_amp_api_key @@ -59,7 +59,7 @@ variable "sourcegraph_amp_api_key" { module "sourcegraph_amp" { count = data.coder_workspace.me.start_count - source = "registry.coder.com/harsh9485/sourcegraph_amp/coder" + source = "registry.coder.com/coder-labs/sourcegraph_amp/coder" version = "1.0.0" agent_id = coder_agent.example.id sourcegraph_amp_api_key = var.sourcegraph_amp_api_key # recommended for authenticated usage From 5003a087417dc5ac1811274b4c533bc085a224b5 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Thu, 14 Aug 2025 17:42:01 +0530 Subject: [PATCH 15/24] Fix typo --- registry/coder-labs/modules/sourcegraph_amp/README.md | 2 +- registry/coder-labs/modules/sourcegraph_amp/main.test.ts | 2 +- .../coder-labs/modules/sourcegraph_amp/scripts/install.sh | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/registry/coder-labs/modules/sourcegraph_amp/README.md b/registry/coder-labs/modules/sourcegraph_amp/README.md index 6b480d368..697596ee0 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/README.md +++ b/registry/coder-labs/modules/sourcegraph_amp/README.md @@ -76,7 +76,7 @@ module "sourcegraph_amp" { ## Troubleshooting - If `amp` is not found, ensure `install_sourcegraph_amp = true` and your API key is valid -- Logs are written under `/home/coder/.sourcegraph_amp-module/` (`install.log`, `agentapi-start.log`) for debugging +- Logs are written under `/home/coder/.sourcegraph-amp-module/` (`install.log`, `agentapi-start.log`) for debugging - If AgentAPI fails to start, verify that your container has network access and executable permissions for the scripts > [!IMPORTANT] diff --git a/registry/coder-labs/modules/sourcegraph_amp/main.test.ts b/registry/coder-labs/modules/sourcegraph_amp/main.test.ts index 00ba91bba..631d13044 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/main.test.ts +++ b/registry/coder-labs/modules/sourcegraph_amp/main.test.ts @@ -123,7 +123,7 @@ describe("sourcegraph-amp", async () => { await execModuleScript(id, { SOURCEGRAPH_AMP_SYSTEM_PROMPT : prompt, }); - const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp/SYSTEM_PROMPT.md"); + const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/SYSTEM_PROMPT.md"); expect(resp).toContain(prompt); }); diff --git a/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh index 79b2fb064..d37aaf702 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh @@ -67,9 +67,9 @@ function install_sourcegraph_amp() { function setup_system_prompt() { if [ -n "${SOURCEGRAPH_AMP_SYSTEM_PROMPT:-}" ]; then echo "Setting Sourcegraph AMP system prompt..." - mkdir -p "$HOME/.sourcegraph-amp" - echo "$SOURCEGRAPH_AMP_SYSTEM_PROMPT" > "$HOME/.sourcegraph-amp/SYSTEM_PROMPT.md" - echo "System prompt saved to $HOME/.sourcegraph-amp/SYSTEM_PROMPT.md" + mkdir -p "$HOME/.sourcegraph-amp-module" + echo "$SOURCEGRAPH_AMP_SYSTEM_PROMPT" > "$HOME/.sourcegraph-amp-module/SYSTEM_PROMPT.md" + echo "System prompt saved to $HOME/.sourcegraph-amp-module/SYSTEM_PROMPT.md" else echo "No system prompt provided for Sourcegraph AMP." fi From a37fbe43797fd042760020befbc0bd6f2279e814 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Thu, 14 Aug 2025 21:07:17 +0530 Subject: [PATCH 16/24] Remove reference directory --- registry/harsh9485/.images/avatr.jpg | Bin 18598 -> 0 bytes registry/harsh9485/README.md | 13 ------------- 2 files changed, 13 deletions(-) delete mode 100644 registry/harsh9485/.images/avatr.jpg delete mode 100644 registry/harsh9485/README.md diff --git a/registry/harsh9485/.images/avatr.jpg b/registry/harsh9485/.images/avatr.jpg deleted file mode 100644 index d99b36e2b89da960b8a4003f076962565548739b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18598 zcmbUIbySo8A3qKc=@QX_G!oJ%vC)k*qehNUnvIZ75u}}TGY}BQV5CS%DbgUh!BE1W zLrOpd5q|Ui`ToA={`0=?opW*3&JNG(S&!G_@w~1+T`d6O08|tdloaGtl$4az)KoNd zKzce_S~}L7w-|t&Y}{O&Y#bbS`0okc;T7ZK;1H4(7L$+!fk51X^2%~jO82BeQY6&W z)O56TEcEm&Qal_yQvW}Hu6h8BR3u|0W27X!fNP8-q>Ln2{Ul`o00}wCe;>gA`H);A zB_pSxq@t#wy#csJLP~m#jFg<5jEwlrNa8&J86){k9!YhITc(bbynaBbXBn@k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z>r4%$n0nNr zLF-v4?dwyljq5=z8U^X4_^P3fI@0bYff76W)pu`tS7T8VlT1XACz&!YsjZIHonQyr zGw3TuyYTV%Zh82pd00bCG~-O~T?Z)AX@;C>rhpo0hMd(KPy%O~CxH6@SQ9Kl Date: Fri, 15 Aug 2025 14:37:45 +0530 Subject: [PATCH 17/24] Implement MCP server --- .../coder-labs/modules/sourcegraph_amp/main.tf | 16 +++++++++++++++- .../modules/sourcegraph_amp/scripts/install.sh | 12 ++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/sourcegraph_amp/main.tf b/registry/coder-labs/modules/sourcegraph_amp/main.tf index 0a7634218..b7c3b2a5a 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/main.tf +++ b/registry/coder-labs/modules/sourcegraph_amp/main.tf @@ -84,6 +84,12 @@ variable "post_install_script" { default = null } +variable "additional_extensions" { + type = string + description = "Additional extensions configuration in YAML format to append to the config." + default = null +} + locals { base_extensions = <<-EOT coder: @@ -108,6 +114,14 @@ developer: type: builtin EOT + # Add two spaces to each line of extensions to match YAML structure + formatted_base = " ${replace(trimspace(local.base_extensions), "\n", "\n ")}" + additional_extensions = var.additional_extensions != null ? "\n ${replace(trimspace(var.additional_extensions), "\n", "\n ")}" : "" + combined_extensions = <<-EOT +extensions: +${local.formatted_base}${local.additional_extensions} +EOT + app_slug = "amp" install_script = file("${path.module}/scripts/install.sh") start_script = file("${path.module}/scripts/start.sh") @@ -152,7 +166,7 @@ module "agentapi" { chmod +x /tmp/install.sh ARG_INSTALL_SOURCEGRAPH_AMP='${var.install_sourcegraph_amp}' \ SOURCEGRAPH_AMP_START_DIRECTORY='${var.folder}' \ - BASE_EXTENSIONS='${replace(local.base_extensions, "'", "'\\''")}' \ + ARG_SOURCEGRAPH_AMP_CONFIG="$(echo -n '${base64encode(local.combined_extensions)}' | base64 -d)" \ /tmp/install.sh EOT } diff --git a/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh index d37aaf702..51fb2d7e4 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh @@ -75,5 +75,17 @@ function setup_system_prompt() { fi } +function configure_mcp() { + echo "MCP Server Configure " + if [ "${ARG_SOURCEGRAPH_AMP_CONFIG}" != "" ]; then + echo "Configuring AMP..." + mkdir -p "$HOME/.config/amp" + echo "$ARG_SOURCEGRAPH_AMP_CONFIG" >>"$HOME/.config/amp/config.yaml" + else + echo "Skipping AMP configuration" + fi +} + install_sourcegraph_amp setup_system_prompt +configure_mcp From f8ac46e08e041f29af9ba26f8b6c98542cc965d1 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Mon, 18 Aug 2025 17:13:19 +0530 Subject: [PATCH 18/24] Fix the MCP server configuration --- registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh index 51fb2d7e4..944e28463 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh @@ -80,7 +80,7 @@ function configure_mcp() { if [ "${ARG_SOURCEGRAPH_AMP_CONFIG}" != "" ]; then echo "Configuring AMP..." mkdir -p "$HOME/.config/amp" - echo "$ARG_SOURCEGRAPH_AMP_CONFIG" >>"$HOME/.config/amp/config.yaml" + echo "$ARG_SOURCEGRAPH_AMP_CONFIG" > "$HOME/.config/amp/config.yaml" else echo "Skipping AMP configuration" fi From 6240ae4235150ff802834f797abf0d8c7c47b637 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 19 Aug 2025 15:37:52 +0000 Subject: [PATCH 19/24] refactor(sourcegraph_amp): update AMP configuration handling and improve install script - Renamed variable `additional_extensions` to `base_amp_config` and updated its description to reflect JSON format usage. - Introduced `additional_mcp_servers` variable for additional MCP server configurations. - Refactored local variables to merge MCP server configurations and updated the final AMP configuration structure. - Modified the install script to configure AMP settings using the new JSON configuration format --- .../modules/sourcegraph_amp/main.tf | 98 ++++++++++++------- .../sourcegraph_amp/scripts/install.sh | 23 +++-- 2 files changed, 77 insertions(+), 44 deletions(-) diff --git a/registry/coder-labs/modules/sourcegraph_amp/main.tf b/registry/coder-labs/modules/sourcegraph_amp/main.tf index b7c3b2a5a..3db0da136 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/main.tf +++ b/registry/coder-labs/modules/sourcegraph_amp/main.tf @@ -84,45 +84,73 @@ variable "post_install_script" { default = null } -variable "additional_extensions" { +variable "base_amp_config" { type = string - description = "Additional extensions configuration in YAML format to append to the config." + description = "Base AMP configuration in JSON format. Can be overridden to customize AMP settings." + default = jsonencode({ + # Enable enhanced reasoning for better autonomous operation + "amp.anthropic.thinking.enabled" = true + + # Enable TODO tracking for task management + "amp.todos.enabled" = true + + # Optional: Configure tool permissions for autonomous operation + # Reference: https://ampcode.com/manual (see Permissions section) + # "amp.permissions" = [] + + # Optional: Extend timeout for long-running operations in CI/automation + # "amp.tools.stopTimeout" = 600 + + # Optional: Control environment loading frequency for performance + # "amp.terminal.commands.nodeSpawn.loadProfile" = "daily" + + # Optional: Disable tools that don't work well in remote environments + # "amp.tools.disable" = ["builtin:open"] + + # These remain at defaults (true) for autonomous operation: + # "amp.git.commit.ampThread.enabled" = true # Link commits to threads + # "amp.git.commit.coauthor.enabled" = true # Add Amp as co-author + + # MCP servers - automatically populated with Coder integration + "amp.mcpServers" = {} + }) +} + +variable "additional_mcp_servers" { + type = string + description = "Additional MCP servers configuration in JSON format to append to amp.mcpServers." default = null } locals { - base_extensions = <<-EOT -coder: - args: - - exp - - mcp - - server - cmd: coder - description: Report ALL tasks and statuses (in progress, done, failed) you are working on. - enabled: true - envs: - CODER_MCP_APP_STATUS_SLUG: ${local.app_slug} - CODER_MCP_AI_AGENTAPI_URL: http://localhost:3284 - name: Coder - timeout: 3000 - type: stdio -developer: - display_name: Developer - enabled: true - name: developer - timeout: 300 - type: builtin -EOT - - # Add two spaces to each line of extensions to match YAML structure - formatted_base = " ${replace(trimspace(local.base_extensions), "\n", "\n ")}" - additional_extensions = var.additional_extensions != null ? "\n ${replace(trimspace(var.additional_extensions), "\n", "\n ")}" : "" - combined_extensions = <<-EOT -extensions: -${local.formatted_base}${local.additional_extensions} -EOT - - app_slug = "amp" + app_slug = "amp" + + base_config = jsondecode(var.base_amp_config) + + coder_mcp = { + "coder" = { + "command" = "coder" + "args" = ["exp", "mcp", "server"] + "env" = { + "CODER_MCP_APP_STATUS_SLUG" = local.app_slug + "CODER_MCP_AI_AGENTAPI_URL" = "http://localhost:3284" + } + "type" = "stdio" + } + } + + additional_mcp = var.additional_mcp_servers != null ? jsondecode(var.additional_mcp_servers) : {} + + merged_mcp_servers = merge( + lookup(local.base_config, "amp.mcpServers", {}), + local.coder_mcp, + local.additional_mcp + ) + + final_config = merge(local.base_config, { + "amp.mcpServers" = local.merged_mcp_servers + }) + install_script = file("${path.module}/scripts/install.sh") start_script = file("${path.module}/scripts/start.sh") module_dir_name = ".sourcegraph-amp-module" @@ -166,7 +194,7 @@ module "agentapi" { chmod +x /tmp/install.sh ARG_INSTALL_SOURCEGRAPH_AMP='${var.install_sourcegraph_amp}' \ SOURCEGRAPH_AMP_START_DIRECTORY='${var.folder}' \ - ARG_SOURCEGRAPH_AMP_CONFIG="$(echo -n '${base64encode(local.combined_extensions)}' | base64 -d)" \ + ARG_AMP_CONFIG="$(echo -n '${base64encode(jsonencode(local.final_config))}' | base64 -d)" \ /tmp/install.sh EOT } diff --git a/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh index 944e28463..de55c7165 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh @@ -75,17 +75,22 @@ function setup_system_prompt() { fi } -function configure_mcp() { - echo "MCP Server Configure " - if [ "${ARG_SOURCEGRAPH_AMP_CONFIG}" != "" ]; then - echo "Configuring AMP..." - mkdir -p "$HOME/.config/amp" - echo "$ARG_SOURCEGRAPH_AMP_CONFIG" > "$HOME/.config/amp/config.yaml" - else - echo "Skipping AMP configuration" +function configure_amp_settings() { + echo "Configuring AMP settings..." + SETTINGS_PATH="$HOME/.config/amp/settings.json" + mkdir -p "$(dirname "$SETTINGS_PATH")" + + if [ -z "${ARG_AMP_CONFIG:-}" ]; then + echo "No AMP config provided, skipping configuration" + return fi + + echo "Writing AMP configuration to $SETTINGS_PATH" + printf '%s\n' "$ARG_AMP_CONFIG" > "$SETTINGS_PATH" + + echo "AMP configuration complete" } install_sourcegraph_amp setup_system_prompt -configure_mcp +configure_amp_settings From a743a466f238297f5e2e33502eb8db4a4b3f5333 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 19 Aug 2025 15:38:20 +0000 Subject: [PATCH 20/24] chore(sourcegraph_amp): replace SVG icon with logo sourced from presskit --- .icons/sourcegraph-amp.svg | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.icons/sourcegraph-amp.svg b/.icons/sourcegraph-amp.svg index cdcae4f21..83777bd2d 100644 --- a/.icons/sourcegraph-amp.svg +++ b/.icons/sourcegraph-amp.svg @@ -1,7 +1,5 @@ - - - - - - + + + + From ce2196d4e5f19f819bec3db86da7bcd9844811d2 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 19 Aug 2025 15:56:13 +0000 Subject: [PATCH 21/24] refactor(sourcegraph_amp): enhance base AMP configuration handling --- .../modules/sourcegraph_amp/main.tf | 51 ++++++++----------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/registry/coder-labs/modules/sourcegraph_amp/main.tf b/registry/coder-labs/modules/sourcegraph_amp/main.tf index 3db0da136..2d994c156 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/main.tf +++ b/registry/coder-labs/modules/sourcegraph_amp/main.tf @@ -86,34 +86,20 @@ variable "post_install_script" { variable "base_amp_config" { type = string - description = "Base AMP configuration in JSON format. Can be overridden to customize AMP settings." - default = jsonencode({ - # Enable enhanced reasoning for better autonomous operation - "amp.anthropic.thinking.enabled" = true - - # Enable TODO tracking for task management - "amp.todos.enabled" = true - - # Optional: Configure tool permissions for autonomous operation - # Reference: https://ampcode.com/manual (see Permissions section) - # "amp.permissions" = [] - - # Optional: Extend timeout for long-running operations in CI/automation - # "amp.tools.stopTimeout" = 600 - - # Optional: Control environment loading frequency for performance - # "amp.terminal.commands.nodeSpawn.loadProfile" = "daily" - - # Optional: Disable tools that don't work well in remote environments - # "amp.tools.disable" = ["builtin:open"] - - # These remain at defaults (true) for autonomous operation: - # "amp.git.commit.ampThread.enabled" = true # Link commits to threads - # "amp.git.commit.coauthor.enabled" = true # Add Amp as co-author - - # MCP servers - automatically populated with Coder integration - "amp.mcpServers" = {} - }) + description = <<-EOT + Base AMP configuration in JSON format. Can be overridden to customize AMP settings. + + If empty, defaults enable thinking and todos for autonomous operation. Additional options include: + - "amp.permissions": [] (tool permissions) + - "amp.tools.stopTimeout": 600 (extend timeout for long operations) + - "amp.terminal.commands.nodeSpawn.loadProfile": "daily" (environment loading) + - "amp.tools.disable": ["builtin:open"] (disable tools for containers) + - "amp.git.commit.ampThread.enabled": true (link commits to threads) + - "amp.git.commit.coauthor.enabled": true (add Amp as co-author) + + Reference: https://ampcode.com/manual + EOT + default = "" } variable "additional_mcp_servers" { @@ -125,7 +111,14 @@ variable "additional_mcp_servers" { locals { app_slug = "amp" - base_config = jsondecode(var.base_amp_config) + default_base_config = { + "amp.anthropic.thinking.enabled" = true + "amp.todos.enabled" = true + "amp.mcpServers" = {} + } + + # Use provided config or default + base_config = var.base_amp_config != "" ? jsondecode(var.base_amp_config) : local.default_base_config coder_mcp = { "coder" = { From 6a1c2db484d067c9801fb48468cd050a49760652 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 19 Aug 2025 15:56:22 +0000 Subject: [PATCH 22/24] chore: bun run fmt --- .../modules/sourcegraph_amp/main.test.ts | 42 ++++-- .../sourcegraph_amp/scripts/install.sh | 122 +++++++++--------- .../modules/sourcegraph_amp/scripts/start.sh | 26 ++-- 3 files changed, 105 insertions(+), 85 deletions(-) diff --git a/registry/coder-labs/modules/sourcegraph_amp/main.test.ts b/registry/coder-labs/modules/sourcegraph_amp/main.test.ts index 631d13044..a08497087 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/main.test.ts +++ b/registry/coder-labs/modules/sourcegraph_amp/main.test.ts @@ -78,7 +78,7 @@ describe("sourcegraph-amp", async () => { await execModuleScript(id); await expectAgentAPIStarted(id); }); - + test("api-key", async () => { const apiKey = "test-api-key-123"; const { id } = await setup({ @@ -87,7 +87,10 @@ describe("sourcegraph-amp", async () => { }, }); await execModuleScript(id); - const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/agentapi-start.log"); + const resp = await readFileContainer( + id, + "/home/coder/.sourcegraph-amp-module/agentapi-start.log", + ); expect(resp).toContain("sourcegraph_amp_api_key provided !"); }); @@ -99,7 +102,10 @@ describe("sourcegraph-amp", async () => { }, }); await execModuleScript(id); - const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/install.log"); + const resp = await readFileContainer( + id, + "/home/coder/.sourcegraph-amp-module/install.log", + ); expect(resp).toContain(folder); }); @@ -111,29 +117,41 @@ describe("sourcegraph-amp", async () => { }, }); await execModuleScript(id); - const preLog = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/pre_install.log"); + const preLog = await readFileContainer( + id, + "/home/coder/.sourcegraph-amp-module/pre_install.log", + ); expect(preLog).toContain("pre-install-script"); - const postLog = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/post_install.log"); + const postLog = await readFileContainer( + id, + "/home/coder/.sourcegraph-amp-module/post_install.log", + ); expect(postLog).toContain("post-install-script"); }); test("system-prompt", async () => { const prompt = "this is a system prompt for AMP"; - const {id} = await setup(); + const { id } = await setup(); await execModuleScript(id, { - SOURCEGRAPH_AMP_SYSTEM_PROMPT : prompt, + SOURCEGRAPH_AMP_SYSTEM_PROMPT: prompt, }); - const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/SYSTEM_PROMPT.md"); + const resp = await readFileContainer( + id, + "/home/coder/.sourcegraph-amp-module/SYSTEM_PROMPT.md", + ); expect(resp).toContain(prompt); }); test("task-prompt", async () => { const prompt = "this is a task prompt for AMP"; - const {id} = await setup(); + const { id } = await setup(); await execModuleScript(id, { - SOURCEGRAPH_AMP_TASK_PROMPT : prompt, + SOURCEGRAPH_AMP_TASK_PROMPT: prompt, }); - const resp = await readFileContainer(id, "/home/coder/.sourcegraph-amp-module/agentapi-start.log"); + const resp = await readFileContainer( + id, + "/home/coder/.sourcegraph-amp-module/agentapi-start.log", + ); expect(resp).toContain(`sourcegraph amp task prompt provided : ${prompt}`); - }) + }); }); diff --git a/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh index de55c7165..61e498b7b 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh +++ b/registry/coder-labs/modules/sourcegraph_amp/scripts/install.sh @@ -11,84 +11,84 @@ echo "--------------------------------" # Helper function to check if a command exists command_exists() { - command -v "$1" >/dev/null 2>&1 + command -v "$1" > /dev/null 2>&1 } function install_node() { - if ! command_exists npm; then - printf "npm not found, checking for Node.js installation...\n" - if ! command_exists node; then - printf "Node.js not found, installing Node.js via NVM...\n" - export NVM_DIR="$HOME/.nvm" - if [ ! -d "$NVM_DIR" ]; then - mkdir -p "$NVM_DIR" - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - else - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - fi + if ! command_exists npm; then + printf "npm not found, checking for Node.js installation...\n" + if ! command_exists node; then + printf "Node.js not found, installing Node.js via NVM...\n" + export NVM_DIR="$HOME/.nvm" + if [ ! -d "$NVM_DIR" ]; then + mkdir -p "$NVM_DIR" + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + else + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + fi - # Temporarily disable nounset (-u) for nvm to avoid PROVIDED_VERSION error - set +u - nvm install --lts - nvm use --lts - nvm alias default node - set -u + # Temporarily disable nounset (-u) for nvm to avoid PROVIDED_VERSION error + set +u + nvm install --lts + nvm use --lts + nvm alias default node + set -u - printf "Node.js installed: %s\n" "$(node --version)" - printf "npm installed: %s\n" "$(npm --version)" - else - printf "Node.js is installed but npm is not available. Please install npm manually.\n" - exit 1 - fi + printf "Node.js installed: %s\n" "$(node --version)" + printf "npm installed: %s\n" "$(npm --version)" + else + printf "Node.js is installed but npm is not available. Please install npm manually.\n" + exit 1 fi + fi } function install_sourcegraph_amp() { - if [ "${ARG_INSTALL_SOURCEGRAPH_AMP}" = "true" ]; then - install_node - - # If nvm is not used, set up user npm global directory - if ! command_exists nvm; then - mkdir -p "$HOME/.npm-global" - npm config set prefix "$HOME/.npm-global" - export PATH="$HOME/.npm-global/bin:$PATH" - if ! grep -q "export PATH=$HOME/.npm-global/bin:\$PATH" ~/.bashrc; then - echo "export PATH=$HOME/.npm-global/bin:\$PATH" >> ~/.bashrc - fi - fi + if [ "${ARG_INSTALL_SOURCEGRAPH_AMP}" = "true" ]; then + install_node - printf "%s Installing Sourcegraph AMP CLI...\n" "${BOLD}" - npm install -g @sourcegraph/amp@0.0.1754179307-gba1f97 - printf "%s Successfully installed Sourcegraph AMP CLI. Version: %s\n" "${BOLD}" "$(amp --version)" + # If nvm is not used, set up user npm global directory + if ! command_exists nvm; then + mkdir -p "$HOME/.npm-global" + npm config set prefix "$HOME/.npm-global" + export PATH="$HOME/.npm-global/bin:$PATH" + if ! grep -q "export PATH=$HOME/.npm-global/bin:\$PATH" ~/.bashrc; then + echo "export PATH=$HOME/.npm-global/bin:\$PATH" >> ~/.bashrc + fi fi + + printf "%s Installing Sourcegraph AMP CLI...\n" "${BOLD}" + npm install -g @sourcegraph/amp@0.0.1754179307-gba1f97 + printf "%s Successfully installed Sourcegraph AMP CLI. Version: %s\n" "${BOLD}" "$(amp --version)" + fi } function setup_system_prompt() { - if [ -n "${SOURCEGRAPH_AMP_SYSTEM_PROMPT:-}" ]; then - echo "Setting Sourcegraph AMP system prompt..." - mkdir -p "$HOME/.sourcegraph-amp-module" - echo "$SOURCEGRAPH_AMP_SYSTEM_PROMPT" > "$HOME/.sourcegraph-amp-module/SYSTEM_PROMPT.md" - echo "System prompt saved to $HOME/.sourcegraph-amp-module/SYSTEM_PROMPT.md" - else - echo "No system prompt provided for Sourcegraph AMP." - fi + if [ -n "${SOURCEGRAPH_AMP_SYSTEM_PROMPT:-}" ]; then + echo "Setting Sourcegraph AMP system prompt..." + mkdir -p "$HOME/.sourcegraph-amp-module" + echo "$SOURCEGRAPH_AMP_SYSTEM_PROMPT" > "$HOME/.sourcegraph-amp-module/SYSTEM_PROMPT.md" + echo "System prompt saved to $HOME/.sourcegraph-amp-module/SYSTEM_PROMPT.md" + else + echo "No system prompt provided for Sourcegraph AMP." + fi } function configure_amp_settings() { - echo "Configuring AMP settings..." - SETTINGS_PATH="$HOME/.config/amp/settings.json" - mkdir -p "$(dirname "$SETTINGS_PATH")" - - if [ -z "${ARG_AMP_CONFIG:-}" ]; then - echo "No AMP config provided, skipping configuration" - return - fi - - echo "Writing AMP configuration to $SETTINGS_PATH" - printf '%s\n' "$ARG_AMP_CONFIG" > "$SETTINGS_PATH" - - echo "AMP configuration complete" + echo "Configuring AMP settings..." + SETTINGS_PATH="$HOME/.config/amp/settings.json" + mkdir -p "$(dirname "$SETTINGS_PATH")" + + if [ -z "${ARG_AMP_CONFIG:-}" ]; then + echo "No AMP config provided, skipping configuration" + return + fi + + echo "Writing AMP configuration to $SETTINGS_PATH" + printf '%s\n' "$ARG_AMP_CONFIG" > "$SETTINGS_PATH" + + echo "AMP configuration complete" } install_sourcegraph_amp diff --git a/registry/coder-labs/modules/sourcegraph_amp/scripts/start.sh b/registry/coder-labs/modules/sourcegraph_amp/scripts/start.sh index 6fed2a39d..252b343f8 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/scripts/start.sh +++ b/registry/coder-labs/modules/sourcegraph_amp/scripts/start.sh @@ -12,13 +12,15 @@ else fi function ensure_command() { - command -v "$1" &>/dev/null || { echo "Error: '$1' not found." >&2; exit 1; } + command -v "$1" &> /dev/null || { + echo "Error: '$1' not found." >&2 + exit 1 + } } ensure_command amp echo "AMP version: $(amp --version)" - dir="$SOURCEGRAPH_AMP_START_DIRECTORY" if [[ -d "$dir" ]]; then echo "Using existing directory: $dir" @@ -29,19 +31,19 @@ fi cd "$dir" if [ -n "$SOURCEGRAPH_AMP_API_KEY" ]; then - printf "sourcegraph_amp_api_key provided !\n" - export AMP_API_KEY=$SOURCEGRAPH_AMP_API_KEY + printf "sourcegraph_amp_api_key provided !\n" + export AMP_API_KEY=$SOURCEGRAPH_AMP_API_KEY else - printf "sourcegraph_amp_api_key not provided\n" + printf "sourcegraph_amp_api_key not provided\n" fi if [ -n "${SOURCEGRAPH_AMP_TASK_PROMPT:-}" ]; then - printf "sourcegraph amp task prompt provided : $SOURCEGRAPH_AMP_TASK_PROMPT" - PROMPT="Every step of the way, report tasks to Coder with proper descriptions and statuses. Your task at hand: $SOURCEGRAPH_AMP_TASK_PROMPT" + printf "sourcegraph amp task prompt provided : $SOURCEGRAPH_AMP_TASK_PROMPT" + PROMPT="Every step of the way, report tasks to Coder with proper descriptions and statuses. Your task at hand: $SOURCEGRAPH_AMP_TASK_PROMPT" - # Pipe the prompt into amp, which will be run inside agentapi - agentapi server --term-width=67 --term-height=1190 -- bash -c "echo \"$PROMPT\" | amp" + # Pipe the prompt into amp, which will be run inside agentapi + agentapi server --term-width=67 --term-height=1190 -- bash -c "echo \"$PROMPT\" | amp" else - printf "No task prompt given.\n" - agentapi server --term-width=67 --term-height=1190 -- amp -fi \ No newline at end of file + printf "No task prompt given.\n" + agentapi server --term-width=67 --term-height=1190 -- amp +fi From 394a6d523fb334e51d3d985b01473e503ee38113 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 19 Aug 2025 16:21:42 +0000 Subject: [PATCH 23/24] refactor(sourcegraph_amp): improve AMP configuration handling --- .../coder-labs/modules/sourcegraph_amp/main.tf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/registry/coder-labs/modules/sourcegraph_amp/main.tf b/registry/coder-labs/modules/sourcegraph_amp/main.tf index 2d994c156..033fc84ed 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/main.tf +++ b/registry/coder-labs/modules/sourcegraph_amp/main.tf @@ -99,7 +99,7 @@ variable "base_amp_config" { Reference: https://ampcode.com/manual EOT - default = "" + default = "" } variable "additional_mcp_servers" { @@ -113,12 +113,12 @@ locals { default_base_config = { "amp.anthropic.thinking.enabled" = true - "amp.todos.enabled" = true - "amp.mcpServers" = {} + "amp.todos.enabled" = true } - # Use provided config or default - base_config = var.base_amp_config != "" ? jsondecode(var.base_amp_config) : local.default_base_config + # Use provided config or default, then extract base settings (excluding mcpServers) + user_config = var.base_amp_config != "" ? jsondecode(var.base_amp_config) : local.default_base_config + base_amp_settings = { for k, v in local.user_config : k => v if k != "amp.mcpServers" } coder_mcp = { "coder" = { @@ -135,12 +135,12 @@ locals { additional_mcp = var.additional_mcp_servers != null ? jsondecode(var.additional_mcp_servers) : {} merged_mcp_servers = merge( - lookup(local.base_config, "amp.mcpServers", {}), + lookup(local.user_config, "amp.mcpServers", {}), local.coder_mcp, local.additional_mcp ) - final_config = merge(local.base_config, { + final_config = merge(local.base_amp_settings, { "amp.mcpServers" = local.merged_mcp_servers }) From 56674f1ede49d9bffd587de6807ffdbf012ae388 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 19 Aug 2025 17:05:49 +0000 Subject: [PATCH 24/24] fix(sourcegraph_amp): update icon path in README for consistency --- registry/coder-labs/modules/sourcegraph_amp/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/sourcegraph_amp/README.md b/registry/coder-labs/modules/sourcegraph_amp/README.md index 697596ee0..45d175d24 100644 --- a/registry/coder-labs/modules/sourcegraph_amp/README.md +++ b/registry/coder-labs/modules/sourcegraph_amp/README.md @@ -1,6 +1,6 @@ --- display_name: Sourcegraph AMP -icon: ../../../../.icons/sourcegraph_amp.svg +icon: ../../../../.icons/sourcegraph-amp.svg description: Run Sourcegraph AMP CLI in your workspace with AgentAPI integration verified: false tags: [agent, sourcegraph, amp, ai, tasks]