Skip to content

Commit db82f6d

Browse files
authored
Merge branch 'main' into codex/sync-skip-missing-files
2 parents b9007ef + f831d3d commit db82f6d

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

packages/cli/src/commands/models.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ export async function modelsListCommand(options: { file: string; provider?: stri
99
for (const listing of listings) {
1010
const name = listing.provider;
1111
if (!listing.supportsDynamicListing) {
12-
if (!options.json) {
12+
if (options.json) {
13+
process.stdout.write(
14+
`${JSON.stringify({ provider: name, supportsDynamicListing: false, models: [] }, null, 2)}\n`,
15+
);
16+
} else {
1317
console.log(chalk.yellow(`\n Provider '${name}' does not support dynamic model listing.`));
1418
if (name === "claude") {
1519
console.log(chalk.dim(` Claude models are specified directly (e.g. claude-sonnet-4-6, claude-opus-4-6).`));

packages/cli/tests/unit/cli-contracts.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,21 @@ test("models list keeps missing config guidance in the core runtime", async () =
466466
expect(result.stderr).toContain("File not found");
467467
});
468468

469+
test("models list JSON reports providers without dynamic listing support", async () => {
470+
const dir = await makeTempDir();
471+
const configPath = await writeBailianVaultConfig(dir);
472+
473+
const result = await runAgents(["models", "list", "--file", configPath, "--provider", "bailian", "--json"]);
474+
475+
expect(result.exitCode).toBe(0);
476+
expect(JSON.parse(result.stdout)).toEqual({
477+
provider: "bailian",
478+
supportsDynamicListing: false,
479+
models: [],
480+
});
481+
expect(result.stderr).toBe("");
482+
});
483+
469484
test("migrated CLI commands consume core service APIs instead of composing internals", async () => {
470485
const commands = ["destroy.ts", "session.ts", "state.ts", "deployment.ts", "validate.ts", "models.ts"];
471486
const banned = [

0 commit comments

Comments
 (0)