-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: Switch to schema creator pattern #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Switch to schema creator pattern #578
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
WalkthroughThis update introduces a major refactor of schema definitions and type inference across the codebase. Static Zod schemas are replaced with context-aware factory functions wrapped by Changes
Sequence Diagram(s)sequenceDiagram
participant Component
participant useDefinitionSchema
participant ProjectContext
participant SchemaFactory
Component->>useDefinitionSchema: Call with SchemaFactory
useDefinitionSchema->>ProjectContext: Get definitionSchemaCreatorOptions
useDefinitionSchema->>SchemaFactory: Call with options/context
SchemaFactory-->>useDefinitionSchema: Returns Zod schema
useDefinitionSchema-->>Component: Returns memoized schema
Component->>Component: Use schema for validation, forms, etc.
sequenceDiagram
participant Morpher
participant SourceFile
Morpher->>SourceFile: Parse for exported Zod schemas
Morpher->>SourceFile: Rename schema variables to createXSchema
Morpher->>SourceFile: Wrap schemas with definitionSchema
Morpher->>SourceFile: Update type inference to def.InferOutput/Input
Morpher->>SourceFile: Update imports for definitionSchema and def
Morpher-->>SourceFile: Output transformed source
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 10
🧹 Nitpick comments (7)
.husky/post-checkout (2)
10-10: Remove debug echo statement.The echo statement appears to be leftover from debugging and should be removed for cleaner output.
- echo $gitDir
9-11: Consider more robust path resolution.The current path resolution logic assumes a specific Git worktree directory structure that might be fragile. Consider using a more direct approach to find the main repository.
- gitDir="$(git rev-parse --git-dir)" # e.g., ../.git/worktrees/my-worktree - echo $gitDir - baseRepoPath="$(cd "$gitDir/../../.." && git rev-parse --show-toplevel)" # main repo root + # More robust way to find the main repo root + baseRepoPath="$(git rev-parse --git-common-dir | xargs dirname)"This approach uses
--git-common-dirwhich directly points to the shared Git directory, making it more reliable across different worktree configurations.packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
9-17: Consider removing unnecessary type assertion.The hook implementation is well-structured with proper memoization, but the type assertion
as def.InferSchema<T>on line 16 appears unnecessary sinceuseMemoshould already infer the correct return type from the schema creator function.Consider this refactor:
return useMemo( () => schemaCreator(definitionSchemaCreatorOptions), [definitionSchemaCreatorOptions, schemaCreator], - ) as def.InferSchema<T>; + );packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/output.ts (1)
3-5: Fix import sorting order.The imports should be sorted according to the coding guidelines: external libraries first, then local imports. Also ensure proper spacing between import groups.
-import type { def } from '#src/schema/creator/index.js'; -import { definitionSchema } from '#src/schema/creator/schema-creator.js'; -import { z } from 'zod'; +import { z } from 'zod'; + +import type { def } from '#src/schema/creator/index.js'; +import { definitionSchema } from '#src/schema/creator/schema-creator.js';packages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/output.ts (1)
3-5: Fix import sorting order.The imports should follow the coding guidelines: external libraries first, then local imports with proper spacing.
-import type { def } from '#src/schema/creator/index.js'; -import { definitionSchema } from '#src/schema/creator/schema-creator.js'; -import { z } from 'zod'; +import { z } from 'zod'; + +import type { def } from '#src/schema/creator/index.js'; +import { definitionSchema } from '#src/schema/creator/schema-creator.js';packages/code-morph/src/morphers/definition-schema-wrapper.morpher.ts (1)
26-26: Consider preserving the original casing pattern.The current transformation always capitalizes only the first character after "create", which could lead to inconsistent naming. For example:
APISchema→createAPISchema(loses the casing)apiSchema→createApiSchemaConsider using:
-const newName = `create${name.charAt(0).toUpperCase()}${name.slice(1)}`; +const newName = `create${name.charAt(0).toUpperCase()}${name.slice(1, -6)}Schema`;This preserves the original casing pattern of the schema name.
packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/built-in-input.ts (1)
20-31: Consider adding context parameter for consistency.All schema factory functions in this file are created without the context parameter
(ctx), while other files in the PR consistently usedefinitionSchema((ctx) => ...). Even though these schemas don't currently need context, consider adding it for consistency and future compatibility.Update all factory functions to include the context parameter:
-export const createAdminCrudTextInputSchema = definitionSchema(() => +export const createAdminCrudTextInputSchema = definitionSchema((ctx) => z.object({Apply similar changes to all other schema factory functions in this file.
Also applies to: 42-56, 67-77, 88-103, 114-129, 140-145
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (62)
.husky/post-checkout(1 hunks).vscode/tasks.json(1 hunks)packages/code-morph/src/morphers/definition-schema-wrapper.morpher.ts(1 hunks)packages/code-morph/src/morphers/definition-schema-wrapper.morpher.unit.test.ts(1 hunks)packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/input.ts(1 hunks)packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/output.ts(1 hunks)packages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/input.ts(1 hunks)packages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/output.ts(1 hunks)packages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/input.ts(1 hunks)packages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/output.ts(1 hunks)packages/project-builder-lib/src/definition/project-definition-container.ts(2 hunks)packages/project-builder-lib/src/plugins/spec/config-spec.ts(2 hunks)packages/project-builder-lib/src/schema/apps/admin/app.ts(1 hunks)packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-crud-input.ts(1 hunks)packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-input-spec.ts(2 hunks)packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/built-in-input.ts(2 hunks)packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/types.ts(2 hunks)packages/project-builder-lib/src/schema/apps/admin/sections/crud.ts(1 hunks)packages/project-builder-lib/src/schema/apps/backend/index.ts(1 hunks)packages/project-builder-lib/src/schema/apps/web/index.ts(1 hunks)packages/project-builder-lib/src/schema/creator/index.ts(1 hunks)packages/project-builder-lib/src/schema/creator/infer-types.ts(1 hunks)packages/project-builder-lib/src/schema/creator/types.ts(1 hunks)packages/project-builder-lib/src/schema/features/feature.ts(1 hunks)packages/project-builder-lib/src/schema/features/theme.ts(2 hunks)packages/project-builder-lib/src/schema/models/enums.ts(1 hunks)packages/project-builder-lib/src/schema/models/graphql.ts(2 hunks)packages/project-builder-lib/src/schema/models/index.ts(3 hunks)packages/project-builder-lib/src/schema/models/transformers/built-in-transformers.ts(2 hunks)packages/project-builder-lib/src/schema/models/transformers/model-transformer-spec.ts(2 hunks)packages/project-builder-lib/src/schema/models/transformers/transformers.ts(1 hunks)packages/project-builder-lib/src/schema/models/transformers/types.ts(2 hunks)packages/project-builder-lib/src/schema/plugins/definition.ts(1 hunks)packages/project-builder-lib/src/schema/project-definition.ts(1 hunks)packages/project-builder-lib/src/schema/settings.ts(1 hunks)packages/project-builder-lib/src/schema/template-extractor/index.ts(1 hunks)packages/project-builder-lib/src/web/hooks/use-project-definition.ts(2 hunks)packages/project-builder-web/src/app/project-definition-provider/new-project-card.tsx(3 hunks)packages/project-builder-web/src/app/project-definition-provider/project-definition-provider.tsx(2 hunks)packages/project-builder-web/src/hooks/use-definition-schema.ts(1 hunks)packages/project-builder-web/src/pages/apps/edit/admin/admin-edit-section-form.tsx(3 hunks)packages/project-builder-web/src/pages/apps/edit/admin/admin-general-form.tsx(3 hunks)packages/project-builder-web/src/pages/apps/edit/admin/crud/admin-crud-embedded-form.tsx(3 hunks)packages/project-builder-web/src/pages/apps/edit/backend-app-form.tsx(3 hunks)packages/project-builder-web/src/pages/apps/edit/web-app-form.tsx(3 hunks)packages/project-builder-web/src/pages/data/enums/edit/edit.page.tsx(1 hunks)packages/project-builder-web/src/pages/data/enums/hooks/use-enum-form.tsx(3 hunks)packages/project-builder-web/src/pages/data/models/_hooks/use-model-form.ts(3 hunks)packages/project-builder-web/src/pages/data/models/edit/[id]/_components/fields/relations/model-relation-form.tsx(3 hunks)packages/project-builder-web/src/pages/data/models/edit/[id]/_components/service/service-transformer-form.tsx(3 hunks)packages/project-builder-web/src/pages/data/models/edit/[id]/graphql.page.tsx(1 hunks)packages/project-builder-web/src/pages/data/models/edit/[id]/index.page.tsx(3 hunks)packages/project-builder-web/src/pages/data/models/edit/[id]/service.page.tsx(3 hunks)packages/project-builder-web/src/pages/settings/project-settings.tsx(2 hunks)packages/project-builder-web/src/pages/settings/template-extractor.tsx(3 hunks)packages/project-builder-web/src/pages/settings/theme-builder.tsx(2 hunks)packages/project-builder-web/tsconfig.app.json(1 hunks)packages/ui-components/src/stories/Typography.mdx(1 hunks)plugins/plugin-storage/src/storage/admin-crud/types.ts(1 hunks)plugins/plugin-storage/src/storage/transformers/common.ts(2 hunks)plugins/plugin-storage/src/storage/transformers/types.ts(1 hunks)turbo.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (10)
`**/*.unit.test.ts`: Unit tests must use the '.unit.test.ts' suffix and be colocated with their implementation files.
**/*.unit.test.ts: Unit tests must use the '.unit.test.ts' suffix and be colocated with their implementation files.
packages/code-morph/src/morphers/definition-schema-wrapper.morpher.unit.test.ts
`**/*.{ts,tsx,js,jsx}`: Always use kebab-case for file names. Always use '.js' extensions in import statements, even for TypeScript files. Order functions such that functions are p...
**/*.{ts,tsx,js,jsx}: Always use kebab-case for file names.
Always use '.js' extensions in import statements, even for TypeScript files.
Order functions such that functions are placed below the variables/functions they use.
Sort imports by group: external libraries first, then local imports.
Use camelCase for variables and functions, PascalCase for types and classes.
Prefer barrel exports (e.g., export * from './foo.js') instead of individual named exports.
Colocate tests with implementation files.
Include absolute paths in import statements via tsconfig paths (use '@src/' as the alias for 'src/').
Node 16 module resolution: always include file extensions in imports ('.js').
packages/code-morph/src/morphers/definition-schema-wrapper.morpher.unit.test.tspackages/project-builder-web/src/pages/apps/edit/admin/admin-edit-section-form.tsxpackages/project-builder-lib/src/web/hooks/use-project-definition.tspackages/project-builder-web/src/app/project-definition-provider/project-definition-provider.tsxpackages/project-builder-web/src/app/project-definition-provider/new-project-card.tsxpackages/project-builder-web/src/pages/data/models/_hooks/use-model-form.tspackages/project-builder-web/src/hooks/use-definition-schema.tspackages/project-builder-web/src/pages/apps/edit/admin/crud/admin-crud-embedded-form.tsxpackages/project-builder-web/src/pages/data/models/edit/[id]/_components/service/service-transformer-form.tsxpackages/project-builder-web/src/pages/data/enums/hooks/use-enum-form.tsxpackages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-input-spec.tsplugins/plugin-storage/src/storage/transformers/common.tspackages/project-builder-lib/src/schema/models/transformers/transformers.tsplugins/plugin-storage/src/storage/admin-crud/types.tspackages/project-builder-web/src/pages/data/models/edit/[id]/index.page.tsxpackages/project-builder-web/src/pages/data/enums/edit/edit.page.tsxpackages/project-builder-web/src/pages/settings/theme-builder.tsxpackages/project-builder-web/src/pages/apps/edit/admin/admin-general-form.tsxpackages/project-builder-web/src/pages/apps/edit/backend-app-form.tsxpackages/project-builder-web/src/pages/data/models/edit/[id]/_components/fields/relations/model-relation-form.tsxpackages/project-builder-web/src/pages/settings/template-extractor.tsxpackages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/input.tspackages/project-builder-web/src/pages/apps/edit/web-app-form.tsxpackages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-crud-input.tsplugins/plugin-storage/src/storage/transformers/types.tspackages/project-builder-lib/src/schema/models/transformers/model-transformer-spec.tspackages/project-builder-lib/src/definition/project-definition-container.tspackages/project-builder-lib/src/schema/apps/admin/sections/crud-form/types.tspackages/project-builder-web/src/pages/settings/project-settings.tsxpackages/project-builder-lib/src/schema/creator/infer-types.tspackages/project-builder-lib/src/schema/creator/index.tspackages/project-builder-web/src/pages/data/models/edit/[id]/graphql.page.tsxpackages/project-builder-web/src/pages/data/models/edit/[id]/service.page.tsxpackages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/output.tspackages/project-builder-lib/src/schema/creator/types.tspackages/project-builder-lib/src/schema/template-extractor/index.tspackages/project-builder-lib/src/schema/features/theme.tspackages/project-builder-lib/src/schema/models/transformers/types.tspackages/project-builder-lib/src/schema/apps/backend/index.tspackages/project-builder-lib/src/schema/features/feature.tspackages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/output.tspackages/code-morph/src/morphers/definition-schema-wrapper.morpher.tspackages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/input.tspackages/project-builder-lib/src/schema/apps/web/index.tspackages/project-builder-lib/src/schema/plugins/definition.tspackages/project-builder-lib/src/schema/settings.tspackages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/output.tspackages/project-builder-lib/src/plugins/spec/config-spec.tspackages/project-builder-lib/src/schema/apps/admin/app.tspackages/project-builder-lib/src/schema/models/transformers/built-in-transformers.tspackages/project-builder-lib/src/schema/models/enums.tspackages/project-builder-lib/src/schema/project-definition.tspackages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/input.tspackages/project-builder-lib/src/schema/apps/admin/sections/crud-form/built-in-input.tspackages/project-builder-lib/src/schema/models/graphql.tspackages/project-builder-lib/src/schema/models/index.tspackages/project-builder-lib/src/schema/apps/admin/sections/crud.ts
`**/*.{ts,tsx}`: Always include explicit return types on all top-level functions, including React components. If a particular interface or type is not exported, change the file so ...
**/*.{ts,tsx}: Always include explicit return types on all top-level functions, including React components.
If a particular interface or type is not exported, change the file so it is exported.
packages/code-morph/src/morphers/definition-schema-wrapper.morpher.unit.test.tspackages/project-builder-web/src/pages/apps/edit/admin/admin-edit-section-form.tsxpackages/project-builder-lib/src/web/hooks/use-project-definition.tspackages/project-builder-web/src/app/project-definition-provider/project-definition-provider.tsxpackages/project-builder-web/src/app/project-definition-provider/new-project-card.tsxpackages/project-builder-web/src/pages/data/models/_hooks/use-model-form.tspackages/project-builder-web/src/hooks/use-definition-schema.tspackages/project-builder-web/src/pages/apps/edit/admin/crud/admin-crud-embedded-form.tsxpackages/project-builder-web/src/pages/data/models/edit/[id]/_components/service/service-transformer-form.tsxpackages/project-builder-web/src/pages/data/enums/hooks/use-enum-form.tsxpackages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-input-spec.tsplugins/plugin-storage/src/storage/transformers/common.tspackages/project-builder-lib/src/schema/models/transformers/transformers.tsplugins/plugin-storage/src/storage/admin-crud/types.tspackages/project-builder-web/src/pages/data/models/edit/[id]/index.page.tsxpackages/project-builder-web/src/pages/data/enums/edit/edit.page.tsxpackages/project-builder-web/src/pages/settings/theme-builder.tsxpackages/project-builder-web/src/pages/apps/edit/admin/admin-general-form.tsxpackages/project-builder-web/src/pages/apps/edit/backend-app-form.tsxpackages/project-builder-web/src/pages/data/models/edit/[id]/_components/fields/relations/model-relation-form.tsxpackages/project-builder-web/src/pages/settings/template-extractor.tsxpackages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/input.tspackages/project-builder-web/src/pages/apps/edit/web-app-form.tsxpackages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-crud-input.tsplugins/plugin-storage/src/storage/transformers/types.tspackages/project-builder-lib/src/schema/models/transformers/model-transformer-spec.tspackages/project-builder-lib/src/definition/project-definition-container.tspackages/project-builder-lib/src/schema/apps/admin/sections/crud-form/types.tspackages/project-builder-web/src/pages/settings/project-settings.tsxpackages/project-builder-lib/src/schema/creator/infer-types.tspackages/project-builder-lib/src/schema/creator/index.tspackages/project-builder-web/src/pages/data/models/edit/[id]/graphql.page.tsxpackages/project-builder-web/src/pages/data/models/edit/[id]/service.page.tsxpackages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/output.tspackages/project-builder-lib/src/schema/creator/types.tspackages/project-builder-lib/src/schema/template-extractor/index.tspackages/project-builder-lib/src/schema/features/theme.tspackages/project-builder-lib/src/schema/models/transformers/types.tspackages/project-builder-lib/src/schema/apps/backend/index.tspackages/project-builder-lib/src/schema/features/feature.tspackages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/output.tspackages/code-morph/src/morphers/definition-schema-wrapper.morpher.tspackages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/input.tspackages/project-builder-lib/src/schema/apps/web/index.tspackages/project-builder-lib/src/schema/plugins/definition.tspackages/project-builder-lib/src/schema/settings.tspackages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/output.tspackages/project-builder-lib/src/plugins/spec/config-spec.tspackages/project-builder-lib/src/schema/apps/admin/app.tspackages/project-builder-lib/src/schema/models/transformers/built-in-transformers.tspackages/project-builder-lib/src/schema/models/enums.tspackages/project-builder-lib/src/schema/project-definition.tspackages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/input.tspackages/project-builder-lib/src/schema/apps/admin/sections/crud-form/built-in-input.tspackages/project-builder-lib/src/schema/models/graphql.tspackages/project-builder-lib/src/schema/models/index.tspackages/project-builder-lib/src/schema/apps/admin/sections/crud.ts
`**/*.test.{ts,tsx,js,jsx}`: Always import vitest globals explicitly (describe, it, expect); do not rely on global availability.
**/*.test.{ts,tsx,js,jsx}: Always import vitest globals explicitly (describe, it, expect); do not rely on global availability.
packages/code-morph/src/morphers/definition-schema-wrapper.morpher.unit.test.ts
`**/*.unit.test.ts`: Unit tests must use the `.unit.test.ts` suffix.
**/*.unit.test.ts: Unit tests must use the.unit.test.tssuffix.
packages/code-morph/src/morphers/definition-schema-wrapper.morpher.unit.test.ts
`**/*.test.ts`: Always import vitest globals (describe, it, expect) explicitly in test files.
**/*.test.ts: Always import vitest globals (describe, it, expect) explicitly in test files.
packages/code-morph/src/morphers/definition-schema-wrapper.morpher.unit.test.ts
`**/*.unit.test.ts`: Unit tests should be colocated with source files and use the `.unit.test.ts` suffix.
**/*.unit.test.ts: Unit tests should be colocated with source files and use the.unit.test.tssuffix.
packages/code-morph/src/morphers/definition-schema-wrapper.morpher.unit.test.ts
`plugins/*/**/*.{js,jsx,ts,tsx}`: All CSS classes used in className attributes within plugin components must be prefixed with the plugin name to avoid style conflicts.
plugins/*/**/*.{js,jsx,ts,tsx}: All CSS classes used in className attributes within plugin components must be prefixed with the plugin name to avoid style conflicts.
plugins/plugin-storage/src/storage/transformers/common.tsplugins/plugin-storage/src/storage/admin-crud/types.tsplugins/plugin-storage/src/storage/transformers/types.ts
`packages/ui-components/**`: Use ShadCN-based components from '@baseplate-dev/ui-components' for UI development; always prefer these over custom components.
packages/ui-components/**: Use ShadCN-based components from '@baseplate-dev/ui-components' for UI development; always prefer these over custom components.
packages/ui-components/src/stories/Typography.mdx
`packages/ui-components/**`: UI components should be implemented as rough analogs of ShadCN components and can be imported from @baseplate-dev/ui-components.
packages/ui-components/**: UI components should be implemented as rough analogs of ShadCN components and can be imported from @baseplate-dev/ui-components.
packages/ui-components/src/stories/Typography.mdx
🧬 Code Graph Analysis (40)
packages/code-morph/src/morphers/definition-schema-wrapper.morpher.unit.test.ts (1)
packages/code-morph/src/morphers/tests/morpher.test-helper.ts (1)
runMorpherTests(55-112)
packages/project-builder-lib/src/web/hooks/use-project-definition.ts (1)
packages/project-builder-lib/src/schema/creator/types.ts (1)
DefinitionSchemaCreatorOptions(5-7)
packages/project-builder-web/src/app/project-definition-provider/project-definition-provider.tsx (1)
packages/project-builder-lib/src/parser/parser.ts (1)
createPluginImplementationStore(40-86)
packages/project-builder-web/src/app/project-definition-provider/new-project-card.tsx (2)
packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/settings.ts (1)
createGeneralSettingsSchema(11-36)
packages/project-builder-web/src/pages/data/models/_hooks/use-model-form.ts (2)
packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/models/index.ts (1)
createModelSchema(310-315)
packages/project-builder-web/src/hooks/use-definition-schema.ts (3)
packages/project-builder-lib/src/schema/creator/types.ts (1)
DefinitionSchemaCreator(13-15)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferSchema(5-5)packages/project-builder-lib/src/web/hooks/use-project-definition.ts (1)
useProjectDefinition(80-88)
packages/project-builder-web/src/pages/apps/edit/admin/crud/admin-crud-embedded-form.tsx (2)
packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/apps/admin/sections/crud.ts (1)
createAdminCrudEmbeddedFormSchema(109-123)
packages/project-builder-web/src/pages/data/models/edit/[id]/_components/service/service-transformer-form.tsx (2)
packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/models/transformers/transformers.ts (1)
createTransformerSchema(7-17)
packages/project-builder-web/src/pages/data/enums/hooks/use-enum-form.tsx (3)
packages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/input.ts (1)
enumSchema(12-16)packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/models/enums.ts (1)
createEnumBaseSchema(26-36)
packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-input-spec.ts (1)
packages/project-builder-lib/src/schema/creator/types.ts (1)
DefinitionSchemaCreator(13-15)
plugins/plugin-storage/src/storage/transformers/common.ts (1)
plugins/plugin-storage/src/storage/transformers/types.ts (1)
createFileTransformerSchema(14-35)
plugins/plugin-storage/src/storage/admin-crud/types.ts (4)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/references/ref-builder.ts (1)
zRef(709-719)packages/project-builder-lib/src/schema/models/types.ts (1)
modelTransformerEntityType(27-30)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferInput(7-9)
packages/project-builder-web/src/pages/data/enums/edit/edit.page.tsx (2)
packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/models/enums.ts (1)
createEnumBaseSchema(26-36)
packages/project-builder-web/src/pages/settings/theme-builder.tsx (3)
packages/project-builder-lib/src/web/hooks/use-project-definition.ts (1)
useProjectDefinition(80-88)packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/features/theme.ts (1)
createThemeSchema(48-59)
packages/project-builder-web/src/pages/apps/edit/admin/admin-general-form.tsx (3)
packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/apps/admin/app.ts (1)
createAdminAppSchema(32-46)packages/project-builder-lib/src/plugins/schema/parser.ts (1)
zPluginWrapper(67-72)
packages/project-builder-web/src/pages/data/models/edit/[id]/_components/fields/relations/model-relation-form.tsx (2)
packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/models/index.ts (1)
createModelRelationFieldSchema(123-169)
packages/project-builder-web/src/pages/settings/template-extractor.tsx (2)
packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/template-extractor/index.ts (1)
createTemplateExtractorSchema(7-24)
packages/project-builder-web/src/pages/apps/edit/web-app-form.tsx (2)
packages/project-builder-web/src/hooks/use-definition-schema.ts (1)
useDefinitionSchema(9-17)packages/project-builder-lib/src/schema/apps/web/index.ts (1)
createWebAppSchema(12-30)
packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-crud-input.ts (3)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/types.ts (1)
baseAdminCrudInputSchema(9-12)packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-input-spec.ts (1)
adminCrudInputSpec(51-53)
plugins/plugin-storage/src/storage/transformers/types.ts (5)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/references/ref-builder.ts (3)
zEnt(732-755)zRef(709-719)createDefinitionEntityNameResolver(74-80)packages/project-builder-lib/src/schema/models/transformers/types.ts (1)
baseTransformerFields(7-9)packages/project-builder-lib/src/schema/models/types.ts (2)
modelLocalRelationEntityType(12-15)modelTransformerEntityType(27-30)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferInput(7-9)
packages/project-builder-lib/src/schema/models/transformers/model-transformer-spec.ts (1)
packages/project-builder-lib/src/schema/creator/types.ts (1)
DefinitionSchemaCreator(13-15)
packages/project-builder-lib/src/definition/project-definition-container.ts (2)
packages/project-builder-lib/src/references/fix-ref-deletions.ts (1)
FixRefDeletionResult(30-32)packages/project-builder-lib/src/schema/project-definition.ts (1)
ProjectDefinitionSchema(58-60)
packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/types.ts (1)
packages/project-builder-lib/src/schema/creator/types.ts (1)
DefinitionSchemaCreator(13-15)
packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
packages/project-builder-lib/src/schema/creator/types.ts (1)
DefinitionSchemaCreator(13-15)
packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/output.ts (3)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/input.ts (5)
UserRole(19-19)UserConfig(20-20)UserConfigInput(21-21)ProjectConfig(22-22)ProjectConfigInput(23-23)packages/project-builder-lib/src/schema/creator/infer-types.ts (2)
InferOutput(11-13)InferInput(7-9)
packages/project-builder-lib/src/schema/template-extractor/index.ts (2)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferOutput(11-13)
packages/project-builder-lib/src/schema/features/theme.ts (2)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferOutput(11-13)
packages/project-builder-lib/src/schema/apps/backend/index.ts (3)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/schema/apps/base.ts (1)
baseAppValidators(6-19)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferOutput(11-13)
packages/project-builder-lib/src/schema/features/feature.ts (4)
packages/utils/src/validators/case-validators.ts (1)
CASE_VALIDATORS(23-48)packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/references/ref-builder.ts (2)
zEnt(732-755)zRef(709-719)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferOutput(11-13)
packages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/output.ts (2)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferOutput(11-13)
packages/project-builder-lib/src/schema/apps/web/index.ts (5)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/schema/apps/base.ts (1)
baseAppValidators(6-19)packages/project-builder-lib/src/references/ref-builder.ts (1)
zRef(709-719)packages/project-builder-lib/src/schema/auth/index.ts (1)
authRoleEntityType(3-3)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferOutput(11-13)
packages/project-builder-lib/src/schema/plugins/definition.ts (4)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/schema/plugins/entity-types.ts (1)
pluginEntityType(3-3)packages/project-builder-lib/src/plugins/spec/config-spec.ts (1)
pluginConfigSpec(89-91)packages/project-builder-lib/src/references/ref-builder.ts (1)
zEnt(732-755)
packages/project-builder-lib/src/schema/settings.ts (5)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/utils/src/validators/case-validators.ts (1)
CASE_VALIDATORS(23-48)packages/project-builder-lib/src/schema/creator/infer-types.ts (2)
InferInput(7-9)InferOutput(11-13)packages/project-builder-lib/src/schema/template-extractor/index.ts (1)
createTemplateExtractorSchema(7-24)packages/project-builder-lib/src/schema/features/theme.ts (1)
createThemeSchema(48-59)
packages/project-builder-lib/src/schema/models/transformers/built-in-transformers.ts (5)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/references/ref-builder.ts (3)
zEnt(732-755)zRef(709-719)createDefinitionEntityNameResolver(74-80)packages/project-builder-lib/src/schema/models/transformers/types.ts (2)
baseTransformerFields(7-9)createModelTransformerType(27-31)packages/project-builder-lib/src/schema/models/types.ts (4)
modelTransformerEntityType(27-30)modelForeignRelationEntityType(17-20)modelScalarFieldEntityType(5-10)modelEntityType(3-3)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferOutput(11-13)
packages/project-builder-lib/src/schema/project-definition.ts (12)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/references/ref-builder.ts (1)
zRefBuilder(696-701)packages/project-builder-lib/src/schema/apps/backend/index.ts (1)
createBackendAppSchema(10-21)packages/project-builder-lib/src/schema/apps/web/index.ts (1)
createWebAppSchema(12-30)packages/project-builder-lib/src/schema/apps/admin/app.ts (1)
createAdminAppSchema(32-46)packages/project-builder-lib/src/schema/apps/types.ts (1)
appEntityType(3-3)packages/project-builder-lib/src/schema/creator/infer-types.ts (3)
InferOutput(11-13)InferInput(7-9)InferSchema(5-5)packages/project-builder-lib/src/schema/features/feature.ts (1)
createFeaturesSchema(40-42)packages/project-builder-lib/src/schema/models/index.ts (1)
createModelSchema(310-315)packages/project-builder-lib/src/schema/models/enums.ts (1)
createEnumSchema(38-43)packages/project-builder-lib/src/schema/plugins/definition.ts (1)
createPluginsSchema(46-48)packages/project-builder-lib/src/schema/settings.ts (1)
createSettingsSchema(46-52)
packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/input.ts (1)
packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/output.ts (5)
UserRole(27-27)UserConfig(28-28)UserConfigInput(29-29)ProjectConfig(30-30)ProjectConfigInput(31-31)
packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/built-in-input.ts (5)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/references/ref-builder.ts (1)
zRef(709-719)packages/project-builder-lib/src/schema/models/types.ts (3)
modelScalarFieldEntityType(5-10)modelLocalRelationEntityType(12-15)modelForeignRelationEntityType(17-20)packages/project-builder-lib/src/schema/creator/infer-types.ts (1)
InferOutput(11-13)packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/types.ts (2)
createAdminCrudInputType(23-27)adminCrudEmbeddedFormEntityType(29-34)
packages/project-builder-lib/src/schema/models/graphql.ts (4)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/references/ref-builder.ts (1)
zRef(709-719)packages/project-builder-lib/src/schema/models/types.ts (3)
modelScalarFieldEntityType(5-10)modelLocalRelationEntityType(12-15)modelForeignRelationEntityType(17-20)packages/project-builder-lib/src/schema/creator/infer-types.ts (2)
InferInput(7-9)InferOutput(11-13)
packages/project-builder-lib/src/schema/models/index.ts (8)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/references/ref-builder.ts (5)
zEnt(732-755)zRefBuilder(696-701)zRef(709-719)zRefId(26-26)createDefinitionEntityNameResolver(74-80)packages/project-builder-lib/src/schema/utils/validation.ts (1)
VALIDATORS(3-18)packages/project-builder-lib/src/schema/models/types.ts (8)
modelEnumEntityType(32-32)modelEnumValueEntityType(34-36)modelScalarFieldEntityType(5-10)modelForeignRelationEntityType(17-20)modelEntityType(3-3)modelLocalRelationEntityType(12-15)modelUniqueConstraintEntityType(22-25)modelTransformerEntityType(27-30)packages/project-builder-lib/src/schema/creator/infer-types.ts (2)
InferOutput(11-13)InferInput(7-9)packages/project-builder-lib/src/schema/models/transformers/transformers.ts (1)
createTransformerSchema(7-17)packages/project-builder-lib/src/schema/features/feature.ts (1)
featureEntityType(9-9)packages/project-builder-lib/src/schema/models/graphql.ts (1)
createModelGraphqlSchema(24-116)
packages/project-builder-lib/src/schema/apps/admin/sections/crud.ts (7)
packages/project-builder-lib/src/schema/creator/schema-creator.ts (1)
definitionSchema(8-12)packages/project-builder-lib/src/references/ref-builder.ts (2)
zRef(709-719)zRefBuilder(696-701)packages/project-builder-lib/src/schema/models/types.ts (3)
modelLocalRelationEntityType(12-15)modelScalarFieldEntityType(5-10)modelEntityType(3-3)packages/project-builder-lib/src/schema/creator/infer-types.ts (2)
InferOutput(11-13)InferInput(7-9)packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-crud-input.ts (1)
createAdminCrudInputSchema(7-17)packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/types.ts (1)
adminCrudEmbeddedFormEntityType(29-34)packages/project-builder-lib/src/schema/apps/admin/sections/base.ts (1)
baseAdminSectionValidators(8-17)
🪛 ESLint
packages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/input.ts
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/output.ts
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
[error] 4-4: Missed spacing between "#src/schema/creator/index.js" and "#src/schema/creator/schema-creator.js".
(perfectionist/sort-imports)
[error] 5-5: Expected "zod" (value-external) to come before "#src/schema/creator/schema-creator.js" (value-internal).
(perfectionist/sort-imports)
packages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/output.ts
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
[error] 4-4: Missed spacing between "#src/schema/creator/index.js" and "#src/schema/creator/schema-creator.js".
(perfectionist/sort-imports)
[error] 5-5: Expected "zod" (value-external) to come before "#src/schema/creator/schema-creator.js" (value-internal).
(perfectionist/sort-imports)
packages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/input.ts
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
packages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/output.ts
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
[error] 4-4: Missed spacing between "#src/schema/creator/index.js" and "#src/schema/creator/schema-creator.js".
(perfectionist/sort-imports)
[error] 5-5: Expected "zod" (value-external) to come before "#src/schema/creator/schema-creator.js" (value-internal).
(perfectionist/sort-imports)
packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/input.ts
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: test
- GitHub Check: Test E2E
- GitHub Check: Lint
🔇 Additional comments (122)
turbo.json (1)
37-39: Explicit inputs for thetypechecktask
Good addition—explicitly specifying["$TURBO_DEFAULT$"]ensures Turborepo will correctly track dependencies and cache type‐checking, aligning this task with the other cacheable pipelines.packages/ui-components/src/stories/Typography.mdx (1)
3-3: Switch story import to JavaScript file
The MDX story now importstypography.stories.jsinstead of the TSX version. Ensure the.jsfile exists alongside this MDX file and that Storybook picks up the new extension correctly..vscode/tasks.json (1)
35-52: LGTM! Well-configured VSCode task for watch mode.The new "Watch Build" task is properly configured with appropriate problem matching for TypeScript compiler output. The custom regex pattern correctly parses the expected "//:watch:tsc:root:" prefixed output format, capturing all necessary error details for inline IDE reporting.
packages/project-builder-web/tsconfig.app.json (1)
4-4: LGTM! Improved build artifact organization.Moving the TypeScript build info file to the
distdirectory aligns with theoutDirconfiguration and consolidates build artifacts in a single location.plugins/plugin-storage/src/storage/transformers/common.ts (2)
6-6: LGTM! Correct implementation of schema creator pattern.The import change from static schema to factory function aligns with the broader refactoring goals.
16-16: LGTM! Proper usage of schema factory function.Using the factory function directly as the schema property is the correct approach for the new pattern.
packages/code-morph/src/morphers/definition-schema-wrapper.morpher.unit.test.ts (1)
1-5: LGTM! Follows established testing patterns.The test file correctly uses the standard morpher test helper and follows the coding guidelines:
- Proper
.unit.test.tssuffix.jsextensions in imports- Delegates to the established
runMorpherTestshelperpackages/project-builder-web/src/pages/apps/edit/admin/admin-edit-section-form.tsx (3)
6-6: LGTM! Correct schema factory import.Import change from static schema to factory function aligns with the schema creator pattern migration.
27-27: LGTM! Proper hook import.Import of
useDefinitionSchemahook follows the established pattern for dynamic schema usage in React components.
61-61: LGTM! Correct usage of schema hook.Using
useDefinitionSchemawith the factory function provides the proper context-aware schema retrieval and memoization.packages/project-builder-web/src/pages/settings/template-extractor.tsx (3)
3-3: LGTM! Correct factory function import.Import change from static schema to factory function follows the established schema creator pattern.
24-24: LGTM! Proper hook import.Import of
useDefinitionSchemaenables dynamic schema retrieval in React components.
35-37: LGTM! Correct hook usage pattern.Using
useDefinitionSchemawith the factory function provides proper memoization and context-aware schema creation.packages/project-builder-web/src/pages/data/enums/hooks/use-enum-form.tsx (1)
9-9: LGTM: Schema creator pattern implementation is correct.The refactoring successfully replaces the static
enumSchemaimport with the dynamiccreateEnumBaseSchemafactory function anduseDefinitionSchemahook. This change enables context-aware schema creation while maintaining the same functionality.Also applies to: 25-25, 73-73
packages/project-builder-web/src/pages/apps/edit/admin/admin-general-form.tsx (2)
6-6: LGTM: Schema creator pattern implementation is correct.The refactoring successfully implements the dynamic schema creation pattern using
createAdminAppSchemaanduseDefinitionSchemahook.Also applies to: 23-23, 37-37
40-40: Good catch: Dependency array correctly updated.The
useMemodependency array has been properly updated to includeadminAppSchemasince it's now dynamically created and used within the memo. This ensures the memo updates when the schema changes.packages/project-builder-lib/src/web/hooks/use-project-definition.ts (1)
6-6: LGTM: Foundational property added for schema creator pattern.The addition of
definitionSchemaCreatorOptionsto theUseProjectDefinitionResultinterface provides the necessary foundation for context-aware schema creation. The property is properly typed and well-documented.Also applies to: 71-74
packages/project-builder-web/src/app/project-definition-provider/new-project-card.tsx (1)
7-7: LGTM: Consistent schema creator pattern implementation.The refactoring correctly replaces the static
generalSettingsSchemawith the dynamiccreateGeneralSettingsSchemafactory function anduseDefinitionSchemahook, maintaining consistency with the broader refactoring effort.Also applies to: 18-18, 30-32
packages/project-builder-web/src/pages/apps/edit/admin/crud/admin-crud-embedded-form.tsx (1)
6-6: LGTM: Schema creator pattern implementation is consistent.The refactoring correctly implements the dynamic schema creation pattern using
createAdminCrudEmbeddedFormSchemaanduseDefinitionSchemahook, maintaining consistency with the broader refactoring effort across the codebase.Also applies to: 32-32, 108-110
packages/project-builder-web/src/pages/apps/edit/backend-app-form.tsx (1)
4-4: LGTM! Schema creator pattern implemented correctly.The refactor successfully transitions from static schema import to the new schema creator pattern:
- Proper import of
createBackendAppSchemafactory function- Correct usage of
useDefinitionSchemahook with appropriate imports following coding guidelines- Maintains existing form functionality while enabling context-aware schema creation
Also applies to: 18-18, 29-29
packages/project-builder-web/src/pages/apps/edit/web-app-form.tsx (1)
6-6: LGTM! Consistent schema creator pattern implementation.The refactor correctly transitions the web app form to use the new schema creator pattern:
- Proper import of
createWebAppSchemafactory function- Correct
useDefinitionSchemahook usage with proper import paths- Maintains existing form validation logic while enabling dynamic schema creation
Also applies to: 22-22, 33-33
packages/project-builder-web/src/pages/data/enums/edit/edit.page.tsx (1)
3-3: LGTM! Schema creator pattern properly implemented with schema manipulation.The enum edit page correctly adopts the new schema creator pattern:
- Proper import of
createEnumBaseSchemafactory function- Correct
useDefinitionSchemahook usage following coding guidelines- Schema manipulation with
.omit()method works seamlessly with the new patternAlso applies to: 8-8, 15-17
packages/project-builder-web/src/pages/data/models/_hooks/use-model-form.ts (1)
9-9: LGTM! Schema creator pattern integrated with plugin enhancement.The model form hook successfully transitions to the schema creator pattern:
- Proper import of
createModelSchemafactory function- Correct
useDefinitionSchemahook usage with appropriate imports- Seamless integration with existing
usePluginEnhancedSchemafor plugin-based schema enhancement- Maintains complex model form logic while enabling dynamic schema creation
Also applies to: 26-26, 95-96
packages/project-builder-web/src/pages/settings/theme-builder.tsx (1)
5-5: LGTM! Schema creator pattern correctly implemented for theme validation.The theme builder page successfully adopts the new schema creator pattern:
- Proper import of
createThemeSchemafactory function- Correct
useDefinitionSchemahook usage with proper import paths following coding guidelines- Schema integrates seamlessly with existing form validation and theme generation logic
- Maintains complex theme building functionality while enabling context-aware schema creation
Also applies to: 35-35, 44-44
packages/project-builder-lib/src/schema/creator/index.ts (2)
1-1: LGTM! Clean namespace export for type inference utilities.The
defnamespace export provides a clean way to access type inference utilities (InferInput,InferOutput,InferSchema) used throughout the refactored codebase.
5-5: LGTM! Proper type export addition.Adding the type export from
types.jsappropriately extends the module's public API.packages/project-builder-web/src/app/project-definition-provider/project-definition-provider.tsx (2)
9-9: LGTM! Proper import addition for plugin store creation.The import of
createPluginImplementationStorealigns with the schema creator pattern refactoring.
155-160: LGTM! Proper implementation of schema creator options.The
definitionSchemaCreatorOptionscorrectly provides plugin context to schema creators throughout the application. The implementation properly uses the existingschemaParserContext.pluginStoreanddefinitionparameters as expected bycreatePluginImplementationStore.packages/project-builder-web/src/pages/data/models/edit/[id]/_components/service/service-transformer-form.tsx (3)
6-6: LGTM! Correct migration to schema creator function.The import change from static
transformerSchematocreateTransformerSchemaaligns with the schema creator pattern refactoring.
21-21: LGTM! Proper hook import for dynamic schema.The
useDefinitionSchemahook import is necessary for the schema creator pattern implementation.
41-41: LGTM! Correct implementation of dynamic schema creation.The change from static schema to
useDefinitionSchema(createTransformerSchema)properly implements the schema creator pattern with context-aware schema generation.packages/project-builder-web/src/pages/data/models/edit/[id]/_components/fields/relations/model-relation-form.tsx (3)
11-11: LGTM! Correct migration to schema creator function.The import change from static
modelRelationFieldSchematocreateModelRelationFieldSchemaaligns with the schema creator pattern refactoring.
35-35: LGTM! Proper hook import for dynamic schema.The
useDefinitionSchemahook import is necessary for the schema creator pattern implementation.
208-210: LGTM! Clean implementation of dynamic schema creation.The multi-line implementation of
useDefinitionSchema(createModelRelationFieldSchema)is clean and properly implements the schema creator pattern with context-aware schema generation.packages/project-builder-web/src/pages/settings/project-settings.tsx (4)
3-3: LGTM! Correct migration to schema creator function.The import change from static
generalSettingsSchematocreateGeneralSettingsSchemaaligns with the schema creator pattern refactoring.
20-20: LGTM! Proper hook import for dynamic schema.The
useDefinitionSchemahook import is necessary for the schema creator pattern implementation.
25-27: LGTM! Clean implementation of dynamic schema creation.The multi-line implementation of
useDefinitionSchema(createGeneralSettingsSchema)properly implements the schema creator pattern with context-aware schema generation.
22-22: Add explicit return type annotation.According to the coding guidelines, all top-level functions including React components should have explicit return types.
Apply this diff to add the explicit return type:
-function ProjectSettingsPage(): React.JSX.Element { +function ProjectSettingsPage(): React.JSX.Element {Wait, that's already correct. Let me check again... Actually, the function already has the explicit return type
React.JSX.Element. The coding guideline is satisfied.packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-input-spec.ts (2)
2-2: LGTM! Import aligns with schema creator pattern.The import of
DefinitionSchemaCreatorcorrectly uses the path alias and supports the new schema creation pattern.
14-14: Generic constraint update is consistent with refactoring.The change from
z.ZodTypeAnytoDefinitionSchemaCreatorproperly aligns with the schema creator pattern and maintains type safety.packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/admin-crud-input.ts (1)
7-17: Schema factory conversion implemented correctly.The transformation from static schema export to context-aware factory function using
definitionSchemais well-implemented. The function properly uses the context parameter and maintains the plugin-based schema retrieval logic.packages/project-builder-lib/src/schema/models/transformers/model-transformer-spec.ts (2)
2-2: Import change supports the schema creator pattern.The import of
DefinitionSchemaCreatoris consistent with the refactoring approach used across the codebase.
14-14: Type constraint updated consistently.The generic constraint change from
z.ZodTypeAnytoDefinitionSchemaCreatormaintains consistency with the schema creator pattern implementation.packages/project-builder-web/src/pages/data/models/edit/[id]/index.page.tsx (2)
4-4: Import changes align with schema creator pattern.The import updates correctly transition from static schema (
modelBaseSchema) to factory function (createModelBaseSchema) and include the newuseDefinitionSchemahook for dynamic schema usage.Also applies to: 13-13
33-35: Dynamic schema usage implemented correctly.The component now properly uses the
useDefinitionSchemahook to obtain the schema dynamically, maintaining the same functionality with.omit()while supporting the context-aware schema creation pattern.packages/project-builder-web/src/pages/data/models/edit/[id]/graphql.page.tsx (1)
3-3: LGTM! Schema creator pattern implemented correctly.The refactoring successfully transitions from static schema import to dynamic schema creation using the
useDefinitionSchemahook. The import changes and hook usage align with the schema creator pattern described in the PR objectives.Also applies to: 7-7, 16-21
plugins/plugin-storage/src/storage/admin-crud/types.ts (3)
1-1: LGTM! Proper imports for schema creator pattern.The addition of
deftype utilities anddefinitionSchemaimport correctly supports the new factory-based schema creation approach.Also applies to: 4-4
10-20: LGTM! Schema successfully converted to factory function.The schema is properly wrapped with
definitionSchemato create a context-aware factory function while preserving the original schema logic and structure.
22-24: LGTM! Type inference updated correctly.The type alias now uses
def.InferInputwhich is the appropriate utility for inferring input types from schema creator functions.packages/project-builder-lib/src/schema/models/transformers/transformers.ts (2)
2-2: LGTM! Proper import for schema creator pattern.The
definitionSchemaimport supports the new factory-based schema creation approach.
7-17: LGTM! Schema converted to context-aware factory function.The refactoring correctly:
- Wraps the schema creation in
definitionSchemawith context parameter- Passes context through to
transformer.schema(ctx)for dynamic schema creation- Maintains the existing
zWithPluginsstructure and logic- Follows the
createXSchemanaming conventionThis enables context-sensitive schema creation in preparation for zRef transition.
packages/project-builder-web/src/pages/data/models/edit/[id]/service.page.tsx (1)
4-4: LGTM! Schema creator pattern implemented correctly.The refactoring successfully transitions from static schema import to dynamic schema creation using the
useDefinitionSchemahook. The changes are consistent with the pattern applied across other components and maintain the existing schema manipulation logic.Also applies to: 19-19, 33-35
packages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/input.ts (2)
1-1: Verify if @ts-nocheck is necessary for this test case.The ESLint rule flags the use of
@ts-nocheckas it can mask compilation errors. Since this is a test input file for the morpher, please confirm if this directive is required for the test scenario or if it can be removed.If the directive is not needed for the test case, apply this diff:
-// @ts-nocheck -
5-15: LGTM! Test schemas are well-structured.The test input schemas correctly demonstrate:
- Basic schema definition with
baseSchema- Schema composition with
dependentSchemareferencingbaseSchema- Type inference using
z.inferThis provides a good foundation for testing the morpher's ability to transform static schemas into factory functions.
packages/project-builder-lib/src/schema/apps/backend/index.ts (3)
3-5: LGTM! Imports follow coding guidelines.The new imports for the schema creator pattern are correctly added with proper
.jsextensions as required by the coding guidelines.
10-21: Schema creator pattern correctly implemented.The static schema has been successfully converted to a factory function using
definitionSchema. The schema logic is preserved exactly with all backend-specific configuration options maintained.
23-23: Type inference correctly updated.The type inference has been properly updated from
z.infertodef.InferOutput, which is appropriate for extracting the output type from the schema creator function.packages/project-builder-lib/src/schema/features/theme.ts (3)
5-5: LGTM! Imports correctly added.The new imports for the schema creator pattern follow the coding guidelines with proper
.jsextensions.Also applies to: 9-9
48-59: Complex schema correctly refactored to factory pattern.The theme schema with its nested palettes and colors structure has been successfully wrapped in
definitionSchema. The complex object structure including base/primary palettes and light/dark color themes is preserved exactly.
61-61: Type inference appropriately updated.The
ThemeConfigtype now correctly usesdef.InferOutputto extract the type from the schema creator function.packages/project-builder-lib/src/schema/creator/types.ts (1)
13-15: Excellent ergonomic improvement with default generic parameter.Adding the default generic parameter
T = z.ZodTypeAnymakes theDefinitionSchemaCreatortype more convenient to use without requiring explicit type arguments in most cases, while maintaining full backward compatibility.plugins/plugin-storage/src/storage/transformers/types.ts (3)
1-2: LGTM! Imports correctly added for plugin context.The imports follow the coding guidelines and correctly reference the external package
@baseplate-dev/project-builder-lib.Also applies to: 6-6
14-35: Complex entity schema correctly refactored.The file transformer schema with its entity relationships (
zEnt,zRef) and cascade delete configuration has been successfully wrapped in thedefinitionSchemafactory function. The schema logic including the file relation reference and entity metadata is preserved exactly.
37-39: ```shell
#!/bin/bash
sed -n '1,200p' plugins/plugin-storage/src/storage/core/schema/plugin-definition.js</details> <details> <summary>packages/project-builder-lib/src/schema/creator/infer-types.ts (1)</summary> `1-13`: **Excellent utility types for schema creator pattern.** This module provides clean, well-designed utility types that enable type-safe inference from schema creator functions: - `InferSchema<T>` extracts the actual Zod schema returned by the creator - `InferInput<T>` and `InferOutput<T>` properly apply Zod's type inference to handle input/output type differences - All types are appropriately constrained to `DefinitionSchemaCreator` - Import follows coding guidelines with `.js` extension These utilities form the foundation for type-safe usage of the schema creator pattern across the codebase. </details> <details> <summary>packages/project-builder-lib/src/schema/apps/admin/sections/crud-form/types.ts (3)</summary> `3-3`: **LGTM: Import aligns with schema creator pattern.** The import of `DefinitionSchemaCreator` type supports the refactoring to the schema creator pattern. --- `16-21`: **LGTM: Generic constraint updated correctly.** The constraint change from `z.ZodTypeAny` to `DefinitionSchemaCreator` properly narrows the type to align with the new schema creator pattern, ensuring type safety. --- `23-27`: **LGTM: Function signature updated consistently.** The generic constraint change maintains consistency with the interface definition and supports the schema creator pattern refactoring. </details> <details> <summary>packages/project-builder-lib/src/definition/project-definition-container.ts (2)</summary> `14-14`: **LGTM: Import simplified appropriately.** The direct import of `ProjectDefinitionSchema` type simplifies the code while maintaining the same semantic meaning as the previous complex type inference. --- `92-92`: **LGTM: Return type simplified correctly.** The simplified return type `FixRefDeletionResult<ProjectDefinitionSchema>` is cleaner and equivalent to the previous complex inference pattern. </details> <details> <summary>packages/project-builder-lib/src/schema/template-extractor/index.ts (3)</summary> `3-5`: **LGTM: Imports added for schema creator pattern.** The imports correctly support the new schema creator pattern with `definitionSchema` function and `def` type utilities. --- `7-24`: **LGTM: Schema converted to factory function pattern.** The conversion from static schema to `definitionSchema`-wrapped factory function follows the established pattern correctly while preserving all validation logic and defaults. --- `26-28`: **LGTM: Type inference updated appropriately.** The type definition correctly uses `def.InferOutput` instead of `z.infer`, aligning with the new schema creator pattern. </details> <details> <summary>packages/project-builder-lib/src/schema/apps/web/index.ts (3)</summary> `3-7`: **LGTM: Imports properly ordered and support schema creator pattern.** The imports correctly support the new pattern, though consider adjusting the import order to match coding guidelines (external libraries first, then local imports). --- `12-30`: **LGTM: Web app schema converted correctly.** The conversion to `definitionSchema`-wrapped factory function preserves all validation logic including the `zRef` usage for role references and maintains all optional fields and their semantics. --- `32-32`: **LGTM: Type inference updated consistently.** The type definition correctly uses `def.InferOutput<typeof createWebAppSchema>` following the established pattern. </details> <details> <summary>packages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/output.ts (1)</summary> `7-21`: **LGTM: Schema creator pattern implemented correctly.** The examples correctly demonstrate both simple and context-dependent schema creation using `definitionSchema`, with proper context parameter usage and type inference. </details> <details> <summary>packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/output.ts (2)</summary> `7-25`: **LGTM! Correct implementation of schema creator pattern.** The schema creators correctly use the `definitionSchema` wrapper and properly pass context between dependent schemas (e.g., `createUserRoleSchema(ctx)` in `createUserSchema`). This follows the new pattern consistently. --- `27-31`: **LGTM! Correct type inference using new pattern.** The type exports correctly use `def.InferOutput` and `def.InferInput` instead of the old `z.infer` and `z.input` pattern, which aligns with the schema creator refactoring. </details> <details> <summary>packages/project-builder-lib/src/schema/models/transformers/types.ts (2)</summary> `4-5`: **LGTM! Correct imports for new schema creator pattern.** The new imports properly bring in the `def` namespace for type inference and `DefinitionSchemaCreator` type for generic constraints. --- `16-18`: **LGTM! Proper transition to schema creator pattern.** The changes correctly: - Update generic constraint from `z.ZodTypeAny` to `DefinitionSchemaCreator` for more specific typing - Change type inference from `z.infer<T>` to `def.InferOutput<T>` to work with schema creators - Maintain consistency across both interface and function definitions This aligns perfectly with the schema creator refactoring objectives. Also applies to: 23-23, 27-27 </details> <details> <summary>packages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/input.ts (1)</summary> `5-20`: **LGTM! Correct test input schemas.** The static Zod schemas and type definitions correctly represent the "before" state for testing the schema wrapper transformation. The enum schemas are well-structured with appropriate validations. </details> <details> <summary>packages/project-builder-lib/src/schema/plugins/definition.ts (4)</summary> `5-5`: **LGTM! Correct import for schema creator.** The new import properly brings in `definitionSchema` for the schema creator pattern. --- `9-16`: **LGTM! Simplified base schema structure.** The `basePluginDefinitionSchema` is correctly simplified to a plain `z.object` with the required fields, removing the previous `zEnt` wrapping which is now handled in the schema creator function. --- `20-44`: **LGTM! Well-implemented schema creator with plugin integration.** The `createPluginWithConfigSchema` correctly implements the schema creator pattern with sophisticated plugin system integration: 1. Parses base plugin data to extract the ID 2. Derives plugin key using the entity type's `keyFromId` method 3. Dynamically retrieves config schema from the plugin system 4. Applies `zEnt` wrapping for entity associations 5. Conditionally extends with config schema when available This maintains the dynamic behavior while transitioning to the new pattern. --- `46-48`: **LGTM! Consistent array schema creator.** The `createPluginsSchema` correctly implements an array of plugins using the context-aware pattern, properly passing the context to the nested schema creator. </details> <details> <summary>packages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/output.ts (2)</summary> `7-22`: **LGTM! Correct schema creator implementation.** The enum schema creators properly implement the new pattern: - `createEnumValueSchema` uses `definitionSchema` without context (no dependencies) - `createEnumSchema` correctly passes context to the nested `createEnumValueSchema(ctx)` call - Schema validation logic is preserved from the input version --- `14-14`: **LGTM! Proper type inference with new pattern.** The type exports correctly use `def.InferOutput` and `def.InferInput` instead of the legacy `z.infer` and `z.input`, aligning with the schema creator refactoring. Also applies to: 24-24, 26-26 </details> <details> <summary>packages/project-builder-lib/src/schema/features/feature.ts (4)</summary> `4-7`: **Import statements follow the correct pattern.** The imports are properly organized with external libraries (zod) first, followed by local imports. The '.js' extension is correctly included in the import paths as per the coding guidelines. --- `13-36`: **Schema transformation correctly implements the factory pattern.** The schema has been properly wrapped with `definitionSchema` while preserving all validation logic and entity references. The function doesn't use the context parameter, which is correct since this schema doesn't reference other schemas. --- `38-38`: **Type inference correctly updated to use the factory pattern.** The type now properly uses `def.InferOutput` with the factory function, maintaining type safety while following the new schema pattern. --- `40-42`: **Context parameter correctly propagated.** The `createFeaturesSchema` properly accepts and passes the context parameter to `createFeatureSchema`, following the established pattern for schema composition. </details> <details> <summary>packages/project-builder-lib/src/schema/models/graphql.ts (3)</summary> `3-6`: **Imports correctly follow the established pattern.** The imports are properly organized and include the required '.js' extensions as per the coding guidelines. --- `24-116`: **Schema transformation correctly implements the factory pattern with improved type safety.** The refactoring properly wraps the schema with `definitionSchema` and includes important corrections: - Fixed the entity type reference for fields to `modelScalarFieldEntityType` - Explicitly marked `localRelations` and `foreignRelations` as optional - Preserved all default values and structure These changes improve type safety and correctness. --- `118-122`: **Type exports correctly updated for the factory pattern.** Both input and output types now properly use the `def` inference utilities with the factory function. </details> <details> <summary>packages/code-morph/src/morphers/definition-schema-wrapper.morpher.ts (1)</summary> `147-161`: **Import management correctly handles conditional imports.** The logic properly adds imports only when needed. Note that the import paths are project-specific and would need adjustment if the project structure changes. </details> <details> <summary>packages/project-builder-lib/src/schema/apps/admin/app.ts (3)</summary> `16-24`: **Admin section schema correctly implements the factory pattern.** The schema properly accepts and passes the context parameter to `createAdminCrudSectionSchema`, maintaining the reference builder configuration. --- `32-46`: **Admin app schema properly propagates context.** The schema correctly passes the context parameter to nested schema factories while preserving all validation logic and references. --- `28-30`: **Type inference correctly updated.** Both input and output types properly use the `def` inference utilities with the respective factory functions. Also applies to: 48-48 </details> <details> <summary>packages/project-builder-lib/src/plugins/spec/config-spec.ts (1)</summary> `50-74`: **Implementation correctly uses consistent naming.** The implementation properly uses `pluginKey` throughout all methods, error messages, and map operations. </details> <details> <summary>packages/project-builder-lib/src/schema/settings.ts (4)</summary> `4-6`: **LGTM! Clean import additions for the schema creator pattern.** The imports follow the coding guidelines with proper absolute paths using '#src/' alias and '.js' extensions. --- `11-36`: **LGTM! Proper conversion to schema factory pattern.** The `generalSettingsSchema` has been correctly converted to `createGeneralSettingsSchema` factory function wrapped with `definitionSchema`. The schema logic remains unchanged while enabling context-aware creation. --- `38-44`: **LGTM! Correct type inference updates.** The type aliases properly use `def.InferInput` and `def.InferOutput` with the factory function, maintaining type safety while adapting to the new pattern. --- `46-52`: **LGTM! Consistent factory function usage.** The `createSettingsSchema` properly passes the context parameter to all nested factory functions, ensuring consistent behavior across the schema hierarchy. </details> <details> <summary>packages/project-builder-lib/src/schema/models/transformers/built-in-transformers.ts (5)</summary> `3-3`: **LGTM! Proper imports for schema creator pattern.** The imports correctly add the `def` types and `definitionSchema` utility with proper file extensions. Also applies to: 10-10 --- `20-32`: **LGTM! Clean conversion of password transformer schema.** The `passwordTransformerSchema` is properly converted to a factory function with `definitionSchema` wrapper. The schema structure with `zEnt` and entity metadata is preserved correctly. --- `38-81`: **LGTM! Proper handling of complex embedded relation schema.** The conversion correctly moves the complex schema logic including the `getNameResolver` function inside the factory function. The reference builder and entity relationships are maintained properly. --- `34-36`: **LGTM! Correct type inference updates.** Type aliases properly use `def.InferOutput` with the new factory functions. Also applies to: 83-85 --- `90-90`: **LGTM! Consistent factory function references.** The `BUILT_IN_TRANSFORMERS` array correctly references the new factory functions instead of static schemas. Also applies to: 95-95 </details> <details> <summary>packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/input.ts (1)</summary> `3-23`: **LGTM! Appropriate test input structure.** The test input correctly demonstrates the "before" state with static Zod schemas and traditional type inference patterns that the morpher should transform. </details> <details> <summary>packages/project-builder-lib/src/schema/models/enums.ts (4)</summary> `3-3`: **LGTM! Proper imports for schema creator pattern.** Imports correctly add necessary types and utilities with proper file extensions. Also applies to: 6-6 --- `11-22`: **LGTM! Proper enum value schema factory.** The `createEnumValueSchema` factory correctly wraps the enum value schema with proper entity metadata. --- `26-36`: **LGTM! Proper enum schema factories.** Both `createEnumBaseSchema` and `createEnumSchema` are correctly implemented with proper context passing and entity metadata. Also applies to: 38-43 --- `45-47`: **LGTM! Correct type inference for enum config.** The final enum configuration types properly use `def.InferOutput` and `def.InferInput` with the full enum schema. </details> <details> <summary>packages/project-builder-lib/src/schema/project-definition.ts (6)</summary> `5-5`: **LGTM! Proper type import addition.** The `def` types import uses correct absolute path and file extension. --- `7-9`: **LGTM! Consistent factory function imports.** All schema imports have been correctly updated to reference the new factory functions with proper file paths and extensions. Also applies to: 12-15 --- `18-32`: **LGTM! Proper app schema factory with discriminated union.** The `createAppSchema` factory correctly maintains the discriminated union structure while passing context to all constituent app schemas. The `zRefBuilder` usage with entity metadata is properly preserved. --- `34-34`: **LGTM! Correct app config type inference.** The `AppConfig` type properly uses `def.InferOutput` with the factory function. --- `39-46`: **LGTM! Consistent factory function usage in project schema.** The project definition schema correctly passes context to all nested factory functions, maintaining the schema composition hierarchy. --- `50-60`: **LGTM! Complete type inference migration.** All exported types properly use the new `def.InferInput`, `def.InferOutput`, and `def.InferSchema` utilities, maintaining consistency with the schema creator pattern. </details> <details> <summary>packages/project-builder-lib/src/schema/apps/admin/sections/crud.ts (1)</summary> `1-166`: **Schema creator pattern properly implemented.** The refactoring correctly implements the schema creator pattern with proper context parameter usage throughout. Complex schemas appropriately use `zRefBuilder` for entity management, and discriminated unions correctly pass context to child schemas. </details> <details> <summary>packages/project-builder-lib/src/schema/models/index.ts (1)</summary> `1-320`: **Excellent implementation of the schema creator pattern.** The refactoring demonstrates proper use of: - Context parameter consistently passed to all nested schemas - Complex validation logic and transformations preserved - Advanced features like custom entity name resolvers - Proper entity and reference management with `zEnt` and `zRefBuilder` The code maintains all existing functionality while enabling dynamic schema creation. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
| if [[ -f "$src" ]]; then | ||
| cp "$src" "$dest" | ||
| echo "Copied $src → $dest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add error handling for copy operations.
The script should handle potential copy failures more gracefully and provide better feedback.
if [[ -f "$src" ]]; then
- cp "$src" "$dest"
- echo "Copied $src → $dest"
+ if cp "$src" "$dest" 2>/dev/null; then
+ echo "Copied $src → $dest"
+ else
+ echo "Failed to copy $src to $dest" >&2
+ fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if [[ -f "$src" ]]; then | |
| cp "$src" "$dest" | |
| echo "Copied $src → $dest" | |
| if [[ -f "$src" ]]; then | |
| if cp "$src" "$dest" 2>/dev/null; then | |
| echo "Copied $src → $dest" | |
| else | |
| echo "Failed to copy $src to $dest" >&2 | |
| fi |
🤖 Prompt for AI Agents
In .husky/post-checkout around lines 19 to 21, the copy operation lacks error
handling, which can cause silent failures. Modify the script to check the exit
status of the cp command immediately after it runs, and if it fails, output an
error message indicating the failure and optionally exit with a non-zero status
to signal the error. This will provide clearer feedback and improve robustness.
| @@ -0,0 +1,21 @@ | |||
| // @ts-nocheck | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove @ts-nocheck directive.
The @ts-nocheck directive should be removed as it suppresses TypeScript compilation errors that should be addressed.
-// @ts-nocheck📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // @ts-nocheck |
🧰 Tools
🪛 ESLint
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
🤖 Prompt for AI Agents
In
packages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/output.ts
at line 1, remove the @ts-nocheck directive to allow TypeScript to report
compilation errors. After removing it, fix any TypeScript errors that appear to
ensure the code type-checks correctly.
| import type { def } from '#src/schema/creator/index.js'; | ||
| import { definitionSchema } from '#src/schema/creator/schema-creator.js'; | ||
| import { z } from 'zod'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Fix import ordering to follow coding guidelines.
The imports should be reordered according to the coding guidelines: external libraries first, then local imports with proper spacing.
-import type { def } from '#src/schema/creator/index.js';
-import { definitionSchema } from '#src/schema/creator/schema-creator.js';
-import { z } from 'zod';
+import { z } from 'zod';
+
+import type { def } from '#src/schema/creator/index.js';
+import { definitionSchema } from '#src/schema/creator/schema-creator.js';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import type { def } from '#src/schema/creator/index.js'; | |
| import { definitionSchema } from '#src/schema/creator/schema-creator.js'; | |
| import { z } from 'zod'; | |
| import { z } from 'zod'; | |
| import type { def } from '#src/schema/creator/index.js'; | |
| import { definitionSchema } from '#src/schema/creator/schema-creator.js'; |
🧰 Tools
🪛 ESLint
[error] 4-4: Missed spacing between "#src/schema/creator/index.js" and "#src/schema/creator/schema-creator.js".
(perfectionist/sort-imports)
[error] 5-5: Expected "zod" (value-external) to come before "#src/schema/creator/schema-creator.js" (value-internal).
(perfectionist/sort-imports)
🤖 Prompt for AI Agents
In
packages/code-morph/src/morphers/tests/definition-schema-wrapper/with-ctx/output.ts
around lines 3 to 5, the import statements are not ordered correctly. Reorder
the imports to place external libraries like 'zod' first, followed by local
imports such as '#src/schema/creator/index.js' and
'#src/schema/creator/schema-creator.js', ensuring proper spacing between these
groups according to the coding guidelines.
| @@ -0,0 +1,31 @@ | |||
| // @ts-nocheck | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove @ts-nocheck directive.
The @ts-nocheck directive disables TypeScript compilation errors entirely, which can hide real issues. If there are specific TypeScript errors that need to be suppressed, use more targeted directives like @ts-expect-error with explanatory comments.
-// @ts-nocheck📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // @ts-nocheck |
🧰 Tools
🪛 ESLint
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
🤖 Prompt for AI Agents
In
packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/output.ts
at line 1, remove the @ts-nocheck directive to enable TypeScript error checking.
If there are specific errors that need to be suppressed, replace @ts-nocheck
with targeted directives like @ts-expect-error and add comments explaining why
the suppression is necessary.
| @@ -0,0 +1,20 @@ | |||
| // @ts-nocheck | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove @ts-nocheck directive.
The @ts-nocheck directive disables TypeScript compilation errors entirely. Even in test files, this can hide real issues. Consider removing it or using more targeted directives if specific suppressions are needed.
-// @ts-nocheck📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // @ts-nocheck |
🧰 Tools
🪛 ESLint
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
🤖 Prompt for AI Agents
In
packages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/input.ts
at line 1, remove the @ts-nocheck directive to enable TypeScript to report
compilation errors. If there are specific errors you want to suppress, replace
it with more targeted directives instead of disabling all checks.
| @@ -0,0 +1,26 @@ | |||
| // @ts-nocheck | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove @ts-nocheck directive.
The @ts-nocheck directive disables TypeScript compilation errors entirely, which can hide real issues. Remove this directive to ensure proper type checking.
-// @ts-nocheck📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // @ts-nocheck |
🧰 Tools
🪛 ESLint
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
🤖 Prompt for AI Agents
In
packages/code-morph/src/morphers/tests/definition-schema-wrapper/simple/output.ts
at line 1, remove the @ts-nocheck directive to enable TypeScript to perform
proper type checking and catch potential errors.
| const regex = new RegExp(`\\b${newSchemaName}\\b`, 'g'); | ||
| if (regex.test(schemaText)) { | ||
| needsCtx = true; | ||
|
|
||
| // Replace references with new name + (ctx) | ||
| schemaText = schemaText.replace(regex, `${newSchemaName}(ctx)`); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Schema reference replacement could match unintended occurrences.
The regex replacement might match schema names in strings, comments, or as parts of other identifiers. Consider using TypeScript's AST manipulation instead of text replacement for more reliable transformations.
Example of potential issues:
- Comments:
// Using createUserSchema here - Strings:
"The createUserSchema function" - Partial matches in longer names:
createUserSchemaValidator
🤖 Prompt for AI Agents
In packages/code-morph/src/morphers/definition-schema-wrapper.morpher.ts around
lines 70 to 77, the current regex-based schema name replacement risks matching
unintended text like comments, strings, or partial identifiers. To fix this,
replace the regex text replacement with TypeScript AST manipulation: parse the
schemaText into an AST, traverse it to find exact identifier nodes matching
newSchemaName, and update those nodes to include (ctx). This ensures only valid
schema references are transformed without affecting comments or strings.
| getMigrations(pluginId: string): PluginConfigMigration[] | undefined; | ||
| getLastMigrationVersion(pluginId: string): number | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix inconsistent parameter naming.
The getMigrations and getLastMigrationVersion methods still use pluginId as the parameter name while all other methods and their implementations use pluginKey. This inconsistency should be fixed.
- getMigrations(pluginId: string): PluginConfigMigration[] | undefined;
- getLastMigrationVersion(pluginId: string): number | undefined;
+ getMigrations(pluginKey: string): PluginConfigMigration[] | undefined;
+ getLastMigrationVersion(pluginKey: string): number | undefined;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| getMigrations(pluginId: string): PluginConfigMigration[] | undefined; | |
| getLastMigrationVersion(pluginId: string): number | undefined; | |
| getMigrations(pluginKey: string): PluginConfigMigration[] | undefined; | |
| getLastMigrationVersion(pluginKey: string): number | undefined; |
🤖 Prompt for AI Agents
In packages/project-builder-lib/src/plugins/spec/config-spec.ts at lines 23 to
24, the parameter name for the methods getMigrations and getLastMigrationVersion
is inconsistent with other methods; it uses pluginId instead of pluginKey.
Rename the parameter from pluginId to pluginKey in both method signatures to
maintain consistency across the codebase.
| @@ -0,0 +1,23 @@ | |||
| // @ts-nocheck | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove @ts-nocheck directive.
The ESLint rule correctly flags this directive as problematic since it suppresses TypeScript compilation errors. For test files, prefer targeted suppressions or fix the underlying TypeScript issues.
-// @ts-nocheck📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // @ts-nocheck |
🧰 Tools
🪛 ESLint
[error] 1-1: Do not use "@ts-nocheck" because it alters compilation errors.
(@typescript-eslint/ban-ts-comment)
🤖 Prompt for AI Agents
In
packages/code-morph/src/morphers/tests/definition-schema-wrapper/complex/input.ts
at line 1, remove the @ts-nocheck directive to avoid suppressing all TypeScript
errors. Instead, address the specific TypeScript issues in the file or use
targeted suppression comments only where necessary.
+ They are often lagging behind (probably because CI is substantially slower)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/code-morph/src/morphers/tests/morpher.test-helper.ts(1 hunks)packages/project-builder-lib/src/schema/models/enums.ts(1 hunks)packages/ui-components/src/stories/typography.mdx(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/ui-components/src/stories/typography.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/project-builder-lib/src/schema/models/enums.ts
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.{ts,tsx,js,jsx}`: Always use kebab-case for file names. Always use '.js' extensions in import statements, even for TypeScript files. Order functions such that functions are p...
**/*.{ts,tsx,js,jsx}: Always use kebab-case for file names.
Always use '.js' extensions in import statements, even for TypeScript files.
Order functions such that functions are placed below the variables/functions they use.
Sort imports by group: external libraries first, then local imports.
Use camelCase for variables and functions, PascalCase for types and classes.
Prefer barrel exports (e.g., export * from './foo.js') instead of individual named exports.
Colocate tests with implementation files.
Include absolute paths in import statements via tsconfig paths (use '@src/' as the alias for 'src/').
Node 16 module resolution: always include file extensions in imports ('.js').
packages/code-morph/src/morphers/tests/morpher.test-helper.ts
`**/*.{ts,tsx}`: Always include explicit return types on all top-level functions, including React components. If a particular interface or type is not exported, change the file so ...
**/*.{ts,tsx}: Always include explicit return types on all top-level functions, including React components.
If a particular interface or type is not exported, change the file so it is exported.
packages/code-morph/src/morphers/tests/morpher.test-helper.ts
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test E2E
- GitHub Check: Lint
🔇 Additional comments (1)
packages/code-morph/src/morphers/tests/morpher.test-helper.ts (1)
55-55: LGTM: Function signature follows TypeScript guidelines.The explicit return type
voidand the eslint disable comment with proper justification are both appropriate here.
| let prettierConfig: prettier.Options | null; | ||
|
|
||
| describe(`Test morpher ${morpher.name}`, () => { | ||
| describe.skipIf(process.env.CI)(`Test morpher ${morpher.name}`, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Verification correct
Reconsider skipping all morpher tests in CI environments.
Conditionally skipping the entire test suite in CI could significantly reduce test coverage and hide potential regressions. This means these transformation tests won't provide any feedback during continuous integration, which defeats the purpose of having CI validation.
Consider these alternatives:
- Make the tests more reliable/faster instead of skipping them
- Skip only specific problematic test cases rather than the entire suite
- Use timeouts or retry mechanisms for flaky tests
- Run a subset of critical tests in CI while skipping others
If this change is intentional due to test reliability issues, please document the reasoning and consider implementing a more targeted approach:
- describe.skipIf(process.env.CI)(`Test morpher ${morpher.name}`, () => {
+ describe(`Test morpher ${morpher.name}`, () => {Please verify if there are specific issues with these tests in CI that necessitate skipping them entirely:
🏁 Script executed:
#!/bin/bash
# Check for any CI-specific configuration or known issues with morpher tests
echo "Searching for CI-related configurations and test issues..."
# Look for CI configuration files
fd -t f "\.github|\.circleci|\.travis|ci\." --exec echo "Found CI config: {}"
# Search for any documentation about test skipping or CI issues
rg -i "skip.*ci|ci.*skip|flaky.*test|timeout.*test" --type md --type txt
# Look for other instances of conditional test skipping
rg "skipIf.*CI|describe\.skip" --type ts --type js
# Check if there are any performance or timing issues mentioned
rg -i "slow.*test|performance.*test|timeout" --type ts --type js -A 3Length of output: 27896
Reconsider skipping all morpher tests in CI environments.
Conditionally skipping the entire test suite in CI could significantly reduce test coverage and hide potential regressions. This means these transformation tests won't provide any feedback during continuous integration, which defeats the purpose of having CI validation.
Consider these alternatives:
- Make the tests more reliable/faster instead of skipping them
- Skip only specific problematic test cases rather than the entire suite
- Use timeouts or retry mechanisms for flaky tests
- Run a subset of critical tests in CI while skipping others
If this change is intentional due to test reliability issues, please document the reasoning and consider implementing a more targeted approach:
- describe.skipIf(process.env.CI)(`Test morpher ${morpher.name}`, () => {
+ describe(`Test morpher ${morpher.name}`, () => {Please verify if there are specific issues with these tests in CI that necessitate skipping them entirely:
#!/bin/bash
# Check for any CI-specific configuration or known issues with morpher tests
echo "Searching for CI-related configurations and test issues..."
# Look for CI configuration files
fd -t f "\.github|\.circleci|\.travis|ci\." --exec echo "Found CI config: {}"
# Search for any documentation about test skipping or CI issues
rg -i "skip.*ci|ci.*skip|flaky.*test|timeout.*test" --type md --type txt
# Look for other instances of conditional test skipping
rg "skipIf.*CI|describe\.skip" --type ts --type js
# Check if there are any performance or timing issues mentioned
rg -i "slow.*test|performance.*test|timeout" --type ts --type js -A 3🤖 Prompt for AI Agents
In packages/code-morph/src/morphers/tests/morpher.test-helper.ts at line 64, the
entire morpher test suite is conditionally skipped in CI environments, which
reduces test coverage and may hide regressions. Instead of skipping all tests,
identify and isolate specific flaky or slow tests to skip or add
retries/timeouts for them. Alternatively, improve test reliability or run a
critical subset in CI. Remove the global skipIf condition and implement targeted
handling for problematic tests, documenting any CI-related issues if skipping
remains necessary.
Use the schema creator pattern more broadly in preparation for transition zRef
Summary by CodeRabbit
New Features
Refactor
Bug Fixes
Chores
Tests