Validate project names for Docker Compose compatibility#1073
Merged
Conversation
Project creation now validates the project name against the rules for a Docker Compose project name. Names containing umlauts, spaces, dots or other characters that Docker Compose would silently strip or reject (it only allows alphanumerics, dashes and underscores, starting with a letter or digit) are now rejected up front, both in the interactive form and when the name is passed as an argument.
Code Coverage OverviewLanguages: Go Go / code-coverage/go-testThe overall coverage in the branch remains at 50%, unchanged from the branch. Show a code coverage summary of the most impacted files.
Updated |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0500280cf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
Docker Compose requires project names to contain only lowercase letters, digits, dashes and underscores and to start with a lowercase letter or digit. The previous regex also accepted uppercase letters (e.g. MyShop), which would later fail once the generated Docker setup runs from the project directory. Tighten the regex to lowercase-only and treat uppercase names as invalid.
The interactive create form now validates the project name as the user types instead of only on submit. The input description switches to a red-highlighted hint describing the allowed characters whenever the current value is not a valid Docker Compose project name, and reverts to the normal help text once it is valid. The allowed-character rule is shared between this live hint and the submit-time validation error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add validation for project names to ensure they are compatible with Docker Compose's project naming requirements. Project names can only contain alphanumeric characters, dashes, and underscores, and must start with a letter or digit.
Changes
validateProjectName()function incmd/project/project_create.gothat validates project folder names against Docker Compose naming constraints using a regex patterncomposeProjectNameRegexpregex pattern that matches valid Docker Compose project names:^[a-zA-Z0-9][a-zA-Z0-9_-]*$cmd/project/project_create_test.gowithTestValidateProjectName()that validates:Implementation Details
filepath.Base()) since Docker Compose derives the project name from the directory namehttps://claude.ai/code/session_012ynH2shX6TQgW983qJztYu