feat(models): generate Command Code catalog snapshot
This commit is contained in:
@@ -8,6 +8,9 @@ import {
|
||||
parseKnownTextOnlyModelIds,
|
||||
parseModelsReference,
|
||||
parsePackageVersion,
|
||||
renderCommandCodeCatalog,
|
||||
updateChangelogCatalogVersion,
|
||||
updateReadmeCatalogVersion,
|
||||
type CommandCodeModelMetadata,
|
||||
} from "../.github/scripts/check-commandcode-model-metadata.ts"
|
||||
|
||||
@@ -68,6 +71,7 @@ describe("Command Code model metadata checker", () => {
|
||||
const diff = diffModelMetadata(current, upstream)
|
||||
|
||||
assert.deepEqual(diff, {
|
||||
versionChanged: false,
|
||||
addedImageModelIds: ["added-image"],
|
||||
removedImageModelIds: ["removed-image"],
|
||||
addedReasoningModelIds: ["added-reasoning"],
|
||||
@@ -77,6 +81,63 @@ describe("Command Code model metadata checker", () => {
|
||||
assert.equal(hasModelMetadataDiff(diff), true)
|
||||
})
|
||||
|
||||
it("reports CLI version drift even when model metadata is unchanged", () => {
|
||||
const metadata: CommandCodeModelMetadata = {
|
||||
imageModelIds: ["vision-model"],
|
||||
reasoningEfforts: { "vision-model": ["low"] },
|
||||
}
|
||||
|
||||
const diff = diffModelMetadata(metadata, metadata, "1.32.2", "1.33.0")
|
||||
|
||||
assert.equal(diff.versionChanged, true)
|
||||
assert.equal(hasModelMetadataDiff(diff), true)
|
||||
})
|
||||
|
||||
it("renders a deterministic generated catalog and updates the README version", () => {
|
||||
assert.equal(
|
||||
renderCommandCodeCatalog("1.33.0", {
|
||||
imageModelIds: ["b-model", "a-model"],
|
||||
reasoningEfforts: {
|
||||
"b-model": ["high", "max"],
|
||||
"a-model": ["low"],
|
||||
},
|
||||
}),
|
||||
`export const COMMAND_CODE_CLI_VERSION = "1.33.0"
|
||||
|
||||
export type CommandCodeInputType = "text" | "image"
|
||||
export type CommandCodeReasoningEffort = "minimal" | "low" | "medium" | "high" | "xhigh" | "max"
|
||||
|
||||
/**
|
||||
* Generated from command-code@1.33.0 by \`npm run sync:commandcode-catalog\`.
|
||||
* Do not edit manually.
|
||||
*/
|
||||
export const MODEL_INPUT_MODALITIES: Readonly<Record<string, readonly CommandCodeInputType[]>> = {
|
||||
"a-model": ["text", "image"],
|
||||
"b-model": ["text", "image"],
|
||||
}
|
||||
|
||||
export const MODEL_EFFORTS: Readonly<Record<string, readonly CommandCodeReasoningEffort[]>> = {
|
||||
"a-model": ["low"],
|
||||
"b-model": ["high", "max"],
|
||||
}
|
||||
`,
|
||||
)
|
||||
assert.equal(
|
||||
updateReadmeCatalogVersion(
|
||||
"The capability snapshot currently follows `command-code@1.32.2`.",
|
||||
"1.33.0",
|
||||
),
|
||||
"The capability snapshot currently follows `command-code@1.33.0`.",
|
||||
)
|
||||
assert.equal(
|
||||
updateChangelogCatalogVersion(
|
||||
"- Refresh capabilities from `command-code@1.32.2`, including metadata.",
|
||||
"1.33.0",
|
||||
),
|
||||
"- Refresh capabilities from `command-code@1.33.0`, including metadata.",
|
||||
)
|
||||
})
|
||||
|
||||
it("rejects unexpected upstream structures instead of silently passing", () => {
|
||||
assert.throws(() => parseModelsReference("# no catalog"), /No model rows/)
|
||||
assert.throws(
|
||||
|
||||
+14
-34
@@ -4,6 +4,7 @@ import { tmpdir } from "node:os"
|
||||
import { join } from "node:path"
|
||||
import { describe, it } from "node:test"
|
||||
|
||||
import { COMMAND_CODE_CLI_VERSION } from "../src/commandcode-catalog.ts"
|
||||
import {
|
||||
apiForModelId,
|
||||
baseUrlForModel,
|
||||
@@ -100,7 +101,7 @@ describe("commandCodeModelsFromApiResponse()", () => {
|
||||
)
|
||||
})
|
||||
|
||||
it("matches command-code@1.32.2 image input capabilities", () => {
|
||||
it(`uses the command-code@${COMMAND_CODE_CLI_VERSION} image capability catalog`, () => {
|
||||
assert.deepEqual(inputModalitiesForModel("gpt-5.6-luna"), ["text", "image"])
|
||||
assert.deepEqual(inputModalitiesForModel("meta/muse-spark-1.2"), ["text", "image"])
|
||||
assert.deepEqual(inputModalitiesForModel("deepseek/deepseek-v4-flash-vision-exp"), [
|
||||
@@ -117,7 +118,10 @@ describe("commandCodeModelsFromApiResponse()", () => {
|
||||
assert.equal(modelSupportsImageInput("deepseek/deepseek-v4-flash-vision-exp"), true)
|
||||
assert.equal(modelSupportsImageInput("stealth/ox-alpha"), true)
|
||||
assert.equal(modelSupportsImageInput("deepseek/deepseek-v4-pro"), false)
|
||||
assert.equal(Object.keys(MODEL_INPUT_MODALITIES).length, 41)
|
||||
assert.ok(Object.keys(MODEL_INPUT_MODALITIES).length > 0)
|
||||
for (const modalities of Object.values(MODEL_INPUT_MODALITIES)) {
|
||||
assert.deepEqual(modalities, ["text", "image"])
|
||||
}
|
||||
})
|
||||
|
||||
it("marks only known reasoning models as reasoning-capable", () => {
|
||||
@@ -133,38 +137,14 @@ describe("commandCodeModelsFromApiResponse()", () => {
|
||||
assert.equal(models[1]?.reasoning, false)
|
||||
})
|
||||
|
||||
it("matches the exact command-code@1.32.2 reasoning effort catalog", () => {
|
||||
assert.deepEqual(MODEL_EFFORTS, {
|
||||
"Qwen/Qwen3.8-27B": ["low", "medium", "xhigh"],
|
||||
"Qwen/Qwen3.8-Max": ["low", "medium", "xhigh"],
|
||||
"claude-fable-5": ["low", "medium", "high", "xhigh", "max"],
|
||||
"claude-opus-4-7": ["low", "medium", "high", "xhigh", "max"],
|
||||
"claude-opus-4-8": ["low", "medium", "high", "xhigh", "max"],
|
||||
"claude-opus-5": ["low", "medium", "high", "xhigh", "max"],
|
||||
"claude-sonnet-4-6": ["low", "medium", "high", "xhigh", "max"],
|
||||
"claude-sonnet-5": ["low", "medium", "high", "xhigh", "max"],
|
||||
"deepseek/deepseek-v4-flash": ["high", "max"],
|
||||
"deepseek/deepseek-v4-flash-vision-exp": ["high", "max"],
|
||||
"deepseek/deepseek-v4-pro": ["high", "max"],
|
||||
"gpt-5.3-codex": ["low", "medium", "high", "xhigh"],
|
||||
"gpt-5.4": ["low", "medium", "high", "xhigh"],
|
||||
"gpt-5.4-mini": ["low", "medium", "high"],
|
||||
"gpt-5.5": ["low", "medium", "high", "xhigh"],
|
||||
"gpt-5.6-luna": ["low", "medium", "high", "xhigh", "max"],
|
||||
"gpt-5.6-sol": ["low", "medium", "high", "xhigh", "max"],
|
||||
"gpt-5.6-terra": ["low", "medium", "high", "xhigh", "max"],
|
||||
"google/gemini-3.1-flash-lite": ["low", "medium", "high"],
|
||||
"google/gemini-3.5-flash": ["low", "medium", "high"],
|
||||
"google/gemini-3.5-flash-lite": ["low", "medium", "high"],
|
||||
"google/gemini-3.6-flash": ["low", "medium", "high"],
|
||||
"google/gemini-3.7-flash": ["low", "medium", "high"],
|
||||
"sakana/fugu-ultra": ["high", "xhigh"],
|
||||
"stealth/ox-alpha": ["low", "high", "max"],
|
||||
"xai/grok-4.5": ["low", "medium", "high"],
|
||||
"xai/grok-4.6": ["low", "medium", "high", "xhigh"],
|
||||
"zai-org/GLM-5.2": ["high", "max"],
|
||||
"zai-org/GLM-5.3": ["low", "high", "max"],
|
||||
})
|
||||
it(`uses the command-code@${COMMAND_CODE_CLI_VERSION} reasoning effort catalog`, () => {
|
||||
const validEfforts = new Set(["minimal", "low", "medium", "high", "xhigh", "max"])
|
||||
assert.ok(Object.keys(MODEL_EFFORTS).length > 0)
|
||||
for (const efforts of Object.values(MODEL_EFFORTS)) {
|
||||
assert.ok(efforts.length > 0)
|
||||
assert.equal(new Set(efforts).size, efforts.length)
|
||||
assert.ok(efforts.every((effort) => validEfforts.has(effort)))
|
||||
}
|
||||
})
|
||||
|
||||
it("builds separate canonical pi and OMP metadata", () => {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import assert from "node:assert/strict"
|
||||
import { after, before, beforeEach, describe, it } from "node:test"
|
||||
|
||||
import { COMMAND_CODE_CLI_VERSION } from "../src/commandcode-catalog.ts"
|
||||
import type { AssistantMessageEvent } from "../src/core.ts"
|
||||
import { MODEL_EFFORTS, thinkingLevelMapForEfforts } from "../src/models.ts"
|
||||
import {
|
||||
@@ -569,7 +570,7 @@ describe("streamCommandCode — request serialization", () => {
|
||||
|
||||
const headers = server.lastRequestHeaders()
|
||||
assert.equal(headers.authorization, "Bearer mock-key")
|
||||
assert.equal(headers["x-command-code-version"], "1.32.2")
|
||||
assert.equal(headers["x-command-code-version"], COMMAND_CODE_CLI_VERSION)
|
||||
assert.equal(headers["x-project-slug"], "repo")
|
||||
assert.equal(headers["x-taste-learning"], "true")
|
||||
assert.equal(headers["x-co-flag"], "false")
|
||||
|
||||
Reference in New Issue
Block a user