fix: add map format support to CLI commands and fix docs field syntax#684
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- lint.ts: normalize config before linting - doctor.ts: normalize config before health checks - validate.ts: normalize config before schema validation - compile.ts: normalize config before compilation - info.ts: normalize config before displaying info - format.ts: make collectMetadataStats handle both formats - core-concepts.mdx: fix fields to use map format in Array tab - common-patterns.mdx: fix fields to use map format in all examples Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
- Simplify count() redundant Array.isArray check - Improve normalization comments in validate.ts and compile.ts Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Assess support for new map syntax in all kernel packages
fix: add map format support to CLI commands and fix docs field syntax
Feb 15, 2026
hotlong
approved these changes
Feb 15, 2026
hotlong
marked this pull request as ready for review
February 15, 2026 02:15
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds map format support to CLI commands and fixes documentation examples where fields was incorrectly shown as an array instead of a map. The changes ensure all CLI tools (lint, doctor, validate, compile, info) correctly process both array and map-formatted metadata collections by calling normalizeStackInput() before processing raw configs.
Changes:
- CLI commands now normalize stack input before validation/processing to support map-formatted metadata
- Documentation examples corrected to show
fieldsas map format (Record) not array format collectMetadataStatshelper made defensive to handle both array and map formats
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/utils/format.ts | Enhanced count helper and field counting logic to handle both array and map formats defensively |
| packages/cli/src/commands/validate.ts | Added normalizeStackInput() call before schema validation |
| packages/cli/src/commands/lint.ts | Added normalizeStackInput() call before linting |
| packages/cli/src/commands/info.ts | Added normalizeStackInput() call before collecting stats |
| packages/cli/src/commands/doctor.ts | Added normalizeStackInput() call before running diagnostic checks |
| packages/cli/src/commands/compile.ts | Added normalizeStackInput() call before validation and compilation |
| content/docs/guides/common-patterns.mdx | Fixed CRUD, master-detail, approval, field-level security, and summary examples to show fields as map format |
| content/docs/getting-started/core-concepts.mdx | Fixed first defineStack() example to show fields as map format in both Array and Map tabs |
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.
CLI commands (
lint,doctor,validate,compile,info) usedArray.isArray()on raw config input, silently skipping map-formatted metadata collections. Documentation examples incorrectly showedfieldsas arrays when ObjectSchema definesfieldsasz.record()(map-only).CLI: normalize before processing
All commands that consume raw user configs now call
normalizeStackInput()before processing:normalizeStackInput()beforesafeParse()so map configs pass validationcollectMetadataStats()count helper handles both formats defensivelyDocs:
fieldsmust always be map formatFixed all "Array Format" tab examples where
fieldswas incorrectly shown asfields: [{ name: 'x', ... }]. PerObjectSchema,fieldsisz.record()— only the top-level collection (objects,apps, etc.) varies between array/map:Files:
core-concepts.mdx,common-patterns.mdx(CRUD, master-detail, approval, field-level security, summary)Audit: packages with correct support (no changes)
core,client,rest,runtime,objectql(explicit dual-format handling inregisterPlugin),metadata,studio— all already handle map format correctly or don't consume raw stack configs.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.