Skip to content

ktext init panics when package.json has devDependencies but no dependencies #4

Description

@hypotyposis

Summary

ktext init panics when a repository has devDependencies in package.json but no dependencies field.

Reproduction

Create a minimal repo like:

{
  "name": "@acme/demo",
  "devDependencies": {
    "@acme/tooling": "1.0.0"
  }
}

Then run:

ktext init

Actual behavior

The process panics with:

panic: assignment to entry in nil map
...
internal/scan/scan.go:518

Expected behavior

ktext init should scan the repo normally and never panic on a common package.json shape.

Likely cause

In internal/scan/scan.go, scanDependencies() assigns all := pkg.Dependencies and then writes all[k] = v while merging devDependencies. If dependencies is absent, all is nil and the write panics.

Impact

This makes ktext init crash on valid JavaScript/TypeScript repos that only declare devDependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions