From 0573557092f3dfec777bb7f16a764f1e7c0c3ef3 Mon Sep 17 00:00:00 2001 From: Imanol Maiztegui Date: Mon, 27 Apr 2026 19:41:11 +0200 Subject: [PATCH] test(opencode): update tool parameter snapshots and assertions for schema changes Refresh JSON Schema snapshots and adjust unit tests to reflect recent schema modifications in the opencode tool definitions. - Mark bash `description` field as optional and update its prefix text - Add i18n key fields (headerKey, questionKey, labelKey, descriptionKey) to the question tool snapshot - Flip bash parameter test from rejecting to accepting missing description - Remove stale blank line in snapshot file --- .../__snapshots__/parameters.test.ts.snap | 20 ++++++++++++++++--- .../opencode/test/tool/parameters.test.ts | 6 ++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/packages/opencode/test/tool/__snapshots__/parameters.test.ts.snap b/packages/opencode/test/tool/__snapshots__/parameters.test.ts.snap index eb3fe6cce4..6fedb62888 100644 --- a/packages/opencode/test/tool/__snapshots__/parameters.test.ts.snap +++ b/packages/opencode/test/tool/__snapshots__/parameters.test.ts.snap @@ -26,7 +26,7 @@ exports[`tool parameters JSON Schema (wire shape) bash 1`] = ` }, "description": { "description": -"Clear, concise description of what this command does in 5-10 words. Examples: +"Recommended: a clear, concise description of what this command does in 5-10 words. Examples: Input: ls Output: Lists files in current directory @@ -52,7 +52,6 @@ Output: Creates directory 'foo'" }, "required": [ "command", - "description", ], "type": "object", } @@ -220,7 +219,6 @@ exports[`tool parameters JSON Schema (wire shape) lsp 1`] = ` } `; - exports[`tool parameters JSON Schema (wire shape) plan 1`] = ` { "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -241,6 +239,10 @@ exports[`tool parameters JSON Schema (wire shape) question 1`] = ` "description": "Very short label (max 30 chars)", "type": "string", }, + "headerKey": { + "description": "Optional i18n key for the header; clients fall back to \`header\` when missing", + "type": "string", + }, "multiple": { "description": "Allow selecting multiple choices", "type": "boolean", @@ -253,10 +255,18 @@ exports[`tool parameters JSON Schema (wire shape) question 1`] = ` "description": "Explanation of choice", "type": "string", }, + "descriptionKey": { + "description": "Optional i18n key for the description", + "type": "string", + }, "label": { "description": "Display text (1-5 words, concise)", "type": "string", }, + "labelKey": { + "description": "Optional i18n key for the label; clients translate and still reply with \`label\`", + "type": "string", + }, }, "ref": "QuestionOption", "required": [ @@ -271,6 +281,10 @@ exports[`tool parameters JSON Schema (wire shape) question 1`] = ` "description": "Complete question", "type": "string", }, + "questionKey": { + "description": "Optional i18n key for the question text; clients fall back to \`question\` when missing", + "type": "string", + }, }, "ref": "QuestionPrompt", "required": [ diff --git a/packages/opencode/test/tool/parameters.test.ts b/packages/opencode/test/tool/parameters.test.ts index 8ea008a457..f37e8a3ce3 100644 --- a/packages/opencode/test/tool/parameters.test.ts +++ b/packages/opencode/test/tool/parameters.test.ts @@ -77,9 +77,11 @@ describe("tool parameters", () => { expect(parsed.timeout).toBe(5000) expect(parsed.workdir).toBe("/tmp") }) - test("rejects missing description (required by zod)", () => { - expect(accepts(Bash, { command: "ls" })).toBe(false) + // kilocode_change start - description is optional in kilo (see bash.ts Parameters) + test("accepts missing description (optional in kilo)", () => { + expect(accepts(Bash, { command: "ls" })).toBe(true) }) + // kilocode_change end test("rejects missing command", () => { expect(accepts(Bash, { description: "list" })).toBe(false) })