@@ -142,6 +142,60 @@ PLUGIN_CURRENT_PROTOCOL_VERSION=1
142142# Clean up
143143unset WARP_CLI_AGENT_PROTOCOL_VERSION
144144
145+ echo " "
146+ echo " === should-use-structured.sh ==="
147+
148+ source " $SCRIPT_DIR /../scripts/should-use-structured.sh"
149+
150+ echo " "
151+ echo " --- No protocol version → legacy ---"
152+ unset WARP_CLI_AGENT_PROTOCOL_VERSION
153+ unset WARP_CLIENT_VERSION
154+ should_use_structured
155+ assert_eq " no protocol version returns false" " 1" " $? "
156+
157+ echo " "
158+ echo " --- Protocol set, no client version → legacy ---"
159+ export WARP_CLI_AGENT_PROTOCOL_VERSION=1
160+ unset WARP_CLIENT_VERSION
161+ should_use_structured
162+ assert_eq " missing WARP_CLIENT_VERSION returns false" " 1" " $? "
163+
164+ echo " "
165+ echo " --- Protocol set, dev version → always structured (dev was never broken) ---"
166+ export WARP_CLI_AGENT_PROTOCOL_VERSION=1
167+ export WARP_CLIENT_VERSION=" v0.2026.03.30.08.43.dev_00"
168+ should_use_structured
169+ assert_eq " dev version returns true" " 0" " $? "
170+
171+ echo " "
172+ echo " --- Protocol set, broken stable version → legacy ---"
173+ export WARP_CLIENT_VERSION=" v0.2026.03.25.08.24.stable_05"
174+ should_use_structured
175+ assert_eq " exact broken stable version returns false" " 1" " $? "
176+
177+ echo " "
178+ echo " --- Protocol set, newer stable version → structured ---"
179+ export WARP_CLIENT_VERSION=" v0.2026.04.01.08.00.stable_00"
180+ should_use_structured
181+ assert_eq " newer stable version returns true" " 0" " $? "
182+
183+ echo " "
184+ echo " --- Protocol set, broken preview version → legacy ---"
185+ export WARP_CLIENT_VERSION=" v0.2026.03.25.08.24.preview_05"
186+ should_use_structured
187+ assert_eq " exact broken preview version returns false" " 1" " $? "
188+
189+ echo " "
190+ echo " --- Protocol set, newer preview version → structured ---"
191+ export WARP_CLIENT_VERSION=" v0.2026.04.01.08.00.preview_00"
192+ should_use_structured
193+ assert_eq " newer preview version returns true" " 0" " $? "
194+
195+ # Clean up
196+ unset WARP_CLI_AGENT_PROTOCOL_VERSION
197+ unset WARP_CLIENT_VERSION
198+
145199# --- Routing tests ---
146200# These test the hook scripts as subprocesses to verify routing behavior.
147201# We override /dev/tty writes since they'd fail in CI.
0 commit comments