fix(projects): auto-generate identifier on project create - #8
Open
OmarAdel10 wants to merge 1 commit into
Open
Conversation
- `project new <name>` without `-i` previously sent CreateProject with no identifier, which the Plane API rejects. - Add _default_identifier helper: derives identifier from the project name (first 5 alphanumeric chars, uppercased). - Explicit -i flag still takes precedence; create now always sends an identifier. - Add tests/test_projects.py covering derivation, punctuation stripping, short names, and uppercasing.
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
Fixes
project new <name>failing when no-iflag is given. The Plane API requires a project identifier, but the CLI previously sentCreateProject(name=...)with no identifier, causing the create to be rejected. The identifier is now auto-generated from the project name (first 5 alphanumeric characters, uppercased) when not explicitly provided.Problem
planecli project new "My Project"sent
CreateProjectwith a missingidentifierfield. The Plane API rejects project creation without an identifier, so the command failed unless the user remembered to pass-i FEetc. The--helptext already documented "Auto-generated if not specified" — this PR makes the CLI honor that contract.Change
src/planecli/commands/projects.py_default_identifier(name)helper: derives an identifier from the project name (alphanumeric characters only, max 5, uppercased).createnow always sends anidentifier: the explicit-ivalue wins; otherwise the derived default is used. Explicit identifiers are still uppercased as before.tests/test_projects.py(new)Behavior
project new "My Backend API"→ API error (missing identifier)project new "My Backend API"→ created with identifierMYBACproject new "API" -i fe→ created withFEFE)No breaking changes. No output-format changes.
Testing
make check(ruff format + ruff lint + pytest) — all green:Includes the 4 new
tests/test_projects.pytests.Notes
OmarAdel10/plane-cli) since write access to this repo is not available.fix/project-create-auto-identifier