Skip to content

Commit 6fd9d71

Browse files
committed
fix: Accept simpler schema in @observe command
Gemini has some issues with consistently generating the required schema, so accept a simpler schema too.
1 parent ce8ee94 commit 6fd9d71

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

packages/navie/src/commands/observe-command.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,15 @@ const RelevantTest = z.object({
3838
.describe('An ordered list of terminal command(s) necessary to execute to install AppMap'),
3939
testCommands: z
4040
.array(
41-
z.object({
42-
command: z.string().describe('The command to execute'),
43-
description: z.string().optional().describe('A description of the command'),
44-
})
41+
z
42+
.union([
43+
z.object({
44+
command: z.string().describe('The command to execute'),
45+
description: z.string().optional().describe('A description of the command'),
46+
}),
47+
z.string().describe('A command to execute'),
48+
])
49+
.describe('The command to execute')
4550
)
4651
.optional()
4752
.describe('The ordered list of terminal command(s) that can be executed to run the test'),
@@ -205,7 +210,7 @@ ${
205210
testCommands?.length
206211
? `I've identified the following commands that you may need to run to execute the test:
207212
<commands>
208-
${testCommands?.map((command) => `- \`${command.command}\`: ${command.description}`).join('\n')}
213+
${testCommands?.map((command) => `- ${commandDescription(command)}`).join('\n')}
209214
</commands>
210215
`
211216
: ''
@@ -250,3 +255,10 @@ Do not include:
250255
}
251256
}
252257
}
258+
259+
function commandDescription(command: string | { command: string; description?: string }): string {
260+
if (typeof command === 'string') {
261+
return `\`${command}\``;
262+
}
263+
return `\`${command.command}\`: ${command.description ?? ''}`;
264+
}

0 commit comments

Comments
 (0)