From 8faa831a93984cdc3998a9c048f92ad1fd3743bb Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Thu, 21 Aug 2025 12:00:12 +0530 Subject: [PATCH 01/22] feat: add auggie cli --- registry/coder-labs/modules/auggie/README.md | 190 +++++++++++ .../modules/auggie/auggie.tftest.hcl | 186 +++++++++++ .../coder-labs/modules/auggie/main.test.ts | 301 ++++++++++++++++++ registry/coder-labs/modules/auggie/main.tf | 196 ++++++++++++ .../modules/auggie/scripts/install.sh | 130 ++++++++ .../modules/auggie/scripts/start.sh | 112 +++++++ .../modules/auggie/testdata/auggie-mock.sh | 14 + 7 files changed, 1129 insertions(+) create mode 100644 registry/coder-labs/modules/auggie/README.md create mode 100644 registry/coder-labs/modules/auggie/auggie.tftest.hcl create mode 100644 registry/coder-labs/modules/auggie/main.test.ts create mode 100644 registry/coder-labs/modules/auggie/main.tf create mode 100644 registry/coder-labs/modules/auggie/scripts/install.sh create mode 100644 registry/coder-labs/modules/auggie/scripts/start.sh create mode 100644 registry/coder-labs/modules/auggie/testdata/auggie-mock.sh diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md new file mode 100644 index 000000000..a7ee98f2d --- /dev/null +++ b/registry/coder-labs/modules/auggie/README.md @@ -0,0 +1,190 @@ +--- +display_name: Auggie CLI +icon: ../../../../.icons/auggie.svg +description: Run Auggie CLI in your workspace for AI-powered coding assistance with AgentAPI integration +verified: true +tags: [agent, auggie, ai, tasks, augment] +--- + +# Auggie CLI + +Run Auggie CLI in your workspace to access Augment's AI coding assistant with advanced context understanding and codebase integration. This module integrates with [AgentAPI](https://github.com/coder/agentapi) for Coder Tasks compatibility. + +```tf +module "auggie" { + source = "registry.coder.com/coder-labs/auggie/coder" + version = "0.1.0" + agent_id = coder_agent.example.id + folder = "/home/coder/project" +} +``` + +## Prerequisites + +- You must add the [Coder Login](https://registry.coder.com/modules/coder/coder-login) module to your template +- **Augment session token for authentication (required for tasks)** + +## Usage Examples + +### Simple Usage + +```tf +module "auggie" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder-labs/auggie/coder" + version = "0.1.0" + agent_id = coder_agent.example.id + folder = "/home/coder/project" + + # Optional: Specify Auggie version + install_auggie = true + auggie_version = "latest" +} +``` + +### Advanced Usage with Tasks and Configuration + +```tf +data "coder_parameter" "ai_prompt" { + type = "string" + name = "AI Prompt" + default = "" + description = "Initial task prompt for Auggie CLI" + mutable = true +} + +module "coder-login" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/coder-login/coder" + version = "1.0.31" + agent_id = coder_agent.example.id +} + +module "auggie" { + source = "registry.coder.com/coder-labs/auggie/coder" + version = "0.1.0" + agent_id = coder_agent.example.id + folder = "/home/coder/project" + + # Authentication + augment_session_token = <<-EOF + {"accessToken":"xxxx-yyyy-zzzz-jjjj","tenantURL":"https://d1.api.augmentcode.com/","scopes":["read","write"]} +EOF # Required for tasks + + # Task configuration + ai_prompt = data.coder_parameter.ai_prompt.value + continue_previous_conversation = true + interaction_mode = "quiet" + auggie_model = "gpt-5" + + # MCP configuration for additional integrations + mcp = <<-EOF +{ + "mcpServers": { + "filesystem": { + "command": "npx", + "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/coder/project"] + }, + "git": { + "command": "npx", + "args": ["-y", "@modelcontextprotocol/server-git", "--repository", "/home/coder/project"] + } + } +} +EOF + + # Workspace guidelines + rules = <<-EOT + # Project Guidelines + + ## Code Style + - Use TypeScript for all new JavaScript files + - Follow consistent naming conventions + - Add comprehensive comments for complex logic + + ## Testing + - Write unit tests for all new functions + - Ensure test coverage above 80% + + ## Documentation + - Update README.md for any new features + - Document API changes in CHANGELOG.md + EOT +} +``` + +### Using Multiple MCP Configuration Files + +```tf +module "auggie" { + source = "registry.coder.com/coder-labs/auggie/coder" + version = "0.1.0" + agent_id = coder_agent.example.id + folder = "/home/coder/project" + + # Multiple MCP configuration files + mcp_files = [ + "/path/to/filesystem-mcp.json", + "/path/to/database-mcp.json", + "/path/to/api-mcp.json" + ] + + mcp = <<-EOF + { + "mcpServers": { + "Test MCP": { + "command": "uv", + "args": [ + "--directory", + "/home/coder/test-mcp", + "run", + "server.py" + ], + "timeout": 600 + } + } +} +EOF + + # Custom install scripts + pre_install_script = <<-EOT + #!/usr/bin/env bash + set -euo pipefail + # Install additional dependencies + npm install -g typescript + pip install -r requirements.txt + EOT + + post_install_script = <<-EOT + #!/usr/bin/env bash + set -euo pipefail + # Setup project-specific configuration + echo "Auggie setup complete for $(pwd)" + EOT +} +``` + +### Log Files + +```bash +# Installation logs +cat ~/.auggie-module/install.log + +# Startup logs +cat ~/.auggie-module/agentapi-start.log + +# Pre/post install script logs +cat ~/.auggie-module/pre_install.log +cat ~/.auggie-module/post_install.log +``` + +> [!NOTE] +> To use tasks with Auggie CLI, create a `coder_parameter` named `"AI Prompt"` and pass its value to the auggie module's `ai_prompt` variable. The `folder` variable is required for the module to function correctly. + +## References + +- [Augment Code Documentation](https://docs.augmentcode.com/) +- [Auggie CLI Reference](https://docs.augmentcode.com/cli/reference) +- [MCP Integration Guide](https://docs.augmentcode.com/cli/integrations#mcp-integrations) +- [AgentAPI Documentation](https://github.com/coder/agentapi) +- [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents) diff --git a/registry/coder-labs/modules/auggie/auggie.tftest.hcl b/registry/coder-labs/modules/auggie/auggie.tftest.hcl new file mode 100644 index 000000000..eae010799 --- /dev/null +++ b/registry/coder-labs/modules/auggie/auggie.tftest.hcl @@ -0,0 +1,186 @@ +run "test_auggie_basic" { + command = plan + + variables { + agent_id = "test-agent-123" + folder = "/home/coder/projects" + } + + assert { + condition = coder_env.auggie_session_auth.name == "AUGMENT_SESSION_AUTH" + error_message = "Auggie session auth environment variable should be set correctly" + } + + assert { + condition = var.folder == "/home/coder/projects" + error_message = "Folder variable should be set correctly" + } + + assert { + condition = var.agent_id == "test-agent-123" + error_message = "Agent ID variable should be set correctly" + } + + assert { + condition = var.install_auggie == true + error_message = "Install auggie should default to true" + } + + assert { + condition = var.install_agentapi == true + error_message = "Install agentapi should default to true" + } +} + +run "test_auggie_with_session_token" { + command = plan + + variables { + agent_id = "test-agent-456" + folder = "/home/coder/workspace" + augment_session_token = "test-session-token-123" + } + + assert { + condition = coder_env.auggie_session_auth.value == "test-session-token-123" + error_message = "Auggie session token value should match the input" + } +} + +run "test_auggie_with_custom_options" { + command = plan + + variables { + agent_id = "test-agent-789" + folder = "/home/coder/custom" + order = 5 + group = "development" + icon = "/icon/custom.svg" + auggie_model = "gpt-4" + ai_prompt = "Help me write better code" + interaction_mode = "compact" + continue_previous_conversation = true + install_auggie = false + install_agentapi = false + auggie_version = "1.0.0" + agentapi_version = "v0.6.0" + } + + assert { + condition = var.order == 5 + error_message = "Order variable should be set to 5" + } + + assert { + condition = var.group == "development" + error_message = "Group variable should be set to 'development'" + } + + assert { + condition = var.icon == "/icon/custom.svg" + error_message = "Icon variable should be set to custom icon" + } + + assert { + condition = var.auggie_model == "gpt-4" + error_message = "Auggie model variable should be set to 'gpt-4'" + } + + assert { + condition = var.ai_prompt == "Help me write better code" + error_message = "AI prompt variable should be set correctly" + } + + assert { + condition = var.interaction_mode == "compact" + error_message = "Interaction mode should be set to 'compact'" + } + + assert { + condition = var.continue_previous_conversation == true + error_message = "Continue previous conversation should be set to true" + } + + assert { + condition = var.auggie_version == "1.0.0" + error_message = "Auggie version should be set to '1.0.0'" + } + + assert { + condition = var.agentapi_version == "v0.6.0" + error_message = "AgentAPI version should be set to 'v0.6.0'" + } +} + +run "test_auggie_with_mcp_and_rules" { + command = plan + + variables { + agent_id = "test-agent-mcp" + folder = "/home/coder/mcp-test" + mcp = jsonencode({ + mcpServers = { + test = { + command = "test-server" + args = ["--config", "test.json"] + } + } + }) + mcp_files = [ + "/path/to/mcp1.json", + "/path/to/mcp2.json" + ] + rules = "# General coding rules\n- Write clean code\n- Add comments" + } + + assert { + condition = var.mcp != "" + error_message = "MCP configuration should be provided" + } + + assert { + condition = length(var.mcp_files) == 2 + error_message = "Should have 2 MCP files" + } + + assert { + condition = var.rules != "" + error_message = "Rules should be provided" + } +} + +run "test_auggie_with_scripts" { + command = plan + + variables { + agent_id = "test-agent-scripts" + folder = "/home/coder/scripts" + pre_install_script = "echo 'Pre-install script'" + post_install_script = "echo 'Post-install script'" + } + + assert { + condition = var.pre_install_script == "echo 'Pre-install script'" + error_message = "Pre-install script should be set correctly" + } + + assert { + condition = var.post_install_script == "echo 'Post-install script'" + error_message = "Post-install script should be set correctly" + } +} + +run "test_auggie_interaction_mode_validation" { + command = plan + + variables { + agent_id = "test-agent-validation" + folder = "/home/coder/test" + interaction_mode = "print" + } + + assert { + condition = contains(["interactive", "print", "quiet", "compact"], var.interaction_mode) + error_message = "Interaction mode should be one of the valid options" + } +} diff --git a/registry/coder-labs/modules/auggie/main.test.ts b/registry/coder-labs/modules/auggie/main.test.ts new file mode 100644 index 000000000..abb111a0a --- /dev/null +++ b/registry/coder-labs/modules/auggie/main.test.ts @@ -0,0 +1,301 @@ +import { + 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"; +import dedent from "dedent"; + +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; + skipAuggieMock?: 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_auggie: props?.skipAuggieMock ? "true" : "false", + install_agentapi: props?.skipAgentAPIMock ? "true" : "false", + folder: projectDir, + ...props?.moduleVariables, + }, + registerCleanup, + projectDir, + skipAgentAPIMock: props?.skipAgentAPIMock, + agentapiMockScript: props?.agentapiMockScript, + }); + if (!props?.skipAuggieMock) { + await writeExecutable({ + containerId: id, + filePath: "/usr/bin/auggie", + content: await loadTestFile(import.meta.dir, "auggie-mock.sh"), + }); + } + return { id }; +}; + +setDefaultTimeout(60 * 1000); + +describe("auggie", async () => { + beforeAll(async () => { + await runTerraformInit(import.meta.dir); + }); + + test("happy-path", async () => { + const { id } = await setup(); + await execModuleScript(id); + await expectAgentAPIStarted(id); + }); + + test("install-auggie-version", async () => { + const version_to_install = "0.3.0"; + const { id } = await setup({ + skipAuggieMock: true, + moduleVariables: { + install_auggie: "true", + auggie_version: version_to_install, + }, + }); + await execModuleScript(id); + const resp = await execContainer(id, [ + "bash", + "-c", + `cat /home/coder/.auggie-module/install.log`, + ]); + expect(resp.stdout).toContain(version_to_install); + }); + + test("check-latest-auggie-version-works", async () => { + const { id } = await setup({ + skipAuggieMock: true, + skipAgentAPIMock: true, + moduleVariables: { + install_auggie: "true", + }, + }); + await execModuleScript(id); + await expectAgentAPIStarted(id); + }); + + test("auggie-session-token", async () => { + const sessionToken = "test-session-token-123"; + const { id } = await setup({ + moduleVariables: { + augment_session_token: sessionToken, + }, + }); + await execModuleScript(id); + + const envCheck = await execContainer(id, [ + "bash", + "-c", + `env | grep AUGMENT_SESSION_AUTH || echo "AUGMENT_SESSION_AUTH not found"`, + ]); + expect(envCheck.stdout).toContain("AUGMENT_SESSION_AUTH"); + }); + + test("auggie-mcp-config", async () => { + const mcpConfig = JSON.stringify({ + mcpServers: { + test: { + command: "test-cmd", + type: "stdio" + } + } + }); + const { id } = await setup({ + moduleVariables: { + mcp: mcpConfig, + }, + }); + await execModuleScript(id); + + const resp = await readFileContainer( + id, + "/home/coder/.auggie-module/agentapi-start.log", + ); + expect(resp).toContain("--mcp-config"); + }); + + test("auggie-rules", async () => { + const rules = "Always use TypeScript for new files"; + const { id } = await setup({ + moduleVariables: { + rules: rules, + }, + }); + await execModuleScript(id); + + const rulesFile = await readFileContainer(id, "/home/coder/.augment/rules.md"); + expect(rulesFile).toContain(rules); + }); + + test("auggie-ai-task-prompt", async () => { + const prompt = "This is a task prompt for Auggie."; + const { id } = await setup({ + moduleVariables: { + ai_prompt: prompt, + }, + }); + await execModuleScript(id); + + const resp = await execContainer(id, [ + "bash", + "-c", + `cat /home/coder/.auggie-module/agentapi-start.log`, + ]); + expect(resp.stdout).toContain(prompt); + }); + + test("auggie-interaction-mode", async () => { + const mode = "compact"; + const { id } = await setup({ + moduleVariables: { + interaction_mode: mode, + ai_prompt: "test prompt", + }, + }); + await execModuleScript(id); + + const startLog = await execContainer(id, [ + "bash", + "-c", + "cat /home/coder/.auggie-module/agentapi-start.log", + ]); + expect(startLog.stdout).toContain(`--${mode}`); + }); + + test("auggie-model", async () => { + const model = "gpt-4"; + const { id } = await setup({ + moduleVariables: { + auggie_model: model, + ai_prompt: "test prompt", + }, + }); + await execModuleScript(id); + + const startLog = await execContainer(id, [ + "bash", + "-c", + "cat /home/coder/.auggie-module/agentapi-start.log", + ]); + expect(startLog.stdout).toContain(`--model ${model}`); + }); + + test("auggie-continue-previous-conversation", async () => { + const { id } = await setup({ + moduleVariables: { + continue_previous_conversation: "true", + ai_prompt: "test prompt", + }, + }); + await execModuleScript(id); + + const startLog = await execContainer(id, [ + "bash", + "-c", + "cat /home/coder/.auggie-module/agentapi-start.log", + ]); + expect(startLog.stdout).toContain("--continue"); + }); + + test("pre-post-install-scripts", async () => { + const { id } = await setup({ + moduleVariables: { + pre_install_script: "#!/bin/bash\necho 'auggie-pre-install-script'", + post_install_script: "#!/bin/bash\necho 'auggie-post-install-script'", + }, + }); + await execModuleScript(id); + + const preInstallLog = await readFileContainer( + id, + "/home/coder/.auggie-module/pre_install.log", + ); + expect(preInstallLog).toContain("auggie-pre-install-script"); + + const postInstallLog = await readFileContainer( + id, + "/home/coder/.auggie-module/post_install.log", + ); + expect(postInstallLog).toContain("auggie-post-install-script"); + }); + + test("folder-variable", async () => { + const folder = "/home/coder/auggie-test-folder"; + const { id } = await setup({ + skipAuggieMock: false, + moduleVariables: { + folder, + }, + }); + await execModuleScript(id); + + const resp = await readFileContainer( + id, + "/home/coder/.auggie-module/agentapi-start.log", + ); + expect(resp).toContain(folder); + }); + + test("coder-mcp-config-created", async () => { + const { id } = await setup(); + await execModuleScript(id); + + const mcpConfig = await readFileContainer(id, "/home/coder/.augment/coder_mcp.json"); + expect(mcpConfig).toContain("mcpServers"); + expect(mcpConfig).toContain("coder"); + expect(mcpConfig).toContain("CODER_MCP_APP_STATUS_SLUG"); + expect(mcpConfig).toContain("CODER_MCP_AI_AGENTAPI_URL"); + }); + + test("mcp-files-array", async () => { + const mcpFiles = ["/path/to/mcp1.json", "/path/to/mcp2.json"]; + const { id } = await setup({ + moduleVariables: { + mcp_files: JSON.stringify(mcpFiles), + ai_prompt: "test prompt", + }, + }); + await execModuleScript(id); + + const startLog = await execContainer(id, [ + "bash", + "-c", + "cat /home/coder/.auggie-module/agentapi-start.log", + ]); + expect(startLog.stdout).toContain("mcp1.json"); + expect(startLog.stdout).toContain("mcp2.json"); + }); +}); diff --git a/registry/coder-labs/modules/auggie/main.tf b/registry/coder-labs/modules/auggie/main.tf new file mode 100644 index 000000000..bb51d2a11 --- /dev/null +++ b/registry/coder-labs/modules/auggie/main.tf @@ -0,0 +1,196 @@ +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/auggie.svg" +} + +variable "folder" { + type = string + description = "The folder to run Codex in." +} + +variable "install_auggie" { + type = bool + description = "Whether to install Auggie CLI." + default = true +} + +variable "auggie_version" { + type = string + description = "The version of Auggie to install." + default = "" # empty string means the latest available version +} + +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.5.0" +} + +variable "pre_install_script" { + type = string + description = "Custom script to run before installing Codex." + default = null +} + +variable "post_install_script" { + type = string + description = "Custom script to run after installing Codex." + default = null +} + +# ---------------------------------------------- + +variable "ai_prompt" { + type = string + description = "Task prompt for the Auggie CLI" + default = "" +} + +variable "mcp" { + type = string + description = "MCP configuration as a JSON string for the auggie cli, check https://docs.augmentcode.com/cli/integrations#mcp-integrations" + default = "" +} + +variable "mcp_files" { + type = list(string) + description = "MCP configuration from a JSON file for the auggie cli, check https://docs.augmentcode.com/cli/integrations#mcp-integrations" + default = [] +} + +variable "rules" { + type = string + description = "Additional rules to append to workspace guidelines (markdown format)" + default = "" +} + +variable "continue_previous_conversation" { + type = bool + description = "Whether to resume the previous conversation." + default = false +} + +variable "interaction_mode" { + type = string + description = "Interaction mode with the Auggie CLI. Options: interactive, print, quiet, compact. https://docs.augmentcode.com/cli/reference#cli-flags" + default = "interactive" + validation { + condition = contains(["interactive", "print", "quiet", "compact"], var.interaction_mode) + error_message = "interaction_mode must be one of: interactive, print, quiet, compact." + } +} + +variable "augment_session_token" { + type = string + description = "Auggie session token for authentication. https://docs.augmentcode.com/cli/setup-auggie/authentication" + default = "" +} + +variable "auggie_model" { + type = string + description = "The model to use for Auggie, find available models using auggie --list-models" + default = "" +} + +resource "coder_env" "auggie_session_auth" { + agent_id = var.agent_id + name = "AUGMENT_SESSION_AUTH" + value = var.augment_session_token +} + +locals { + app_slug = "auggie" + install_script = file("${path.module}/scripts/install.sh") + start_script = file("${path.module}/scripts/start.sh") + module_dir_name = ".auggie-module" +} + +module "agentapi" { + source = "registry.coder.com/coder/agentapi/coder" + version = "1.1.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 = "Auggie" + cli_app_slug = "${local.app_slug}-cli" + cli_app_display_name = "Auggie 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 + ARG_AUGGIE_START_DIRECTORY='${var.folder}' \ + ARG_TASK_PROMPT='${base64encode(var.ai_prompt)}' \ + ARG_MCP_CONFIG='${var.mcp != null ? base64encode(replace(var.mcp, "'", "'\\''")) : ""}' \ + ARG_MCP_FILES='${jsonencode(var.mcp_files)}' \ + ARG_AUGGIE_RULES='${base64encode(var.rules)}' \ + ARG_AUGGIE_CONTINUE_PREVIOUS_CONVERSATION='${var.continue_previous_conversation}' \ + ARG_AUGGIE_INTERACTION_MODE='${var.interaction_mode}' \ + ARG_AUGMENT_SESSION_AUTH='${var.augment_session_token}' \ + ARG_AUGGIE_MODEL='${var.auggie_model}' \ + /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_AUGGIE_INSTALL='${var.install_auggie}' \ + ARG_AUGGIE_VERSION='${var.auggie_version}' \ + ARG_MCP_APP_STATUS_SLUG='${local.app_slug}' \ + ARG_AUGGIE_RULES='${base64encode(var.rules)}' \ + /tmp/install.sh + EOT +} \ No newline at end of file diff --git a/registry/coder-labs/modules/auggie/scripts/install.sh b/registry/coder-labs/modules/auggie/scripts/install.sh new file mode 100644 index 000000000..1ace92336 --- /dev/null +++ b/registry/coder-labs/modules/auggie/scripts/install.sh @@ -0,0 +1,130 @@ +#!/bin/bash +source "$HOME"/.bashrc + +BOLD='\033[0;1m' + +# Function to check if a command exists +command_exists() { + command -v "$1" > /dev/null 2>&1 +} +set -o errexit +set -o pipefail +set -o nounset + +ARG_AUGGIE_INSTALL=${ARG_AUGGIE_INSTALL:-true} +ARG_AUGGIE_VERSION=${ARG_AUGGIE_VERSION:-} +ARG_MCP_APP_STATUS_SLUG=${ARG_MCP_APP_STATUS_SLUG:-} +ARG_AUGGIE_RULES=$(echo -n "${ARG_AUGGIE_RULES:-}" | base64 -d) + +echo "--------------------------------" + +printf "install auggie: %s\n" "$ARG_AUGGIE_INSTALL" +printf "auggie_version: %s\n" "$ARG_AUGGIE_VERSION" +printf "app_slug: %s\n" "$ARG_MCP_APP_STATUS_SLUG" +printf "rules: %s\n" "$ARG_AUGGIE_RULES" + +echo "--------------------------------" + +set +o nounset + +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_auggie() { + if [ "${ARG_AUGGIE_INSTALL}" = "true" ]; then + install_node + + # If nvm does not exist, we will create a global npm directory (this os to prevent the possibility of EACCESS issues on npm -g) + if ! command_exists nvm; then + printf "which node: %s\n" "$(which node)" + printf "which npm: %s\n" "$(which npm)" + + # Create a directory for global packages + mkdir -p "$HOME"/.npm-global + + # Configure npm to use it + npm config set prefix "$HOME/.npm-global" + + # Add to PATH for current session + export PATH="$HOME/.npm-global/bin:$PATH" + + # Add to shell profile for future sessions + 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 Auggie CLI\n" "${BOLD}" + + if [ -n "$ARG_AUGGIE_VERSION" ]; then + npm install -g "@augmentcode/auggie@$ARG_AUGGIE_VERSION" + else + npm install -g "@augmentcode/auggie" + fi + printf "%s Successfully installed Auggie CLI. Version: %s\n" "${BOLD}" "$(auggie --version)" + fi +} + +function create_coder_mcp() { + AUGGIE_CODER_MCP_FILE="$HOME/.augment/coder_mcp.json" + CODER_MCP=$( + cat << EOF +{ + "mcpServers":{ + "coder": { + "args": ["exp", "mcp", "server"], + "command": "coder", + "env": { + "CODER_MCP_APP_STATUS_SLUG": "${ARG_MCP_APP_STATUS_SLUG}", + "CODER_MCP_AI_AGENTAPI_URL": "http://localhost:3284", + "CODER_AGENT_URL": "${CODER_AGENT_URL}", + "CODER_AGENT_TOKEN": "${CODER_AGENT_TOKEN}" + } + } + } +} +EOF +) + mkdir -p "$(dirname "$AUGGIE_CODER_MCP_FILE")" + echo "$CODER_MCP" > "$AUGGIE_CODER_MCP_FILE" + printf "Coder MCP config created at: %s\n" "$AUGGIE_CODER_MCP_FILE" +} + +function create_rules_file() { + AUGGIE_RULES_FILE="$HOME/.augment/rules.md" + if [ -n "$ARG_AUGGIE_RULES" ]; then + mkdir -p "$(dirname "$AUGGIE_RULES_FILE")" + echo -n "$ARG_AUGGIE_RULES" > "$AUGGIE_RULES_FILE" + printf "Rules file created at: %s\n" "$AUGGIE_RULES_FILE" + else + printf "No rules provided, skipping rules file creation.\n" + fi +} + +install_auggie +create_coder_mcp +create_rules_file \ No newline at end of file diff --git a/registry/coder-labs/modules/auggie/scripts/start.sh b/registry/coder-labs/modules/auggie/scripts/start.sh new file mode 100644 index 000000000..ad7fde186 --- /dev/null +++ b/registry/coder-labs/modules/auggie/scripts/start.sh @@ -0,0 +1,112 @@ +#!/bin/bash +set -o errexit +set -o pipefail + +source "$HOME"/.bashrc + +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +if [ -f "$HOME/.nvm/nvm.sh" ]; then + source "$HOME"/.nvm/nvm.sh +else + export PATH="$HOME/.npm-global/bin:$PATH" +fi + + +set -o errexit +set -o pipefail +set -o nounset + +ARG_AUGGIE_START_DIRECTORY=${ARG_AUGGIE_START_DIRECTORY:-"$HOME"} +ARG_TASK_PROMPT=$(echo -n "${ARG_TASK_PROMPT:-}" | base64 -d) +ARG_MCP_CONFIG=${ARG_MCP_CONFIG:-} +ARG_MCP_FILES=${ARG_MCP_FILES:-[]} +ARG_AUGGIE_RULES=${ARG_AUGGIE_RULES:-} +ARG_AUGMENT_SESSION_AUTH=${ARG_AUGMENT_SESSION_AUTH:-} +ARG_AUGGIE_CONTINUE_PREVIOUS_CONVERSATION=${ARG_AUGGIE_CONTINUE_PREVIOUS_CONVERSATION:-false} +ARG_AUGGIE_INTERACTION_MODE=${ARG_AUGGIE_INTERACTION_MODE:-"interactive"} +ARG_AUGGIE_MODEL=${ARG_AUGGIE_MODEL:-} + +ARGS=() + + +echo "--------------------------------" + +printf "auggie_start_directory: %s\n" "$ARG_AUGGIE_START_DIRECTORY" +printf "task_prompt: %s\n" "$ARG_TASK_PROMPT" +printf "mcp_config: %s\n" "$ARG_MCP_CONFIG" +printf "mcp_files: %s\n" "$ARG_MCP_FILES" +printf "auggie_rules: %s\n" "$ARG_AUGGIE_RULES" +printf "continue_previous_conversation: %s\n" "$ARG_AUGGIE_CONTINUE_PREVIOUS_CONVERSATION" +printf "auggie_interaction_mode: %s\n" "$ARG_AUGGIE_INTERACTION_MODE" +printf "augment_session_auth: %s\n" "$ARG_AUGMENT_SESSION_AUTH" +printf "auggie_model: %s\n" "$ARG_AUGGIE_MODEL" + +echo "--------------------------------" + +set +o nounset + + +function validate_auggie_installation() { + if command_exists auggie; then + printf "Auggie is installed\n" + else + printf "Error: Auggie is not installed. Please enable install_auggie or install it manually\n" + exit 1 + fi +} + +function build_auggie_args() { + if [ -n "$ARG_AUGGIE_INTERACTION_MODE" ]; then + if [ "$ARG_AUGGIE_INTERACTION_MODE" != "interactive" ]; then + ARGS+=(--"$ARG_AUGGIE_INTERACTION_MODE") + fi + fi + + if [ -n "$ARG_AUGGIE_MODEL" ]; then + ARGS+=(--model "$ARG_AUGGIE_MODEL") + fi + + if [ -n "$ARG_MCP_CONFIG" ]; then + ARGS+=(--mcp-config "$ARG_MCP_CONFIG") + fi + + if [ -n "$ARG_MCP_FILES" ]; then + for file in $(echo "$ARG_MCP_FILES" | jq -r '.[]'); do + ARGS+=(--mcp-config "$file") + done + fi + + # add coder mcp file + ARGS+=(--mcp-config "$HOME/.augment/coder_mcp.json") + + if [ -n "$ARG_AUGGIE_RULES" ]; then + AUGGIE_RULES_FILE="$HOME/.augment/rules.md" + ARGS+=(--rules "$AUGGIE_RULES_FILE") + fi + + if [ "$ARG_AUGGIE_CONTINUE_PREVIOUS_CONVERSATION" == "true" ]; then + ARGS+=(--continue) + fi + + + if [ -n "$ARG_TASK_PROMPT" ]; then + PROMPT="Every step of the way, report your progress using coder_report_task tool with proper summary and statuses. Your task at hand: $ARG_TASK_PROMPT" + ARGS+=(--instruction "$PROMPT") + fi +} + +function start_agentapi_server() { + mkdir -p "$ARG_AUGGIE_START_DIRECTORY" + cd "$ARG_AUGGIE_START_DIRECTORY" + ARGS+=(--workspace-root "$ARG_AUGGIE_START_DIRECTORY") + printf "Running auggie with args: %s\n" "$(printf '%q ' "${ARGS[@]}")" + agentapi server --term-width 67 --term-height 1190 -- auggie "${ARGS[@]}" +} + + +validate_auggie_installation +build_auggie_args +start_agentapi_server \ No newline at end of file diff --git a/registry/coder-labs/modules/auggie/testdata/auggie-mock.sh b/registry/coder-labs/modules/auggie/testdata/auggie-mock.sh new file mode 100644 index 000000000..ba7c5f6db --- /dev/null +++ b/registry/coder-labs/modules/auggie/testdata/auggie-mock.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +if [[ "$1" == "--version" ]]; then + echo "HELLO: $(bash -c env)" + echo "auggie version v1.0.0" + exit 0 +fi + +set -e + +while true; do + echo "$(date) - auggie-mock" + sleep 15 +done From 7dbf18c27c6a37a36ec44a2eab21fd60f0859f33 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Thu, 21 Aug 2025 12:10:54 +0530 Subject: [PATCH 02/22] chore: update readme --- registry/coder-labs/modules/auggie/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index a7ee98f2d..80c232478 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -8,7 +8,7 @@ tags: [agent, auggie, ai, tasks, augment] # Auggie CLI -Run Auggie CLI in your workspace to access Augment's AI coding assistant with advanced context understanding and codebase integration. This module integrates with [AgentAPI](https://github.com/coder/agentapi) for Coder Tasks compatibility. +Run Auggie CLI in your workspace to access Augment's AI coding assistant with advanced context understanding and codebase integration. This module integrates with [AgentAPI](https://github.com/coder/agentapi). ```tf module "auggie" { From 0f87683257195df0b5e6a82f88c838e0f163a0d2 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Thu, 21 Aug 2025 12:13:12 +0530 Subject: [PATCH 03/22] feat: pretty shell script --- .../modules/auggie/scripts/install.sh | 16 +++--- .../modules/auggie/scripts/start.sh | 49 +++++++++---------- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/registry/coder-labs/modules/auggie/scripts/install.sh b/registry/coder-labs/modules/auggie/scripts/install.sh index 1ace92336..6b595e09e 100644 --- a/registry/coder-labs/modules/auggie/scripts/install.sh +++ b/registry/coder-labs/modules/auggie/scripts/install.sh @@ -90,9 +90,9 @@ function install_auggie() { } function create_coder_mcp() { - AUGGIE_CODER_MCP_FILE="$HOME/.augment/coder_mcp.json" - CODER_MCP=$( - cat << EOF + AUGGIE_CODER_MCP_FILE="$HOME/.augment/coder_mcp.json" + CODER_MCP=$( + cat << EOF { "mcpServers":{ "coder": { @@ -108,10 +108,10 @@ function create_coder_mcp() { } } EOF -) - mkdir -p "$(dirname "$AUGGIE_CODER_MCP_FILE")" - echo "$CODER_MCP" > "$AUGGIE_CODER_MCP_FILE" - printf "Coder MCP config created at: %s\n" "$AUGGIE_CODER_MCP_FILE" + ) + mkdir -p "$(dirname "$AUGGIE_CODER_MCP_FILE")" + echo "$CODER_MCP" > "$AUGGIE_CODER_MCP_FILE" + printf "Coder MCP config created at: %s\n" "$AUGGIE_CODER_MCP_FILE" } function create_rules_file() { @@ -127,4 +127,4 @@ function create_rules_file() { install_auggie create_coder_mcp -create_rules_file \ No newline at end of file +create_rules_file diff --git a/registry/coder-labs/modules/auggie/scripts/start.sh b/registry/coder-labs/modules/auggie/scripts/start.sh index ad7fde186..ea40882f9 100644 --- a/registry/coder-labs/modules/auggie/scripts/start.sh +++ b/registry/coder-labs/modules/auggie/scripts/start.sh @@ -5,7 +5,7 @@ set -o pipefail source "$HOME"/.bashrc command_exists() { - command -v "$1" >/dev/null 2>&1 + command -v "$1" > /dev/null 2>&1 } if [ -f "$HOME/.nvm/nvm.sh" ]; then @@ -14,7 +14,6 @@ else export PATH="$HOME/.npm-global/bin:$PATH" fi - set -o errexit set -o pipefail set -o nounset @@ -31,7 +30,6 @@ ARG_AUGGIE_MODEL=${ARG_AUGGIE_MODEL:-} ARGS=() - echo "--------------------------------" printf "auggie_start_directory: %s\n" "$ARG_AUGGIE_START_DIRECTORY" @@ -48,34 +46,33 @@ echo "--------------------------------" set +o nounset - function validate_auggie_installation() { - if command_exists auggie; then - printf "Auggie is installed\n" - else - printf "Error: Auggie is not installed. Please enable install_auggie or install it manually\n" - exit 1 - fi + if command_exists auggie; then + printf "Auggie is installed\n" + else + printf "Error: Auggie is not installed. Please enable install_auggie or install it manually\n" + exit 1 + fi } function build_auggie_args() { if [ -n "$ARG_AUGGIE_INTERACTION_MODE" ]; then - if [ "$ARG_AUGGIE_INTERACTION_MODE" != "interactive" ]; then - ARGS+=(--"$ARG_AUGGIE_INTERACTION_MODE") - fi + if [ "$ARG_AUGGIE_INTERACTION_MODE" != "interactive" ]; then + ARGS+=(--"$ARG_AUGGIE_INTERACTION_MODE") + fi fi if [ -n "$ARG_AUGGIE_MODEL" ]; then - ARGS+=(--model "$ARG_AUGGIE_MODEL") + ARGS+=(--model "$ARG_AUGGIE_MODEL") fi if [ -n "$ARG_MCP_CONFIG" ]; then - ARGS+=(--mcp-config "$ARG_MCP_CONFIG") + ARGS+=(--mcp-config "$ARG_MCP_CONFIG") fi if [ -n "$ARG_MCP_FILES" ]; then for file in $(echo "$ARG_MCP_FILES" | jq -r '.[]'); do - ARGS+=(--mcp-config "$file") + ARGS+=(--mcp-config "$file") done fi @@ -88,25 +85,23 @@ function build_auggie_args() { fi if [ "$ARG_AUGGIE_CONTINUE_PREVIOUS_CONVERSATION" == "true" ]; then - ARGS+=(--continue) + ARGS+=(--continue) fi - if [ -n "$ARG_TASK_PROMPT" ]; then - PROMPT="Every step of the way, report your progress using coder_report_task tool with proper summary and statuses. Your task at hand: $ARG_TASK_PROMPT" - ARGS+=(--instruction "$PROMPT") + PROMPT="Every step of the way, report your progress using coder_report_task tool with proper summary and statuses. Your task at hand: $ARG_TASK_PROMPT" + ARGS+=(--instruction "$PROMPT") fi } function start_agentapi_server() { - mkdir -p "$ARG_AUGGIE_START_DIRECTORY" - cd "$ARG_AUGGIE_START_DIRECTORY" - ARGS+=(--workspace-root "$ARG_AUGGIE_START_DIRECTORY") - printf "Running auggie with args: %s\n" "$(printf '%q ' "${ARGS[@]}")" - agentapi server --term-width 67 --term-height 1190 -- auggie "${ARGS[@]}" + mkdir -p "$ARG_AUGGIE_START_DIRECTORY" + cd "$ARG_AUGGIE_START_DIRECTORY" + ARGS+=(--workspace-root "$ARG_AUGGIE_START_DIRECTORY") + printf "Running auggie with args: %s\n" "$(printf '%q ' "${ARGS[@]}")" + agentapi server --term-width 67 --term-height 1190 -- auggie "${ARGS[@]}" } - validate_auggie_installation build_auggie_args -start_agentapi_server \ No newline at end of file +start_agentapi_server From 337baa2df5854bc92d86fd8f6275ed4e5daadbe5 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Thu, 21 Aug 2025 16:14:03 +0530 Subject: [PATCH 04/22] chore: bump agentapi version --- registry/coder-labs/modules/auggie/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/auggie/main.tf b/registry/coder-labs/modules/auggie/main.tf index bb51d2a11..1fb7ea6c4 100644 --- a/registry/coder-labs/modules/auggie/main.tf +++ b/registry/coder-labs/modules/auggie/main.tf @@ -62,7 +62,7 @@ variable "install_agentapi" { variable "agentapi_version" { type = string description = "The version of AgentAPI to install." - default = "v0.5.0" + default = "v0.6.0" } variable "pre_install_script" { From 1639ce55fd173c0a0d1595a75638c499bcb4bcc8 Mon Sep 17 00:00:00 2001 From: 35C4n0r <70096901+35C4n0r@users.noreply.github.com> Date: Fri, 22 Aug 2025 17:31:36 +0530 Subject: [PATCH 05/22] Update registry/coder-labs/modules/auggie/README.md Co-authored-by: Atif Ali --- registry/coder-labs/modules/auggie/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index 80c232478..ee61faae3 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -24,7 +24,7 @@ module "auggie" { - You must add the [Coder Login](https://registry.coder.com/modules/coder/coder-login) module to your template - **Augment session token for authentication (required for tasks)** -## Usage Examples +## Examples ### Simple Usage From 9e753c68386aa5be3926b076118fdf5e108a208f Mon Sep 17 00:00:00 2001 From: 35C4n0r <70096901+35C4n0r@users.noreply.github.com> Date: Fri, 22 Aug 2025 17:32:05 +0530 Subject: [PATCH 06/22] Update registry/coder-labs/modules/auggie/README.md Co-authored-by: Atif Ali --- registry/coder-labs/modules/auggie/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index ee61faae3..bacf9af1b 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -183,7 +183,11 @@ cat ~/.auggie-module/post_install.log ## References +- [Auggie CLI Reference](https://docs.augmentcode.com/cli/reference) +- [MCP Integration Guide](https://docs.augmentcode.com/cli/integrations#mcp-integrations) - [Augment Code Documentation](https://docs.augmentcode.com/) +- [AgentAPI Documentation](https://github.com/coder/agentapi) +- [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents) - [Auggie CLI Reference](https://docs.augmentcode.com/cli/reference) - [MCP Integration Guide](https://docs.augmentcode.com/cli/integrations#mcp-integrations) - [AgentAPI Documentation](https://github.com/coder/agentapi) From a6206139f3436632f0a6ca0bb23bc59e08c70e8c Mon Sep 17 00:00:00 2001 From: 35C4n0r <70096901+35C4n0r@users.noreply.github.com> Date: Fri, 22 Aug 2025 17:47:30 +0530 Subject: [PATCH 07/22] Update registry/coder-labs/modules/auggie/README.md Co-authored-by: Atif Ali --- registry/coder-labs/modules/auggie/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index bacf9af1b..1f562a0a2 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -164,7 +164,9 @@ EOF } ``` -### Log Files +### Troubleshooting + +If you have any issues, please take a look at the log files below. ```bash # Installation logs From d6b46bbf0368bb9aabc9f5d89e370a07f3f99db4 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Fri, 22 Aug 2025 17:57:35 +0530 Subject: [PATCH 08/22] chore: update README.md --- registry/coder-labs/modules/auggie/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index 1f562a0a2..5aeb748b3 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -22,7 +22,7 @@ module "auggie" { ## Prerequisites - You must add the [Coder Login](https://registry.coder.com/modules/coder/coder-login) module to your template -- **Augment session token for authentication (required for tasks)** +- **Augment session token for authentication (required for tasks). [Instructions](https://docs.augmentcode.com/cli/setup-auggie/authentication) to get the session token** ## Examples @@ -37,8 +37,7 @@ module "auggie" { folder = "/home/coder/project" # Optional: Specify Auggie version - install_auggie = true - auggie_version = "latest" + auggie_version = "0.3.0" } ``` From 0fb7823a8b04aee175c0b9086f7526ee6877e1bc Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Fri, 22 Aug 2025 18:01:48 +0530 Subject: [PATCH 09/22] chore: update README.md --- registry/coder-labs/modules/auggie/README.md | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index 5aeb748b3..2c2f82bcb 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -26,22 +26,7 @@ module "auggie" { ## Examples -### Simple Usage - -```tf -module "auggie" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/coder-labs/auggie/coder" - version = "0.1.0" - agent_id = coder_agent.example.id - folder = "/home/coder/project" - - # Optional: Specify Auggie version - auggie_version = "0.3.0" -} -``` - -### Advanced Usage with Tasks and Configuration +### Usage with Tasks and Configuration ```tf data "coder_parameter" "ai_prompt" { @@ -70,6 +55,9 @@ module "auggie" { {"accessToken":"xxxx-yyyy-zzzz-jjjj","tenantURL":"https://d1.api.augmentcode.com/","scopes":["read","write"]} EOF # Required for tasks + # Version + auggie_version = "0.3.0" + # Task configuration ai_prompt = data.coder_parameter.ai_prompt.value continue_previous_conversation = true From 86ee31e3be79134cc2910bafccf3249e2fef8e84 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 09:27:27 -0500 Subject: [PATCH 10/22] fix: update user mcp creation to follow coder_mcp method since mcp flag can be passed multiple times to auggie --- registry/coder-labs/modules/auggie/main.tf | 2 +- .../coder-labs/modules/auggie/scripts/install.sh | 14 ++++++++++++++ .../coder-labs/modules/auggie/scripts/start.sh | 7 +++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/registry/coder-labs/modules/auggie/main.tf b/registry/coder-labs/modules/auggie/main.tf index 1fb7ea6c4..7ace984e3 100644 --- a/registry/coder-labs/modules/auggie/main.tf +++ b/registry/coder-labs/modules/auggie/main.tf @@ -170,7 +170,6 @@ module "agentapi" { chmod +x /tmp/start.sh ARG_AUGGIE_START_DIRECTORY='${var.folder}' \ ARG_TASK_PROMPT='${base64encode(var.ai_prompt)}' \ - ARG_MCP_CONFIG='${var.mcp != null ? base64encode(replace(var.mcp, "'", "'\\''")) : ""}' \ ARG_MCP_FILES='${jsonencode(var.mcp_files)}' \ ARG_AUGGIE_RULES='${base64encode(var.rules)}' \ ARG_AUGGIE_CONTINUE_PREVIOUS_CONVERSATION='${var.continue_previous_conversation}' \ @@ -191,6 +190,7 @@ module "agentapi" { ARG_AUGGIE_VERSION='${var.auggie_version}' \ ARG_MCP_APP_STATUS_SLUG='${local.app_slug}' \ ARG_AUGGIE_RULES='${base64encode(var.rules)}' \ + ARG_MCP_CONFIG='${var.mcp != null ? base64encode(replace(var.mcp, "'", "'\\''")) : ""}' \ /tmp/install.sh EOT } \ No newline at end of file diff --git a/registry/coder-labs/modules/auggie/scripts/install.sh b/registry/coder-labs/modules/auggie/scripts/install.sh index 6b595e09e..6d93b7ee4 100644 --- a/registry/coder-labs/modules/auggie/scripts/install.sh +++ b/registry/coder-labs/modules/auggie/scripts/install.sh @@ -15,6 +15,7 @@ ARG_AUGGIE_INSTALL=${ARG_AUGGIE_INSTALL:-true} ARG_AUGGIE_VERSION=${ARG_AUGGIE_VERSION:-} ARG_MCP_APP_STATUS_SLUG=${ARG_MCP_APP_STATUS_SLUG:-} ARG_AUGGIE_RULES=$(echo -n "${ARG_AUGGIE_RULES:-}" | base64 -d) +ARG_MCP_CONFIG=${ARG_MCP_CONFIG:-} echo "--------------------------------" @@ -114,6 +115,18 @@ EOF printf "Coder MCP config created at: %s\n" "$AUGGIE_CODER_MCP_FILE" } +function create_user_mcp() { + if [ -n "$ARG_MCP_CONFIG" ]; then + USER_MCP_CONFIG_FILE="$HOME/.augment/user_mcp.json" + USER_MCP_CONTENT=$(echo -n "$ARG_MCP_CONFIG" | base64 -d) + mkdir -p "$(dirname "$USER_MCP_CONFIG_FILE")" + echo "$USER_MCP_CONTENT" > "$USER_MCP_CONFIG_FILE" + printf "User MCP config created at: %s\n" "$USER_MCP_CONFIG_FILE" + else + printf "No user MCP config provided, skipping user MCP config creation.\n" + fi +} + function create_rules_file() { AUGGIE_RULES_FILE="$HOME/.augment/rules.md" if [ -n "$ARG_AUGGIE_RULES" ]; then @@ -127,4 +140,5 @@ function create_rules_file() { install_auggie create_coder_mcp +create_user_mcp create_rules_file diff --git a/registry/coder-labs/modules/auggie/scripts/start.sh b/registry/coder-labs/modules/auggie/scripts/start.sh index ea40882f9..1c196a744 100644 --- a/registry/coder-labs/modules/auggie/scripts/start.sh +++ b/registry/coder-labs/modules/auggie/scripts/start.sh @@ -20,7 +20,6 @@ set -o nounset ARG_AUGGIE_START_DIRECTORY=${ARG_AUGGIE_START_DIRECTORY:-"$HOME"} ARG_TASK_PROMPT=$(echo -n "${ARG_TASK_PROMPT:-}" | base64 -d) -ARG_MCP_CONFIG=${ARG_MCP_CONFIG:-} ARG_MCP_FILES=${ARG_MCP_FILES:-[]} ARG_AUGGIE_RULES=${ARG_AUGGIE_RULES:-} ARG_AUGMENT_SESSION_AUTH=${ARG_AUGMENT_SESSION_AUTH:-} @@ -34,7 +33,6 @@ echo "--------------------------------" printf "auggie_start_directory: %s\n" "$ARG_AUGGIE_START_DIRECTORY" printf "task_prompt: %s\n" "$ARG_TASK_PROMPT" -printf "mcp_config: %s\n" "$ARG_MCP_CONFIG" printf "mcp_files: %s\n" "$ARG_MCP_FILES" printf "auggie_rules: %s\n" "$ARG_AUGGIE_RULES" printf "continue_previous_conversation: %s\n" "$ARG_AUGGIE_CONTINUE_PREVIOUS_CONVERSATION" @@ -66,8 +64,9 @@ function build_auggie_args() { ARGS+=(--model "$ARG_AUGGIE_MODEL") fi - if [ -n "$ARG_MCP_CONFIG" ]; then - ARGS+=(--mcp-config "$ARG_MCP_CONFIG") + # add user mcp file if it exists + if [ -f "$HOME/.augment/user_mcp.json" ]; then + ARGS+=(--mcp-config "$HOME/.augment/user_mcp.json") fi if [ -n "$ARG_MCP_FILES" ]; then From 9de4f5453e5903b9c60f7794bc71489c88667092 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 09:32:47 -0500 Subject: [PATCH 11/22] fix: update auggie model name format in README.md from "gpt-5" to "gpt5" --- registry/coder-labs/modules/auggie/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index 2c2f82bcb..89837c209 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -62,7 +62,7 @@ EOF # Required for tasks ai_prompt = data.coder_parameter.ai_prompt.value continue_previous_conversation = true interaction_mode = "quiet" - auggie_model = "gpt-5" + auggie_model = "gpt5" # MCP configuration for additional integrations mcp = <<-EOF From 1e567f40c924e64a5fedc729c29ba0a0ec5de1ea Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 11:22:36 -0500 Subject: [PATCH 12/22] chore: update to make auggie work more like other ai modules --- registry/coder-labs/modules/auggie/README.md | 7 +-- registry/coder-labs/modules/auggie/main.tf | 46 ++++++++++++++++--- .../modules/auggie/scripts/start.sh | 10 ++-- 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index 89837c209..b4762ab09 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -63,6 +63,7 @@ EOF # Required for tasks continue_previous_conversation = true interaction_mode = "quiet" auggie_model = "gpt5" + report_tasks = true # MCP configuration for additional integrations mcp = <<-EOF @@ -71,10 +72,6 @@ EOF # Required for tasks "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/coder/project"] - }, - "git": { - "command": "npx", - "args": ["-y", "@modelcontextprotocol/server-git", "--repository", "/home/coder/project"] } } } @@ -179,5 +176,3 @@ cat ~/.auggie-module/post_install.log - [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents) - [Auggie CLI Reference](https://docs.augmentcode.com/cli/reference) - [MCP Integration Guide](https://docs.augmentcode.com/cli/integrations#mcp-integrations) -- [AgentAPI Documentation](https://github.com/coder/agentapi) -- [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents) diff --git a/registry/coder-labs/modules/auggie/main.tf b/registry/coder-labs/modules/auggie/main.tf index 7ace984e3..0f6c3327e 100644 --- a/registry/coder-labs/modules/auggie/main.tf +++ b/registry/coder-labs/modules/auggie/main.tf @@ -38,7 +38,7 @@ variable "icon" { variable "folder" { type = string - description = "The folder to run Codex in." + description = "The folder to run Auggie in." } variable "install_auggie" { @@ -51,6 +51,10 @@ variable "auggie_version" { type = string description = "The version of Auggie to install." default = "" # empty string means the latest available version + validation { + condition = var.auggie_version == "" || can(regex("^v?[0-9]+\\.[0-9]+\\.[0-9]+", var.auggie_version)) + error_message = "auggie_version must be empty (for latest) or a valid semantic version like 'v1.2.3' or '1.2.3'." + } } variable "install_agentapi" { @@ -63,17 +67,21 @@ variable "agentapi_version" { type = string description = "The version of AgentAPI to install." default = "v0.6.0" + validation { + condition = can(regex("^v[0-9]+\\.[0-9]+\\.[0-9]+", var.agentapi_version)) + error_message = "agentapi_version must be a valid semantic version starting with 'v', like 'v0.3.3'." + } } variable "pre_install_script" { type = string - description = "Custom script to run before installing Codex." + description = "Custom script to run before installing Auggie." default = null } variable "post_install_script" { type = string - description = "Custom script to run after installing Codex." + description = "Custom script to run after installing Auggie." default = null } @@ -131,6 +139,30 @@ variable "auggie_model" { default = "" } +variable "report_tasks" { + type = bool + description = "Whether to enable task reporting to Coder UI via AgentAPI" + default = false +} + +variable "cli_app" { + type = bool + description = "Whether to create a CLI app for Auggie" + default = true +} + +variable "web_app_display_name" { + type = string + description = "Display name for the web app" + default = "Auggie" +} + +variable "cli_app_display_name" { + type = string + description = "Display name for the CLI app" + default = "Auggie CLI" +} + resource "coder_env" "auggie_session_auth" { agent_id = var.agent_id name = "AUGMENT_SESSION_AUTH" @@ -153,9 +185,10 @@ module "agentapi" { web_app_order = var.order web_app_group = var.group web_app_icon = var.icon - web_app_display_name = "Auggie" - cli_app_slug = "${local.app_slug}-cli" - cli_app_display_name = "Auggie CLI" + web_app_display_name = var.web_app_display_name + cli_app = var.cli_app + cli_app_slug = var.cli_app ? "${local.app_slug}-cli" : null + cli_app_display_name = var.cli_app ? var.cli_app_display_name : null module_dir_name = local.module_dir_name install_agentapi = var.install_agentapi agentapi_version = var.agentapi_version @@ -176,6 +209,7 @@ module "agentapi" { ARG_AUGGIE_INTERACTION_MODE='${var.interaction_mode}' \ ARG_AUGMENT_SESSION_AUTH='${var.augment_session_token}' \ ARG_AUGGIE_MODEL='${var.auggie_model}' \ + ARG_REPORT_TASKS='${var.report_tasks}' \ /tmp/start.sh EOT diff --git a/registry/coder-labs/modules/auggie/scripts/start.sh b/registry/coder-labs/modules/auggie/scripts/start.sh index 1c196a744..a238d0c1d 100644 --- a/registry/coder-labs/modules/auggie/scripts/start.sh +++ b/registry/coder-labs/modules/auggie/scripts/start.sh @@ -26,6 +26,7 @@ ARG_AUGMENT_SESSION_AUTH=${ARG_AUGMENT_SESSION_AUTH:-} ARG_AUGGIE_CONTINUE_PREVIOUS_CONVERSATION=${ARG_AUGGIE_CONTINUE_PREVIOUS_CONVERSATION:-false} ARG_AUGGIE_INTERACTION_MODE=${ARG_AUGGIE_INTERACTION_MODE:-"interactive"} ARG_AUGGIE_MODEL=${ARG_AUGGIE_MODEL:-} +ARG_REPORT_TASKS=${ARG_REPORT_TASKS:-false} ARGS=() @@ -39,6 +40,7 @@ printf "continue_previous_conversation: %s\n" "$ARG_AUGGIE_CONTINUE_PREVIOUS_CON printf "auggie_interaction_mode: %s\n" "$ARG_AUGGIE_INTERACTION_MODE" printf "augment_session_auth: %s\n" "$ARG_AUGMENT_SESSION_AUTH" printf "auggie_model: %s\n" "$ARG_AUGGIE_MODEL" +printf "report_tasks: %s\n" "$ARG_REPORT_TASKS" echo "--------------------------------" @@ -64,7 +66,6 @@ function build_auggie_args() { ARGS+=(--model "$ARG_AUGGIE_MODEL") fi - # add user mcp file if it exists if [ -f "$HOME/.augment/user_mcp.json" ]; then ARGS+=(--mcp-config "$HOME/.augment/user_mcp.json") fi @@ -75,7 +76,6 @@ function build_auggie_args() { done fi - # add coder mcp file ARGS+=(--mcp-config "$HOME/.augment/coder_mcp.json") if [ -n "$ARG_AUGGIE_RULES" ]; then @@ -88,7 +88,11 @@ function build_auggie_args() { fi if [ -n "$ARG_TASK_PROMPT" ]; then - PROMPT="Every step of the way, report your progress using coder_report_task tool with proper summary and statuses. Your task at hand: $ARG_TASK_PROMPT" + if [ "$ARG_REPORT_TASKS" == "true" ]; then + PROMPT="Every step of the way, report your progress using coder_report_task tool with proper summary and statuses. Your task at hand: $ARG_TASK_PROMPT" + else + PROMPT="$ARG_TASK_PROMPT" + fi ARGS+=(--instruction "$PROMPT") fi } From 31d1a457e45d5ddea2191d93ccde5bdffae217a5 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 11:25:50 -0500 Subject: [PATCH 13/22] chore: update spacing in task reporting example --- registry/coder-labs/modules/auggie/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index b4762ab09..d6ee61aa5 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -61,9 +61,9 @@ EOF # Required for tasks # Task configuration ai_prompt = data.coder_parameter.ai_prompt.value continue_previous_conversation = true - interaction_mode = "quiet" - auggie_model = "gpt5" - report_tasks = true + interaction_mode = "quiet" + auggie_model = "gpt5" + report_tasks = true # MCP configuration for additional integrations mcp = <<-EOF From dbde485e61c74c6403689ff00b07942c19c74d69 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 11:33:38 -0500 Subject: [PATCH 14/22] chore: set cli_app to false as default --- registry/coder-labs/modules/auggie/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/auggie/main.tf b/registry/coder-labs/modules/auggie/main.tf index 0f6c3327e..d6c326e0b 100644 --- a/registry/coder-labs/modules/auggie/main.tf +++ b/registry/coder-labs/modules/auggie/main.tf @@ -148,7 +148,7 @@ variable "report_tasks" { variable "cli_app" { type = bool description = "Whether to create a CLI app for Auggie" - default = true + default = false } variable "web_app_display_name" { From 5a2cf10db6a2ab182357ccc7009f044c75f250cf Mon Sep 17 00:00:00 2001 From: DevCats Date: Fri, 22 Aug 2025 11:37:25 -0500 Subject: [PATCH 15/22] chore: remove duplicate references Co-authored-by: Atif Ali --- registry/coder-labs/modules/auggie/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index d6ee61aa5..872d052e8 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -170,9 +170,7 @@ cat ~/.auggie-module/post_install.log ## References - [Auggie CLI Reference](https://docs.augmentcode.com/cli/reference) -- [MCP Integration Guide](https://docs.augmentcode.com/cli/integrations#mcp-integrations) +- [Auggie CLI MCP Integration](https://docs.augmentcode.com/cli/integrations#mcp-integrations) - [Augment Code Documentation](https://docs.augmentcode.com/) - [AgentAPI Documentation](https://github.com/coder/agentapi) - [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents) -- [Auggie CLI Reference](https://docs.augmentcode.com/cli/reference) -- [MCP Integration Guide](https://docs.augmentcode.com/cli/integrations#mcp-integrations) From 9e8fcfbf563a492b7215cc2d554e28127f4a0fb0 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 12:08:24 -0500 Subject: [PATCH 16/22] chore: add auggie svg --- .icons/auggie.svg | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .icons/auggie.svg diff --git a/.icons/auggie.svg b/.icons/auggie.svg new file mode 100644 index 000000000..590bd5aa1 --- /dev/null +++ b/.icons/auggie.svg @@ -0,0 +1,8 @@ + + + + + + + + From 7fc820ae23646b740c5d42953ec4ec0d3363e6c5 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 13:17:35 -0500 Subject: [PATCH 17/22] chore: remove hardcoded node/mpn installation so that it can be handled at users discretion, and standardize bash set options --- registry/coder-labs/modules/auggie/README.md | 13 ++++ .../modules/auggie/scripts/install.sh | 64 +++++-------------- .../modules/auggie/scripts/start.sh | 8 +-- 3 files changed, 30 insertions(+), 55 deletions(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index 872d052e8..5366a6be8 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -21,6 +21,7 @@ module "auggie" { ## Prerequisites +- Node.js and npm must be installed (can be installed via `pre_install_script`) - You must add the [Coder Login](https://registry.coder.com/modules/coder/coder-login) module to your template - **Augment session token for authentication (required for tasks). [Instructions](https://docs.augmentcode.com/cli/setup-auggie/authentication) to get the session token** @@ -134,6 +135,18 @@ EOF pre_install_script = <<-EOT #!/usr/bin/env bash set -euo pipefail + # Install Node.js via NVM if not already available + if ! command -v node >/dev/null 2>&1; then + 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 + fi + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + nvm install --lts + nvm use --lts + nvm alias default node + fi # Install additional dependencies npm install -g typescript pip install -r requirements.txt diff --git a/registry/coder-labs/modules/auggie/scripts/install.sh b/registry/coder-labs/modules/auggie/scripts/install.sh index 6d93b7ee4..f676d9665 100644 --- a/registry/coder-labs/modules/auggie/scripts/install.sh +++ b/registry/coder-labs/modules/auggie/scripts/install.sh @@ -7,9 +7,7 @@ BOLD='\033[0;1m' command_exists() { command -v "$1" > /dev/null 2>&1 } -set -o errexit -set -o pipefail -set -o nounset +set -euo pipefail ARG_AUGGIE_INSTALL=${ARG_AUGGIE_INSTALL:-true} ARG_AUGGIE_VERSION=${ARG_AUGGIE_VERSION:-} @@ -26,58 +24,25 @@ printf "rules: %s\n" "$ARG_AUGGIE_RULES" echo "--------------------------------" -set +o nounset -function install_node() { +function check_dependencies() { + if ! command_exists node; then + printf "Error: Node.js is not installed. Please install Node.js manually or use the pre_install_script to install it.\n" + exit 1 + 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 - - 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 + printf "Error: npm is not installed. Please install npm manually or use the pre_install_script to install it.\n" + exit 1 fi + + printf "Node.js version: %s\n" "$(node --version)" + printf "npm version: %s\n" "$(npm --version)" } function install_auggie() { if [ "${ARG_AUGGIE_INSTALL}" = "true" ]; then - install_node - - # If nvm does not exist, we will create a global npm directory (this os to prevent the possibility of EACCESS issues on npm -g) - if ! command_exists nvm; then - printf "which node: %s\n" "$(which node)" - printf "which npm: %s\n" "$(which npm)" - - # Create a directory for global packages - mkdir -p "$HOME"/.npm-global - - # Configure npm to use it - npm config set prefix "$HOME/.npm-global" - - # Add to PATH for current session - export PATH="$HOME/.npm-global/bin:$PATH" - - # Add to shell profile for future sessions - if ! grep -q "export PATH=$HOME/.npm-global/bin:\$PATH" ~/.bashrc; then - echo "export PATH=$HOME/.npm-global/bin:\$PATH" >> ~/.bashrc - fi - fi + check_dependencies printf "%s Installing Auggie CLI\n" "${BOLD}" @@ -87,6 +52,9 @@ function install_auggie() { npm install -g "@augmentcode/auggie" fi printf "%s Successfully installed Auggie CLI. Version: %s\n" "${BOLD}" "$(auggie --version)" + else + # Even if not installing, we should check that dependencies exist for the module to work + check_dependencies fi } diff --git a/registry/coder-labs/modules/auggie/scripts/start.sh b/registry/coder-labs/modules/auggie/scripts/start.sh index a238d0c1d..1aff1a16b 100644 --- a/registry/coder-labs/modules/auggie/scripts/start.sh +++ b/registry/coder-labs/modules/auggie/scripts/start.sh @@ -1,6 +1,5 @@ #!/bin/bash -set -o errexit -set -o pipefail +set -euo pipefail source "$HOME"/.bashrc @@ -14,10 +13,6 @@ else export PATH="$HOME/.npm-global/bin:$PATH" fi -set -o errexit -set -o pipefail -set -o nounset - ARG_AUGGIE_START_DIRECTORY=${ARG_AUGGIE_START_DIRECTORY:-"$HOME"} ARG_TASK_PROMPT=$(echo -n "${ARG_TASK_PROMPT:-}" | base64 -d) ARG_MCP_FILES=${ARG_MCP_FILES:-[]} @@ -44,7 +39,6 @@ printf "report_tasks: %s\n" "$ARG_REPORT_TASKS" echo "--------------------------------" -set +o nounset function validate_auggie_installation() { if command_exists auggie; then From d2297b157baf943621f823225fd5a8b3fca8d31a Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 15:22:11 -0500 Subject: [PATCH 18/22] chore: update installation script to use system package manager for Node.js and npm, and configure npm user directory --- registry/coder-labs/modules/auggie/README.md | 23 +++++----- .../coder-labs/modules/auggie/main.test.ts | 43 ++++++++++++++++++- .../modules/auggie/scripts/install.sh | 11 ++--- 3 files changed, 61 insertions(+), 16 deletions(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index 5366a6be8..115cbb73f 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -135,18 +135,21 @@ EOF pre_install_script = <<-EOT #!/usr/bin/env bash set -euo pipefail - # Install Node.js via NVM if not already available + + # Install Node.js and npm via system package manager if ! command -v node >/dev/null 2>&1; then - 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 - fi - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - nvm install --lts - nvm use --lts - nvm alias default node + sudo apt-get update + sudo apt-get install -y nodejs npm fi + + # Configure npm to use user directory (avoids permission issues) + mkdir -p "$HOME/.npm-global" + npm config set prefix "$HOME/.npm-global" + + # Persist npm user directory configuration + echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc + echo "prefix=$HOME/.npm-global" > ~/.npmrc + # Install additional dependencies npm install -g typescript pip install -r requirements.txt diff --git a/registry/coder-labs/modules/auggie/main.test.ts b/registry/coder-labs/modules/auggie/main.test.ts index abb111a0a..185b933a8 100644 --- a/registry/coder-labs/modules/auggie/main.test.ts +++ b/registry/coder-labs/modules/auggie/main.test.ts @@ -84,6 +84,24 @@ describe("auggie", async () => { moduleVariables: { install_auggie: "true", auggie_version: version_to_install, + pre_install_script: dedent` + #!/usr/bin/env bash + set -euo pipefail + + # Install Node.js and npm via system package manager + if ! command -v node >/dev/null 2>&1; then + sudo apt-get update + sudo apt-get install -y nodejs npm + fi + + # Configure npm to use user directory (avoids permission issues) + mkdir -p "$HOME/.npm-global" + npm config set prefix "$HOME/.npm-global" + + # Persist npm user directory configuration + echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc + echo "prefix=$HOME/.npm-global" > ~/.npmrc + `, }, }); await execModuleScript(id); @@ -101,6 +119,24 @@ describe("auggie", async () => { skipAgentAPIMock: true, moduleVariables: { install_auggie: "true", + pre_install_script: dedent` + #!/usr/bin/env bash + set -euo pipefail + + # Install Node.js and npm via system package manager + if ! command -v node >/dev/null 2>&1; then + sudo apt-get update + sudo apt-get install -y nodejs npm + fi + + # Configure npm to use user directory (avoids permission issues) + mkdir -p "$HOME/.npm-global" + npm config set prefix "$HOME/.npm-global" + + # Persist npm user directory configuration + echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc + echo "prefix=$HOME/.npm-global" > ~/.npmrc + `, }, }); await execModuleScript(id); @@ -151,6 +187,7 @@ describe("auggie", async () => { const rules = "Always use TypeScript for new files"; const { id } = await setup({ moduleVariables: { + install_auggie: "false", // Don't need to install auggie to test rules file creation rules: rules, }, }); @@ -270,7 +307,11 @@ describe("auggie", async () => { }); test("coder-mcp-config-created", async () => { - const { id } = await setup(); + const { id } = await setup({ + moduleVariables: { + install_auggie: "false", // Don't need to install auggie to test MCP config creation + }, + }); await execModuleScript(id); const mcpConfig = await readFileContainer(id, "/home/coder/.augment/coder_mcp.json"); diff --git a/registry/coder-labs/modules/auggie/scripts/install.sh b/registry/coder-labs/modules/auggie/scripts/install.sh index f676d9665..248b2229f 100644 --- a/registry/coder-labs/modules/auggie/scripts/install.sh +++ b/registry/coder-labs/modules/auggie/scripts/install.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -euo pipefail + source "$HOME"/.bashrc BOLD='\033[0;1m' @@ -7,7 +9,6 @@ BOLD='\033[0;1m' command_exists() { command -v "$1" > /dev/null 2>&1 } -set -euo pipefail ARG_AUGGIE_INSTALL=${ARG_AUGGIE_INSTALL:-true} ARG_AUGGIE_VERSION=${ARG_AUGGIE_VERSION:-} @@ -53,11 +54,11 @@ function install_auggie() { fi printf "%s Successfully installed Auggie CLI. Version: %s\n" "${BOLD}" "$(auggie --version)" else - # Even if not installing, we should check that dependencies exist for the module to work - check_dependencies + printf "Skipping Auggie CLI installation (install_auggie=false)\n" fi } + function create_coder_mcp() { AUGGIE_CODER_MCP_FILE="$HOME/.augment/coder_mcp.json" CODER_MCP=$( @@ -70,8 +71,8 @@ function create_coder_mcp() { "env": { "CODER_MCP_APP_STATUS_SLUG": "${ARG_MCP_APP_STATUS_SLUG}", "CODER_MCP_AI_AGENTAPI_URL": "http://localhost:3284", - "CODER_AGENT_URL": "${CODER_AGENT_URL}", - "CODER_AGENT_TOKEN": "${CODER_AGENT_TOKEN}" + "CODER_AGENT_URL": "${CODER_AGENT_URL:-}", + "CODER_AGENT_TOKEN": "${CODER_AGENT_TOKEN:-}" } } } From 7cff853e28167801901163cd7740b3005d632192 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 16:22:35 -0500 Subject: [PATCH 19/22] chore: use sudo auggie install since its done in pre install script now --- registry/coder-labs/modules/auggie/scripts/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/registry/coder-labs/modules/auggie/scripts/install.sh b/registry/coder-labs/modules/auggie/scripts/install.sh index 248b2229f..74c8b0229 100644 --- a/registry/coder-labs/modules/auggie/scripts/install.sh +++ b/registry/coder-labs/modules/auggie/scripts/install.sh @@ -48,9 +48,9 @@ function install_auggie() { printf "%s Installing Auggie CLI\n" "${BOLD}" if [ -n "$ARG_AUGGIE_VERSION" ]; then - npm install -g "@augmentcode/auggie@$ARG_AUGGIE_VERSION" + sudo npm install -g "@augmentcode/auggie@$ARG_AUGGIE_VERSION" else - npm install -g "@augmentcode/auggie" + sudo npm install -g "@augmentcode/auggie" fi printf "%s Successfully installed Auggie CLI. Version: %s\n" "${BOLD}" "$(auggie --version)" else From a95ca85e00394894994cdfa391977a9f1d05b116 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 16:35:19 -0500 Subject: [PATCH 20/22] chore: cleanup readme --- registry/coder-labs/modules/auggie/README.md | 33 +------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index 115cbb73f..4b8e93151 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -21,7 +21,7 @@ module "auggie" { ## Prerequisites -- Node.js and npm must be installed (can be installed via `pre_install_script`) +- **Node.js and npm must be sourced/available before the auggie module installs** - ensure they are installed in your workspace image or via earlier provisioning steps - You must add the [Coder Login](https://registry.coder.com/modules/coder/coder-login) module to your template - **Augment session token for authentication (required for tasks). [Instructions](https://docs.augmentcode.com/cli/setup-auggie/authentication) to get the session token** @@ -130,37 +130,6 @@ module "auggie" { } } EOF - - # Custom install scripts - pre_install_script = <<-EOT - #!/usr/bin/env bash - set -euo pipefail - - # Install Node.js and npm via system package manager - if ! command -v node >/dev/null 2>&1; then - sudo apt-get update - sudo apt-get install -y nodejs npm - fi - - # Configure npm to use user directory (avoids permission issues) - mkdir -p "$HOME/.npm-global" - npm config set prefix "$HOME/.npm-global" - - # Persist npm user directory configuration - echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc - echo "prefix=$HOME/.npm-global" > ~/.npmrc - - # Install additional dependencies - npm install -g typescript - pip install -r requirements.txt - EOT - - post_install_script = <<-EOT - #!/usr/bin/env bash - set -euo pipefail - # Setup project-specific configuration - echo "Auggie setup complete for $(pwd)" - EOT } ``` From d5d6330344e2bddfe6a6533fe12831106ea6bb78 Mon Sep 17 00:00:00 2001 From: DevCats Date: Fri, 22 Aug 2025 16:37:40 -0500 Subject: [PATCH 21/22] Update registry/coder-labs/modules/auggie/scripts/start.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- registry/coder-labs/modules/auggie/scripts/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder-labs/modules/auggie/scripts/start.sh b/registry/coder-labs/modules/auggie/scripts/start.sh index 1aff1a16b..840b808d4 100644 --- a/registry/coder-labs/modules/auggie/scripts/start.sh +++ b/registry/coder-labs/modules/auggie/scripts/start.sh @@ -64,7 +64,7 @@ function build_auggie_args() { ARGS+=(--mcp-config "$HOME/.augment/user_mcp.json") fi - if [ -n "$ARG_MCP_FILES" ]; then + if [ -n "$ARG_MCP_FILES" ] && [ "$ARG_MCP_FILES" != "[]" ]; then for file in $(echo "$ARG_MCP_FILES" | jq -r '.[]'); do ARGS+=(--mcp-config "$file") done From 52d7b777a800dd9299f503a300fcb10055d5a0cb Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 22 Aug 2025 16:47:16 -0500 Subject: [PATCH 22/22] chore: update install script to configure npm global prefix and update PATH --- .../modules/auggie/scripts/install.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/registry/coder-labs/modules/auggie/scripts/install.sh b/registry/coder-labs/modules/auggie/scripts/install.sh index 74c8b0229..e6606e8ef 100644 --- a/registry/coder-labs/modules/auggie/scripts/install.sh +++ b/registry/coder-labs/modules/auggie/scripts/install.sh @@ -47,11 +47,25 @@ function install_auggie() { printf "%s Installing Auggie CLI\n" "${BOLD}" + NPM_GLOBAL_PREFIX="${HOME}/.npm-global" + if [ ! -d "$NPM_GLOBAL_PREFIX" ]; then + mkdir -p "$NPM_GLOBAL_PREFIX" + fi + + npm config set prefix "$NPM_GLOBAL_PREFIX" + + export PATH="$NPM_GLOBAL_PREFIX/bin:$PATH" + if [ -n "$ARG_AUGGIE_VERSION" ]; then - sudo npm install -g "@augmentcode/auggie@$ARG_AUGGIE_VERSION" + npm install -g "@augmentcode/auggie@$ARG_AUGGIE_VERSION" else - sudo npm install -g "@augmentcode/auggie" + npm install -g "@augmentcode/auggie" + fi + + if ! grep -q "export PATH=\"\$HOME/.npm-global/bin:\$PATH\"" "$HOME/.bashrc"; then + echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> "$HOME/.bashrc" fi + printf "%s Successfully installed Auggie CLI. Version: %s\n" "${BOLD}" "$(auggie --version)" else printf "Skipping Auggie CLI installation (install_auggie=false)\n"