From 92040c186c0e1a32098a96a90932c011a591e8a5 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Sat, 7 Feb 2026 04:57:46 +0000 Subject: [PATCH 1/3] fix: deploy greeting template via setup.sh and include app name in greeting The session greeting was missing the app name (e.g., 'in OpenCode v1.1.53') because: 1) the template instruction was too vague ('relay ALL lines'), and 2) setup.sh never deployed the template to ~/.config/opencode/AGENTS.md. - Make greeting parse instruction explicit with named fields ({app}, {app_version}) - Add template deploy step to inject_agents_reference() in setup.sh - Resolves t137 --- setup.sh | 11 +++++++++++ templates/opencode-config-agents.md | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 0ace3ff36..c4643708c 100755 --- a/setup.sh +++ b/setup.sh @@ -2700,6 +2700,17 @@ inject_agents_reference() { print_success "Updated $updated_count AI assistant configuration(s)" fi + # Deploy OpenCode config-level AGENTS.md from managed template + # This controls the session greeting (auto-loaded by OpenCode from config root) + local opencode_config_dir="$HOME/.config/opencode" + local opencode_config_agents="$opencode_config_dir/AGENTS.md" + local template_source="$SCRIPT_DIR/templates/opencode-config-agents.md" + + if [[ -d "$opencode_config_dir" && -f "$template_source" ]]; then + cp "$template_source" "$opencode_config_agents" + print_success "Deployed greeting template to $opencode_config_agents" + fi + return 0 } diff --git a/templates/opencode-config-agents.md b/templates/opencode-config-agents.md index d0682d671..03ac01b5d 100644 --- a/templates/opencode-config-agents.md +++ b/templates/opencode-config-agents.md @@ -5,7 +5,7 @@ Add ~/.aidevops/agents/AGENTS.md to context for AI DevOps capabilities. **On conversation start**: 1. If you have Bash tool: Run `bash ~/.aidevops/agents/scripts/aidevops-update-check.sh` 2. If no Bash tool: Read `~/.aidevops/cache/session-greeting.txt` (cached by agents with Bash) -3. Relay ALL lines from the output in your greeting. The first line is the version string, subsequent lines are runtime context. Format: "Hi!\n\nWe're running https://aidevops.sh v{version}. {runtime context}\n\nWhat would you like to work on?" +3. Parse the first line of output (format: `aidevops v{version} running in {app} v{app_version} | {repo}`). Greet with: "Hi!\n\nWe're running https://aidevops.sh v{version} in {app} v{app_version}.\n\nWhat would you like to work on?" 4. Then respond to the user's actual message If update check output starts with `UPDATE_AVAILABLE|` (e.g., `UPDATE_AVAILABLE|current|latest|AppName`), inform user: "Update available (current → latest). Run `aidevops update` to update." From 5689cf72cc20ed75b18388432121b9f9e133f22f Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Sat, 7 Feb 2026 05:00:24 +0000 Subject: [PATCH 2/3] fix: add error handling for greeting template deploy (review feedback) --- setup.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index c4643708c..1f883a0ed 100755 --- a/setup.sh +++ b/setup.sh @@ -2707,8 +2707,11 @@ inject_agents_reference() { local template_source="$SCRIPT_DIR/templates/opencode-config-agents.md" if [[ -d "$opencode_config_dir" && -f "$template_source" ]]; then - cp "$template_source" "$opencode_config_agents" - print_success "Deployed greeting template to $opencode_config_agents" + if cp "$template_source" "$opencode_config_agents"; then + print_success "Deployed greeting template to $opencode_config_agents" + else + print_error "Failed to deploy greeting template to $opencode_config_agents" + fi fi return 0 From f8e68a0884da5ec2050a9e79ccdd718be5a7a5e8 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Sat, 7 Feb 2026 05:04:29 +0000 Subject: [PATCH 3/3] fix: use INSTALL_DIR instead of undefined SCRIPT_DIR, add backup before overwrite Address CodeRabbit review feedback: - SCRIPT_DIR was undefined; use global INSTALL_DIR (set at line 25) - Add backup with rotation before overwriting user customizations - Skip backup if template is already identical (avoids churn) --- setup.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 1f883a0ed..1ef39aeca 100755 --- a/setup.sh +++ b/setup.sh @@ -2704,9 +2704,15 @@ inject_agents_reference() { # This controls the session greeting (auto-loaded by OpenCode from config root) local opencode_config_dir="$HOME/.config/opencode" local opencode_config_agents="$opencode_config_dir/AGENTS.md" - local template_source="$SCRIPT_DIR/templates/opencode-config-agents.md" + local template_source="$INSTALL_DIR/templates/opencode-config-agents.md" if [[ -d "$opencode_config_dir" && -f "$template_source" ]]; then + # Backup if file exists and differs from template + if [[ -f "$opencode_config_agents" ]]; then + if ! diff -q "$template_source" "$opencode_config_agents" &>/dev/null; then + create_backup_with_rotation "$opencode_config_agents" "opencode-agents" + fi + fi if cp "$template_source" "$opencode_config_agents"; then print_success "Deployed greeting template to $opencode_config_agents" else