From e4d142806cb288e95799f51b0d296f309ce4223a Mon Sep 17 00:00:00 2001 From: online5880 Date: Wed, 11 Mar 2026 23:38:37 +0900 Subject: [PATCH] fix: recover unquoted agent hex colors --- packages/opencode/src/config/markdown.ts | 11 ++++- .../opencode/test/config/markdown.test.ts | 49 ++++++++++++++++++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/config/markdown.ts b/packages/opencode/src/config/markdown.ts index 3c9709b5b3b..264c6a6c537 100644 --- a/packages/opencode/src/config/markdown.ts +++ b/packages/opencode/src/config/markdown.ts @@ -6,6 +6,8 @@ import { Filesystem } from "../util/filesystem" export namespace ConfigMarkdown { export const FILE_REGEX = /(? { @@ -226,3 +229,47 @@ describe("ConfigMarkdown: frontmatter has weird model id", async () => { expect(result.content.trim()).toBe("Strictly follow da rules") }) }) + +describe("ConfigMarkdown: frontmatter parsing w/ hex colors", () => { + let dir: string + + beforeAll(async () => { + dir = await mkdtemp(path.join(tmpdir(), "opencode-markdown-")) + + await writeFile( + path.join(dir, "quoted-hex.md"), + `--- +name: Quoted Hex +color: "#008080" +--- + +Content +`, + ) + + await writeFile( + path.join(dir, "unquoted-hex.md"), + `--- +name: Unquoted Hex +color: #008080 +--- + +Content +`, + ) + }) + + afterAll(async () => { + await rm(dir, { recursive: true, force: true }) + }) + + test("should preserve quoted hex colors", async () => { + const result = await ConfigMarkdown.parse(path.join(dir, "quoted-hex.md")) + expect(result.data.color).toBe("#008080") + }) + + test("should recover unquoted hex colors that YAML treats as comments", async () => { + const result = await ConfigMarkdown.parse(path.join(dir, "unquoted-hex.md")) + expect(result.data.color).toBe("#008080") + }) +})