From 2168360195e555be7bea4ce8d9043bf1fb61f259 Mon Sep 17 00:00:00 2001 From: DevCats Date: Wed, 15 Oct 2025 12:20:08 -0500 Subject: [PATCH 1/2] fix: add folder to all Agent Modules (#481) ## Description Make sure folder is passed to agentapi in all Agent modules. ## Type of Change - [ ] New module - [ ] New template - [X] Bug fix - [ ] Feature/enhancement - [ ] Documentation - [ ] Other ## Module Information **Path:** `registry/coder-labs/modules/auggie` **New version:** `v0.2.1` **Breaking change:** [ ] Yes [X] No **Path:** `registry/coder-labs/modules/cursor-cli` **New version:** `v0.2.1` **Breaking change:** [ ] Yes [X] No **Path:** `registry/coder-labs/modules/gemini` **New version:** `v2.1.1` **Breaking change:** [ ] Yes [X] No **Path:** `registry/coder-labs/modules/sourcegraph_amp` **New version:** `v1.1.1` **Breaking change:** [ ] Yes [X] No ## Testing & Validation - [X] Tests pass (`bun test`) - [X] Code formatted (`bun fmt`) - [X] Changes tested locally ## Related Issues --- registry/coder-labs/modules/auggie/README.md | 6 +++--- registry/coder-labs/modules/auggie/main.tf | 2 ++ registry/coder-labs/modules/cursor-cli/README.md | 4 ++-- registry/coder-labs/modules/cursor-cli/main.tf | 2 ++ registry/coder-labs/modules/gemini/README.md | 8 ++++---- registry/coder-labs/modules/gemini/main.tf | 2 ++ registry/coder-labs/modules/sourcegraph-amp/README.md | 4 ++-- registry/coder-labs/modules/sourcegraph-amp/main.tf | 2 ++ 8 files changed, 19 insertions(+), 11 deletions(-) diff --git a/registry/coder-labs/modules/auggie/README.md b/registry/coder-labs/modules/auggie/README.md index 6cb7102d..58651f37 100644 --- a/registry/coder-labs/modules/auggie/README.md +++ b/registry/coder-labs/modules/auggie/README.md @@ -13,7 +13,7 @@ Run Auggie CLI in your workspace to access Augment's AI coding assistant with ad ```tf module "auggie" { source = "registry.coder.com/coder-labs/auggie/coder" - version = "0.2.0" + version = "0.2.1" agent_id = coder_agent.example.id folder = "/home/coder/project" } @@ -47,7 +47,7 @@ module "coder-login" { module "auggie" { source = "registry.coder.com/coder-labs/auggie/coder" - version = "0.2.0" + version = "0.2.1" agent_id = coder_agent.example.id folder = "/home/coder/project" @@ -103,7 +103,7 @@ EOF ```tf module "auggie" { source = "registry.coder.com/coder-labs/auggie/coder" - version = "0.2.0" + version = "0.2.1" agent_id = coder_agent.example.id folder = "/home/coder/project" diff --git a/registry/coder-labs/modules/auggie/main.tf b/registry/coder-labs/modules/auggie/main.tf index 5e268ab9..d75b1229 100644 --- a/registry/coder-labs/modules/auggie/main.tf +++ b/registry/coder-labs/modules/auggie/main.tf @@ -174,6 +174,7 @@ locals { install_script = file("${path.module}/scripts/install.sh") start_script = file("${path.module}/scripts/start.sh") module_dir_name = ".auggie-module" + folder = trimsuffix(var.folder, "/") } module "agentapi" { @@ -181,6 +182,7 @@ module "agentapi" { version = "1.2.0" agent_id = var.agent_id + folder = local.folder web_app_slug = local.app_slug web_app_order = var.order web_app_group = var.group diff --git a/registry/coder-labs/modules/cursor-cli/README.md b/registry/coder-labs/modules/cursor-cli/README.md index 92f045de..24514eaa 100644 --- a/registry/coder-labs/modules/cursor-cli/README.md +++ b/registry/coder-labs/modules/cursor-cli/README.md @@ -13,7 +13,7 @@ Run the Cursor Agent CLI in your workspace for interactive coding assistance and ```tf module "cursor_cli" { source = "registry.coder.com/coder-labs/cursor-cli/coder" - version = "0.2.0" + version = "0.2.1" agent_id = coder_agent.example.id folder = "/home/coder/project" } @@ -42,7 +42,7 @@ module "coder-login" { module "cursor_cli" { source = "registry.coder.com/coder-labs/cursor-cli/coder" - version = "0.2.0" + version = "0.2.1" agent_id = coder_agent.example.id folder = "/home/coder/project" diff --git a/registry/coder-labs/modules/cursor-cli/main.tf b/registry/coder-labs/modules/cursor-cli/main.tf index c07193a6..a57ad65c 100644 --- a/registry/coder-labs/modules/cursor-cli/main.tf +++ b/registry/coder-labs/modules/cursor-cli/main.tf @@ -113,6 +113,7 @@ locals { install_script = file("${path.module}/scripts/install.sh") start_script = file("${path.module}/scripts/start.sh") module_dir_name = ".cursor-cli-module" + folder = trimsuffix(var.folder, "/") } # Expose status slug and API key to the agent environment @@ -134,6 +135,7 @@ module "agentapi" { version = "1.2.0" agent_id = var.agent_id + folder = local.folder web_app_slug = local.app_slug web_app_order = var.order web_app_group = var.group diff --git a/registry/coder-labs/modules/gemini/README.md b/registry/coder-labs/modules/gemini/README.md index 1d499817..3e8ed5ee 100644 --- a/registry/coder-labs/modules/gemini/README.md +++ b/registry/coder-labs/modules/gemini/README.md @@ -13,7 +13,7 @@ Run [Gemini CLI](https://github.com/google-gemini/gemini-cli) in your workspace ```tf module "gemini" { source = "registry.coder.com/coder-labs/gemini/coder" - version = "2.1.0" + version = "2.1.1" agent_id = coder_agent.example.id folder = "/home/coder/project" } @@ -46,7 +46,7 @@ variable "gemini_api_key" { module "gemini" { source = "registry.coder.com/coder-labs/gemini/coder" - version = "2.1.0" + version = "2.1.1" agent_id = coder_agent.example.id gemini_api_key = var.gemini_api_key folder = "/home/coder/project" @@ -94,7 +94,7 @@ data "coder_parameter" "ai_prompt" { module "gemini" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder-labs/gemini/coder" - version = "2.1.0" + version = "2.1.1" agent_id = coder_agent.example.id gemini_api_key = var.gemini_api_key gemini_model = "gemini-2.5-flash" @@ -118,7 +118,7 @@ For enterprise users who prefer Google's Vertex AI platform: ```tf module "gemini" { source = "registry.coder.com/coder-labs/gemini/coder" - version = "2.1.0" + version = "2.1.1" agent_id = coder_agent.example.id gemini_api_key = var.gemini_api_key folder = "/home/coder/project" diff --git a/registry/coder-labs/modules/gemini/main.tf b/registry/coder-labs/modules/gemini/main.tf index 1dc25c6d..7cc8ac04 100644 --- a/registry/coder-labs/modules/gemini/main.tf +++ b/registry/coder-labs/modules/gemini/main.tf @@ -172,6 +172,7 @@ EOT install_script = file("${path.module}/scripts/install.sh") start_script = file("${path.module}/scripts/start.sh") module_dir_name = ".gemini-module" + folder = trimsuffix(var.folder, "/") } module "agentapi" { @@ -179,6 +180,7 @@ module "agentapi" { version = "1.2.0" agent_id = var.agent_id + folder = local.folder web_app_slug = local.app_slug web_app_order = var.order web_app_group = var.group diff --git a/registry/coder-labs/modules/sourcegraph-amp/README.md b/registry/coder-labs/modules/sourcegraph-amp/README.md index 61607d9d..44513c67 100644 --- a/registry/coder-labs/modules/sourcegraph-amp/README.md +++ b/registry/coder-labs/modules/sourcegraph-amp/README.md @@ -13,7 +13,7 @@ Run [Amp CLI](https://ampcode.com/) in your workspace to access Sourcegraph's AI ```tf module "amp-cli" { source = "registry.coder.com/coder-labs/sourcegraph-amp/coder" - version = "1.1.0" + version = "1.1.1" agent_id = coder_agent.example.id sourcegraph_amp_api_key = var.sourcegraph_amp_api_key install_sourcegraph_amp = true @@ -60,7 +60,7 @@ variable "sourcegraph_amp_api_key" { module "amp-cli" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder-labs/sourcegraph-amp/coder" - version = "1.1.0" + version = "1.1.1" agent_id = coder_agent.example.id sourcegraph_amp_api_key = var.sourcegraph_amp_api_key # recommended for authenticated usage install_sourcegraph_amp = true diff --git a/registry/coder-labs/modules/sourcegraph-amp/main.tf b/registry/coder-labs/modules/sourcegraph-amp/main.tf index b5566fef..42ccc097 100644 --- a/registry/coder-labs/modules/sourcegraph-amp/main.tf +++ b/registry/coder-labs/modules/sourcegraph-amp/main.tf @@ -147,6 +147,7 @@ locals { install_script = file("${path.module}/scripts/install.sh") start_script = file("${path.module}/scripts/start.sh") module_dir_name = ".sourcegraph-amp-module" + folder = trimsuffix(var.folder, "/") } module "agentapi" { @@ -154,6 +155,7 @@ module "agentapi" { version = "1.2.0" agent_id = var.agent_id + folder = local.folder web_app_slug = local.app_slug web_app_order = var.order web_app_group = var.group From 90873e800945fac1438853bb6acd2ab239283433 Mon Sep 17 00:00:00 2001 From: DevCats Date: Wed, 15 Oct 2025 14:03:12 -0500 Subject: [PATCH 2/2] ci: update CI workflow to run TypeScript tests with new script (#480) --- .github/workflows/ci.yaml | 24 ++++++++++++++- scripts/ts_test_auto.sh | 63 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100755 scripts/ts_test_auto.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9c676ec1..1079f8ea 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,6 +13,24 @@ jobs: steps: - name: Check out code uses: actions/checkout@v5 + - name: Detect changed files + uses: dorny/paths-filter@v3 + id: filter + with: + list-files: shell + filters: | + shared: + - 'test/**' + - 'package.json' + - 'bun.lock' + - 'bunfig.toml' + - 'tsconfig.json' + - '.github/workflows/ci.yaml' + - 'scripts/ts_test_auto.sh' + modules: + - 'registry/**/modules/**' + all: + - '**' - name: Set up Terraform uses: coder/coder/.github/actions/setup-tf@main - name: Set up Bun @@ -27,7 +45,11 @@ jobs: - name: Install dependencies run: bun install - name: Run TypeScript tests - run: bun test + env: + ALL_CHANGED_FILES: ${{ steps.filter.outputs.all_files }} + SHARED_CHANGED: ${{ steps.filter.outputs.shared }} + MODULE_CHANGED_FILES: ${{ steps.filter.outputs.modules_files }} + run: ./scripts/ts_test_auto.sh - name: Run Terraform tests run: ./scripts/terraform_test_all.sh - name: Run Terraform Validate diff --git a/scripts/ts_test_auto.sh b/scripts/ts_test_auto.sh new file mode 100755 index 00000000..5f28e338 --- /dev/null +++ b/scripts/ts_test_auto.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Auto-detect which TypeScript tests to run based on changed files from paths-filter +# Uses paths-filter outputs from GitHub Actions: +# ALL_CHANGED_FILES - all files changed in the PR (for logging) +# SHARED_CHANGED - boolean indicating if shared infrastructure changed +# MODULE_CHANGED_FILES - only files in registry/**/modules/** (for processing) +# Runs all tests if shared infrastructure changes +# +# This script only runs tests for changed modules. Documentation and template changes are ignored. + +echo "==> Detecting changed files..." + +if [[ -n "${ALL_CHANGED_FILES:-}" ]]; then + echo "Changed files in PR:" + echo "$ALL_CHANGED_FILES" | tr ' ' '\n' | sed 's/^/ - /' + echo "" +fi + +if [[ "${SHARED_CHANGED:-false}" == "true" ]]; then + echo "==> Shared infrastructure changed" + echo "==> Running all tests for safety" + exec bun test +fi + +if [[ -z "${MODULE_CHANGED_FILES:-}" ]]; then + echo "✓ No module files changed, skipping tests" + exit 0 +fi + +CHANGED_FILES=$(echo "$MODULE_CHANGED_FILES" | tr ' ' '\n') + +MODULE_DIRS=() +while IFS= read -r file; do + if [[ "$file" =~ \.(md|png|jpg|jpeg|svg)$ ]]; then + continue + fi + + if [[ "$file" =~ ^registry/([^/]+)/modules/([^/]+)/ ]]; then + namespace="${BASH_REMATCH[1]}" + module="${BASH_REMATCH[2]}" + module_dir="registry/${namespace}/modules/${module}" + + if [[ -f "$module_dir/main.test.ts" ]] && [[ ! " ${MODULE_DIRS[*]} " =~ " ${module_dir} " ]]; then + MODULE_DIRS+=("$module_dir") + fi + fi +done <<< "$CHANGED_FILES" + +if [[ ${#MODULE_DIRS[@]} -eq 0 ]]; then + echo "✓ No TypeScript tests to run" + echo " (documentation, templates, namespace files, or modules without tests)" + exit 0 +fi + +echo "==> Running TypeScript tests for ${#MODULE_DIRS[@]} changed module(s):" +for dir in "${MODULE_DIRS[@]}"; do + echo " - $dir" +done +echo "" + +exec bun test "${MODULE_DIRS[@]}"