Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/cli/src/commands/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export async function modelsListCommand(options: { file: string; provider?: stri
for (const listing of listings) {
const name = listing.provider;
if (!listing.supportsDynamicListing) {
if (!options.json) {
if (options.json) {
process.stdout.write(
`${JSON.stringify({ provider: name, supportsDynamicListing: false, models: [] }, null, 2)}\n`,
);
} else {
console.log(chalk.yellow(`\n Provider '${name}' does not support dynamic model listing.`));
if (name === "claude") {
console.log(chalk.dim(` Claude models are specified directly (e.g. claude-sonnet-4-6, claude-opus-4-6).`));
Expand Down
15 changes: 15 additions & 0 deletions packages/cli/tests/unit/cli-contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,21 @@ test("models list keeps missing config guidance in the core runtime", async () =
expect(result.stderr).toContain("File not found");
});

test("models list JSON reports providers without dynamic listing support", async () => {
const dir = await makeTempDir();
const configPath = await writeBailianVaultConfig(dir);

const result = await runAgents(["models", "list", "--file", configPath, "--provider", "bailian", "--json"]);

expect(result.exitCode).toBe(0);
expect(JSON.parse(result.stdout)).toEqual({
provider: "bailian",
supportsDynamicListing: false,
models: [],
});
expect(result.stderr).toBe("");
});

test("migrated CLI commands consume core service APIs instead of composing internals", async () => {
const commands = ["destroy.ts", "session.ts", "state.ts", "deployment.ts", "validate.ts", "models.ts"];
const banned = [
Expand Down