Skip to content

fix(cli): allow underscores in entity names#544

Open
jackc625 wants to merge 1 commit into
base44:mainfrom
jackc625:fix/entity-name-underscores
Open

fix(cli): allow underscores in entity names#544
jackc625 wants to merge 1 commit into
base44:mainfrom
jackc625:fix/entity-name-underscores

Conversation

@jackc625

Copy link
Copy Markdown

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. Because readProjectConfig() eagerly validates every entity file, a single entity like "name": "line_items" aborts site deploy, functions deploy, functions pull, deploy, and dev — including commands that never touch entities. This relaxes the pattern to /^[a-zA-Z0-9_]+$/.

Why underscores specifically

  • The platform accepts and serves snake_case entity names (live production apps, addressable via base44.entities.line_items)
  • Type generation already anticipates them: toPascalCase() splits on /[-_\s]+/ and EntityTypeRegistry emits quoted keys
  • Function automations and agent tool configs already reference entities via unrestricted entity_name fields — such entities just couldn't be defined
  • Sibling rules allow them: plugin namespaces ([a-zA-Z0-9_-]), connector custom types ([a-z0-9_-]/i)
  • Dashes/dots/spaces are still rejected — no evidence the platform accepts those. Happy to adjust the character set if the backend rule differs.

Testing

  • New unit spec tests/core/entity-schema.spec.ts covering accepted/rejected names
  • New fixture with-snake-case-entities + integration tests: readProjectConfig() loads a line_items entity, and entities push succeeds end-to-end against the mock API
  • bun run test, bun run typecheck, and Biome all pass on changed files

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

site deploy (and all deploy commands) blocked by entity-name validation for snake_case names the platform accepts

1 participant