Context
Discovered during implementation of fix for container name collision (#18).
Description
The container name is built as cognitx-codegraph-{repo_name}-{hash} where repo_name = detected.root.name (the bare directory name). Docker container names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*. A git root with a space in its name (e.g. my project) would produce cognitx-codegraph-my project-abcd1234, which Docker will reject.
Reproducer:
mkdir "my project" && cd "my project" && git init && codegraph init --yes --skip-docker --skip-index
# docker-compose.yml is written with an invalid container_name
docker compose up -d # fails: invalid container name
Suggested approach
Sanitize repo_name before interpolating it into the container name — replace any character outside [a-zA-Z0-9_.-] with - (and collapse repeated dashes).
Context
Discovered during implementation of fix for container name collision (#18).
Description
The container name is built as
cognitx-codegraph-{repo_name}-{hash}whererepo_name = detected.root.name(the bare directory name). Docker container names must match[a-zA-Z0-9][a-zA-Z0-9_.-]*. A git root with a space in its name (e.g.my project) would producecognitx-codegraph-my project-abcd1234, which Docker will reject.Reproducer:
Suggested approach
Sanitize
repo_namebefore interpolating it into the container name — replace any character outside[a-zA-Z0-9_.-]with-(and collapse repeated dashes).