Skip to content

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Dec 21, 2025

close #5656

Migrate from @sinclair/typebox v0.34.x to the new typebox v1.0.x package following the official migration guide. Key changes:

  • Package name changed from @sinclair/typebox to typebox
  • Type export now uses default export pattern
  • Updated all import statements to use default export for Type
  • Added default export re-exports in tegg/ajv and egg/ajv modules
  • Updated test snapshots for new typebox API exports
  • Fixed schema comparison test to use parsed JSON (property order changed)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated dependencies: migrated from @sinclair/typebox to typebox package across multiple modules, ensuring consistent package management and dependency resolution.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 21, 2025 09:56
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 21, 2025

Warning

Rate limit exceeded

@fengmk2 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d4644e1 and 8f0347a.

📒 Files selected for processing (2)
  • .gitignore (1 hunks)
  • ecosystem-ci/.gitignore (0 hunks)

Walkthrough

This pull request migrates the codebase from the scoped @sinclair/typebox package to the standalone typebox package across package definitions, export statements, and test fixtures. Updates include dependency replacements, import path changes, and test assertion modifications for compatibility with TypeBox 1.0.

Changes

Cohort / File(s) Summary
Package Dependency Migration
plugins/typebox-validate/package.json, tegg/core/ajv-decorator/package.json
Replaced dependency @sinclair/typebox with typebox (catalog reference), reordering entries to place after ajv-keywords or ajv.
Workspace Configuration
pnpm-workspace.yaml
Replaced catalog entry from @sinclair/typebox: ^0.34.41 to typebox: ^1.0.65 and added typebox to minimumReleaseAgeExclude list.
Export Source Updates
plugins/typebox-validate/src/typebox.ts, tegg/core/ajv-decorator/src/index.ts
Changed re-export source from @sinclair/typebox to typebox.
Test Fixture Import Reordering
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts, tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts, tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts, tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
Reordered named and type imports from @eggjs/tegg/ajv, positioning Type as a leading value import while keeping type-only imports (Ajv, Static) unchanged.
Test Assertion Update
tegg/standalone/standalone/test/index.test.ts
Changed err.currentSchema assertion from string comparison to JSON parsing and deep-equality check against an object structure mirroring the schema definition.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Package.json updates: Straightforward dependency name and version replacements; verify catalog references are correct.
  • Export changes: Simple import path updates with no functional logic changes.
  • Import reordering: Cosmetic reordering with no behavioral impact; verify reordered positions are compatible.
  • Test assertion change (index.test.ts): Requires attention to ensure JSON parsing of err.currentSchema correctly validates the schema structure and that the object comparison is semantically correct for the test's intent.

Poem

🐰 From Sinclair's scope to standalone wings,
TypeBox 1.0 brings simpler things—
Migrations hop through files with care,
Imports reorder, exports share,
A version leap, a cleaner way! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: upgrading typebox from @sinclair/typebox to typebox 1.0.
Linked Issues check ✅ Passed The PR fulfills the #5656 objective to upgrade from @sinclair/typebox to typebox 1.0 by updating package dependencies, imports/exports, and adjusting test snapshots accordingly.
Out of Scope Changes check ✅ Passed All changes are directly related to the typebox upgrade: dependency updates, import/export adjustments, import reordering, and test snapshot fixes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fengmk2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on upgrading the typebox dependency to its major version 1.0.x. This upgrade necessitated changes to package references and import statements throughout the codebase, primarily due to typebox adopting a default export pattern for its core Type object. The modifications ensure that the project remains compatible with the latest version of typebox, benefiting from its updated features and stability.

Highlights

  • Dependency Upgrade: Migrated the project's dependency from @sinclair/typebox v0.34.x to the new typebox v1.0.x package.
  • Package Renaming and API Changes: The package name has changed from @sinclair/typebox to typebox, and the Type export now follows a default export pattern, requiring updates to import statements.
  • Re-exports for Compatibility: Added default export re-exports in egg/ajv and tegg/ajv modules to ensure existing consumers can continue to import Type as a named export.
  • Test Adjustments: Updated test snapshots to reflect the new typebox API exports and fixed a schema comparison test to correctly handle potential changes in JSON property order by parsing the schema string before comparison.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 21, 2025

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8f0347a
Status: ✅  Deploy successful!
Preview URL: https://d06035f2.egg-cci.pages.dev
Branch Preview URL: https://typebox-1-0.egg-cci.pages.dev

View logs

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully upgrades typebox from @sinclair/typebox to the new typebox v1.0 package. All changes, including package name updates, import statement adjustments for the new default export pattern, and re-export module modifications, are correctly implemented according to the migration guide. The test snapshots have been updated accordingly, and a notable improvement is the fix in a schema comparison test to use parsed JSON, making it more robust. The changes are thorough and well-executed.

@codecov
Copy link

codecov bot commented Dec 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.29%. Comparing base (a0cd3bb) to head (8f0347a).
⚠️ Report is 2 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5745      +/-   ##
==========================================
- Coverage   87.60%   87.29%   -0.32%     
==========================================
  Files         563      563              
  Lines       10930    10930              
  Branches     1239     1239              
==========================================
- Hits         9575     9541      -34     
- Misses       1271     1298      +27     
- Partials       84       91       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 21, 2025

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8f0347a
Status: ✅  Deploy successful!
Preview URL: https://18d294e5.egg-v3.pages.dev
Branch Preview URL: https://typebox-1-0.egg-v3.pages.dev

View logs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts (1)

23-23: Consider explicit test data instead of as any cast.

The as any cast bypasses type checking. While this appears intentional for testing validation with invalid data, consider using an explicitly typed invalid object to make the test intent clearer.

Optional: More explicit test data
-  const body: RequestBody = {} as any;
+  const body = {} as RequestBody; // or explicitly define invalid test data

Note: If the intent is to test validation failures, the current approach works but could be more explicit about which fields are missing.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e900acd and 6d61e38.

⛔ Files ignored due to path filters (2)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • tegg/core/ajv-decorator/test/__snapshots__/index.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (13)
  • packages/egg/src/ajv.ts (1 hunks)
  • plugins/typebox-validate/package.json (1 hunks)
  • plugins/typebox-validate/src/typebox.ts (1 hunks)
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts (1 hunks)
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts (1 hunks)
  • pnpm-workspace.yaml (2 hunks)
  • tegg/core/ajv-decorator/package.json (1 hunks)
  • tegg/core/ajv-decorator/src/index.ts (1 hunks)
  • tegg/core/tegg/src/ajv.ts (1 hunks)
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts (1 hunks)
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts (1 hunks)
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts (1 hunks)
  • tegg/standalone/standalone/test/index.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (AGENTS.md)

Use .ts sources over CommonJS and prefer ESM for exports

Files:

  • tegg/standalone/standalone/test/index.test.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/core/ajv-decorator/src/index.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/src/typebox.ts
  • packages/egg/src/ajv.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
  • tegg/core/tegg/src/ajv.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Name classes in PascalCase
Name functions and variables in camelCase

**/*.{ts,tsx}: Use explicit return types for all exported functions, methods, and getters to support TypeScript's --isolatedDeclarations flag
Avoid computed property names with symbols in class declarations; use override methods instead for compatibility with --isolatedDeclarations
Add explicit type annotations for class properties, particularly for exported symbols which should use unique symbol type
Enable strict mode in all TypeScript packages and use explicit return types for public APIs
Prefer interfaces over type aliases for object shapes in TypeScript
Use readonly modifiers where appropriate in TypeScript classes and interfaces
Avoid any type; use unknown when type is truly unknown

Files:

  • tegg/standalone/standalone/test/index.test.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/core/ajv-decorator/src/index.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/src/typebox.ts
  • packages/egg/src/ajv.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
  • tegg/core/tegg/src/ajv.ts
**/test/**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

Configure Vitest to discover **/test/**/*.test.ts within each package and mirror this pattern when adding test suites

Files:

  • tegg/standalone/standalone/test/index.test.ts
tegg/**/*.{js,ts,mjs,cjs}

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

Use ESM only (no CommonJS)

Files:

  • tegg/standalone/standalone/test/index.test.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • tegg/core/tegg/src/ajv.ts
tegg/**/*.{ts,tsx}

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

tegg/**/*.{ts,tsx}: Use decorators (@Inject(), @ContextProto(), @SingletonProto()) to define dependency injection and prototype scoping
ContextProto objects can inject any prototype, but SingletonProto cannot inject ContextProto
Use qualifiers (@InitTypeQualifier, @ModuleQualifier, @EggQualifier) when multiple implementations exist to disambiguate
Do not use circular dependencies between prototypes or modules
Use lifecycle hooks (@LifecyclePostConstruct(), @LifecyclePostInject(), @LifecyclePreDestroy(), etc.) for object initialization and cleanup
All imports should use .js extensions for ESM files

Files:

  • tegg/standalone/standalone/test/index.test.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • tegg/core/tegg/src/ajv.ts
**/test/fixtures/**

📄 CodeRabbit inference engine (AGENTS.md)

Place reusable test data under test/fixtures/

Files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
plugins/*/package.json

📄 CodeRabbit inference engine (CLAUDE.md)

plugins/*/package.json: All plugins must include egg in peerDependencies and define build, clean, and prepublishOnly scripts in package.json
Plugin packages must configure exports in package.json with both development (./src/*.ts) and published (./dist/*.js) entry points

Files:

  • plugins/typebox-validate/package.json
pnpm-workspace.yaml

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Define dependencies in pnpm-workspace.yaml catalog section and reference catalog entries with 'package-name': 'catalog:' or internal workspace dependencies with 'package-name': 'workspace:*'

Files:

  • pnpm-workspace.yaml
tegg/core/*/src/index.ts

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

Core packages should export public API through src/index.ts

Files:

  • tegg/core/ajv-decorator/src/index.ts
{packages,plugins}/**/*.{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (AGENTS.md)

Name files in lowercase with hyphens (e.g. loader-context.ts)

Files:

  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/src/typebox.ts
  • packages/egg/src/ajv.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
packages/**/*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

packages/**/*.ts: Use TypeScript throughout all packages in the Eggjs monorepo
Use strict TypeScript mode in all packages

Files:

  • packages/egg/src/ajv.ts
packages/egg/src/**

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Work primarily in 'packages/egg/src/' for core framework features, organizing into lib/, app/extend/, config/, and lib/loader/ directories

Files:

  • packages/egg/src/ajv.ts
tegg/**/package.json

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

tegg/**/package.json: Node.js version must be >= 22.18.0
Egg.js version must be >= 4.1.0
Use workspace:* protocol for internal monorepo dependencies (both tegg and egg packages)

Files:

  • tegg/core/ajv-decorator/package.json
tegg/core/*/package.json

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

New core packages should include standard scripts in package.json with typecheck script using tsgo

Files:

  • tegg/core/ajv-decorator/package.json
🧠 Learnings (38)
📓 Common learnings
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Re-export types thoughtfully to keep the public API stable
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: All packages must use oxlint for linting with the `--type-aware` flag; remove any `.eslintrc` or `.eslintrc.js` files when migrating
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to test/**/*.test.ts : Use standard assertions with Node.js built-in `assert` module in test files instead of external assertion libraries
Learnt from: CR
Repo: eggjs/egg PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T14:37:59.711Z
Learning: Applies to packages/**/test/**/*.test.ts : Use Node.js built-in 'assert' module for assertions in tests
Learnt from: CR
Repo: eggjs/egg PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T14:37:59.711Z
Learning: Applies to packages/**/*.ts : Use TypeScript throughout all packages in the Eggjs monorepo
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to test/**/*.test.ts : Use standard assertions with Node.js built-in `assert` module in test files instead of external assertion libraries

Applied to files:

  • tegg/standalone/standalone/test/index.test.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
📚 Learning: 2025-11-27T14:37:59.711Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T14:37:59.711Z
Learning: Applies to packages/**/test/**/*.test.ts : Use Node.js built-in 'assert' module for assertions in tests

Applied to files:

  • tegg/standalone/standalone/test/index.test.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
📚 Learning: 2025-12-20T09:24:59.960Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Add regression cases that exercise both CommonJS and TypeScript example apps when features affect HTTP or process orchestration

Applied to files:

  • tegg/standalone/standalone/test/index.test.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/__tests__/**/*.test.{ts,tsx,js} : Use Vitest for testing all tegg packages

Applied to files:

  • tegg/standalone/standalone/test/index.test.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : Use qualifiers (`InitTypeQualifier`, `ModuleQualifier`, `EggQualifier`) when multiple implementations exist to disambiguate

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: All packages must define a `src/types.ts` file that extends the Egg module declarations using `declare module 'egg'` pattern

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • plugins/typebox-validate/package.json
  • tegg/core/ajv-decorator/src/index.ts
  • packages/egg/src/ajv.ts
📚 Learning: 2025-12-20T09:24:59.960Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Re-export types thoughtfully to keep the public API stable

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/core/ajv-decorator/src/index.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/src/typebox.ts
  • packages/egg/src/ajv.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : Do not use circular dependencies between prototypes or modules

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Add explicit type annotations for class properties, particularly for exported symbols which should use `unique symbol` type

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/core/ajv-decorator/src/index.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/src/typebox.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/core/*/src/index.ts : Core packages should export public API through `src/index.ts`

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/core/ajv-decorator/src/index.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/src/typebox.ts
  • packages/egg/src/ajv.ts
  • tegg/core/tegg/src/ajv.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Use explicit return types for all exported functions, methods, and getters to support TypeScript's `--isolatedDeclarations` flag

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/core/ajv-decorator/src/index.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/src/typebox.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
📚 Learning: 2025-11-27T14:37:59.711Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T14:37:59.711Z
Learning: Applies to packages/**/*.ts : Use TypeScript throughout all packages in the Eggjs monorepo

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • plugins/typebox-validate/package.json
  • tegg/core/ajv-decorator/src/index.ts
  • packages/egg/src/ajv.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : All imports should use `.js` extensions for ESM files

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{js,ts,mjs,cjs} : Use ESM only (no CommonJS)

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • packages/egg/src/ajv.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : Use decorators (`Inject()`, `ContextProto()`, `SingletonProto()`) to define dependency injection and prototype scoping

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • tegg/core/tegg/src/ajv.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : ContextProto objects can inject any prototype, but SingletonProto cannot inject ContextProto

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/__tests__/**/*.test.{ts,tsx} : Use `MockApplication` from `eggjs/mock` for testing with `mockModuleContextScope()` to create context scope

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/package.json : Egg.js version must be >= 4.1.0

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • pnpm-workspace.yaml
  • packages/egg/src/ajv.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • tegg/core/ajv-decorator/package.json
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/core/*/package.json : New core packages should include standard scripts in `package.json` with `typecheck` script using tsgo

Applied to files:

  • plugins/typebox-validate/package.json
  • tegg/core/ajv-decorator/package.json
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: All packages must include TypeScript type checking with `tsc --noEmit` in the `typecheck` script

Applied to files:

  • plugins/typebox-validate/package.json
  • tegg/core/ajv-decorator/package.json
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/package.json : Use `workspace:*` protocol for internal monorepo dependencies (both tegg and egg packages)

Applied to files:

  • plugins/typebox-validate/package.json
  • packages/egg/src/ajv.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/pnpm-workspace.yaml : Use pnpm workspaces with `catalog:` protocol for shared external dependencies

Applied to files:

  • plugins/typebox-validate/package.json
  • pnpm-workspace.yaml
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/.oxlintrc.json : Run oxlint with `--type-aware` flag for enhanced TypeScript checking on all packages

Applied to files:

  • plugins/typebox-validate/package.json
  • tegg/core/ajv-decorator/package.json
📚 Learning: 2025-12-20T09:24:59.960Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Applies to **/*.{ts,tsx,js,mjs} : Use `.ts` sources over CommonJS and prefer ESM for exports

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Enable strict mode in all TypeScript packages and use explicit return types for public APIs

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/core/ajv-decorator/src/index.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/src/typebox.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
📚 Learning: 2025-11-27T14:37:59.711Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T14:37:59.711Z
Learning: Applies to packages/**/test/**/*.test.ts : Use 'import { describe, it } from "vitest"' for test functions in Vitest test files

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Prefer interfaces over type aliases for object shapes in TypeScript

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
📚 Learning: 2025-11-27T14:37:59.711Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T14:37:59.711Z
Learning: Applies to pnpm-workspace.yaml : Define dependencies in pnpm-workspace.yaml catalog section and reference catalog entries with 'package-name': 'catalog:' or internal workspace dependencies with 'package-name': 'workspace:*'

Applied to files:

  • pnpm-workspace.yaml
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to package.json : Use `workspace:*` for internal package dependencies and `catalog:` for external dependencies defined in pnpm-workspace.yaml

Applied to files:

  • pnpm-workspace.yaml
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/pnpm-workspace.yaml : Centralize all shared dependency versions in the root `pnpm-workspace.yaml` rather than in individual tegg package files

Applied to files:

  • pnpm-workspace.yaml
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: All packages in this monorepo require Node.js >= 22.18.0 - enforce this minimum version across all packages for compatibility with modern JavaScript features and optimal performance

Applied to files:

  • pnpm-workspace.yaml
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/package.json : Node.js version must be >= 22.18.0

Applied to files:

  • pnpm-workspace.yaml
  • tegg/core/ajv-decorator/package.json
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/tsconfig.json : Use `emitDecoratorMetadata` in TypeScript configuration for type inference in dependency injection

Applied to files:

  • tegg/core/ajv-decorator/src/index.ts
  • tegg/core/ajv-decorator/package.json
  • tegg/core/tegg/src/ajv.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to {tsdown,vitest}.config.ts : Use typed intermediate variables for tsdown and vitest config exports with explicit UserConfig/UserWorkspaceConfig type annotations

Applied to files:

  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
📚 Learning: 2025-12-20T09:24:59.960Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Applies to **/*.{ts,tsx} : Name classes in PascalCase

Applied to files:

  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Use readonly modifiers where appropriate in TypeScript classes and interfaces

Applied to files:

  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/core/*/tsconfig.json : Each new core package should include `tsconfig.json` extending `eggjs/tsconfig`

Applied to files:

  • packages/egg/src/ajv.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: Prepare
  • GitHub Check: Test (ubuntu-latest, 24, 2/3)
  • GitHub Check: Test (windows-latest, 22, 1/3)
  • GitHub Check: Test (macos-latest, 24, 2/3)
  • GitHub Check: Test (windows-latest, 20, 2/3)
  • GitHub Check: Test (windows-latest, 20, 1/3)
  • GitHub Check: Test (macos-latest, 24, 3/3)
  • GitHub Check: Test (macos-latest, 24, 1/3)
  • GitHub Check: Test (windows-latest, 22, 2/3)
  • GitHub Check: Test (ubuntu-latest, 22, 1/3)
  • GitHub Check: Test (macos-latest, 22, 1/3)
  • GitHub Check: Test (macos-latest, 22, 2/3)
  • GitHub Check: Test bin (ubuntu-latest, 24, 2/3)
  • GitHub Check: Test bin (ubuntu-latest, 24, 0/3)
  • GitHub Check: Test bin (windows-latest, 24, 1/3)
  • GitHub Check: Test bin (windows-latest, 24, 0/3)
  • GitHub Check: Test bin (windows-latest, 24, 2/3)
  • GitHub Check: Test bin (ubuntu-latest, 24, 1/3)
  • GitHub Check: typecheck
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Cloudflare Pages: egg-v3
🔇 Additional comments (15)
tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts (2)

2-2: LGTM! Import correctly updated to default export pattern.

The import statement properly uses the default export for Type while preserving named imports for Ajv, Static, and TransformEnum. This aligns with the typebox 1.0 migration strategy.


5-12: Schema definition correctly uses imported Type object.

The schema definition seamlessly uses the default-imported Type object with no behavioral changes. The existing usage pattern (Type.Object, Type.String, etc.) remains compatible with the new import style.

plugins/typebox-validate/package.json (1)

61-62: LGTM! Dependency migration to typebox is correct.

The dependency update from @sinclair/typebox to typebox using the catalog: protocol aligns with the TypeBox 1.0 migration strategy.

pnpm-workspace.yaml (2)

227-227: LGTM! Appropriate exclusion for new major version.

Adding typebox to minimumReleaseAgeExclude is appropriate since this is a newly released major version that the project needs to adopt immediately.


21-21: Version 1.0.65 of the typebox package cannot be verified on npm.

While TypeBox 1.0 was released around September 2025, the actual typebox npm package with version 1.0.65 does not appear to be publicly available. The official @sinclair/typebox package remains at version 0.34.41. Verify that the correct package name and version are being used, or confirm whether this migration is to an unreleased version.

tegg/core/ajv-decorator/package.json (1)

44-45: LGTM! Dependency migration is consistent.

The dependency update from @sinclair/typebox to typebox using the catalog: protocol is correct and consistent with the workspace-wide migration.

tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts (1)

2-2: LGTM! Import pattern correctly updated for TypeBox 1.0.

The import statement correctly adapts to the new default export pattern where Type is imported as the default export, while other exports remain as named imports.

tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts (1)

2-2: LGTM! Consistent import pattern update.

The import statement correctly uses the TypeBox 1.0 default export pattern, consistent with other fixtures in the codebase.

tegg/standalone/standalone/test/index.test.ts (1)

309-317: LGTM! More robust schema comparison.

The change from string comparison to parsing and comparing the schema as a JSON object is more resilient to property ordering differences in TypeBox 1.0 and represents a testing best practice.

tegg/core/tegg/src/ajv.ts (1)

2-2: LGTM! Default export re-exported for API completeness.

Adding the default export re-export ensures that consumers can access the TypeBox Type default export through @eggjs/tegg/ajv, maintaining a complete and stable public API surface.

Based on learnings, this thoughtfully preserves API stability.

plugins/typebox-validate/src/typebox.ts (1)

1-4: LGTM! Re-export pattern maintains API stability.

The re-export strategy correctly adapts to TypeBox 1.0's default export pattern while maintaining backward compatibility for existing consumers.

packages/egg/src/ajv.ts (1)

2-2: LGTM! Default export re-export maintains API stability.

The addition of the default export re-export alongside the existing star export preserves backward compatibility while enabling the new typebox 1.0 default import pattern. This aligns with the learning to re-export types thoughtfully.

plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts (1)

4-4: LGTM! Import correctly updated for typebox 1.0.

The change from named import to default import for Type correctly reflects the typebox 1.0 migration pattern, while Static remains as a type-only named export. The usage of Type.Pick on line 9 works identically with this import style.

plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts (1)

4-4: LGTM! Import pattern correctly migrated.

The import statement properly updates to use Type as a default import while keeping Static, TObject, and TProperties as named type imports. All usage sites (lines 6-27) work correctly with this import pattern.

tegg/core/ajv-decorator/src/index.ts (1)

1-4: Typebox 1.0 default export pattern is correct.

The code correctly imports Type as the default export from typebox and re-exports it while maintaining all named exports. TypeBox documentation confirms this pattern with import Type from 'typebox', establishing the proper re-export chain for downstream consumers. The migration assumption is valid.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR successfully migrates the codebase from @sinclair/typebox v0.34.x to the new typebox v1.0.x package. The migration follows the official typebox v1.0 migration guide, adapting to the package rename and new default export pattern.

Key changes:

  • Updated package dependency from @sinclair/typebox to typebox v1.0.65 across all consuming packages
  • Converted all Type imports to use default export pattern instead of named exports
  • Added default export re-exports in wrapper modules for compatibility

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pnpm-workspace.yaml Updated catalog with new typebox package and added to minimumReleaseAgeExclude
pnpm-lock.yaml Lockfile updates reflecting the dependency migration
tegg/core/ajv-decorator/src/index.ts Added default Type import and export for new package structure
tegg/core/ajv-decorator/package.json Replaced @sinclair/typebox with typebox dependency
tegg/core/ajv-decorator/test/snapshots/index.test.ts.snap Updated snapshot to reflect new typebox v1.0 API exports
tegg/core/tegg/src/ajv.ts Added default export passthrough for Type
packages/egg/src/ajv.ts Added default export passthrough for Type
plugins/typebox-validate/src/typebox.ts Added default Type import and export wrapper
plugins/typebox-validate/package.json Replaced @sinclair/typebox with typebox dependency
tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts Updated import to use default export for Type
tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts Updated import to use default export for Type
tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts Updated import to use default export for Type
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts Updated import to use default export for Type
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts Updated import to use default export for Type
tegg/standalone/standalone/test/index.test.ts Fixed schema comparison to use JSON.parse for property order independence
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

fengmk2 and others added 2 commits December 21, 2025 21:55
close #5656

Migrate from @sinclair/typebox v0.34.x to the new typebox v1.0.x package
following the official migration guide. Key changes:

- Package name changed from @sinclair/typebox to typebox
- Type export now uses default export pattern
- Updated all import statements to use default export for Type
- Added default export re-exports in tegg/ajv and egg/ajv modules
- Updated test snapshots for new typebox API exports
- Fixed schema comparison test to use parsed JSON (property order changed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d61e38 and be9b067.

⛔ Files ignored due to path filters (3)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • tegg/core/ajv-decorator/test/__snapshots__/index.test.ts.snap is excluded by !**/*.snap
  • tegg/core/tegg/test/__snapshots__/ajv.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (13)
  • packages/egg/src/ajv.ts (1 hunks)
  • plugins/typebox-validate/package.json (1 hunks)
  • plugins/typebox-validate/src/typebox.ts (1 hunks)
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts (1 hunks)
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts (1 hunks)
  • pnpm-workspace.yaml (2 hunks)
  • tegg/core/ajv-decorator/package.json (1 hunks)
  • tegg/core/ajv-decorator/src/index.ts (1 hunks)
  • tegg/core/tegg/src/ajv.ts (1 hunks)
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts (1 hunks)
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts (1 hunks)
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts (1 hunks)
  • tegg/standalone/standalone/test/index.test.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • pnpm-workspace.yaml
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • tegg/core/ajv-decorator/package.json
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
🧰 Additional context used
📓 Path-based instructions (11)
packages/**/*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

packages/**/*.ts: Use TypeScript throughout all packages in the Eggjs monorepo
Use strict TypeScript mode in all packages

Files:

  • packages/egg/src/ajv.ts
packages/egg/src/**

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Work primarily in 'packages/egg/src/' for core framework features, organizing into lib/, app/extend/, config/, and lib/loader/ directories

Files:

  • packages/egg/src/ajv.ts
**/*.{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (AGENTS.md)

Use .ts sources over CommonJS and prefer ESM for exports

Files:

  • packages/egg/src/ajv.ts
  • plugins/typebox-validate/src/typebox.ts
  • tegg/standalone/standalone/test/index.test.ts
  • tegg/core/tegg/src/ajv.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
{packages,plugins}/**/*.{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (AGENTS.md)

Name files in lowercase with hyphens (e.g. loader-context.ts)

Files:

  • packages/egg/src/ajv.ts
  • plugins/typebox-validate/src/typebox.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Name classes in PascalCase
Name functions and variables in camelCase

**/*.{ts,tsx}: Use explicit return types for all exported functions, methods, and getters to support TypeScript's --isolatedDeclarations flag
Avoid computed property names with symbols in class declarations; use override methods instead for compatibility with --isolatedDeclarations
Add explicit type annotations for class properties, particularly for exported symbols which should use unique symbol type
Enable strict mode in all TypeScript packages and use explicit return types for public APIs
Prefer interfaces over type aliases for object shapes in TypeScript
Use readonly modifiers where appropriate in TypeScript classes and interfaces
Avoid any type; use unknown when type is truly unknown

Files:

  • packages/egg/src/ajv.ts
  • plugins/typebox-validate/src/typebox.ts
  • tegg/standalone/standalone/test/index.test.ts
  • tegg/core/tegg/src/ajv.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
**/test/**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

Configure Vitest to discover **/test/**/*.test.ts within each package and mirror this pattern when adding test suites

Files:

  • tegg/standalone/standalone/test/index.test.ts
tegg/**/*.{js,ts,mjs,cjs}

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

Use ESM only (no CommonJS)

Files:

  • tegg/standalone/standalone/test/index.test.ts
  • tegg/core/tegg/src/ajv.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
tegg/**/*.{ts,tsx}

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

tegg/**/*.{ts,tsx}: Use decorators (@Inject(), @ContextProto(), @SingletonProto()) to define dependency injection and prototype scoping
ContextProto objects can inject any prototype, but SingletonProto cannot inject ContextProto
Use qualifiers (@InitTypeQualifier, @ModuleQualifier, @EggQualifier) when multiple implementations exist to disambiguate
Do not use circular dependencies between prototypes or modules
Use lifecycle hooks (@LifecyclePostConstruct(), @LifecyclePostInject(), @LifecyclePreDestroy(), etc.) for object initialization and cleanup
All imports should use .js extensions for ESM files

Files:

  • tegg/standalone/standalone/test/index.test.ts
  • tegg/core/tegg/src/ajv.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
plugins/*/package.json

📄 CodeRabbit inference engine (CLAUDE.md)

plugins/*/package.json: All plugins must include egg in peerDependencies and define build, clean, and prepublishOnly scripts in package.json
Plugin packages must configure exports in package.json with both development (./src/*.ts) and published (./dist/*.js) entry points

Files:

  • plugins/typebox-validate/package.json
tegg/core/*/src/index.ts

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

Core packages should export public API through src/index.ts

Files:

  • tegg/core/ajv-decorator/src/index.ts
**/test/fixtures/**

📄 CodeRabbit inference engine (AGENTS.md)

Place reusable test data under test/fixtures/

Files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
🧠 Learnings (24)
📓 Common learnings
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Re-export types thoughtfully to keep the public API stable
Learnt from: CR
Repo: eggjs/egg PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T14:37:59.711Z
Learning: Applies to packages/**/test/**/*.test.ts : Use Node.js built-in 'assert' module for assertions in tests
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to test/**/*.test.ts : Use standard assertions with Node.js built-in `assert` module in test files instead of external assertion libraries
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/core/*/package.json : New core packages should include standard scripts in `package.json` with `typecheck` script using tsgo
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: All packages must include TypeScript type checking with `tsc --noEmit` in the `typecheck` script
Learnt from: CR
Repo: eggjs/egg PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T14:37:59.711Z
Learning: Applies to packages/**/*.ts : Use TypeScript throughout all packages in the Eggjs monorepo
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Enable strict mode in all TypeScript packages and use explicit return types for public APIs
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Add regression cases that exercise both CommonJS and TypeScript example apps when features affect HTTP or process orchestration
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Add explicit type annotations for class properties, particularly for exported symbols which should use `unique symbol` type
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/core/*/src/index.ts : Core packages should export public API through `src/index.ts`

Applied to files:

  • packages/egg/src/ajv.ts
  • plugins/typebox-validate/src/typebox.ts
  • tegg/core/tegg/src/ajv.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: All packages must define a `src/types.ts` file that extends the Egg module declarations using `declare module 'egg'` pattern

Applied to files:

  • packages/egg/src/ajv.ts
  • plugins/typebox-validate/package.json
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-11-27T14:37:59.711Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T14:37:59.711Z
Learning: Applies to packages/**/*.ts : Use TypeScript throughout all packages in the Eggjs monorepo

Applied to files:

  • packages/egg/src/ajv.ts
  • plugins/typebox-validate/package.json
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-20T09:24:59.960Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Re-export types thoughtfully to keep the public API stable

Applied to files:

  • packages/egg/src/ajv.ts
  • plugins/typebox-validate/src/typebox.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/package.json : Egg.js version must be >= 4.1.0

Applied to files:

  • packages/egg/src/ajv.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/package.json : Use `workspace:*` protocol for internal monorepo dependencies (both tegg and egg packages)

Applied to files:

  • packages/egg/src/ajv.ts
  • plugins/typebox-validate/package.json
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{js,ts,mjs,cjs} : Use ESM only (no CommonJS)

Applied to files:

  • packages/egg/src/ajv.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Use explicit return types for all exported functions, methods, and getters to support TypeScript's `--isolatedDeclarations` flag

Applied to files:

  • plugins/typebox-validate/src/typebox.ts
  • tegg/core/ajv-decorator/src/index.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Add explicit type annotations for class properties, particularly for exported symbols which should use `unique symbol` type

Applied to files:

  • plugins/typebox-validate/src/typebox.ts
  • tegg/core/ajv-decorator/src/index.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Enable strict mode in all TypeScript packages and use explicit return types for public APIs

Applied to files:

  • plugins/typebox-validate/src/typebox.ts
  • tegg/core/ajv-decorator/src/index.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to test/**/*.test.ts : Use standard assertions with Node.js built-in `assert` module in test files instead of external assertion libraries

Applied to files:

  • tegg/standalone/standalone/test/index.test.ts
📚 Learning: 2025-11-27T14:37:59.711Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T14:37:59.711Z
Learning: Applies to packages/**/test/**/*.test.ts : Use Node.js built-in 'assert' module for assertions in tests

Applied to files:

  • tegg/standalone/standalone/test/index.test.ts
📚 Learning: 2025-12-20T09:24:59.960Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Add regression cases that exercise both CommonJS and TypeScript example apps when features affect HTTP or process orchestration

Applied to files:

  • tegg/standalone/standalone/test/index.test.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/core/*/package.json : New core packages should include standard scripts in `package.json` with `typecheck` script using tsgo

Applied to files:

  • plugins/typebox-validate/package.json
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: All packages must include TypeScript type checking with `tsc --noEmit` in the `typecheck` script

Applied to files:

  • plugins/typebox-validate/package.json
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/pnpm-workspace.yaml : Use pnpm workspaces with `catalog:` protocol for shared external dependencies

Applied to files:

  • plugins/typebox-validate/package.json
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/.oxlintrc.json : Run oxlint with `--type-aware` flag for enhanced TypeScript checking on all packages

Applied to files:

  • plugins/typebox-validate/package.json
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/tsconfig.json : Use `emitDecoratorMetadata` in TypeScript configuration for type inference in dependency injection

Applied to files:

  • tegg/core/tegg/src/ajv.ts
  • tegg/core/ajv-decorator/src/index.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : Use decorators (`Inject()`, `ContextProto()`, `SingletonProto()`) to define dependency injection and prototype scoping

Applied to files:

  • tegg/core/ajv-decorator/src/index.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-20T09:24:59.960Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Applies to **/*.{ts,tsx,js,mjs} : Use `.ts` sources over CommonJS and prefer ESM for exports

Applied to files:

  • tegg/core/ajv-decorator/src/index.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : All imports should use `.js` extensions for ESM files

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : Use qualifiers (`InitTypeQualifier`, `ModuleQualifier`, `EggQualifier`) when multiple implementations exist to disambiguate

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : Do not use circular dependencies between prototypes or modules

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: Test (ubuntu-latest, 20, 2/3)
  • GitHub Check: Test (macos-latest, 24, 2/3)
  • GitHub Check: Test (macos-latest, 22, 2/3)
  • GitHub Check: Test (macos-latest, 20, 2/3)
  • GitHub Check: Test (macos-latest, 24, 1/3)
  • GitHub Check: Test (ubuntu-latest, 22, 2/3)
  • GitHub Check: Test (ubuntu-latest, 24, 3/3)
  • GitHub Check: Test (ubuntu-latest, 20, 3/3)
  • GitHub Check: Test (macos-latest, 22, 3/3)
  • GitHub Check: Test bin (windows-latest, 24, 1/3)
  • GitHub Check: Test bin (windows-latest, 24, 0/3)
  • GitHub Check: Test bin (ubuntu-latest, 24, 2/3)
  • GitHub Check: Test bin (ubuntu-latest, 24, 0/3)
  • GitHub Check: Test bin (ubuntu-latest, 24, 1/3)
  • GitHub Check: Test bin (windows-latest, 24, 2/3)
  • GitHub Check: typecheck
  • GitHub Check: cnpmcore E2E test
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Cloudflare Pages: egg-v3
🔇 Additional comments (6)
tegg/standalone/standalone/test/index.test.ts (1)

309-317: Appropriate fix for schema comparison.

Using JSON.parse() with deepEqual is the correct approach when property ordering may differ between typebox versions. This makes the test resilient to serialization order changes while still validating semantic correctness.

packages/egg/src/ajv.ts (1)

1-2: LGTM!

The added default export re-export correctly propagates the Type default export from the upstream module, maintaining a stable public API while supporting the new typebox 1.0 import pattern. Based on learnings, this thoughtful re-export approach keeps the public API stable.

tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts (1)

2-2: Import pattern correctly updated for typebox 1.0.

The migration from named to default import for Type follows the typebox 1.0 API change. The usage of Type.Object(), Type.String(), etc. remains unchanged, confirming backward-compatible behavior.

plugins/typebox-validate/src/typebox.ts (1)

1-4: Clean re-export module for typebox 1.0.

The module correctly bridges the new typebox package by:

  1. Importing Type as the default export from typebox
  2. Re-exporting all named exports for type utilities (Static, TSchema, etc.)
  3. Re-exporting Type as the default for schema builders

This maintains a stable public API for the plugin's consumers. Based on learnings, this re-export pattern is thoughtfully designed.

tegg/core/tegg/src/ajv.ts (1)

2-2: LGTM! Default export re-export completes the migration chain.

This re-export enables consumers to access the Type object via import Type from '@eggjs/tegg/ajv', maintaining API stability while supporting the typebox 1.0 default export pattern.

tegg/core/ajv-decorator/src/index.ts (1)

1-4: typebox dependency verified and properly configured.

The typebox package (v1.0.65) is correctly declared in dependencies via the monorepo catalog. The package configuration meets all requirements: Node.js >=22.18.0, typecheck script with tsgo, ESM-only setup, and proper export pattern for core packages. The migration from @sinclair/typebox to typebox and the default export pattern align with the typebox 1.0 migration guide.

Copilot AI review requested due to automatic review settings December 21, 2025 14:06
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts (1)

2-2: Consider consistent import ordering for Type across fixtures.

The Type import is positioned at the end of the import list here, but in tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts (line 2), Type is positioned at the beginning. While both orderings are functionally correct, using a consistent pattern across test fixtures would improve code uniformity.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be9b067 and d4644e1.

⛔ Files ignored due to path filters (2)
  • tegg/core/ajv-decorator/test/__snapshots__/index.test.ts.snap is excluded by !**/*.snap
  • tegg/core/tegg/test/__snapshots__/ajv.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • plugins/typebox-validate/src/typebox.ts (1 hunks)
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts (1 hunks)
  • tegg/core/ajv-decorator/src/index.ts (1 hunks)
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts (1 hunks)
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts (1 hunks)
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • plugins/typebox-validate/src/typebox.ts
  • tegg/core/ajv-decorator/src/index.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (AGENTS.md)

Use .ts sources over CommonJS and prefer ESM for exports

Files:

  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
{packages,plugins}/**/*.{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (AGENTS.md)

Name files in lowercase with hyphens (e.g. loader-context.ts)

Files:

  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Name classes in PascalCase
Name functions and variables in camelCase

**/*.{ts,tsx}: Use explicit return types for all exported functions, methods, and getters to support TypeScript's --isolatedDeclarations flag
Avoid computed property names with symbols in class declarations; use override methods instead for compatibility with --isolatedDeclarations
Add explicit type annotations for class properties, particularly for exported symbols which should use unique symbol type
Enable strict mode in all TypeScript packages and use explicit return types for public APIs
Prefer interfaces over type aliases for object shapes in TypeScript
Use readonly modifiers where appropriate in TypeScript classes and interfaces
Avoid any type; use unknown when type is truly unknown

Files:

  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
**/test/fixtures/**

📄 CodeRabbit inference engine (AGENTS.md)

Place reusable test data under test/fixtures/

Files:

  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
tegg/**/*.{js,ts,mjs,cjs}

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

Use ESM only (no CommonJS)

Files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
tegg/**/*.{ts,tsx}

📄 CodeRabbit inference engine (tegg/CLAUDE.md)

tegg/**/*.{ts,tsx}: Use decorators (@Inject(), @ContextProto(), @SingletonProto()) to define dependency injection and prototype scoping
ContextProto objects can inject any prototype, but SingletonProto cannot inject ContextProto
Use qualifiers (@InitTypeQualifier, @ModuleQualifier, @EggQualifier) when multiple implementations exist to disambiguate
Do not use circular dependencies between prototypes or modules
Use lifecycle hooks (@LifecyclePostConstruct(), @LifecyclePostInject(), @LifecyclePreDestroy(), etc.) for object initialization and cleanup
All imports should use .js extensions for ESM files

Files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
🧠 Learnings (16)
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : All imports should use `.js` extensions for ESM files

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : Do not use circular dependencies between prototypes or modules

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/core/*/src/index.ts : Core packages should export public API through `src/index.ts`

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/package.json : Egg.js version must be >= 4.1.0

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{js,ts,mjs,cjs} : Use ESM only (no CommonJS)

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/tsconfig.json : Use `emitDecoratorMetadata` in TypeScript configuration for type inference in dependency injection

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
📚 Learning: 2025-12-20T09:24:59.960Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Re-export types thoughtfully to keep the public API stable

Applied to files:

  • tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts
  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Add explicit type annotations for class properties, particularly for exported symbols which should use `unique symbol` type

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Use explicit return types for all exported functions, methods, and getters to support TypeScript's `--isolatedDeclarations` flag

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Prefer interfaces over type aliases for object shapes in TypeScript

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-20T09:24:59.960Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-20T09:24:59.960Z
Learning: Applies to **/*.{ts,tsx,js,mjs} : Use `.ts` sources over CommonJS and prefer ESM for exports

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to test/**/*.test.ts : Use standard assertions with Node.js built-in `assert` module in test files instead of external assertion libraries

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:04:53.982Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-21T03:04:53.982Z
Learning: Applies to **/*.{ts,tsx} : Enable strict mode in all TypeScript packages and use explicit return types for public APIs

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : Use decorators (`Inject()`, `ContextProto()`, `SingletonProto()`) to define dependency injection and prototype scoping

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/*.{ts,tsx} : ContextProto objects can inject any prototype, but SingletonProto cannot inject ContextProto

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
📚 Learning: 2025-12-21T03:05:13.313Z
Learnt from: CR
Repo: eggjs/egg PR: 0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-12-21T03:05:13.313Z
Learning: Applies to tegg/**/__tests__/**/*.test.{ts,tsx} : Use `MockApplication` from `eggjs/mock` for testing with `mockModuleContextScope()` to create context scope

Applied to files:

  • tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: Agent
  • GitHub Check: Test (macos-latest, 22, 3/3)
  • GitHub Check: Test (ubuntu-latest, 20, 3/3)
  • GitHub Check: Test (ubuntu-latest, 24, 1/3)
  • GitHub Check: Test (macos-latest, 20, 2/3)
  • GitHub Check: Test (ubuntu-latest, 20, 1/3)
  • GitHub Check: Test (windows-latest, 20, 2/3)
  • GitHub Check: Test (macos-latest, 22, 2/3)
  • GitHub Check: Test (ubuntu-latest, 22, 2/3)
  • GitHub Check: Test (ubuntu-latest, 22, 1/3)
  • GitHub Check: Test (windows-latest, 22, 3/3)
  • GitHub Check: Test bin (ubuntu-latest, 24, 2/3)
  • GitHub Check: Test bin (windows-latest, 24, 2/3)
  • GitHub Check: Test bin (ubuntu-latest, 24, 1/3)
  • GitHub Check: Test bin (windows-latest, 24, 1/3)
  • GitHub Check: Test bin (windows-latest, 24, 0/3)
  • GitHub Check: Test bin (ubuntu-latest, 24, 0/3)
  • GitHub Check: typecheck
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Cloudflare Pages: egg-v3
🔇 Additional comments (2)
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts (1)

4-4: LGTM! Import reordering with no functional impact.

The import order change is purely cosmetic and does not affect functionality.

tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts (1)

2-2: Import ordering already flagged in FooController.ts.

This import ordering (Type at beginning) is the other side of the inconsistency already noted in the review comment for tegg/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/FooController.ts line 2.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 15 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@@ -1,5 +1,5 @@
import { HTTPController, HTTPMethod, HTTPMethodEnum, Inject, HTTPBody } from '@eggjs/tegg';
import { type Ajv, type Static, Type, TransformEnum, type TSchema } from '@eggjs/tegg/ajv';
import { type Ajv, type Static, TransformEnum, type TSchema, Type } from '@eggjs/tegg/ajv';
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import ordering for Type is inconsistent with other files in this PR. In this file, Type is placed last, but in other files being updated (like tegg/standalone/standalone/test/fixtures/ajv-module/foo.ts and tegg/standalone/standalone/test/fixtures/ajv-module-pass/foo.ts), Type is placed first. Consider standardizing the import order to have Type either consistently first or consistently last across all files.

Suggested change
import { type Ajv, type Static, TransformEnum, type TSchema, Type } from '@eggjs/tegg/ajv';
import { Type, type Ajv, type Static, TransformEnum, type TSchema } from '@eggjs/tegg/ajv';

Copilot uses AI. Check for mistakes.
@fengmk2 fengmk2 merged commit e0b74ed into next Dec 21, 2025
31 of 50 checks passed
@fengmk2 fengmk2 deleted the typebox-1.0 branch December 21, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

upgrade to typebox 1.0

2 participants