fix(cli): allow underscores in entity names#544
Open
jackc625 wants to merge 1 commit into
Open
Conversation
The entity name pattern introduced in base44#151 rejected snake_case names the platform already accepts and serves in production. Because every command that loads the project validates all entities eagerly, a single snake_case entity name blocked site deploy, functions deploy/pull, deploy, and dev entirely. Relax the pattern to also accept underscores, matching the platform and the rest of the codebase: type generation already splits names on underscores, and function automations and agent tool configs reference entities via unrestricted entity_name fields. Fixes base44#543 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 #543.
The entity name pattern introduced in #151 (
/^[a-zA-Z0-9]+$/) rejects snake_case names the platform already accepts and serves in production. BecausereadProjectConfig()eagerly validates every entity file, a single entity like"name": "line_items"abortssite deploy,functions deploy,functions pull,deploy, anddev— including commands that never touch entities. This relaxes the pattern to/^[a-zA-Z0-9_]+$/.Why underscores specifically
base44.entities.line_items)toPascalCase()splits on/[-_\s]+/andEntityTypeRegistryemits quoted keysentity_namefields — such entities just couldn't be defined[a-zA-Z0-9_-]), connector custom types ([a-z0-9_-]/i)Testing
tests/core/entity-schema.spec.tscovering accepted/rejected nameswith-snake-case-entities+ integration tests:readProjectConfig()loads aline_itemsentity, andentities pushsucceeds end-to-end against the mock APIbun run test,bun run typecheck, and Biome all pass on changed files🤖 Generated with Claude Code