fix(coding-agent): corrected config display to render arrays and objects as JSON
- Improved config display formatting to properly render arrays and objects as JSON instead of `[object Object]`. - Enhanced type display in config list output to show correct type indicators for number, array, and record settings. - Added test coverage for record settings rendering in config list output.
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- Increased default async max jobs limit from 15 to 100 for improved concurrent task handling
|
||||
|
||||
### Fixed
|
||||
|
||||
- Improved config display formatting to properly render arrays and objects as JSON instead of `[object Object]`
|
||||
- Enhanced type display in config list output to show correct type indicators for number, array, and record settings
|
||||
|
||||
## [13.3.3] - 2026-02-26
|
||||
### Added
|
||||
|
||||
|
||||
@@ -134,18 +134,36 @@ function formatValue(value: unknown): string {
|
||||
if (typeof value === "number") {
|
||||
return chalk.cyan(String(value));
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
return chalk.yellow(value);
|
||||
}
|
||||
if (Array.isArray(value) || typeof value === "object") {
|
||||
try {
|
||||
return chalk.yellow(JSON.stringify(value));
|
||||
} catch {
|
||||
return chalk.yellow(String(value));
|
||||
}
|
||||
}
|
||||
return chalk.yellow(String(value));
|
||||
}
|
||||
|
||||
function getTypeDisplay(def: CliSettingDef): string {
|
||||
if (def.type === "boolean") {
|
||||
return "(boolean)";
|
||||
}
|
||||
const values = getSettingValues(def);
|
||||
if (values && values.length > 0) {
|
||||
return `(${values.join("|")})`;
|
||||
}
|
||||
return "(string)";
|
||||
switch (def.type) {
|
||||
case "boolean":
|
||||
return "(boolean)";
|
||||
case "number":
|
||||
return "(number)";
|
||||
case "array":
|
||||
return "(array)";
|
||||
case "record":
|
||||
return "(record)";
|
||||
default:
|
||||
return "(string)";
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
||||
@@ -39,4 +39,17 @@ describe("config CLI schema coverage", () => {
|
||||
expect(parsed.type).toBe("array");
|
||||
expect(parsed.description).toBe("");
|
||||
});
|
||||
|
||||
it("renders record settings as JSON and with record type in text output", async () => {
|
||||
const logSpy = vi.spyOn(console, "log").mockImplementation(() => {});
|
||||
|
||||
await runConfigCommand({ action: "list", flags: {} });
|
||||
|
||||
const lines = logSpy.mock.calls.map(call => String(call[0] ?? ""));
|
||||
const modelRolesLine = lines.find(line => line.includes("modelRoles ="));
|
||||
expect(modelRolesLine).toBeDefined();
|
||||
expect(modelRolesLine).toContain("modelRoles = {}");
|
||||
expect(modelRolesLine).toContain("(record)");
|
||||
expect(modelRolesLine).not.toContain("[object Object]");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user