Cannot read properties of undefined (reading 'length') when running ai-devkit skill add with private registry
When .ai-devkit.json only contains a private registry config like:
{
"skills": {
"registries": {
"my-org/skills": "https://github.com/my-org/skills.git"
}
}
}
Running ai-devkit skill add my-org/skills some-skill crashes with:
Cannot read properties of undefined (reading 'length')
Why: ConfigManager.read() reads the JSON and casts it directly to DevKitConfig without filling in defaults. Since the file has no environments field, config.environments is undefined. Then SkillManager.resolveProjectEnvironments() hits config.environments.length, which throws on undefined.
Expected Behavior: When environments is missing from the config, skill add should treat it the same as an empty array, prompt the user to select environments, save the selection, then proceed with the installation.
Fixed in https://github.com/codeaholicguy/ai-devkit/commit/a919c47ef9baff5331516e178d9bef554ad3a61b