diff --git a/.gitignore b/.gitignore index 55947fc5b..a9d6b2e22 100644 --- a/.gitignore +++ b/.gitignore @@ -148,3 +148,4 @@ gha-creds-*.json # IDEs .idea +LICENSE.txt diff --git a/bun.lock b/bun.lock index 16c21d09b..b8a3e27c9 100644 --- a/bun.lock +++ b/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "registry", diff --git a/registry/rothnic/modules/opencode/README.md b/registry/rothnic/modules/opencode/README.md index 857f08629..8c6976e1a 100644 --- a/registry/rothnic/modules/opencode/README.md +++ b/registry/rothnic/modules/opencode/README.md @@ -15,7 +15,7 @@ Integrate [OpenCode.ai](https://opencode.ai/) - an AI coding agent that runs in ```tf module "opencode" { - source = "git::https://github.com/rothnic/coder-registry.git//registry/rothnic/modules/opencode" + source = "git::https://github.com/rothnic/coder-registry.git//registry/rothnic/modules/opencode" agent_id = coder_agent.main.id workdir = "/workspaces" @@ -31,18 +31,20 @@ OpenCode requires GitHub Copilot's special session token format. Three options: **Option 1: Pre-configured auth (Recommended)** Run locally: + ```bash npm install -g opencode-ai -opencode auth login # Complete device flow -cat ~/.local/share/opencode/auth.json # Copy this +opencode auth login # Complete device flow +cat ~/.local/share/opencode/auth.json # Copy this ``` In your template: + ```tf module "opencode" { source = "..." - opencode_auth_config = file("${path.module}/opencode-auth.json") # Store as file + opencode_auth_config = file("${path.module}/opencode-auth.json") # Store as file # Or use variable: opencode_auth_config = var.opencode_auth_json } ``` @@ -61,15 +63,15 @@ For Anthropic, OpenAI, etc., users authenticate via `opencode auth login` in the ## Configuration -| Variable | Description | Default | -|----------|-------------|---------| -| `agent_id` | Coder agent ID | Required | -| `workdir` | Working directory | Required | -| `opencode_auth_config` | Pre-configured auth.json content | `""` (optional) | -| `opencode_version` | OpenCode version | `"latest"` | -| `install_method` | Installation method: `npm` or `curl` | `"npm"` | -| `report_tasks` | Enable Coder task reporting | `true` | -| `subdomain` | Use subdomain for app access | `false` | +| Variable | Description | Default | +| ---------------------- | ------------------------------------ | --------------- | +| `agent_id` | Coder agent ID | Required | +| `workdir` | Working directory | Required | +| `opencode_auth_config` | Pre-configured auth.json content | `""` (optional) | +| `opencode_version` | OpenCode version | `"latest"` | +| `install_method` | Installation method: `npm` or `curl` | `"npm"` | +| `report_tasks` | Enable Coder task reporting | `true` | +| `subdomain` | Use subdomain for app access | `false` | See [variables](./main.tf) for complete list. diff --git a/registry/rothnic/modules/opencode/scripts/install.sh b/registry/rothnic/modules/opencode/scripts/install.sh index 71e9e92db..a683c859c 100644 --- a/registry/rothnic/modules/opencode/scripts/install.sh +++ b/registry/rothnic/modules/opencode/scripts/install.sh @@ -46,7 +46,7 @@ install_nodejs() { fi # Reload shell environment - source "$HOME"/.bashrc 2>/dev/null || true + source "$HOME"/.bashrc 2> /dev/null || true if ! command_exists node; then echo "ERROR: Failed to install Node.js" @@ -82,7 +82,7 @@ install_opencode() { export PATH="$HOME/.local/bin:$PATH" # Persist PATH to shell profile - if ! grep -q 'PATH="$HOME/.local/bin:$PATH"' "$HOME/.bashrc" 2>/dev/null; then + if ! grep -q 'PATH="$HOME/.local/bin:$PATH"' "$HOME/.bashrc" 2> /dev/null; then echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc" fi @@ -180,7 +180,7 @@ configure_github_copilot_provider() { echo "✓ GitHub token available - configuring Copilot provider in auth.json" # Create auth.json with GitHub Copilot credentials - cat > "$auth_file" < "$auth_file" << EOF { "credentials": [ { diff --git a/registry/rothnic/modules/opencode/scripts/start.sh b/registry/rothnic/modules/opencode/scripts/start.sh index 7003d0c38..5f45c721c 100644 --- a/registry/rothnic/modules/opencode/scripts/start.sh +++ b/registry/rothnic/modules/opencode/scripts/start.sh @@ -1,7 +1,7 @@ #!/bin/bash set -euo pipefail -source "$HOME"/.bashrc 2>/dev/null || true +source "$HOME"/.bashrc 2> /dev/null || true export PATH="$HOME/.local/bin:$PATH" command_exists() { @@ -78,7 +78,7 @@ setup_github_authentication() { # Note: This creates a simplified auth.json that may not work with GitHub Copilot # For full GitHub Copilot support, use the opencode_auth_config variable echo "⚠ Warning: Using simplified auth format - GitHub Copilot may require device flow auth" - cat > "$auth_file" < "$auth_file" << EOF { "credentials": [ {