@@ -39,6 +39,9 @@ import { OutputFormatFlag } from "../../shared/cli/global-flags.ts";
3939import { outputLayerFor } from "../../shared/output/output.layer.ts" ;
4040import { legacyQuietProgressTextOutputLayer } from "../output/legacy-quiet-progress-text-output.layer.ts" ;
4141import { makeGoProxyLayer } from "../../shared/legacy/go-proxy.layer.ts" ;
42+ import { AiTool } from "../../shared/telemetry/ai-tool.service.ts" ;
43+ import { aiToolLayer } from "../../shared/telemetry/ai-tool.layer.ts" ;
44+ import { resolveAgentOutputFormat } from "../../shared/cli/agent-output.ts" ;
4245import {
4346 LEGACY_GLOBAL_FLAGS ,
4447 LegacyAgentFlag ,
@@ -96,7 +99,7 @@ export const legacyRoot = Command.make("supabase").pipe(
9699 Command . provide (
97100 Layer . unwrap (
98101 Effect . gen ( function * ( ) {
99- const outputFormat = yield * OutputFormatFlag ;
102+ const explicitOutputFormat = yield * OutputFormatFlag ;
100103 const goOutput = yield * LegacyOutputFlag ;
101104 const profile = yield * LegacyProfileFlag ;
102105 const debug = yield * LegacyDebugFlag ;
@@ -108,6 +111,10 @@ export const legacyRoot = Command.make("supabase").pipe(
108111 const createTicket = yield * LegacyCreateTicketFlag ;
109112 const agent = yield * LegacyAgentFlag ;
110113
114+ const aiTool = yield * AiTool . pipe ( Effect . provide ( aiToolLayer ) ) ;
115+ const isCodingAgent = agent === "yes" || ( agent !== "no" && Option . isSome ( aiTool . name ) ) ;
116+ const outputFormat = resolveAgentOutputFormat ( explicitOutputFormat , isCodingAgent ) ;
117+
111118 // Build args to prepend to every proxy exec call.
112119 // --output: use explicit --output if set, otherwise map from --output-format.
113120 const globalArgs : string [ ] = [ ] ;
0 commit comments