From a6e9aae9b7bb3a00e9d9858dc285f7c84be14a25 Mon Sep 17 00:00:00 2001 From: Milamber Date: Tue, 18 Aug 2026 10:11:54 +0300 Subject: [PATCH] fix(tools): scope bridge.groovy config vars with @Field Top-level `def` config vars (TRACKER_URL, API_TOKEN, AUTH_SCHEME, ENV) are locals of the script's run() method and are invisible to the cmd_* methods and the httpGet/httpPost helpers, so every subcommand threw MissingPropertyException before any HTTP call. Annotate them with @groovy.transform.Field so they become fields visible to every method. Fixes the failing tools/jira/tests/test_bridge_write.py suite. Closes #1098 Co-Authored-By: Claude Opus 4.8 --- tools/jira/bridge.groovy | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/jira/bridge.groovy b/tools/jira/bridge.groovy index 9ced0d21a..2edf245d9 100644 --- a/tools/jira/bridge.groovy +++ b/tools/jira/bridge.groovy @@ -4,6 +4,7 @@ @Grab('org.apache.groovy:groovy-json:4.0.21') import groovy.json.JsonOutput import groovy.json.JsonSlurper +import groovy.transform.Field /** * JIRA REST bridge for the issue-* skill family. @@ -37,11 +38,15 @@ import groovy.json.JsonSlurper * the calling skill — the bridge only executes confirmed actions. */ -def ENV = System.getenv() -def TRACKER_URL = ENV['ISSUE_TRACKER_URL'] ?: '' -def PROJECT_KEY = ENV['ISSUE_TRACKER_PROJECT'] ?: '' -def API_TOKEN = ENV['JIRA_API_TOKEN'] ?: '' -def AUTH_SCHEME = ENV['JIRA_AUTH_SCHEME'] ?: 'Basic' +// These are @Field so the cmd_* methods and the httpGet/httpPost helpers +// can see them. A bare top-level `def` in a Groovy script is a local of the +// generated run() method and is NOT visible inside methods — referencing it +// there throws MissingPropertyException. +@Field Map ENV = System.getenv() +@Field String TRACKER_URL = ENV['ISSUE_TRACKER_URL'] ?: '' +@Field String PROJECT_KEY = ENV['ISSUE_TRACKER_PROJECT'] ?: '' +@Field String API_TOKEN = ENV['JIRA_API_TOKEN'] ?: '' +@Field String AUTH_SCHEME = ENV['JIRA_AUTH_SCHEME'] ?: 'Basic' if (!TRACKER_URL) { System.err.println('error: ISSUE_TRACKER_URL not set in the environment (the calling skill resolves it from /issue-tracker-config.md and exports it)')