ai-devkit icon indicating copy to clipboard operation
ai-devkit copied to clipboard

Cannot read properties of undefined (reading 'length') when running ai-devkit skill add with private registry

Open codeaholicguy opened this issue 7 months ago • 1 comments

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.

codeaholicguy avatar Apr 15 '26 17:04 codeaholicguy

Fixed in https://github.com/codeaholicguy/ai-devkit/commit/a919c47ef9baff5331516e178d9bef554ad3a61b

codeaholicguy avatar Apr 15 '26 17:04 codeaholicguy