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:
can1357
2026-02-26 12:38:57 +01:00
parent 944d7f8d8d
commit e710d97d74
3 changed files with 41 additions and 4 deletions
+22 -4
View File
@@ -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)";
}
}
// =============================================================================