Skip to content

Commit ba4ec8b

Browse files
fix: normalize string entries in loadComponents to prevent padEnd crash (#273)
`agentsys list` commands crash with "Cannot read properties of undefined (reading 'padEnd')" because components.json stores entries as plain strings while the display code expects objects with a .name property. Normalize string entries to {name} objects when loading from JSON.
1 parent c39600f commit ba4ec8b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bin/cli.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -786,10 +786,13 @@ function loadComponents(pluginDir) {
786786
if (fs.existsSync(componentsPath)) {
787787
try {
788788
const data = JSON.parse(fs.readFileSync(componentsPath, 'utf8'));
789+
const normalize = (arr) => (arr || []).map(item =>
790+
typeof item === 'string' ? { name: item } : item
791+
);
789792
return {
790-
agents: data.agents || [],
791-
skills: data.skills || [],
792-
commands: data.commands || []
793+
agents: normalize(data.agents),
794+
skills: normalize(data.skills),
795+
commands: normalize(data.commands)
793796
};
794797
} catch {
795798
// Fall through to filesystem scan

0 commit comments

Comments
 (0)